Version Description
- Feature - Added defaults to configuration.php which allows users to define the default PDF settings for all Gravity Forms. See the installation and configuration documentation for more details.
- Feature - Added three new configuration options 'default-show-html', 'default-show-empty' and 'default-show-page-names' which allow different display options to the three default templates. See the installation and configuration documentation for more details.
- Feature - Added filter hooks 'gfpdfe_pdf_name' and 'gfpdfe_template' which allows developers to further modify a PDF name and template file, respectively, outside of the configuration.php. This is useful if you have a special case naming convention based on user input. See http://gravityformspdfextended.com/filters-and-hooks/ for more details about using these filters.
- Feature - Custom font support. Any .ttf font file added to the PDF_EXTENDED_TEMPLATE/fonts/ folder will be automatically installed once the plugin has been initialised. Users also have the option to just initialise the fonts via the settings page. See the font/language documentation for details.
- Compatability - Use Gravity Forms get_upload_root() and get_upload_url_root() instead of hard coding the signature upload directory in pdf-entry-detail.php
- Compatability - Changed depreciated functions get_themes() and get_theme() to wp_get_theme() (added in Wordpress v3.4).
- Compatability - The plugin now needs to be initialised on fresh installation and upgrade. This allows us to use the WP_Filesystem API for file manipulation.
- Compatability - Automatic copying of PDF_EXTENDED_TEMPLATE folder on a theme change was removed in favour of a user prompt. This allows us to take advantage of the WP_Filesystem API.
- Compatability - Added Wordpress compatibility checker (minimum now 3.4 or higher).
- Bug - Removed ZipArchive in favour of Wordpress's WP_Filesystem API unzip_file() command. Some users reported the plugin would stop their entire website working if this extension wasn't installed.
- Bug - Fixed Gravity Forms compatibility checker which wouldn't return the correct response.
- Bug - Fixed minor bug in pdf.php when using static call 'self' in add_filter hook. Changed to class name.
- Bug - Removed PHP notice about $even variable not being defined in pdf-entry-detail.php
- Bug - Prevent code from continuing to excecute after sending header redirect.
Download this release
Release Info
Developer | Blue Liquid Designs |
Plugin | Gravity PDF |
Version | 3.1.0 |
Comparing to | |
See all releases |
Code changes from version 3.6.0 to 3.1.0
- LICENSE +0 -339
- README.txt +217 -469
- initialisation/configuration.php.example → configuration.php +300 -390
- depreciated.php +0 -24
- helper/data.php +0 -70
- helper/installation-update-manager.php +0 -658
- helper/notices.php +0 -376
- helper/pdf-common.php +0 -273
- helper/pdf-configuration-indexer.php +0 -417
- helper/pdf-entry-detail.php +0 -1908
- helper/pdf-render.php +0 -320
- images/_notes/dwsync.xml +5 -0
- {resources/images → images}/alpha.gif +0 -0
- {resources/images → images}/alpha.png +0 -0
- {resources/images → images}/alpha3.png +0 -0
- {resources/images → images}/bayeux1.jpg +0 -0
- {resources/images → images}/bg.jpg +0 -0
- {resources/images → images}/bgbarcode.png +0 -0
- {resources/images → images}/bgrock.jpg +0 -0
- {resources/images → images}/borders2FF.jpg +0 -0
- {resources/images → images}/borders2IE.jpg +0 -0
- {resources/images → images}/borders3FF.jpg +0 -0
- {resources/images → images}/borders3IE.jpg +0 -0
- {resources/images → images}/borders4FF.jpg +0 -0
- {resources/images → images}/borders4IE.jpg +0 -0
- {resources/images → images}/bordersFF.jpg +0 -0
- {resources/images → images}/bordersIE.jpg +0 -0
- {resources/images → images}/bordersMPDF2.jpg +0 -0
- {resources/images → images}/clematis.jpg +0 -0
- {resources/images → images}/firefox-48.png +0 -0
- {resources/images → images}/flowers-pattern.jpg +0 -0
- {resources/images → images}/goto.gif +0 -0
- images/gravityformspdfextended.jpg +0 -0
- {resources/images → images}/img1.png +0 -0
- {resources/images → images}/img2.png +0 -0
- {resources/images → images}/img3.png +0 -0
- {resources/images → images}/img4.png +0 -0
- {resources/images → images}/img5.png +0 -0
- {resources/images → images}/klematis.jpg +0 -0
- {resources/images → images}/loading.gif +0 -0
- {resources/images → images}/mpdfstyleA4.css +0 -0
- {resources/images → images}/mpdfstylePaged.css +0 -0
- {resources/images → images}/mpdfstyletables.css +0 -0
- {resources/images → images}/quran282.jpg +0 -0
- {resources/images → images}/signature.png +0 -0
- {resources/images → images}/sunset.jpg +0 -0
- {resources/images → images}/sunsetv.jpg +0 -0
- {resources/images → images}/tiger.bmp +0 -0
- {resources/images → images}/tiger.gif +0 -0
- {resources/images → images}/tiger.jpg +0 -0
- {resources/images → images}/tiger.png +0 -0
- {resources/images → images}/tiger.svg +0 -0
- {resources/images → images}/tiger.wmf +0 -0
- {resources/images → images}/tiger2.png +0 -0
- {resources/images → images}/tiger2.wmf +0 -0
- {resources/images → images}/tiger24trns.png +0 -0
- {resources/images → images}/tiger300px300dpi.jpg +0 -0
- {resources/images → images}/tiger300px300dpi.png +0 -0
- {resources/images → images}/tiger300px72dpi.jpg +0 -0
- {resources/images → images}/tiger300px96dpi.jpg +0 -0
- {resources/images → images}/tiger300px96dpi.png +0 -0
- {resources/images → images}/tiger8trns.gif +0 -0
- {resources/images → images}/tiger8trns.png +0 -0
- {resources/images → images}/tigercmyk.jpg +0 -0
- {resources/images → images}/windmill.jpg +0 -0
- initialisation/template.css +0 -132
- initialisation/templates/default-template-no-style.php +0 -47
- initialisation/templates/default-template-two-rows.php +0 -47
- initialisation/templates/default-template.php +0 -45
- initialisation/templates/example-advanced-headers_07.php +0 -110
- initialisation/templates/example-backgrounds-and-borders02.php +0 -164
- initialisation/templates/example-basic-html01.php +0 -157
- initialisation/templates/example-different-page-size_08.php +0 -82
- initialisation/templates/example-float-and-positioning05.php +0 -157
- initialisation/templates/example-header-and-footer_06.php +0 -109
- initialisation/templates/example-images03.php +0 -240
- initialisation/templates/example-tables04.php +0 -1732
- initialisation/templates/example-template.php +0 -95
- initialisation/templates/example-watermark09.php +0 -136
- installation-update-manager.php +518 -0
- languages/pdfextended-en_GB.po +0 -856
- languages/pdfextended-fr_FR.mo +0 -0
- languages/pdfextended-fr_FR.po +0 -1024
- mPDF.zip +0 -0
- mPDF/CHANGELOG.txt +0 -25
- mPDF/CREDITS.txt +0 -92
- mPDF/FONT INFO.txt +0 -164
- mPDF/LICENSE.txt +0 -340
- mPDF/README.txt +0 -5
- mPDF/classes/barcode.php +0 -1966
- mPDF/classes/bmp.php +0 -248
- mPDF/classes/cssmgr.php +0 -1602
- mPDF/classes/directw.php +0 -408
- mPDF/classes/form.php +0 -1498
- mPDF/classes/gif.php +0 -700
- mPDF/classes/grad.php +0 -723
- mPDF/classes/indic.php +0 -433
- mPDF/classes/meter.php +0 -224
- mPDF/classes/svg.php +0 -2600
- mPDF/classes/tocontents.php +0 -468
- mPDF/classes/ttfontsuni.php +0 -2066
- mPDF/classes/ttfontsuni_analysis.php +0 -463
- mPDF/classes/wmf.php +0 -236
- mPDF/compress.php +0 -172
- mPDF/config.php +0 -241
LICENSE
DELETED
@@ -1,339 +0,0 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 2, June 1991
|
3 |
-
|
4 |
-
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
5 |
-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
-
Everyone is permitted to copy and distribute verbatim copies
|
7 |
-
of this license document, but changing it is not allowed.
|
8 |
-
|
9 |
-
Preamble
|
10 |
-
|
11 |
-
The licenses for most software are designed to take away your
|
12 |
-
freedom to share and change it. By contrast, the GNU General Public
|
13 |
-
License is intended to guarantee your freedom to share and change free
|
14 |
-
software--to make sure the software is free for all its users. This
|
15 |
-
General Public License applies to most of the Free Software
|
16 |
-
Foundation's software and to any other program whose authors commit to
|
17 |
-
using it. (Some other Free Software Foundation software is covered by
|
18 |
-
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
-
your programs, too.
|
20 |
-
|
21 |
-
When we speak of free software, we are referring to freedom, not
|
22 |
-
price. Our General Public Licenses are designed to make sure that you
|
23 |
-
have the freedom to distribute copies of free software (and charge for
|
24 |
-
this service if you wish), that you receive source code or can get it
|
25 |
-
if you want it, that you can change the software or use pieces of it
|
26 |
-
in new free programs; and that you know you can do these things.
|
27 |
-
|
28 |
-
To protect your rights, we need to make restrictions that forbid
|
29 |
-
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
-
These restrictions translate to certain responsibilities for you if you
|
31 |
-
distribute copies of the software, or if you modify it.
|
32 |
-
|
33 |
-
For example, if you distribute copies of such a program, whether
|
34 |
-
gratis or for a fee, you must give the recipients all the rights that
|
35 |
-
you have. You must make sure that they, too, receive or can get the
|
36 |
-
source code. And you must show them these terms so they know their
|
37 |
-
rights.
|
38 |
-
|
39 |
-
We protect your rights with two steps: (1) copyright the software, and
|
40 |
-
(2) offer you this license which gives you legal permission to copy,
|
41 |
-
distribute and/or modify the software.
|
42 |
-
|
43 |
-
Also, for each author's protection and ours, we want to make certain
|
44 |
-
that everyone understands that there is no warranty for this free
|
45 |
-
software. If the software is modified by someone else and passed on, we
|
46 |
-
want its recipients to know that what they have is not the original, so
|
47 |
-
that any problems introduced by others will not reflect on the original
|
48 |
-
authors' reputations.
|
49 |
-
|
50 |
-
Finally, any free program is threatened constantly by software
|
51 |
-
patents. We wish to avoid the danger that redistributors of a free
|
52 |
-
program will individually obtain patent licenses, in effect making the
|
53 |
-
program proprietary. To prevent this, we have made it clear that any
|
54 |
-
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
-
|
56 |
-
The precise terms and conditions for copying, distribution and
|
57 |
-
modification follow.
|
58 |
-
|
59 |
-
GNU GENERAL PUBLIC LICENSE
|
60 |
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
-
|
62 |
-
0. This License applies to any program or other work which contains
|
63 |
-
a notice placed by the copyright holder saying it may be distributed
|
64 |
-
under the terms of this General Public License. The "Program", below,
|
65 |
-
refers to any such program or work, and a "work based on the Program"
|
66 |
-
means either the Program or any derivative work under copyright law:
|
67 |
-
that is to say, a work containing the Program or a portion of it,
|
68 |
-
either verbatim or with modifications and/or translated into another
|
69 |
-
language. (Hereinafter, translation is included without limitation in
|
70 |
-
the term "modification".) Each licensee is addressed as "you".
|
71 |
-
|
72 |
-
Activities other than copying, distribution and modification are not
|
73 |
-
covered by this License; they are outside its scope. The act of
|
74 |
-
running the Program is not restricted, and the output from the Program
|
75 |
-
is covered only if its contents constitute a work based on the
|
76 |
-
Program (independent of having been made by running the Program).
|
77 |
-
Whether that is true depends on what the Program does.
|
78 |
-
|
79 |
-
1. You may copy and distribute verbatim copies of the Program's
|
80 |
-
source code as you receive it, in any medium, provided that you
|
81 |
-
conspicuously and appropriately publish on each copy an appropriate
|
82 |
-
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
-
notices that refer to this License and to the absence of any warranty;
|
84 |
-
and give any other recipients of the Program a copy of this License
|
85 |
-
along with the Program.
|
86 |
-
|
87 |
-
You may charge a fee for the physical act of transferring a copy, and
|
88 |
-
you may at your option offer warranty protection in exchange for a fee.
|
89 |
-
|
90 |
-
2. You may modify your copy or copies of the Program or any portion
|
91 |
-
of it, thus forming a work based on the Program, and copy and
|
92 |
-
distribute such modifications or work under the terms of Section 1
|
93 |
-
above, provided that you also meet all of these conditions:
|
94 |
-
|
95 |
-
a) You must cause the modified files to carry prominent notices
|
96 |
-
stating that you changed the files and the date of any change.
|
97 |
-
|
98 |
-
b) You must cause any work that you distribute or publish, that in
|
99 |
-
whole or in part contains or is derived from the Program or any
|
100 |
-
part thereof, to be licensed as a whole at no charge to all third
|
101 |
-
parties under the terms of this License.
|
102 |
-
|
103 |
-
c) If the modified program normally reads commands interactively
|
104 |
-
when run, you must cause it, when started running for such
|
105 |
-
interactive use in the most ordinary way, to print or display an
|
106 |
-
announcement including an appropriate copyright notice and a
|
107 |
-
notice that there is no warranty (or else, saying that you provide
|
108 |
-
a warranty) and that users may redistribute the program under
|
109 |
-
these conditions, and telling the user how to view a copy of this
|
110 |
-
License. (Exception: if the Program itself is interactive but
|
111 |
-
does not normally print such an announcement, your work based on
|
112 |
-
the Program is not required to print an announcement.)
|
113 |
-
|
114 |
-
These requirements apply to the modified work as a whole. If
|
115 |
-
identifiable sections of that work are not derived from the Program,
|
116 |
-
and can be reasonably considered independent and separate works in
|
117 |
-
themselves, then this License, and its terms, do not apply to those
|
118 |
-
sections when you distribute them as separate works. But when you
|
119 |
-
distribute the same sections as part of a whole which is a work based
|
120 |
-
on the Program, the distribution of the whole must be on the terms of
|
121 |
-
this License, whose permissions for other licensees extend to the
|
122 |
-
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
-
|
124 |
-
Thus, it is not the intent of this section to claim rights or contest
|
125 |
-
your rights to work written entirely by you; rather, the intent is to
|
126 |
-
exercise the right to control the distribution of derivative or
|
127 |
-
collective works based on the Program.
|
128 |
-
|
129 |
-
In addition, mere aggregation of another work not based on the Program
|
130 |
-
with the Program (or with a work based on the Program) on a volume of
|
131 |
-
a storage or distribution medium does not bring the other work under
|
132 |
-
the scope of this License.
|
133 |
-
|
134 |
-
3. You may copy and distribute the Program (or a work based on it,
|
135 |
-
under Section 2) in object code or executable form under the terms of
|
136 |
-
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
-
|
138 |
-
a) Accompany it with the complete corresponding machine-readable
|
139 |
-
source code, which must be distributed under the terms of Sections
|
140 |
-
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
-
|
142 |
-
b) Accompany it with a written offer, valid for at least three
|
143 |
-
years, to give any third party, for a charge no more than your
|
144 |
-
cost of physically performing source distribution, a complete
|
145 |
-
machine-readable copy of the corresponding source code, to be
|
146 |
-
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
-
customarily used for software interchange; or,
|
148 |
-
|
149 |
-
c) Accompany it with the information you received as to the offer
|
150 |
-
to distribute corresponding source code. (This alternative is
|
151 |
-
allowed only for noncommercial distribution and only if you
|
152 |
-
received the program in object code or executable form with such
|
153 |
-
an offer, in accord with Subsection b above.)
|
154 |
-
|
155 |
-
The source code for a work means the preferred form of the work for
|
156 |
-
making modifications to it. For an executable work, complete source
|
157 |
-
code means all the source code for all modules it contains, plus any
|
158 |
-
associated interface definition files, plus the scripts used to
|
159 |
-
control compilation and installation of the executable. However, as a
|
160 |
-
special exception, the source code distributed need not include
|
161 |
-
anything that is normally distributed (in either source or binary
|
162 |
-
form) with the major components (compiler, kernel, and so on) of the
|
163 |
-
operating system on which the executable runs, unless that component
|
164 |
-
itself accompanies the executable.
|
165 |
-
|
166 |
-
If distribution of executable or object code is made by offering
|
167 |
-
access to copy from a designated place, then offering equivalent
|
168 |
-
access to copy the source code from the same place counts as
|
169 |
-
distribution of the source code, even though third parties are not
|
170 |
-
compelled to copy the source along with the object code.
|
171 |
-
|
172 |
-
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
-
except as expressly provided under this License. Any attempt
|
174 |
-
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
-
void, and will automatically terminate your rights under this License.
|
176 |
-
However, parties who have received copies, or rights, from you under
|
177 |
-
this License will not have their licenses terminated so long as such
|
178 |
-
parties remain in full compliance.
|
179 |
-
|
180 |
-
5. You are not required to accept this License, since you have not
|
181 |
-
signed it. However, nothing else grants you permission to modify or
|
182 |
-
distribute the Program or its derivative works. These actions are
|
183 |
-
prohibited by law if you do not accept this License. Therefore, by
|
184 |
-
modifying or distributing the Program (or any work based on the
|
185 |
-
Program), you indicate your acceptance of this License to do so, and
|
186 |
-
all its terms and conditions for copying, distributing or modifying
|
187 |
-
the Program or works based on it.
|
188 |
-
|
189 |
-
6. Each time you redistribute the Program (or any work based on the
|
190 |
-
Program), the recipient automatically receives a license from the
|
191 |
-
original licensor to copy, distribute or modify the Program subject to
|
192 |
-
these terms and conditions. You may not impose any further
|
193 |
-
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
-
You are not responsible for enforcing compliance by third parties to
|
195 |
-
this License.
|
196 |
-
|
197 |
-
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
-
infringement or for any other reason (not limited to patent issues),
|
199 |
-
conditions are imposed on you (whether by court order, agreement or
|
200 |
-
otherwise) that contradict the conditions of this License, they do not
|
201 |
-
excuse you from the conditions of this License. If you cannot
|
202 |
-
distribute so as to satisfy simultaneously your obligations under this
|
203 |
-
License and any other pertinent obligations, then as a consequence you
|
204 |
-
may not distribute the Program at all. For example, if a patent
|
205 |
-
license would not permit royalty-free redistribution of the Program by
|
206 |
-
all those who receive copies directly or indirectly through you, then
|
207 |
-
the only way you could satisfy both it and this License would be to
|
208 |
-
refrain entirely from distribution of the Program.
|
209 |
-
|
210 |
-
If any portion of this section is held invalid or unenforceable under
|
211 |
-
any particular circumstance, the balance of the section is intended to
|
212 |
-
apply and the section as a whole is intended to apply in other
|
213 |
-
circumstances.
|
214 |
-
|
215 |
-
It is not the purpose of this section to induce you to infringe any
|
216 |
-
patents or other property right claims or to contest validity of any
|
217 |
-
such claims; this section has the sole purpose of protecting the
|
218 |
-
integrity of the free software distribution system, which is
|
219 |
-
implemented by public license practices. Many people have made
|
220 |
-
generous contributions to the wide range of software distributed
|
221 |
-
through that system in reliance on consistent application of that
|
222 |
-
system; it is up to the author/donor to decide if he or she is willing
|
223 |
-
to distribute software through any other system and a licensee cannot
|
224 |
-
impose that choice.
|
225 |
-
|
226 |
-
This section is intended to make thoroughly clear what is believed to
|
227 |
-
be a consequence of the rest of this License.
|
228 |
-
|
229 |
-
8. If the distribution and/or use of the Program is restricted in
|
230 |
-
certain countries either by patents or by copyrighted interfaces, the
|
231 |
-
original copyright holder who places the Program under this License
|
232 |
-
may add an explicit geographical distribution limitation excluding
|
233 |
-
those countries, so that distribution is permitted only in or among
|
234 |
-
countries not thus excluded. In such case, this License incorporates
|
235 |
-
the limitation as if written in the body of this License.
|
236 |
-
|
237 |
-
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
-
of the General Public License from time to time. Such new versions will
|
239 |
-
be similar in spirit to the present version, but may differ in detail to
|
240 |
-
address new problems or concerns.
|
241 |
-
|
242 |
-
Each version is given a distinguishing version number. If the Program
|
243 |
-
specifies a version number of this License which applies to it and "any
|
244 |
-
later version", you have the option of following the terms and conditions
|
245 |
-
either of that version or of any later version published by the Free
|
246 |
-
Software Foundation. If the Program does not specify a version number of
|
247 |
-
this License, you may choose any version ever published by the Free Software
|
248 |
-
Foundation.
|
249 |
-
|
250 |
-
10. If you wish to incorporate parts of the Program into other free
|
251 |
-
programs whose distribution conditions are different, write to the author
|
252 |
-
to ask for permission. For software which is copyrighted by the Free
|
253 |
-
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
-
make exceptions for this. Our decision will be guided by the two goals
|
255 |
-
of preserving the free status of all derivatives of our free software and
|
256 |
-
of promoting the sharing and reuse of software generally.
|
257 |
-
|
258 |
-
NO WARRANTY
|
259 |
-
|
260 |
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
-
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
-
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
-
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
-
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
-
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
-
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
-
REPAIR OR CORRECTION.
|
269 |
-
|
270 |
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
-
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
-
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
-
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
-
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
-
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
-
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
-
POSSIBILITY OF SUCH DAMAGES.
|
279 |
-
|
280 |
-
END OF TERMS AND CONDITIONS
|
281 |
-
|
282 |
-
How to Apply These Terms to Your New Programs
|
283 |
-
|
284 |
-
If you develop a new program, and you want it to be of the greatest
|
285 |
-
possible use to the public, the best way to achieve this is to make it
|
286 |
-
free software which everyone can redistribute and change under these terms.
|
287 |
-
|
288 |
-
To do so, attach the following notices to the program. It is safest
|
289 |
-
to attach them to the start of each source file to most effectively
|
290 |
-
convey the exclusion of warranty; and each file should have at least
|
291 |
-
the "copyright" line and a pointer to where the full notice is found.
|
292 |
-
|
293 |
-
{description}
|
294 |
-
Copyright (C) {year} {fullname}
|
295 |
-
|
296 |
-
This program is free software; you can redistribute it and/or modify
|
297 |
-
it under the terms of the GNU General Public License as published by
|
298 |
-
the Free Software Foundation; either version 2 of the License, or
|
299 |
-
(at your option) any later version.
|
300 |
-
|
301 |
-
This program is distributed in the hope that it will be useful,
|
302 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
-
GNU General Public License for more details.
|
305 |
-
|
306 |
-
You should have received a copy of the GNU General Public License along
|
307 |
-
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
-
|
310 |
-
Also add information on how to contact you by electronic and paper mail.
|
311 |
-
|
312 |
-
If the program is interactive, make it output a short notice like this
|
313 |
-
when it starts in an interactive mode:
|
314 |
-
|
315 |
-
Gnomovision version 69, Copyright (C) year name of author
|
316 |
-
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
-
This is free software, and you are welcome to redistribute it
|
318 |
-
under certain conditions; type `show c' for details.
|
319 |
-
|
320 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
-
parts of the General Public License. Of course, the commands you use may
|
322 |
-
be called something other than `show w' and `show c'; they could even be
|
323 |
-
mouse-clicks or menu items--whatever suits your program.
|
324 |
-
|
325 |
-
You should also get your employer (if you work as a programmer) or your
|
326 |
-
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
-
necessary. Here is a sample; alter the names:
|
328 |
-
|
329 |
-
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
-
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
-
|
332 |
-
{signature of Ty Coon}, 1 April 1989
|
333 |
-
Ty Coon, President of Vice
|
334 |
-
|
335 |
-
This General Public License does not permit incorporating your program into
|
336 |
-
proprietary programs. If your program is a subroutine library, you may
|
337 |
-
consider it more useful to permit linking proprietary applications with the
|
338 |
-
library. If this is what you want to do, use the GNU Lesser General
|
339 |
-
Public License instead of this License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.txt
CHANGED
@@ -1,469 +1,217 @@
|
|
1 |
-
=== Plugin Name ===
|
2 |
-
Contributors: blueliquiddesigns
|
3 |
-
Donate link:
|
4 |
-
Tags: gravity, forms, pdf, automation, attachment
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 3.
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
Gravity PDF allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission.
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
Gravity PDF
|
16 |
-
|
17 |
-
**
|
18 |
-
|
19 |
-
* Save PDF File on user submission of a Gravity Form so it can be attached to a notification
|
20 |
-
* Customise the PDF template without affecting the core Gravity Form Plugin
|
21 |
-
* Multiple PDF Templates
|
22 |
-
* Custom PDF Name
|
23 |
-
* Output individual form fields in the template - like MERGETAGS.
|
24 |
-
* View and download a PDF via the administrator interface
|
25 |
-
*
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
*
|
33 |
-
*
|
34 |
-
*
|
35 |
-
*
|
36 |
-
*
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
*
|
41 |
-
*
|
42 |
-
*
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
* Feature -
|
86 |
-
*
|
87 |
-
*
|
88 |
-
*
|
89 |
-
*
|
90 |
-
*
|
91 |
-
*
|
92 |
-
*
|
93 |
-
*
|
94 |
-
*
|
95 |
-
*
|
96 |
-
|
97 |
-
|
98 |
-
*
|
99 |
-
* Bug -
|
100 |
-
|
101 |
-
|
102 |
-
* Bug - Fixed
|
103 |
-
* Bug -
|
104 |
-
*
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
*
|
113 |
-
|
114 |
-
|
115 |
-
*
|
116 |
-
*
|
117 |
-
|
118 |
-
|
119 |
-
*
|
120 |
-
|
121 |
-
|
122 |
-
*
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
*
|
130 |
-
*
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
*
|
136 |
-
|
137 |
-
|
138 |
-
*
|
139 |
-
*
|
140 |
-
|
141 |
-
=
|
142 |
-
* Bug - Fixed
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
*
|
148 |
-
* Bug - Fixed
|
149 |
-
*
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
* Bug -
|
154 |
-
|
155 |
-
=
|
156 |
-
|
157 |
-
*
|
158 |
-
*
|
159 |
-
*
|
160 |
-
*
|
161 |
-
|
162 |
-
|
163 |
-
*
|
164 |
-
*
|
165 |
-
*
|
166 |
-
*
|
167 |
-
*
|
168 |
-
|
169 |
-
*
|
170 |
-
* Housekeeping -
|
171 |
-
* Housekeeping -
|
172 |
-
* Housekeeping -
|
173 |
-
* Housekeeping -
|
174 |
-
|
175 |
-
|
176 |
-
*
|
177 |
-
*
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
*
|
183 |
-
|
184 |
-
|
185 |
-
*
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
*
|
191 |
-
|
192 |
-
=
|
193 |
-
*
|
194 |
-
*
|
195 |
-
*
|
196 |
-
|
197 |
-
=
|
198 |
-
*
|
199 |
-
|
200 |
-
|
201 |
-
*
|
202 |
-
*
|
203 |
-
*
|
204 |
-
|
205 |
-
|
206 |
-
*
|
207 |
-
*
|
208 |
-
*
|
209 |
-
*
|
210 |
-
|
211 |
-
|
212 |
-
*
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
* Feature: $form_data['signature'] et al. keys now contain the signature width and height attributes
|
219 |
-
|
220 |
-
* Housekeeping - Ensure the form and lead IDs are correctly passed throughout the render functions.
|
221 |
-
* Housekeeping - Update settings page link to match new Gravity Forms URL structure
|
222 |
-
* Housekeeping - Check if $lead['gfsurvey_score'] exists before assigning to $form_data array
|
223 |
-
* Housekeeping - Removed table and font checksum debugging from mPDF when WP_DEBUG enabled as they produced inaccurate results.
|
224 |
-
* Housekeeping - Fixed up mPDF logging location when WP_DEBUG enabled. Files now stored in wp-content/themes/Active_Theme_Folder/PDF_EXTENDED_TEMPLATES/output/ folder.
|
225 |
-
* Housekeeping - Removed API logging locally when WP_DEBUG is enabled.
|
226 |
-
* Housekeeping - Increase API timeout interval as some overseas users reported timeout issues
|
227 |
-
* Housekeeping - Modified mPDF functions Image() and purify_utf8_text() to validate the input data so we don't have to do it every time through the template.
|
228 |
-
* Housekeeping - Added ability to not re-deploy every update (not enabled this release as template files were all updated)
|
229 |
-
* Housekeeping - Additional checks on load to see if any of the required file/folder structure is missing. If so, re-initilise.
|
230 |
-
* Housekeeping - Save resources and turn off automatic rtl identification. Users must set the RTL option when configuring form
|
231 |
-
* Housekeeping - Turn off mPDFs packTableData setting, decreasing processing time when working with large tables.
|
232 |
-
* Housekeeping - $gf_pdf_default_configuration options now merge down into existing PDF nodes, instead of applying to only unassigned forms. $gf_pdf_config settings override any in $gf_pdf_default_configuration
|
233 |
-
* Housekeeping - Center aligned Survey Likery field results
|
234 |
-
* Housekeeping - Partially refactored the pdf-entry-detail.php code
|
235 |
-
* Housekeeping - All default and example templates have been tidied. This won't affect custom templates.
|
236 |
-
* Housekeeping - Set the gform_notification order number to 100 which will prevent other functions (example snippets from Gravity Forms, for instance) from overridding the attached PDF.
|
237 |
-
* Housekeeping - Fix spelling mistake on initialising fonts
|
238 |
-
* Housekeeping - Remove wpautop() function from Gravity Form HTML output, which was applied before rendering and was messing up the HTML markup.
|
239 |
-
* Housekeeping - Remove empty list rows from the $form_data['list'] array in single and multi-column lists.
|
240 |
-
* Housekeeping - Apply same CSS styles (padding, border and line height) to HTML fields as done to form values in default templates
|
241 |
-
* Housekeeping - Replaced arbitrary wrapper IDs in the default templates with the actual field ID
|
242 |
-
|
243 |
-
* Bug - Fixed signature rendering issue when custom signature size was being used
|
244 |
-
* Bug - Fixed static error types in helper/install-update-manager.php file.
|
245 |
-
* Bug - Fixed redeployment error message which wasn't showing correctly
|
246 |
-
* Bug - Fixed issue with PDF not attaching to notification using Paypal's delayed notification feature
|
247 |
-
* Bug - Fixed strict standard warning about calling GFPDF_Settings::settings_page();
|
248 |
-
* Bug - Fixed strict standard warning about calling GFPDFEntryDetail::pdf_get_lead_field_display();
|
249 |
-
* Bug - Fixed issue with Gravity Form Post Category field causing fatal error generating PDF
|
250 |
-
* Bug - Fixed number field formatting issue when displaying on PDF.
|
251 |
-
* Bug - Do additional check for PHP's MB_String regex functions before initialising ti prevent errors after initialising
|
252 |
-
* Bug - Fixed problem with multiple nodes assigned to a form using the same template
|
253 |
-
* Bug - Fixed path to fallback templates when not found
|
254 |
-
* Bug - Fixed problem with master password setting to user password
|
255 |
-
|
256 |
-
|
257 |
-
= 3.3.4 =
|
258 |
-
* Bug - Fixed issue linking to PDF from front end
|
259 |
-
* Housekeeping - Removed autoredirect to initialisation page
|
260 |
-
|
261 |
-
= 3.3.3 =
|
262 |
-
* Bug - Correctly call javascript to control admin area 'View PDFs' drop down
|
263 |
-
* Bug - Some users still reported incorrect RAM. Convert MB/KB/GB values to M/K/G as per the PHP documentation.
|
264 |
-
* Housekeeping - Show initilisation prompt on all admin area pages instead of only on the Gravity Forms pages
|
265 |
-
|
266 |
-
= 3.3.2.1 =
|
267 |
-
* Bug - Incorrectly showing assigned RAM to website
|
268 |
-
|
269 |
-
= 3.3.2 =
|
270 |
-
* Bug - Some hosts reported SSL certificate errors when using the support API. Disabled HTTPS for further investigation. Using hash-based verification for authentication.
|
271 |
-
* Housekeeping - Forgot to disable API debug feature after completing beta
|
272 |
-
|
273 |
-
= 3.3.1 =
|
274 |
-
* Bug - $form_data['list'] was mapped using an incremental key instead of via the field ID
|
275 |
-
|
276 |
-
= 3.3.0 =
|
277 |
-
* Feature - Overhauled the initialisation process so that the software better reviews the host for potential problems before initialisation. This should help debug issues and make users aware there could be a problem before they begin using the software.
|
278 |
-
* Feature - Overhauled the settings page to make it easier to access features of the software
|
279 |
-
* Feature - Added a Support tab to the settings page which allows users to securely (over HTTPS) submit a support ticket to the Gravity PDF support desk
|
280 |
-
* Feature - Changed select, multiselect and radio fields so that the default templates use the name rather than the value. $form_data now also includes the name and values for all these fields.
|
281 |
-
* Feature - $form_data now includes all miscellaneous lead information in the $form_data['misc'] array.
|
282 |
-
* Feature - $form_data now contains 24 and 12 hour time of entry submission.
|
283 |
-
* Feature - Added localisation support
|
284 |
-
* Compatibility - Added new multi-upload support which was added in Gravity Forms 1.8.
|
285 |
-
* Bug - Added 'aid' parametre to the PDF url when multiple configuration nodes present on a single form
|
286 |
-
* Bug - Fixed issue when Gravity Forms in No Conflict Mode
|
287 |
-
* Bug - Font config.php's array keys now in lower case
|
288 |
-
* Housekeeping - Moved all initialisation files to a folder called 'initialisation'.
|
289 |
-
* Housekeeping - Renamed the configuration.php file in the plugin folder to configuration.php.example to alleviate confusion for developers who unwittingly modify the plugin configuration file instead of the file in their active theme's PDF_EXTENDED_TEMPLATES folder.
|
290 |
-
* Housekeeping - Updated the plugin file system to a more MVC-style approach, with model and view folders.
|
291 |
-
* Housekeeping - Removed ability to directly access default and example template files.
|
292 |
-
* Housekeeping - Fixed PHP notices in default templates related to the default template-only configuration options
|
293 |
-
* Housekeeping - Update core styles to match Wordpress 3.8/Gravity Forms 1.8.
|
294 |
-
* Housekeeping - Updated header/footer examples to use @page in example.
|
295 |
-
|
296 |
-
= 3.2.0 =
|
297 |
-
* 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.
|
298 |
-
* Feature - You can exclude a field from the default templates using the class name 'exclude'. See our [FAQ topic](https://gravitypdf.com/#faqs) for more details.
|
299 |
-
* Bug - Fixed issue viewing own PDF entry when logged in as anything lower than editor.
|
300 |
-
* Bug - Fixed data return bug in pdf-entry-details.php that was preventing all data returning correctly.
|
301 |
-
* Bug - Fixed PHP Warning when using products with no options
|
302 |
-
* Bug - Fixed issue with invalid characters being added to the PDF filename. Most notably the date mergetag.
|
303 |
-
* Bug - Limit filename length to 150 characters which should work on the majority of web servers.
|
304 |
-
* Bug - Fixed problem sending duplicate PDF when using mass resend notification feature
|
305 |
-
* 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](https://developer.gravitypdf.com/news/version-2-3-migration-guide/) to your templates before upgrading.
|
306 |
-
|
307 |
-
= 3.1.4 =
|
308 |
-
* Bug - Fixed issue with plugin breaking website's when the Gravity Forms plugin wasn't activated.
|
309 |
-
* Housekeeping - The plugin now only supports Gravity Forms 1.7 or higher and Wordpress 3.5 or higher.
|
310 |
-
* Housekeeping - PDF template files can no longer be accessed directly. Instead, add &html=1 to the end of your URL when viewing a PDF.
|
311 |
-
* Extension - Added additional filters to allow the lead ID and notifications to be overridden.
|
312 |
-
|
313 |
-
= 3.1.3 =
|
314 |
-
* Feature - Added signature_details_id to $form_data array which maps a signatures field ID to the array.
|
315 |
-
* Extension - Added pre-PDF generator filter for use with extensions.
|
316 |
-
* Bug - Fixed issue with quotes in entry data breaking custom templates.
|
317 |
-
* Bug - Fixed issue with the plugin not correctly using the new default configuration template, if set.
|
318 |
-
* Bug - Fixed issue with signature not being removed correctly when only testing with file_exists(). Added second is_dir() test.
|
319 |
-
* Bug - Fixed issue with empty signature field not displaying when option 'default-show-empty' is set.
|
320 |
-
* Bug - Fixed initialisation prompt issue when the MPDF package wasn't unpacked.
|
321 |
-
|
322 |
-
= 3.1.2 =
|
323 |
-
* Feature - Added list array, file path, form ID and lead ID to $form_data array in custom templates
|
324 |
-
* Bug - Fixed initialisation prompt issue when updating plugin
|
325 |
-
* Bug - Fixed window.open issue which prevented a new window from opening when viewing a PDF in the admin area
|
326 |
-
* Bug - Fixed issue with product dropdown and radio button data showing the value instead of the name field.
|
327 |
-
* Bug - Fixed incorrect URL pointing to signature in $form_data
|
328 |
-
|
329 |
-
= 3.1.1 =
|
330 |
-
* Bug - Users whose server only supports FTP file manipulation using the WP_Filesystem API moved the files into the wrong directory due to FTP usually being rooted to the Wordpress home directory. To fix this the plugin attempts to determine the FTP directory, otherwise assumes it is the WP base directory.
|
331 |
-
* Bug - Initialisation error message was being called but the success message was also showing.
|
332 |
-
|
333 |
-
= 3.1.0 =
|
334 |
-
* Feature - Added defaults to configuration.php which allows users to define the default PDF settings for all Gravity Forms. See the [installation and configuration documentation](https://developer.gravitypdf.com/documentation/getting-started-with-gravity-pdf-configuration/) for more details.
|
335 |
-
* Feature - Added three new configuration options 'default-show-html', 'default-show-empty' and 'default-show-page-names' which allow different display options to the three default templates. See the [installation and configuration documentation](http://gravitypdf.com/documentation-v3-x-x/installation-and-configuration/#default-template) for more details.
|
336 |
-
* Feature - Added filter hooks 'gfpdfe_pdf_name' and 'gfpdfe_template' which allows developers to further modify a PDF name and template file, respectively, outside of the configuration.php. This is useful if you have a special case naming convention based on user input. See [https://developer.gravitypdf.com/documentation/filters-and-hooks/](https://developer.gravitypdf.com/documentation/filters-and-hooks/) for more details about using these filters.
|
337 |
-
* Feature - Custom font support. Any .ttf font file added to the PDF_EXTENDED_TEMPLATES/fonts/ folder will be automatically installed once the plugin has been initialised. Users also have the option to just initialise the fonts via the settings page. See the [font/language documentation ](https://developer.gravitypdf.com/documentation/language-support/#install-custom-fonts) for details.
|
338 |
-
* Compatability - Use Gravity Forms get_upload_root() and get_upload_url_root() instead of hard coding the signature upload directory in pdf-entry-detail.php
|
339 |
-
* Compatability - Changed depreciated functions get_themes() and get_theme() to wp_get_theme() (added in Wordpress v3.4).
|
340 |
-
* Compatability - The plugin now needs to be initialised on fresh installation and upgrade. This allows us to use the WP_Filesystem API for file manipulation.
|
341 |
-
* Compatability - Automatic copying of PDF_EXTENDED_TEMPLATES folder on a theme change was removed in favour of a user prompt. This allows us to take advantage of the WP_Filesystem API.
|
342 |
-
* Compatability - Added Wordpress compatibility checker (minimum now 3.4 or higher).
|
343 |
-
* Bug - Removed ZipArchive in favour of Wordpress's WP_Filesystem API unzip_file() command. Some users reported the plugin would stop their entire website working if this extension wasn't installed.
|
344 |
-
* Bug - Fixed Gravity Forms compatibility checker which wouldn't return the correct response.
|
345 |
-
* Bug - Fixed minor bug in pdf.php when using static call 'self' in add_filter hook. Changed to class name.
|
346 |
-
* Bug - Removed PHP notice about $even variable not being defined in pdf-entry-detail.php
|
347 |
-
* Bug - Prevent code from continuing to excecute after sending header redirect.
|
348 |
-
|
349 |
-
= 3.0.2 =
|
350 |
-
* Backwards Compatibility - While PHP 5.3 has was released a number of years ago it seems a number of hosts do not currently offer this version to their clients. In the interest of backwards compatibility we've re-written the plugin to again work with PHP 5+.
|
351 |
-
* Signature / Image Display Bug - All URLs have been converted to a path so images should now display correctly in PDF.
|
352 |
-
|
353 |
-
= 3.0.1 =
|
354 |
-
* Bug - Fixed issue that caused website to become unresponsive when Gravity Forms was disabled or upgraded
|
355 |
-
* Bug - New HTML fields weren't being displayed in $form_data array
|
356 |
-
* Feature - Options for default templates to disable HTML fields or empty fields (or both)
|
357 |
-
|
358 |
-
= 3.0.0 =
|
359 |
-
As of Gravity PDF v3.0.0 we have removed the DOMPDF package from our plugin and integrated the more advanced mPDF system. Along with a new HTML to PDF generator, we've rewritten the entire plugin's base code to make it more user friendly to both hobbyists and rock star web developers. Configuration time is cut in half and advanced features like adding security features is now accessible to users who have little experience with PHP.
|
360 |
-
|
361 |
-
New Features include:
|
362 |
-
|
363 |
-
* Language Support - almost all languages are supported including RTL (right to left) languages like Arabic and Hebrew and CJK languages - Chinese, Japanese and Korean.
|
364 |
-
* HTML Page Numbering
|
365 |
-
* Odd and even paging with mirrored margins (most commonly used in printing).
|
366 |
-
* Nested Tables
|
367 |
-
* Text-justification and hyphenation
|
368 |
-
* Table of Contents
|
369 |
-
* Index
|
370 |
-
* Bookmarks
|
371 |
-
* Watermarks
|
372 |
-
* Password protection
|
373 |
-
* UTF-8 encoded HTML
|
374 |
-
* Better system resource handling
|
375 |
-
|
376 |
-
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.
|
377 |
-
|
378 |
-
Users will no longer place code in their active theme's functions.php file. Instead, configuration will happen in a new file called configuration.php, inside the PDF_EXTENDED_TEMPLATES folder (in your active theme).
|
379 |
-
|
380 |
-
Other changes include
|
381 |
-
* Improved security - further restrictions were placed on non-administrators viewing template files.
|
382 |
-
* $form_data array tidied up - images won't be wrapped in anchor tags.
|
383 |
-
|
384 |
-
For more details [view the 3.x.x online documentation](https://developer.gravitypdf.com/).
|
385 |
-
|
386 |
-
= 2.2.3 =
|
387 |
-
* Bug - Fixed mb_string error in the updated DOMPDF package.
|
388 |
-
|
389 |
-
= 2.2.2 =
|
390 |
-
* DOMPDF - We updated to the latest version of DOMPDF - DOMPDF 0.6.0 beta 3.
|
391 |
-
* DOMPDF - We've enabled font subsetting by default which should help limit the increased PDF size when using DejaVu Sans (or any other font).
|
392 |
-
|
393 |
-
= 2.2.1 =
|
394 |
-
* Bug - Fixed HTML error which caused list items to distort on PDF
|
395 |
-
|
396 |
-
= 2.2.0 =
|
397 |
-
* Compatibility - Ensure compatibility with Gravity Forms 1.7. We've updated the functions.php code and remove gform_user_notification_attachments and gform_admin_notification_attachments hooks which are now depreciated. Functions gform_pdf_create and gform_add_attachment have been removed and replaced with gfpdfe_create_and_attach_pdf(). See upgrade documentation for details.
|
398 |
-
* Enhancement - Added deployment code switch so the template redeployment feature can be turned on and off. This release doesn't require redeployment.
|
399 |
-
* Enhancement - PDF_Generator() variables were getting long and complex so the third variable is now an array which will pass all the optional arguments. The new 1.7 compatible functions.php code includes this method by default. For backwards compatibility the function will still work with the variable structure prior to 2.2.0.
|
400 |
-
* Bug - Fixed error generated by legacy code in the function PDF_processing() which is located in render_to_pdf.php.
|
401 |
-
* Bug - Images and stylesheets will now try and be accessed with a local path instead of a URL. It fixes problem where some hosts were preventing read access from a URL. No template changes are required.
|
402 |
-
|
403 |
-
= 2.1.1 =
|
404 |
-
* Bug - Signatures stopped displaying after 2.1.0 update. Fixed issue.
|
405 |
-
* Bug - First time install code now won't execute if already have configuration variables in database
|
406 |
-
|
407 |
-
= 2.1.0 =
|
408 |
-
|
409 |
-
* Feature - Product table can now be accessed directly through custom templates by running GFPDFEntryDetail::product_table($form, $lead);. See documentation for more details.
|
410 |
-
* Feature - Update screen will ask you if you want to deploy new template files, instead of overriding your modified versions.
|
411 |
-
* Feature - Product subtotal, shipping and total have been added to $form_data['field'] array to make it easier to work with product details in the custom template.
|
412 |
-
* Feature - Added two new default template files. One displays field and name in two rows (like you see when viewing an entry in the admin area) and the other removes all styling. See documentation on use.
|
413 |
-
* Security - Tightened PDF template security so that custom templates couldn't be automatically generated by just anyone. Now only logged in users with the correct privileges and the user who submitted the form (matched against IP) can auto generate a PDF. See documentation on usage.
|
414 |
-
* Depreciated - Removed form data that was added directly to the $form_data array instead of $form_data['field'] array. Users upgrading will need to update their custom templates if not using field data from the $form_data[�field'] array. If using $form_data['field'] in your custom template this won't affect you.
|
415 |
-
* Bug - Fixed problem with default template not showing and displaying a timeout error. Removed table tags and replaced with divs that are styled appropriately.
|
416 |
-
* Bug - The new plugin theme folder will successfully create when upgrading. You won't have to deactivate and reactivate to get it working.
|
417 |
-
* Bug - some installs had plugins that included the function mb_string which is also included in DOMPDF. DOMPDF will now check if the function exists before creating it.
|
418 |
-
* Bug - Remove empty signature field from the default template.
|
419 |
-
* Bug - fixed problem with redirecting to login screen even when logged in while accessing template file through the browser window directly.
|
420 |
-
* Bug - fixed error where sample template would reimport itself automatically even after deleting it. Will now only reimport if any important changes to template need to be viewed straight after an update.
|
421 |
-
* Bug - Moved render_to_pdf.php constants to pdf.php so we can use the constants in the core files. Was previously generating an error.
|
422 |
-
* Housekeeping - Cleaned up core template files, moved functions into classes and added more in-file documentation.
|
423 |
-
* Housekeeping - moved install/upgrade code from pdf.php to installation-update-manager.php
|
424 |
-
* Housekeeping - changed pdf-entry-detail.php class name from GFEntryDetail to GFPDFEntryDetail to remove compatibility problems with Gravity Forms.
|
425 |
-
* Housekeeping - created pdf-settings.php file to house the settings page code.
|
426 |
-
|
427 |
-
= 2.0.1 =
|
428 |
-
* Fixed Signature bug when checking if image file exists using URL instead of filesystem path
|
429 |
-
* Fixed PHP Constants Notice
|
430 |
-
|
431 |
-
= 2.0.0 =
|
432 |
-
* Moved templates to active theme folder to prevent custom themes being removed on upgrade
|
433 |
-
* Allow PDFs to be saved using a custom name
|
434 |
-
* Fixed WP_Error bug when image/css file cannot be found
|
435 |
-
* Upgraded to latest version of DOMPDF
|
436 |
-
* Removed auto-load form bug which would see multiple instances of the example form loaded
|
437 |
-
* Created a number of constants to allow easier developer modification
|
438 |
-
* Plugin/Support moved to dedicated website.
|
439 |
-
* Pro/Business package offers the ability to write fields on an existing PDF.
|
440 |
-
|
441 |
-
= 1.2.3 =
|
442 |
-
* Fixed $wpdb->prepare error
|
443 |
-
|
444 |
-
= 1.2.2 =
|
445 |
-
* Fixed bug with tempalte shipping method MERGETAGS
|
446 |
-
* Fixed bug where attachment wasn't being sent
|
447 |
-
* Fixed problem when all_url_fopen was turned off on server and failed to retreive remote images. Now uses WP_HTTP class.
|
448 |
-
|
449 |
-
= 1.2.1 =
|
450 |
-
* Fixed path to custom css file included in PDF template
|
451 |
-
|
452 |
-
= 1.2.0 =
|
453 |
-
* Template files moved to the plugin's template folder
|
454 |
-
* Sample Form installed so developers have a working example to modify
|
455 |
-
* Fixed bug when using WordPress in another directory to the site
|
456 |
-
|
457 |
-
= 1.1.0 =
|
458 |
-
* Now compatible with Gravity Forms Signature Add-On
|
459 |
-
* Moved the field data functions out side of the Gravity Forms core so users can freely style their form information (located in pdf-entry-detail.php)
|
460 |
-
* Simplified the field data output
|
461 |
-
* Fixed bug when using product information
|
462 |
-
|
463 |
-
= 1.0.0 =
|
464 |
-
* First release.
|
465 |
-
|
466 |
-
== Upgrade Notice ==
|
467 |
-
|
468 |
-
= 3.6.0 =
|
469 |
-
WARNING: Minimum WordPress and Gravity Forms versions have been bumped to WordPress 3.9+ and Gravity Forms 1.8+. If you aren't running either version of this software DO NOT UPGRADE.
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: blueliquiddesigns
|
3 |
+
Donate link: http://www.gravityformspdfextended.com
|
4 |
+
Tags: gravity, forms, pdf, automation, attachment
|
5 |
+
Requires at least: 3.4
|
6 |
+
Tested up to: 3.5.2
|
7 |
+
Stable tag: 3.1.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Gravity Forms PDF Extended allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
As of Gravity Forms PDF Extended v3.0.0 we have removed the DOMPDF package from our plugin and integrated the more advanced mPDF system. Along with a new HTML to PDF generator, we've rewritten the entire plugin's base code to make it more user friendly to both hobbyists and rock star web developers. Configuration time is cut in half and advanced features like adding security features is now accessible to users who have little experience with PHP.
|
16 |
+
|
17 |
+
**Features**
|
18 |
+
|
19 |
+
* Save PDF File on user submission of a Gravity Form so it can be attached to a notification
|
20 |
+
* Customise the PDF template without affecting the core Gravity Form Plugin
|
21 |
+
* Multiple PDF Templates
|
22 |
+
* Custom PDF Name
|
23 |
+
* Output individual form fields in the template - like MERGETAGS.
|
24 |
+
* View and download a PDF via the administrator interface
|
25 |
+
* Simple function to output PDF via template / plugin
|
26 |
+
* Works with Gravity Forms Signature Add-On
|
27 |
+
|
28 |
+
**PDF Features**
|
29 |
+
|
30 |
+
Along with the above features, the new PDF features include:
|
31 |
+
|
32 |
+
* Language Support - almost all languages are supported including RTL (right to left) languages like Arabic and Hebrew and CJK languages - Chinese, Japanese and Korean.
|
33 |
+
* HTML Page Numbering
|
34 |
+
* Odd and even paging with mirrored margins (most commonly used in printing).
|
35 |
+
* Nested Tables
|
36 |
+
* Text-justification and hyphenation
|
37 |
+
* Table of Contents
|
38 |
+
* Index
|
39 |
+
* Bookmarks
|
40 |
+
* Watermarks
|
41 |
+
* Password protection
|
42 |
+
* UTF-8 encoded HTML
|
43 |
+
* Better system resource handling
|
44 |
+
|
45 |
+
**Server Requirements**
|
46 |
+
|
47 |
+
1. PHP 5+
|
48 |
+
2. MB String
|
49 |
+
3. GD Library (optional)
|
50 |
+
4. RAM: Recommended: 128MB. Minimum: 64MB.
|
51 |
+
|
52 |
+
**Software Requirements**
|
53 |
+
|
54 |
+
1. [Purchase and install Gravity Forms](https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154)
|
55 |
+
2. Wordpress 3.4+
|
56 |
+
3. Gravity Forms 1.6.9+
|
57 |
+
|
58 |
+
**Documentation and Support**
|
59 |
+
|
60 |
+
To view the Development Documentation head to [http://www.gravityformspdfextended.com/documentation/](http://www.gravityformspdfextended.com/documentation/). If you need support with the plugin please post a topic in our [support forums](http://gravityformspdfextended.com/support/gravity-forms-pdf-extended/).
|
61 |
+
|
62 |
+
== Installation ==
|
63 |
+
|
64 |
+
1. Upload this plugin to your website and activate it
|
65 |
+
2. Create a form in Gravity Forms and configure notifications
|
66 |
+
3. Get the Form ID and follow the steps below in [the configuration section](http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/)
|
67 |
+
4. Modify the PDF template file ([see the advanced templating section in the documentation](http://gravityformspdfextended.com/documentation-v3-x-x/templates/)) inside your active theme's PDF_EXTENDED_TEMPLATES/ folder.
|
68 |
+
|
69 |
+
|
70 |
+
== Frequently Asked Questions ==
|
71 |
+
|
72 |
+
All FAQs can be [viewed on the Gravity Forms PDF Extended website](http://gravityformspdfextended.com/faq/category/developers/).
|
73 |
+
|
74 |
+
== Screenshots ==
|
75 |
+
|
76 |
+
1. View PDF from the Gravity Forms entries list.
|
77 |
+
2. View or download the PDF from a Gravity Forms entry.
|
78 |
+
|
79 |
+
== Changelog ==
|
80 |
+
|
81 |
+
= 3.1.0 =
|
82 |
+
* Feature - Added defaults to configuration.php which allows users to define the default PDF settings for all Gravity Forms. See the [installation and configuration documentation](http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/#default-configuration-options) for more details.
|
83 |
+
* Feature - Added three new configuration options 'default-show-html', 'default-show-empty' and 'default-show-page-names' which allow different display options to the three default templates. See the [installation and configuration documentation](http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/#default-template-only) for more details.
|
84 |
+
* Feature - Added filter hooks 'gfpdfe_pdf_name' and 'gfpdfe_template' which allows developers to further modify a PDF name and template file, respectively, outside of the configuration.php. This is useful if you have a special case naming convention based on user input. See [http://gravityformspdfextended.com/filters-and-hooks/](http://gravityformspdfextended.com/filters-and-hooks/) for more details about using these filters.
|
85 |
+
* Feature - Custom font support. Any .ttf font file added to the PDF_EXTENDED_TEMPLATE/fonts/ folder will be automatically installed once the plugin has been initialised. Users also have the option to just initialise the fonts via the settings page. See the [font/language documentation ](http://gravityformspdfextended.com/documentation-v3-x-x/language-support/#installing-fonts) for details.
|
86 |
+
* Compatability - Use Gravity Forms get_upload_root() and get_upload_url_root() instead of hard coding the signature upload directory in pdf-entry-detail.php
|
87 |
+
* Compatability - Changed depreciated functions get_themes() and get_theme() to wp_get_theme() (added in Wordpress v3.4).
|
88 |
+
* Compatability - The plugin now needs to be initialised on fresh installation and upgrade. This allows us to use the WP_Filesystem API for file manipulation.
|
89 |
+
* Compatability - Automatic copying of PDF_EXTENDED_TEMPLATE folder on a theme change was removed in favour of a user prompt. This allows us to take advantage of the WP_Filesystem API.
|
90 |
+
* Compatability - Added Wordpress compatibility checker (minimum now 3.4 or higher).
|
91 |
+
* Bug - Removed ZipArchive in favour of Wordpress's WP_Filesystem API unzip_file() command. Some users reported the plugin would stop their entire website working if this extension wasn't installed.
|
92 |
+
* Bug - Fixed Gravity Forms compatibility checker which wouldn't return the correct response.
|
93 |
+
* Bug - Fixed minor bug in pdf.php when using static call 'self' in add_filter hook. Changed to class name.
|
94 |
+
* Bug - Removed PHP notice about $even variable not being defined in pdf-entry-detail.php
|
95 |
+
* Bug - Prevent code from continuing to excecute after sending header redirect.
|
96 |
+
|
97 |
+
= 3.0.2 =
|
98 |
+
* Backwards Compatibility - While PHP 5.3 has was released a number of years ago it seems a number of hosts do not currently offer this version to their clients. In the interest of backwards compatibility we've re-written the plugin to again work with PHP 5+.
|
99 |
+
* Signature / Image Display Bug - All URLs have been converted to a path so images should now display correctly in PDF.
|
100 |
+
|
101 |
+
= 3.0.1 =
|
102 |
+
* Bug - Fixed issue that caused website to become unresponsive when Gravity Forms was disabled or upgraded
|
103 |
+
* Bug - New HTML fields weren't being displayed in $form_data array
|
104 |
+
* Feature - Options for default templates to disable HTML fields or empty fields (or both)
|
105 |
+
|
106 |
+
= 3.0.0 =
|
107 |
+
As of Gravity Forms PDF Extended v3.0.0 we have removed the DOMPDF package from our plugin and integrated the more advanced mPDF system. Along with a new HTML to PDF generator, we've rewritten the entire plugin's base code to make it more user friendly to both hobbyists and rock star web developers. Configuration time is cut in half and advanced features like adding security features is now accessible to users who have little experience with PHP.
|
108 |
+
|
109 |
+
New Features include:
|
110 |
+
|
111 |
+
* Language Support - almost all languages are supported including RTL (right to left) languages like Arabic and Hebrew and CJK languages - Chinese, Japanese and Korean.
|
112 |
+
* HTML Page Numbering
|
113 |
+
* Odd and even paging with mirrored margins (most commonly used in printing).
|
114 |
+
* Nested Tables
|
115 |
+
* Text-justification and hyphenation
|
116 |
+
* Table of Contents
|
117 |
+
* Index
|
118 |
+
* Bookmarks
|
119 |
+
* Watermarks
|
120 |
+
* Password protection
|
121 |
+
* UTF-8 encoded HTML
|
122 |
+
* Better system resource handling
|
123 |
+
|
124 |
+
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.
|
125 |
+
|
126 |
+
Users will no longer place code in their active theme's functions.php file. Instead, configuration will happen in a new file called configuration.php, inside the PDF_EXTENDED_TEMPLATES folder (in your active theme).
|
127 |
+
|
128 |
+
Other changes include
|
129 |
+
* Improved security - further restrictions were placed on non-administrators viewing template files.
|
130 |
+
* $form_data array tidied up - images won't be wrapped in anchor tags.
|
131 |
+
|
132 |
+
For more details [view the 3.x.x online documentation](http://gravityformspdfextended.com/documentation-v3-x-x/introduction/).
|
133 |
+
|
134 |
+
= 2.2.3 =
|
135 |
+
* Bug - Fixed mb_string error in the updated DOMPDF package.
|
136 |
+
|
137 |
+
= 2.2.2 =
|
138 |
+
* DOMPDF - We updated to the latest version of DOMPDF - DOMPDF 0.6.0 beta 3.
|
139 |
+
* DOMPDF - We've enabled font subsetting by default which should help limit the increased PDF size when using DejaVu Sans (or any other font).
|
140 |
+
|
141 |
+
= 2.2.1 =
|
142 |
+
* Bug - Fixed HTML error which caused list items to distort on PDF
|
143 |
+
|
144 |
+
= 2.2.0 =
|
145 |
+
* Compatibility - Ensure compatibility with Gravity Forms 1.7. We've updated the functions.php code and remove gform_user_notification_attachments and gform_admin_notification_attachments hooks which are now depreciated. Functions gform_pdf_create and gform_add_attachment have been removed and replaced with gfpdfe_create_and_attach_pdf(). See upgrade documentation for details.
|
146 |
+
* Enhancement - Added deployment code switch so the template redeployment feature can be turned on and off. This release doesn't require redeployment.
|
147 |
+
* Enhancement - PDF_Generator() variables were getting long and complex so the third variable is now an array which will pass all the optional arguments. The new 1.7 compatible functions.php code includes this method by default. For backwards compatibility the function will still work with the variable structure prior to 2.2.0.
|
148 |
+
* Bug - Fixed error generated by legacy code in the function PDF_processing() which is located in render_to_pdf.php.
|
149 |
+
* Bug - Images and stylesheets will now try and be accessed with a local path instead of a URL. It fixes problem where some hosts were preventing read access from a URL. No template changes are required.
|
150 |
+
|
151 |
+
= 2.1.1 =
|
152 |
+
* Bug - Signatures stopped displaying after 2.1.0 update. Fixed issue.
|
153 |
+
* Bug - First time install code now won't execute if already have configuration variables in database
|
154 |
+
|
155 |
+
= 2.1.0 =
|
156 |
+
|
157 |
+
* Feature - Product table can now be accessed directly through custom templates by running GFPDFEntryDetail::product_table($form, $lead);. See documentation for more details.
|
158 |
+
* Feature - Update screen will ask you if you want to deploy new template files, instead of overriding your modified versions.
|
159 |
+
* Feature - Product subtotal, shipping and total have been added to $form_data['field'] array to make it easier to work with product details in the custom template.
|
160 |
+
* Feature - Added two new default template files. One displays field and name in two rows (like you see when viewing an entry in the admin area) and the other removes all styling. See documentation on use.
|
161 |
+
* Security - Tightened PDF template security so that custom templates couldn't be automatically generated by just anyone. Now only logged in users with the correct privileges and the user who submitted the form (matched against IP) can auto generate a PDF. See documentation on usage.
|
162 |
+
* Depreciated - Removed form data that was added directly to the $form_data array instead of $form_data['field'] array. Users upgrading will need to update their custom templates if not using field data from the $form_data[�field'] array. If using $form_data['field'] in your custom template this won't affect you.
|
163 |
+
* Bug - Fixed problem with default template not showing and displaying a timeout error. Removed table tags and replaced with divs that are styled appropriately.
|
164 |
+
* Bug - The new plugin theme folder will successfully create when upgrading. You won't have to deactivate and reactivate to get it working.
|
165 |
+
* Bug - some installs had plugins that included the function mb_string which is also included in DOMPDF. DOMPDF will now check if the function exists before creating it.
|
166 |
+
* Bug - Remove empty signature field from the default template.
|
167 |
+
* Bug - fixed problem with redirecting to login screen even when logged in while accessing template file through the browser window directly.
|
168 |
+
* Bug - fixed error where sample template would reimport itself automatically even after deleting it. Will now only reimport if any important changes to template need to be viewed straight after an update.
|
169 |
+
* Bug - Moved render_to_pdf.php constants to pdf.php so we can use the constants in the core files. Was previously generating an error.
|
170 |
+
* Housekeeping - Cleaned up core template files, moved functions into classes and added more in-file documentation.
|
171 |
+
* Housekeeping - moved install/upgrade code from pdf.php to installation-update-manager.php
|
172 |
+
* Housekeeping - changed pdf-entry-detail.php class name from GFEntryDetail to GFPDFEntryDetail to remove compatibility problems with Gravity Forms.
|
173 |
+
* Housekeeping - created pdf-settings.php file to house the settings page code.
|
174 |
+
|
175 |
+
= 2.0.1 =
|
176 |
+
* Fixed Signature bug when checking if image file exists using URL instead of filesystem path
|
177 |
+
* Fixed PHP Constants Notice
|
178 |
+
|
179 |
+
= 2.0.0 =
|
180 |
+
* Moved templates to active theme folder to prevent custom themes being removed on upgrade
|
181 |
+
* Allow PDFs to be saved using a custom name
|
182 |
+
* Fixed WP_Error bug when image/css file cannot be found
|
183 |
+
* Upgraded to latest version of DOMPDF
|
184 |
+
* Removed auto-load form bug which would see multiple instances of the example form loaded
|
185 |
+
* Created a number of constants to allow easier developer modification
|
186 |
+
* Plugin/Support moved to dedicated website.
|
187 |
+
* Pro/Business package offers the ability to write fields on an existing PDF.
|
188 |
+
|
189 |
+
= 1.2.3 =
|
190 |
+
* Fixed $wpdb->prepare error
|
191 |
+
|
192 |
+
= 1.2.2 =
|
193 |
+
* Fixed bug with tempalte shipping method MERGETAGS
|
194 |
+
* Fixed bug where attachment wasn't being sent
|
195 |
+
* Fixed problem when all_url_fopen was turned off on server and failed to retreive remote images. Now uses WP_HTTP class.
|
196 |
+
|
197 |
+
= 1.2.1 =
|
198 |
+
* Fixed path to custom css file included in PDF template
|
199 |
+
|
200 |
+
= 1.2.0 =
|
201 |
+
* Template files moved to the plugin's template folder
|
202 |
+
* Sample Form installed so developers have a working example to modify
|
203 |
+
* Fixed bug when using WordPress in another directory to the site
|
204 |
+
|
205 |
+
= 1.1.0 =
|
206 |
+
* Now compatible with Gravity Forms Signature Add-On
|
207 |
+
* Moved the field data functions out side of the Gravity Forms core so users can freely style their form information (located in pdf-entry-detail.php)
|
208 |
+
* Simplified the field data output
|
209 |
+
* Fixed bug when using product information
|
210 |
+
|
211 |
+
= 1.0.0 =
|
212 |
+
* First release.
|
213 |
+
|
214 |
+
== Upgrade Notice ==
|
215 |
+
|
216 |
+
= 3.1.0 =
|
217 |
+
We've added custom font support, a number of configuration options for the default template, fixed a major compatibility issue with unzipping files and reworked the entire installation and upgrade manager. Note: Wordpress 3.4 is now the minimum supported version.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/configuration.php.example → configuration.php
RENAMED
@@ -1,390 +1,300 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* Gravity PDF Configuration
|
5 |
-
* New from v3.0.0. No longer is theme functions.php code required.
|
6 |
-
* Important documentation on the configuration found at
|
7 |
-
*/
|
8 |
-
|
9 |
-
/*
|
10 |
-
* Added in v3.1.0
|
11 |
-
* Users can now assign defaults to forms that aren't configured below.
|
12 |
-
* Note: this will only work if the configuration option GFPDF_SET_DEFAULT_TEMPLATE is set to true (located at the bottom of this file).
|
13 |
-
*
|
14 |
-
* Users can use any configuration option like you would for a singular form, including:
|
15 |
-
* notifications, template, filename, pdf_size, orientation, security and rtl
|
16 |
-
*/
|
17 |
-
global $gf_pdf_default_configuration;
|
18 |
-
|
19 |
-
$gf_pdf_default_configuration = array(
|
20 |
-
'template' => 'default-template.php',
|
21 |
-
'pdf_size' => 'A4'
|
22 |
-
);
|
23 |
-
|
24 |
-
/*
|
25 |
-
* ------------------------------------------------------------
|
26 |
-
* Bare minimum configuration code
|
27 |
-
* Usage: Will generate PDF and send to all notifications
|
28 |
-
* Remove the comments around the code blocks below to use (/*)
|
29 |
-
* form_id Mixed - Integer or Array. Required. The Gravity Form ID you are assigning the PDF to.
|
30 |
-
* notifications Mixed - String, Boolean or Array.
|
31 |
-
*/
|
32 |
-
/*$gf_pdf_config[] = array(
|
33 |
-
'form_id' => 1,
|
34 |
-
|
35 |
-
);*/
|
36 |
-
|
37 |
-
/*
|
38 |
-
* ------------------------------------------------------------
|
39 |
-
* Default template specific configuration code
|
40 |
-
* As of 3.1.0 uses can now add default-show-html, default-show-empty and default-show-page-names when using any
|
41 |
-
* of the default template files (any template prepended with default-)
|
42 |
-
*
|
43 |
-
* Usage:
|
44 |
-
* 'default-show-html' - This option will display HTMl blocks in your default tempalte.
|
45 |
-
* 'default-show-empty' - All form fields will be displayed in the PDF, regardless of what the user input is.
|
46 |
-
* 'default-show-page-names' - If you are using page breaks you can display the page names in the PDF.
|
47 |
-
*
|
48 |
-
* Remove the comments around the code blocks below to use (/*)
|
49 |
-
*/
|
50 |
-
|
51 |
-
/*$gf_pdf_config[] = array(
|
52 |
-
'form_id' => 1,
|
53 |
-
|
54 |
-
|
55 |
-
);*/
|
56 |
-
|
57 |
-
/*$gf_pdf_config[] = array(
|
58 |
-
'form_id' => 1,
|
59 |
-
|
60 |
-
|
61 |
-
);*/
|
62 |
-
|
63 |
-
/*$gf_pdf_config[] = array(
|
64 |
-
'form_id' => 1,
|
65 |
-
|
66 |
-
|
67 |
-
);*/
|
68 |
-
|
69 |
-
/*$gf_pdf_config[] = array(
|
70 |
-
'form_id' => 1,
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
);*/
|
76 |
-
|
77 |
-
/*
|
78 |
-
* ------------------------------------------------------------
|
79 |
-
* Notification Options
|
80 |
-
* notifications Mixed - String, Boolean or Array.
|
81 |
-
* Notifications can be a string like 'Admin Notifications', an array with multiple notification names or true to send to all.
|
82 |
-
*/
|
83 |
-
/*$gf_pdf_config[] = array(
|
84 |
-
'form_id' => 1,
|
85 |
-
|
86 |
-
);*/
|
87 |
-
|
88 |
-
/*$gf_pdf_config[] = array(
|
89 |
-
'form_id' => '1',
|
90 |
-
|
91 |
-
);*/
|
92 |
-
|
93 |
-
/*
|
94 |
-
* ------------------------------------------------------------
|
95 |
-
* Custom Template
|
96 |
-
* Don't want to use a custom template? Just pass the custom template name to the configuration.
|
97 |
-
* template String. Default default-template.php. The name of your custom template that's placed in your active theme's PDF_EXTENDED_TEMPLATES folder.
|
98 |
-
* For more information about creating custom templates please see
|
99 |
-
*/
|
100 |
-
/*$gf_pdf_config[] = array(
|
101 |
-
'form_id' => 1,
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
'
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
*
|
116 |
-
*
|
117 |
-
*
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
*
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
*
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
*
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
*
|
232 |
-
*
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
'
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
*
|
259 |
-
*
|
260 |
-
*
|
261 |
-
*
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
*
|
272 |
-
*
|
273 |
-
*
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
'
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
*
|
283 |
-
*
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
*
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
* The default DPI used in the PDFs are 96.
|
302 |
-
* Use the 'dpi' option
|
303 |
-
*/
|
304 |
-
|
305 |
-
/*$gf_pdf_config[] = array(
|
306 |
-
'form_id' => 1,
|
307 |
-
'template' => 'example-template.php',
|
308 |
-
'dpi' => 300,
|
309 |
-
);*/
|
310 |
-
|
311 |
-
/*
|
312 |
-
* ------------------------------------------------------------
|
313 |
-
* Set PDF to PDF/A-1b format
|
314 |
-
* Added in v3.4.0
|
315 |
-
*
|
316 |
-
* PDF/A1-b is a file format for the long-term archiving of electronic documents.
|
317 |
-
* A key element to this reproducibility is the requirement for PDF/A documents to be 100% self-contained.
|
318 |
-
*
|
319 |
-
* Important: The software is not guaranteed to produce fully PDF/A1-b compliant files in all circumstances. It is the users responsibility to check compliance if this is essential.
|
320 |
-
*
|
321 |
-
* Usage:
|
322 |
-
* We've added the configuration options 'pdfa1b'.
|
323 |
-
*
|
324 |
-
* The software will automatically make appropriate changes to your document to ensure it generates a valid PDF/A-1b document however the following items cannot be automatically fixed and are disallowed:
|
325 |
-
*
|
326 |
-
* 1. Watermarks - text or image - are not permitted (transparency is disallowed so will make text unreadable)
|
327 |
-
* 2. PNG images with alpha channel transparency ('masks' not allowed)
|
328 |
-
* 3. Encryption is enabled (the system will automatically remove any security settings)
|
329 |
-
*
|
330 |
-
* For more details about generating a PDF/X-1a document see http://mpdf1.com/manual/index.php?tid=420
|
331 |
-
*/
|
332 |
-
|
333 |
-
/*$gf_pdf_config[] = array(
|
334 |
-
'form_id' => 1,
|
335 |
-
'template' => 'example-template.php',
|
336 |
-
'pdfa1b' => true,
|
337 |
-
);*/
|
338 |
-
|
339 |
-
/*
|
340 |
-
* ------------------------------------------------------------
|
341 |
-
* Set PDF to PDF/X-1a format
|
342 |
-
* Added in v3.4.0
|
343 |
-
*
|
344 |
-
* PDF/X-1a is a file format to facilitate printing of electronic documents.
|
345 |
-
* Two key elements to this function are the requirement for PDF/X documents to be 100% self-contained, and all images need to be CMYK or spot colors.
|
346 |
-
*
|
347 |
-
* Important: The software is not guaranteed to produce fully PDF/A1-b compliant files in all circumstances. It is the users responsibility to check compliance if this is essential.
|
348 |
-
*
|
349 |
-
* Usage:
|
350 |
-
* We've added a new configuration options: 'pdfx1a' to turn documents into PDF/X-1a format.
|
351 |
-
*
|
352 |
-
* The software will automatically make appropriate changes to your document to ensure it generates a valid PDF/X-1a document however the following items cannot be automatically fixed and are disallowed:
|
353 |
-
*
|
354 |
-
* 1. Watermarks - text or image - are not permitted (transparency is disallowed so will make text unreadable)
|
355 |
-
* 2. PNG images with alpha channel transparency ('masks' not allowed)
|
356 |
-
* 3. Encryption is enabled (the system will automatically remove any security settings)
|
357 |
-
*
|
358 |
-
* For more details about generating a PDF/X-1a document see http://mpdf1.com/manual/index.php?tid=481
|
359 |
-
*
|
360 |
-
*/
|
361 |
-
|
362 |
-
/*$gf_pdf_config[] = array(
|
363 |
-
'form_id' => 1,
|
364 |
-
'template' => 'example-template.php',
|
365 |
-
'pdfx1a' => true,
|
366 |
-
);*/
|
367 |
-
|
368 |
-
|
369 |
-
/* ---------------------------------------------------------------
|
370 |
-
* CUSTOM PDF SETUP BELOW.
|
371 |
-
* See https://developer.gravitypdf.com/documentation/configuration-options-examples/#constants for more details
|
372 |
-
*/
|
373 |
-
|
374 |
-
/*
|
375 |
-
* By default, forms that don't have PDFs assigned through the above configuration
|
376 |
-
* will automatically use the default template in the admin area.
|
377 |
-
* Set to false to disable this feature.
|
378 |
-
*/
|
379 |
-
define('GFPDF_SET_DEFAULT_TEMPLATE', true);
|
380 |
-
|
381 |
-
/*
|
382 |
-
* MEMORY ISSUES?
|
383 |
-
* Try setting the options below to true to help reduce the memory footprint of the package.
|
384 |
-
*/
|
385 |
-
define('PDF_ENABLE_MPDF_LITE', false); /* strip out advanced features like advanced table borders, terms and conditions, index, bookmarks and barcodes. */
|
386 |
-
define('PDF_ENABLE_MPDF_TINY', false); /* if your tried the lite version and are still having trouble the tiny version includes the bare minimum features. There's no positioning, float, watermark or form support */
|
387 |
-
define('PDF_DISABLE_FONT_SUBSTITUTION', false); /* reduced memory by stopping font substitution */
|
388 |
-
define('PDF_ENABLE_SIMPLE_TABLES', false); /* disable the advanced table feature and forces all cells to have the same border, background etc. */
|
389 |
-
|
390 |
-
define('PDF_REPACK_FONT', false); /* If enabled, when embedding full TTF font files it will be remade with only core font tables which may improve function with some PostScript printers (GhostScript/GSView) */
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Gravity Forms PDF Extended Configuration
|
5 |
+
* New from v3.0.0. No longer is theme functions.php code required.
|
6 |
+
* Important documentation on the configuration found at http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/
|
7 |
+
*/
|
8 |
+
|
9 |
+
/*
|
10 |
+
* Added in v3.1.0
|
11 |
+
* Users can now assign defaults to forms that aren't configured below.
|
12 |
+
* Note: this will only work if the configuration option GFPDF_SET_DEFAULT_TEMPLATE is set to true (located at the bottom of this file).
|
13 |
+
*
|
14 |
+
* Users can use any configuration option like you would for a singular form, including:
|
15 |
+
* notifications, template, filename, pdf_size, orientation, security and rtl
|
16 |
+
*/
|
17 |
+
global $gf_pdf_default_configuration;
|
18 |
+
|
19 |
+
$gf_pdf_default_configuration = array(
|
20 |
+
'template' => 'default-template-two-rows.php',
|
21 |
+
'pdf_size' => 'A4'
|
22 |
+
);
|
23 |
+
|
24 |
+
/*
|
25 |
+
* ------------------------------------------------------------
|
26 |
+
* Bare minimum configuration code
|
27 |
+
* Usage: Will generate PDF and send to all notifications
|
28 |
+
* Remove the comments around the code blocks below to use (/*)
|
29 |
+
* form_id Mixed - Integer or Array. Required. The Gravity Form ID you are assigning the PDF to.
|
30 |
+
* notifications Mixed - String, Boolean or Array.
|
31 |
+
*/
|
32 |
+
/*$gf_pdf_config[] = array(
|
33 |
+
'form_id' => '1',
|
34 |
+
'notifications' => true
|
35 |
+
);*/
|
36 |
+
|
37 |
+
/*
|
38 |
+
* ------------------------------------------------------------
|
39 |
+
* Default template specific configuration code
|
40 |
+
* As of 3.1.0 uses can now add default-show-html, default-show-empty and default-show-page-names when using any
|
41 |
+
* of the default template files (any template prepended with default-)
|
42 |
+
*
|
43 |
+
* Usage:
|
44 |
+
* 'default-show-html' - This option will display HTMl blocks in your default tempalte.
|
45 |
+
* 'default-show-empty' - All form fields will be displayed in the PDF, regardless of what the user input is.
|
46 |
+
* 'default-show-page-names' - If you are using page breaks you can display the page names in the PDF.
|
47 |
+
*
|
48 |
+
* Remove the comments around the code blocks below to use (/*)
|
49 |
+
*/
|
50 |
+
|
51 |
+
/*$gf_pdf_config[] = array(
|
52 |
+
'form_id' => '1',
|
53 |
+
'template' => 'default-template.php',
|
54 |
+
'default-show-html' => true
|
55 |
+
);*/
|
56 |
+
|
57 |
+
/*$gf_pdf_config[] = array(
|
58 |
+
'form_id' => '1',
|
59 |
+
'template' => 'default-template.php',
|
60 |
+
'default-show-empty' => true
|
61 |
+
);*/
|
62 |
+
|
63 |
+
/*$gf_pdf_config[] = array(
|
64 |
+
'form_id' => '1',
|
65 |
+
'template' => 'default-template.php',
|
66 |
+
'default-show-page-names' => true
|
67 |
+
);*/
|
68 |
+
|
69 |
+
/*$gf_pdf_config[] = array(
|
70 |
+
'form_id' => '1',
|
71 |
+
'template' => 'default-template.php',
|
72 |
+
'default-show-html' => true,
|
73 |
+
'default-show-empty' => true,
|
74 |
+
'default-show-page-names' => true
|
75 |
+
);*/
|
76 |
+
|
77 |
+
/*
|
78 |
+
* ------------------------------------------------------------
|
79 |
+
* Notification Options
|
80 |
+
* notifications Mixed - String, Boolean or Array.
|
81 |
+
* Notifications can be a string like 'Admin Notifications', an array with multiple notification names or true to send to all.
|
82 |
+
*/
|
83 |
+
/*$gf_pdf_config[] = array(
|
84 |
+
'form_id' => '1',
|
85 |
+
'notifications' => 'Admin Notification'
|
86 |
+
);*/
|
87 |
+
|
88 |
+
/*$gf_pdf_config[] = array(
|
89 |
+
'form_id' => '1',
|
90 |
+
'notifications' => array('Admin Notification', 'User Notification')
|
91 |
+
);*/
|
92 |
+
|
93 |
+
/*
|
94 |
+
* ------------------------------------------------------------
|
95 |
+
* Custom Template
|
96 |
+
* Don't want to use a custom template? Just pass the custom template name to the configuration.
|
97 |
+
* template String. Default default-template.php. The name of your custom template that's placed in your active theme's PDF_EXTENDED_TEMPLATES folder.
|
98 |
+
* For more information about creating custom templates please see http://gravityformspdfextended.com/documentation-v3-x-x/templates/
|
99 |
+
*/
|
100 |
+
/*$gf_pdf_config[] = array(
|
101 |
+
'form_id' => 1,
|
102 |
+
'notifications' => 'User Notification',
|
103 |
+
|
104 |
+
'template' => 'example-float-and-positioning05.php'
|
105 |
+
);*/
|
106 |
+
|
107 |
+
/*$gf_pdf_config[] = array(
|
108 |
+
'form_id' => 2,
|
109 |
+
'notifications' => 'User Notification',
|
110 |
+
|
111 |
+
'template' => 'example-basic-html01.php'
|
112 |
+
);*/
|
113 |
+
|
114 |
+
/*
|
115 |
+
* ------------------------------------------------------------
|
116 |
+
* Multiple Forms
|
117 |
+
* If you have multiple forms that use the same PDF template then you can pass the form_id through as an array.
|
118 |
+
* WARNING: If using a custom template with this option your secondary forms should be a duplicate of the original and you shouldn't delete the fields
|
119 |
+
* otherwise the custom template won't show correctly.
|
120 |
+
* WARNING: The previous warning also applies to custom PDF names with MERGETAGS
|
121 |
+
*/
|
122 |
+
/*$gf_pdf_config[] = array(
|
123 |
+
'form_id' => array(1,5,6),
|
124 |
+
'notifications' => true
|
125 |
+
);*/
|
126 |
+
|
127 |
+
/*
|
128 |
+
* ------------------------------------------------------------
|
129 |
+
* Custom File Name
|
130 |
+
* Will change the filename of the PDF which is attached
|
131 |
+
* As of v3.0.0 merge tags can be used in the file name
|
132 |
+
* filename String. Default form-{form_id}-entry-{entry_id}.pdf
|
133 |
+
*/
|
134 |
+
/*$gf_pdf_config[] = array(
|
135 |
+
'form_id' => '1',
|
136 |
+
'notifications' => true,
|
137 |
+
'filename' => 'New PDF Name.pdf'
|
138 |
+
);*/
|
139 |
+
|
140 |
+
/*$gf_pdf_config[] = array(
|
141 |
+
'form_id' => '1',
|
142 |
+
'notifications' => true,
|
143 |
+
'filename' => 'User {Name:1}.pdf'
|
144 |
+
);*/
|
145 |
+
|
146 |
+
/*
|
147 |
+
* ------------------------------------------------------------
|
148 |
+
* Custom PDF Size / Orientation
|
149 |
+
* PDF Size can be set to the following:
|
150 |
+
*
|
151 |
+
* A0 - A10, B0 - B10, C0 - C10
|
152 |
+
* 4A0, 2A0, RA0 - RA4, SRA0 - SRA4
|
153 |
+
* Letter, Legal, Executive, Folio
|
154 |
+
* Demy, Royal
|
155 |
+
*
|
156 |
+
* Default: A4
|
157 |
+
* You can also pass the PDF size as an array, represented in millimetres - array(width, height).
|
158 |
+
*
|
159 |
+
* NOTE: By default the orientation is portrait so you only need to add it for landscape PDFs
|
160 |
+
*/
|
161 |
+
|
162 |
+
/* Letter-sized Document */
|
163 |
+
/*$gf_pdf_config[] = array(
|
164 |
+
'form_id' => '1',
|
165 |
+
'attachments' => true,
|
166 |
+
|
167 |
+
'pdf_size' => 'letter'
|
168 |
+
);*/
|
169 |
+
|
170 |
+
/* Custom PDF Size */
|
171 |
+
/* $gf_pdf_config[] = array(
|
172 |
+
'form_id' => '1',
|
173 |
+
'attachments' => true,
|
174 |
+
|
175 |
+
'pdf_size' => array(50, 200)
|
176 |
+
);*/
|
177 |
+
|
178 |
+
/* Change orientation */
|
179 |
+
/* $gf_pdf_config[] = array(
|
180 |
+
'form_id' => '1',
|
181 |
+
'attachments' => true,
|
182 |
+
|
183 |
+
'pdf_size' => 'letter',
|
184 |
+
'orientation' => 'landscape'
|
185 |
+
);*/
|
186 |
+
|
187 |
+
/*
|
188 |
+
* ------------------------------------------------------------
|
189 |
+
* PDF Security
|
190 |
+
* Allows you to password protect your PDF document, place a master password on the document which prevents document tampering and restricts user behaviour.
|
191 |
+
*
|
192 |
+
* security Boolean. Default false. If true the security settings will be applied.
|
193 |
+
* pdf_password String. Default blank.
|
194 |
+
* pdf_privileges Array
|
195 |
+
* Assign user privileges to the document. Valid privileges include: copy, print, modify, annot-forms, fill-forms, extract, assemble, print-highres
|
196 |
+
* pdf_master_password String. Default random generated. Set a master password on the PDF which stops the PDF from being modified.
|
197 |
+
* NOTE: As the document is encrypted in 128-bit print will only allow users to print a low resolution copy.
|
198 |
+
* Use print-highres to print full resolution image.
|
199 |
+
* NOTE: The use of print will only allow low-resolution printing from the document; you must specify print-highres to allow full resolution printing.
|
200 |
+
* NOTE: If pdf_master_password is omitted a random one will be generated
|
201 |
+
* NOTE: Passing a blank array or not passing anything to pdf_privileges will deny all permissions to the user
|
202 |
+
*/
|
203 |
+
|
204 |
+
/*
|
205 |
+
* Setting security settings with all values
|
206 |
+
*/
|
207 |
+
/*$gf_pdf_config[] = array(
|
208 |
+
'form_id' => '1',
|
209 |
+
'notifications' => true,
|
210 |
+
|
211 |
+
'security' => true,
|
212 |
+
'pdf_password' => 'myPDFpass',
|
213 |
+
'pdf_privileges' => array('copy', 'print', 'modify', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-highres'),
|
214 |
+
'pdf_master_password' => 'admin password'
|
215 |
+
);*/
|
216 |
+
|
217 |
+
/*
|
218 |
+
* Set password to PDF.
|
219 |
+
* Deny all permissions to user
|
220 |
+
* Random master password will be generated
|
221 |
+
*/
|
222 |
+
/*$gf_pdf_config[] = array(
|
223 |
+
'form_id' => '1',
|
224 |
+
'notifications' => true,
|
225 |
+
|
226 |
+
'security' => true,
|
227 |
+
'pdf_password' => 'myPDFpass'
|
228 |
+
);*/
|
229 |
+
|
230 |
+
/*
|
231 |
+
* No password required to open PDF document.
|
232 |
+
* Deny all permissions to user
|
233 |
+
* Master password set
|
234 |
+
*/
|
235 |
+
/*$gf_pdf_config[] = array(
|
236 |
+
'form_id' => '1',
|
237 |
+
'notifications' => true,
|
238 |
+
|
239 |
+
'security' => true,
|
240 |
+
'pdf_master_password' => 'admin password'
|
241 |
+
);*/
|
242 |
+
|
243 |
+
/*
|
244 |
+
* No password required to open PDF document.
|
245 |
+
* User can copy, print and modify PDF
|
246 |
+
* Random master password will be generated
|
247 |
+
*
|
248 |
+
*/
|
249 |
+
/*$gf_pdf_config[] = array(
|
250 |
+
'form_id' => '1',
|
251 |
+
'notifications' => true,
|
252 |
+
|
253 |
+
'security' => true,
|
254 |
+
'pdf_privileges' => array('copy', 'print', 'modify', 'print-highres')
|
255 |
+
);*/
|
256 |
+
|
257 |
+
/*
|
258 |
+
* ------------------------------------------------------------
|
259 |
+
* Right to Left Language Support
|
260 |
+
* We now support RTL languages.
|
261 |
+
* rtl Boolean. Default false.
|
262 |
+
*/
|
263 |
+
/*$gf_pdf_config[] = array(
|
264 |
+
'form_id' => '1',
|
265 |
+
'notifications' => true,
|
266 |
+
|
267 |
+
'rtl' => true
|
268 |
+
);*/
|
269 |
+
|
270 |
+
/*
|
271 |
+
* ------------------------------------------------------------
|
272 |
+
* Disable Notifications
|
273 |
+
* If you don't need to send notifications and just want a custom PDF generated
|
274 |
+
* via the admin area you can forgo the notifications class
|
275 |
+
*/
|
276 |
+
/*$gf_pdf_config[] = array(
|
277 |
+
'form_id' => '1',
|
278 |
+
'template' => 'example-template.php'
|
279 |
+
);*/
|
280 |
+
|
281 |
+
/* ---------------------------------------------------------------
|
282 |
+
* CUSTOM PDF SETUP BELOW.
|
283 |
+
* See http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/#constants for more details
|
284 |
+
*/
|
285 |
+
|
286 |
+
/*
|
287 |
+
* By default, forms that don't have PDFs assigned through the above configuration
|
288 |
+
* will automatically use the default template in the admin area.
|
289 |
+
* Set to false to disable this feature.
|
290 |
+
*/
|
291 |
+
define('GFPDF_SET_DEFAULT_TEMPLATE', true);
|
292 |
+
|
293 |
+
/*
|
294 |
+
* MEMORY ISSUES?
|
295 |
+
* Try setting the options below to true to help reduce the memory footprint of the package.
|
296 |
+
*/
|
297 |
+
define('PDF_ENABLE_MPDF_LITE', false); /* strip out advanced features like advanced table borders, terms and conditions, columns, index, bookmarks and barcodes. */
|
298 |
+
define('PDF_ENABLE_MPDF_TINY', false); /* if your tried the lite version and are still having trouble the tiny version includes the bare minimum features. There's no positioning, float, watermark or form support */
|
299 |
+
define('PDF_DISABLE_FONT_SUBSTITUTION', false); /* reduced memory by stopping font substitution */
|
300 |
+
define('PDF_ENABLE_SIMPLE_TABLES', false); /* disable the advanced table feature and forces all cells to have the same border, background etc. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
depreciated.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Filename: depreciated.php
|
5 |
-
* This file contains any depreciated functionality to help preserve backwards compatibility
|
6 |
-
* with either Gravity Forms, or our template files.
|
7 |
-
*/
|
8 |
-
|
9 |
-
|
10 |
-
/*
|
11 |
-
* Since v3.6
|
12 |
-
* Moved to the $gfpdfe_data class.
|
13 |
-
* Can now be accessed using the following:
|
14 |
-
*
|
15 |
-
* $gfpdfe_data->template_location
|
16 |
-
* $gfpdfe_data->template_site_location
|
17 |
-
* $gfpdfe_data->template_save_location
|
18 |
-
* $gfpdfe_data->template_font_location
|
19 |
-
*
|
20 |
-
*/
|
21 |
-
define('PDF_SAVE_LOCATION', $gfpdfe_data->template_save_location);
|
22 |
-
define('PDF_FONT_LOCATION', $gfpdfe_data->template_font_location);
|
23 |
-
define('PDF_TEMPLATE_LOCATION', $gfpdfe_data->template_site_location);
|
24 |
-
define('PDF_TEMPLATE_URL_LOCATION', $gfpdfe_data->template_site_location_url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper/data.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin: Gravity PDF
|
5 |
-
* File: data.php
|
6 |
-
*
|
7 |
-
* This is a data overloading class which holds important variables shared throughout the plugin
|
8 |
-
* In some circumstances it will also provide functions to get data from itself
|
9 |
-
*/
|
10 |
-
|
11 |
-
class GFPDFE_DATA
|
12 |
-
{
|
13 |
-
/** Location for overloaded data. */
|
14 |
-
private $data = array();
|
15 |
-
|
16 |
-
public function __set($name, $value)
|
17 |
-
{
|
18 |
-
$this->data[$name] = $value;
|
19 |
-
}
|
20 |
-
|
21 |
-
public function __get($name)
|
22 |
-
{
|
23 |
-
if (array_key_exists($name, $this->data)) {
|
24 |
-
return $this->data[$name];
|
25 |
-
}
|
26 |
-
|
27 |
-
$trace = debug_backtrace();
|
28 |
-
trigger_error(
|
29 |
-
'Undefined property via __get(): ' . $name .
|
30 |
-
' in ' . $trace[0]['file'] .
|
31 |
-
' on line ' . $trace[0]['line'],
|
32 |
-
E_USER_NOTICE);
|
33 |
-
return null;
|
34 |
-
}
|
35 |
-
|
36 |
-
/** As of PHP 5.1.0 */
|
37 |
-
public function __isset($name)
|
38 |
-
{
|
39 |
-
return isset($this->data[$name]);
|
40 |
-
}
|
41 |
-
|
42 |
-
/** As of PHP 5.1.0 */
|
43 |
-
public function __unset($name)
|
44 |
-
{
|
45 |
-
unset($this->data[$name]);
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Used to set up our PDF template folder,
|
50 |
-
* save folder and font folder
|
51 |
-
*/
|
52 |
-
public function set_directory_structure()
|
53 |
-
{
|
54 |
-
$upload_dir = PDF_Common::get_upload_dir();
|
55 |
-
$site_name = PDF_Common::get_site_name();
|
56 |
-
|
57 |
-
$this->template_location = $upload_dir['basedir'] . '/' . PDF_SAVE_FOLDER . '/';
|
58 |
-
$this->template_site_location = $upload_dir['basedir'] . '/' . PDF_SAVE_FOLDER . '/' . $site_name . '/';
|
59 |
-
$this->template_save_location = $upload_dir['basedir'] . '/' . PDF_SAVE_FOLDER . '/' . $site_name . '/output/';
|
60 |
-
$this->template_font_location = $upload_dir['basedir'] . '/' . PDF_SAVE_FOLDER . '/' . $site_name . '/fonts/';
|
61 |
-
|
62 |
-
$this->template_location_url = $upload_dir['baseurl'] . '/' . PDF_SAVE_FOLDER . '/';
|
63 |
-
$this->template_site_location_url = $upload_dir['baseurl'] . '/' . PDF_SAVE_FOLDER . '/' . $site_name . '/';
|
64 |
-
$this->template_save_location_url = $upload_dir['baseurl'] . '/' . PDF_SAVE_FOLDER . '/' . $site_name . '/output/';
|
65 |
-
$this->template_font_location_url = $upload_dir['baseurl'] . '/' . PDF_SAVE_FOLDER . '/' . $site_name . '/fonts/';
|
66 |
-
|
67 |
-
$this->old_template_location = get_stylesheet_directory().'/'.PDF_SAVE_FOLDER.'/';
|
68 |
-
$this->upload_dir = $upload_dir['basedir'];
|
69 |
-
}
|
70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper/installation-update-manager.php
DELETED
@@ -1,658 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin: Gravity PDF
|
5 |
-
* File: install-update-manager.php
|
6 |
-
*
|
7 |
-
* This file handles the installation and update code that ensures the plugin will be supported.
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Check to see if Gravity Forms version is supported
|
12 |
-
*/
|
13 |
-
|
14 |
-
class GFPDF_InstallUpdater
|
15 |
-
{
|
16 |
-
|
17 |
-
public static function check_filesystem_api()
|
18 |
-
{
|
19 |
-
global $gfpdfe_data;
|
20 |
-
$access_type = get_filesystem_method();
|
21 |
-
|
22 |
-
$gfpdfe_data->automated = false;
|
23 |
-
if($access_type === 'direct')
|
24 |
-
{
|
25 |
-
$gfpdfe_data->automated = true;
|
26 |
-
}
|
27 |
-
}
|
28 |
-
|
29 |
-
/*
|
30 |
-
* Check if we can automatically deploy the software
|
31 |
-
* We use WP Filesystem API to initialise.
|
32 |
-
* Check if we have direct write control to the filesystem. If so, automatically deploy
|
33 |
-
* without asking the user. This will make upgrades much simplier.
|
34 |
-
*/
|
35 |
-
public static function maybe_deploy()
|
36 |
-
{
|
37 |
-
global $gfpdfe_data;
|
38 |
-
/*
|
39 |
-
* Check if we have a 'direct' method, that the software isn't fully installed and we aren't trying to manually initialise
|
40 |
-
*/
|
41 |
-
|
42 |
-
if($gfpdfe_data->automated === true && $gfpdfe_data->is_initialised === false && !rgpost('upgrade') && get_option('gfpdfe_automated_install') != 'installing')
|
43 |
-
{
|
44 |
-
/*
|
45 |
-
* Initialise all multisites if a super admin is logged in
|
46 |
-
*/
|
47 |
-
if(is_multisite() && is_super_admin())
|
48 |
-
{
|
49 |
-
$results = GFPDF_InstallUpdater::run_multisite_deployment(array('GFPDF_InstallUpdater', 'do_deploy'));
|
50 |
-
|
51 |
-
if($results === true)
|
52 |
-
{
|
53 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_network_deploy_success'));
|
54 |
-
}
|
55 |
-
elseif($results === false)
|
56 |
-
{
|
57 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_auto_deploy_network_failure'));
|
58 |
-
}
|
59 |
-
return $results;
|
60 |
-
}
|
61 |
-
else
|
62 |
-
{
|
63 |
-
if(self::do_deploy())
|
64 |
-
{
|
65 |
-
/*
|
66 |
-
* Output successfull automated installation message
|
67 |
-
*/
|
68 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_auto_deploy_success'));
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
/*
|
75 |
-
* Initialise all multsites in one fowl swoop
|
76 |
-
*/
|
77 |
-
public static function run_multisite_deployment($action)
|
78 |
-
{
|
79 |
-
global $gfpdfe_data;
|
80 |
-
|
81 |
-
/* add additional check incase someone doesn't call this correctly */
|
82 |
-
if(!is_multisite() || !is_super_admin())
|
83 |
-
return false;
|
84 |
-
|
85 |
-
/*
|
86 |
-
* Get multisites which aren't deleted
|
87 |
-
*/
|
88 |
-
$sites = wp_get_sites(array('deleted' => 0));
|
89 |
-
|
90 |
-
if(sizeof($sites) > 0)
|
91 |
-
{
|
92 |
-
|
93 |
-
$problem = array();
|
94 |
-
foreach($sites as $site)
|
95 |
-
{
|
96 |
-
switch_to_blog( (int) $site['blog_id'] );
|
97 |
-
|
98 |
-
/*
|
99 |
-
* Reset the directory structure
|
100 |
-
*/
|
101 |
-
$gfpdfe_data->set_directory_structure();
|
102 |
-
|
103 |
-
/*
|
104 |
-
* Test if the blog has gravity forms and PDF Extended active
|
105 |
-
* If so, we can initialise
|
106 |
-
*/
|
107 |
-
$gravityforms = 'gravityforms/gravityforms.php'; /* have to hardcode the folder name as they don't set it in a constant or variable */
|
108 |
-
$pdfextended = GF_PDF_EXTENDED_PLUGIN_BASENAME; /* no need to hardcode the basename here */
|
109 |
-
|
110 |
-
if( (is_plugin_active_for_network($gravityforms) && is_plugin_active_for_network($pdfextended)) ||
|
111 |
-
(is_plugin_active($gravityforms) && is_plugin_active($pdfextended))
|
112 |
-
)
|
113 |
-
{
|
114 |
-
/* run our deployment and output any problems */
|
115 |
-
$deploy = call_user_func($action);
|
116 |
-
if($deploy === false)
|
117 |
-
{
|
118 |
-
$problem[] = $site;
|
119 |
-
}
|
120 |
-
else if ($deploy === 'false')
|
121 |
-
{
|
122 |
-
/*
|
123 |
-
* Asking for the access details so we can write to the server
|
124 |
-
* Exit early
|
125 |
-
*/
|
126 |
-
return $deploy;
|
127 |
-
}
|
128 |
-
}
|
129 |
-
restore_current_blog();
|
130 |
-
|
131 |
-
/*
|
132 |
-
* Reset the directory structure
|
133 |
-
*/
|
134 |
-
$gfpdfe_data->set_directory_structure();
|
135 |
-
}
|
136 |
-
|
137 |
-
if(sizeof($problem) > 0)
|
138 |
-
{
|
139 |
-
$gfpdfe_data->network_error = $problem;
|
140 |
-
return false;
|
141 |
-
}
|
142 |
-
return true;
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
/*
|
147 |
-
* Used to automatically deploy the software
|
148 |
-
* Regular initialisation (via the settings page) will call pdf_extended_activate() directly.
|
149 |
-
*/
|
150 |
-
public static function do_deploy()
|
151 |
-
{
|
152 |
-
update_option('gfpdfe_automated_install', 'installing');
|
153 |
-
return self::pdf_extended_activate();
|
154 |
-
}
|
155 |
-
|
156 |
-
/*
|
157 |
-
* Different filesystems (FTP/SSH) might have a different ABSPATH than the 'direct' method
|
158 |
-
* due to being rooted to a specific folder.
|
159 |
-
* The $wp_filesystem->abspath() corrects this behaviour.
|
160 |
-
*/
|
161 |
-
private static function get_basedir($path)
|
162 |
-
{
|
163 |
-
global $wp_filesystem;
|
164 |
-
return str_replace(ABSPATH, $wp_filesystem->abspath(), $path);
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Install everything required
|
169 |
-
*/
|
170 |
-
public static function pdf_extended_activate()
|
171 |
-
{
|
172 |
-
/*
|
173 |
-
* Initialise the Wordpress Filesystem API
|
174 |
-
*/
|
175 |
-
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy', 'overwrite'), 'pdf-extended-filesystem') === false)
|
176 |
-
{
|
177 |
-
return 'false';
|
178 |
-
}
|
179 |
-
|
180 |
-
/*
|
181 |
-
* If we got here we should have $wp_filesystem available
|
182 |
-
*/
|
183 |
-
global $wp_filesystem, $gfpdfe_data;
|
184 |
-
|
185 |
-
/*
|
186 |
-
* Set the correct paths
|
187 |
-
* FTP and SSH could be rooted to the wordpress base directory
|
188 |
-
* use $wp_filesystem->abspath(); function to fix any issues
|
189 |
-
*/
|
190 |
-
$directory = self::get_basedir(PDF_PLUGIN_DIR);
|
191 |
-
$base_template_directory = self::get_basedir( $gfpdfe_data->template_location );
|
192 |
-
$template_directory = self::get_basedir( $gfpdfe_data->template_site_location );
|
193 |
-
$template_save_directory = self::get_basedir( $gfpdfe_data->template_save_location );
|
194 |
-
$template_font_directory = self::get_basedir( $gfpdfe_data->template_font_location );
|
195 |
-
|
196 |
-
|
197 |
-
/**
|
198 |
-
* If template directory already exists then we will remove the old template files so we can redeploy the new ones
|
199 |
-
*/
|
200 |
-
self::reinitialise_templates($template_directory);
|
201 |
-
|
202 |
-
/* create new directory in uploads folder*/
|
203 |
-
if(self::create_base_template_dir($base_template_directory) === false)
|
204 |
-
{
|
205 |
-
return false;
|
206 |
-
}
|
207 |
-
|
208 |
-
/* create site directory in base template directory */
|
209 |
-
if(self::create_site_template_dir($template_directory) === false)
|
210 |
-
{
|
211 |
-
return false;
|
212 |
-
}
|
213 |
-
|
214 |
-
/* create 'save' output folder */
|
215 |
-
if(self::create_save_dir($template_save_directory) === false)
|
216 |
-
{
|
217 |
-
return false;
|
218 |
-
}
|
219 |
-
|
220 |
-
/* create 'font' folder */
|
221 |
-
if(self::create_font_dir($template_font_directory) === false)
|
222 |
-
{
|
223 |
-
return false;
|
224 |
-
}
|
225 |
-
|
226 |
-
/* copy entire template folder over to the template directory */
|
227 |
-
self::pdf_extended_copy_directory( $directory . 'initialisation/templates', $template_directory, false );
|
228 |
-
|
229 |
-
/* copy configuration file over to new directory */
|
230 |
-
if(self::create_configuration_file($directory, $template_directory) === false)
|
231 |
-
{
|
232 |
-
return false;
|
233 |
-
}
|
234 |
-
|
235 |
-
/* create .htaccess file */
|
236 |
-
if(self::create_htaccess_file($template_save_directory) === false)
|
237 |
-
{
|
238 |
-
return false;
|
239 |
-
}
|
240 |
-
|
241 |
-
/* initialise font directory */
|
242 |
-
if(self::install_fonts($directory, $template_directory, $template_font_directory) !== true)
|
243 |
-
{
|
244 |
-
return false;
|
245 |
-
}
|
246 |
-
|
247 |
-
/* update db to ensure everything is installed correctly. */
|
248 |
-
self::db_init();
|
249 |
-
|
250 |
-
return true;
|
251 |
-
}
|
252 |
-
|
253 |
-
public static function reinitialise_templates($template_directory)
|
254 |
-
{
|
255 |
-
global $wp_filesystem, $gfpdfe_data;
|
256 |
-
|
257 |
-
if($wp_filesystem->exists($template_directory) && isset($_POST['overwrite']))
|
258 |
-
{
|
259 |
-
/*
|
260 |
-
* Create a backup folder and move all the files there
|
261 |
-
*/
|
262 |
-
$backup_folder = 'INIT_BACKUP_' . date('Y-m-d_G-i') . '/';
|
263 |
-
$do_backup = false;
|
264 |
-
if($wp_filesystem->mkdir($template_directory . $backup_folder ))
|
265 |
-
{
|
266 |
-
$do_backup = true;
|
267 |
-
}
|
268 |
-
|
269 |
-
|
270 |
-
/* read all file names into array and unlink from active theme template folder */
|
271 |
-
foreach(glob( PDF_PLUGIN_DIR . 'initialisation/templates/*') as $file) {
|
272 |
-
$path_parts = pathinfo($file);
|
273 |
-
if($wp_filesystem->exists($template_directory.$path_parts['basename']))
|
274 |
-
{
|
275 |
-
if(!$do_backup)
|
276 |
-
{
|
277 |
-
$wp_filesystem->delete($template_directory.$path_parts['basename']);
|
278 |
-
continue;
|
279 |
-
}
|
280 |
-
$wp_filesystem->move($template_directory.$path_parts['basename'], $template_directory . $backup_folder . $path_parts['basename']);
|
281 |
-
}
|
282 |
-
}
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
public static function create_base_template_dir($base_template_directory)
|
287 |
-
{
|
288 |
-
global $wp_filesystem, $gfpdfe_data;
|
289 |
-
|
290 |
-
/* create new directory in uploads folder*/
|
291 |
-
if(!$wp_filesystem->is_dir($base_template_directory))
|
292 |
-
{
|
293 |
-
if($wp_filesystem->mkdir($base_template_directory) === false)
|
294 |
-
{
|
295 |
-
/*
|
296 |
-
* TODO: add correct notices
|
297 |
-
*/
|
298 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_template_dir_err'));
|
299 |
-
return false;
|
300 |
-
}
|
301 |
-
}
|
302 |
-
|
303 |
-
return true;
|
304 |
-
}
|
305 |
-
|
306 |
-
public static function create_site_template_dir($template_directory)
|
307 |
-
{
|
308 |
-
global $wp_filesystem, $gfpdfe_data;
|
309 |
-
|
310 |
-
if(!$wp_filesystem->is_dir($template_directory))
|
311 |
-
{
|
312 |
-
if($wp_filesystem->mkdir($template_directory) === false)
|
313 |
-
{
|
314 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_template_site_dir_err'));
|
315 |
-
return false;
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
return true;
|
320 |
-
}
|
321 |
-
|
322 |
-
public static function create_save_dir($template_save_directory)
|
323 |
-
{
|
324 |
-
global $wp_filesystem, $gfpdfe_data;
|
325 |
-
|
326 |
-
if(!$wp_filesystem->is_dir($template_save_directory))
|
327 |
-
{
|
328 |
-
/* create new directory in active themes folder*/
|
329 |
-
if($wp_filesystem->mkdir($template_save_directory) === false)
|
330 |
-
{
|
331 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_template_dir_err'));
|
332 |
-
return false;
|
333 |
-
}
|
334 |
-
}
|
335 |
-
|
336 |
-
return true;
|
337 |
-
}
|
338 |
-
|
339 |
-
public static function create_font_dir($template_font_directory)
|
340 |
-
{
|
341 |
-
global $wp_filesystem, $gfpdfe_data;
|
342 |
-
|
343 |
-
if(!$wp_filesystem->is_dir($template_font_directory))
|
344 |
-
{
|
345 |
-
/* create new directory in active themes folder*/
|
346 |
-
if($wp_filesystem->mkdir($template_font_directory) === false)
|
347 |
-
{
|
348 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_template_dir_err'));
|
349 |
-
return false;
|
350 |
-
}
|
351 |
-
}
|
352 |
-
|
353 |
-
return true;
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Copy configuration file to template folder
|
358 |
-
* @param String $directory The $wp_filesystem path to the plugin folder
|
359 |
-
* @param String $template_directory The $wp_filesystem path to the template folder
|
360 |
-
* @return Boolean Success on true (or not run at all). false on fail
|
361 |
-
*/
|
362 |
-
public static function create_configuration_file($directory, $template_directory)
|
363 |
-
{
|
364 |
-
global $wp_filesystem, $gfpdfe_data;
|
365 |
-
|
366 |
-
if(!$wp_filesystem->exists($template_directory .'configuration.php'))
|
367 |
-
{
|
368 |
-
/* copy template files to new directory */
|
369 |
-
if(!$wp_filesystem->copy($directory . 'initialisation/configuration.php.example', $template_directory . 'configuration.php'))
|
370 |
-
{
|
371 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_template_dir_err'));
|
372 |
-
return false;
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
return true;
|
377 |
-
}
|
378 |
-
|
379 |
-
/**
|
380 |
-
* Create htaccess file to prevent direct access to PDFs
|
381 |
-
* @param String $template_save_directory The $wp_filesystem path to the save directory
|
382 |
-
* @return Boolean success on true (or not run at all). false on fail
|
383 |
-
*/
|
384 |
-
public static function create_htaccess_file($template_save_directory)
|
385 |
-
{
|
386 |
-
global $wp_filesystem, $gfpdfe_data;
|
387 |
-
|
388 |
-
if(!$wp_filesystem->exists($template_save_directory . '.htaccess'))
|
389 |
-
{
|
390 |
-
if(!$wp_filesystem->put_contents($template_save_directory . '.htaccess', 'deny from all'))
|
391 |
-
{
|
392 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_template_dir_err'));
|
393 |
-
return false;
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
return true;
|
398 |
-
}
|
399 |
-
|
400 |
-
/*
|
401 |
-
* Normalize the database options related to initialisation
|
402 |
-
*/
|
403 |
-
public static function db_init()
|
404 |
-
{
|
405 |
-
global $gfpdfe_data;
|
406 |
-
|
407 |
-
update_option('gf_pdf_extended_installed', 'installed');
|
408 |
-
delete_option('gfpdfe_automated_install');
|
409 |
-
GFPDF_Settings::$model->check_compatibility();
|
410 |
-
}
|
411 |
-
|
412 |
-
public static function initialise_fonts()
|
413 |
-
{
|
414 |
-
/*
|
415 |
-
* Initialise the Wordpress Filesystem API
|
416 |
-
*/
|
417 |
-
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy', 'font-initialise', 'gfpdf_deploy_nonce'), 'pdf-extended-fonts') === false)
|
418 |
-
{
|
419 |
-
return false;
|
420 |
-
}
|
421 |
-
|
422 |
-
/*
|
423 |
-
* If we got here we should have $wp_filesystem available
|
424 |
-
*/
|
425 |
-
global $wp_filesystem, $gfpdfe_data;
|
426 |
-
|
427 |
-
/*
|
428 |
-
* We need to set up some filesystem compatibility checkes to work with the different server file management types
|
429 |
-
* Most notably is the FTP options, but SSH may be effected too
|
430 |
-
*/
|
431 |
-
$directory = self::get_basedir(PDF_PLUGIN_DIR);
|
432 |
-
$template_directory = self::get_basedir( $gfpdfe_data->template_site_location );
|
433 |
-
$template_font_directory = self::get_basedir( $gfpdfe_data->template_font_location );
|
434 |
-
|
435 |
-
if(self::install_fonts($directory, $template_directory, $template_font_directory) === true)
|
436 |
-
{
|
437 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_font_install_success'));
|
438 |
-
}
|
439 |
-
return true;
|
440 |
-
}
|
441 |
-
|
442 |
-
private static function install_fonts($directory, $template_directory, $fonts_location)
|
443 |
-
{
|
444 |
-
|
445 |
-
global $wp_filesystem, $gfpdfe_data;
|
446 |
-
$write_to_file = '<?php
|
447 |
-
|
448 |
-
if(!defined("PDF_EXTENDED_VERSION"))
|
449 |
-
{
|
450 |
-
return;
|
451 |
-
}
|
452 |
-
|
453 |
-
';
|
454 |
-
|
455 |
-
/*
|
456 |
-
* Search the font folder for .ttf files. If found, move them to the mPDF font folder
|
457 |
-
* and write the configuration file
|
458 |
-
*/
|
459 |
-
|
460 |
-
/* read all file names into array and unlink from active theme template folder */
|
461 |
-
foreach(glob( $gfpdfe_data->template_font_location . '/*.[tT][tT][fF]') as $file) {
|
462 |
-
|
463 |
-
$path_parts = pathinfo($file);
|
464 |
-
|
465 |
-
/*
|
466 |
-
* Generate configuration information in preparation to write to file
|
467 |
-
*/
|
468 |
-
$write_to_file .= '
|
469 |
-
$this->fontdata[\''.mb_strtolower(str_replace(' ', '', $path_parts['filename']), 'UTF-8').'\'] = array(
|
470 |
-
\'R\' => \''.$path_parts['basename'].'\'
|
471 |
-
);';
|
472 |
-
|
473 |
-
}
|
474 |
-
|
475 |
-
/*
|
476 |
-
* Remove the old configuration file and put the contents of $write_to_file in a font configuration file
|
477 |
-
*/
|
478 |
-
$wp_filesystem->delete($template_directory.'fonts/config.php');
|
479 |
-
if($wp_filesystem->put_contents($template_directory.'fonts/config.php', $write_to_file) === false)
|
480 |
-
{
|
481 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_font_config_err'));
|
482 |
-
return false;
|
483 |
-
}
|
484 |
-
|
485 |
-
return true;
|
486 |
-
}
|
487 |
-
|
488 |
-
public static function maybe_automigrate()
|
489 |
-
{
|
490 |
-
global $gfpdfe_data;
|
491 |
-
self::check_filesystem_api();
|
492 |
-
|
493 |
-
if($gfpdfe_data->automated === true)
|
494 |
-
{
|
495 |
-
update_option('gfpdfe_automated_install', 'installing');
|
496 |
-
self::run_template_migration();
|
497 |
-
return true;
|
498 |
-
}
|
499 |
-
return false;
|
500 |
-
}
|
501 |
-
|
502 |
-
/*
|
503 |
-
* Check if the new PDF_TEMPLATE_LOCATION (v.3.6 mod) has been made switched
|
504 |
-
* If it has then prompt the user to move the files
|
505 |
-
*/
|
506 |
-
public static function check_template_migration()
|
507 |
-
{
|
508 |
-
global $gfpdfe_data;
|
509 |
-
|
510 |
-
if(is_dir($gfpdfe_data->old_template_location))
|
511 |
-
{
|
512 |
-
if(!self::maybe_automigrate())
|
513 |
-
{
|
514 |
-
/*
|
515 |
-
* Add admin notification hook to move the files
|
516 |
-
*/
|
517 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'do_template_switch_notice'));
|
518 |
-
return true;
|
519 |
-
}
|
520 |
-
}
|
521 |
-
return false;
|
522 |
-
}
|
523 |
-
|
524 |
-
public static function run_template_migration()
|
525 |
-
{
|
526 |
-
global $gfpdfe_data;
|
527 |
-
|
528 |
-
if(is_multisite() && is_super_admin())
|
529 |
-
{
|
530 |
-
$return = self::run_multisite_deployment(array('GFPDF_InstallUpdater','do_template_migration'));
|
531 |
-
GFPDF_Settings::$model->check_compatibility();
|
532 |
-
|
533 |
-
/* multisite mode */
|
534 |
-
if($return === true)
|
535 |
-
{
|
536 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_migration_success'));
|
537 |
-
}
|
538 |
-
elseif($return === false)
|
539 |
-
{
|
540 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_merge_network_failure'));
|
541 |
-
}
|
542 |
-
return $return;
|
543 |
-
}
|
544 |
-
else
|
545 |
-
{
|
546 |
-
$return = self::do_template_migration();
|
547 |
-
GFPDF_Settings::$model->check_compatibility();
|
548 |
-
|
549 |
-
/* single site mode */
|
550 |
-
if($return === true)
|
551 |
-
{
|
552 |
-
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_migration_success'));
|
553 |
-
return $return;
|
554 |
-
}
|
555 |
-
return $return;
|
556 |
-
}
|
557 |
-
}
|
558 |
-
|
559 |
-
/*
|
560 |
-
* The after_switch_theme hook is too early in the initialisation to use request_filesystem_credentials()
|
561 |
-
* so we have to call this function at a later inteval
|
562 |
-
*/
|
563 |
-
public static function do_template_migration()
|
564 |
-
{
|
565 |
-
/*
|
566 |
-
* Initialise the Wordpress Filesystem API
|
567 |
-
*/
|
568 |
-
if(PDF_Common::initialise_WP_filesystem_API(array(), 'gfpdfe_migrate') === false)
|
569 |
-
{
|
570 |
-
return 'false';
|
571 |
-
}
|
572 |
-
|
573 |
-
/*
|
574 |
-
* If we got here we should have $wp_filesystem available
|
575 |
-
*/
|
576 |
-
global $wp_filesystem, $gfpdfe_data;
|
577 |
-
|
578 |
-
/*
|
579 |
-
* Convert paths for SSH/FTP users who are rooted to a directory along the server absolute path
|
580 |
-
*/
|
581 |
-
$base_template_directory = self::get_basedir($gfpdfe_data->template_location );
|
582 |
-
$previous_pdf_path = self::get_basedir($gfpdfe_data->old_template_location);
|
583 |
-
$current_pdf_path = self::get_basedir($gfpdfe_data->template_site_location);
|
584 |
-
|
585 |
-
/* create the base template directory */
|
586 |
-
if(self::create_base_template_dir($base_template_directory) === false)
|
587 |
-
{
|
588 |
-
return false;
|
589 |
-
}
|
590 |
-
|
591 |
-
/* create the site template directory */
|
592 |
-
if(self::create_site_template_dir($current_pdf_path) === false)
|
593 |
-
{
|
594 |
-
return false;
|
595 |
-
}
|
596 |
-
|
597 |
-
if($wp_filesystem->is_dir($previous_pdf_path))
|
598 |
-
{
|
599 |
-
self::pdf_extended_copy_directory( $previous_pdf_path, $current_pdf_path, true, true, true ); /* swap back to TRUE to delete the theme folder */
|
600 |
-
|
601 |
-
/*
|
602 |
-
* Clean up the DB
|
603 |
-
*/
|
604 |
-
delete_option('gfpdfe_automated_install');
|
605 |
-
|
606 |
-
return true;
|
607 |
-
}
|
608 |
-
return false;
|
609 |
-
}
|
610 |
-
|
611 |
-
/*
|
612 |
-
* Allows you to copy entire folder structures to new location
|
613 |
-
*/
|
614 |
-
public static function pdf_extended_copy_directory( $source, $destination, $copy_base = true, $delete_destination = false, $delete_source = false )
|
615 |
-
{
|
616 |
-
global $wp_filesystem;
|
617 |
-
|
618 |
-
if ( $wp_filesystem->is_dir( $source ) )
|
619 |
-
{
|
620 |
-
if($delete_destination === true)
|
621 |
-
{
|
622 |
-
/*
|
623 |
-
* To ensure everything stays in sync we will remove the destination file structure
|
624 |
-
*/
|
625 |
-
$wp_filesystem->delete($destination, true);
|
626 |
-
}
|
627 |
-
|
628 |
-
if($copy_base === true)
|
629 |
-
{
|
630 |
-
$wp_filesystem->mkdir( $destination );
|
631 |
-
}
|
632 |
-
$directory = $wp_filesystem->dirlist( $source );
|
633 |
-
|
634 |
-
foreach($directory as $name => $data)
|
635 |
-
{
|
636 |
-
|
637 |
-
$PathDir = $source . '/' . $name;
|
638 |
-
|
639 |
-
if ( $wp_filesystem->is_dir( $PathDir ) )
|
640 |
-
{
|
641 |
-
self::pdf_extended_copy_directory( $PathDir, $destination . '/' . $name );
|
642 |
-
continue;
|
643 |
-
}
|
644 |
-
$wp_filesystem->copy( $PathDir, $destination . '/' . $name );
|
645 |
-
}
|
646 |
-
|
647 |
-
}
|
648 |
-
else
|
649 |
-
{
|
650 |
-
$wp_filesystem->copy( $source, $destination );
|
651 |
-
}
|
652 |
-
|
653 |
-
if($delete_source)
|
654 |
-
{
|
655 |
-
$wp_filesystem->delete($source, true);
|
656 |
-
}
|
657 |
-
}
|
658 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper/notices.php
DELETED
@@ -1,376 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin: Gravity PDF
|
5 |
-
* File: notices.php
|
6 |
-
*
|
7 |
-
* This file handles the output of all notices to the admin area
|
8 |
-
*/
|
9 |
-
|
10 |
-
class GFPDF_Notices
|
11 |
-
{
|
12 |
-
/*
|
13 |
-
* Admin notice template
|
14 |
-
*/
|
15 |
-
private static function message($text, $type = 'updated')
|
16 |
-
{
|
17 |
-
?>
|
18 |
-
<div id="message" class="<?php echo $type; ?>">
|
19 |
-
<p>
|
20 |
-
<?php echo $text; ?>
|
21 |
-
</p>
|
22 |
-
</div>
|
23 |
-
<?php
|
24 |
-
}
|
25 |
-
|
26 |
-
/*
|
27 |
-
* Output the update notice
|
28 |
-
*/
|
29 |
-
private static function notice($text)
|
30 |
-
{
|
31 |
-
self::message($text);
|
32 |
-
}
|
33 |
-
|
34 |
-
/*
|
35 |
-
* Output the error notice
|
36 |
-
*/
|
37 |
-
private static function error($text)
|
38 |
-
{
|
39 |
-
self::message($text, 'error');
|
40 |
-
}
|
41 |
-
|
42 |
-
private static function display_plugin_message($message, $is_error = false){
|
43 |
-
|
44 |
-
$style = $is_error ? 'style="background-color: #ffebe8;"' : "";
|
45 |
-
|
46 |
-
echo '</tr><tr class="plugin-update-tr"><td colspan="5" class="plugin-update"><div class="update-message" ' . $style . '>' . $message . '</div></td>';
|
47 |
-
}
|
48 |
-
|
49 |
-
private static function autoprefix()
|
50 |
-
{
|
51 |
-
global $gfpdfe_data;
|
52 |
-
if($gfpdfe_data->automated === true && !rgpost('upgrade') && !rgpost('font-initialise'))
|
53 |
-
{
|
54 |
-
return sprintf(__('%sGravity PDF Automated Installer%s: ', 'pdfextended'), '<strong>', '</strong>');
|
55 |
-
}
|
56 |
-
return '';
|
57 |
-
}
|
58 |
-
|
59 |
-
private static function autosuffix()
|
60 |
-
{
|
61 |
-
global $gfpdfe_data;
|
62 |
-
if($gfpdfe_data->automated === true && !rgpost('upgrade') && !rgpost('font-initialise'))
|
63 |
-
{
|
64 |
-
return sprintf(__(' %sGo to installer%s.', 'pdfextended'), '<a href="'. PDF_SETTINGS_URL .'">', '</a>');
|
65 |
-
}
|
66 |
-
return '';
|
67 |
-
}
|
68 |
-
|
69 |
-
public static function gf_pdf_font_install_success()
|
70 |
-
{
|
71 |
-
$prefix = self::autoprefix();
|
72 |
-
$suffix = self::autosuffix();
|
73 |
-
|
74 |
-
$msg = $prefix . __('The font files have been successfully installed. A font can be used by adding its file name (without .ttf) in a CSS font-family declaration.', 'pdfextended') . $suffix;
|
75 |
-
|
76 |
-
self::notice($msg);
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
public static function gf_pdf_font_config_err()
|
81 |
-
{
|
82 |
-
$prefix = self::autoprefix();
|
83 |
-
$suffix = self::autosuffix();
|
84 |
-
|
85 |
-
$msg = $prefix . __('Could not create font configuration file. Try initialise again.', 'pdfextended') . $suffix;
|
86 |
-
|
87 |
-
self::error($msg);
|
88 |
-
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* The software has detected a problem (no configuration.php file or no PDF_EXTENDED_TEMPLATE folder
|
93 |
-
* The user will need to reinitialise
|
94 |
-
*/
|
95 |
-
public static function gf_pdf_problem_detected()
|
96 |
-
{
|
97 |
-
if( !rgpost('update') )
|
98 |
-
{
|
99 |
-
if(rgget("page") == 'gf_settings' && rgget('subview') == 'PDF')
|
100 |
-
{
|
101 |
-
$msg = __('Gravity PDF detected a configuration problem. Please reinitialise the plugin.', 'pdfextended');
|
102 |
-
}
|
103 |
-
else
|
104 |
-
{
|
105 |
-
$msg = sprintf(__('Gravity PDF detected a configuration problem. Please go to the %splugin\'s settings page%s to reinitialise.', 'pdfextended'), '<a href="'.PDF_SETTINGS_URL.'">', '</a>');
|
106 |
-
}
|
107 |
-
|
108 |
-
self::error($msg);
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
/*
|
113 |
-
* The $gfpdfe_data->allow_initilisation function is false
|
114 |
-
* meaning there is a server configuration problem detected
|
115 |
-
*/
|
116 |
-
public static function gf_pdf_server_problem_detected()
|
117 |
-
{
|
118 |
-
if( !rgpost('update') )
|
119 |
-
{
|
120 |
-
if(rgget("page") == 'gf_settings' && rgget('subview') == 'PDF')
|
121 |
-
{
|
122 |
-
$msg = __('Gravity PDF detected a server compatibility problem which prevented the software from running. See the System Status section below for details.', 'pdfextended');
|
123 |
-
}
|
124 |
-
else
|
125 |
-
{
|
126 |
-
$msg = sprintf(__('Gravity PDF detected a server compatibility problem which prevented the software from running. Please go to the %splugin\'s settings page%s to view the issue.', 'pdfextended'), '<a href="'.PDF_SETTINGS_URL.'">', '</a>');
|
127 |
-
}
|
128 |
-
|
129 |
-
self::error($msg);
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* PDF Extended has been freshly installed
|
135 |
-
*/
|
136 |
-
public static function gf_pdf_not_deployed_fresh()
|
137 |
-
{
|
138 |
-
if( !rgpost('update') )
|
139 |
-
{
|
140 |
-
if(rgget("page") == 'gf_settings' && rgget('subview') == 'PDF')
|
141 |
-
{
|
142 |
-
$msg = __('Welcome to Gravity PDF. Before you can use the plugin correctly you need to initilise it.', 'pdfextended');
|
143 |
-
}
|
144 |
-
else
|
145 |
-
{
|
146 |
-
$msg = sprintf(__('Welcome to Gravity PDF. Before you can use the plugin correctly you need to initilise it. Please go to the %splugin\'s settings page%s to initialise.', 'pdfextended'), '<a href="'.PDF_SETTINGS_URL.'">', '</a>');
|
147 |
-
}
|
148 |
-
|
149 |
-
self::notice($msg);
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* The Gravity Forms version isn't compatible. Prompt user to upgrade
|
155 |
-
*/
|
156 |
-
public static function gf_pdf_not_supported()
|
157 |
-
{
|
158 |
-
$msg = sprintf(__('Gravity PDF only works with Gravity Forms version %s and higher. Please %supgrade your copy of Gravity Forms%s to use this plugin.', 'pdfextended'), GF_PDF_EXTENDED_SUPPORTED_VERSION, '<a href="https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154" target="ejejcsingle">', '</a>');
|
159 |
-
|
160 |
-
self::error($msg);
|
161 |
-
}
|
162 |
-
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Cannot create new template folder in active theme directory
|
166 |
-
*/
|
167 |
-
public static function gf_pdf_template_dir_err()
|
168 |
-
{
|
169 |
-
global $gfpdfe_data;
|
170 |
-
|
171 |
-
$prefix = self::autoprefix();
|
172 |
-
$suffix = self::autosuffix();
|
173 |
-
|
174 |
-
$msg = $prefix . sprintf(__('We could not create a template folder in your uploads directory. Please ensure %s is writable by your web server and try again.', 'pdfextended'), str_replace(ABSPATH, '', $gfpdfe_data->upload_dir)) . $suffix;
|
175 |
-
|
176 |
-
self::error($msg);
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Cannot create site directory in template folder
|
181 |
-
*/
|
182 |
-
public static function gf_pdf_template_site_dir_err()
|
183 |
-
{
|
184 |
-
global $gfpdfe_data;
|
185 |
-
|
186 |
-
$prefix = self::autoprefix();
|
187 |
-
$suffix = self::autosuffix();
|
188 |
-
|
189 |
-
$msg = $prefix . sprintf(__('We could not create a site folder in your uploads/%s directory. Please ensure %s is writable by your web server and try again.'), PDF_SAVE_FOLDER, str_replace(ABSPATH, '', $gfpdfe_data->template_location), 'pdfextended') . $suffix;
|
190 |
-
|
191 |
-
self::error($msg);
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Cannot remove old default template files
|
196 |
-
*/
|
197 |
-
public static function gf_pdf_deployment_unlink_error()
|
198 |
-
{
|
199 |
-
$prefix = self::autoprefix();
|
200 |
-
$suffix = self::autosuffix();
|
201 |
-
|
202 |
-
$msg = $prefix . sprintf(__('We could not remove the default template files from %s in your uploads directory. Please ensure %s is wriable by your web server and try again.', 'pdfextended'), PDF_SAVE_FOLDER, str_replace(ABSPATH, '', $gfpdfe_data->template_site_location)) . $suffix;
|
203 |
-
|
204 |
-
self::error($msg);
|
205 |
-
}
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Cannot create new template folder
|
209 |
-
*/
|
210 |
-
public static function gf_pdf_template_move_err()
|
211 |
-
{
|
212 |
-
$prefix = self::autoprefix();
|
213 |
-
$suffix = self::autosuffix();
|
214 |
-
|
215 |
-
$msg = $prefix . sprintf(__('We could not move the template files to the %s folder. Please ensure %s is wriable by your web server and try again.', 'pdfextended'), PDF_SAVE_FOLDER, str_replace(ABSPATH, '', $gfpdfe_data->template_site_location) ) . $suffix;
|
216 |
-
|
217 |
-
self::error($msg);
|
218 |
-
}
|
219 |
-
|
220 |
-
/*
|
221 |
-
* Prompt user to keep the plugin working
|
222 |
-
*/
|
223 |
-
public static function do_template_switch_notice()
|
224 |
-
{
|
225 |
-
/*
|
226 |
-
* Check we aren't in the middle of doing the sync
|
227 |
-
*/
|
228 |
-
if(isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'gfpdfe_migrate'))
|
229 |
-
{
|
230 |
-
return;
|
231 |
-
}
|
232 |
-
|
233 |
-
$msg = sprintf(__('Gravity PDF directory structure has been changed. %sMigrate Now%s %sUnsure what this means?%s', 'pdfextended'), '<a href="'. wp_nonce_url(PDF_SETTINGS_URL, 'gfpdfe_migrate') . '" class="button">', '</a>', '<a href="https://developer.gravitypdf.com/news/migrating-template-directory-means/">', '</a>' );
|
234 |
-
|
235 |
-
self::notice($msg);
|
236 |
-
|
237 |
-
}
|
238 |
-
|
239 |
-
public static function gf_pdf_migration_success()
|
240 |
-
{
|
241 |
-
global $gfpdfe_data;
|
242 |
-
$prefix = ($gfpdfe_data->automated === true && !rgpost('upgrade')) ? sprintf(__('%sGravity PDF Automated Template Migration:%s', 'pdfextended'), '<strong>', '</strong><br>') : '';
|
243 |
-
|
244 |
-
$msg = $prefix . sprintf( __('Your PDF template folder structure was successfully migrated to %s. %sUnsure what this means?%s', 'pdfextended'), str_replace(ABSPATH, '', $gfpdfe_data->upload_dir), '<br><a href="https://developer.gravitypdf.com/news/migrating-template-directory-means/">', '</a>');
|
245 |
-
|
246 |
-
self::notice($msg);
|
247 |
-
|
248 |
-
}
|
249 |
-
|
250 |
-
public static function gf_pdf_network_deploy_success()
|
251 |
-
{
|
252 |
-
global $gfpdfe_data;
|
253 |
-
|
254 |
-
if($gfpdfe_data->automated === true && !rgpost('upgrade') && !rgpost('font-initialise'))
|
255 |
-
{
|
256 |
-
$msg = __('Gravity PDF Auto Initialisation Complete across the entire network.', 'pdfextended');
|
257 |
-
}
|
258 |
-
else
|
259 |
-
{
|
260 |
-
$msg = __('Gravity PDF Initialisation Complete across the entire network.', 'pdfextended');
|
261 |
-
}
|
262 |
-
|
263 |
-
if($gfpdfe_data->fresh_install === true)
|
264 |
-
{
|
265 |
-
$msg .= ' ' . sprintf( __('%sLearn how to configuring the plugin%s.', 'pdfextended'), '<a href="'. PDF_SETTINGS_URL .'">', '</a>');
|
266 |
-
}
|
267 |
-
self::notice($msg);
|
268 |
-
}
|
269 |
-
|
270 |
-
public static function gf_pdf_auto_deploy_success()
|
271 |
-
{
|
272 |
-
global $gfpdfe_data;
|
273 |
-
$msg = __('Gravity PDF Auto Initialisation Complete.', 'pdfextended');
|
274 |
-
|
275 |
-
if($gfpdfe_data->fresh_install === true)
|
276 |
-
{
|
277 |
-
$msg .= ' ' . sprintf( __('%sLearn how to configuring the plugin%s.', 'pdfextended'), '<a href="'. PDF_SETTINGS_URL .'">', '</a>');
|
278 |
-
}
|
279 |
-
self::notice($msg);
|
280 |
-
}
|
281 |
-
|
282 |
-
public static function gf_pdf_merge_network_failure()
|
283 |
-
{
|
284 |
-
global $gfpdfe_data;
|
285 |
-
|
286 |
-
$prefix = self::autoprefix();
|
287 |
-
$errors = (array) $gfpdfe_data->network_error;
|
288 |
-
|
289 |
-
if(sizeof($errors) > 0)
|
290 |
-
{
|
291 |
-
$msg = $prefix . __('There was a problem merging the PDF templates folder on the following sites;', 'pdfextended');
|
292 |
-
$msg .= '<ul>';
|
293 |
-
|
294 |
-
$base_site_url = site_url();
|
295 |
-
foreach($errors as $site)
|
296 |
-
{
|
297 |
-
switch_to_blog( (int) $site['blog_id'] );
|
298 |
-
$url = str_replace($base_site_url, site_url(), PDF_SETTINGS_URL );
|
299 |
-
$msg .= "<li><a href='$url'>{$site['domain']}{$site['path']}</a></li>";
|
300 |
-
restore_current_blog();
|
301 |
-
}
|
302 |
-
$msg .= '</ul>';
|
303 |
-
|
304 |
-
$msg .= __('Follow the site links above and try run the PDF template merging function again, or reinitialise the software.', 'pdfextended');
|
305 |
-
}
|
306 |
-
else
|
307 |
-
{
|
308 |
-
$msg = $prefix . __('An unknown error occured while merging the PDF template folders. Please try again.', 'pdfextended');
|
309 |
-
}
|
310 |
-
|
311 |
-
self::error($msg);
|
312 |
-
}
|
313 |
-
|
314 |
-
public static function gf_pdf_auto_deploy_network_failure()
|
315 |
-
{
|
316 |
-
global $gfpdfe_data;
|
317 |
-
|
318 |
-
$prefix = self::autoprefix();
|
319 |
-
$errors = (array) $gfpdfe_data->network_error;
|
320 |
-
|
321 |
-
if(sizeof($errors) > 0)
|
322 |
-
{
|
323 |
-
$msg = $prefix . __('There was a network initialisation issue on the following sites;', 'pdfextended');
|
324 |
-
$msg .= '<ul>';
|
325 |
-
|
326 |
-
$base_site_url = site_url();
|
327 |
-
foreach($errors as $site)
|
328 |
-
{
|
329 |
-
switch_to_blog( (int) $site['blog_id'] );
|
330 |
-
$url = str_replace($base_site_url, site_url(), PDF_SETTINGS_URL );
|
331 |
-
$msg .= "<li><a href='$url'>{$site['domain']}{$site['path']}</a></li>";
|
332 |
-
restore_current_blog();
|
333 |
-
}
|
334 |
-
$msg .= '</ul>';
|
335 |
-
|
336 |
-
$msg .= __('Please try manually initialise the software', 'pdfextended');
|
337 |
-
}
|
338 |
-
else
|
339 |
-
{
|
340 |
-
$msg = $prefix . __('An unknown network initialisation error occured. Please try initialise again.', 'pdfextended');
|
341 |
-
}
|
342 |
-
|
343 |
-
self::error($msg);
|
344 |
-
}
|
345 |
-
|
346 |
-
public static function gf_pdf_deploy_success() {
|
347 |
-
$msg = __('You\'ve successfully initialised Gravity PDF.', 'pdfextended');
|
348 |
-
|
349 |
-
self::notice($msg);
|
350 |
-
}
|
351 |
-
|
352 |
-
public static function display_compatibility_error()
|
353 |
-
{
|
354 |
-
$message = sprintf(__("Gravity Forms " . GF_PDF_EXTENDED_SUPPORTED_VERSION . " is required to use this plugin. Activate it now or %spurchase it today!%s", 'pdfextended'), "<a href='https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154'>", "</a>");
|
355 |
-
self::display_plugin_message($message, true);
|
356 |
-
}
|
357 |
-
|
358 |
-
public static function display_wp_compatibility_error()
|
359 |
-
{
|
360 |
-
$message = __("Wordpress " . GF_PDF_EXTENDED_WP_SUPPORTED_VERSION . " or higher is required to use this plugin.", 'pdfextended');
|
361 |
-
self::display_plugin_message($message, true);
|
362 |
-
}
|
363 |
-
|
364 |
-
public static function display_pdf_compatibility_error()
|
365 |
-
{
|
366 |
-
$message = __("PHP " . GF_PDF_EXTENDED_PHP_SUPPORTED_VERSION . " or higher is required to use this plugin.", 'pdfextended');
|
367 |
-
self::display_plugin_message($message, true);
|
368 |
-
}
|
369 |
-
|
370 |
-
public static function add_tooltips($tooltips)
|
371 |
-
{
|
372 |
-
$tooltips['pdf_overwrite'] = sprintf(__('If you reinitialise and enable this option %syou will overwrite%s the default and example template files in your active theme directory.', 'pdfextended'), '<strong>', '</strong>');
|
373 |
-
|
374 |
-
return $tooltips;
|
375 |
-
}
|
376 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper/pdf-common.php
DELETED
@@ -1,273 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin: Gravity PDF
|
5 |
-
* File: pdf-common.php
|
6 |
-
*
|
7 |
-
* This file holds a number of common functions used throughout the plugin
|
8 |
-
*/
|
9 |
-
|
10 |
-
class PDF_Common
|
11 |
-
{
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Depreciated function
|
15 |
-
*/
|
16 |
-
public static function setup_ids() { }
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Takes over for setup_ids() but is now called much earlier in the process
|
20 |
-
* @return Boolean whether settings the ids was successful or not
|
21 |
-
*/
|
22 |
-
public static function get_ids()
|
23 |
-
{
|
24 |
-
global $form_id, $lead_id, $lead_ids;
|
25 |
-
|
26 |
-
$form_id = ($form_id) ? $form_id : absint( rgget("fid") );
|
27 |
-
$lead_ids = ($lead_id) ? array($lead_id) : explode(',', rgget("lid"));
|
28 |
-
|
29 |
-
/**
|
30 |
-
* If form ID and lead ID hasn't been set stop the PDF from attempting to generate
|
31 |
-
*/
|
32 |
-
if(empty($form_id) || empty($lead_ids))
|
33 |
-
{
|
34 |
-
return false;
|
35 |
-
}
|
36 |
-
return true;
|
37 |
-
}
|
38 |
-
|
39 |
-
/*
|
40 |
-
* We will use the output buffer to get the HTML template
|
41 |
-
*/
|
42 |
-
public static function get_html_template($filename)
|
43 |
-
{
|
44 |
-
global $form_id, $lead_id, $lead_ids;
|
45 |
-
|
46 |
-
ob_start();
|
47 |
-
require($filename);
|
48 |
-
|
49 |
-
$page = ob_get_contents();
|
50 |
-
ob_end_clean();
|
51 |
-
|
52 |
-
return $page;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Get the name of the PDF based on the Form and the submission
|
57 |
-
*/
|
58 |
-
public static function get_pdf_filename($form_id, $lead_id)
|
59 |
-
{
|
60 |
-
return "form-$form_id-entry-$lead_id.pdf";
|
61 |
-
}
|
62 |
-
|
63 |
-
/*
|
64 |
-
* We need to validate the PDF name
|
65 |
-
* Check the size limit, if the file name's syntax is correct
|
66 |
-
* and strip any characters that aren't classed as valid file name characters.
|
67 |
-
*/
|
68 |
-
public static function validate_pdf_name($name, $form_id = false, $lead_id = false)
|
69 |
-
{
|
70 |
-
$pdf_name = $name;
|
71 |
-
|
72 |
-
if($form_id > 0)
|
73 |
-
{
|
74 |
-
$pdf_name = self::do_mergetags($pdf_name, $form_id, $lead_id);
|
75 |
-
}
|
76 |
-
|
77 |
-
/*
|
78 |
-
* Limit the size of the filename to 120 characters
|
79 |
-
*/
|
80 |
-
if(strlen($pdf_name) > 120)
|
81 |
-
{
|
82 |
-
$pdf_name = substr($pdf_name, 0, 120);
|
83 |
-
}
|
84 |
-
|
85 |
-
/*
|
86 |
-
* Remove extension from the end of the filename so we can replace all '.'
|
87 |
-
* Will add back before we are finished
|
88 |
-
*/
|
89 |
-
if(substr($pdf_name, -4) == '.pdf')
|
90 |
-
{
|
91 |
-
$pdf_name = substr($pdf_name, 0, -4);
|
92 |
-
}
|
93 |
-
|
94 |
-
/*
|
95 |
-
* Remove any invalid (mostly Windows) characters from filename
|
96 |
-
*/
|
97 |
-
$pdf_name = self::remove_invalid_characters($pdf_name);
|
98 |
-
$pdf_name = $pdf_name . '.pdf';
|
99 |
-
|
100 |
-
return $pdf_name;
|
101 |
-
}
|
102 |
-
|
103 |
-
public static function remove_invalid_characters($name)
|
104 |
-
{
|
105 |
-
/*
|
106 |
-
* Remove any invalid (mostly Windows) characters from filename
|
107 |
-
*/
|
108 |
-
$name = str_replace('/', '-', $name);
|
109 |
-
$name = str_replace('\\', '-', $name);
|
110 |
-
$name = str_replace('"', '-', $name);
|
111 |
-
$name = str_replace('*', '-', $name);
|
112 |
-
$name = str_replace('?', '-', $name);
|
113 |
-
$name = str_replace('|', '-', $name);
|
114 |
-
$name = str_replace(':', '-', $name);
|
115 |
-
$name = str_replace('<', '-', $name);
|
116 |
-
$name = str_replace('>', '-', $name);
|
117 |
-
$name = str_replace('.', '_', $name);
|
118 |
-
|
119 |
-
return $name;
|
120 |
-
}
|
121 |
-
|
122 |
-
/*
|
123 |
-
* Replace all the merge tag fields in the string
|
124 |
-
* We wll remove the {all_fields} mergetag is it is not needed
|
125 |
-
*/
|
126 |
-
public static function do_mergetags($string, $form_id, $lead_id)
|
127 |
-
{
|
128 |
-
/*
|
129 |
-
* Unconvert { and } symbols from HTML entities
|
130 |
-
*/
|
131 |
-
$string = str_replace('{', '{', $string);
|
132 |
-
$string = str_replace('}', '}', $string);
|
133 |
-
|
134 |
-
/* strip {all_fields} merge tag from $string */
|
135 |
-
$string = str_replace('{all_fields}', '', $string);
|
136 |
-
|
137 |
-
/*
|
138 |
-
* Get form and lead data
|
139 |
-
*/
|
140 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
141 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
142 |
-
|
143 |
-
return trim(GFCommon::replace_variables($string, $form, $lead, false, false, false));
|
144 |
-
}
|
145 |
-
|
146 |
-
/*
|
147 |
-
* Allow users to view the $form_data array, if it exists
|
148 |
-
*/
|
149 |
-
public static function view_data($form_data)
|
150 |
-
{
|
151 |
-
if(isset($_GET['data']) && $_GET['data'] === '1' && GFCommon::current_user_can_any("gravityforms_view_entries"))
|
152 |
-
{
|
153 |
-
print '<pre>';
|
154 |
-
print_r($form_data);
|
155 |
-
print '</pre>';
|
156 |
-
exit;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
/*
|
161 |
-
* New to 3.0.2 we will use WP_Filesystem API to manipulate files instead of using in-built PHP functions
|
162 |
-
* $post Array the post data to include in the request_filesystem_credntials API
|
163 |
-
*/
|
164 |
-
public static function initialise_WP_filesystem_API($post, $nonce)
|
165 |
-
{
|
166 |
-
|
167 |
-
$url = wp_nonce_url(PDF_SETTINGS_URL, $nonce);
|
168 |
-
|
169 |
-
if (false === ($creds = request_filesystem_credentials($url, '', false, false, $post) ) ) {
|
170 |
-
/*
|
171 |
-
* If we get here, then we don't have correct permissions and we need to get the FTP details.
|
172 |
-
* request_filesystem_credentials will handle all that
|
173 |
-
*/
|
174 |
-
return false; // stop the normal page from displaying
|
175 |
-
}
|
176 |
-
|
177 |
-
/*
|
178 |
-
* Check if the credentials are no good and display an error
|
179 |
-
*/
|
180 |
-
if ( ! WP_Filesystem($creds) ) {
|
181 |
-
request_filesystem_credentials($url, '', true, false, $post);
|
182 |
-
return false;
|
183 |
-
}
|
184 |
-
|
185 |
-
return true;
|
186 |
-
|
187 |
-
}
|
188 |
-
|
189 |
-
/*
|
190 |
-
* Check if we are on the PDF settings page
|
191 |
-
*/
|
192 |
-
public static function is_settings()
|
193 |
-
{
|
194 |
-
if(isset($_GET['page']) && isset($_GET['subview']) && $_GET['page'] === 'gf_settings' && strtolower($_GET['subview']) === 'pdf')
|
195 |
-
{
|
196 |
-
return true;
|
197 |
-
}
|
198 |
-
return false;
|
199 |
-
}
|
200 |
-
|
201 |
-
public static function post($name)
|
202 |
-
{
|
203 |
-
if(isset($_POST[$name]))
|
204 |
-
return $_POST[$name];
|
205 |
-
|
206 |
-
return '';
|
207 |
-
}
|
208 |
-
|
209 |
-
|
210 |
-
public static function get($name)
|
211 |
-
{
|
212 |
-
if(isset($_GET[$name]))
|
213 |
-
return $_GET[$name];
|
214 |
-
|
215 |
-
return '';
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Gets the site name for use as a directory name
|
220 |
-
* @return String Returns the current 'safe' directory site name
|
221 |
-
*/
|
222 |
-
public static function get_site_name()
|
223 |
-
{
|
224 |
-
$name = (is_ssl()) ? str_replace('https://', '', site_url()) : str_replace('http://', '', site_url());
|
225 |
-
return self::remove_invalid_characters($name);
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* Modified version of get_upload_dir() which just focuses on the base directory
|
230 |
-
* no matter if single or multisite installation
|
231 |
-
* We also only needed the basedir and baseurl so stripped out all the extras
|
232 |
-
* @return Array Base dir and url for the upload directory
|
233 |
-
*/
|
234 |
-
public static function get_upload_dir()
|
235 |
-
{
|
236 |
-
$siteurl = get_option( 'siteurl' );
|
237 |
-
$upload_path = trim( get_option( 'upload_path' ) );
|
238 |
-
|
239 |
-
if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
|
240 |
-
$dir = WP_CONTENT_DIR . '/uploads';
|
241 |
-
} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
|
242 |
-
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
|
243 |
-
$dir = path_join( ABSPATH, $upload_path );
|
244 |
-
} else {
|
245 |
-
$dir = $upload_path;
|
246 |
-
}
|
247 |
-
|
248 |
-
if ( !$url = get_option( 'upload_url_path' ) ) {
|
249 |
-
if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
|
250 |
-
$url = WP_CONTENT_URL . '/uploads';
|
251 |
-
else
|
252 |
-
$url = trailingslashit( $siteurl ) . $upload_path;
|
253 |
-
}
|
254 |
-
|
255 |
-
/*
|
256 |
-
* Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
|
257 |
-
* We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
|
258 |
-
*/
|
259 |
-
if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
|
260 |
-
$dir = ABSPATH . UPLOADS;
|
261 |
-
$url = trailingslashit( $siteurl ) . UPLOADS;
|
262 |
-
}
|
263 |
-
|
264 |
-
$basedir = $dir;
|
265 |
-
$baseurl = $url;
|
266 |
-
|
267 |
-
return array(
|
268 |
-
'basedir' => $basedir,
|
269 |
-
'baseurl' => $baseurl,
|
270 |
-
);
|
271 |
-
}
|
272 |
-
}
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper/pdf-configuration-indexer.php
DELETED
@@ -1,417 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class: PDFGenerator
|
5 |
-
* Plugin: Gravity PDF
|
6 |
-
* Usage: assign options from user configuration file, automatically attach PDFs to specified Gravity Forms, and view PDF from admin area.
|
7 |
-
*/
|
8 |
-
|
9 |
-
class PDFGenerator
|
10 |
-
{
|
11 |
-
|
12 |
-
/*
|
13 |
-
* Set default values for forms not assigned a PDF
|
14 |
-
*/
|
15 |
-
public static $default = array(
|
16 |
-
'template' => 'default-template.php',
|
17 |
-
'pdf_size' => 'a4',
|
18 |
-
'orientation' => 'portrait',
|
19 |
-
'rtf' => false,
|
20 |
-
'security' => false
|
21 |
-
);
|
22 |
-
|
23 |
-
public static $allowed_privileges = array('copy', 'print', 'modify', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-highres');
|
24 |
-
|
25 |
-
public $configuration = array();
|
26 |
-
|
27 |
-
/*
|
28 |
-
* Switch to verify if configuration file exists.
|
29 |
-
* If not, user is using old functions.php method and we
|
30 |
-
* don't want to interfere with it.
|
31 |
-
*/
|
32 |
-
public $disabled = false;
|
33 |
-
|
34 |
-
/*
|
35 |
-
* The index holds the form_id and configuration key in $this->configuration
|
36 |
-
* so each form knows
|
37 |
-
*/
|
38 |
-
public $index = array();
|
39 |
-
|
40 |
-
public function __construct()
|
41 |
-
{
|
42 |
-
global $gfpdfe_data;
|
43 |
-
|
44 |
-
/*
|
45 |
-
* Do configuration pre-processing
|
46 |
-
*/
|
47 |
-
|
48 |
-
/*
|
49 |
-
* Check if user configuration file exists
|
50 |
-
* If not disable $configuration and $index.
|
51 |
-
*/
|
52 |
-
if(!file_exists( $gfpdfe_data->template_site_location . 'configuration.php') )
|
53 |
-
{
|
54 |
-
$this->disabled = true;
|
55 |
-
return;
|
56 |
-
}
|
57 |
-
else
|
58 |
-
{
|
59 |
-
/*
|
60 |
-
* Include the configuration file and set up the configuration variable.
|
61 |
-
*/
|
62 |
-
require_once( $gfpdfe_data->template_site_location . 'configuration.php' );
|
63 |
-
/*
|
64 |
-
* $gf_pdf_config included from configuration.php file
|
65 |
-
*/
|
66 |
-
$this->configuration = (isset($gf_pdf_config)) ? $gf_pdf_config : array();
|
67 |
-
|
68 |
-
/*
|
69 |
-
* Merge down the default configuration options
|
70 |
-
*/
|
71 |
-
foreach($this->configuration as &$node)
|
72 |
-
{
|
73 |
-
$node = $this->merge_defaults($node);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
$this->pdf_config();
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Merge the configuration node with the default options, ensuring the config node takes precendent
|
82 |
-
* @param array $config the configuration node from $gfpdf->configuration()
|
83 |
-
* @return array Merged default/node configuration options
|
84 |
-
*/
|
85 |
-
private function merge_defaults($config)
|
86 |
-
{
|
87 |
-
global $gf_pdf_default_configuration;
|
88 |
-
|
89 |
-
/*
|
90 |
-
* If the default settings are set we'll merge them into the configuration index
|
91 |
-
*/
|
92 |
-
if(is_array($gf_pdf_default_configuration) && sizeof($gf_pdf_default_configuration) > 0)
|
93 |
-
{
|
94 |
-
$config = array_replace_recursive($gf_pdf_default_configuration, $config);
|
95 |
-
}
|
96 |
-
|
97 |
-
return $config;
|
98 |
-
}
|
99 |
-
|
100 |
-
/*
|
101 |
-
* Run through user configuration and set PDF options
|
102 |
-
*/
|
103 |
-
private function pdf_config()
|
104 |
-
{
|
105 |
-
if(sizeof($this->configuration) == 0)
|
106 |
-
{
|
107 |
-
return;
|
108 |
-
}
|
109 |
-
|
110 |
-
$this->set_form_pdfs();
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
-
/*
|
115 |
-
* Set the configuration index so it's faster to access template configuration information
|
116 |
-
*/
|
117 |
-
private function set_form_pdfs()
|
118 |
-
{
|
119 |
-
foreach($this->configuration as $key => $config)
|
120 |
-
{
|
121 |
-
if(!is_array($config['form_id']))
|
122 |
-
{
|
123 |
-
$this->assign_index($config['form_id'], $key);
|
124 |
-
}
|
125 |
-
else
|
126 |
-
{
|
127 |
-
foreach($config['form_id'] as $id)
|
128 |
-
{
|
129 |
-
$this->assign_index($id, $key);
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
/*
|
137 |
-
* Check to see if ID is valid
|
138 |
-
* If so, assign ID => key to index
|
139 |
-
*/
|
140 |
-
public function assign_index($id, $key)
|
141 |
-
{
|
142 |
-
$id = (int) $id;
|
143 |
-
if($id !== 0)
|
144 |
-
{
|
145 |
-
/*
|
146 |
-
* Assign the outter array with the form ID and the value as the configuration key
|
147 |
-
*/
|
148 |
-
$this->index[$id][] = $key;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
/*
|
153 |
-
* Searches the index for the configuration key
|
154 |
-
* Return: form PDF configuration
|
155 |
-
*/
|
156 |
-
public function get_config($id)
|
157 |
-
{
|
158 |
-
return (isset($this->index[$id])) ? $this->index[$id] : false;
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Pull all config nodes for a single form
|
163 |
-
* @param Integer $form_id The form ID a user is looking for
|
164 |
-
* @return Array The configuration nodes for a particular form
|
165 |
-
*/
|
166 |
-
public function get_form_configuration($form_id)
|
167 |
-
{
|
168 |
-
if(!isset($this->index[$form_id]))
|
169 |
-
{
|
170 |
-
return false;
|
171 |
-
}
|
172 |
-
|
173 |
-
$indexes = $this->index[$form_id];
|
174 |
-
|
175 |
-
$config_nodes = array();
|
176 |
-
|
177 |
-
foreach($indexes as $index)
|
178 |
-
{
|
179 |
-
$config_nodes[$index] = $this->configuration[$index];
|
180 |
-
}
|
181 |
-
|
182 |
-
return $config_nodes;
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Depreciated
|
187 |
-
* See get_default_config_data()
|
188 |
-
*/
|
189 |
-
public function get_config_data($form_id)
|
190 |
-
{
|
191 |
-
return $this->get_default_config_data($form_id);
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Replaced get_config_data in default tempaltes to only return the default-only configuration options
|
196 |
-
* @param integer $form_id form ID
|
197 |
-
* @return array Default template configuration options
|
198 |
-
*/
|
199 |
-
public function get_default_config_data($form_id)
|
200 |
-
{
|
201 |
-
$config = $this->pull_config_data($form_id);
|
202 |
-
|
203 |
-
/* get the default template values and return in array */
|
204 |
-
$show_html_fields = (isset($config['default-show-html']) && $config['default-show-html'] == 1) ? true : false;
|
205 |
-
$show_empty_fields = (isset($config['default-show-empty']) && $config['default-show-empty'] == 1) ? true : false;
|
206 |
-
$show_page_names = (isset($config['default-show-page-names']) && $config['default-show-page-names'] == 1) ? true : false;
|
207 |
-
|
208 |
-
return array(
|
209 |
-
'html_field' => $show_html_fields,
|
210 |
-
'empty_field' => $show_empty_fields,
|
211 |
-
'page_names' => $show_page_names,
|
212 |
-
);
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Get the configuration information based on the form ID
|
217 |
-
* If multiple nodes assigned to form look for $_GET['aid']
|
218 |
-
* @param integer $form_id ID of the form
|
219 |
-
* @return array configuration node
|
220 |
-
*/
|
221 |
-
public function pull_config_data($form_id)
|
222 |
-
{
|
223 |
-
if(!isset($this->index[$form_id]))
|
224 |
-
{
|
225 |
-
return false;
|
226 |
-
}
|
227 |
-
|
228 |
-
$index = $this->index[$form_id];
|
229 |
-
/*
|
230 |
-
* Because we now allow multiple PDF templates per form we need a way to get the correct PDF settings
|
231 |
-
* To do this we use the $_GET variable 'aid'
|
232 |
-
* If 'aid' is not found we will pull the first entry
|
233 |
-
* Note: 'aid' has been incremented by 1 so 'aid' === 0 is never found
|
234 |
-
*/
|
235 |
-
if(isset($_GET['aid']) && (int) $_GET['aid'] > 0)
|
236 |
-
{
|
237 |
-
$aid = (int) $_GET['aid'] - 1;
|
238 |
-
return $this->configuration[$index[$aid]];
|
239 |
-
}
|
240 |
-
|
241 |
-
/*
|
242 |
-
* No valid configuration file found so pull the default
|
243 |
-
*/
|
244 |
-
return $this->configuration[$index[0]];
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Gets the aid (a temporary ID assigned to config node clusters on a single form ) from the $config ID
|
249 |
-
* @param Integer $config_id The $this->configuration ID of the node
|
250 |
-
* @param Integer $form_id The Gravity Form ID
|
251 |
-
* @return Integer The configuration nodes aid (a temporary ID assigned to config node clusters on a single form )
|
252 |
-
*/
|
253 |
-
public function get_aid($config_id, $form_id)
|
254 |
-
{
|
255 |
-
$index = self::index_lookup($config_id, $form_id);
|
256 |
-
|
257 |
-
if($index !== false)
|
258 |
-
{
|
259 |
-
return $index + 1;
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Does a reverse look up on the $this->index using the $this->configuration ID
|
265 |
-
* @param Integer $config_id The $this->configuration ID of the node
|
266 |
-
* @return Integer The index ID
|
267 |
-
* @return Array If $form_id isn't passed an array of index IDs will always be returns
|
268 |
-
*/
|
269 |
-
public function index_lookup($config_id, $form_id = false)
|
270 |
-
{
|
271 |
-
$config = $this->configuration[$config_id];
|
272 |
-
|
273 |
-
/*
|
274 |
-
* Check the configuration node actually exists
|
275 |
-
*/
|
276 |
-
if(!is_array($config))
|
277 |
-
{
|
278 |
-
return false;
|
279 |
-
}
|
280 |
-
|
281 |
-
/* get the form ID */
|
282 |
-
$config_form_id = (!is_array($config['form_id'])) ? array($config['form_id']) : $config['form_id'];
|
283 |
-
|
284 |
-
|
285 |
-
/*
|
286 |
-
* If $form_id is set and inside the config node array we will do a search on it
|
287 |
-
*/
|
288 |
-
if($form_id && in_array($form_id, $config_form_id) && isset($this->index[$form_id]))
|
289 |
-
{
|
290 |
-
/* return the array key, or false */
|
291 |
-
return array_search($config_id, $this->index[$form_id]);
|
292 |
-
}
|
293 |
-
|
294 |
-
/*
|
295 |
-
* Loop through the form IDs and return all indexes associated with it
|
296 |
-
*/
|
297 |
-
$index_keys = array();
|
298 |
-
foreach($config_form_id as $f_id)
|
299 |
-
{
|
300 |
-
if(isset($this->index[$f_id]))
|
301 |
-
{
|
302 |
-
/*
|
303 |
-
* Search for the config ID in each form's index
|
304 |
-
*/
|
305 |
-
$index_search = array_search($config_id, $this->index[$f_id]);
|
306 |
-
if($index_search !== false)
|
307 |
-
{
|
308 |
-
$index_keys[] = $index_search;
|
309 |
-
}
|
310 |
-
}
|
311 |
-
}
|
312 |
-
|
313 |
-
/*
|
314 |
-
* We have results so return them
|
315 |
-
*/
|
316 |
-
if(sizeof($index_keys) > 0)
|
317 |
-
{
|
318 |
-
return $index_keys;
|
319 |
-
}
|
320 |
-
|
321 |
-
return false;
|
322 |
-
}
|
323 |
-
|
324 |
-
/*
|
325 |
-
* Search for the template from a given form id
|
326 |
-
* Return: the first template found for the form
|
327 |
-
*/
|
328 |
-
public function get_template($form_id)
|
329 |
-
{
|
330 |
-
global $gf_pdf_default_configuration;
|
331 |
-
|
332 |
-
$template = '';
|
333 |
-
|
334 |
-
/* Set the default template based on if the default is set */
|
335 |
-
$default_template = self::$default['template'];
|
336 |
-
|
337 |
-
if(is_array($gf_pdf_default_configuration) && sizeof($gf_pdf_default_configuration) > 0 && isset($gf_pdf_default_configuration['template']) )
|
338 |
-
{
|
339 |
-
$default_template = $gf_pdf_default_configuration['template'];
|
340 |
-
}
|
341 |
-
|
342 |
-
if(isset($this->index[$form_id]))
|
343 |
-
{
|
344 |
-
/*
|
345 |
-
* Check if PDF template is avaliable
|
346 |
-
*/
|
347 |
-
if(isset($this->configuration[$this->index[$form_id][0]]['template']))
|
348 |
-
{
|
349 |
-
$user_template = (isset($_GET['template'])) ? $_GET['template'] : '';
|
350 |
-
$match = false;
|
351 |
-
|
352 |
-
foreach($this->index[$form_id] as $index)
|
353 |
-
{
|
354 |
-
if($this->configuration[$index]['template'] === $user_template)
|
355 |
-
{
|
356 |
-
$match = true;
|
357 |
-
}
|
358 |
-
}
|
359 |
-
|
360 |
-
$template = ($match === true) ? $user_template : $this->configuration[$this->index[$form_id][0]]['template'];
|
361 |
-
}
|
362 |
-
|
363 |
-
if(strlen($template) == 0)
|
364 |
-
{
|
365 |
-
$template = $default_template;
|
366 |
-
}
|
367 |
-
return $template;
|
368 |
-
}
|
369 |
-
|
370 |
-
if( (strlen($template) == 0) && (GFPDF_SET_DEFAULT_TEMPLATE === true))
|
371 |
-
{
|
372 |
-
/*
|
373 |
-
* Check if a default configuration is defined
|
374 |
-
*/
|
375 |
-
return $default_template;
|
376 |
-
}
|
377 |
-
else
|
378 |
-
{
|
379 |
-
return false;
|
380 |
-
}
|
381 |
-
|
382 |
-
}
|
383 |
-
|
384 |
-
public function get_pdf_name($id, $form_id = false, $lead_id = false)
|
385 |
-
{
|
386 |
-
if(isset($this->configuration[$id]['filename']))
|
387 |
-
{
|
388 |
-
return PDF_Common::validate_pdf_name($this->configuration[$id]['filename'], $form_id, $lead_id);
|
389 |
-
}
|
390 |
-
else
|
391 |
-
{
|
392 |
-
return PDF_Common::validate_pdf_name(PDF_Common::get_pdf_filename($form_id, $lead_id), $form_id, $lead_id);
|
393 |
-
}
|
394 |
-
}
|
395 |
-
|
396 |
-
public function validate_privileges($privs)
|
397 |
-
{
|
398 |
-
if(!is_array($privs))
|
399 |
-
{
|
400 |
-
return array();
|
401 |
-
}
|
402 |
-
|
403 |
-
$new_privs = array_filter($privs, array($this, 'array_filter_privilages'));
|
404 |
-
|
405 |
-
return $new_privs;
|
406 |
-
}
|
407 |
-
|
408 |
-
private function array_filter_privilages($i)
|
409 |
-
{
|
410 |
-
if(in_array($i, PDFGenerator::$allowed_privileges))
|
411 |
-
{
|
412 |
-
return true;
|
413 |
-
}
|
414 |
-
return false;
|
415 |
-
}
|
416 |
-
|
417 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper/pdf-entry-detail.php
DELETED
@@ -1,1908 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if(!class_exists('GFPDFEntryDetail'))
|
3 |
-
{
|
4 |
-
|
5 |
-
/*
|
6 |
-
* Include Gravity Forms Currency class (it not already included)
|
7 |
-
*/
|
8 |
-
if ( false === class_exists( 'RGCurrency' ) ) {
|
9 |
-
require_once( GFCommon::get_base_path() . '/currency.php' );
|
10 |
-
}
|
11 |
-
|
12 |
-
add_filter('gfpdf_field_content', array('GFPDFEntryDetail', 'encode_tags'), 10, 2); /* encode shortcodes in user's response so they aren't converted later by do_shortcode */
|
13 |
-
class GFPDFEntryDetail {
|
14 |
-
|
15 |
-
/* holds the form fields, stored by field ID */
|
16 |
-
static $fields;
|
17 |
-
|
18 |
-
/* NEED THIS FUNCTION - BLD */
|
19 |
-
public static function lead_detail_grid($form, $lead, $allow_display_empty_fields=false, $show_html=false, $show_page_name=false, $return=false, $show_section_breaks=false) {
|
20 |
-
$form_id = $form['id'];
|
21 |
-
$results = array();
|
22 |
-
|
23 |
-
if($return === true)
|
24 |
-
{
|
25 |
-
$results['title'] = '<h2 id="details" class="default">'. $form['title'] .'</h2>';
|
26 |
-
}
|
27 |
-
else
|
28 |
-
{
|
29 |
-
?>
|
30 |
-
<div id='container'>
|
31 |
-
<h2 id='details' class='default'><?php echo $form['title']?></h2>
|
32 |
-
<?php
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
$count = 0;
|
37 |
-
$field_count = sizeof($form['fields']);
|
38 |
-
|
39 |
-
$has_product_fields = false;
|
40 |
-
|
41 |
-
$page_number = 0;
|
42 |
-
foreach($form['fields'] as $field) {
|
43 |
-
|
44 |
-
|
45 |
-
/*
|
46 |
-
* Check if this field has been excluded from the list
|
47 |
-
*/
|
48 |
-
if(isset($field['cssClass']) && strpos($field['cssClass'], 'exclude') !== false)
|
49 |
-
{
|
50 |
-
/* skip this field */
|
51 |
-
continue;
|
52 |
-
}
|
53 |
-
|
54 |
-
/*
|
55 |
-
* Skip over hidden fields
|
56 |
-
*/
|
57 |
-
if(GFFormsModel::is_field_hidden( $form, $field, array(), $lead ))
|
58 |
-
{
|
59 |
-
continue;
|
60 |
-
}
|
61 |
-
|
62 |
-
/*
|
63 |
-
* Check if we are to show the page names
|
64 |
-
*/
|
65 |
-
if($show_page_name === true)
|
66 |
-
{
|
67 |
-
if((int) $field['pageNumber'] !== $page_number)
|
68 |
-
{
|
69 |
-
/*
|
70 |
-
* Display the page number
|
71 |
-
*/
|
72 |
-
if($return === true)
|
73 |
-
{
|
74 |
-
$results['field'][] = '<h2 id="field-'. $field['id'].'" class="default entry-view-page-break">'. $form['pagination']['pages'][$page_number] .'</h2>';
|
75 |
-
}
|
76 |
-
else
|
77 |
-
{
|
78 |
-
?>
|
79 |
-
<h2 id='field-<?php echo $field['id']; ?>' class='default entry-view-page-break'><?php echo $form['pagination']['pages'][$page_number]; ?></h2>
|
80 |
-
<?php
|
81 |
-
}
|
82 |
-
/*
|
83 |
-
* Increment the page number
|
84 |
-
*/
|
85 |
-
$page_number++;
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
$even = $odd = '';
|
90 |
-
|
91 |
-
switch(RGFormsModel::get_input_type($field)){
|
92 |
-
case 'section' :
|
93 |
-
|
94 |
-
if(!GFCommon::is_section_empty($field, $form, $lead) || $allow_display_empty_fields){
|
95 |
-
$count++;
|
96 |
-
|
97 |
-
if($return === true)
|
98 |
-
{
|
99 |
-
$results['field'][] = '<h2 id="field-'.$field['id'].'" class="default entry-view-section-break">'. esc_html(GFCommon::get_label($field)) .'</h2>';
|
100 |
-
}
|
101 |
-
else
|
102 |
-
{
|
103 |
-
?>
|
104 |
-
<h2 id="field-<?php echo $field['id']; ?>" class="default entry-view-section-break"><?php echo esc_html(GFCommon::get_label($field))?></h2>
|
105 |
-
<?php
|
106 |
-
}
|
107 |
-
}
|
108 |
-
break;
|
109 |
-
|
110 |
-
case 'captcha':
|
111 |
-
case 'password':
|
112 |
-
case 'page':
|
113 |
-
//ignore captcha, html, password, page field
|
114 |
-
break;
|
115 |
-
case 'html':
|
116 |
-
if($show_html == true)
|
117 |
-
{
|
118 |
-
|
119 |
-
$count++;
|
120 |
-
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
121 |
-
$last_row = $is_last ? ' lastrow' : '';
|
122 |
-
$even = ($count%2) ? ' odd' : ' even';
|
123 |
-
|
124 |
-
$display_value = $field['content'];
|
125 |
-
$value = '';
|
126 |
-
|
127 |
-
$content = '<div id="field-'. $field['id'] .'" class="entry-view-html-value' . $last_row . $even . '"><div class="value">' . $display_value . '</div></div>';
|
128 |
-
$content = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
129 |
-
|
130 |
-
if($return === true)
|
131 |
-
{
|
132 |
-
$results['field'][] = $content;
|
133 |
-
}
|
134 |
-
else
|
135 |
-
{
|
136 |
-
echo $content;
|
137 |
-
}
|
138 |
-
}
|
139 |
-
break;
|
140 |
-
case 'signature':
|
141 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
142 |
-
$public_folder = RGFormsModel::get_upload_url_root() . 'signatures/';
|
143 |
-
$server_folder = RGFormsModel::get_upload_root() . 'signatures/';
|
144 |
-
|
145 |
-
$image_size = getimagesize($server_folder.$value);
|
146 |
-
$width = $image_size[0] / 4;
|
147 |
-
$height = $image_size[1] / 4;
|
148 |
-
|
149 |
-
$display_value = '<img src="'. $server_folder.$value .'" alt="Signature" width=" '. $width .'" height="'. $height .'" />';
|
150 |
-
|
151 |
-
|
152 |
-
$is_last = $count >= $field_count ? true : false;
|
153 |
-
$last_row = $is_last ? ' lastrow' : '';
|
154 |
-
|
155 |
-
if(strlen($value) > 0 && (file_exists($server_folder.$value)) && (is_dir($server_folder.$value) !== true) )
|
156 |
-
{
|
157 |
-
$content = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div> ';
|
158 |
-
|
159 |
-
if($return === true)
|
160 |
-
{
|
161 |
-
$results['field'][] = $content;
|
162 |
-
}
|
163 |
-
else
|
164 |
-
{
|
165 |
-
echo $content;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
elseif($allow_display_empty_fields)
|
169 |
-
{
|
170 |
-
if($return === true)
|
171 |
-
{
|
172 |
-
$results['field'][] = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div></div>';
|
173 |
-
}
|
174 |
-
else
|
175 |
-
{
|
176 |
-
print '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div></div>';
|
177 |
-
}
|
178 |
-
|
179 |
-
}
|
180 |
-
break;
|
181 |
-
|
182 |
-
default:
|
183 |
-
|
184 |
-
//ignore product fields as they will be grouped together at the end of the grid
|
185 |
-
if(GFCommon::is_product_field($field['type'])){
|
186 |
-
$has_product_fields = true;
|
187 |
-
continue;
|
188 |
-
}
|
189 |
-
|
190 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
191 |
-
$display_value = self::pdf_get_lead_field_display($field, $value, $lead['currency']);
|
192 |
-
|
193 |
-
|
194 |
-
$display_value = apply_filters('gform_entry_field_value', $display_value, $field, $lead, $form);
|
195 |
-
|
196 |
-
if( !empty($display_value) || $display_value === '0' || $allow_display_empty_fields){
|
197 |
-
$count++;
|
198 |
-
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
199 |
-
$last_row = $is_last ? ' lastrow' : '';
|
200 |
-
$even = ($count%2) ? ' odd' : ' even';
|
201 |
-
|
202 |
-
$display_value = empty($display_value) && $display_value !== '0' ? ' ' : $display_value;
|
203 |
-
|
204 |
-
$content = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div>';
|
205 |
-
|
206 |
-
$content = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
207 |
-
|
208 |
-
if($return === true)
|
209 |
-
{
|
210 |
-
$results['field'][] = $content;
|
211 |
-
}
|
212 |
-
else
|
213 |
-
{
|
214 |
-
echo $content;
|
215 |
-
}
|
216 |
-
|
217 |
-
}
|
218 |
-
break;
|
219 |
-
}
|
220 |
-
|
221 |
-
}
|
222 |
-
$products = array();
|
223 |
-
if($has_product_fields){
|
224 |
-
if($return === true)
|
225 |
-
{
|
226 |
-
ob_start();
|
227 |
-
self::product_table($form, $lead);
|
228 |
-
$results['field'][] = ob_get_contents();
|
229 |
-
ob_end_clean();
|
230 |
-
}
|
231 |
-
else
|
232 |
-
{
|
233 |
-
self::product_table($form, $lead);
|
234 |
-
}
|
235 |
-
|
236 |
-
}
|
237 |
-
|
238 |
-
if($return === true)
|
239 |
-
{
|
240 |
-
return $results;
|
241 |
-
}
|
242 |
-
?>
|
243 |
-
</div>
|
244 |
-
<?php
|
245 |
-
}
|
246 |
-
|
247 |
-
public static function product_table($form, $lead)
|
248 |
-
{
|
249 |
-
$products = GFCommon::get_product_fields($form, $lead, true);
|
250 |
-
|
251 |
-
$form_id = $form['id'];
|
252 |
-
if(!empty($products['products'])){
|
253 |
-
?>
|
254 |
-
|
255 |
-
<h2 class='default entry-view-field-name'><?php echo apply_filters("gform_order_label_{$form['id']}", apply_filters('gform_order_label', __('Order', 'gravityforms'), $form['id']), $form['id']) ?></h2>
|
256 |
-
|
257 |
-
<table class='entry-products' autosize='1' cellspacing='0' width='97%'>
|
258 |
-
<colgroup>
|
259 |
-
<col class='entry-products-col1' />
|
260 |
-
<col class='entry-products-col2' />
|
261 |
-
<col class='entry-products-col3' />
|
262 |
-
<col class='entry-products-col4' />
|
263 |
-
</colgroup>
|
264 |
-
<thead>
|
265 |
-
<tr>
|
266 |
-
<th scope='col'><?php echo apply_filters('gform_product_{$form_id}', apply_filters('gform_product', __('Product', 'gravityforms'), $form_id), $form_id) ?></th>
|
267 |
-
<th scope='col' class='textcenter'><?php echo apply_filters('gform_product_qty_{$form_id}', apply_filters('gform_product_qty', __('Qty', 'gravityforms'), $form_id), $form_id) ?></th>
|
268 |
-
<th scope='col'><?php echo apply_filters('gform_product_unitprice_{$form_id}', apply_filters('gform_product_unitprice', __('Unit Price', 'gravityforms'), $form_id), $form_id) ?></th>
|
269 |
-
<th scope='col'><?php echo apply_filters('gform_product_price_{$form_id}', apply_filters('gform_product_price', __('Price', 'gravityforms'), $form_id), $form_id) ?></th>
|
270 |
-
</tr>
|
271 |
-
</thead>
|
272 |
-
<tbody>
|
273 |
-
<?php
|
274 |
-
|
275 |
-
$total = 0;
|
276 |
-
foreach($products['products'] as $product){
|
277 |
-
?>
|
278 |
-
<tr>
|
279 |
-
<td>
|
280 |
-
<div class='product_name'><?php echo esc_html($product['name'])?></div>
|
281 |
-
|
282 |
-
<?php
|
283 |
-
$price = GFCommon::to_number($product['price']);
|
284 |
-
if(is_array(rgar($product,'options'))){
|
285 |
-
echo '<ul class="product_options">';
|
286 |
-
$count = sizeof($product['options']);
|
287 |
-
$index = 1;
|
288 |
-
foreach($product['options'] as $option){
|
289 |
-
$price += GFCommon::to_number($option['price']);
|
290 |
-
$class = $index == $count ? ' class="lastitem"' : '';
|
291 |
-
$index++;
|
292 |
-
?>
|
293 |
-
<li<?php echo $class?>><?php echo $option['option_label']?></li>
|
294 |
-
<?php
|
295 |
-
}
|
296 |
-
echo '</ul>';
|
297 |
-
}
|
298 |
-
$subtotal = floatval($product['quantity']) * $price;
|
299 |
-
$total += $subtotal;
|
300 |
-
?>
|
301 |
-
|
302 |
-
</td>
|
303 |
-
<td class='textcenter'><?php echo $product['quantity'] ?></td>
|
304 |
-
<td><?php echo GFCommon::to_money($price, $lead['currency']) ?></td>
|
305 |
-
<td><?php echo GFCommon::to_money($subtotal, $lead['currency']) ?></td>
|
306 |
-
</tr>
|
307 |
-
<?php
|
308 |
-
}
|
309 |
-
$total += floatval($products['shipping']['price']);
|
310 |
-
?>
|
311 |
-
|
312 |
-
|
313 |
-
<?php
|
314 |
-
if(!empty($products['shipping']['name'])){
|
315 |
-
?>
|
316 |
-
<tr>
|
317 |
-
<td colspan='2' rowspan='2' class='emptycell'> </td>
|
318 |
-
<td class='textright shipping'><?php echo $products['shipping']['name'] ?></td>
|
319 |
-
<td class='shipping_amount'><?php echo GFCommon::to_money($products['shipping']['price'], $lead['currency'])?> </td>
|
320 |
-
</tr>
|
321 |
-
<?php
|
322 |
-
}
|
323 |
-
?>
|
324 |
-
<tr>
|
325 |
-
<?php
|
326 |
-
if(empty($products['shipping']['name'])){
|
327 |
-
?>
|
328 |
-
<td colspan='2' class='emptycell'> </td>
|
329 |
-
<?php
|
330 |
-
}
|
331 |
-
?>
|
332 |
-
<td class='textright grandtotal'><?php _e('Total', 'gravityforms') ?></td>
|
333 |
-
<td class='grandtotal_amount'><?php echo GFCommon::to_money($total, $lead['currency'])?></td>
|
334 |
-
</tr>
|
335 |
-
</tbody>
|
336 |
-
|
337 |
-
</table>
|
338 |
-
|
339 |
-
<?php
|
340 |
-
}
|
341 |
-
}
|
342 |
-
|
343 |
-
/*
|
344 |
-
* Public method for outputting likert (survey addon field)
|
345 |
-
*/
|
346 |
-
public static function get_likert($form, $lead, $field_id)
|
347 |
-
{
|
348 |
-
$fields = self::$fields;
|
349 |
-
$field = $fields[$field_id];
|
350 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
351 |
-
|
352 |
-
$display_value = apply_filters('gform_entry_field_value', self::pdf_get_lead_field_display($field, $value, ''), $field, $lead, $form);
|
353 |
-
$content = $display_value;
|
354 |
-
|
355 |
-
$results = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
356 |
-
|
357 |
-
return $results;
|
358 |
-
}
|
359 |
-
|
360 |
-
public static function format_date($date, $usa = false)
|
361 |
-
{
|
362 |
-
$timestamp = strtotime($date);
|
363 |
-
$new_date = (!$usa) ? date('j/n/Y', $timestamp) : date('n/j/Y', $timestamp);
|
364 |
-
return $new_date;
|
365 |
-
}
|
366 |
-
|
367 |
-
|
368 |
-
/* returns the form values as an array instead of pre-formated html */
|
369 |
-
public static function lead_detail_grid_array($form, $lead, $allow_display_empty_fields=false){
|
370 |
-
|
371 |
-
$form_id = $form['id'];
|
372 |
-
$form_array = self::set_form_array_common($form, $lead, $form_id);
|
373 |
-
|
374 |
-
$has_product_fields = false;
|
375 |
-
|
376 |
-
foreach($form['fields'] as $field) {
|
377 |
-
|
378 |
-
|
379 |
-
/*
|
380 |
-
* Add field descriptions to the $form_data array
|
381 |
-
*/
|
382 |
-
if(isset($field['description']))
|
383 |
-
{
|
384 |
-
$form_array['field_descriptions'][$field['id']] = $field['description'];
|
385 |
-
}
|
386 |
-
|
387 |
-
switch(RGFormsModel::get_input_type($field)) {
|
388 |
-
case 'section' :
|
389 |
-
case 'html':
|
390 |
-
$form_array = self::get_html($field, $form_array);
|
391 |
-
break;
|
392 |
-
|
393 |
-
case 'captcha':
|
394 |
-
case 'password':
|
395 |
-
case 'page':
|
396 |
-
//ignore captcha, password and page
|
397 |
-
break;
|
398 |
-
case 'signature':
|
399 |
-
$form_array = self::get_signature($form, $lead, $field, $form_array);
|
400 |
-
|
401 |
-
break;
|
402 |
-
case 'fileupload':
|
403 |
-
$form_array = self::get_fileupload($form, $lead, $field, $form_array);
|
404 |
-
break;
|
405 |
-
case 'list':
|
406 |
-
/*
|
407 |
-
* We want list to run both this and the deafult so don't call break.
|
408 |
-
* Get the list array and store it outside of [field] in a new key called ['list']
|
409 |
-
*/
|
410 |
-
$form_array = self::get_default_list($lead, $field, $form_array);
|
411 |
-
|
412 |
-
case 'select':
|
413 |
-
case 'multiselect':
|
414 |
-
case 'radio':
|
415 |
-
|
416 |
-
if($field['type'] == 'quiz')
|
417 |
-
{
|
418 |
-
$form_array = self::get_quiz_radios($form, $lead, $field, $form_array);
|
419 |
-
}
|
420 |
-
elseif($field['type'] == 'poll' || $field['type'] == 'survey')
|
421 |
-
{
|
422 |
-
$form_array = self::get_poll_radios($form, $lead, $field, $form_array);
|
423 |
-
}
|
424 |
-
else
|
425 |
-
{
|
426 |
-
/* store values in regular [field] array */
|
427 |
-
$form_array = self::get_the_list($lead, $field, $form_array);
|
428 |
-
}
|
429 |
-
break;
|
430 |
-
|
431 |
-
case 'likert':
|
432 |
-
$form_array['survey']['likert'][$field['id']] = self::get_the_likert($form, $lead, $field, $form_array);
|
433 |
-
break;
|
434 |
-
|
435 |
-
case 'rank':
|
436 |
-
$form_array['survey']['rank'][$field['id']] = self::get_the_rank($form, $lead, $field, $form_array);
|
437 |
-
break;
|
438 |
-
|
439 |
-
case 'rating':
|
440 |
-
$form_array['survey']['rating'][$field['id']] = self::get_the_rank($form, $lead, $field, $form_array);
|
441 |
-
break;
|
442 |
-
|
443 |
-
default:
|
444 |
-
|
445 |
-
|
446 |
-
//ignore product fields as they will be grouped together at the end of the grid
|
447 |
-
if(GFCommon::is_product_field($field['type'])){
|
448 |
-
$has_product_fields = true;
|
449 |
-
continue;
|
450 |
-
}
|
451 |
-
|
452 |
-
$form_array = self::get_defaults($lead, $field, $form_array);
|
453 |
-
|
454 |
-
break;
|
455 |
-
}
|
456 |
-
|
457 |
-
}
|
458 |
-
|
459 |
-
$form_array = self::get_product_array($form, $lead, $has_product_fields, $form_array);
|
460 |
-
|
461 |
-
return $form_array;
|
462 |
-
}
|
463 |
-
|
464 |
-
private static function get_quiz_radios($form, $lead, $field, $form_array)
|
465 |
-
{
|
466 |
-
$id = $field['id'];
|
467 |
-
$results = $lead[$id];
|
468 |
-
$return = array();
|
469 |
-
|
470 |
-
foreach($field['choices'] as $choice)
|
471 |
-
{
|
472 |
-
if(trim($choice['value']) == trim($results))
|
473 |
-
{
|
474 |
-
$return = array('text' => $choice['text'], 'isCorrect' => $choice['gquizIsCorrect']);
|
475 |
-
break;
|
476 |
-
}
|
477 |
-
}
|
478 |
-
|
479 |
-
/* add data to field tag correctly */
|
480 |
-
$form_array['field'][$field['id'].'.'.$field['label'].'_name'] = $return;
|
481 |
-
|
482 |
-
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
483 |
-
$form_array['field'][$field['id']] = $return;
|
484 |
-
|
485 |
-
return $form_array;
|
486 |
-
|
487 |
-
}
|
488 |
-
|
489 |
-
private static function get_poll_radios($form, $lead, $field, $form_array)
|
490 |
-
{
|
491 |
-
|
492 |
-
$id = $field['id'];
|
493 |
-
$results = $lead[$id];
|
494 |
-
$return = array();
|
495 |
-
|
496 |
-
$return = self::get_poll_data($results, $field['choices']);
|
497 |
-
|
498 |
-
/* add data to field tag correctly */
|
499 |
-
$form_array['field'][$field['id'].'.'.$field['label'].'_name'] = $return;
|
500 |
-
|
501 |
-
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
502 |
-
$form_array['field'][$field['id']] = $return;
|
503 |
-
|
504 |
-
return $form_array;
|
505 |
-
|
506 |
-
}
|
507 |
-
|
508 |
-
private static function get_poll_checkbox($field, $values)
|
509 |
-
{
|
510 |
-
foreach($values as $id => $item)
|
511 |
-
{
|
512 |
-
$values[$id] = self::get_poll_data($item, $field['choices']);
|
513 |
-
}
|
514 |
-
return $values;
|
515 |
-
}
|
516 |
-
|
517 |
-
private static function get_poll_data($lookup, $options)
|
518 |
-
{
|
519 |
-
$return = '';
|
520 |
-
|
521 |
-
foreach($options as $choice)
|
522 |
-
{
|
523 |
-
if(trim($choice['value']) == trim($lookup))
|
524 |
-
{
|
525 |
-
$return = $choice['text'];
|
526 |
-
break;
|
527 |
-
}
|
528 |
-
}
|
529 |
-
|
530 |
-
return $return;
|
531 |
-
}
|
532 |
-
|
533 |
-
private static function get_the_rank($form, $lead, $field, $form_array)
|
534 |
-
{
|
535 |
-
$id = $field['id'];
|
536 |
-
$results = explode(',', $lead[$id]);
|
537 |
-
$return = array();
|
538 |
-
|
539 |
-
foreach($results as $rank)
|
540 |
-
{
|
541 |
-
foreach($field['choices'] as $choice)
|
542 |
-
{
|
543 |
-
if(trim($choice['value']) == trim($rank))
|
544 |
-
{
|
545 |
-
$return[] = $choice['text'];
|
546 |
-
break;
|
547 |
-
}
|
548 |
-
}
|
549 |
-
}
|
550 |
-
|
551 |
-
return $return;
|
552 |
-
}
|
553 |
-
|
554 |
-
private static function get_the_likert($form, $lead, $field, $form_array)
|
555 |
-
{
|
556 |
-
$id = $field['id'];
|
557 |
-
$multiple_rows = rgar($field, "gsurveyLikertEnableMultipleRows");
|
558 |
-
|
559 |
-
if(!$multiple_rows)
|
560 |
-
{
|
561 |
-
$results = $lead[$id];
|
562 |
-
}
|
563 |
-
|
564 |
-
$likert = array();
|
565 |
-
|
566 |
-
/* store the column names */
|
567 |
-
foreach($field['choices'] as $col)
|
568 |
-
{
|
569 |
-
$likert['col'][$col['value']] = $col['text'];
|
570 |
-
}
|
571 |
-
|
572 |
-
if(is_array($field['inputs']) && sizeof($field['inputs']) > 0)
|
573 |
-
{
|
574 |
-
/* do our multi-row likert */
|
575 |
-
foreach($field['inputs'] as $row)
|
576 |
-
{
|
577 |
-
/* pad the array with the number of columns */
|
578 |
-
|
579 |
-
foreach($likert['col'] as $col_id => $text)
|
580 |
-
{
|
581 |
-
/*
|
582 |
-
* Results for multi row is stored with ID.ROW# (eg $lead['1.2'])
|
583 |
-
* The number is stored in $row['id']
|
584 |
-
*/
|
585 |
-
$results = $lead[$row['id']];
|
586 |
-
|
587 |
-
/* user data in the $lead comes in as ROW ID:COL ID */
|
588 |
-
$comparison = $row['name'] . ':' . $col_id;
|
589 |
-
|
590 |
-
/* do our comparison and update the output */
|
591 |
-
$output = ($comparison == $results) ? 'selected' : '';
|
592 |
-
|
593 |
-
/* assign our results to the array */
|
594 |
-
$likert['rows'][$row['label']][$text] = $output;
|
595 |
-
|
596 |
-
}
|
597 |
-
}
|
598 |
-
}
|
599 |
-
else
|
600 |
-
{
|
601 |
-
/* do our single row likert */
|
602 |
-
foreach($likert['col'] as $col_id => $text)
|
603 |
-
{
|
604 |
-
/* single row data comes in with col value */
|
605 |
-
/* do our comparison and update the output */
|
606 |
-
$output = ($col_id == $results) ? 'selected' : '';
|
607 |
-
|
608 |
-
$likert['row'][$text] = $output;
|
609 |
-
|
610 |
-
}
|
611 |
-
}
|
612 |
-
|
613 |
-
/*
|
614 |
-
* Check if scoring is enabled and calculate
|
615 |
-
*/
|
616 |
-
if($field['gsurveyLikertEnableScoring'] && class_exists('GFSurvey'))
|
617 |
-
{
|
618 |
-
$survey = GFSurvey::get_instance();
|
619 |
-
$likert['score'] = $survey->get_field_score($field, $lead);
|
620 |
-
}
|
621 |
-
|
622 |
-
return $likert;
|
623 |
-
|
624 |
-
}
|
625 |
-
|
626 |
-
private static function get_form_fields($form)
|
627 |
-
{
|
628 |
-
$fields = array();
|
629 |
-
foreach($form['fields'] as $field)
|
630 |
-
{
|
631 |
-
$fields[$field['id']] = $field;
|
632 |
-
}
|
633 |
-
|
634 |
-
self::$fields = $fields;
|
635 |
-
}
|
636 |
-
|
637 |
-
private static function set_form_array_common($form, $lead, $form_id)
|
638 |
-
{
|
639 |
-
/*
|
640 |
-
* Reorder the $form array as we can access the info by Field ID
|
641 |
-
*/
|
642 |
-
self::get_form_fields($form);
|
643 |
-
|
644 |
-
$form_array = array();
|
645 |
-
|
646 |
-
/*
|
647 |
-
* Add form_id and lead_id
|
648 |
-
*/
|
649 |
-
$form_array['form_id'] = $form_id;
|
650 |
-
$form_array['entry_id'] = $lead['id'];
|
651 |
-
|
652 |
-
/*
|
653 |
-
* Set title and dates (both US and international)
|
654 |
-
*/
|
655 |
-
$form_array['form_title'] = $form['title'];
|
656 |
-
$form_array['form_description'] = $form['description'];
|
657 |
-
$form_array['date_created'] = self::format_date($lead['date_created']);
|
658 |
-
$form_array['date_created_usa'] = self::format_date($lead['date_created'], true);
|
659 |
-
|
660 |
-
/*
|
661 |
-
* Include page names
|
662 |
-
*/
|
663 |
-
$form_array['pages'] = $form['pagination']['pages'];
|
664 |
-
|
665 |
-
/*
|
666 |
-
* Add misc fields
|
667 |
-
*/
|
668 |
-
$form_array['misc']['date_time'] = $lead['date_created'];
|
669 |
-
$form_array['misc']['time_24hr'] = date('H:i', strtotime($lead['date_created']));
|
670 |
-
$form_array['misc']['time_12hr'] = date('g:ia', strtotime($lead['date_created']));
|
671 |
-
$form_array['misc']['is_starred'] = $lead['is_starred'];
|
672 |
-
$form_array['misc']['is_read'] = $lead['is_read'];
|
673 |
-
$form_array['misc']['ip'] = $lead['ip'];
|
674 |
-
$form_array['misc']['source_url'] = $lead['source_url'];
|
675 |
-
$form_array['misc']['post_id'] = $lead['post_id'];
|
676 |
-
$form_array['misc']['currency'] = $lead['currency'];
|
677 |
-
$form_array['misc']['payment_status'] = $lead['payment_status'];
|
678 |
-
$form_array['misc']['payment_date'] = $lead['payment_date'];
|
679 |
-
$form_array['misc']['transaction_id'] = $lead['transaction_id'];
|
680 |
-
$form_array['misc']['payment_amount'] = $lead['payment_amount'];
|
681 |
-
$form_array['misc']['is_fulfilled'] = $lead['is_fulfilled'];
|
682 |
-
$form_array['misc']['created_by'] = $lead['created_by'];
|
683 |
-
$form_array['misc']['transaction_type'] = $lead['transaction_type'];
|
684 |
-
$form_array['misc']['user_agent'] = $lead['user_agent'];
|
685 |
-
$form_array['misc']['status'] = $lead['status'];
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
/*
|
690 |
-
* Add quiz results
|
691 |
-
*/
|
692 |
-
$form_array = self::get_quiz_results($form_array, $form, $lead);
|
693 |
-
$form_array = self::get_survey_results($form_array, $form, $lead);
|
694 |
-
$form_array = self::get_poll_results($form_array, $form, $lead);
|
695 |
-
|
696 |
-
return $form_array;
|
697 |
-
}
|
698 |
-
|
699 |
-
/**
|
700 |
-
* Sniff the form fields and determine if there are any of the $type avaluable
|
701 |
-
* @param string $type the field type we are looking for
|
702 |
-
* @param array $form the form array
|
703 |
-
* @return boolean Whether there is a match or not
|
704 |
-
*/
|
705 |
-
private static function check_for_fields($type, $form)
|
706 |
-
{
|
707 |
-
foreach($form['fields'] as $field)
|
708 |
-
{
|
709 |
-
if($field['type'] == $type)
|
710 |
-
{
|
711 |
-
return true;
|
712 |
-
}
|
713 |
-
}
|
714 |
-
return false;
|
715 |
-
}
|
716 |
-
|
717 |
-
private static function get_poll_results($form_array, $form, $lead)
|
718 |
-
{
|
719 |
-
if(self::check_for_fields('poll', $form) === false)
|
720 |
-
{
|
721 |
-
return $form_array;
|
722 |
-
}
|
723 |
-
|
724 |
-
$poll_results = self::get_addon_global_data($form, array());
|
725 |
-
|
726 |
-
$form_fields = self::$fields;
|
727 |
-
|
728 |
-
/*
|
729 |
-
* Convert the array keys into their text counterparts
|
730 |
-
* Loop through the global poll data
|
731 |
-
*/
|
732 |
-
foreach($poll_results['field_data'] as $id => &$choices)
|
733 |
-
{
|
734 |
-
/* get the $field */
|
735 |
-
$field = $form_fields[$id];
|
736 |
-
|
737 |
-
/* add the field name to the ['misc'] key */
|
738 |
-
$choices['misc']['label'] = $field['label'];
|
739 |
-
|
740 |
-
/* loop through the field choices */
|
741 |
-
foreach($field['choices'] as $choice)
|
742 |
-
{
|
743 |
-
$choices = self::replace_key($choices, $choice['value'], $choice['text']);
|
744 |
-
}
|
745 |
-
}
|
746 |
-
|
747 |
-
$form_array['poll']['global'] = $poll_results;
|
748 |
-
|
749 |
-
return $form_array;
|
750 |
-
}
|
751 |
-
|
752 |
-
private static function get_survey_results($form_array, $form, $lead)
|
753 |
-
{
|
754 |
-
if(self::check_for_fields('survey', $form) === false)
|
755 |
-
{
|
756 |
-
return $form_array;
|
757 |
-
}
|
758 |
-
|
759 |
-
/*
|
760 |
-
* If there are any survey results
|
761 |
-
* add them to the 'survey' key
|
762 |
-
*/
|
763 |
-
$fields = GFCommon::get_fields_by_type($form, array('survey'));
|
764 |
-
$count_survey_fields = count($fields);
|
765 |
-
|
766 |
-
if ($count_survey_fields > 0 && isset($lead['gsurvey_score']))
|
767 |
-
{
|
768 |
-
$form_array['survey']['score'] = $lead['gsurvey_score'];
|
769 |
-
}
|
770 |
-
|
771 |
-
$form_array['survey']['global'] = self::get_addon_global_data($form, array());
|
772 |
-
$form_fields = self::$fields;
|
773 |
-
|
774 |
-
/*
|
775 |
-
* Convert the array keys into their text counterparts
|
776 |
-
* Loop through the global survey data
|
777 |
-
*/
|
778 |
-
foreach($form_array['survey']['global']['field_data'] as $id => &$choices)
|
779 |
-
{
|
780 |
-
/* get the $field */
|
781 |
-
$field = $form_fields[$id];
|
782 |
-
|
783 |
-
/*
|
784 |
-
* Check if we have a multifield likert and replace the row key
|
785 |
-
*/
|
786 |
-
if(isset($field['gsurveyLikertEnableMultipleRows']) && $field['gsurveyLikertEnableMultipleRows'] == 1)
|
787 |
-
{
|
788 |
-
foreach($field['gsurveyLikertRows'] as $row)
|
789 |
-
{
|
790 |
-
$choices = self::replace_key($choices, $row['value'], $row['text']);
|
791 |
-
}
|
792 |
-
|
793 |
-
foreach($choices as $multi_id => &$multi_choices)
|
794 |
-
{
|
795 |
-
foreach($field['choices'] as $choice)
|
796 |
-
{
|
797 |
-
$multi_choices = self::replace_key($multi_choices, $choice['value'], $choice['text']);
|
798 |
-
}
|
799 |
-
}
|
800 |
-
}
|
801 |
-
|
802 |
-
/* replace the standard row data */
|
803 |
-
foreach($field['choices'] as $choice)
|
804 |
-
{
|
805 |
-
$choices = self::replace_key($choices, $choice['value'], $choice['text']);
|
806 |
-
}
|
807 |
-
}
|
808 |
-
|
809 |
-
return $form_array;
|
810 |
-
|
811 |
-
}
|
812 |
-
|
813 |
-
private static function replace_key($array, $key, $text)
|
814 |
-
{
|
815 |
-
if($key != $text && isset($array[$key]))
|
816 |
-
{
|
817 |
-
/* replace the array key with the actual field name */
|
818 |
-
$array[$text] = $array[$key];
|
819 |
-
unset($array[$key]);
|
820 |
-
}
|
821 |
-
return $array;
|
822 |
-
}
|
823 |
-
|
824 |
-
private static function get_quiz_results($form_array, $form, $lead)
|
825 |
-
{
|
826 |
-
|
827 |
-
if(self::check_for_fields('quiz', $form) === false)
|
828 |
-
{
|
829 |
-
return $form_array;
|
830 |
-
}
|
831 |
-
|
832 |
-
/*
|
833 |
-
* If there are any quiz results
|
834 |
-
* add them to the 'quiz' key
|
835 |
-
*/
|
836 |
-
$fields = GFCommon::get_fields_by_type($form, array('quiz'));
|
837 |
-
$count_quiz_fields = count($fields);
|
838 |
-
|
839 |
-
if ($count_quiz_fields > 0)
|
840 |
-
{
|
841 |
-
$form_array['quiz']['config']['grading'] = (isset($form['gravityformsquiz']['grading'])) ? $form['gravityformsquiz']['grading'] : '';
|
842 |
-
$form_array['quiz']['config']['passPercent'] = (isset($form['gravityformsquiz']['passPercent'])) ? $form['gravityformsquiz']['passPercent'] : '';
|
843 |
-
$form_array['quiz']['config']['grades'] = (isset($form['gravityformsquiz']['grades'])) ? $form['gravityformsquiz']['grades'] : '';
|
844 |
-
|
845 |
-
$form_array['quiz']['results']['score'] = rgar($lead, 'gquiz_score');
|
846 |
-
$form_array['quiz']['results']['percent'] = rgar($lead, 'gquiz_percent');
|
847 |
-
$form_array['quiz']['results']['is_pass'] = rgar($lead, 'gquiz_is_pass');
|
848 |
-
$form_array['quiz']['results']['grade'] = rgar($lead, 'gquiz_grade');
|
849 |
-
|
850 |
-
/*
|
851 |
-
* Get the overall results
|
852 |
-
*/
|
853 |
-
$quiz_global = self::get_quiz_overalls($form);
|
854 |
-
|
855 |
-
$form_fields = self::$fields;
|
856 |
-
/*
|
857 |
-
* Convert the array keys into their text counterparts
|
858 |
-
* Loop through the global quiz data
|
859 |
-
*/
|
860 |
-
foreach($quiz_global['field_data'] as $id => &$choices)
|
861 |
-
{
|
862 |
-
/* get the $field */
|
863 |
-
$field = $form_fields[$id];
|
864 |
-
|
865 |
-
/* replace ['totals'] key with ['misc'] key */
|
866 |
-
$choices = self::replace_key($choices, 'totals', 'misc');
|
867 |
-
|
868 |
-
/* add the field name to the ['misc'] key */
|
869 |
-
$choices['misc']['label'] = $field['label'];
|
870 |
-
|
871 |
-
/* loop through the field choices */
|
872 |
-
foreach($field['choices'] as $choice)
|
873 |
-
{
|
874 |
-
$choices = self::replace_key($choices, $choice['value'], $choice['text']);
|
875 |
-
|
876 |
-
/* check if this is the correct field */
|
877 |
-
if($choice['gquizIsCorrect'] == 1)
|
878 |
-
{
|
879 |
-
$choices['misc']['correct_option_name'] = $choice['text'];
|
880 |
-
}
|
881 |
-
|
882 |
-
}
|
883 |
-
}
|
884 |
-
|
885 |
-
$form_array['quiz']['global'] = $quiz_global;
|
886 |
-
//$form_array['quiz']['global'] = self::get_quiz_overalls($form);
|
887 |
-
|
888 |
-
}
|
889 |
-
|
890 |
-
return $form_array;
|
891 |
-
}
|
892 |
-
|
893 |
-
private static function get_addon_global_data($form, $options)
|
894 |
-
{
|
895 |
-
/* if the results class isn't loaded, load it */
|
896 |
-
if (!class_exists("GFResults"))
|
897 |
-
{
|
898 |
-
require_once(GFCommon::get_base_path() . "/includes/addon/class-gf-results.php");
|
899 |
-
}
|
900 |
-
|
901 |
-
$fields = $form["fields"];
|
902 |
-
|
903 |
-
/* initiat the results class */
|
904 |
-
$gf_results = new GFResults('', $options);
|
905 |
-
|
906 |
-
/* ensure that only active leads are queried */
|
907 |
-
$search = array(
|
908 |
-
'field_filters' => array('mode' => ''),
|
909 |
-
'status' => 'active'
|
910 |
-
);
|
911 |
-
|
912 |
-
/* get the results */
|
913 |
-
$data = $gf_results->get_results_data($form, $fields, $search);
|
914 |
-
|
915 |
-
/* unset some array keys we don't need */
|
916 |
-
unset($data['status']);
|
917 |
-
unset($data['timestamp']);
|
918 |
-
|
919 |
-
return $data;
|
920 |
-
|
921 |
-
}
|
922 |
-
|
923 |
-
private static function get_quiz_overalls($form)
|
924 |
-
{
|
925 |
-
/* we need to tap into functions GF Quiz has so only run if it is active */
|
926 |
-
if(class_exists('GFQuiz'))
|
927 |
-
{
|
928 |
-
/* GFQuiz is a singleton. Get the instance */
|
929 |
-
$quiz = GFQuiz::get_instance();
|
930 |
-
|
931 |
-
/* create our callback to add additional data to the array specific to the quiz plugin */
|
932 |
-
$options['callbacks']['calculation'] = array(
|
933 |
-
$quiz,
|
934 |
-
'results_calculation'
|
935 |
-
);
|
936 |
-
|
937 |
-
return self::get_addon_global_data($form, $options);
|
938 |
-
}
|
939 |
-
|
940 |
-
return array(__('Activate Gravity Forms Quiz Add On to see global quiz statistics for this form', 'pdfextended'));
|
941 |
-
}
|
942 |
-
|
943 |
-
private static function get_html($field, $form_array)
|
944 |
-
{
|
945 |
-
if(isset($field['content']))
|
946 |
-
{
|
947 |
-
$form_array['html'][] = wpautop($field['content']);
|
948 |
-
}
|
949 |
-
|
950 |
-
return $form_array;
|
951 |
-
}
|
952 |
-
|
953 |
-
private static function get_signature($form, $lead, $field, $form_array)
|
954 |
-
{
|
955 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
956 |
-
|
957 |
-
$http_folder = RGFormsModel::get_upload_url_root(). 'signatures/';
|
958 |
-
$server_folder = RGFormsModel::get_upload_root() . 'signatures/';
|
959 |
-
|
960 |
-
|
961 |
-
if(file_exists($server_folder.$value) !== false && is_dir($server_folder.$value) !== true)
|
962 |
-
{
|
963 |
-
$image_size = getimagesize($server_folder.$value);
|
964 |
-
$width = $image_size[0] / 4;
|
965 |
-
$height = $image_size[1] / 4;
|
966 |
-
|
967 |
-
$sig_html = '<img src="'. $server_folder.$value .'" alt="Signature" width=" '. $width .'" height="'. $height .'" />';
|
968 |
-
|
969 |
-
$form_array['signature'][] = $sig_html;
|
970 |
-
$form_array['signature_details'][] = array(
|
971 |
-
'img' => $sig_html,
|
972 |
-
'path' => $server_folder.$value,
|
973 |
-
'url' => $http_folder.$value,
|
974 |
-
'width' => $width,
|
975 |
-
'height' => $height,
|
976 |
-
);
|
977 |
-
|
978 |
-
$form_array['signature_details_id'][$field['id']] = array(
|
979 |
-
'img' => $sig_html,
|
980 |
-
'path' => $server_folder.$value,
|
981 |
-
'url' => $http_folder.$value,
|
982 |
-
'width' => $width,
|
983 |
-
'height' => $height,
|
984 |
-
);
|
985 |
-
}
|
986 |
-
|
987 |
-
return $form_array;
|
988 |
-
}
|
989 |
-
|
990 |
-
private static function get_fileupload($form, $lead, $field, $form_array)
|
991 |
-
{
|
992 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
993 |
-
$display = self::get_lead_field_display($field, $value, $lead['currency']);
|
994 |
-
|
995 |
-
/*
|
996 |
-
* Get the absolute path to the upload
|
997 |
-
*/
|
998 |
-
$path = str_replace(home_url().'/', ABSPATH, $display);
|
999 |
-
|
1000 |
-
/* add path */
|
1001 |
-
$form_array['field'][$field['id'].'_path'] = $path;
|
1002 |
-
$form_array['field'][$field['id'].'.'.$field['label'].'_path'] = $path;
|
1003 |
-
|
1004 |
-
return self::assign_form($field, $display, $form_array);
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
private static function get_default_list($lead, $field, $form_array)
|
1008 |
-
{
|
1009 |
-
$value = self::remove_empty_list_rows(unserialize(RGFormsModel::get_lead_field_value($lead, $field)));
|
1010 |
-
$form_array['list'][$field['id']] = $value;
|
1011 |
-
|
1012 |
-
return $form_array;
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
private static function remove_empty_list_rows($list)
|
1016 |
-
{
|
1017 |
-
/*
|
1018 |
-
* Check if there are any values in the list
|
1019 |
-
*/
|
1020 |
-
if(!is_array($list) || sizeof($list) == 0)
|
1021 |
-
{
|
1022 |
-
return $list;
|
1023 |
-
}
|
1024 |
-
|
1025 |
-
/*
|
1026 |
-
* Check if it's a multi column list
|
1027 |
-
*/
|
1028 |
-
if(!is_array($list[0]))
|
1029 |
-
{
|
1030 |
-
$list = array_filter($list);
|
1031 |
-
}
|
1032 |
-
else
|
1033 |
-
{
|
1034 |
-
$list = self::remove_empty_multi_col_list($list);
|
1035 |
-
}
|
1036 |
-
|
1037 |
-
return $list;
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
private static function remove_empty_multi_col_list($list)
|
1041 |
-
{
|
1042 |
-
foreach($list as $id => $row)
|
1043 |
-
{
|
1044 |
-
|
1045 |
-
$empty = true;
|
1046 |
-
foreach($row as &$col)
|
1047 |
-
{
|
1048 |
-
/* check if there is data and if so break the loop */
|
1049 |
-
if(trim(strlen($col) > 0))
|
1050 |
-
{
|
1051 |
-
$empty = false;
|
1052 |
-
break;
|
1053 |
-
}
|
1054 |
-
}
|
1055 |
-
|
1056 |
-
/* remove row from list */
|
1057 |
-
if($empty)
|
1058 |
-
{
|
1059 |
-
unset($list[$id]);
|
1060 |
-
}
|
1061 |
-
}
|
1062 |
-
|
1063 |
-
return $list;
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
private static function get_the_list($lead, $field, $form_array)
|
1067 |
-
{
|
1068 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
1069 |
-
$display = self::get_lead_field_display($field, $value, $lead['currency']);
|
1070 |
-
|
1071 |
-
$form_array = self::assign_form($field, $display, $form_array);
|
1072 |
-
|
1073 |
-
/*
|
1074 |
-
* Include these items correct names
|
1075 |
-
*/
|
1076 |
-
$display = self::get_lead_field_display($field, $value, $lead['currency'], true);
|
1077 |
-
/* add data to field tag correctly */
|
1078 |
-
$form_array['field'][$field['id'].'.'.$field['label'].'_name'] = $display;
|
1079 |
-
|
1080 |
-
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
1081 |
-
$form_array['field'][$field['id'].'_name'] = $display;
|
1082 |
-
|
1083 |
-
/* keep backwards compatibility */
|
1084 |
-
$form_array['field'][$field['label'].'_name'] = $display;
|
1085 |
-
|
1086 |
-
return $form_array;
|
1087 |
-
}
|
1088 |
-
|
1089 |
-
private static function get_defaults($lead, $field, $form_array)
|
1090 |
-
{
|
1091 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
1092 |
-
$display = self::get_lead_field_display($field, $value, $lead['currency']);
|
1093 |
-
|
1094 |
-
return self::assign_form($field, $display, $form_array);
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
private static function assign_form($field, $display, $form_array)
|
1098 |
-
{
|
1099 |
-
/* add data to field tag correctly */
|
1100 |
-
$form_array['field'][$field['id'].'.'.$field['label']] = $display;
|
1101 |
-
|
1102 |
-
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
1103 |
-
$form_array['field'][$field['id']] = $display;
|
1104 |
-
|
1105 |
-
/* keep backwards compatibility */
|
1106 |
-
$form_array['field'][$field['label']] = $display;
|
1107 |
-
|
1108 |
-
return $form_array;
|
1109 |
-
}
|
1110 |
-
|
1111 |
-
private static function get_product_array($form, $lead, $has_product_fields, $form_array)
|
1112 |
-
{
|
1113 |
-
$currency_format = GFCommon::is_currency_decimal_dot() ? 'decimal_dot' : 'decimal_comma';
|
1114 |
-
|
1115 |
-
if($has_product_fields) {
|
1116 |
-
$products = GFCommon::get_product_fields($form, $lead, true);
|
1117 |
-
|
1118 |
-
/* check that there are actual product fields */
|
1119 |
-
if(sizeof($products['products']) > 0 )
|
1120 |
-
{
|
1121 |
-
|
1122 |
-
/*
|
1123 |
-
* Set up our variables
|
1124 |
-
*/
|
1125 |
-
$total = 0;
|
1126 |
-
$subtotal = 0;
|
1127 |
-
|
1128 |
-
|
1129 |
-
foreach($products['products'] as $id => $product) {
|
1130 |
-
|
1131 |
-
$price = GFCommon::to_number($product['price']);
|
1132 |
-
|
1133 |
-
/* add all options to total price */
|
1134 |
-
if(is_array(rgar($product,'options')))
|
1135 |
-
{
|
1136 |
-
foreach($product['options'] as $option){
|
1137 |
-
$price += GFCommon::to_number($option['price']);
|
1138 |
-
}
|
1139 |
-
}
|
1140 |
-
|
1141 |
-
/* calculate subtotal */
|
1142 |
-
$subtotal = floatval($product['quantity']) * $price;
|
1143 |
-
$total += $subtotal;
|
1144 |
-
|
1145 |
-
/*
|
1146 |
-
* Check if we should include options
|
1147 |
-
*/
|
1148 |
-
$options = isset($product['options']) ? $product['options'] : array();
|
1149 |
-
|
1150 |
-
/*
|
1151 |
-
* Add formated price for each product option
|
1152 |
-
*/
|
1153 |
-
foreach($options as &$o)
|
1154 |
-
{
|
1155 |
-
if(is_numeric($o['price']))
|
1156 |
-
{
|
1157 |
-
$o['price_formatted'] = GFCommon::format_number($o['price'], 'currency');
|
1158 |
-
}
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
/*
|
1162 |
-
* Store product in $form_array array
|
1163 |
-
*/
|
1164 |
-
$form_array['products'][$id] = array(
|
1165 |
-
'name' => esc_html($product['name']),
|
1166 |
-
'price' => esc_html($product['price']),
|
1167 |
-
'price_unformatted' => GFCommon::clean_number($product['price'], $currency_format),
|
1168 |
-
'options' => $options,
|
1169 |
-
'quantity' => $product['quantity'],
|
1170 |
-
'subtotal' => $subtotal,
|
1171 |
-
'subtotal_formatted' => GFCommon::format_number($subtotal, 'currency'));
|
1172 |
-
}
|
1173 |
-
|
1174 |
-
/* Increment total */
|
1175 |
-
$total += floatval($products['shipping']['price']);
|
1176 |
-
$subtotal = $total - floatval($products['shipping']['price']);
|
1177 |
-
|
1178 |
-
/* add totals to form data */
|
1179 |
-
$form_array['products_totals'] = array(
|
1180 |
-
'subtotal' => $subtotal,
|
1181 |
-
'shipping' => $products['shipping']['price'],
|
1182 |
-
'total' => $total,
|
1183 |
-
'shipping_formatted' => GFCommon::format_number($products['shipping']['price'], 'currency'),
|
1184 |
-
'subtotal_formatted' => GFCommon::format_number($subtotal, 'currency'),
|
1185 |
-
'total_formatted' => GFCommon::format_number($total, 'currency'),
|
1186 |
-
);
|
1187 |
-
}
|
1188 |
-
}
|
1189 |
-
|
1190 |
-
return $form_array;
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
public static function get_lead_field_display($field, $value, $currency='', $use_text=false, $format='html', $media='screen'){
|
1194 |
-
|
1195 |
-
if($field['type'] == 'post_category')
|
1196 |
-
$value = GFCommon::prepare_post_category_value($value, $field);
|
1197 |
-
|
1198 |
-
switch(RGFormsModel::get_input_type($field)){
|
1199 |
-
case 'name' :
|
1200 |
-
if(is_array($value)){
|
1201 |
-
$prefix = trim(rgget($field['id'] . '.2', $value));
|
1202 |
-
$first = trim(rgget($field['id'] . '.3', $value));
|
1203 |
-
$middle = trim(rgget($field['id'] . '.4', $value));
|
1204 |
-
$last = trim(rgget($field['id'] . '.6', $value));
|
1205 |
-
$suffix = trim(rgget($field['id'] . '.8', $value));
|
1206 |
-
|
1207 |
-
return array('prefix' => $prefix, 'first' => $first, 'middle' => $middle, 'last' => $last, 'suffix' => $suffix);
|
1208 |
-
}
|
1209 |
-
else{
|
1210 |
-
return $value;
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
break;
|
1214 |
-
case 'creditcard' :
|
1215 |
-
if(is_array($value)){
|
1216 |
-
$card_number = trim(rgget($field['id'] . '.1', $value));
|
1217 |
-
$card_type = trim(rgget($field['id'] . '.4', $value));
|
1218 |
-
$separator = $format == 'html' ? '<br/>' : '\n';
|
1219 |
-
return empty($card_number) ? '' : $card_type . $separator . $card_number;
|
1220 |
-
}
|
1221 |
-
else{
|
1222 |
-
return '';
|
1223 |
-
}
|
1224 |
-
break;
|
1225 |
-
|
1226 |
-
case 'address' :
|
1227 |
-
if(is_array($value)){
|
1228 |
-
$street_value = trim(rgget($field['id'] . '.1', $value));
|
1229 |
-
$street2_value = trim(rgget($field['id'] . '.2', $value));
|
1230 |
-
$city_value = trim(rgget($field['id'] . '.3', $value));
|
1231 |
-
$state_value = trim(rgget($field['id'] . '.4', $value));
|
1232 |
-
$zip_value = trim(rgget($field['id'] . '.5', $value));
|
1233 |
-
$country_value = trim(rgget($field['id'] . '.6', $value));
|
1234 |
-
|
1235 |
-
$line_break = $format == 'html' ? '<br />' : '\n';
|
1236 |
-
|
1237 |
-
$address_display_format = apply_filters('gform_address_display_format', 'default');
|
1238 |
-
|
1239 |
-
$address['street'] = $street_value;
|
1240 |
-
$address['street2'] = $street2_value;
|
1241 |
-
$address['city'] = $city_value;
|
1242 |
-
$address['state'] = $state_value;
|
1243 |
-
$address['zip'] = $zip_value;
|
1244 |
-
$address['country'] = $country_value;
|
1245 |
-
|
1246 |
-
return $address;
|
1247 |
-
}
|
1248 |
-
else{
|
1249 |
-
return '';
|
1250 |
-
}
|
1251 |
-
break;
|
1252 |
-
|
1253 |
-
case 'email' :
|
1254 |
-
return GFCommon::is_valid_email($value) && $format == 'html' ? $value : $value;
|
1255 |
-
break;
|
1256 |
-
|
1257 |
-
case 'website' :
|
1258 |
-
return GFCommon::is_valid_url($value) && $format == 'html' ? $value : $value;
|
1259 |
-
break;
|
1260 |
-
|
1261 |
-
case 'checkbox' :
|
1262 |
-
if(is_array($value)){
|
1263 |
-
|
1264 |
-
$items = array();
|
1265 |
-
|
1266 |
-
foreach($value as $key => $item){
|
1267 |
-
if(!empty($item)) {
|
1268 |
-
if($field['type'] == 'poll' || $field['type'] == 'survey')
|
1269 |
-
{
|
1270 |
-
/*
|
1271 |
-
* Convert our poll type
|
1272 |
-
*/
|
1273 |
-
$items[] = self::get_poll_checkbox($field, $value);
|
1274 |
-
return $items;
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
switch($format){
|
1278 |
-
case 'text' :
|
1279 |
-
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
1280 |
-
break;
|
1281 |
-
|
1282 |
-
default:
|
1283 |
-
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
1284 |
-
break;
|
1285 |
-
}
|
1286 |
-
}
|
1287 |
-
}
|
1288 |
-
if(empty($items)){
|
1289 |
-
return '';
|
1290 |
-
}
|
1291 |
-
else if($format == 'text'){
|
1292 |
-
/*return substr($items, 0, strlen($items)-2); //removing last comma*/
|
1293 |
-
}
|
1294 |
-
else{
|
1295 |
-
return $items;
|
1296 |
-
}
|
1297 |
-
}
|
1298 |
-
else{
|
1299 |
-
return $value;
|
1300 |
-
}
|
1301 |
-
break;
|
1302 |
-
|
1303 |
-
case 'post_image' :
|
1304 |
-
$ary = explode('|:|', $value);
|
1305 |
-
$url = count($ary) > 0 ? $ary[0] : '';
|
1306 |
-
$title = count($ary) > 1 ? $ary[1] : '';
|
1307 |
-
$caption = count($ary) > 2 ? $ary[2] : '';
|
1308 |
-
$description = count($ary) > 3 ? $ary[3] : '';
|
1309 |
-
|
1310 |
-
if(!empty($url)){
|
1311 |
-
$url = str_replace(' ', '%20', $url);
|
1312 |
-
|
1313 |
-
$value = array('url' => $url,
|
1314 |
-
'path' => str_replace(site_url().'/', ABSPATH, $url),
|
1315 |
-
'title' => $title,
|
1316 |
-
'caption' => $caption,
|
1317 |
-
'description' => $description);
|
1318 |
-
}
|
1319 |
-
return $value;
|
1320 |
-
|
1321 |
-
case 'fileupload' :
|
1322 |
-
$output_arr = array();
|
1323 |
-
if(!empty($value)){
|
1324 |
-
$file_paths = rgar($field,'multipleFiles') ? json_decode($value) : array($value);
|
1325 |
-
foreach($file_paths as $file_path){
|
1326 |
-
$info = pathinfo($file_path);
|
1327 |
-
$file_path = esc_attr(str_replace(' ', '%20', $file_path));
|
1328 |
-
$output_arr[] = $file_path;
|
1329 |
-
}
|
1330 |
-
$output = join(PHP_EOL, $output_arr);
|
1331 |
-
}
|
1332 |
-
return $output_arr;
|
1333 |
-
break;
|
1334 |
-
|
1335 |
-
case 'date' :
|
1336 |
-
return GFCommon::date_display($value, rgar($field, 'dateFormat'));
|
1337 |
-
break;
|
1338 |
-
|
1339 |
-
case 'radio' :
|
1340 |
-
case 'select' :
|
1341 |
-
return GFCommon::selection_display($value, $field, $currency, $use_text);
|
1342 |
-
break;
|
1343 |
-
|
1344 |
-
case 'multiselect' :
|
1345 |
-
if(empty($value) || $format == 'text')
|
1346 |
-
return $value;
|
1347 |
-
|
1348 |
-
$value = explode(',', $value);
|
1349 |
-
|
1350 |
-
$items = '';
|
1351 |
-
foreach($value as $item){
|
1352 |
-
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
1353 |
-
}
|
1354 |
-
|
1355 |
-
if(sizeof($items) == 1)
|
1356 |
-
{
|
1357 |
-
return $items[0];
|
1358 |
-
}
|
1359 |
-
return $items;
|
1360 |
-
|
1361 |
-
|
1362 |
-
break;
|
1363 |
-
|
1364 |
-
case 'calculation' :
|
1365 |
-
case 'singleproduct' :
|
1366 |
-
if(is_array($value)){
|
1367 |
-
$product_name = trim($value[$field['id'] . '.1']);
|
1368 |
-
$price = trim($value[$field['id'] . '.2']);
|
1369 |
-
$quantity = trim($value[$field['id'] . '.3']);
|
1370 |
-
|
1371 |
-
$product = $product_name . ', ' . __('Qty: ', 'gravityforms') . $quantity . ', ' . __('Price: ', 'gravityforms') . $price;
|
1372 |
-
|
1373 |
-
return $product;
|
1374 |
-
}
|
1375 |
-
else{
|
1376 |
-
return '';
|
1377 |
-
}
|
1378 |
-
break;
|
1379 |
-
|
1380 |
-
case 'number' :
|
1381 |
-
return GFCommon::format_number($value, rgar($field, 'numberFormat'));
|
1382 |
-
break;
|
1383 |
-
|
1384 |
-
case 'singleshipping' :
|
1385 |
-
case 'donation' :
|
1386 |
-
case 'total' :
|
1387 |
-
case 'price' :
|
1388 |
-
return GFCommon::to_money($value, $currency);
|
1389 |
-
|
1390 |
-
case 'list' :
|
1391 |
-
if(empty($value))
|
1392 |
-
return '';
|
1393 |
-
$value = unserialize($value);
|
1394 |
-
|
1395 |
-
$has_columns = is_array($value[0]);
|
1396 |
-
|
1397 |
-
if(!$has_columns){
|
1398 |
-
$items = array();
|
1399 |
-
foreach($value as $key => $item){
|
1400 |
-
if(!empty($item)){
|
1401 |
-
switch($format){
|
1402 |
-
case 'text' :
|
1403 |
-
$items[] = $item;
|
1404 |
-
break;
|
1405 |
-
case 'url' :
|
1406 |
-
$items[] = $item;
|
1407 |
-
break;
|
1408 |
-
default :
|
1409 |
-
if($media == 'email'){
|
1410 |
-
$items[] = $item;
|
1411 |
-
}
|
1412 |
-
else{
|
1413 |
-
$items[] = $item;
|
1414 |
-
}
|
1415 |
-
break;
|
1416 |
-
}
|
1417 |
-
}
|
1418 |
-
}
|
1419 |
-
|
1420 |
-
if(empty($items)){
|
1421 |
-
return '';
|
1422 |
-
}
|
1423 |
-
else if($format == 'text'){
|
1424 |
-
/* return substr($items, 0, strlen($items)-2); //removing last comma*/
|
1425 |
-
return $items;
|
1426 |
-
}
|
1427 |
-
else if($format == 'url'){
|
1428 |
-
/*return substr($items, 0, strlen($items)-1); //removing last comma*/
|
1429 |
-
return $items;
|
1430 |
-
}
|
1431 |
-
else if($media == 'email'){
|
1432 |
-
return $items;
|
1433 |
-
}
|
1434 |
-
else {
|
1435 |
-
$list = '<table autosize="1" class="gfield_list" style="border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%">';
|
1436 |
-
foreach($items as $i)
|
1437 |
-
{
|
1438 |
-
$list .= '<tr><td>' . $i .'</td></tr>';
|
1439 |
-
}
|
1440 |
-
$list .= '</table>';
|
1441 |
-
|
1442 |
-
return $list;
|
1443 |
-
}
|
1444 |
-
}
|
1445 |
-
else if(is_array($value)){
|
1446 |
-
$columns = array_keys($value[0]);
|
1447 |
-
|
1448 |
-
$list = '';
|
1449 |
-
|
1450 |
-
switch($format){
|
1451 |
-
case 'text' :
|
1452 |
-
$is_first_row = true;
|
1453 |
-
foreach($value as $item){
|
1454 |
-
if(!$is_first_row)
|
1455 |
-
$list .= '\n\n' . $field['label'] . ': ';
|
1456 |
-
$list .= implode(',', array_values($item));
|
1457 |
-
|
1458 |
-
$is_first_row = false;
|
1459 |
-
}
|
1460 |
-
break;
|
1461 |
-
|
1462 |
-
case 'url' :
|
1463 |
-
foreach($value as $item){
|
1464 |
-
$list .= implode('|', array_values($item)) . ',';
|
1465 |
-
}
|
1466 |
-
if(!empty($list))
|
1467 |
-
$list = substr($list, 0, strlen($list)-1);
|
1468 |
-
break;
|
1469 |
-
|
1470 |
-
default :
|
1471 |
-
|
1472 |
-
if($media == 'email'){
|
1473 |
-
$list = '<table autosize="1" class="gfield_list" style="border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%"><thead><tr>';
|
1474 |
-
|
1475 |
-
//reading columns from entry data
|
1476 |
-
foreach($columns as $column){
|
1477 |
-
$list .= '<th style="background-image: none; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; padding: 6px 10px; font-family: sans-serif; font-size: 12px; font-weight: bold; background-color: #F1F1F1; color:#333; text-align:left">" . esc_html($column) . "</th>';
|
1478 |
-
}
|
1479 |
-
$list .= '</tr></thead>';
|
1480 |
-
|
1481 |
-
$list .= '<tbody style="background-color: #F9F9F9">';
|
1482 |
-
foreach($value as $item){
|
1483 |
-
$list .= '<tr>';
|
1484 |
-
foreach($columns as $column){
|
1485 |
-
$val = rgar($item, $column);
|
1486 |
-
$list .= '<td style="padding: 6px 10px; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; border-top: 1px solid #FFF; font-family: sans-serif; font-size:12px;">{$val}</td>';
|
1487 |
-
}
|
1488 |
-
|
1489 |
-
$list .='</tr>';
|
1490 |
-
}
|
1491 |
-
|
1492 |
-
$list .='</tbody></table>';
|
1493 |
-
}
|
1494 |
-
else{
|
1495 |
-
$list = '<table class="gfield_list" autosize="1"><thead><tr>';
|
1496 |
-
|
1497 |
-
//reading columns from entry data
|
1498 |
-
foreach($columns as $column){
|
1499 |
-
$list .= '<th>' . esc_html($column) . '</th>';
|
1500 |
-
}
|
1501 |
-
$list .= '</tr></thead>';
|
1502 |
-
|
1503 |
-
$list .= '<tbody>';
|
1504 |
-
foreach($value as $item){
|
1505 |
-
$list .= '<tr>';
|
1506 |
-
foreach($columns as $column){
|
1507 |
-
$val = rgar($item, $column);
|
1508 |
-
$list .= '<td>'.htmlspecialchars($val).'</td>';
|
1509 |
-
}
|
1510 |
-
|
1511 |
-
$list .='</tr>';
|
1512 |
-
}
|
1513 |
-
|
1514 |
-
$list .='</tbody></table>';
|
1515 |
-
}
|
1516 |
-
break;
|
1517 |
-
}
|
1518 |
-
|
1519 |
-
return $list;
|
1520 |
-
}
|
1521 |
-
return '';
|
1522 |
-
break;
|
1523 |
-
|
1524 |
-
default :
|
1525 |
-
if (!is_array($value))
|
1526 |
-
{
|
1527 |
-
return nl2br($value);
|
1528 |
-
}
|
1529 |
-
break;
|
1530 |
-
}
|
1531 |
-
}
|
1532 |
-
|
1533 |
-
public static function pdf_get_lead_field_display($field, $value, $currency='', $use_text=false, $format='html', $media='screen'){
|
1534 |
-
|
1535 |
-
if($field['type'] == 'post_category')
|
1536 |
-
$value = GFCommon::prepare_post_category_value($value, $field);
|
1537 |
-
|
1538 |
-
switch(RGFormsModel::get_input_type($field)){
|
1539 |
-
case 'name' :
|
1540 |
-
if(is_array($value)){
|
1541 |
-
$prefix = trim(rgget($field['id'] . '.2', $value));
|
1542 |
-
$first = trim(rgget($field['id'] . '.3', $value));
|
1543 |
-
$middle = trim(rgget($field['id'] . '.4', $value));
|
1544 |
-
$last = trim(rgget($field['id'] . '.6', $value));
|
1545 |
-
$suffix = trim(rgget($field['id'] . '.8', $value));
|
1546 |
-
|
1547 |
-
$name = $prefix;
|
1548 |
-
$name .= !empty($name) && !empty($first) ? " $first" : $first;
|
1549 |
-
$name .= !empty($name) && !empty($middle) ? " $middle" : $middle;
|
1550 |
-
$name .= !empty($name) && !empty($last) ? " $last" : $last;
|
1551 |
-
$name .= !empty($name) && !empty($suffix) ? " $suffix" : $suffix;
|
1552 |
-
|
1553 |
-
return $name;
|
1554 |
-
}
|
1555 |
-
else{
|
1556 |
-
return $value;
|
1557 |
-
}
|
1558 |
-
|
1559 |
-
break;
|
1560 |
-
case 'creditcard' :
|
1561 |
-
if(is_array($value)){
|
1562 |
-
$card_number = trim(rgget($field['id'] . '.1', $value));
|
1563 |
-
$card_type = trim(rgget($field['id'] . '.4', $value));
|
1564 |
-
$separator = $format == 'html' ? '<br/>' : '\n';
|
1565 |
-
return empty($card_number) ? '' : $card_type . $separator . $card_number;
|
1566 |
-
}
|
1567 |
-
else{
|
1568 |
-
return '';
|
1569 |
-
}
|
1570 |
-
break;
|
1571 |
-
|
1572 |
-
case 'address' :
|
1573 |
-
if(is_array($value)){
|
1574 |
-
$street_value = trim(rgget($field['id'] . '.1', $value));
|
1575 |
-
$street2_value = trim(rgget($field['id'] . '.2', $value));
|
1576 |
-
$city_value = trim(rgget($field['id'] . '.3', $value));
|
1577 |
-
$state_value = trim(rgget($field['id'] . '.4', $value));
|
1578 |
-
$zip_value = trim(rgget($field['id'] . '.5', $value));
|
1579 |
-
$country_value = trim(rgget($field['id'] . '.6', $value));
|
1580 |
-
|
1581 |
-
$line_break = $format == 'html' ? '<br />' : '\n';
|
1582 |
-
|
1583 |
-
$address_display_format = apply_filters('gform_address_display_format', 'default');
|
1584 |
-
if($address_display_format == 'zip_before_city'){
|
1585 |
-
/*
|
1586 |
-
Sample:
|
1587 |
-
3333 Some Street
|
1588 |
-
suite 16
|
1589 |
-
2344 City, State
|
1590 |
-
Country
|
1591 |
-
*/
|
1592 |
-
|
1593 |
-
$addr_ary = array();
|
1594 |
-
$addr_ary[] = $street_value;
|
1595 |
-
|
1596 |
-
if(!empty($street2_value))
|
1597 |
-
$addr_ary[] = $street2_value;
|
1598 |
-
|
1599 |
-
$zip_line = trim($zip_value . ' ' . $city_value);
|
1600 |
-
$zip_line .= !empty($zip_line) && !empty($state_value) ? ", {$state_value}" : $state_value;
|
1601 |
-
$zip_line = trim($zip_line);
|
1602 |
-
if(!empty($zip_line))
|
1603 |
-
$addr_ary[] = $zip_line;
|
1604 |
-
|
1605 |
-
if(!empty($country_value))
|
1606 |
-
$addr_ary[] = $country_value;
|
1607 |
-
|
1608 |
-
$address = implode('<br />', $addr_ary);
|
1609 |
-
|
1610 |
-
}
|
1611 |
-
else{
|
1612 |
-
$address = $street_value;
|
1613 |
-
$address .= !empty($address) && !empty($street2_value) ? $line_break . $street2_value : $street2_value;
|
1614 |
-
$address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? $line_break. $city_value : $city_value;
|
1615 |
-
$address .= !empty($address) && !empty($city_value) && !empty($state_value) ? ", $state_value" : $state_value;
|
1616 |
-
$address .= !empty($address) && !empty($zip_value) ? " $zip_value" : $zip_value;
|
1617 |
-
$address .= !empty($address) && !empty($country_value) ? $line_break . $country_value : $country_value;
|
1618 |
-
}
|
1619 |
-
|
1620 |
-
return $address;
|
1621 |
-
}
|
1622 |
-
else{
|
1623 |
-
return '';
|
1624 |
-
}
|
1625 |
-
break;
|
1626 |
-
|
1627 |
-
case 'email' :
|
1628 |
-
return GFCommon::is_valid_email($value) && $format == 'html' ? '<a href="mailto:'. $value .'">'. $value .'</a>' : $value;
|
1629 |
-
break;
|
1630 |
-
|
1631 |
-
case 'website' :
|
1632 |
-
return GFCommon::is_valid_url($value) && $format == 'html' ? '<a href="'. $value .'" target="_blank">'. $value .'</a>' : $value;
|
1633 |
-
break;
|
1634 |
-
|
1635 |
-
case 'checkbox' :
|
1636 |
-
if(is_array($value)){
|
1637 |
-
|
1638 |
-
$items = '';
|
1639 |
-
|
1640 |
-
foreach($value as $key => $item){
|
1641 |
-
if(!empty($item)){
|
1642 |
-
switch($format){
|
1643 |
-
case 'text' :
|
1644 |
-
$items .= GFCommon::selection_display($item, $field, $currency, true) . ', ';
|
1645 |
-
break;
|
1646 |
-
|
1647 |
-
default:
|
1648 |
-
$items .= '<li>' . GFCommon::selection_display($item, $field, $currency, true) . '</li>';
|
1649 |
-
break;
|
1650 |
-
}
|
1651 |
-
}
|
1652 |
-
}
|
1653 |
-
if(empty($items)){
|
1654 |
-
return '';
|
1655 |
-
}
|
1656 |
-
else if($format == 'text'){
|
1657 |
-
return substr($items, 0, strlen($items)-2); //removing last comma
|
1658 |
-
}
|
1659 |
-
else{
|
1660 |
-
return '<ul class="bulleted">' . $items . '</ul>';
|
1661 |
-
}
|
1662 |
-
}
|
1663 |
-
else{
|
1664 |
-
return $value;
|
1665 |
-
}
|
1666 |
-
break;
|
1667 |
-
|
1668 |
-
case 'post_image' :
|
1669 |
-
$ary = explode('|:|', $value);
|
1670 |
-
$url = count($ary) > 0 ? $ary[0] : '';
|
1671 |
-
$title = count($ary) > 1 ? $ary[1] : '';
|
1672 |
-
$caption = count($ary) > 2 ? $ary[2] : '';
|
1673 |
-
$description = count($ary) > 3 ? $ary[3] : '';
|
1674 |
-
|
1675 |
-
if(!empty($url)){
|
1676 |
-
$url = str_replace(' ', '%20', $url);
|
1677 |
-
switch($format){
|
1678 |
-
case 'text' :
|
1679 |
-
$value = $url;
|
1680 |
-
$value .= !empty($title) ? '\n\n' . $field['label'] . ' (' . __('Title', 'gravityforms') . '): ' . $title : '';
|
1681 |
-
$value .= !empty($caption) ? '\n\n' . $field['label'] . ' (' . __('Caption', 'gravityforms') . '): ' . $caption : '';
|
1682 |
-
$value .= !empty($description) ? '\n\n' . $field['label'] . ' (' . __('Description', 'gravityforms') . '): ' . $description : '';
|
1683 |
-
break;
|
1684 |
-
|
1685 |
-
default :
|
1686 |
-
$path = str_replace(site_url().'/', ABSPATH, $url);
|
1687 |
-
$value = "<a href='$url' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='$path' width='100' /></a>";
|
1688 |
-
$value .= !empty($title) ? "<div>Title: $title</div>" : "";
|
1689 |
-
$value .= !empty($caption) ? "<div>Caption: $caption</div>" : "";
|
1690 |
-
$value .= !empty($description) ? "<div>Description: $description</div>": "";
|
1691 |
-
|
1692 |
-
break;
|
1693 |
-
}
|
1694 |
-
}
|
1695 |
-
return $value;
|
1696 |
-
|
1697 |
-
case 'fileupload' :
|
1698 |
-
$output = '';
|
1699 |
-
$output_arr = array();
|
1700 |
-
if(!empty($value)){
|
1701 |
-
$output .= '<ul>';
|
1702 |
-
$file_paths = rgar($field,'multipleFiles') ? json_decode($value) : array($value);
|
1703 |
-
foreach($file_paths as $file_path){
|
1704 |
-
$info = pathinfo($file_path);
|
1705 |
-
$file_path = esc_attr(str_replace(' ', '%20', $file_path));
|
1706 |
-
$output_arr[] = '<li><a href="'. $file_path .'" target="_blank" title="' . __('Click to view', 'gravityforms') . '">' . $info['basename'] . '</a></li>';
|
1707 |
-
}
|
1708 |
-
$output .= join(PHP_EOL, $output_arr);
|
1709 |
-
$output .= '</ul>';
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
return $output;
|
1713 |
-
break;
|
1714 |
-
|
1715 |
-
case 'date' :
|
1716 |
-
return GFCommon::date_display($value, rgar($field, 'dateFormat'));
|
1717 |
-
break;
|
1718 |
-
|
1719 |
-
case 'radio' :
|
1720 |
-
case 'select' :
|
1721 |
-
return GFCommon::selection_display($value, $field, $currency, true);
|
1722 |
-
break;
|
1723 |
-
|
1724 |
-
case 'multiselect' :
|
1725 |
-
if(empty($value) || $format == 'text')
|
1726 |
-
return $value;
|
1727 |
-
|
1728 |
-
$value = explode(',', $value);
|
1729 |
-
|
1730 |
-
$items = '';
|
1731 |
-
foreach($value as $item){
|
1732 |
-
$items .= '<li>' . GFCommon::selection_display($item, $field, $currency, true) . '</li>';
|
1733 |
-
}
|
1734 |
-
|
1735 |
-
return '<ul class="bulleted">' . $items . '</ul>';
|
1736 |
-
|
1737 |
-
break;
|
1738 |
-
|
1739 |
-
case 'calculation' :
|
1740 |
-
case 'singleproduct' :
|
1741 |
-
if(is_array($value)){
|
1742 |
-
$product_name = trim($value[$field['id'] . '.1']);
|
1743 |
-
$price = trim($value[$field['id'] . '.2']);
|
1744 |
-
$quantity = trim($value[$field['id'] . '.3']);
|
1745 |
-
|
1746 |
-
$product = $product_name . ', ' . __('Qty: ', 'gravityforms') . $quantity . ', ' . __('Price: ', 'gravityforms') . $price;
|
1747 |
-
return $product;
|
1748 |
-
}
|
1749 |
-
else{
|
1750 |
-
return '';
|
1751 |
-
}
|
1752 |
-
break;
|
1753 |
-
|
1754 |
-
case 'number' :
|
1755 |
-
return GFCommon::format_number($value, rgar($field, 'numberFormat'));
|
1756 |
-
break;
|
1757 |
-
|
1758 |
-
case 'singleshipping' :
|
1759 |
-
case 'donation' :
|
1760 |
-
case 'total' :
|
1761 |
-
case 'price' :
|
1762 |
-
return GFCommon::to_money($value, $currency);
|
1763 |
-
|
1764 |
-
case 'list' :
|
1765 |
-
if(empty($value))
|
1766 |
-
return '';
|
1767 |
-
$value = unserialize($value);
|
1768 |
-
|
1769 |
-
$has_columns = is_array($value[0]);
|
1770 |
-
|
1771 |
-
if(!$has_columns){
|
1772 |
-
$items = '';
|
1773 |
-
foreach($value as $key => $item){
|
1774 |
-
if(!empty($item)){
|
1775 |
-
switch($format){
|
1776 |
-
case 'text' :
|
1777 |
-
$items .= $item . ', ';
|
1778 |
-
break;
|
1779 |
-
case 'url' :
|
1780 |
-
$items .= $item . ',';
|
1781 |
-
break;
|
1782 |
-
default :
|
1783 |
-
if($media == 'email'){
|
1784 |
-
$items .= '<li>'.htmlspecialchars($item).'</li>';
|
1785 |
-
}
|
1786 |
-
else{
|
1787 |
-
$items .= '<li>'.htmlspecialchars($item).'</li>';
|
1788 |
-
}
|
1789 |
-
break;
|
1790 |
-
}
|
1791 |
-
}
|
1792 |
-
}
|
1793 |
-
|
1794 |
-
if(empty($items)){
|
1795 |
-
return '';
|
1796 |
-
}
|
1797 |
-
else if($format == 'text'){
|
1798 |
-
return substr($items, 0, strlen($items)-2); //removing last comma
|
1799 |
-
}
|
1800 |
-
else if($format == 'url'){
|
1801 |
-
return substr($items, 0, strlen($items)-1); //removing last comma
|
1802 |
-
}
|
1803 |
-
else{
|
1804 |
-
return '<ul class="bulleted">' . $items . '</ul>';
|
1805 |
-
}
|
1806 |
-
}
|
1807 |
-
else if(is_array($value)){
|
1808 |
-
$columns = array_keys($value[0]);
|
1809 |
-
|
1810 |
-
$list = '';
|
1811 |
-
|
1812 |
-
switch($format){
|
1813 |
-
case 'text' :
|
1814 |
-
$is_first_row = true;
|
1815 |
-
foreach($value as $item){
|
1816 |
-
if(!$is_first_row)
|
1817 |
-
$list .= '\n\n' . $field['label'] . ': ';
|
1818 |
-
$list .= implode(',', array_values($item));
|
1819 |
-
|
1820 |
-
$is_first_row = false;
|
1821 |
-
}
|
1822 |
-
break;
|
1823 |
-
|
1824 |
-
case 'url' :
|
1825 |
-
foreach($value as $item){
|
1826 |
-
$list .= implode('|', array_values($item)) . ',';
|
1827 |
-
}
|
1828 |
-
if(!empty($list))
|
1829 |
-
$list = substr($list, 0, strlen($list)-1);
|
1830 |
-
break;
|
1831 |
-
|
1832 |
-
default :
|
1833 |
-
if($media == 'email'){
|
1834 |
-
$list = '<table autosize="1" class="gfield_list" style="border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%"><thead><tr>';
|
1835 |
-
|
1836 |
-
//reading columns from entry data
|
1837 |
-
foreach($columns as $column){
|
1838 |
-
$list .= '<th style="background-image: none; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; padding: 6px 10px; font-family: sans-serif; font-size: 12px; font-weight: bold; background-color: #F1F1F1; color:#333; text-align:left">' . esc_html($column) . '</th>';
|
1839 |
-
}
|
1840 |
-
$list .= '</tr></thead>';
|
1841 |
-
|
1842 |
-
$list .= '<tbody style="background-color: #F9F9F9">';
|
1843 |
-
foreach($value as $item){
|
1844 |
-
$list .= '<tr>';
|
1845 |
-
foreach($columns as $column){
|
1846 |
-
$val = rgar($item, $column);
|
1847 |
-
$list .= '<td style="padding: 6px 10px; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; border-top: 1px solid #FFF; font-family: sans-serif; font-size:12px;">{$val}</td>';
|
1848 |
-
}
|
1849 |
-
|
1850 |
-
$list .='</tr>';
|
1851 |
-
}
|
1852 |
-
|
1853 |
-
$list .='</tbody></table>';
|
1854 |
-
}
|
1855 |
-
else{
|
1856 |
-
$list = '<table autosize="1" class="gfield_list"><thead><tr>';
|
1857 |
-
|
1858 |
-
//reading columns from entry data
|
1859 |
-
foreach($columns as $column){
|
1860 |
-
$list .= '<th>' . esc_html($column) . '</th>';
|
1861 |
-
}
|
1862 |
-
$list .= '</tr></thead>';
|
1863 |
-
|
1864 |
-
$list .= '<tbody>';
|
1865 |
-
foreach($value as $item){
|
1866 |
-
$list .= '<tr>';
|
1867 |
-
foreach($columns as $column){
|
1868 |
-
$val = rgar($item, $column);
|
1869 |
-
$list .= '<td>'.htmlspecialchars($val).'</td>';
|
1870 |
-
}
|
1871 |
-
|
1872 |
-
$list .='</tr>';
|
1873 |
-
}
|
1874 |
-
|
1875 |
-
$list .='</tbody></table>';
|
1876 |
-
}
|
1877 |
-
break;
|
1878 |
-
}
|
1879 |
-
|
1880 |
-
return $list;
|
1881 |
-
}
|
1882 |
-
return '';
|
1883 |
-
break;
|
1884 |
-
|
1885 |
-
default :
|
1886 |
-
if (!is_array($value))
|
1887 |
-
{
|
1888 |
-
return nl2br($value);
|
1889 |
-
}
|
1890 |
-
break;
|
1891 |
-
}
|
1892 |
-
}
|
1893 |
-
|
1894 |
-
|
1895 |
-
public static function encode_tags($content, $field)
|
1896 |
-
{
|
1897 |
-
if(RGFormsModel::get_input_type($field) != 'html' || RGFormsModel::get_input_type($field) != 'signature')
|
1898 |
-
{
|
1899 |
-
$content = str_replace('[', '[', $content);
|
1900 |
-
$content = str_replace(']', ']', $content);
|
1901 |
-
$content = str_replace('{', '{', $content);
|
1902 |
-
$content = str_replace('}', '}', $content);
|
1903 |
-
}
|
1904 |
-
|
1905 |
-
return $content;
|
1906 |
-
}
|
1907 |
-
}
|
1908 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper/pdf-render.php
DELETED
@@ -1,320 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
class PDFRender
|
5 |
-
{
|
6 |
-
/**
|
7 |
-
* Outputs a PDF entry from a Gravity Form
|
8 |
-
* var $form_id integer: The form id
|
9 |
-
* var $lead_id integer: The entry id
|
10 |
-
* var $output string: either view, save or download
|
11 |
-
* save will save a copy of the PDF to the server using the $gfpdfe_data->template_save_location variable
|
12 |
-
* var $return boolean: if set to true
|
13 |
-
* it will return the path of the saved PDF
|
14 |
-
* var $template string: if you want to use multiple PDF templates - name of the template file
|
15 |
-
* var $pdfname string: allows you to pass a custom PDF name to the generator e.g. 'Application Form.pdf' (ensure .pdf is appended to the filename)
|
16 |
-
* var $fpdf boolean: custom hook to allow the FPDF engine to generate PDFs instead of DOMPDF. Premium Paid Feature.
|
17 |
-
*/
|
18 |
-
public function PDF_Generator($form_id, $lead_id, $arguments = array())
|
19 |
-
{
|
20 |
-
/*
|
21 |
-
* Because we merged the create and attach functions we need a measure to only run this function once per session per lead id.
|
22 |
-
*/
|
23 |
-
static $pdf_creator = array();
|
24 |
-
|
25 |
-
/*
|
26 |
-
* Set user-variable to output HTML instead of PDF
|
27 |
-
*/
|
28 |
-
$html = (isset($_GET['html'])) ? (int) $_GET['html'] : 0;
|
29 |
-
|
30 |
-
/*
|
31 |
-
* Join the form and lead IDs together to get the real ID
|
32 |
-
*/
|
33 |
-
$id = $form_id . $lead_id;
|
34 |
-
|
35 |
-
/*
|
36 |
-
* PDF_Generator was becoming too cluttered so store all the variables in an array
|
37 |
-
*/
|
38 |
-
$filename = $arguments['pdfname'];
|
39 |
-
$template = $arguments['template'];
|
40 |
-
$output = (isset($arguments['output']) && strlen($arguments['output']) > 0) ? $arguments['output'] : 'save';
|
41 |
-
|
42 |
-
/*
|
43 |
-
* Check if the PDF exists and if this function has already run this season
|
44 |
-
*/
|
45 |
-
if(in_array($lead_id, $pdf_creator) && file_exists($gfpdfe_data->template_save_location . $id . '/' . $filename))
|
46 |
-
{
|
47 |
-
/*
|
48 |
-
* Don't generate a new PDF, use the existing one
|
49 |
-
*/
|
50 |
-
return $gfpdfe_data->template_save_location . $id . '/' . $filename;
|
51 |
-
}
|
52 |
-
|
53 |
-
/*
|
54 |
-
* Add lead to PDF creation tracker
|
55 |
-
*/
|
56 |
-
$pdf_creator[] = $lead_id;
|
57 |
-
|
58 |
-
/*
|
59 |
-
* Add filter before we load the template file so we can stop the main process
|
60 |
-
* Used in premium plugins
|
61 |
-
* return true to cancel, otherwise run.
|
62 |
-
*/
|
63 |
-
$return = apply_filters("gfpdfe_pre_load_template", $form_id, $lead_id, $template, $id, $output, $filename, $arguments);
|
64 |
-
|
65 |
-
if($return !== true)
|
66 |
-
{
|
67 |
-
/*
|
68 |
-
* Get the template HTML file
|
69 |
-
* v3.4.0 allows mergetags to be used in PDF templates
|
70 |
-
*/
|
71 |
-
$raw_entry = $this->load_entry_data($template);
|
72 |
-
$entry = apply_filters("gfpdfe_pdf_template_{$form_id}", apply_filters('gfpdfe_pdf_template', $raw_entry, $form_id, $lead_id, $arguments), $lead_id, $arguments);
|
73 |
-
|
74 |
-
/*
|
75 |
-
* Output HTML version and return if user requested a HTML version
|
76 |
-
*/
|
77 |
-
if($html === 1)
|
78 |
-
{
|
79 |
-
echo $entry;
|
80 |
-
exit;
|
81 |
-
}
|
82 |
-
|
83 |
-
/*
|
84 |
-
* If successfully got the entry then run the processor
|
85 |
-
*/
|
86 |
-
if(strlen($entry) > 0)
|
87 |
-
{
|
88 |
-
return $this->PDF_processing($entry, $filename, $id, $output, $arguments, $form_id, $lead_id);
|
89 |
-
}
|
90 |
-
|
91 |
-
return false;
|
92 |
-
}
|
93 |
-
/*
|
94 |
-
* Used in extensions to return the name of the PDF file when attaching to notifications
|
95 |
-
*/
|
96 |
-
return apply_filters('gfpdfe_return_pdf_path', $form_id, $lead_id);
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Loads the Gravity Form output script (actually the print preview)
|
101 |
-
*/
|
102 |
-
private function load_entry_data($template)
|
103 |
-
{
|
104 |
-
global $gfpdfe_data;
|
105 |
-
|
106 |
-
/* set up contstants for gravity forms to use so we can override the security on the printed version */
|
107 |
-
if(file_exists( $gfpdfe_data->template_site_location . $template))
|
108 |
-
{
|
109 |
-
return PDF_Common::get_html_template($gfpdfe_data->template_site_location . $template);
|
110 |
-
}
|
111 |
-
else
|
112 |
-
{
|
113 |
-
/*
|
114 |
-
* Check if template file exists in the plugin's core template folder
|
115 |
-
*/
|
116 |
-
if(file_exists( PDF_PLUGIN_DIR . 'templates/' . $template))
|
117 |
-
{
|
118 |
-
return PDF_Common::get_html_template( PDF_PLUGIN_DIR . 'initialisation/templates/' . $template);
|
119 |
-
}
|
120 |
-
/*
|
121 |
-
* If template not found then we will resort to the default template.
|
122 |
-
*/
|
123 |
-
else
|
124 |
-
{
|
125 |
-
return PDF_Common::get_html_template(PDF_PLUGIN_DIR . 'initialisation/templates/' . PDFGenerator::$default['template']);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Creates the PDF and does a specific output (see PDF_Generator function above for $output variable types)
|
133 |
-
*/
|
134 |
-
public function PDF_processing($html, $filename, $id, $output = 'view', $arguments, $form_id, $lead_id)
|
135 |
-
{
|
136 |
-
/*
|
137 |
-
* DOMPDF replaced with mPDF in v3.0.0
|
138 |
-
* Check which version of mpdf we are calling
|
139 |
-
* Full, Lite or Tiny
|
140 |
-
*/
|
141 |
-
if(!class_exists('mPDF'))
|
142 |
-
{
|
143 |
-
if(defined('PDF_ENABLE_MPDF_TINY') && PDF_ENABLE_MPDF_TINY === true)
|
144 |
-
{
|
145 |
-
include PDF_PLUGIN_DIR .'/mPDF/mpdf-extra-lite.php';
|
146 |
-
}
|
147 |
-
elseif(defined('PDF_ENABLE_MPDF_LITE') && PDF_ENABLE_MPDF_LITE === true)
|
148 |
-
{
|
149 |
-
include PDF_PLUGIN_DIR .'/mPDF/mpdf-lite.php';
|
150 |
-
}
|
151 |
-
else
|
152 |
-
{
|
153 |
-
include PDF_PLUGIN_DIR .'/mPDF/mpdf.php';
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
/*
|
158 |
-
* Initialise class and set the paper size and orientation
|
159 |
-
*/
|
160 |
-
$paper_size = $arguments['pdf_size'];
|
161 |
-
|
162 |
-
if(!is_array($paper_size))
|
163 |
-
{
|
164 |
-
$orientation = ($arguments['orientation'] == 'landscape') ? '-L' : '';
|
165 |
-
$paper_size = $paper_size.$orientation;
|
166 |
-
}
|
167 |
-
else
|
168 |
-
{
|
169 |
-
$orientation = ($arguments['orientation'] == 'landscape') ? 'L' : 'P';
|
170 |
-
}
|
171 |
-
|
172 |
-
$mpdf = new mPDF('', $paper_size, 0, '', 15, 15, 16, 16, 9, 9, $orientation);
|
173 |
-
|
174 |
-
/*
|
175 |
-
* Add filter to allow the $mpdf object to be modified right after the class is created.
|
176 |
-
* Because $mpdf is a class it is automatically passed by reference and doesn't need to be assigned
|
177 |
-
*/
|
178 |
-
apply_filters('gfpdfe_mpdf_class', $mpdf, $form_id, $lead_id, $arguments, $output, $filename);
|
179 |
-
|
180 |
-
/*
|
181 |
-
* Display PDF is full-page mode which allows the entire PDF page to be viewed
|
182 |
-
* Normally PDF is zoomed right in.
|
183 |
-
*/
|
184 |
-
$mpdf->SetDisplayMode('fullpage');
|
185 |
-
|
186 |
-
/*
|
187 |
-
* Automatically detect fonts and substitue as needed
|
188 |
-
*/
|
189 |
-
$mpdf->SetAutoFont(AUTOFONT_ALL);
|
190 |
-
(defined('PDF_DISABLE_FONT_SUBSTITUTION') && PDF_DISABLE_FONT_SUBSTITUTION === false) ? $mpdf->useSubstitutions = true : $mpdf->useSubstitutions = false;
|
191 |
-
|
192 |
-
/*
|
193 |
-
* Set Creator Meta Data
|
194 |
-
*/
|
195 |
-
$mpdf->SetCreator('Gravity PDF v' . PDF_EXTENDED_VERSION . '. https://gravitypdf.com');
|
196 |
-
|
197 |
-
/*
|
198 |
-
* Set PDF DPI if added to configuration node
|
199 |
-
*/
|
200 |
-
if($arguments['dpi'] !== false)
|
201 |
-
{
|
202 |
-
/* TEXT DPI dramatically decreases the text size. As text is a vector element of the document we will only be concerned with the image DPI for the moment */
|
203 |
-
/*$mpdf->dpi = $arguments['dpi'];*/
|
204 |
-
$mpdf->img_dpi = $arguments['dpi'];
|
205 |
-
}
|
206 |
-
|
207 |
-
/*
|
208 |
-
* Set RTL languages at user request
|
209 |
-
*/
|
210 |
-
if($arguments['rtl'] === true)
|
211 |
-
{
|
212 |
-
$mpdf->SetDirectionality('rtl');
|
213 |
-
}
|
214 |
-
|
215 |
-
/*
|
216 |
-
* Set up security if user requested
|
217 |
-
*/
|
218 |
-
if($arguments['security'] === true && $arguments['pdfa1b'] === false && $arguments['pdfx1a'] === false )
|
219 |
-
{
|
220 |
-
$password = (strlen($arguments['pdf_password']) > 0) ? $arguments['pdf_password'] : '';
|
221 |
-
$master_password = (strlen($arguments['pdf_master_password']) > 0) ? $arguments['pdf_master_password'] : null;
|
222 |
-
$pdf_privileges = (is_array($arguments['pdf_privileges'])) ? $arguments['pdf_privileges'] : array();
|
223 |
-
|
224 |
-
$mpdf->SetProtection($pdf_privileges, $password, $master_password, 128);
|
225 |
-
}
|
226 |
-
|
227 |
-
/* PDF/A1-b support added in v3.4.0 */
|
228 |
-
if($arguments['pdfa1b'] === true)
|
229 |
-
{
|
230 |
-
$mpdf->PDFA = true;
|
231 |
-
$mpdf->PDFAauto = true;
|
232 |
-
}
|
233 |
-
else if($arguments['pdfx1a'] === true) /* PDF/X-1a support added in v3.4.0 */
|
234 |
-
{
|
235 |
-
$mpdf->PDFX = true;
|
236 |
-
$mpdf->PDFXauto = true;
|
237 |
-
}
|
238 |
-
|
239 |
-
/*
|
240 |
-
* Check if we should auto prompt to print the document on open
|
241 |
-
*/
|
242 |
-
if(isset($_GET['print']))
|
243 |
-
{
|
244 |
-
$mpdf->SetJS('this.print();');
|
245 |
-
}
|
246 |
-
|
247 |
-
|
248 |
-
/* load HTML block */
|
249 |
-
$mpdf->WriteHTML($html);
|
250 |
-
|
251 |
-
/*
|
252 |
-
* Allow the $mpdf object to be modified now all the settings have been applied
|
253 |
-
*/
|
254 |
-
apply_filters('gfpdfe_mpdf_class_pre_render', $mpdf, $form_id, $lead_id, $arguments, $output, $filename);
|
255 |
-
apply_filters('gfpdfe_pre_render_pdf', $mpdf, $form_id, $lead_id, $arguments, $output, $filename); /* left in for backwards compatiblity */
|
256 |
-
|
257 |
-
/*
|
258 |
-
* Add pre-render/save filter so PDF can be manipulated further
|
259 |
-
*/
|
260 |
-
$output = apply_filters('gfpdfe_pdf_output_type', $output);
|
261 |
-
$filename = apply_filters('gfpdfe_pdf_filename', $filename);
|
262 |
-
|
263 |
-
switch($output)
|
264 |
-
{
|
265 |
-
case 'download':
|
266 |
-
$mpdf->Output($filename, 'D');
|
267 |
-
exit;
|
268 |
-
break;
|
269 |
-
|
270 |
-
case 'view':
|
271 |
-
$mpdf->Output($filename, 'I');
|
272 |
-
exit;
|
273 |
-
break;
|
274 |
-
|
275 |
-
case 'save':
|
276 |
-
/*
|
277 |
-
* PDF wasn't writing to file with the F method - http://mpdf1.com/manual/index.php?tid=125
|
278 |
-
* Return as a string and write to file manually
|
279 |
-
*/
|
280 |
-
$pdf = $mpdf->Output('', 'S');
|
281 |
-
$filename = $this->savePDF($pdf, $filename, $id);
|
282 |
-
|
283 |
-
do_action('gfpdf_post_pdf_save', $form_id, $lead_id, $arguments, $filename);
|
284 |
-
|
285 |
-
return $filename;
|
286 |
-
break;
|
287 |
-
}
|
288 |
-
}
|
289 |
-
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Creates the PDF and does a specific output (see PDF_Generator function above for $output variable types)
|
293 |
-
* var $dompdf Object
|
294 |
-
*/
|
295 |
-
public function savePDF($pdf, $filename, $id)
|
296 |
-
{
|
297 |
-
global $gfpdfe_data;
|
298 |
-
|
299 |
-
/* create unique folder for PDFs */
|
300 |
-
if(!is_dir( $gfpdfe_data->template_save_location . $id))
|
301 |
-
{
|
302 |
-
if(!mkdir( $gfpdfe_data->template_save_location . $id))
|
303 |
-
{
|
304 |
-
trigger_error('Could not create PDF folder in '. $gfpdfe_data->template_save_location . $id, E_USER_WARNING);
|
305 |
-
return;
|
306 |
-
}
|
307 |
-
}
|
308 |
-
|
309 |
-
$pdf_save = $gfpdfe_data->template_save_location . $id . '/' . $filename;
|
310 |
-
|
311 |
-
if(!file_put_contents($pdf_save, $pdf))
|
312 |
-
{
|
313 |
-
trigger_error('Could not save PDF to '. $pdf_save, E_USER_WARNING);
|
314 |
-
return;
|
315 |
-
}
|
316 |
-
|
317 |
-
return $pdf_save;
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
images/_notes/dwsync.xml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
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 |
+
</dwsync>
|
{resources/images → images}/alpha.gif
RENAMED
File without changes
|
{resources/images → images}/alpha.png
RENAMED
File without changes
|
{resources/images → images}/alpha3.png
RENAMED
File without changes
|
{resources/images → images}/bayeux1.jpg
RENAMED
File without changes
|
{resources/images → images}/bg.jpg
RENAMED
File without changes
|
{resources/images → images}/bgbarcode.png
RENAMED
File without changes
|
{resources/images → images}/bgrock.jpg
RENAMED
File without changes
|
{resources/images → images}/borders2FF.jpg
RENAMED
File without changes
|
{resources/images → images}/borders2IE.jpg
RENAMED
File without changes
|
{resources/images → images}/borders3FF.jpg
RENAMED
File without changes
|
{resources/images → images}/borders3IE.jpg
RENAMED
File without changes
|
{resources/images → images}/borders4FF.jpg
RENAMED
File without changes
|
{resources/images → images}/borders4IE.jpg
RENAMED
File without changes
|
{resources/images → images}/bordersFF.jpg
RENAMED
File without changes
|
{resources/images → images}/bordersIE.jpg
RENAMED
File without changes
|
{resources/images → images}/bordersMPDF2.jpg
RENAMED
File without changes
|
{resources/images → images}/clematis.jpg
RENAMED
File without changes
|
{resources/images → images}/firefox-48.png
RENAMED
File without changes
|
{resources/images → images}/flowers-pattern.jpg
RENAMED
File without changes
|
{resources/images → images}/goto.gif
RENAMED
File without changes
|
images/gravityformspdfextended.jpg
ADDED
Binary file
|
{resources/images → images}/img1.png
RENAMED
File without changes
|
{resources/images → images}/img2.png
RENAMED
File without changes
|
{resources/images → images}/img3.png
RENAMED
File without changes
|
{resources/images → images}/img4.png
RENAMED
File without changes
|
{resources/images → images}/img5.png
RENAMED
File without changes
|
{resources/images → images}/klematis.jpg
RENAMED
File without changes
|
{resources/images → images}/loading.gif
RENAMED
File without changes
|
{resources/images → images}/mpdfstyleA4.css
RENAMED
File without changes
|
{resources/images → images}/mpdfstylePaged.css
RENAMED
File without changes
|
{resources/images → images}/mpdfstyletables.css
RENAMED
File without changes
|
{resources/images → images}/quran282.jpg
RENAMED
File without changes
|
{resources/images → images}/signature.png
RENAMED
File without changes
|
{resources/images → images}/sunset.jpg
RENAMED
File without changes
|
{resources/images → images}/sunsetv.jpg
RENAMED
File without changes
|
{resources/images → images}/tiger.bmp
RENAMED
File without changes
|
{resources/images → images}/tiger.gif
RENAMED
File without changes
|
{resources/images → images}/tiger.jpg
RENAMED
File without changes
|
{resources/images → images}/tiger.png
RENAMED
File without changes
|
{resources/images → images}/tiger.svg
RENAMED
File without changes
|
{resources/images → images}/tiger.wmf
RENAMED
File without changes
|
{resources/images → images}/tiger2.png
RENAMED
File without changes
|
{resources/images → images}/tiger2.wmf
RENAMED
File without changes
|
{resources/images → images}/tiger24trns.png
RENAMED
File without changes
|
{resources/images → images}/tiger300px300dpi.jpg
RENAMED
File without changes
|
{resources/images → images}/tiger300px300dpi.png
RENAMED
File without changes
|
{resources/images → images}/tiger300px72dpi.jpg
RENAMED
File without changes
|
{resources/images → images}/tiger300px96dpi.jpg
RENAMED
File without changes
|
{resources/images → images}/tiger300px96dpi.png
RENAMED
File without changes
|
{resources/images → images}/tiger8trns.gif
RENAMED
File without changes
|
{resources/images → images}/tiger8trns.png
RENAMED
File without changes
|
{resources/images → images}/tigercmyk.jpg
RENAMED
File without changes
|
{resources/images → images}/windmill.jpg
RENAMED
File without changes
|
initialisation/template.css
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
/* *
|
2 |
-
* DO NOT MODIFY THIS FILE. IT'S OVERRIDDEN WHEN INITIALISING
|
3 |
-
* Instead create another stylesheet and load it in your custom template
|
4 |
-
*
|
5 |
-
* The following snippet of CSS styles the default templates and the example template */
|
6 |
-
body {
|
7 |
-
font-family: DejaVu Sans, Helvetica, sans-serif;
|
8 |
-
letter-spacing: -0.2px;
|
9 |
-
}
|
10 |
-
#container {
|
11 |
-
border-radius: 4px 4px 4px 4px;
|
12 |
-
border-spacing: 0;
|
13 |
-
clear: both;
|
14 |
-
width: 100%;
|
15 |
-
background-color: #fff;
|
16 |
-
border-color: #dfdfdf;
|
17 |
-
border-style: solid;
|
18 |
-
border-width: 1px;
|
19 |
-
margin: 0 0 16px;
|
20 |
-
}
|
21 |
-
h2.default {
|
22 |
-
background-color: #e3e3e3;
|
23 |
-
font-size: 14px;
|
24 |
-
text-align: left;
|
25 |
-
text-shadow: 0 1px 0 #fff;
|
26 |
-
margin: 0;
|
27 |
-
padding: 7px;
|
28 |
-
}
|
29 |
-
.entry-view-field-value, .entry-view-html-value {
|
30 |
-
border-bottom: 1px solid #dfdfdf;
|
31 |
-
line-height: 150%;
|
32 |
-
padding: 6px 6px 6px 7px;
|
33 |
-
}
|
34 |
-
.lastrow {
|
35 |
-
border-bottom: none;
|
36 |
-
}
|
37 |
-
.entry-view-field-value ul {
|
38 |
-
margin-left: 25px;
|
39 |
-
}
|
40 |
-
.entry-view-field-value div.strong {
|
41 |
-
font-weight: bold;
|
42 |
-
}
|
43 |
-
.no-style .entry-view-field-value, .no-style #container, .no-style h2, .no-style .entry-view-html-value {
|
44 |
-
background: none;
|
45 |
-
border: none;
|
46 |
-
}
|
47 |
-
.two_row .entry-view-field-value {
|
48 |
-
border: 0;
|
49 |
-
line-height: normal;
|
50 |
-
padding: 0;
|
51 |
-
}
|
52 |
-
.two_row .entry-view-field-value div.strong {
|
53 |
-
font-weight: bold;
|
54 |
-
width: 100%;
|
55 |
-
border-bottom: 1px solid #dfdfdf;
|
56 |
-
line-height: 150%;
|
57 |
-
background-color: #eaf2fa;
|
58 |
-
padding: 6px 6px 6px 7px;
|
59 |
-
}
|
60 |
-
.two_row .entry-view-field-value div.value {
|
61 |
-
display: block;
|
62 |
-
width: 100%;
|
63 |
-
border-bottom: 1px solid #fff;
|
64 |
-
line-height: 150%;
|
65 |
-
padding: 6px 6px 6px 7px;
|
66 |
-
}
|
67 |
-
.two_row .entry-view-field-value span {
|
68 |
-
font-weight: normal;
|
69 |
-
}
|
70 |
-
td.entry-view-field-value {
|
71 |
-
padding-left: 9px;
|
72 |
-
}
|
73 |
-
.even {
|
74 |
-
background: #eaf2fa;
|
75 |
-
}
|
76 |
-
.body_copy {
|
77 |
-
padding-top: 50px;
|
78 |
-
}
|
79 |
-
.pdf_logo_area {
|
80 |
-
text-align: center;
|
81 |
-
margin: 0 auto;
|
82 |
-
}
|
83 |
-
table.entry-products th {
|
84 |
-
background-color: #F4F4F4;
|
85 |
-
border-bottom: 1px solid #DFDFDF;
|
86 |
-
border-right: 1px solid #DFDFDF !important;
|
87 |
-
}
|
88 |
-
table.entry-products td.textcenter, table.entry-products th.textcenter {
|
89 |
-
text-align: center;
|
90 |
-
}
|
91 |
-
table.entry-products col.entry-products-col2 {
|
92 |
-
width: 50px;
|
93 |
-
}
|
94 |
-
table.entry-products col.entry-products-col3 {
|
95 |
-
width: 155px;
|
96 |
-
}
|
97 |
-
table.entry-products col.entry-products-col4 {
|
98 |
-
width: 155px;
|
99 |
-
}
|
100 |
-
table.entry-products {
|
101 |
-
border: 1px solid #DFDFDF;
|
102 |
-
margin: 10px 0;
|
103 |
-
}
|
104 |
-
table.entry-products td {
|
105 |
-
border-bottom: 1px solid #DFDFDF;
|
106 |
-
border-right: 1px solid #DFDFDF !important;
|
107 |
-
padding: 7px 7px 8px;
|
108 |
-
vertical-align: top;
|
109 |
-
}
|
110 |
-
table.entry-products td.emptycell {
|
111 |
-
background-color: #F4F4F4;
|
112 |
-
}
|
113 |
-
table.entry-products td.grandtotal, table.entry-products td.grandtotal_amount, table.entry-products td.shipping, table.entry-products td.shipping_amount {
|
114 |
-
font-size: 13px;
|
115 |
-
font-weight: bold;
|
116 |
-
padding-bottom: 8px;
|
117 |
-
padding-top: 7px;
|
118 |
-
}
|
119 |
-
table.entry-products td.textright, table.entry-products th.textright {
|
120 |
-
text-align: right;
|
121 |
-
}
|
122 |
-
.two_row .odd, .two_row .even {
|
123 |
-
background: none;
|
124 |
-
}
|
125 |
-
.gsurvey-likert-choice-label {
|
126 |
-
padding: 4px;
|
127 |
-
}
|
128 |
-
.gsurvey-likert-choice {
|
129 |
-
text-align: center;
|
130 |
-
}
|
131 |
-
|
132 |
-
/* FINISHED REQUIRED CSS */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/default-template-no-style.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
global $gfpdf;
|
11 |
-
|
12 |
-
$config_data = $gfpdf->get_default_config_data($form_id);
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Load the form data to pass to our PDF generating function
|
16 |
-
*/
|
17 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
18 |
-
|
19 |
-
?>
|
20 |
-
|
21 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
22 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
23 |
-
<html>
|
24 |
-
<head>
|
25 |
-
<link rel="stylesheet" href="<?php echo GFCommon::get_base_url(); ?>/css/print.css" type="text/css" />
|
26 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
27 |
-
<title>Gravity PDF</title>
|
28 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
29 |
-
</head>
|
30 |
-
<body>
|
31 |
-
<div class="no-style">
|
32 |
-
<?php
|
33 |
-
/*
|
34 |
-
* Loop through the entries
|
35 |
-
* There is usually only one but you can pass more IDs through the lid URL parameter
|
36 |
-
*/
|
37 |
-
foreach($lead_ids as $lead_id) {
|
38 |
-
/* load the lead information */
|
39 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
40 |
-
|
41 |
-
/* generate the entry HTML */
|
42 |
-
GFPDFEntryDetail::lead_detail_grid($form, $lead, $config_data['empty_field'], $config_data['html_field'], $config_data['page_names']);
|
43 |
-
}
|
44 |
-
?>
|
45 |
-
</div>
|
46 |
-
</body>
|
47 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/default-template-two-rows.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
global $gfpdf;
|
11 |
-
|
12 |
-
$config_data = $gfpdf->get_default_config_data($form_id);
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Load the form data to pass to our PDF generating function
|
16 |
-
*/
|
17 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
18 |
-
|
19 |
-
?>
|
20 |
-
|
21 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
22 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
23 |
-
<html>
|
24 |
-
<head>
|
25 |
-
<link rel="stylesheet" href="<?php echo GFCommon::get_base_url(); ?>/css/print.css" type="text/css" />
|
26 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
27 |
-
<title>Gravity PDF</title>
|
28 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
29 |
-
</head>
|
30 |
-
<body>
|
31 |
-
<div class="two_row">
|
32 |
-
<?php
|
33 |
-
/*
|
34 |
-
* Loop through the entries
|
35 |
-
* There is usually only one but you can pass more IDs through the lid URL parameter
|
36 |
-
*/
|
37 |
-
foreach($lead_ids as $lead_id) {
|
38 |
-
/* load the lead information */
|
39 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
40 |
-
|
41 |
-
/* generate the entry HTML */
|
42 |
-
GFPDFEntryDetail::lead_detail_grid($form, $lead, $config_data['empty_field'], $config_data['html_field'], $config_data['page_names']);
|
43 |
-
}
|
44 |
-
?>
|
45 |
-
</div>
|
46 |
-
</body>
|
47 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/default-template.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
global $gfpdf;
|
11 |
-
|
12 |
-
$config_data = $gfpdf->get_default_config_data($form_id);
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Load the form data to pass to our PDF generating function
|
16 |
-
*/
|
17 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
18 |
-
|
19 |
-
?>
|
20 |
-
|
21 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
22 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
23 |
-
<html>
|
24 |
-
<head>
|
25 |
-
<link rel="stylesheet" href="<?php echo GFCommon::get_base_url(); ?>/css/print.css" type="text/css" />
|
26 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
27 |
-
<title>Gravity PDF</title>
|
28 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
29 |
-
</head>
|
30 |
-
<body>
|
31 |
-
<?php
|
32 |
-
/*
|
33 |
-
* Loop through the entries
|
34 |
-
* There is usually only one but you can pass more IDs through the lid URL parameter
|
35 |
-
*/
|
36 |
-
foreach($lead_ids as $lead_id) {
|
37 |
-
/* load the lead information */
|
38 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
39 |
-
|
40 |
-
/* generate the entry HTML */
|
41 |
-
GFPDFEntryDetail::lead_detail_grid($form, $lead, $config_data['empty_field'], $config_data['html_field'], $config_data['page_names']);
|
42 |
-
}
|
43 |
-
?>
|
44 |
-
</body>
|
45 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-advanced-headers_07.php
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
</head>
|
31 |
-
<body>
|
32 |
-
<?php
|
33 |
-
|
34 |
-
foreach($lead_ids as $lead_id) {
|
35 |
-
|
36 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
37 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
38 |
-
|
39 |
-
/*
|
40 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
41 |
-
*/
|
42 |
-
PDF_Common::view_data($form_data);
|
43 |
-
|
44 |
-
/*
|
45 |
-
* Store your form fields from the $form_data array into variables here
|
46 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
47 |
-
*
|
48 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
49 |
-
*
|
50 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
51 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
52 |
-
*
|
53 |
-
*/
|
54 |
-
|
55 |
-
?>
|
56 |
-
|
57 |
-
<!-- defines the headers/footers - this must occur before the headers/footers are set -->
|
58 |
-
|
59 |
-
<htmlpageheader name="myHTMLHeader1">
|
60 |
-
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
|
61 |
-
<td width="50%">First header p <span style="font-size:14pt;">{PAGENO}</span></td>
|
62 |
-
<td width="50%" style="text-align: right;"><span style="font-weight: bold;">myHTMLHeader1</span></td>
|
63 |
-
</tr></table>
|
64 |
-
</htmlpageheader>
|
65 |
-
|
66 |
-
<htmlpageheader name="myHTMLHeader2">
|
67 |
-
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
|
68 |
-
<td width="50%">Second header p <span style="font-size:14pt;">{PAGENO}</span></td>
|
69 |
-
<td width="50%" style="text-align: right;"><span style="font-weight: bold;">myHTMLHeader2</span></td>
|
70 |
-
</tr></table>
|
71 |
-
</htmlpageheader>
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
<!-- set the headers/footers - they will occur from here on in the document -->
|
76 |
-
|
77 |
-
<sethtmlpageheader name="myHTMLHeader1" value="on" show-this-page="1" />
|
78 |
-
|
79 |
-
|
80 |
-
<div>
|
81 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>/resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
82 |
-
<h2>Advanced Headers</h2>
|
83 |
-
|
84 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
85 |
-
<pagebreak />
|
86 |
-
|
87 |
-
<h2>Advanced Headers</h2>
|
88 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
89 |
-
|
90 |
-
<!-- Note the html_ prefix when referencing an HTML header using one of the pagebreaks -->
|
91 |
-
<pagebreak />
|
92 |
-
|
93 |
-
<sethtmlpageheader name="myHTMLHeader2" value="on" show-this-page="1" />
|
94 |
-
|
95 |
-
<h2>Advanced Headers</h2>
|
96 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
97 |
-
</div>
|
98 |
-
|
99 |
-
<?php
|
100 |
-
/*
|
101 |
-
* For more detail see mPDF documentation
|
102 |
-
* <sethtmlpageheader> : http://mpdf1.com/manual/index.php?tid=179
|
103 |
-
* <sethtmlpagefooter> : http://mpdf1.com/manual/index.php?tid=180
|
104 |
-
* <pagebreak> : http://mpdf1.com/manual/index.php?tid=110
|
105 |
-
*/
|
106 |
-
?>
|
107 |
-
|
108 |
-
<?php } ?>
|
109 |
-
</body>
|
110 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-backgrounds-and-borders02.php
DELETED
@@ -1,164 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
|
31 |
-
<style>
|
32 |
-
|
33 |
-
body {
|
34 |
-
background: linear-gradient(bottom, #0b91c2, #FFFFFF 65%);
|
35 |
-
}
|
36 |
-
.gradient {
|
37 |
-
border:0.1mm solid #220044;
|
38 |
-
background: #f0f2ff linear-gradient(top, #e1e1e1 65%, #c7c7c7);
|
39 |
-
}
|
40 |
-
.radialgradient {
|
41 |
-
border:0.1mm solid #220044;
|
42 |
-
background: #f0f2ff radial-gradient(center circle, #00FFFF, #FFFF00)
|
43 |
-
margin: auto;
|
44 |
-
}
|
45 |
-
.rounded {
|
46 |
-
border:0.1mm solid #220044;
|
47 |
-
background: #f0f2ff linear-gradient(top, #c7cdde 65%, #f0f2ff);
|
48 |
-
border-radius: 2mm;
|
49 |
-
background-clip: border-box;
|
50 |
-
}
|
51 |
-
h4 {
|
52 |
-
font-family: sans;
|
53 |
-
font-weight: bold;
|
54 |
-
margin-top: 1em;
|
55 |
-
margin-bottom: 0.5em;
|
56 |
-
}
|
57 |
-
div {
|
58 |
-
padding:1em;
|
59 |
-
margin-bottom: 1em;
|
60 |
-
text-align:left;
|
61 |
-
}
|
62 |
-
.example pre {
|
63 |
-
background-color: #d5d5d5;
|
64 |
-
margin: 1em 1cm;
|
65 |
-
padding: 0 0.3cm;
|
66 |
-
}
|
67 |
-
|
68 |
-
pre { text-align:left }
|
69 |
-
pre.code { font-family: monospace }
|
70 |
-
|
71 |
-
</style>
|
72 |
-
</head>
|
73 |
-
<body>
|
74 |
-
|
75 |
-
<?php
|
76 |
-
|
77 |
-
foreach($lead_ids as $lead_id) {
|
78 |
-
|
79 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
80 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
81 |
-
|
82 |
-
/*
|
83 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
84 |
-
*/
|
85 |
-
PDF_Common::view_data($form_data);
|
86 |
-
|
87 |
-
/*
|
88 |
-
* Store your form fields from the $form_data array into variables here
|
89 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
90 |
-
*
|
91 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
92 |
-
*
|
93 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
94 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
95 |
-
*
|
96 |
-
*/
|
97 |
-
|
98 |
-
?>
|
99 |
-
|
100 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>/resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
101 |
-
|
102 |
-
<h1>Backgrounds & Borders</h1>
|
103 |
-
<div style="border:0.1mm solid #220044; padding:1em 2em; background-color:#ffffcc; ">
|
104 |
-
<h4>Page background</h4>
|
105 |
-
<div class="gradient">
|
106 |
-
The background colour can be set by CSS styles on the <body> tag. This will set the background for the whole page. In this document, the background has been set as a gradient (see below).
|
107 |
-
</div>
|
108 |
-
<h4>Background Gradients</h4>
|
109 |
-
<div class="gradient">
|
110 |
-
Background can be set as a linear or radial gradient between two colours. The background has been set on this <div> element to a linear gradient. CSS style used here is:<br />
|
111 |
-
<span style="font-family: mono; font-size: 9pt;">background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;</span><br />
|
112 |
-
The four numbers are coordinates in the form (x1, y1, x2, y2) which defines the gradient vector. x and y are values from 0 to 1, where 1 represents the height or width of the box as it is printed.
|
113 |
-
<br />
|
114 |
-
<br />
|
115 |
-
Background gradients can be set on all block elements e.g. P, DIV, H1-H6, as well as on BODY.
|
116 |
-
</div>
|
117 |
-
<div class="radialgradient">
|
118 |
-
The background has been set on this <div> element to a radial gradient. CSS style used here is:<br />
|
119 |
-
<span style="font-family: mono; font-size: 9pt;">background-gradient: radial #00FFFF #FFFF00 0.5 0.5 0.5 0.5 0.65;</span><br />
|
120 |
-
The five numbers are coordinates in the form (x1, y1, x2, y2, r) where (x1, y1) is the starting point of the gradient with color1,
|
121 |
-
(x2, y2) is the center of the circle with color2, and r is the radius of the circle.
|
122 |
-
(x1, y1) should be inside the circle, otherwise some areas will not be defined.
|
123 |
-
<br />
|
124 |
-
<br />
|
125 |
-
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec mattis lacus ac purus feugiat semper. Donec aliquet nunc odio, vitae pellentesque diam. Pellentesque sed velit lacus. Duis quis dui quis sem consectetur sollicitudin. Cras dolor quam, dapibus et pretium sit amet, elementum vel arcu. Duis rhoncus facilisis erat nec mattis. In hac habitasse platea dictumst. Vivamus hendrerit sem in justo aliquet a pellentesque lorem scelerisque. Suspendisse a augue sed urna rhoncus elementum. Aliquam erat volutpat.
|
126 |
-
</div>
|
127 |
-
<h4>Background Images</h4>
|
128 |
-
<div style="border:0.1mm solid #880000; background: transparent url(<?php echo PDF_PLUGIN_DIR; ?>resources/images/bg.jpg) repeat fixed right top; background-color:#ccffff; ">
|
129 |
-
The CSS properties background-image, background-position, and background-repeat are supported as defined in CSS2, as well as the shorthand form "background".
|
130 |
-
<br />
|
131 |
-
The background has been set on this <div> element to:<br />
|
132 |
-
<span style="font-family: mono; font-size: 9pt;">background: transparent url(\'bg.jpg\') repeat fixed right top;</span><br />
|
133 |
-
Background gradients can be set on all block elements e.g. P, DIV, H1-H6, as well as on BODY.
|
134 |
-
</div>
|
135 |
-
<h4>Rounded Borders</h4>
|
136 |
-
<div class="rounded">
|
137 |
-
Rounded corners to borders can be added using border-radius as defined in the draft spec. of <a href="http://www.w3.org/TR/2008/WD-css3-background-20080910/#layering">CSS3</a>. <br />
|
138 |
-
The two length values of the border-*-radius properties define the radii of a quarter ellipse that defines the shape of the corner of the outer border edge.
|
139 |
-
The first value is the horizontal radius. <br />
|
140 |
-
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 55pt 25pt;</span> 55pt is radius of curve from top end of left border starting to go round to the top.<br />
|
141 |
-
If the second length is omitted it is equal to the first (and the corner is thus a quarter circle). If either length is zero, the corner is square, not rounded.<br />
|
142 |
-
The border-radius shorthand sets all four border-*-radius properties. If values are given before and after a slash, then the values before the slash set the horizontal radius and the values after the slash set the vertical radius. If there is no slash, then the values set both radii equally. The four values for each radii are given in the order top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted it is the same as top-right. If bottom-right is omitted it is the same as top-left. If top-right is omitted it is the same as top-left.
|
143 |
-
</div>
|
144 |
-
<div class="rounded">
|
145 |
-
<span style="font-family: mono; font-size: 9pt;">border-radius: 4em;</span><br />
|
146 |
-
would be equivalent to<br />
|
147 |
-
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 4em;<br />
|
148 |
-
border-top-right-radius: 4em;<br />
|
149 |
-
border-bottom-right-radius: 4em;<br />
|
150 |
-
border-bottom-left-radius: 4em;</span><br />
|
151 |
-
<br />
|
152 |
-
and<br />
|
153 |
-
<span style="font-family: mono; font-size: 9pt;">border-radius: 2em 1em 4em / 0.5em 3em;</span><br />
|
154 |
-
would be equivalent to<br />
|
155 |
-
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 2em 0.5em;<br />
|
156 |
-
border-top-right-radius: 1em 3em;<br />
|
157 |
-
border-bottom-right-radius: 4em 0.5em;<br />
|
158 |
-
border-bottom-left-radius: 1em 3em;</span>
|
159 |
-
</div>
|
160 |
-
</div>
|
161 |
-
|
162 |
-
<?php } ?>
|
163 |
-
</body>
|
164 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-basic-html01.php
DELETED
@@ -1,157 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
</head>
|
31 |
-
<body>
|
32 |
-
|
33 |
-
<?php
|
34 |
-
|
35 |
-
foreach($lead_ids as $lead_id) {
|
36 |
-
|
37 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
38 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
39 |
-
|
40 |
-
/*
|
41 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
42 |
-
*/
|
43 |
-
PDF_Common::view_data($form_data);
|
44 |
-
|
45 |
-
/*
|
46 |
-
* Store your form fields from the $form_data array into variables here
|
47 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
48 |
-
*
|
49 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
50 |
-
*
|
51 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
52 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
53 |
-
*
|
54 |
-
*/
|
55 |
-
|
56 |
-
?>
|
57 |
-
|
58 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
59 |
-
<h2>Basic HTML Example</h2>
|
60 |
-
This file demonstrates most of the HTML elements.
|
61 |
-
<h3>Heading 3</h3>
|
62 |
-
<h4>Heading 4</h4>
|
63 |
-
<h5>Heading 5</h5>
|
64 |
-
<h6>Heading 6</h6>
|
65 |
-
<p>P: Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
66 |
-
<hr />
|
67 |
-
<div><img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.wmf" style="float:right;">DIV: Proin aliquet lorem id felis. Curabitur vel libero at mauris nonummy tincidunt. Donec imperdiet. Vestibulum sem sem, lacinia vel, molestie et, laoreet eget, urna. Curabitur viverra faucibus pede. Morbi lobortis. Donec dapibus. Donec tempus. Ut arcu enim, rhoncus ac, venenatis eu, porttitor mollis, dui. Sed vitae risus. In elementum sem placerat dui. Nam tristique eros in nisl. Nulla cursus sapien non quam porta porttitor. Quisque dictum ipsum ornare tortor. Fusce ornare tempus enim. </div>
|
68 |
-
<div><img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/klematis.jpg" style="opacity: 0.5; float: left;" />DIV: Proin aliquet lorem id felis. Curabitur vel libero at mauris nonummy tincidunt. Donec imperdiet. Vestibulum sem sem, lacinia vel, molestie et, laoreet eget, urna. Curabitur viverra faucibus pede. Morbi lobortis. Donec dapibus. Donec tempus. Ut arcu enim, rhoncus ac, venenatis eu, porttitor mollis, dui. Sed vitae risus. In elementum sem placerat dui. Nam tristique eros in nisl. Nulla cursus sapien non quam porta porttitor. Quisque dictum ipsum ornare tortor. Fusce ornare tempus enim. </div>
|
69 |
-
<blockquote>Blockquote: Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus. Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus.</blockquote>
|
70 |
-
<address>Address: Vestibulum feugiat, orci at imperdiet tincidunt, mauris erat facilisis urna, sagittis ultricies dui nisl et lectus. Sed lacinia, lectus vitae dictum sodales, elit ipsum ultrices orci, non euismod arcu diam non metus.</address>
|
71 |
-
<pre>PRE: Cum sociis natoque penatibus et magnis dis parturient montes,
|
72 |
-
nascetur ridiculus mus. In suscipit turpis vitae odio. Integer convallis
|
73 |
-
dui at metus. Fusce magna. Sed sed lectus vitae enim tempor cursus. Cras
|
74 |
-
sed, posuere et, urna. Quisque ut leo. Aliquam interdum hendrerit tortor.
|
75 |
-
Vestibulum elit. Vestibulum et arcu at diam mattis commodo. Nam ipsum sem,
|
76 |
-
ultricies at, rutrum sit amet, posuere nec, velit. Sed molestie mollis dui.</pre>
|
77 |
-
<div><a href="#top">Hyperlink (<a>)</a></div>
|
78 |
-
<div><a href="https://gravitypdf.com">Hyperlink (<a>)</a></div>
|
79 |
-
<div>Styles - <tt>tt(teletype)</tt> <i>italic</i> <b>bold</b> <big>big</big> <small>small</small> <em>emphasis</em> <strong>strong</strong> <br />new lines<br>
|
80 |
-
<code>code</code> <samp>sample</samp> <kbd>keyboard</kbd> <var>variable</var> <cite>citation</cite> <abbr>abbr.</abbr> <acronym>ACRONYM</acronym> <sup>sup</sup> <sub>sub</sub> <strike>strike</strike> <s>strike-s</s> <u>underline</u> <del>delete</del> <ins>insert</ins> <q>To be or not to be</q> <font face="sans-serif" color="#880000" size="5">font changing face, size and color</font>
|
81 |
-
</div>
|
82 |
-
<p style="font-size:15pt; color:#440066">Paragraph using the in-line style to determine the font-size (15pt) and colour</p>
|
83 |
-
<h3>Testing BIG, SMALL, UNDERLINE, STRIKETHROUGH, FONT color, ACRONYM, SUPERSCRIPT and SUBSCRIPT</h3>
|
84 |
-
<p>This is <s>strikethrough</s> in <b><s>block</s></b> and <small>small <s>strikethrough</s> in <i>small span</i></small> and <big>big <s>strikethrough</s> in big span</big> and then <u>underline and <s>strikethrough and <sup>sup</sup></s></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</p>
|
85 |
-
<p>This is a <font color="#008800">green reference<sup>32-47</sup></font> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> then <s>Strikethrough reference<sup>32-47</sup></s> and <s>strikethrough reference<sub>32-47</sub></s></p>
|
86 |
-
<p><big>Repeated in <u>BIG</u>: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</big></p>
|
87 |
-
<p><small>Repeated in small: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</small></p>
|
88 |
-
<p>The above repeated, but starting with a paragraph with font-size specified (7pt)</p>
|
89 |
-
<p style="font-size:7pt;">This is <s>strikethrough</s> in block and <small>small <s>strikethrough</s> in small span</small> and then <u>underline</u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</p>
|
90 |
-
<p style="font-size:7pt;">This is <s>strikethrough</s> in block and <big>big <s>strikethrough</s> in big span</big> and then <u>underline</u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</p>
|
91 |
-
<p style="font-size:7pt;">This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> then <s>Strikethrough reference<sup>32-47</sup></s> and <s>strikethrough reference<sub>32-47</sub></s></p>
|
92 |
-
<p><small>This tests <u>underline</u> and <s>strikethrough</s> when they are <s><u>used together</u></s> as they both use text-decoration</small></p>
|
93 |
-
<p><small>Repeated in small: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</small></p>
|
94 |
-
<p style="font-size:7pt;"><big>Repeated in BIG but with font-size set to 7pt by in-line css: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</big></p>
|
95 |
-
<ol>
|
96 |
-
<li>Item <b><u>1</u></b></li>
|
97 |
-
<li>Item 2<sup>32</sup></li>
|
98 |
-
<li><small>Item</small> 3</li>
|
99 |
-
<li>
|
100 |
-
Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
101 |
-
<ul>
|
102 |
-
<li>Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. </li>
|
103 |
-
<li>
|
104 |
-
Subitem 2
|
105 |
-
<ul>
|
106 |
-
<li>
|
107 |
-
Level 3 subitem
|
108 |
-
</li>
|
109 |
-
</ul>
|
110 |
-
</li>
|
111 |
-
</ul>
|
112 |
-
</li>
|
113 |
-
<li>Item 5</li>
|
114 |
-
</ol>
|
115 |
-
<dl>
|
116 |
-
<dt>Definition list</dt>
|
117 |
-
<dd>List defined by DL, DD and DT tags</dd>
|
118 |
-
</dl>
|
119 |
-
<p>Sed bibendum. Nunc eleifend ornare velit. Sed consectetuer urna in erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Mauris sodales semper metus. Maecenas justo libero, pretium at, malesuada eu, mollis et, arcu. Ut suscipit pede in nulla. Praesent elementum, dolor ac fringilla posuere, elit libero rutrum massa, vel tincidunt dui tellus a ante. Sed aliquet euismod dolor. Vestibulum sed dui. Duis lobortis hendrerit quam. Donec tempus orci ut libero. Pellentesque suscipit malesuada nisi. </p>
|
120 |
-
<table border="1">
|
121 |
-
<thead>
|
122 |
-
<tr>
|
123 |
-
<th>Data</th>
|
124 |
-
<td>Data</td>
|
125 |
-
<td>Data</td>
|
126 |
-
<td>Data<br />2nd line</td>
|
127 |
-
</tr>
|
128 |
-
</thead>
|
129 |
-
<tbody>
|
130 |
-
<tr>
|
131 |
-
<th>More Data</th>
|
132 |
-
<td>More Data</td>
|
133 |
-
<td>More Data</td>
|
134 |
-
<td>Data<br />2nd line</td>
|
135 |
-
</tr>
|
136 |
-
<tr>
|
137 |
-
<th>Data</th>
|
138 |
-
<td>Data</td>
|
139 |
-
<td>Data</td>
|
140 |
-
<td>Data<br />2nd line</td>
|
141 |
-
</tr>
|
142 |
-
<tr>
|
143 |
-
<th>Data</th>
|
144 |
-
<td>Data</td>
|
145 |
-
<td>Data</td>
|
146 |
-
<td>Data<br />2nd line</td>
|
147 |
-
</tr>
|
148 |
-
</tbody>
|
149 |
-
</table>
|
150 |
-
<p>Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Cras tellus. Fusce aliquet. Curabitur tincidunt viverra ligula. Fusce eget erat. Donec pede. Vestibulum id felis. Phasellus tincidunt ligula non pede. Morbi turpis. In vitae dui non erat placerat malesuada. Mauris adipiscing congue ante. Proin at erat. Aliquam mattis. </p>
|
151 |
-
|
152 |
-
<?php
|
153 |
-
}
|
154 |
-
|
155 |
-
?>
|
156 |
-
</body>
|
157 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-different-page-size_08.php
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
</head>
|
31 |
-
<body>
|
32 |
-
<?php
|
33 |
-
|
34 |
-
foreach($lead_ids as $lead_id) {
|
35 |
-
|
36 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
37 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
38 |
-
|
39 |
-
/*
|
40 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
41 |
-
*/
|
42 |
-
PDF_Common::view_data($form_data);
|
43 |
-
|
44 |
-
/*
|
45 |
-
* Store your form fields from the $form_data array into variables here
|
46 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
47 |
-
*
|
48 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
49 |
-
*
|
50 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
51 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
52 |
-
*
|
53 |
-
*/
|
54 |
-
|
55 |
-
?>
|
56 |
-
|
57 |
-
<?php
|
58 |
-
/*
|
59 |
-
* The initial page size is set using the 'page_size' configuration option
|
60 |
-
* The default is A4 Portrait
|
61 |
-
* See Configuration page for more details on page_size : https://developer.gravitypdf.com/documentation/configuration-options-examples/
|
62 |
-
*/
|
63 |
-
?>
|
64 |
-
|
65 |
-
<p>This should print on an A4 (portrait) sheet</p>
|
66 |
-
|
67 |
-
<!-- using pagebreak we can set the next page's size. In this case, it's A4 landscape -->
|
68 |
-
<pagebreak sheet-size="A4-L" />
|
69 |
-
<p>This page appears after the A4 portrait sheet and should print on an A4 (landscape) sheet</p>
|
70 |
-
<h1>mPDF Page Sizes</h1>
|
71 |
-
<h3>Changing page (sheet) sizes within the document</h3>
|
72 |
-
|
73 |
-
<!-- change next page to A5 landscape -->
|
74 |
-
<pagebreak sheet-size="A5-L" />
|
75 |
-
|
76 |
-
<p>This should print on an A5 (landscape) sheet</p>
|
77 |
-
<h1>mPDF Page Sizes</h1>
|
78 |
-
<h3>Changing page (sheet) sizes within the document</h3>
|
79 |
-
|
80 |
-
<?php } ?>
|
81 |
-
</body>
|
82 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-float-and-positioning05.php
DELETED
@@ -1,157 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
<style>
|
31 |
-
.gradient {
|
32 |
-
border:0.1mm solid #220044;
|
33 |
-
background-color: #f0f2ff;
|
34 |
-
background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
|
35 |
-
}
|
36 |
-
h4 {
|
37 |
-
font-family: sans;
|
38 |
-
font-weight: bold;
|
39 |
-
margin-top: 1em;
|
40 |
-
margin-bottom: 0.5em;
|
41 |
-
}
|
42 |
-
div {
|
43 |
-
padding:1em;
|
44 |
-
margin-bottom: 1em;
|
45 |
-
text-align:justify;
|
46 |
-
}
|
47 |
-
.myfixed1 {
|
48 |
-
position: absolute;
|
49 |
-
overflow: visible;
|
50 |
-
left: 0;
|
51 |
-
bottom: 0;
|
52 |
-
border: 1px solid #880000;
|
53 |
-
background-color: #FFEEDD;
|
54 |
-
background-gradient: linear #dec7cd #fff0f2 0 1 0 0.5;
|
55 |
-
padding: 1.5em;
|
56 |
-
font-family:sans;
|
57 |
-
margin: 0;
|
58 |
-
}
|
59 |
-
.myfixed2 {
|
60 |
-
position: fixed;
|
61 |
-
overflow: auto;
|
62 |
-
right: 0;
|
63 |
-
bottom: 0mm;
|
64 |
-
width: 65mm;
|
65 |
-
border: 1px solid #880000;
|
66 |
-
background-color: #FFEEDD;
|
67 |
-
background-gradient: linear #dec7cd #fff0f2 0 1 0 0.5;
|
68 |
-
padding: 0.5em;
|
69 |
-
font-family:sans;
|
70 |
-
margin: 0;
|
71 |
-
rotate: 90;
|
72 |
-
}
|
73 |
-
</style>
|
74 |
-
|
75 |
-
|
76 |
-
</head>
|
77 |
-
<body>
|
78 |
-
<?php
|
79 |
-
|
80 |
-
foreach($lead_ids as $lead_id) {
|
81 |
-
|
82 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
83 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
84 |
-
|
85 |
-
/*
|
86 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
87 |
-
*/
|
88 |
-
PDF_Common::view_data($form_data);
|
89 |
-
|
90 |
-
/*
|
91 |
-
* Store your form fields from the $form_data array into variables here
|
92 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
93 |
-
*
|
94 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
95 |
-
*
|
96 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
97 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
98 |
-
*
|
99 |
-
*/
|
100 |
-
|
101 |
-
?>
|
102 |
-
|
103 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
104 |
-
|
105 |
-
<h2>Floating & Fixed Position elements</h2>
|
106 |
-
<h4>CSS "Float"</h4>
|
107 |
-
<div class="gradient">
|
108 |
-
Block elements can be positioned alongside each other using the CSS property float: left or right. The clear property can also be used, set as left|right|both. Float is only supported on block elements (i.e. not SPAN etc.) and is not fully compliant with the CSS specification.
|
109 |
-
Float only works properly if a width is set for the float, otherwise the width is set to the maximum available (full width, or less if floats already set).
|
110 |
-
<br />
|
111 |
-
Margin-right can still be set for a float:right and vice-versa.
|
112 |
-
<br />
|
113 |
-
A block element next to a float has the padding adjusted so that content fits in the remaining width. Text next to a float should wrap correctly, but backgrounds and borders will overlap and/or lie under the floats in a mess.
|
114 |
-
<br />
|
115 |
-
NB The width that is set defines the width of the content-box. So if you have two floats with width=50% and either of them has padding, margin or border, they will not fit together on the page.
|
116 |
-
</div>
|
117 |
-
<div class="gradient" style="float: right; width: 28%; margin-bottom: 0pt; ">
|
118 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.wmf" style="float:right" width="70" />This is text in a <div> element that is set to float:right and width:28%. It also has an image with float:right inside. With this exception, you cannot nest elements with the float property set inside one another.
|
119 |
-
</div>
|
120 |
-
<div class="gradient" style="float: left; width: 54%; margin-bottom: 0pt; ">
|
121 |
-
This is text in a <div> element that is set to float:left and width:54%.
|
122 |
-
</div>
|
123 |
-
<div style="clear: both; margin: 0pt; padding: 0pt; "></div>
|
124 |
-
This is text that follows a <div> element that is set to clear:both.
|
125 |
-
<h4>CSS "Position"</h4>
|
126 |
-
At the bottom of the page are two DIV elements with position:fixed and position:absolute set
|
127 |
-
<div class="myfixed1">1 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.</div>
|
128 |
-
<div class="myfixed2">2 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.</div>
|
129 |
-
<pagebreak />
|
130 |
-
<div style="float: left; width: 29%; background: green">
|
131 |
-
These are all floated left. 1 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
132 |
-
</div>
|
133 |
-
<div style="float: left; width: 29%; background: grey">
|
134 |
-
2 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
135 |
-
</div>
|
136 |
-
<div style="float: left; width: 29%; background: black; color: white;">
|
137 |
-
3 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
138 |
-
</div>
|
139 |
-
<div style="clear: both">
|
140 |
-
<div style="float: left; width: 20%; background: #EEE;">
|
141 |
-
Floated left with a width of 20%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
142 |
-
</div>
|
143 |
-
<div style="float: right; width: 30%; background: #222222; color: #FFF">
|
144 |
-
Floated right with a width of 30%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
145 |
-
</div>
|
146 |
-
</div>
|
147 |
-
<pagebreak />
|
148 |
-
<div style="float: left; width: 20%; background: #EEE;">
|
149 |
-
Floated left with a width of 20%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
150 |
-
</div>
|
151 |
-
<div style="margin-left: 25%">
|
152 |
-
By default this element will be positioned inline with the float. The start of the element should be inline with the top of the float. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
153 |
-
</div>
|
154 |
-
|
155 |
-
<?php } ?>
|
156 |
-
</body>
|
157 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-header-and-footer_06.php
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
|
31 |
-
<?php
|
32 |
-
/*
|
33 |
-
* Using the @page method we can set the headers and footers
|
34 |
-
* This method is more reliable that the <sethtmlpageheaders> method
|
35 |
-
* See mPDF documentation for more details
|
36 |
-
* http://mpdf1.com/manual/index.php?tid=307&searchstring=@page
|
37 |
-
*/
|
38 |
-
?>
|
39 |
-
<style>
|
40 |
-
@page {
|
41 |
-
header: html_myHTMLHeader1;
|
42 |
-
footer: html_myFooter1;
|
43 |
-
}
|
44 |
-
</style>
|
45 |
-
</head>
|
46 |
-
<body>
|
47 |
-
<?php
|
48 |
-
|
49 |
-
foreach($lead_ids as $lead_id) {
|
50 |
-
|
51 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
52 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
53 |
-
|
54 |
-
/*
|
55 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
56 |
-
*/
|
57 |
-
PDF_Common::view_data($form_data);
|
58 |
-
|
59 |
-
/*
|
60 |
-
* Store your form fields from the $form_data array into variables here
|
61 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
62 |
-
*
|
63 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
64 |
-
*
|
65 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
66 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
67 |
-
*
|
68 |
-
*/
|
69 |
-
|
70 |
-
?>
|
71 |
-
|
72 |
-
<!-- Defines the headers/footers -->
|
73 |
-
<!-- Headers and footers set with CSS @page method above -->
|
74 |
-
|
75 |
-
<htmlpageheader name="myHTMLHeader1">
|
76 |
-
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
|
77 |
-
<td width="50%">Main Header p <span style="font-size:14pt;">{PAGENO}</span></td>
|
78 |
-
<td width="50%" style="text-align: right;"><span style="font-weight: bold;">myHTMLHeader1</span></td>
|
79 |
-
</tr></table>
|
80 |
-
</htmlpageheader>
|
81 |
-
|
82 |
-
<htmlpagefooter name="myFooter1">
|
83 |
-
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt;
|
84 |
-
color: #000000; font-weight: bold; font-style: italic;"><tr>
|
85 |
-
<td width="33%"><span style="font-weight: bold; font-style: italic;">{DATE j-m-Y}</span></td>
|
86 |
-
<td width="33%" align="center" style="font-weight: bold; font-style: italic;">{PAGENO}/{nbpg}</td>
|
87 |
-
<td width="33%" style="text-align: right; ">My document</td>
|
88 |
-
</tr></table>
|
89 |
-
</htmlpagefooter>
|
90 |
-
|
91 |
-
<div>
|
92 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
93 |
-
<h2>Basic Headers</h2>
|
94 |
-
|
95 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
96 |
-
<pagebreak />
|
97 |
-
|
98 |
-
<h2>Basic Headers</h2>
|
99 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
100 |
-
|
101 |
-
<pagebreak />
|
102 |
-
|
103 |
-
<h2>Basic Headers</h2>
|
104 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
105 |
-
</div>
|
106 |
-
|
107 |
-
<?php } ?>
|
108 |
-
</body>
|
109 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-images03.php
DELETED
@@ -1,240 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
|
31 |
-
<style>
|
32 |
-
table { border-collapse: collapse; margin-top: 0; text-align: center; }
|
33 |
-
td { padding: 0.5em; }
|
34 |
-
h1 { margin-bottom: 0; }
|
35 |
-
</style>
|
36 |
-
</head>
|
37 |
-
<body>
|
38 |
-
<?php
|
39 |
-
|
40 |
-
foreach($lead_ids as $lead_id) {
|
41 |
-
|
42 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
43 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
44 |
-
|
45 |
-
/*
|
46 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
47 |
-
*/
|
48 |
-
PDF_Common::view_data($form_data);
|
49 |
-
|
50 |
-
/*
|
51 |
-
* Store your form fields from the $form_data array into variables here
|
52 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
53 |
-
*
|
54 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
55 |
-
*
|
56 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
57 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
58 |
-
*
|
59 |
-
*/
|
60 |
-
|
61 |
-
?>
|
62 |
-
|
63 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>/resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
64 |
-
|
65 |
-
<h1>mPDF Images</h1>
|
66 |
-
<table>
|
67 |
-
<tr>
|
68 |
-
<td>GIF</td>
|
69 |
-
<td>JPG</td>
|
70 |
-
<td>JPG (CMYK)</td>
|
71 |
-
<td>PNG</td>
|
72 |
-
<td>BMP</td>
|
73 |
-
<td>WMF</td>
|
74 |
-
<td>SVG</td>
|
75 |
-
</tr>
|
76 |
-
<tr>
|
77 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.gif" width="80" /></td>
|
78 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.jpg" width="80" /></td>
|
79 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tigercmyk.jpg" width="80" /></td>
|
80 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.png" width="80" /></td>
|
81 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.bmp" width="80" /></td>
|
82 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" width="80" /></td>
|
83 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="80" /></td>
|
84 |
-
</tr>
|
85 |
-
</tr>
|
86 |
-
<tr>
|
87 |
-
<td colspan="7" style="text-align: left" >
|
88 |
-
<h4>Opacity 50%</h4>
|
89 |
-
</td>
|
90 |
-
</tr>
|
91 |
-
<tr>
|
92 |
-
<tr>
|
93 |
-
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.gif" width="80" /></td>
|
94 |
-
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.jpg" width="80" /></td>
|
95 |
-
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tigercmyk.jpg" width="80" /></td>
|
96 |
-
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.png" width="80" /></td>
|
97 |
-
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.bmp" width="80" /></td>
|
98 |
-
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" width="80" /></td>
|
99 |
-
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="80" /></td>
|
100 |
-
</tr>
|
101 |
-
</table>
|
102 |
-
<h4>Alpha channel</h4>
|
103 |
-
<table>
|
104 |
-
<tr>
|
105 |
-
<td>PNG</td>
|
106 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/alpha.png" width="85" /></td>
|
107 |
-
<td style="background-color:#FFCCFF; "><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/alpha.png" width="85" /></td>
|
108 |
-
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/alpha.png" width="85" /></td>
|
109 |
-
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/alpha.png" width="85" /></td>
|
110 |
-
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>resources/images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/alpha.png" width="85" /></td>
|
111 |
-
</tr>
|
112 |
-
</table>
|
113 |
-
<h4>Transparency</h4>
|
114 |
-
<table>
|
115 |
-
<tr>
|
116 |
-
<td>PNG</td>
|
117 |
-
<td style="background-color:#FFCCFF; "><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger24trns.png" width="85" /></td>
|
118 |
-
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger24trns.png" width="85" /></td>
|
119 |
-
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger24trns.png" width="85" /></td>
|
120 |
-
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>resources/images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger24trns.png" width="85" /></td>
|
121 |
-
</tr>
|
122 |
-
<tr>
|
123 |
-
<td>GIF</td>
|
124 |
-
<td style="background-color:#FFCCFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger8trns.gif" width="85" /></td>
|
125 |
-
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger8trns.gif" width="85" /></td>
|
126 |
-
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger8trns.gif" width="85" /></td>
|
127 |
-
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>resources/images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger8trns.gif" width="85" /></td>
|
128 |
-
</tr>
|
129 |
-
<tr>
|
130 |
-
<td>WMF</td>
|
131 |
-
<td style="background-color:#FFCCFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" width="85" /></td>
|
132 |
-
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" width="85" /></td>
|
133 |
-
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" width="85" /></td>
|
134 |
-
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>resources/images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" width="85" /></td>
|
135 |
-
</tr>
|
136 |
-
<tr>
|
137 |
-
<td>SVG</td>
|
138 |
-
<td style="background-color:#FFCCFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="85" /></td>
|
139 |
-
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="85" /></td>
|
140 |
-
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="85" /></td>
|
141 |
-
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>resources/images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="85" /></td>
|
142 |
-
</tr>
|
143 |
-
</table>
|
144 |
-
Images returned from tiger.php
|
145 |
-
<div>
|
146 |
-
GIF <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.gif" width="85" />
|
147 |
-
JPG <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.jpg" width="85" />
|
148 |
-
PNG <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.png" width="85" />
|
149 |
-
WMF <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.wmf" width="85" />
|
150 |
-
SVG <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="85" />
|
151 |
-
</div>
|
152 |
-
<pagebreak />
|
153 |
-
<h3>Image Alignment</h3>
|
154 |
-
<div>From mPDF version 4.2 onwards, in-line images can be individually aligned (vertically). Most of the values for "vertical-align" are supported: top, bottom, middle, baseline, text-top, and text-bottom. The default value for vertical alignment has been changed to baseline, and the default padding to 0, consistent with most browsers.
|
155 |
-
</div>
|
156 |
-
<br />
|
157 |
-
<div style="background-color:#CCFFFF;">
|
158 |
-
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img1.png" style="vertical-align: top;" />
|
159 |
-
are <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img2.png" style="vertical-align: top;" />
|
160 |
-
<b>top</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img3.png" style="vertical-align: top;" />
|
161 |
-
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img4.png" style="vertical-align: middle;" />
|
162 |
-
</div>
|
163 |
-
<br />
|
164 |
-
<div style="background-color:#CCFFFF;">
|
165 |
-
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img1.png" style="vertical-align: text-top;" />
|
166 |
-
are <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img2.png" style="vertical-align: text-top;" />
|
167 |
-
<b>text-top</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img3.png" style="vertical-align: text-top;" />
|
168 |
-
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img4.png" style="vertical-align: middle;" />
|
169 |
-
</div>
|
170 |
-
<br />
|
171 |
-
<div style="background-color:#CCFFFF;">
|
172 |
-
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img1.png" style="vertical-align: bottom;" />
|
173 |
-
are <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img2.png" style="vertical-align: bottom;" />
|
174 |
-
<b>bottom</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img3.png" style="vertical-align: bottom;" />
|
175 |
-
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img4.png" style="vertical-align: middle;" />
|
176 |
-
</div>
|
177 |
-
<br />
|
178 |
-
<div style="background-color:#CCFFFF;">
|
179 |
-
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img1.png" style="vertical-align: text-bottom;" />
|
180 |
-
are <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img2.png" style="vertical-align: text-bottom;" />
|
181 |
-
<b>text-bottom</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img3.png" style="vertical-align: text-bottom;" />
|
182 |
-
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img4.png" style="vertical-align: middle;" />
|
183 |
-
</div>
|
184 |
-
<br />
|
185 |
-
<div style="background-color:#CCFFFF;">
|
186 |
-
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img1.png" style="vertical-align: baseline;" />
|
187 |
-
are <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img2.png" style="vertical-align: baseline;" />
|
188 |
-
<b>baseline</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img3.png" style="vertical-align: baseline;" />
|
189 |
-
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img4.png" style="vertical-align: middle;" />
|
190 |
-
</div>
|
191 |
-
<br />
|
192 |
-
<div style="background-color:#CCFFFF;">
|
193 |
-
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img1.png" style="vertical-align: middle;" />
|
194 |
-
are <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img2.png" style="vertical-align: middle;" />
|
195 |
-
<b>middle</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img3.png" style="vertical-align: middle;" />
|
196 |
-
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/img5.png" style="vertical-align: bottom;" />
|
197 |
-
</div>
|
198 |
-
<br />
|
199 |
-
<h4>Mixed alignment</h4>
|
200 |
-
<div style="background-color:#CCFFFF;">
|
201 |
-
baseline: <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/sunset.jpg" width="50" style="vertical-align: baseline;" />
|
202 |
-
text-bottom: <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/sunset.jpg" width="30" style="vertical-align: text-bottom;" />
|
203 |
-
middle: <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/sunset.jpg" width="30" style="vertical-align: middle;" />
|
204 |
-
bottom: <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/sunset.jpg" width="80" style="vertical-align: bottom;" />
|
205 |
-
text-top: <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/sunset.jpg" width="50" style="vertical-align: text-top;" />
|
206 |
-
top: <img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/sunset.jpg" width="100" style="vertical-align: top;" />
|
207 |
-
</div>
|
208 |
-
<h3>Image Border and padding</h3>
|
209 |
-
From mPDF v4.2, Image padding is supported as well as border and margin.
|
210 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/sunset.jpg" width="100" style="border:3px solid #44FF44; padding: 1em;" />
|
211 |
-
|
212 |
-
<h3>Rotated Images</h3>
|
213 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.png" width="100" />
|
214 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.png" rotate="90" width="100" />
|
215 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.png" rotate="180" width="100" />
|
216 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.png" rotate="-90" width="100" />
|
217 |
-
<br />
|
218 |
-
|
219 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.jpg" width="100" />
|
220 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.jpg" rotate="90" width="100" />
|
221 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.jpg" rotate="180" width="100" />
|
222 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.jpg" rotate="-90" width="100" />
|
223 |
-
<br />
|
224 |
-
|
225 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" width="80" />
|
226 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" rotate="90" width="80" />
|
227 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" rotate="180" width="80" />
|
228 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger2.wmf" rotate="-90" width="80" />
|
229 |
-
<br />
|
230 |
-
|
231 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" width="100" />
|
232 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" rotate="90" width="85" />
|
233 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" rotate="180" width="100" />
|
234 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/tiger.svg" rotate="-90" width="85" />
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
<?php } ?>
|
239 |
-
</body>
|
240 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-tables04.php
DELETED
@@ -1,1732 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
|
31 |
-
<style>
|
32 |
-
|
33 |
-
body {
|
34 |
-
font-family: DejaVuSansCondensed;
|
35 |
-
font-size: 11pt;
|
36 |
-
}
|
37 |
-
|
38 |
-
p {
|
39 |
-
margin-bottom: 4pt;
|
40 |
-
margin-top: 0pt;
|
41 |
-
}
|
42 |
-
|
43 |
-
table {
|
44 |
-
font-family: DejaVuSansCondensed;
|
45 |
-
font-size: 9pt;
|
46 |
-
line-height: 1.2;
|
47 |
-
margin-top: 2pt;
|
48 |
-
margin-bottom: 5pt;
|
49 |
-
border-collapse: collapse;
|
50 |
-
}
|
51 |
-
|
52 |
-
thead {
|
53 |
-
font-weight: bold;
|
54 |
-
vertical-align: bottom;
|
55 |
-
}
|
56 |
-
|
57 |
-
tfoot {
|
58 |
-
font-weight: bold;
|
59 |
-
vertical-align: top;
|
60 |
-
}
|
61 |
-
|
62 |
-
thead td {
|
63 |
-
font-weight: bold;
|
64 |
-
}
|
65 |
-
|
66 |
-
tfoot td {
|
67 |
-
font-weight: bold;
|
68 |
-
}
|
69 |
-
|
70 |
-
thead td, thead th, tfoot td, tfoot th {
|
71 |
-
font-variant: small-caps;
|
72 |
-
}
|
73 |
-
|
74 |
-
.headerrow td, .headerrow th {
|
75 |
-
background-gradient: linear #b7cebd #f5f8f5 0 1 0 0.2;
|
76 |
-
}
|
77 |
-
|
78 |
-
.footerrow td, .footerrow th {
|
79 |
-
background-gradient: linear #b7cebd #f5f8f5 0 1 0 0.2;
|
80 |
-
}
|
81 |
-
|
82 |
-
th {
|
83 |
-
font-weight: bold;
|
84 |
-
vertical-align: top;
|
85 |
-
text-align: left;
|
86 |
-
padding-left: 2mm;
|
87 |
-
padding-right: 2mm;
|
88 |
-
padding-top: 0.5mm;
|
89 |
-
padding-bottom: 0.5mm;
|
90 |
-
}
|
91 |
-
|
92 |
-
td {
|
93 |
-
padding-left: 2mm;
|
94 |
-
vertical-align: top;
|
95 |
-
text-align: left;
|
96 |
-
padding-right: 2mm;
|
97 |
-
padding-top: 0.5mm;
|
98 |
-
padding-bottom: 0.5mm;
|
99 |
-
}
|
100 |
-
|
101 |
-
th p {
|
102 |
-
text-align: left;
|
103 |
-
margin: 0pt;
|
104 |
-
}
|
105 |
-
|
106 |
-
td p {
|
107 |
-
text-align: left;
|
108 |
-
margin: 0pt;
|
109 |
-
}
|
110 |
-
|
111 |
-
table.widecells td {
|
112 |
-
padding-left: 5mm;
|
113 |
-
padding-right: 5mm;
|
114 |
-
}
|
115 |
-
|
116 |
-
table.tallcells td {
|
117 |
-
padding-top: 3mm;
|
118 |
-
padding-bottom: 3mm;
|
119 |
-
}
|
120 |
-
|
121 |
-
hr {
|
122 |
-
width: 70%;
|
123 |
-
height: 1px;
|
124 |
-
text-align: center;
|
125 |
-
color: #999999;
|
126 |
-
margin-top: 8pt;
|
127 |
-
margin-bottom: 8pt;
|
128 |
-
}
|
129 |
-
|
130 |
-
a {
|
131 |
-
color: #000066;
|
132 |
-
font-style: normal;
|
133 |
-
text-decoration: underline;
|
134 |
-
font-weight: normal;
|
135 |
-
}
|
136 |
-
|
137 |
-
ul {
|
138 |
-
text-indent: 5mm;
|
139 |
-
margin-bottom: 9pt;
|
140 |
-
}
|
141 |
-
|
142 |
-
ol {
|
143 |
-
text-indent: 5mm;
|
144 |
-
margin-bottom: 9pt;
|
145 |
-
}
|
146 |
-
|
147 |
-
pre {
|
148 |
-
font-family: DejaVuSansMono;
|
149 |
-
font-size: 9pt;
|
150 |
-
margin-top: 5pt;
|
151 |
-
margin-bottom: 5pt;
|
152 |
-
}
|
153 |
-
|
154 |
-
h1 {
|
155 |
-
font-weight: normal;
|
156 |
-
font-size: 26pt;
|
157 |
-
color: #000066;
|
158 |
-
font-family: DejaVuSansCondensed;
|
159 |
-
margin-top: 18pt;
|
160 |
-
margin-bottom: 6pt;
|
161 |
-
border-top: 0.075cm solid #000000;
|
162 |
-
border-bottom: 0.075cm solid #000000;
|
163 |
-
text-align: ; page-break-after:avoid;
|
164 |
-
}
|
165 |
-
|
166 |
-
h2 {
|
167 |
-
font-weight: bold;
|
168 |
-
font-size: 12pt;
|
169 |
-
color: #000066;
|
170 |
-
font-family: DejaVuSansCondensed;
|
171 |
-
margin-top: 6pt;
|
172 |
-
margin-bottom: 6pt;
|
173 |
-
border-top: 0.07cm solid #000000;
|
174 |
-
border-bottom: 0.07cm solid #000000;
|
175 |
-
text-align: ; text-transform:uppercase;
|
176 |
-
page-break-after: avoid;
|
177 |
-
}
|
178 |
-
|
179 |
-
h3 {
|
180 |
-
font-weight: normal;
|
181 |
-
font-size: 26pt;
|
182 |
-
color: #000000;
|
183 |
-
font-family: DejaVuSansCondensed;
|
184 |
-
margin-top: 0pt;
|
185 |
-
margin-bottom: 6pt;
|
186 |
-
border-top: 0;
|
187 |
-
border-bottom: 0;
|
188 |
-
text-align: ; page-break-after:avoid;
|
189 |
-
}
|
190 |
-
|
191 |
-
h4 {
|
192 |
-
font-weight: ; font-size: 13pt;
|
193 |
-
color: #9f2b1e;
|
194 |
-
font-family: DejaVuSansCondensed;
|
195 |
-
margin-top: 10pt;
|
196 |
-
margin-bottom: 7pt;
|
197 |
-
font-variant: small-caps;
|
198 |
-
text-align: ; margin-collapse:collapse;
|
199 |
-
page-break-after: avoid;
|
200 |
-
}
|
201 |
-
|
202 |
-
h5 {
|
203 |
-
font-weight: bold;
|
204 |
-
font-style: italic;
|
205 |
-
; font-size: 11pt;
|
206 |
-
color: #000044;
|
207 |
-
font-family: DejaVuSansCondensed;
|
208 |
-
margin-top: 8pt;
|
209 |
-
margin-bottom: 4pt;
|
210 |
-
text-align: ; page-break-after:avoid;
|
211 |
-
}
|
212 |
-
|
213 |
-
h6 {
|
214 |
-
font-weight: bold;
|
215 |
-
font-size: 9.5pt;
|
216 |
-
color: #333333;
|
217 |
-
font-family: DejaVuSansCondensed;
|
218 |
-
margin-top: 6pt;
|
219 |
-
margin-bottom: ;
|
220 |
-
text-align:;
|
221 |
-
page-break-after: avoid;
|
222 |
-
}
|
223 |
-
|
224 |
-
.breadcrumb {
|
225 |
-
text-align: right;
|
226 |
-
font-size: 8pt;
|
227 |
-
font-family: DejaVuSerifCondensed;
|
228 |
-
color: #666666;
|
229 |
-
font-weight: bold;
|
230 |
-
font-style: normal;
|
231 |
-
margin-bottom: 6pt;
|
232 |
-
}
|
233 |
-
|
234 |
-
.evenrow td, .evenrow th {
|
235 |
-
background-color: #f5f8f5;
|
236 |
-
}
|
237 |
-
|
238 |
-
.oddrow td, .oddrow th {
|
239 |
-
background-color: #e3ece4;
|
240 |
-
}
|
241 |
-
|
242 |
-
.bpmTopic {
|
243 |
-
background-color: #e3ece4;
|
244 |
-
}
|
245 |
-
|
246 |
-
.bpmTopicC {
|
247 |
-
background-color: #e3ece4;
|
248 |
-
}
|
249 |
-
|
250 |
-
.bpmNoLines {
|
251 |
-
background-color: #e3ece4;
|
252 |
-
}
|
253 |
-
|
254 |
-
.bpmNoLinesC {
|
255 |
-
background-color: #e3ece4;
|
256 |
-
}
|
257 |
-
|
258 |
-
.bpmClear {
|
259 |
-
}
|
260 |
-
|
261 |
-
.bpmClearC {
|
262 |
-
text-align: center;
|
263 |
-
}
|
264 |
-
|
265 |
-
.bpmTopnTail {
|
266 |
-
background-color: #e3ece4;
|
267 |
-
topntail: 0.02cm solid #495b4a;
|
268 |
-
}
|
269 |
-
|
270 |
-
.bpmTopnTailC {
|
271 |
-
background-color: #e3ece4;
|
272 |
-
topntail: 0.02cm solid #495b4a;
|
273 |
-
}
|
274 |
-
|
275 |
-
.bpmTopnTailClear {
|
276 |
-
topntail: 0.02cm solid #495b4a;
|
277 |
-
}
|
278 |
-
|
279 |
-
.bpmTopnTailClearC {
|
280 |
-
topntail: 0.02cm solid #495b4a;
|
281 |
-
}
|
282 |
-
|
283 |
-
.bpmTopicC td, .bpmTopicC td p {
|
284 |
-
text-align: center;
|
285 |
-
}
|
286 |
-
|
287 |
-
.bpmNoLinesC td, .bpmNoLinesC td p {
|
288 |
-
text-align: center;
|
289 |
-
}
|
290 |
-
|
291 |
-
.bpmClearC td, .bpmClearC td p {
|
292 |
-
text-align: center;
|
293 |
-
}
|
294 |
-
|
295 |
-
.bpmTopnTailC td, .bpmTopnTailC td p {
|
296 |
-
text-align: center;
|
297 |
-
}
|
298 |
-
|
299 |
-
.bpmTopnTailClearC td, .bpmTopnTailClearC td p {
|
300 |
-
text-align: center;
|
301 |
-
}
|
302 |
-
|
303 |
-
.pmhMiddleCenter {
|
304 |
-
text-align: center;
|
305 |
-
vertical-align: middle;
|
306 |
-
}
|
307 |
-
|
308 |
-
.pmhMiddleRight {
|
309 |
-
text-align: right;
|
310 |
-
vertical-align: middle;
|
311 |
-
}
|
312 |
-
|
313 |
-
.pmhBottomCenter {
|
314 |
-
text-align: center;
|
315 |
-
vertical-align: bottom;
|
316 |
-
}
|
317 |
-
|
318 |
-
.pmhBottomRight {
|
319 |
-
text-align: right;
|
320 |
-
vertical-align: bottom;
|
321 |
-
}
|
322 |
-
|
323 |
-
.pmhTopCenter {
|
324 |
-
text-align: center;
|
325 |
-
vertical-align: top;
|
326 |
-
}
|
327 |
-
|
328 |
-
.pmhTopRight {
|
329 |
-
text-align: right;
|
330 |
-
vertical-align: top;
|
331 |
-
}
|
332 |
-
|
333 |
-
.pmhTopLeft {
|
334 |
-
text-align: left;
|
335 |
-
vertical-align: top;
|
336 |
-
}
|
337 |
-
|
338 |
-
.pmhBottomLeft {
|
339 |
-
text-align: left;
|
340 |
-
vertical-align: bottom;
|
341 |
-
}
|
342 |
-
|
343 |
-
.pmhMiddleLeft {
|
344 |
-
text-align: left;
|
345 |
-
vertical-align: middle;
|
346 |
-
}
|
347 |
-
|
348 |
-
.infobox {
|
349 |
-
margin-top: 10pt;
|
350 |
-
background-color: #DDDDBB;
|
351 |
-
text-align: center;
|
352 |
-
border: 1px solid #880000;
|
353 |
-
}
|
354 |
-
|
355 |
-
.bpmTopic td, .bpmTopic th {
|
356 |
-
border-top: 1px solid #FFFFFF;
|
357 |
-
}
|
358 |
-
|
359 |
-
.bpmTopicC td, .bpmTopicC th {
|
360 |
-
border-top: 1px solid #FFFFFF;
|
361 |
-
}
|
362 |
-
|
363 |
-
.bpmTopnTail td, .bpmTopnTail th {
|
364 |
-
border-top: 1px solid #FFFFFF;
|
365 |
-
}
|
366 |
-
|
367 |
-
.bpmTopnTailC td, .bpmTopnTailC th {
|
368 |
-
border-top: 1px solid #FFFFFF;
|
369 |
-
}
|
370 |
-
</style>
|
371 |
-
</head>
|
372 |
-
<body>
|
373 |
-
<?php
|
374 |
-
|
375 |
-
foreach($lead_ids as $lead_id) {
|
376 |
-
|
377 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
378 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
379 |
-
|
380 |
-
/*
|
381 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
382 |
-
*/
|
383 |
-
PDF_Common::view_data($form_data);
|
384 |
-
|
385 |
-
/*
|
386 |
-
* Store your form fields from the $form_data array into variables here
|
387 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
388 |
-
*
|
389 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
390 |
-
*
|
391 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
392 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
393 |
-
*
|
394 |
-
*/
|
395 |
-
|
396 |
-
?>
|
397 |
-
|
398 |
-
|
399 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
400 |
-
|
401 |
-
<h1>mPDF</h1>
|
402 |
-
<h2>Tables</h2>
|
403 |
-
<h3>CSS Styles</h3>
|
404 |
-
<p>The CSS properties for tables and cells is increased over that in html2fpdf. It includes recognition of THEAD, TFOOT and TH.<br />See below for other facilities such as autosizing, and rotation.</p>
|
405 |
-
<table border="1">
|
406 |
-
<tbody>
|
407 |
-
<tr>
|
408 |
-
<td>Row 1</td>
|
409 |
-
<td>This is data</td>
|
410 |
-
<td>This is data</td>
|
411 |
-
</tr>
|
412 |
-
<tr>
|
413 |
-
<td>Row 2</td>
|
414 |
-
<td style="background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;">
|
415 |
-
<p>This is data p</p>
|
416 |
-
This is data out of p
|
417 |
-
<p style="font-weight:bold; font-size:20pt; background-color:#FFBBFF;">This is bold data p</p>
|
418 |
-
<b>This is bold data out of p</b><br />
|
419 |
-
This is normal data after br
|
420 |
-
<h3>H3 in a table</h3>
|
421 |
-
<div>This is data div</div>
|
422 |
-
This is data out of div
|
423 |
-
<div style="font-weight:bold;">This is data div (bold)</div>
|
424 |
-
This is data out of div
|
425 |
-
</td>
|
426 |
-
<td>
|
427 |
-
<p>More data</p>
|
428 |
-
<p style="font-size:12pt;">This is large text</p>
|
429 |
-
</td>
|
430 |
-
</tr>
|
431 |
-
<tr>
|
432 |
-
<td>
|
433 |
-
<p>Row 3</p>
|
434 |
-
</td>
|
435 |
-
<td>
|
436 |
-
<p>This is long data</p>
|
437 |
-
</td>
|
438 |
-
<td>This is data</td>
|
439 |
-
</tr>
|
440 |
-
<tr>
|
441 |
-
<td>
|
442 |
-
<p>Row 4 <td> cell</p>
|
443 |
-
</td>
|
444 |
-
<td>This is data</td>
|
445 |
-
<td>
|
446 |
-
<p>This is data</p>
|
447 |
-
</td>
|
448 |
-
</tr>
|
449 |
-
<tr>
|
450 |
-
<td>Row 5</td>
|
451 |
-
<td>Also data</td>
|
452 |
-
<td>Also data</td>
|
453 |
-
</tr>
|
454 |
-
<tr>
|
455 |
-
<td>Row 6</td>
|
456 |
-
<td>Also data</td>
|
457 |
-
<td>Also data</td>
|
458 |
-
</tr>
|
459 |
-
<tr>
|
460 |
-
<td>Row 7</td>
|
461 |
-
<td>Also data</td>
|
462 |
-
<td>Also data</td>
|
463 |
-
</tr>
|
464 |
-
<tr>
|
465 |
-
<td>Row 8</td>
|
466 |
-
<td>Also data</td>
|
467 |
-
<td>Also data</td>
|
468 |
-
</tr>
|
469 |
-
</tbody>
|
470 |
-
</table>
|
471 |
-
<p>This table has padding-left and -right set to 5mm i.e. padding within the cells. Also border colour and style, font family and size are set by <acronym>CSS</acronym>.</p>
|
472 |
-
<table align="right" style="border: 1px solid #880000; font-family: Mono; font-size: 7pt; " class="widecells">
|
473 |
-
<tbody>
|
474 |
-
<tr>
|
475 |
-
<td>Row 1</td>
|
476 |
-
<td>This is data</td>
|
477 |
-
<td>This is data</td>
|
478 |
-
</tr>
|
479 |
-
<tr>
|
480 |
-
<td>Row 2</td>
|
481 |
-
<td>
|
482 |
-
<p>This is data p</p>
|
483 |
-
</td>
|
484 |
-
<td>
|
485 |
-
<p>More data</p>
|
486 |
-
</td>
|
487 |
-
</tr>
|
488 |
-
<tr>
|
489 |
-
<td>
|
490 |
-
<p>Row 3</p>
|
491 |
-
</td>
|
492 |
-
<td>
|
493 |
-
<p>This is long data</p>
|
494 |
-
</td>
|
495 |
-
<td>This is data</td>
|
496 |
-
</tr>
|
497 |
-
<tr>
|
498 |
-
<td>
|
499 |
-
<p>Row 4 <td> cell</p>
|
500 |
-
</td>
|
501 |
-
<td>This is data</td>
|
502 |
-
<td>
|
503 |
-
<p>This is data</p>
|
504 |
-
</td>
|
505 |
-
</tr>
|
506 |
-
<tr>
|
507 |
-
<td>Row 5</td>
|
508 |
-
<td>Also data</td>
|
509 |
-
<td>Also data</td>
|
510 |
-
</tr>
|
511 |
-
<tr>
|
512 |
-
<td>Row 6</td>
|
513 |
-
<td>Also data</td>
|
514 |
-
<td>Also data</td>
|
515 |
-
</tr>
|
516 |
-
<tr>
|
517 |
-
<td>Row 7</td>
|
518 |
-
<td>Also data</td>
|
519 |
-
<td>Also data</td>
|
520 |
-
</tr>
|
521 |
-
<tr>
|
522 |
-
<td>Row 8</td>
|
523 |
-
<td>Also data</td>
|
524 |
-
<td>Also data</td>
|
525 |
-
</tr>
|
526 |
-
</tbody>
|
527 |
-
</table>
|
528 |
-
<p>This table has padding-top and -bottom set to 3mm i.e. padding within the cells. Also background-, border colour and style, font family and size are set by in-line <acronym>CSS</acronym>.</p>
|
529 |
-
<table style="border: 1px solid #880000; background-color: #BBCCDD; font-family: Mono; font-size: 7pt; " class="tallcells">
|
530 |
-
<tbody>
|
531 |
-
<tr>
|
532 |
-
<td>Row 1</td>
|
533 |
-
<td>This is data</td>
|
534 |
-
<td>This is data</td>
|
535 |
-
</tr>
|
536 |
-
<tr>
|
537 |
-
<td>Row 2</td>
|
538 |
-
<td>
|
539 |
-
<p>This is data p</p>
|
540 |
-
</td>
|
541 |
-
<td>
|
542 |
-
<p>More data</p>
|
543 |
-
</td>
|
544 |
-
</tr>
|
545 |
-
<tr>
|
546 |
-
<td>
|
547 |
-
<p>Row 3</p>
|
548 |
-
</td>
|
549 |
-
<td>
|
550 |
-
<p>This is long data</p>
|
551 |
-
</td>
|
552 |
-
<td>This is data</td>
|
553 |
-
</tr>
|
554 |
-
</tbody>
|
555 |
-
</table>
|
556 |
-
<h3 style="margin-top: 20pt; margin-collapse:collapse;">Table Styles</h3>
|
557 |
-
<p>The style sheet used for these examples shows some of the table styles I use on my website. The property 'topntail' defined by a border-type definition e.g. "1px solid #880000" puts a border at the top and bottom of the table, and also below a header row (thead) if defined. Note also that <thead> will automatically turn on the header-repeat i.e. reproduce the header row at the top of each page.</p>
|
558 |
-
<p>bpmTopic Class</p>
|
559 |
-
<table class="bpmTopic">
|
560 |
-
<thead></thead>
|
561 |
-
<tbody>
|
562 |
-
<tr>
|
563 |
-
<td>Row 1</td>
|
564 |
-
<td>This is data</td>
|
565 |
-
<td>This is data</td>
|
566 |
-
</tr>
|
567 |
-
<tr>
|
568 |
-
<td>Row 2</td>
|
569 |
-
<td>
|
570 |
-
<p>This is data p</p>
|
571 |
-
</td>
|
572 |
-
<td>
|
573 |
-
<p>More data</p>
|
574 |
-
</td>
|
575 |
-
</tr>
|
576 |
-
<tr>
|
577 |
-
<td>
|
578 |
-
<p>Row 3</p>
|
579 |
-
</td>
|
580 |
-
<td>
|
581 |
-
<p>This is long data</p>
|
582 |
-
</td>
|
583 |
-
<td>This is data</td>
|
584 |
-
</tr>
|
585 |
-
<tr>
|
586 |
-
<td>
|
587 |
-
<p>Row 4 <td> cell</p>
|
588 |
-
</td>
|
589 |
-
<td>This is data</td>
|
590 |
-
<td>
|
591 |
-
<p>This is data</p>
|
592 |
-
</td>
|
593 |
-
</tr>
|
594 |
-
<tr>
|
595 |
-
<td>Row 5</td>
|
596 |
-
<td>Also data</td>
|
597 |
-
<td>Also data</td>
|
598 |
-
</tr>
|
599 |
-
<tr>
|
600 |
-
<td>Row 6</td>
|
601 |
-
<td>Also data</td>
|
602 |
-
<td>Also data</td>
|
603 |
-
</tr>
|
604 |
-
<tr>
|
605 |
-
<td>Row 7</td>
|
606 |
-
<td>Also data</td>
|
607 |
-
<td>Also data</td>
|
608 |
-
</tr>
|
609 |
-
<tr>
|
610 |
-
<td>Row 8</td>
|
611 |
-
<td>Also data</td>
|
612 |
-
<td>Also data</td>
|
613 |
-
</tr>
|
614 |
-
</tbody>
|
615 |
-
</table>
|
616 |
-
<p> </p>
|
617 |
-
<p>bpmTopic<b>C</b> Class (centered) Odd and Even rows</p>
|
618 |
-
<table class="bpmTopicC">
|
619 |
-
<thead>
|
620 |
-
<tr class="headerrow">
|
621 |
-
<th>Col/Row Header</th>
|
622 |
-
<td>
|
623 |
-
<p>Second column header p</p>
|
624 |
-
</td>
|
625 |
-
<td>Third column header</td>
|
626 |
-
</tr>
|
627 |
-
</thead>
|
628 |
-
<tbody>
|
629 |
-
<tr class="oddrow">
|
630 |
-
<th>Row header 1</th>
|
631 |
-
<td>This is data</td>
|
632 |
-
<td>This is data</td>
|
633 |
-
</tr>
|
634 |
-
<tr class="evenrow">
|
635 |
-
<th>Row header 2</th>
|
636 |
-
<td>
|
637 |
-
<p>This is data p</p>
|
638 |
-
</td>
|
639 |
-
<td>
|
640 |
-
<p>This is data</p>
|
641 |
-
</td>
|
642 |
-
</tr>
|
643 |
-
<tr class="oddrow">
|
644 |
-
<th>
|
645 |
-
<p>Row header 3</p>
|
646 |
-
</th>
|
647 |
-
<td>
|
648 |
-
<p>This is long data</p>
|
649 |
-
</td>
|
650 |
-
<td>This is data</td>
|
651 |
-
</tr>
|
652 |
-
<tr class="evenrow">
|
653 |
-
<th>
|
654 |
-
<p>Row header 4</p>
|
655 |
-
<p><th> cell acting as header</p>
|
656 |
-
</th>
|
657 |
-
<td>This is data</td>
|
658 |
-
<td>
|
659 |
-
<p>This is data</p>
|
660 |
-
</td>
|
661 |
-
</tr>
|
662 |
-
<tr class="oddrow">
|
663 |
-
<th>Row header 5</th>
|
664 |
-
<td>Also data</td>
|
665 |
-
<td>Also data</td>
|
666 |
-
</tr>
|
667 |
-
<tr class="evenrow">
|
668 |
-
<th>Row header 6</th>
|
669 |
-
<td>Also data</td>
|
670 |
-
<td>Also data</td>
|
671 |
-
</tr>
|
672 |
-
<tr class="oddrow">
|
673 |
-
<th>Row header 7</th>
|
674 |
-
<td>Also data</td>
|
675 |
-
<td>Also data</td>
|
676 |
-
</tr>
|
677 |
-
<tr class="evenrow">
|
678 |
-
<th>Row header 8</th>
|
679 |
-
<td>Also data</td>
|
680 |
-
<td>Also data</td>
|
681 |
-
</tr>
|
682 |
-
</tbody>
|
683 |
-
</table>
|
684 |
-
<p> </p>
|
685 |
-
<p>bpmTopnTail Class </p>
|
686 |
-
<table class="bpmTopnTail">
|
687 |
-
<thead></thead>
|
688 |
-
<tbody>
|
689 |
-
<tr>
|
690 |
-
<td>Row 1</td>
|
691 |
-
<td>This is data</td>
|
692 |
-
<td>This is data</td>
|
693 |
-
</tr>
|
694 |
-
<tr>
|
695 |
-
<td>Row 2</td>
|
696 |
-
<td>
|
697 |
-
<p>This is data p</p>
|
698 |
-
</td>
|
699 |
-
<td>
|
700 |
-
<p>This is data</p>
|
701 |
-
</td>
|
702 |
-
</tr>
|
703 |
-
<tr>
|
704 |
-
<td>
|
705 |
-
<p>Row 3</p>
|
706 |
-
</td>
|
707 |
-
<td>
|
708 |
-
<p>This is long data</p>
|
709 |
-
</td>
|
710 |
-
<td>This is data</td>
|
711 |
-
</tr>
|
712 |
-
<tr>
|
713 |
-
<td>
|
714 |
-
<p>Row 4 <td> cell</p>
|
715 |
-
</td>
|
716 |
-
<td>This is data</td>
|
717 |
-
<td>
|
718 |
-
<p>This is data</p>
|
719 |
-
</td>
|
720 |
-
</tr>
|
721 |
-
<tr>
|
722 |
-
<td>Row 5</td>
|
723 |
-
<td>Also data</td>
|
724 |
-
<td>Also data</td>
|
725 |
-
</tr>
|
726 |
-
<tr>
|
727 |
-
<td>Row 6</td>
|
728 |
-
<td>Also data</td>
|
729 |
-
<td>Also data</td>
|
730 |
-
</tr>
|
731 |
-
<tr>
|
732 |
-
<td>Row 7</td>
|
733 |
-
<td>Also data</td>
|
734 |
-
<td>Also data</td>
|
735 |
-
</tr>
|
736 |
-
<tr>
|
737 |
-
<td>Row 8</td>
|
738 |
-
<td>Also data</td>
|
739 |
-
<td>Also data</td>
|
740 |
-
</tr>
|
741 |
-
</tbody>
|
742 |
-
</table>
|
743 |
-
<p> </p>
|
744 |
-
<p>bpmTopnTail<b>C</b> Class (centered) Odd and Even rows</p>
|
745 |
-
<table class="bpmTopnTailC">
|
746 |
-
<thead>
|
747 |
-
<tr class="headerrow">
|
748 |
-
<th>Col/Row Header</th>
|
749 |
-
<td>
|
750 |
-
<p>Second column header p</p>
|
751 |
-
</td>
|
752 |
-
<td>Third column header</td>
|
753 |
-
</tr>
|
754 |
-
</thead>
|
755 |
-
<tbody>
|
756 |
-
<tr class="oddrow">
|
757 |
-
<th>Row header 1</th>
|
758 |
-
<td>This is data</td>
|
759 |
-
<td>This is data</td>
|
760 |
-
</tr>
|
761 |
-
<tr class="evenrow">
|
762 |
-
<th>Row header 2</th>
|
763 |
-
<td>
|
764 |
-
<p>This is data p</p>
|
765 |
-
</td>
|
766 |
-
<td>
|
767 |
-
<p>This is data</p>
|
768 |
-
</td>
|
769 |
-
</tr>
|
770 |
-
<tr class="oddrow">
|
771 |
-
<th>
|
772 |
-
<p>Row header 3</p>
|
773 |
-
</th>
|
774 |
-
<td>
|
775 |
-
<p>This is long data</p>
|
776 |
-
</td>
|
777 |
-
<td>This is data</td>
|
778 |
-
</tr>
|
779 |
-
<tr class="evenrow">
|
780 |
-
<th>
|
781 |
-
<p>Row header 4</p>
|
782 |
-
<p><th> cell acting as header</p>
|
783 |
-
</th>
|
784 |
-
<td>This is data</td>
|
785 |
-
<td>
|
786 |
-
<p>This is data</p>
|
787 |
-
</td>
|
788 |
-
</tr>
|
789 |
-
<tr class="oddrow">
|
790 |
-
<th>Row header 5</th>
|
791 |
-
<td>Also data</td>
|
792 |
-
<td>Also data</td>
|
793 |
-
</tr>
|
794 |
-
<tr class="evenrow">
|
795 |
-
<th>Row header 6</th>
|
796 |
-
<td>Also data</td>
|
797 |
-
<td>Also data</td>
|
798 |
-
</tr>
|
799 |
-
<tr class="oddrow">
|
800 |
-
<th>Row header 7</th>
|
801 |
-
<td>Also data</td>
|
802 |
-
<td>Also data</td>
|
803 |
-
</tr>
|
804 |
-
<tr class="evenrow">
|
805 |
-
<th>Row header 8</th>
|
806 |
-
<td>Also data</td>
|
807 |
-
<td>Also data</td>
|
808 |
-
</tr>
|
809 |
-
</tbody>
|
810 |
-
</table>
|
811 |
-
<p> </p>
|
812 |
-
<p>TopnTail Class</p>
|
813 |
-
<table class="bpmTopnTail">
|
814 |
-
<thead>
|
815 |
-
<tr class="headerrow">
|
816 |
-
<th>Col and Row Header</th>
|
817 |
-
<td>
|
818 |
-
<p>Second</p>
|
819 |
-
<p>column</p>
|
820 |
-
</td>
|
821 |
-
<td class="pmhTopRight">Top right align</td>
|
822 |
-
</tr>
|
823 |
-
</thead>
|
824 |
-
<tbody>
|
825 |
-
<tr class="oddrow">
|
826 |
-
<th>
|
827 |
-
<p>Row header 1 p</p>
|
828 |
-
</th>
|
829 |
-
<td>This is data</td>
|
830 |
-
<td>This is data</td>
|
831 |
-
</tr>
|
832 |
-
<tr class="evenrow">
|
833 |
-
<th>Row header 2</th>
|
834 |
-
<td class="pmhBottomRight"><b><i>Bottom right align</i></b></td>
|
835 |
-
<td>
|
836 |
-
<p>This is data. Can use</p>
|
837 |
-
<p><b>bold</b> <i>italic </i><sub>sub</sub> or <sup>sup</sup> text</p>
|
838 |
-
</td>
|
839 |
-
</tr>
|
840 |
-
<tr class="oddrow">
|
841 |
-
<th class="pmhBottomRight">
|
842 |
-
<p>Bottom right align</p>
|
843 |
-
</th>
|
844 |
-
<td class="pmhMiddleCenter" style="border: #000000 1px solid">
|
845 |
-
<p>This is data. This cell</p>
|
846 |
-
<p>uses Cell Styles to set</p>
|
847 |
-
<p>the borders.</p>
|
848 |
-
<p>All borders are collapsible</p>
|
849 |
-
<p>in mPDF.</p>
|
850 |
-
</td>
|
851 |
-
<td>This is data</td>
|
852 |
-
</tr>
|
853 |
-
<tr class="evenrow">
|
854 |
-
<th>Row header 4</th>
|
855 |
-
<td>
|
856 |
-
<p>This is data p</p>
|
857 |
-
</td>
|
858 |
-
<td>More data</td>
|
859 |
-
</tr>
|
860 |
-
<tr class="oddrow">
|
861 |
-
<th>Row header 5</th>
|
862 |
-
<td colspan="2" class="pmhTopCenter">Also data merged and centered</td>
|
863 |
-
</tr>
|
864 |
-
</tbody>
|
865 |
-
</table>
|
866 |
-
<p> </p>
|
867 |
-
<h4>Lists in a Table</h4>
|
868 |
-
<table class="bpmTopnTail">
|
869 |
-
<thead>
|
870 |
-
<tr class="headerrow">
|
871 |
-
<th>Col and Row Header</th>
|
872 |
-
<td>
|
873 |
-
<p>Second</p>
|
874 |
-
<p>column</p>
|
875 |
-
</td>
|
876 |
-
<td class="pmhTopRight">Top right align</td>
|
877 |
-
</tr>
|
878 |
-
</thead>
|
879 |
-
<tbody>
|
880 |
-
<tr class="oddrow">
|
881 |
-
<th>
|
882 |
-
<p>Row header 1 p</p>
|
883 |
-
</th>
|
884 |
-
<td>This is data</td>
|
885 |
-
<td>This is data</td>
|
886 |
-
</tr>
|
887 |
-
<tr class="evenrow">
|
888 |
-
<th>Row header 2</th>
|
889 |
-
<td>
|
890 |
-
<ol>
|
891 |
-
<li>Item 1</li>
|
892 |
-
<li>
|
893 |
-
Item 2
|
894 |
-
<ol type="a">
|
895 |
-
<li>Subitem of ordered list</li>
|
896 |
-
<li>
|
897 |
-
Subitem 2
|
898 |
-
<ol type="i">
|
899 |
-
<li>Level 3 subitem</li>
|
900 |
-
<li>Level 3 subitem</li>
|
901 |
-
</ol>
|
902 |
-
</li>
|
903 |
-
</ol>
|
904 |
-
</li>
|
905 |
-
<li>Item 3</li>
|
906 |
-
<li>Another Item</li>
|
907 |
-
<li>
|
908 |
-
Subitem
|
909 |
-
<ol>
|
910 |
-
<li>Level 3 subitem</li>
|
911 |
-
</ol>
|
912 |
-
</li>
|
913 |
-
<li>Another Item</li>
|
914 |
-
</ol>
|
915 |
-
</td>
|
916 |
-
<td>
|
917 |
-
Unordered list:
|
918 |
-
<ul>
|
919 |
-
<li>Item 1</li>
|
920 |
-
<li>
|
921 |
-
Item 2
|
922 |
-
<ul>
|
923 |
-
<li>Subitem of unordered list</li>
|
924 |
-
<li>
|
925 |
-
Subitem 2
|
926 |
-
<ul>
|
927 |
-
<li>Level 3 subitem</li>
|
928 |
-
<li>Level 3 subitem</li>
|
929 |
-
<li>Level 3 subitem</li>
|
930 |
-
</ul>
|
931 |
-
</li>
|
932 |
-
</ul>
|
933 |
-
</li>
|
934 |
-
<li>Item 3</li>
|
935 |
-
</ul>
|
936 |
-
</td>
|
937 |
-
</tr>
|
938 |
-
</tbody>
|
939 |
-
</table>
|
940 |
-
<p> </p>
|
941 |
-
<h4>Automatic Column Width</h4>
|
942 |
-
<table class="bpmTopnTail">
|
943 |
-
<tbody>
|
944 |
-
<tr>
|
945 |
-
<td>Causes</td>
|
946 |
-
<td>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. <br />
|
947 |
-
Ut a eros at ligula vehicula pretium; maecenas feugiat pede vel risus.<br />
|
948 |
-
Suspendisse potenti
|
949 |
-
</td>
|
950 |
-
</tr>
|
951 |
-
<tr>
|
952 |
-
<td>Mechanisms</td>
|
953 |
-
<td>Ut magna ipsum, tempus in, condimentum at, rutrum et, nisl. Vestibulum interdum luctus sapien. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Maecenas consectetuer eros quis massa. Mauris semper velit vehicula purus. Duis lacus. Aenean pretium consectetuer mauris. Ut purus sem, consequat ut, fermentum sit amet, ornare sit amet, ipsum. Donec non nunc. Maecenas fringilla. Curabitur libero. In dui massa, malesuada sit amet, hendrerit vitae, viverra nec, tortor. Donec varius. Ut ut dolor et tellus adipiscing adipiscing.</td>
|
954 |
-
</tr>
|
955 |
-
</tbody>
|
956 |
-
</table>
|
957 |
-
<h4>ColSpan & Rowspan</h4>
|
958 |
-
<table class="bpmTopnTail">
|
959 |
-
<tbody>
|
960 |
-
<tr>
|
961 |
-
<td rowspan="2">Causes</td>
|
962 |
-
<td colspan="2">Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. <br />
|
963 |
-
Ut a eros at ligula vehicula pretium; maecenas feugiat pede vel risus.<br />
|
964 |
-
Suspendisse potenti
|
965 |
-
</td>
|
966 |
-
</tr>
|
967 |
-
<tr>
|
968 |
-
<td>Fusce eleifend neque sit amet erat.<br />
|
969 |
-
Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus.
|
970 |
-
</td>
|
971 |
-
<td>Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla.<br />
|
972 |
-
Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien.
|
973 |
-
</td>
|
974 |
-
</tr>
|
975 |
-
</tbody>
|
976 |
-
</table>
|
977 |
-
<h4>Table Header & Footer Rows</h4>
|
978 |
-
<p>A table using a header row should repeat the header row across pages:</p>
|
979 |
-
<p>bpmTopic<b>C</b> Class</p>
|
980 |
-
<table class="bpmTopicC">
|
981 |
-
<thead>
|
982 |
-
<tr class="headerrow">
|
983 |
-
<th>Col and Row Header</th>
|
984 |
-
<td>
|
985 |
-
<p>Second column header</p>
|
986 |
-
</td>
|
987 |
-
<td>Third column header</td>
|
988 |
-
</tr>
|
989 |
-
</thead>
|
990 |
-
<tfoot>
|
991 |
-
<tr class="footerrow">
|
992 |
-
<th>Col and Row Footer</th>
|
993 |
-
<td>
|
994 |
-
<p>Second column footer</p>
|
995 |
-
</td>
|
996 |
-
<td>Third column footer</td>
|
997 |
-
</tr>
|
998 |
-
</tfoot>
|
999 |
-
<tbody>
|
1000 |
-
<tr>
|
1001 |
-
<th>Row header 1</th>
|
1002 |
-
<td>This is data</td>
|
1003 |
-
<td>This is data</td>
|
1004 |
-
</tr>
|
1005 |
-
<tr>
|
1006 |
-
<th>Row header 2</th>
|
1007 |
-
<td>This is data</td>
|
1008 |
-
<td>
|
1009 |
-
<p>This is data</p>
|
1010 |
-
</td>
|
1011 |
-
</tr>
|
1012 |
-
<tr>
|
1013 |
-
<th>
|
1014 |
-
<p>Row header 3</p>
|
1015 |
-
</th>
|
1016 |
-
<td>
|
1017 |
-
<p>This is data</p>
|
1018 |
-
</td>
|
1019 |
-
<td>This is data</td>
|
1020 |
-
</tr>
|
1021 |
-
<tr>
|
1022 |
-
<th>Row header 4</th>
|
1023 |
-
<td>This is data</td>
|
1024 |
-
<td>
|
1025 |
-
<p>This is data</p>
|
1026 |
-
</td>
|
1027 |
-
</tr>
|
1028 |
-
<tr>
|
1029 |
-
<th>Row header 5</th>
|
1030 |
-
<td>Also data</td>
|
1031 |
-
<td>Also data</td>
|
1032 |
-
</tr>
|
1033 |
-
<tr>
|
1034 |
-
<th>Row header 6</th>
|
1035 |
-
<td>Also data</td>
|
1036 |
-
<td>Also data</td>
|
1037 |
-
</tr>
|
1038 |
-
<tr>
|
1039 |
-
<th>Row header 7</th>
|
1040 |
-
<td>Also data</td>
|
1041 |
-
<td>Also data</td>
|
1042 |
-
</tr>
|
1043 |
-
<tr>
|
1044 |
-
<th>Row header 8</th>
|
1045 |
-
<td>Also data</td>
|
1046 |
-
<td>Also data</td>
|
1047 |
-
</tr>
|
1048 |
-
<tr>
|
1049 |
-
<th>Row header 9</th>
|
1050 |
-
<td>Also data</td>
|
1051 |
-
<td>Also data</td>
|
1052 |
-
</tr>
|
1053 |
-
<tr>
|
1054 |
-
<th>Another Row header</th>
|
1055 |
-
<td>Also data</td>
|
1056 |
-
<td>Also data</td>
|
1057 |
-
</tr>
|
1058 |
-
<tr>
|
1059 |
-
<th>Another Row header</th>
|
1060 |
-
<td>Also data</td>
|
1061 |
-
<td>Also data</td>
|
1062 |
-
</tr>
|
1063 |
-
<tr>
|
1064 |
-
<th>Another Row header</th>
|
1065 |
-
<td>Also data</td>
|
1066 |
-
<td>Also data</td>
|
1067 |
-
</tr>
|
1068 |
-
<tr>
|
1069 |
-
<th>Another Row header</th>
|
1070 |
-
<td>Also data</td>
|
1071 |
-
<td>Also data</td>
|
1072 |
-
</tr>
|
1073 |
-
<tr>
|
1074 |
-
<th>Another Row header</th>
|
1075 |
-
<td>Also data</td>
|
1076 |
-
<td>Also data</td>
|
1077 |
-
</tr>
|
1078 |
-
<tr>
|
1079 |
-
<th>Another Row header</th>
|
1080 |
-
<td>Also data</td>
|
1081 |
-
<td>Also data</td>
|
1082 |
-
</tr>
|
1083 |
-
<tr>
|
1084 |
-
<th>Another Row header</th>
|
1085 |
-
<td>Also data</td>
|
1086 |
-
<td>Also data</td>
|
1087 |
-
</tr>
|
1088 |
-
<tr>
|
1089 |
-
<th>Another Row header</th>
|
1090 |
-
<td>Also data</td>
|
1091 |
-
<td>Also data</td>
|
1092 |
-
</tr>
|
1093 |
-
<tr>
|
1094 |
-
<th>Another Row header</th>
|
1095 |
-
<td>Also data</td>
|
1096 |
-
<td>Also data</td>
|
1097 |
-
</tr>
|
1098 |
-
<tr>
|
1099 |
-
<th>Another Row header</th>
|
1100 |
-
<td>Also data</td>
|
1101 |
-
<td>Also data</td>
|
1102 |
-
</tr>
|
1103 |
-
<tr>
|
1104 |
-
<th>Another Row header</th>
|
1105 |
-
<td>Also data</td>
|
1106 |
-
<td>Also data</td>
|
1107 |
-
</tr>
|
1108 |
-
<tr>
|
1109 |
-
<th>Another Row header</th>
|
1110 |
-
<td>Also data</td>
|
1111 |
-
<td>Also data</td>
|
1112 |
-
</tr>
|
1113 |
-
<tr>
|
1114 |
-
<th>Another Row header</th>
|
1115 |
-
<td>Also data</td>
|
1116 |
-
<td>Also data</td>
|
1117 |
-
</tr>
|
1118 |
-
<tr>
|
1119 |
-
<th>Another Row header</th>
|
1120 |
-
<td>Also data</td>
|
1121 |
-
<td>Also data</td>
|
1122 |
-
</tr>
|
1123 |
-
<tr>
|
1124 |
-
<th>Another Row header</th>
|
1125 |
-
<td>Also data</td>
|
1126 |
-
<td>Also data</td>
|
1127 |
-
</tr>
|
1128 |
-
<tr>
|
1129 |
-
<th>Another Row header</th>
|
1130 |
-
<td>Also data</td>
|
1131 |
-
<td>Also data</td>
|
1132 |
-
</tr>
|
1133 |
-
<tr>
|
1134 |
-
<th>Another Row header</th>
|
1135 |
-
<td>Also data</td>
|
1136 |
-
<td>Also data</td>
|
1137 |
-
</tr>
|
1138 |
-
<tr>
|
1139 |
-
<th>Another Row header</th>
|
1140 |
-
<td>Also data</td>
|
1141 |
-
<td>Also data</td>
|
1142 |
-
</tr>
|
1143 |
-
<tr>
|
1144 |
-
<th>Another Row header</th>
|
1145 |
-
<td>Also data</td>
|
1146 |
-
<td>Also data</td>
|
1147 |
-
</tr>
|
1148 |
-
<tr>
|
1149 |
-
<th>Another Row header</th>
|
1150 |
-
<td>Also data</td>
|
1151 |
-
<td>Also data</td>
|
1152 |
-
</tr>
|
1153 |
-
<tr>
|
1154 |
-
<th>Another Row header</th>
|
1155 |
-
<td>Also data</td>
|
1156 |
-
<td>Also data</td>
|
1157 |
-
</tr>
|
1158 |
-
<tr>
|
1159 |
-
<th>Another Row header</th>
|
1160 |
-
<td>Also data</td>
|
1161 |
-
<td>Also data</td>
|
1162 |
-
</tr>
|
1163 |
-
<tr>
|
1164 |
-
<th>Another Row header</th>
|
1165 |
-
<td>Also data</td>
|
1166 |
-
<td>Also data</td>
|
1167 |
-
</tr>
|
1168 |
-
<tr>
|
1169 |
-
<th>Another Row header</th>
|
1170 |
-
<td>Also data</td>
|
1171 |
-
<td>Also data</td>
|
1172 |
-
</tr>
|
1173 |
-
<tr>
|
1174 |
-
<th>Another Row header</th>
|
1175 |
-
<td>Also data</td>
|
1176 |
-
<td>Also data</td>
|
1177 |
-
</tr>
|
1178 |
-
<tr>
|
1179 |
-
<th>Another Row header</th>
|
1180 |
-
<td>Also data</td>
|
1181 |
-
<td>Also data</td>
|
1182 |
-
</tr>
|
1183 |
-
<tr>
|
1184 |
-
<th>Another Row header</th>
|
1185 |
-
<td>Also data</td>
|
1186 |
-
<td>Also data</td>
|
1187 |
-
</tr>
|
1188 |
-
<tr>
|
1189 |
-
<th>Another Row header</th>
|
1190 |
-
<td>Also data</td>
|
1191 |
-
<td>Also data</td>
|
1192 |
-
</tr>
|
1193 |
-
<tr>
|
1194 |
-
<th>Another Row header</th>
|
1195 |
-
<td>Also data</td>
|
1196 |
-
<td>Also data</td>
|
1197 |
-
</tr>
|
1198 |
-
<tr>
|
1199 |
-
<th>Another Row header</th>
|
1200 |
-
<td>Also data</td>
|
1201 |
-
<td>Also data</td>
|
1202 |
-
</tr>
|
1203 |
-
<tr>
|
1204 |
-
<th>Another Row header</th>
|
1205 |
-
<td>Also data</td>
|
1206 |
-
<td>Also data</td>
|
1207 |
-
</tr>
|
1208 |
-
<tr>
|
1209 |
-
<th>Another Row header</th>
|
1210 |
-
<td>Also data</td>
|
1211 |
-
<td>Also data</td>
|
1212 |
-
</tr>
|
1213 |
-
<tr>
|
1214 |
-
<th>Another Row header</th>
|
1215 |
-
<td>Also data</td>
|
1216 |
-
<td>Also data</td>
|
1217 |
-
</tr>
|
1218 |
-
<tr>
|
1219 |
-
<th>Another Row header</th>
|
1220 |
-
<td>Also data</td>
|
1221 |
-
<td>Also data</td>
|
1222 |
-
</tr>
|
1223 |
-
<tr>
|
1224 |
-
<th>Another Row header</th>
|
1225 |
-
<td>Also data</td>
|
1226 |
-
<td>Also data</td>
|
1227 |
-
</tr>
|
1228 |
-
</tbody>
|
1229 |
-
</table>
|
1230 |
-
<p> </p>
|
1231 |
-
<h3>Autosizing Tables</h3>
|
1232 |
-
<p>Periodic Table of elements. Tables are set by default to reduce font size if complete words will not fit inside each cell, to a maximum of 1/1.4 * the set font-size. This value can be changed by setting $mpdf->shrink_tables_to_fit=1.8 or using html attribute <table autosize="1.8">.</p>
|
1233 |
-
<h5>Periodic Table</h5>
|
1234 |
-
<table style="border:1px solid #000000;" cellPadding="9">
|
1235 |
-
<thead>
|
1236 |
-
<tr>
|
1237 |
-
<th>1A</th>
|
1238 |
-
<th>2A</th>
|
1239 |
-
<th>3B</th>
|
1240 |
-
<th>4B</th>
|
1241 |
-
<th>5B</th>
|
1242 |
-
<th>6B</th>
|
1243 |
-
<th>7B</th>
|
1244 |
-
<th>8B</th>
|
1245 |
-
<th>8B</th>
|
1246 |
-
<th>8B</th>
|
1247 |
-
<th>1B</th>
|
1248 |
-
<th>2B</th>
|
1249 |
-
<th>3A</th>
|
1250 |
-
<th>4A</th>
|
1251 |
-
<th>5A</th>
|
1252 |
-
<th>6A</th>
|
1253 |
-
<th>7A</th>
|
1254 |
-
<th>8A</th>
|
1255 |
-
</tr>
|
1256 |
-
</thead>
|
1257 |
-
<tbody>
|
1258 |
-
<tr>
|
1259 |
-
<td colspan="18"></td>
|
1260 |
-
</tr>
|
1261 |
-
<tr>
|
1262 |
-
<td>H </td>
|
1263 |
-
<td colspan="16"></td>
|
1264 |
-
<td>He </td>
|
1265 |
-
</tr>
|
1266 |
-
<tr>
|
1267 |
-
<td>Li </td>
|
1268 |
-
<td>Be </td>
|
1269 |
-
<td colspan="10"></td>
|
1270 |
-
<td>B </td>
|
1271 |
-
<td>C </td>
|
1272 |
-
<td>N </td>
|
1273 |
-
<td>O </td>
|
1274 |
-
<td>F </td>
|
1275 |
-
<td>Ne </td>
|
1276 |
-
</tr>
|
1277 |
-
<tr>
|
1278 |
-
<td>Na </td>
|
1279 |
-
<td>Mg </td>
|
1280 |
-
<td colspan="10"></td>
|
1281 |
-
<td>Al </td>
|
1282 |
-
<td>Si </td>
|
1283 |
-
<td>P </td>
|
1284 |
-
<td>S </td>
|
1285 |
-
<td>Cl </td>
|
1286 |
-
<td>Ar </td>
|
1287 |
-
</tr>
|
1288 |
-
<tr>
|
1289 |
-
<td>K </td>
|
1290 |
-
<td>Ca </td>
|
1291 |
-
<td>Sc </td>
|
1292 |
-
<td>Ti </td>
|
1293 |
-
<td>V </td>
|
1294 |
-
<td>Cr </td>
|
1295 |
-
<td>Mn </td>
|
1296 |
-
<td>Fe </td>
|
1297 |
-
<td>Co </td>
|
1298 |
-
<td>Ni </td>
|
1299 |
-
<td>Cu </td>
|
1300 |
-
<td>Zn </td>
|
1301 |
-
<td>Ga </td>
|
1302 |
-
<td>Ge </td>
|
1303 |
-
<td>As </td>
|
1304 |
-
<td>Se </td>
|
1305 |
-
<td>Br </td>
|
1306 |
-
<td>Kr </td>
|
1307 |
-
</tr>
|
1308 |
-
<tr>
|
1309 |
-
<td>Rb </td>
|
1310 |
-
<td>Sr </td>
|
1311 |
-
<td>Y </td>
|
1312 |
-
<td>Zr </td>
|
1313 |
-
<td>Nb </td>
|
1314 |
-
<td>Mo </td>
|
1315 |
-
<td>Tc </td>
|
1316 |
-
<td>Ru </td>
|
1317 |
-
<td>Rh </td>
|
1318 |
-
<td>Pd </td>
|
1319 |
-
<td>Ag </td>
|
1320 |
-
<td>Cd </td>
|
1321 |
-
<td>In </td>
|
1322 |
-
<td>Sn </td>
|
1323 |
-
<td>Sb </td>
|
1324 |
-
<td>Te </td>
|
1325 |
-
<td>I </td>
|
1326 |
-
<td>Xe </td>
|
1327 |
-
</tr>
|
1328 |
-
<tr>
|
1329 |
-
<td>Cs </td>
|
1330 |
-
<td>Ba </td>
|
1331 |
-
<td>La </td>
|
1332 |
-
<td>Hf </td>
|
1333 |
-
<td>Ta </td>
|
1334 |
-
<td>W </td>
|
1335 |
-
<td>Re </td>
|
1336 |
-
<td>Os </td>
|
1337 |
-
<td>Ir </td>
|
1338 |
-
<td>Pt </td>
|
1339 |
-
<td>Au </td>
|
1340 |
-
<td>Hg </td>
|
1341 |
-
<td>Tl </td>
|
1342 |
-
<td>Pb </td>
|
1343 |
-
<td>Bi </td>
|
1344 |
-
<td>Po </td>
|
1345 |
-
<td>At </td>
|
1346 |
-
<td>Rn </td>
|
1347 |
-
</tr>
|
1348 |
-
<tr>
|
1349 |
-
<td>Fr </td>
|
1350 |
-
<td>Ra </td>
|
1351 |
-
<td>Ac </td>
|
1352 |
-
<td colspan="15"></td>
|
1353 |
-
</tr>
|
1354 |
-
<tr>
|
1355 |
-
<td colspan="18"></td>
|
1356 |
-
</tr>
|
1357 |
-
<tr>
|
1358 |
-
<td colspan="3"></td>
|
1359 |
-
<td>Ce </td>
|
1360 |
-
<td>Pr </td>
|
1361 |
-
<td>Nd </td>
|
1362 |
-
<td>Pm </td>
|
1363 |
-
<td>Sm </td>
|
1364 |
-
<td>Eu </td>
|
1365 |
-
<td>Gd </td>
|
1366 |
-
<td>Tb </td>
|
1367 |
-
<td>Dy </td>
|
1368 |
-
<td>Ho </td>
|
1369 |
-
<td>Er </td>
|
1370 |
-
<td>Tm </td>
|
1371 |
-
<td>Yb </td>
|
1372 |
-
<td>Lu </td>
|
1373 |
-
<td></td>
|
1374 |
-
</tr>
|
1375 |
-
<tr>
|
1376 |
-
<td colspan="3"></td>
|
1377 |
-
<td>Th </td>
|
1378 |
-
<td>Pa </td>
|
1379 |
-
<td>U </td>
|
1380 |
-
<td>Np </td>
|
1381 |
-
<td>Pu </td>
|
1382 |
-
<td>Am </td>
|
1383 |
-
<td>Cm </td>
|
1384 |
-
<td>Bk </td>
|
1385 |
-
<td>Cf </td>
|
1386 |
-
<td>Es </td>
|
1387 |
-
<td>Fm </td>
|
1388 |
-
<td>Md </td>
|
1389 |
-
<td>No </td>
|
1390 |
-
<td>Lr </td>
|
1391 |
-
<td></td>
|
1392 |
-
</tr>
|
1393 |
-
</tbody>
|
1394 |
-
</table>
|
1395 |
-
<pagebreak />
|
1396 |
-
<h3>Rotating Tables</h3>
|
1397 |
-
<p>This is set to rotate -90 degrees (counterclockwise).</p>
|
1398 |
-
<h5>Periodic Table</h5>
|
1399 |
-
<p>
|
1400 |
-
<table rotate="-90" class="bpmClearC">
|
1401 |
-
<thead>
|
1402 |
-
<tr>
|
1403 |
-
<th>1A</th>
|
1404 |
-
<th>2A</th>
|
1405 |
-
<th>3B</th>
|
1406 |
-
<th>4B</th>
|
1407 |
-
<th>5B</th>
|
1408 |
-
<th>6B</th>
|
1409 |
-
<th>7B</th>
|
1410 |
-
<th>8B</th>
|
1411 |
-
<th>8B</th>
|
1412 |
-
<th>8B</th>
|
1413 |
-
<th>1B</th>
|
1414 |
-
<th>2B</th>
|
1415 |
-
<th>3A</th>
|
1416 |
-
<th>4A</th>
|
1417 |
-
<th>5A</th>
|
1418 |
-
<th>6A</th>
|
1419 |
-
<th>7A</th>
|
1420 |
-
<th>8A</th>
|
1421 |
-
</tr>
|
1422 |
-
</thead>
|
1423 |
-
<tbody>
|
1424 |
-
<tr>
|
1425 |
-
<td></td>
|
1426 |
-
<td colspan="18"></td>
|
1427 |
-
</tr>
|
1428 |
-
<tr>
|
1429 |
-
<td>H </td>
|
1430 |
-
<td colspan="15"></td>
|
1431 |
-
<td></td>
|
1432 |
-
<td>He </td>
|
1433 |
-
</tr>
|
1434 |
-
<tr>
|
1435 |
-
<td>Li </td>
|
1436 |
-
<td>Be </td>
|
1437 |
-
<td colspan="10"></td>
|
1438 |
-
<td>B </td>
|
1439 |
-
<td>C </td>
|
1440 |
-
<td>N </td>
|
1441 |
-
<td>O </td>
|
1442 |
-
<td>F </td>
|
1443 |
-
<td>Ne </td>
|
1444 |
-
</tr>
|
1445 |
-
<tr>
|
1446 |
-
<td>Na </td>
|
1447 |
-
<td>Mg </td>
|
1448 |
-
<td colspan="10"></td>
|
1449 |
-
<td>Al </td>
|
1450 |
-
<td>Si </td>
|
1451 |
-
<td>P </td>
|
1452 |
-
<td>S </td>
|
1453 |
-
<td>Cl </td>
|
1454 |
-
<td>Ar </td>
|
1455 |
-
</tr>
|
1456 |
-
<tr>
|
1457 |
-
<td>K </td>
|
1458 |
-
<td>Ca </td>
|
1459 |
-
<td>Sc </td>
|
1460 |
-
<td>Ti </td>
|
1461 |
-
<td>V </td>
|
1462 |
-
<td>Cr </td>
|
1463 |
-
<td>Mn </td>
|
1464 |
-
<td>Fe </td>
|
1465 |
-
<td>Co </td>
|
1466 |
-
<td>Ni </td>
|
1467 |
-
<td>Cu </td>
|
1468 |
-
<td>Zn </td>
|
1469 |
-
<td>Ga </td>
|
1470 |
-
<td>Ge </td>
|
1471 |
-
<td>As </td>
|
1472 |
-
<td>Se </td>
|
1473 |
-
<td>Br </td>
|
1474 |
-
<td>Kr </td>
|
1475 |
-
</tr>
|
1476 |
-
<tr>
|
1477 |
-
<td>Rb </td>
|
1478 |
-
<td>Sr </td>
|
1479 |
-
<td>Y </td>
|
1480 |
-
<td>Zr </td>
|
1481 |
-
<td>Nb </td>
|
1482 |
-
<td>Mo </td>
|
1483 |
-
<td>Tc </td>
|
1484 |
-
<td>Ru </td>
|
1485 |
-
<td>Rh </td>
|
1486 |
-
<td>Pd </td>
|
1487 |
-
<td>Ag </td>
|
1488 |
-
<td>Cd </td>
|
1489 |
-
<td>In </td>
|
1490 |
-
<td>Sn </td>
|
1491 |
-
<td>Sb </td>
|
1492 |
-
<td>Te </td>
|
1493 |
-
<td>I </td>
|
1494 |
-
<td>Xe </td>
|
1495 |
-
</tr>
|
1496 |
-
<tr>
|
1497 |
-
<td>Cs </td>
|
1498 |
-
<td>Ba </td>
|
1499 |
-
<td>La </td>
|
1500 |
-
<td>Hf </td>
|
1501 |
-
<td>Ta </td>
|
1502 |
-
<td>W </td>
|
1503 |
-
<td>Re </td>
|
1504 |
-
<td>Os </td>
|
1505 |
-
<td>Ir </td>
|
1506 |
-
<td>Pt </td>
|
1507 |
-
<td>Au </td>
|
1508 |
-
<td>Hg </td>
|
1509 |
-
<td>Tl </td>
|
1510 |
-
<td>Pb </td>
|
1511 |
-
<td>Bi </td>
|
1512 |
-
<td>Po </td>
|
1513 |
-
<td>At </td>
|
1514 |
-
<td>Rn </td>
|
1515 |
-
</tr>
|
1516 |
-
<tr>
|
1517 |
-
<td>Fr </td>
|
1518 |
-
<td>Ra </td>
|
1519 |
-
<td>Ac </td>
|
1520 |
-
</tr>
|
1521 |
-
<tr>
|
1522 |
-
<td></td>
|
1523 |
-
<td colspan="18"></td>
|
1524 |
-
</tr>
|
1525 |
-
<tr>
|
1526 |
-
<td colspan="3"></td>
|
1527 |
-
<td>Ce </td>
|
1528 |
-
<td>Pr </td>
|
1529 |
-
<td>Nd </td>
|
1530 |
-
<td>Pm </td>
|
1531 |
-
<td>Sm </td>
|
1532 |
-
<td>Eu </td>
|
1533 |
-
<td>Gd </td>
|
1534 |
-
<td>Tb </td>
|
1535 |
-
<td>Dy </td>
|
1536 |
-
<td>Ho </td>
|
1537 |
-
<td>Er </td>
|
1538 |
-
<td>Tm </td>
|
1539 |
-
<td>Yb </td>
|
1540 |
-
<td>Lu </td>
|
1541 |
-
<td></td>
|
1542 |
-
</tr>
|
1543 |
-
<tr>
|
1544 |
-
<td colspan="3"></td>
|
1545 |
-
<td>Th </td>
|
1546 |
-
<td>Pa </td>
|
1547 |
-
<td>U </td>
|
1548 |
-
<td>Np </td>
|
1549 |
-
<td>Pu </td>
|
1550 |
-
<td>Am </td>
|
1551 |
-
<td>Cm </td>
|
1552 |
-
<td>Bk </td>
|
1553 |
-
<td>Cf </td>
|
1554 |
-
<td>Es </td>
|
1555 |
-
<td>Fm </td>
|
1556 |
-
<td>Md </td>
|
1557 |
-
<td>No </td>
|
1558 |
-
<td>Lr </td>
|
1559 |
-
<td></td>
|
1560 |
-
</tr>
|
1561 |
-
</tbody>
|
1562 |
-
</table>
|
1563 |
-
<p> </p>
|
1564 |
-
<pagebreak />
|
1565 |
-
<h3>Rotated text in Table Cells</h3>
|
1566 |
-
<h5>Periodic Table</h5>
|
1567 |
-
<table>
|
1568 |
-
<thead>
|
1569 |
-
<tr text-rotate="45">
|
1570 |
-
<th>
|
1571 |
-
<p>Element type 1A</p>
|
1572 |
-
<p>Second line</p>
|
1573 |
-
<th>
|
1574 |
-
<p>Element type longer 2A</p>
|
1575 |
-
</th>
|
1576 |
-
<th>Element type 3B</th>
|
1577 |
-
<th>Element type 4B</th>
|
1578 |
-
<th>Element type 5B</th>
|
1579 |
-
<th>Element type 6B</th>
|
1580 |
-
<th>7B</th>
|
1581 |
-
<th>8B</th>
|
1582 |
-
<th>Element type 8B R</th>
|
1583 |
-
<th>8B</th>
|
1584 |
-
<th>Element <span>type</span> 1B</th>
|
1585 |
-
<th>2B</th>
|
1586 |
-
<th>Element type 3A</th>
|
1587 |
-
<th>Element type 4A</th>
|
1588 |
-
<th>Element type 5A</th>
|
1589 |
-
<th>Element type 6A</th>
|
1590 |
-
<th>7A</th>
|
1591 |
-
<th>Element type 8A</th>
|
1592 |
-
</tr>
|
1593 |
-
</thead>
|
1594 |
-
<tbody>
|
1595 |
-
<tr>
|
1596 |
-
<td>H</td>
|
1597 |
-
<td colspan="15"></td>
|
1598 |
-
<td></td>
|
1599 |
-
<td>He </td>
|
1600 |
-
</tr>
|
1601 |
-
<tr>
|
1602 |
-
<td>Li </td>
|
1603 |
-
<td>Be </td>
|
1604 |
-
<td colspan="10"></td>
|
1605 |
-
<td>B </td>
|
1606 |
-
<td>C </td>
|
1607 |
-
<td>N </td>
|
1608 |
-
<td>O </td>
|
1609 |
-
<td>F </td>
|
1610 |
-
<td>Ne </td>
|
1611 |
-
</tr>
|
1612 |
-
<tr>
|
1613 |
-
<td>Na </td>
|
1614 |
-
<td>Mg </td>
|
1615 |
-
<td colspan="10"></td>
|
1616 |
-
<td>Al </td>
|
1617 |
-
<td>Si </td>
|
1618 |
-
<td>P </td>
|
1619 |
-
<td>S </td>
|
1620 |
-
<td>Cl </td>
|
1621 |
-
<td>Ar </td>
|
1622 |
-
</tr>
|
1623 |
-
<tr style="text-rotate: 45">
|
1624 |
-
<td>K </td>
|
1625 |
-
<td>Ca </td>
|
1626 |
-
<td>Sc </td>
|
1627 |
-
<td>Ti</td>
|
1628 |
-
<td>Va</td>
|
1629 |
-
<td>Cr</td>
|
1630 |
-
<td>Mn</td>
|
1631 |
-
<td>Fe</td>
|
1632 |
-
<td>Co</td>
|
1633 |
-
<td>Ni </td>
|
1634 |
-
<td>Cu </td>
|
1635 |
-
<td>Zn </td>
|
1636 |
-
<td>Ga </td>
|
1637 |
-
<td>Ge </td>
|
1638 |
-
<td>As </td>
|
1639 |
-
<td>Se </td>
|
1640 |
-
<td>Br </td>
|
1641 |
-
<td>Kr </td>
|
1642 |
-
</tr>
|
1643 |
-
<tr>
|
1644 |
-
<td>Rb </td>
|
1645 |
-
<td>Sr </td>
|
1646 |
-
<td>Y </td>
|
1647 |
-
<td>Zr </td>
|
1648 |
-
<td>Nb </td>
|
1649 |
-
<td>Mo </td>
|
1650 |
-
<td>Tc </td>
|
1651 |
-
<td>Ru </td>
|
1652 |
-
<td style="text-align:right; ">Rh</td>
|
1653 |
-
<td>Pd </td>
|
1654 |
-
<td>Ag </td>
|
1655 |
-
<td>Cd </td>
|
1656 |
-
<td>In </td>
|
1657 |
-
<td>Sn </td>
|
1658 |
-
<td>Sb </td>
|
1659 |
-
<td>Te </td>
|
1660 |
-
<td>I </td>
|
1661 |
-
<td>Xe </td>
|
1662 |
-
</tr>
|
1663 |
-
<tr>
|
1664 |
-
<td>Cs </td>
|
1665 |
-
<td>Ba </td>
|
1666 |
-
<td>La </td>
|
1667 |
-
<td>Hf </td>
|
1668 |
-
<td>Ta </td>
|
1669 |
-
<td>W </td>
|
1670 |
-
<td>Re </td>
|
1671 |
-
<td>Os </td>
|
1672 |
-
<td>Ir </td>
|
1673 |
-
<td>Pt </td>
|
1674 |
-
<td>Au </td>
|
1675 |
-
<td>Hg </td>
|
1676 |
-
<td>Tl </td>
|
1677 |
-
<td>Pb </td>
|
1678 |
-
<td>Bi </td>
|
1679 |
-
<td>Po </td>
|
1680 |
-
<td>At </td>
|
1681 |
-
<td>Rn </td>
|
1682 |
-
</tr>
|
1683 |
-
<tr>
|
1684 |
-
<td>Fr </td>
|
1685 |
-
<td>Ra </td>
|
1686 |
-
<td colspan="16">Ac </td>
|
1687 |
-
</tr>
|
1688 |
-
<tr>
|
1689 |
-
<td colspan="3"></td>
|
1690 |
-
<td>Ce </td>
|
1691 |
-
<td>Pr </td>
|
1692 |
-
<td>Nd </td>
|
1693 |
-
<td>Pm </td>
|
1694 |
-
<td>Sm </td>
|
1695 |
-
<td>Eu </td>
|
1696 |
-
<td>Gd </td>
|
1697 |
-
<td>Tb </td>
|
1698 |
-
<td>Dy </td>
|
1699 |
-
<td>Ho </td>
|
1700 |
-
<td>Er </td>
|
1701 |
-
<td>Tm </td>
|
1702 |
-
<td>Yb </td>
|
1703 |
-
<td>Lu </td>
|
1704 |
-
<td></td>
|
1705 |
-
</tr>
|
1706 |
-
<tr>
|
1707 |
-
<td colspan="3"></td>
|
1708 |
-
<td>Th </td>
|
1709 |
-
<td>Pa </td>
|
1710 |
-
<td>U </td>
|
1711 |
-
<td>Np </td>
|
1712 |
-
<td>Pu </td>
|
1713 |
-
<td>Am </td>
|
1714 |
-
<td>Cm </td>
|
1715 |
-
<td>Bk </td>
|
1716 |
-
<td>Cf </td>
|
1717 |
-
<td>Es </td>
|
1718 |
-
<td>Fm </td>
|
1719 |
-
<td>Md </td>
|
1720 |
-
<td>No </td>
|
1721 |
-
<td>Lr </td>
|
1722 |
-
<td></td>
|
1723 |
-
</tr>
|
1724 |
-
</tbody>
|
1725 |
-
</table>
|
1726 |
-
<p> </p>
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
<?php } ?>
|
1731 |
-
</body>
|
1732 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-template.php
DELETED
@@ -1,95 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
</head>
|
31 |
-
<body>
|
32 |
-
<?php
|
33 |
-
|
34 |
-
foreach($lead_ids as $lead_id) {
|
35 |
-
|
36 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
37 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
38 |
-
|
39 |
-
/*
|
40 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
41 |
-
*/
|
42 |
-
PDF_Common::view_data($form_data);
|
43 |
-
|
44 |
-
/*
|
45 |
-
* Store your form fields from the $form_data array into variables here
|
46 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
47 |
-
*
|
48 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
49 |
-
*
|
50 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
51 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
52 |
-
*
|
53 |
-
*/
|
54 |
-
|
55 |
-
?>
|
56 |
-
|
57 |
-
<!-- New to v3.4.0, watermarking is now enabled. See example-watermark09.php for more details -->
|
58 |
-
<watermarktext content="DRAFT" alpha="0.1" />
|
59 |
-
|
60 |
-
<!-- There's much better server compatibility if you use the absolute path to the image as oppose to a URL. -->
|
61 |
-
<img src="<?php echo PDF_PLUGIN_DIR ?>resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
62 |
-
|
63 |
-
|
64 |
-
<!-- let's build our body content -->
|
65 |
-
<div class="body_copy">
|
66 |
-
|
67 |
-
<p class="whom_concern_intro">Dear User,</p>
|
68 |
-
|
69 |
-
<p class="body_text">Gravity PDF allows you to directly access Gravity Form field data so you can create custom PDFs like this one.
|
70 |
-
If you haven't reviewed our five part installation and configuration guide yet, we recommend <a target="_blank" href="https://developer.gravitypdf.com/documentation/getting-started-with-gravity-pdf-configuration/">taking a look</a>.
|
71 |
-
There's also a <a target="_blank" href="https://developer.gravitypdf.com/documentation/configuration-options-examples/">large number of configuration options</a> that can be applied to any PDF.</p>
|
72 |
-
</p>
|
73 |
-
|
74 |
-
<p class="body_text">Now you've got an understanding on configuring the software, let's take a look at custom templates.
|
75 |
-
To start with, you'll want to copy and rename one of the <em>example-</em> template files in your active theme's PDF_EXTENDED_TEMPLATES directory. </p>
|
76 |
-
|
77 |
-
<p class="body_text">Once copied, go to your Wordpress Dashboard and navigate to Forms -> Entries and click the View PDF button on one of your entries. If you haven't assigned a custom template to the form, the default-template.php should open.
|
78 |
-
If you change <em>default-template.php</em> in the URL to the new template you just made it will generate a PDF based off that file.</p>
|
79 |
-
<p class="body_text">Once you have your new template file open in your browser window you can access the $form_data array (which contains all the Gravity Form entry data) by appending the URL with &data=1. <strong>Note: this only works if you copied a template file with example- in the name.</strong></p>
|
80 |
-
<p><strong>Example:</strong> http://www.yourdomain.com/?gf_pdf=1&fid=2&lid=6&template=new-example-template.php&data=1 </p>
|
81 |
-
|
82 |
-
<p>For more information about custom templates <a target="_blank" href="https://developer.gravitypdf.com/documentation/custom-templates-introduction/">review the plugin's documentation</a><br /><br />
|
83 |
-
</p>
|
84 |
-
<p class="signature">
|
85 |
-
Jake Jackson<br />
|
86 |
-
<img src="<?php echo PDF_PLUGIN_DIR ?>resources/images/signature.png" alt="Signature" width="100" height="60" /><br />
|
87 |
-
Developer, Gravity PDF<br />
|
88 |
-
<a target="_blank" href="http://gravitypdf.com">gravitypdf.com</a>
|
89 |
-
</p>
|
90 |
-
|
91 |
-
</div>
|
92 |
-
|
93 |
-
<?php } ?>
|
94 |
-
</body>
|
95 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialisation/templates/example-watermark09.php
DELETED
@@ -1,136 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Don't give direct access to the template
|
5 |
-
*/
|
6 |
-
if(!class_exists("RGForms")){
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Load the form data to pass to our PDF generating function
|
12 |
-
*/
|
13 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19 |
-
<html>
|
20 |
-
<head>
|
21 |
-
<link rel='stylesheet' href='<?php echo PDF_PLUGIN_URL .'initialisation/template.css'; ?>' type='text/css' />
|
22 |
-
<?php
|
23 |
-
/*
|
24 |
-
* Create your own stylesheet or use the <style></style> tags to add or modify styles
|
25 |
-
* The plugin stylesheet is overridden every update
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<title>Gravity PDF</title>
|
29 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
30 |
-
</head>
|
31 |
-
<body>
|
32 |
-
<?php
|
33 |
-
|
34 |
-
foreach($lead_ids as $lead_id) {
|
35 |
-
|
36 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
37 |
-
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
38 |
-
|
39 |
-
/*
|
40 |
-
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
41 |
-
*/
|
42 |
-
PDF_Common::view_data($form_data);
|
43 |
-
|
44 |
-
/*
|
45 |
-
* Store your form fields from the $form_data array into variables here
|
46 |
-
* To see your entire $form_data array, view your PDF via the admin area and add &data=1 to the url
|
47 |
-
*
|
48 |
-
* For an example of accessing $form_data fields see https://developer.gravitypdf.com/documentation/custom-templates-introduction/
|
49 |
-
*
|
50 |
-
* Alternatively, as of v3.4.0 you can use merge tags (except {allfields}) in your templates.
|
51 |
-
* Just add merge tags to your HTML and they'll be parsed before generating the PDF.
|
52 |
-
*
|
53 |
-
*/
|
54 |
-
|
55 |
-
?>
|
56 |
-
|
57 |
-
<!--
|
58 |
-
Watermark content must have characters properly encoded: < = < > = > & = & ' = ' or " = "
|
59 |
-
Best to use htmlspecialchars('Content', ENT_QUOTES)
|
60 |
-
Setting content to blank will clear the watermark
|
61 |
-
-->
|
62 |
-
|
63 |
-
<watermarktext content="<?php echo htmlspecialchars("DRAFT'S", ENT_QUOTES); ?>" alpha="0.1" />
|
64 |
-
|
65 |
-
<img src="<?php echo PDF_PLUGIN_DIR ?>resources/images/gravityformspdfextended.jpg" width="311" height="110" />
|
66 |
-
|
67 |
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sollicitudin, magna et interdum hendrerit, est libero convallis odio, quis dapibus augue risus condimentum nisl. Quisque in orci dui. Pellentesque volutpat, nibh non eleifend fringilla, massa risus blandit neque, vestibulum adipiscing elit purus in tortor. Ut mauris libero, commodo eu suscipit vel, sagittis nec erat. Maecenas at eros facilisis, vestibulum felis sit amet, pellentesque nunc. Mauris accumsan leo a gravida tincidunt. Aliquam congue, leo vitae consequat tempor, arcu arcu dapibus ipsum, sit amet faucibus sem nulla nec lorem.</p>
|
68 |
-
<p>Vivamus eu neque ac tortor fringilla malesuada. Nullam sed orci non erat vehicula volutpat eu sed velit. Donec gravida lacus ut tortor facilisis vestibulum. Vivamus venenatis hendrerit neque et porttitor. Aenean ultricies quis nibh nec euismod. Aliquam aliquam erat eget erat blandit sollicitudin. Curabitur non quam eget neque dignissim posuere.</p>
|
69 |
-
<p>Nullam euismod venenatis eleifend. Donec et iaculis velit. Sed in magna sit amet felis egestas sagittis id ut velit. Morbi eleifend dictum interdum. Vestibulum convallis rutrum erat id lacinia. Pellentesque vulputate porta vehicula. Curabitur sagittis vel diam at placerat. Aliquam auctor diam sit amet risus convallis dignissim. Donec fermentum quam porttitor porta sagittis. Maecenas tristique turpis enim, eget convallis neque bibendum vitae. Ut iaculis lacus at rutrum ultrices. Suspendisse ut urna vitae purus eleifend laoreet non sit amet sem. </p>
|
70 |
-
|
71 |
-
<pagebreak />
|
72 |
-
|
73 |
-
<watermarktext content="<?php echo htmlspecialchars("PRIVATE", ENT_QUOTES); ?>" alpha="0.5" />
|
74 |
-
|
75 |
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sollicitudin, magna et interdum hendrerit, est libero convallis odio, quis dapibus augue risus condimentum nisl. Quisque in orci dui. Pellentesque volutpat, nibh non eleifend fringilla, massa risus blandit neque, vestibulum adipiscing elit purus in tortor. Ut mauris libero, commodo eu suscipit vel, sagittis nec erat. Maecenas at eros facilisis, vestibulum felis sit amet, pellentesque nunc. Mauris accumsan leo a gravida tincidunt. Aliquam congue, leo vitae consequat tempor, arcu arcu dapibus ipsum, sit amet faucibus sem nulla nec lorem.</p>
|
76 |
-
<p>Vivamus eu neque ac tortor fringilla malesuada. Nullam sed orci non erat vehicula volutpat eu sed velit. Donec gravida lacus ut tortor facilisis vestibulum. Vivamus venenatis hendrerit neque et porttitor. Aenean ultricies quis nibh nec euismod. Aliquam aliquam erat eget erat blandit sollicitudin. Curabitur non quam eget neque dignissim posuere.</p>
|
77 |
-
<p>Nullam euismod venenatis eleifend. Donec et iaculis velit. Sed in magna sit amet felis egestas sagittis id ut velit. Morbi eleifend dictum interdum. Vestibulum convallis rutrum erat id lacinia. Pellentesque vulputate porta vehicula. Curabitur sagittis vel diam at placerat. Aliquam auctor diam sit amet risus convallis dignissim. Donec fermentum quam porttitor porta sagittis. Maecenas tristique turpis enim, eget convallis neque bibendum vitae. Ut iaculis lacus at rutrum ultrices. Suspendisse ut urna vitae purus eleifend laoreet non sit amet sem. </p>
|
78 |
-
|
79 |
-
|
80 |
-
<pagebreak />
|
81 |
-
|
82 |
-
<watermarktext content="" />
|
83 |
-
|
84 |
-
<p>Water mark turned off</p>
|
85 |
-
|
86 |
-
<pagebreak />
|
87 |
-
<!--
|
88 |
-
Let's look at the image watermark now.
|
89 |
-
It accepts two additional arguments to <watermarktext>: size and position
|
90 |
-
And 'content' is substituted for 'src' : the link to the image
|
91 |
-
|
92 |
-
Size Options:
|
93 |
-
D: default i.e. original size of image - may depend on img_dpi
|
94 |
-
P: Resize to fit the full page size, keeping aspect ratio
|
95 |
-
F: Resize to fit the print-area (frame) respecting current page margins, keeping aspect ratio
|
96 |
-
INT: Resize to full page size minus a margin set by this integer in millimeters, keeping aspect ratio
|
97 |
-
2 comma-separated numbers ($width, $height): Specify a size; units in millimeters
|
98 |
-
DEFAULT: "D"
|
99 |
-
|
100 |
-
Position options:
|
101 |
-
P: Centred on the whole page area
|
102 |
-
F: Centred on the page print-area (frame) respecting page margins
|
103 |
-
2 comma-separated numbers ($x, $y): Specify a position; units in millimeters
|
104 |
-
DEFAULT: "P"
|
105 |
-
|
106 |
-
-->
|
107 |
-
|
108 |
-
<watermarkimage src="<?php echo PDF_PLUGIN_DIR ?>resources/images/gravityformspdfextended.jpg" alpha="0.1" size="D" position="P" />
|
109 |
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sollicitudin, magna et interdum hendrerit, est libero convallis odio, quis dapibus augue risus condimentum nisl. Quisque in orci dui. Pellentesque volutpat, nibh non eleifend fringilla, massa risus blandit neque, vestibulum adipiscing elit purus in tortor. Ut mauris libero, commodo eu suscipit vel, sagittis nec erat. Maecenas at eros facilisis, vestibulum felis sit amet, pellentesque nunc. Mauris accumsan leo a gravida tincidunt. Aliquam congue, leo vitae consequat tempor, arcu arcu dapibus ipsum, sit amet faucibus sem nulla nec lorem.</p>
|
110 |
-
<p>Vivamus eu neque ac tortor fringilla malesuada. Nullam sed orci non erat vehicula volutpat eu sed velit. Donec gravida lacus ut tortor facilisis vestibulum. Vivamus venenatis hendrerit neque et porttitor. Aenean ultricies quis nibh nec euismod. Aliquam aliquam erat eget erat blandit sollicitudin. Curabitur non quam eget neque dignissim posuere.</p>
|
111 |
-
<p>Nullam euismod venenatis eleifend. Donec et iaculis velit. Sed in magna sit amet felis egestas sagittis id ut velit. Morbi eleifend dictum interdum. Vestibulum convallis rutrum erat id lacinia. Pellentesque vulputate porta vehicula. Curabitur sagittis vel diam at placerat. Aliquam auctor diam sit amet risus convallis dignissim. Donec fermentum quam porttitor porta sagittis. Maecenas tristique turpis enim, eget convallis neque bibendum vitae. Ut iaculis lacus at rutrum ultrices. Suspendisse ut urna vitae purus eleifend laoreet non sit amet sem. </p>
|
112 |
-
|
113 |
-
<pagebreak />
|
114 |
-
|
115 |
-
<watermarkimage src="<?php echo PDF_PLUGIN_DIR ?>resources/images/gravityformspdfextended.jpg" alpha="0.5" size="P" position="F" />
|
116 |
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sollicitudin, magna et interdum hendrerit, est libero convallis odio, quis dapibus augue risus condimentum nisl. Quisque in orci dui. Pellentesque volutpat, nibh non eleifend fringilla, massa risus blandit neque, vestibulum adipiscing elit purus in tortor. Ut mauris libero, commodo eu suscipit vel, sagittis nec erat. Maecenas at eros facilisis, vestibulum felis sit amet, pellentesque nunc. Mauris accumsan leo a gravida tincidunt. Aliquam congue, leo vitae consequat tempor, arcu arcu dapibus ipsum, sit amet faucibus sem nulla nec lorem.</p>
|
117 |
-
<p>Vivamus eu neque ac tortor fringilla malesuada. Nullam sed orci non erat vehicula volutpat eu sed velit. Donec gravida lacus ut tortor facilisis vestibulum. Vivamus venenatis hendrerit neque et porttitor. Aenean ultricies quis nibh nec euismod. Aliquam aliquam erat eget erat blandit sollicitudin. Curabitur non quam eget neque dignissim posuere.</p>
|
118 |
-
<p>Nullam euismod venenatis eleifend. Donec et iaculis velit. Sed in magna sit amet felis egestas sagittis id ut velit. Morbi eleifend dictum interdum. Vestibulum convallis rutrum erat id lacinia. Pellentesque vulputate porta vehicula. Curabitur sagittis vel diam at placerat. Aliquam auctor diam sit amet risus convallis dignissim. Donec fermentum quam porttitor porta sagittis. Maecenas tristique turpis enim, eget convallis neque bibendum vitae. Ut iaculis lacus at rutrum ultrices. Suspendisse ut urna vitae purus eleifend laoreet non sit amet sem. </p>
|
119 |
-
|
120 |
-
<pagebreak />
|
121 |
-
|
122 |
-
<watermarkimage src="<?php echo PDF_PLUGIN_DIR ?>resources/images/gravityformspdfextended.jpg" alpha="0.1" size="D" position="1,1" />
|
123 |
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sollicitudin, magna et interdum hendrerit, est libero convallis odio, quis dapibus augue risus condimentum nisl. Quisque in orci dui. Pellentesque volutpat, nibh non eleifend fringilla, massa risus blandit neque, vestibulum adipiscing elit purus in tortor. Ut mauris libero, commodo eu suscipit vel, sagittis nec erat. Maecenas at eros facilisis, vestibulum felis sit amet, pellentesque nunc. Mauris accumsan leo a gravida tincidunt. Aliquam congue, leo vitae consequat tempor, arcu arcu dapibus ipsum, sit amet faucibus sem nulla nec lorem.</p>
|
124 |
-
<p>Vivamus eu neque ac tortor fringilla malesuada. Nullam sed orci non erat vehicula volutpat eu sed velit. Donec gravida lacus ut tortor facilisis vestibulum. Vivamus venenatis hendrerit neque et porttitor. Aenean ultricies quis nibh nec euismod. Aliquam aliquam erat eget erat blandit sollicitudin. Curabitur non quam eget neque dignissim posuere.</p>
|
125 |
-
<p>Nullam euismod venenatis eleifend. Donec et iaculis velit. Sed in magna sit amet felis egestas sagittis id ut velit. Morbi eleifend dictum interdum. Vestibulum convallis rutrum erat id lacinia. Pellentesque vulputate porta vehicula. Curabitur sagittis vel diam at placerat. Aliquam auctor diam sit amet risus convallis dignissim. Donec fermentum quam porttitor porta sagittis. Maecenas tristique turpis enim, eget convallis neque bibendum vitae. Ut iaculis lacus at rutrum ultrices. Suspendisse ut urna vitae purus eleifend laoreet non sit amet sem. </p>
|
126 |
-
|
127 |
-
<pagebreak />
|
128 |
-
|
129 |
-
<watermarkimage src="<?php echo PDF_PLUGIN_DIR ?>resources/images/gravityformspdfextended.jpg" alpha="0.5" size="50, 50" position="P" />
|
130 |
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sollicitudin, magna et interdum hendrerit, est libero convallis odio, quis dapibus augue risus condimentum nisl. Quisque in orci dui. Pellentesque volutpat, nibh non eleifend fringilla, massa risus blandit neque, vestibulum adipiscing elit purus in tortor. Ut mauris libero, commodo eu suscipit vel, sagittis nec erat. Maecenas at eros facilisis, vestibulum felis sit amet, pellentesque nunc. Mauris accumsan leo a gravida tincidunt. Aliquam congue, leo vitae consequat tempor, arcu arcu dapibus ipsum, sit amet faucibus sem nulla nec lorem.</p>
|
131 |
-
<p>Vivamus eu neque ac tortor fringilla malesuada. Nullam sed orci non erat vehicula volutpat eu sed velit. Donec gravida lacus ut tortor facilisis vestibulum. Vivamus venenatis hendrerit neque et porttitor. Aenean ultricies quis nibh nec euismod. Aliquam aliquam erat eget erat blandit sollicitudin. Curabitur non quam eget neque dignissim posuere.</p>
|
132 |
-
<p>Nullam euismod venenatis eleifend. Donec et iaculis velit. Sed in magna sit amet felis egestas sagittis id ut velit. Morbi eleifend dictum interdum. Vestibulum convallis rutrum erat id lacinia. Pellentesque vulputate porta vehicula. Curabitur sagittis vel diam at placerat. Aliquam auctor diam sit amet risus convallis dignissim. Donec fermentum quam porttitor porta sagittis. Maecenas tristique turpis enim, eget convallis neque bibendum vitae. Ut iaculis lacus at rutrum ultrices. Suspendisse ut urna vitae purus eleifend laoreet non sit amet sem. </p>
|
133 |
-
|
134 |
-
<?php } ?>
|
135 |
-
</body>
|
136 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
installation-update-manager.php
ADDED
@@ -0,0 +1,518 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin: Gravity Forms PDF Extended
|
5 |
+
* File: install-update-manager.php
|
6 |
+
*
|
7 |
+
* This file handles the installation and update code that ensures the plugin will be supported.
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Check to see if Gravity Forms version is supported
|
12 |
+
*/
|
13 |
+
|
14 |
+
class GFPDF_InstallUpdater
|
15 |
+
{
|
16 |
+
public function install()
|
17 |
+
{
|
18 |
+
if(strlen(get_option('gf_pdf_extended_installed')) == 0)
|
19 |
+
{
|
20 |
+
update_option('gf_pdf_extended_version', PDF_EXTENDED_VERSION);
|
21 |
+
update_option('gf_pdf_extended_deploy', 'yes');
|
22 |
+
|
23 |
+
self::pdf_extended_activate();
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Install everything required
|
29 |
+
*/
|
30 |
+
public function pdf_extended_activate()
|
31 |
+
{
|
32 |
+
/*
|
33 |
+
* Initialise the Wordpress Filesystem API
|
34 |
+
*/
|
35 |
+
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy'), 'pdf-extended-filesystem') === false)
|
36 |
+
{
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
|
40 |
+
/*
|
41 |
+
* If we got here we should have $wp_filesystem available
|
42 |
+
*/
|
43 |
+
global $wp_filesystem;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* If PDF_TEMPLATE_LOCATION already exists then we will remove the old template files so we can redeploy the new ones
|
47 |
+
*/
|
48 |
+
if(PDF_DEPLOY === true && $wp_filesystem->exists(PDF_TEMPLATE_LOCATION))
|
49 |
+
{
|
50 |
+
/* read all file names into array and unlink from active theme template folder */
|
51 |
+
foreach(glob(PDF_PLUGIN_DIR.'templates/*.php') as $file) {
|
52 |
+
$path_parts = pathinfo($file);
|
53 |
+
if($wp_filesystem->exists(PDF_TEMPLATE_LOCATION.$path_parts['basename']))
|
54 |
+
{
|
55 |
+
$wp_filesystem->delete(PDF_TEMPLATE_LOCATION.$path_parts['basename']);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
if($wp_filesystem->exists(PDF_TEMPLATE_LOCATION.'template.css')) { $wp_filesystem->delete(PDF_TEMPLATE_LOCATION.'template.css'); }
|
59 |
+
}
|
60 |
+
|
61 |
+
/* unzip the mPDF file */
|
62 |
+
if($wp_filesystem->exists(PDF_PLUGIN_DIR . 'mPDF.zip'))
|
63 |
+
{
|
64 |
+
if($results = unzip_file( PDF_PLUGIN_DIR . 'mPDF.zip', PDF_PLUGIN_DIR ) !== true)
|
65 |
+
{
|
66 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_unzip_mpdf_err"));
|
67 |
+
return true;
|
68 |
+
}
|
69 |
+
/*
|
70 |
+
* Remove the original archive
|
71 |
+
*/
|
72 |
+
$wp_filesystem->delete(PDF_PLUGIN_DIR . 'mPDF.zip');
|
73 |
+
}
|
74 |
+
|
75 |
+
/* create new directory in active themes folder*/
|
76 |
+
if(!$wp_filesystem->is_dir(PDF_TEMPLATE_LOCATION))
|
77 |
+
{
|
78 |
+
if($wp_filesystem->mkdir(PDF_TEMPLATE_LOCATION) === false)
|
79 |
+
{
|
80 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
if(!$wp_filesystem->is_dir(PDF_SAVE_LOCATION))
|
86 |
+
{
|
87 |
+
/* create new directory in active themes folder*/
|
88 |
+
if($wp_filesystem->mkdir(PDF_SAVE_LOCATION) === false)
|
89 |
+
{
|
90 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
91 |
+
return true;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
if(!$wp_filesystem->is_dir(PDF_FONT_LOCATION))
|
96 |
+
{
|
97 |
+
/* create new directory in active themes folder*/
|
98 |
+
if($wp_filesystem->mkdir(PDF_FONT_LOCATION) === false)
|
99 |
+
{
|
100 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
101 |
+
return true;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
/*
|
106 |
+
* Copy entire template folder over to PDF_TEMPLATE_LOCATION
|
107 |
+
*/
|
108 |
+
self::pdf_extended_copy_directory( PDF_PLUGIN_DIR . 'templates', PDF_TEMPLATE_LOCATION, false );
|
109 |
+
|
110 |
+
if(!$wp_filesystem->exists(PDF_TEMPLATE_LOCATION.'configuration.php'))
|
111 |
+
{
|
112 |
+
/* copy template files to new directory */
|
113 |
+
if(!$wp_filesystem->copy(PDF_PLUGIN_DIR .'configuration.php', PDF_TEMPLATE_LOCATION.'configuration.php'))
|
114 |
+
{
|
115 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
116 |
+
return true;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
if(!$wp_filesystem->exists(PDF_TEMPLATE_LOCATION.'template.css'))
|
121 |
+
{
|
122 |
+
/* copy template files to new directory */
|
123 |
+
if(!$wp_filesystem->copy(PDF_PLUGIN_DIR .'styles/template.css', PDF_TEMPLATE_LOCATION.'template.css'))
|
124 |
+
{
|
125 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
126 |
+
return true;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
if(!$wp_filesystem->exists(PDF_SAVE_LOCATION.'.htaccess'))
|
131 |
+
{
|
132 |
+
if(!$wp_filesystem->put_contents(PDF_SAVE_LOCATION.'.htaccess', 'deny from all'))
|
133 |
+
{
|
134 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
135 |
+
return true;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
if(self::install_fonts() !== true)
|
140 |
+
{
|
141 |
+
return true;
|
142 |
+
}
|
143 |
+
|
144 |
+
/*
|
145 |
+
* Update system to ensure everything is installed correctly.
|
146 |
+
*/
|
147 |
+
update_option('gf_pdf_extended_installed', 'installed');
|
148 |
+
update_option('gf_pdf_extended_deploy', 'yes');
|
149 |
+
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
|
153 |
+
public static function initialise_fonts()
|
154 |
+
{
|
155 |
+
/*
|
156 |
+
* Initialise the Wordpress Filesystem API
|
157 |
+
*/
|
158 |
+
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy'), 'pdf-extended-filesystem') === false)
|
159 |
+
{
|
160 |
+
return false;
|
161 |
+
}
|
162 |
+
|
163 |
+
if(self::install_fonts() === true)
|
164 |
+
{
|
165 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_install_success"));
|
166 |
+
}
|
167 |
+
return true;
|
168 |
+
}
|
169 |
+
|
170 |
+
private static function install_fonts()
|
171 |
+
{
|
172 |
+
|
173 |
+
global $wp_filesystem;
|
174 |
+
$write_to_file = '<?php
|
175 |
+
|
176 |
+
if(!defined("PDF_EXTENDED_VERSION"))
|
177 |
+
{
|
178 |
+
return;
|
179 |
+
}
|
180 |
+
|
181 |
+
';
|
182 |
+
|
183 |
+
/*
|
184 |
+
* Search the font folder for .ttf files. If found, move them to the mPDF font folder
|
185 |
+
* and write the configuration file
|
186 |
+
*/
|
187 |
+
|
188 |
+
/* read all file names into array and unlink from active theme template folder */
|
189 |
+
foreach(glob(PDF_TEMPLATE_LOCATION.'fonts/*.[tT][tT][fF]') as $file) {
|
190 |
+
|
191 |
+
$path_parts = pathinfo($file);
|
192 |
+
|
193 |
+
/*
|
194 |
+
* Check if the files already exist in the mPDF font folder
|
195 |
+
*/
|
196 |
+
if(!$wp_filesystem->exists(PDF_PLUGIN_DIR . 'mPDF/ttfonts/' . $path_parts['basename']))
|
197 |
+
{
|
198 |
+
/*
|
199 |
+
* copy ttf file to the mPDF font folder
|
200 |
+
*/
|
201 |
+
if($wp_filesystem->copy($file, PDF_PLUGIN_DIR . 'mPDF/ttfonts/' . $path_parts['basename']) === false)
|
202 |
+
{
|
203 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_err"));
|
204 |
+
return false;
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
/*
|
209 |
+
* Generate configuration information in preparation to write to file
|
210 |
+
*/
|
211 |
+
$write_to_file .= '
|
212 |
+
$this->fontdata[\''.$path_parts['filename'].'\'] = array(
|
213 |
+
\'R\' => \''.$path_parts['basename'].'\'
|
214 |
+
);';
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
/*
|
219 |
+
* Remove the old configuration file and put the contents of $write_to_file in a font configuration file
|
220 |
+
*/
|
221 |
+
$wp_filesystem->delete(PDF_TEMPLATE_LOCATION.'fonts/config.php');
|
222 |
+
if($wp_filesystem->put_contents(PDF_TEMPLATE_LOCATION.'fonts/config.php', $write_to_file) === false)
|
223 |
+
{
|
224 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_config_err"));
|
225 |
+
return false;
|
226 |
+
}
|
227 |
+
|
228 |
+
return true;
|
229 |
+
}
|
230 |
+
|
231 |
+
public function gf_pdf_font_install_success()
|
232 |
+
{
|
233 |
+
echo '<div id="message" class="updated"><p>';
|
234 |
+
echo 'The font files have been successfully installed. A font can be used by adding it\'s file name (without .ttf) in a CSS font-family declaration.';
|
235 |
+
echo '</p></div>';
|
236 |
+
}
|
237 |
+
|
238 |
+
public function gf_pdf_font_err()
|
239 |
+
{
|
240 |
+
echo '<div id="message" class="error"><p>';
|
241 |
+
echo 'There was a problem installing the font files. Manually copy your fonts to the mPDF/ttfonts/ folder.';
|
242 |
+
echo '</p></div>';
|
243 |
+
}
|
244 |
+
|
245 |
+
public function gf_pdf_font_config_err()
|
246 |
+
{
|
247 |
+
echo '<div id="message" class="error"><p>';
|
248 |
+
echo 'Could not create font configuration file. Try initialise again.';
|
249 |
+
echo '</p></div>';
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Gravity Forms hasn't been installed so throw error.
|
254 |
+
* We make sure the user hasn't already dismissed the error
|
255 |
+
*/
|
256 |
+
public function gf_pdf_not_installed()
|
257 |
+
{
|
258 |
+
echo '<div id="message" class="error"><p>';
|
259 |
+
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.';
|
260 |
+
echo '</p></div>';
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* PDF Extended has been updated but the new template files haven't been deployed yet
|
265 |
+
*/
|
266 |
+
public function gf_pdf_not_deployed()
|
267 |
+
{
|
268 |
+
if( (PDF_DEPLOY === true) && !rgpost('update') )
|
269 |
+
{
|
270 |
+
if(rgget("page") == 'gf_settings' && rgget('addon') == 'PDF')
|
271 |
+
{
|
272 |
+
echo '<div id="message" class="error"><p>';
|
273 |
+
echo 'You\'ve updated Gravity Forms PDF Extended but are yet to re-initialise the plugin. After initialising, please review the latest updates to ensure your custom templates remain compatible with the latest version.';
|
274 |
+
echo '</p></div>';
|
275 |
+
|
276 |
+
}
|
277 |
+
else
|
278 |
+
{
|
279 |
+
echo '<div id="message" class="error"><p>';
|
280 |
+
echo 'You\'ve updated Gravity Forms PDF Extended but are yet to re-initialise the plugin. Please go to the <a href="'.PDF_SETTINGS_URL.'">plugin\'s settings page</a> to initialise.';
|
281 |
+
echo '</p></div>';
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* PDF Extended has been freshly installed
|
288 |
+
*/
|
289 |
+
public function gf_pdf_not_deployed_fresh()
|
290 |
+
{
|
291 |
+
if( (PDF_DEPLOY === true) && !rgpost('update') )
|
292 |
+
{
|
293 |
+
if(rgget("page") == 'gf_settings' && rgget('addon') == 'PDF')
|
294 |
+
{
|
295 |
+
echo '<div id="message" class="updated"><p>';
|
296 |
+
echo 'Welcome to Gravity Forms PDF Extended. Before you can use the plugin correctly you need to initilise it.';
|
297 |
+
echo '</p></div>';
|
298 |
+
|
299 |
+
}
|
300 |
+
else
|
301 |
+
{
|
302 |
+
echo '<div id="message" class="updated"><p>';
|
303 |
+
echo 'Welcome to Gravity Forms PDF Extended. Before you can use the plugin correctly you need to initilise it. Please go to the <a href="'.PDF_SETTINGS_URL.'">plugin\'s settings page</a> to initialise.';
|
304 |
+
echo '</p></div>';
|
305 |
+
}
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* The Gravity Forms version isn't compatible. Prompt user to upgrade
|
311 |
+
*/
|
312 |
+
public function gf_pdf_not_supported()
|
313 |
+
{
|
314 |
+
echo '<div id="message" class="error"><p>';
|
315 |
+
echo 'Gravity Forms PDF Extended only works with Gravity Forms version '.GF_PDF_EXTENDED_SUPPORTED_VERSION.' and higher. Please <a href="https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154" target="ejejcsingle">upgrade your copy of Gravity Forms</a> to use this plugin.';
|
316 |
+
echo '</p></div>';
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Cannot create new template folder in active theme directory
|
322 |
+
*/
|
323 |
+
public function gf_pdf_template_dir_err()
|
324 |
+
{
|
325 |
+
echo '<div id="message" class="error"><p>';
|
326 |
+
echo 'We could not create a template folder in your active theme\'s directory. Please created a folder called <strong>\''. PDF_SAVE_FOLDER .'\'</strong> in '.get_stylesheet_directory().'/. Then copy the contents of '.PDF_PLUGIN_DIR.'templates/ to your newly-created PDF_EXTENDED_TEMPLATES folder, as well as styles/template.css. You should also make this directory writable.';
|
327 |
+
echo '</p></div>';
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
public static function gf_pdf_unzip_mpdf_err()
|
332 |
+
{
|
333 |
+
echo '<div id="message" class="error"><p>';
|
334 |
+
echo 'Could not unzip mPDF.zip (located in the plugin folder). Unzip the file manually, place the extracted mPDF folder in the plugin folder and run the initialisation again.';
|
335 |
+
echo '</p></div>';
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Cannot remove old default template files
|
340 |
+
*/
|
341 |
+
public function gf_pdf_deployment_unlink_error()
|
342 |
+
{
|
343 |
+
echo '<div id="message" class="error"><p>';
|
344 |
+
echo 'We could not remove the default template files from the Gravity Forms PDF Extended folder in your active theme\'s directory. Please manually remove all files starting with \'default-\' and the template.css file.';
|
345 |
+
echo '</p></div>';
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Cannot create new template folder in active theme directory
|
351 |
+
*/
|
352 |
+
public function gf_pdf_template_move_err()
|
353 |
+
{
|
354 |
+
echo '<div id="message" class="error"><p>';
|
355 |
+
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..';
|
356 |
+
echo '</p></div>';
|
357 |
+
|
358 |
+
}
|
359 |
+
|
360 |
+
/*
|
361 |
+
* When switching themes copy over current active theme's PDF_EXTENDED_TEMPLATES (if it exists) to new theme folder
|
362 |
+
*/
|
363 |
+
public function gf_pdf_on_switch_theme($old_theme_name, $old_theme_object) {
|
364 |
+
|
365 |
+
/*
|
366 |
+
* We will store the old pdf dir and new pdf directory and prompt the user to copy the PDF_EXTENDED_TEMPLATES folder
|
367 |
+
*/
|
368 |
+
$previous_theme_directory = $old_theme_object->get_stylesheet_directory();
|
369 |
+
|
370 |
+
$current_theme_array = wp_get_theme();
|
371 |
+
$current_theme_directory = $current_theme_array->get_stylesheet_directory();
|
372 |
+
|
373 |
+
/*
|
374 |
+
* Add the save folder name to the end of the paths
|
375 |
+
*/
|
376 |
+
$old_pdf_path = $previous_theme_directory . '/' . PDF_SAVE_FOLDER;
|
377 |
+
$new_pdf_path = $current_theme_directory . '/' . PDF_SAVE_FOLDER;
|
378 |
+
|
379 |
+
update_option('gfpdfe_switch_theme', array('old' => $old_pdf_path, 'new' => $new_pdf_path));
|
380 |
+
}
|
381 |
+
|
382 |
+
/*
|
383 |
+
* Check if a theme switch has been made recently
|
384 |
+
* If it has then prompt the user to move the files
|
385 |
+
*/
|
386 |
+
public static function check_theme_switch()
|
387 |
+
{
|
388 |
+
$theme_switch = get_option('gfpdfe_switch_theme');
|
389 |
+
if(isset($theme_switch['old']) && isset($theme_switch['new']))
|
390 |
+
{
|
391 |
+
/*
|
392 |
+
* Add admin notification hook to move the files
|
393 |
+
*/
|
394 |
+
add_action('admin_notices', array("GFPDF_InstallUpdater", "do_theme_switch_notice"));
|
395 |
+
return true;
|
396 |
+
}
|
397 |
+
return false;
|
398 |
+
}
|
399 |
+
|
400 |
+
/*
|
401 |
+
* Prompt user to keep the plugin working
|
402 |
+
*/
|
403 |
+
public static function do_theme_switch_notice()
|
404 |
+
{
|
405 |
+
/*
|
406 |
+
* Check we aren't in the middle of doing the sync
|
407 |
+
*/
|
408 |
+
if(isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'gfpdfe_sync_now'))
|
409 |
+
{
|
410 |
+
return;
|
411 |
+
}
|
412 |
+
|
413 |
+
echo '<div id="message" class="error"><p>';
|
414 |
+
echo 'Gravity Forms PDF Extended needs to keep the PDF_EXTENDED_TEMPLATE folder in sync with your current active theme. <a href="'. wp_nonce_url(PDF_SETTINGS_URL, 'gfpdfe_sync_now') . '" class="button">Sync Now</a>';
|
415 |
+
echo '</p></div>';
|
416 |
+
|
417 |
+
}
|
418 |
+
|
419 |
+
public static function gf_pdf_theme_sync_success()
|
420 |
+
{
|
421 |
+
echo '<div id="message" class="updated"><p>';
|
422 |
+
echo 'PDF_EXTENDED_TEMPLATE folder successfully synced.';
|
423 |
+
echo '</p></div>';
|
424 |
+
}
|
425 |
+
|
426 |
+
/*
|
427 |
+
* The after_switch_theme hook is too early in the initialisation to use request_filesystem_credentials()
|
428 |
+
* so we have to call this function at a later inteval
|
429 |
+
*/
|
430 |
+
public function do_theme_switch($previous_pdf_path, $current_pdf_path)
|
431 |
+
{
|
432 |
+
/*
|
433 |
+
* Prepare for calling the WP Filesystem
|
434 |
+
* It only allows post data to be added so we have to manually assign them
|
435 |
+
*/
|
436 |
+
$_POST['previous_pdf_path'] = $previous_pdf_path;
|
437 |
+
$_POST['current_pdf_path'] = $current_pdf_path;
|
438 |
+
|
439 |
+
/*
|
440 |
+
* Initialise the Wordpress Filesystem API
|
441 |
+
*/
|
442 |
+
if(PDF_Common::initialise_WP_filesystem_API(array('previous_pdf_path', 'current_pdf_path'), 'gfpdfe_sync_now') === false)
|
443 |
+
{
|
444 |
+
return false;
|
445 |
+
}
|
446 |
+
|
447 |
+
/*
|
448 |
+
* If we got here we should have $wp_filesystem available
|
449 |
+
*/
|
450 |
+
global $wp_filesystem;
|
451 |
+
|
452 |
+
if($wp_filesystem->is_dir($previous_pdf_path))
|
453 |
+
{
|
454 |
+
self::pdf_extended_copy_directory( $previous_pdf_path, $current_pdf_path, true, true );
|
455 |
+
}
|
456 |
+
|
457 |
+
/*
|
458 |
+
* Remove the options key that triggers the switch theme function
|
459 |
+
*/
|
460 |
+
delete_option('gfpdfe_switch_theme');
|
461 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_theme_sync_success"));
|
462 |
+
|
463 |
+
/*
|
464 |
+
* Show success message to user
|
465 |
+
*/
|
466 |
+
return true;
|
467 |
+
}
|
468 |
+
|
469 |
+
/*
|
470 |
+
* Allows you to copy entire folder structures to new location
|
471 |
+
*/
|
472 |
+
|
473 |
+
public function pdf_extended_copy_directory( $source, $destination, $copy_base = true, $delete_destination = false )
|
474 |
+
{
|
475 |
+
global $wp_filesystem;
|
476 |
+
|
477 |
+
if ( $wp_filesystem->is_dir( $source ) )
|
478 |
+
{
|
479 |
+
if($delete_destination === true)
|
480 |
+
{
|
481 |
+
/*
|
482 |
+
* To ensure everything stays in sync we will remove the destination file structure
|
483 |
+
*/
|
484 |
+
$wp_filesystem->delete($destination, true);
|
485 |
+
}
|
486 |
+
|
487 |
+
if($copy_base === true)
|
488 |
+
{
|
489 |
+
$wp_filesystem->mkdir( $destination );
|
490 |
+
}
|
491 |
+
$directory = dir( $source );
|
492 |
+
while ( FALSE !== ( $readdirectory = $directory->read() ) )
|
493 |
+
{
|
494 |
+
|
495 |
+
if ( $readdirectory === '.' || $readdirectory === '..' )
|
496 |
+
{
|
497 |
+
continue;
|
498 |
+
}
|
499 |
+
|
500 |
+
$PathDir = $source . '/' . $readdirectory;
|
501 |
+
|
502 |
+
if ( $wp_filesystem->is_dir( $PathDir ) )
|
503 |
+
{
|
504 |
+
self::pdf_extended_copy_directory( $PathDir, $destination . '/' . $readdirectory );
|
505 |
+
continue;
|
506 |
+
}
|
507 |
+
$wp_filesystem->copy( $PathDir, $destination . '/' . $readdirectory );
|
508 |
+
}
|
509 |
+
|
510 |
+
$directory->close();
|
511 |
+
}
|
512 |
+
else
|
513 |
+
{
|
514 |
+
$wp_filesystem->copy( $source, $destination );
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
518 |
+
}
|
languages/pdfextended-en_GB.po
DELETED
@@ -1,856 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Gravity PDF\n"
|
4 |
-
"POT-Creation-Date: 2014-12-04 13:00+1000\n"
|
5 |
-
"PO-Revision-Date: 2014-12-04 13:00+1000\n"
|
6 |
-
"Last-Translator: Blue Liquid Designs <enquire@blueliquiddesigns.com.au>\n"
|
7 |
-
"Language-Team: <enquire@blueliquiddesigns.com.au>\n"
|
8 |
-
"Language: en\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.6.5\n"
|
13 |
-
"X-Poedit-KeywordsList: __;_e\n"
|
14 |
-
"X-Poedit-Basepath: /\n"
|
15 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
-
"X-Poedit-SearchPath-0: G:\\Blue Liquid Designs\\4) BLUE LIQUID DESIGNS\\19) "
|
17 |
-
"Gravity PDF\\1) github\n"
|
18 |
-
|
19 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
20 |
-
#: EXTENDED\1) github/helper/api.php:142
|
21 |
-
msgid "Bad Request."
|
22 |
-
msgstr ""
|
23 |
-
|
24 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
25 |
-
#: EXTENDED\1) github/helper/api.php:150 github/helper/api.php:261
|
26 |
-
msgid "Unauthorized Access."
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
30 |
-
#: EXTENDED\1) github/helper/api.php:172
|
31 |
-
msgid "Method not allowed."
|
32 |
-
msgstr ""
|
33 |
-
|
34 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
35 |
-
#: EXTENDED\1) github/helper/api.php:180
|
36 |
-
msgid "Internal API Error."
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
40 |
-
#: EXTENDED\1) github/helper/api.php:188
|
41 |
-
msgid "API Unavailable."
|
42 |
-
msgstr ""
|
43 |
-
|
44 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
45 |
-
#: EXTENDED\1) github/helper/notices.php:54
|
46 |
-
#, php-format
|
47 |
-
msgid "%sGravity PDF Automated Installer%s: "
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
51 |
-
#: EXTENDED\1) github/helper/notices.php:64
|
52 |
-
#, php-format
|
53 |
-
msgid " %sGo to installer%s."
|
54 |
-
msgstr ""
|
55 |
-
|
56 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
57 |
-
#: EXTENDED\1) github/helper/notices.php:74
|
58 |
-
msgid ""
|
59 |
-
"The font files have been successfully installed. A font can be used by "
|
60 |
-
"adding its file name (without .ttf) in a CSS font-family declaration."
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
64 |
-
#: EXTENDED\1) github/helper/notices.php:85
|
65 |
-
msgid "Could not create font configuration file. Try initialise again."
|
66 |
-
msgstr ""
|
67 |
-
|
68 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
69 |
-
#: EXTENDED\1) github/helper/notices.php:101
|
70 |
-
msgid ""
|
71 |
-
"Gravity PDF detected a configuration problem. Please "
|
72 |
-
"reinitialise the plugin."
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
76 |
-
#: EXTENDED\1) github/helper/notices.php:105
|
77 |
-
#, php-format
|
78 |
-
msgid ""
|
79 |
-
"Gravity PDF detected a configuration problem. Please go to "
|
80 |
-
"the %splugin's settings page%s to reinitialise."
|
81 |
-
msgstr ""
|
82 |
-
|
83 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
84 |
-
#: EXTENDED\1) github/helper/notices.php:122
|
85 |
-
msgid ""
|
86 |
-
"Gravity PDF detected a server compatibility problem which "
|
87 |
-
"prevented the software from running. See the System Status section below for "
|
88 |
-
"details."
|
89 |
-
msgstr ""
|
90 |
-
|
91 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
92 |
-
#: EXTENDED\1) github/helper/notices.php:126
|
93 |
-
#, php-format
|
94 |
-
msgid ""
|
95 |
-
"Gravity PDF detected a server compatibility problem which "
|
96 |
-
"prevented the software from running. Please go to the %splugin's settings "
|
97 |
-
"page%s to view the issue."
|
98 |
-
msgstr ""
|
99 |
-
|
100 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
101 |
-
#: EXTENDED\1) github/helper/notices.php:142
|
102 |
-
msgid ""
|
103 |
-
"Welcome to Gravity PDF. Before you can use the plugin "
|
104 |
-
"correctly you need to initilise it."
|
105 |
-
msgstr ""
|
106 |
-
|
107 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
108 |
-
#: EXTENDED\1) github/helper/notices.php:146
|
109 |
-
#, php-format
|
110 |
-
msgid ""
|
111 |
-
"Welcome to Gravity PDF. Before you can use the plugin "
|
112 |
-
"correctly you need to initilise it. Please go to the %splugin's settings page"
|
113 |
-
"%s to initialise."
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
117 |
-
#: EXTENDED\1) github/helper/notices.php:158
|
118 |
-
#, php-format
|
119 |
-
msgid ""
|
120 |
-
"Gravity PDF only works with Gravity Forms version %s and "
|
121 |
-
"higher. Please %supgrade your copy of Gravity Forms%s to use this plugin."
|
122 |
-
msgstr ""
|
123 |
-
|
124 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
125 |
-
#: EXTENDED\1) github/helper/notices.php:174
|
126 |
-
#, php-format
|
127 |
-
msgid ""
|
128 |
-
"We could not create a template folder in your uploads directory. Please "
|
129 |
-
"ensure %s is writable by your web server and try again."
|
130 |
-
msgstr ""
|
131 |
-
|
132 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
133 |
-
#: EXTENDED\1) github/helper/notices.php:189
|
134 |
-
#, php-format
|
135 |
-
msgid ""
|
136 |
-
"We could not create a site folder in your uploads/%s directory. Please "
|
137 |
-
"ensure %s is writable by your web server and try again."
|
138 |
-
msgstr ""
|
139 |
-
|
140 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
141 |
-
#: EXTENDED\1) github/helper/notices.php:202
|
142 |
-
#, php-format
|
143 |
-
msgid ""
|
144 |
-
"We could not remove the default template files from %s in your uploads "
|
145 |
-
"directory. Please ensure %s is wriable by your web server and try again."
|
146 |
-
msgstr ""
|
147 |
-
|
148 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
149 |
-
#: EXTENDED\1) github/helper/notices.php:215
|
150 |
-
#, php-format
|
151 |
-
msgid ""
|
152 |
-
"We could not move the template files to the %s folder. Please ensure %s is "
|
153 |
-
"wriable by your web server and try again."
|
154 |
-
msgstr ""
|
155 |
-
|
156 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
157 |
-
#: EXTENDED\1) github/helper/notices.php:233
|
158 |
-
#, php-format
|
159 |
-
msgid ""
|
160 |
-
"Gravity PDF directory structure has been changed. %sMigrate "
|
161 |
-
"Now%s %sUnsure what this means?%s"
|
162 |
-
msgstr ""
|
163 |
-
|
164 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
165 |
-
#: EXTENDED\1) github/helper/notices.php:242
|
166 |
-
#, php-format
|
167 |
-
msgid "%sGravity PDF Automated Template Migration:%s"
|
168 |
-
msgstr ""
|
169 |
-
|
170 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
171 |
-
#: EXTENDED\1) github/helper/notices.php:244
|
172 |
-
#, php-format
|
173 |
-
msgid ""
|
174 |
-
"Your PDF template folder structure was successfully migrated to %s. %sUnsure "
|
175 |
-
"what this means?%s"
|
176 |
-
msgstr ""
|
177 |
-
|
178 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
179 |
-
#: EXTENDED\1) github/helper/notices.php:256
|
180 |
-
msgid ""
|
181 |
-
"Gravity PDF Auto Initialisation Complete across the entire "
|
182 |
-
"network."
|
183 |
-
msgstr ""
|
184 |
-
|
185 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
186 |
-
#: EXTENDED\1) github/helper/notices.php:260
|
187 |
-
msgid ""
|
188 |
-
"Gravity PDF Initialisation Complete across the entire network."
|
189 |
-
msgstr ""
|
190 |
-
|
191 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
192 |
-
#: EXTENDED\1) github/helper/notices.php:265 github/helper/notices.php:277
|
193 |
-
#, php-format
|
194 |
-
msgid "%sLearn how to configuring the plugin%s."
|
195 |
-
msgstr ""
|
196 |
-
|
197 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
198 |
-
#: EXTENDED\1) github/helper/notices.php:273
|
199 |
-
msgid "Gravity PDF Auto Initialisation Complete."
|
200 |
-
msgstr ""
|
201 |
-
|
202 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
203 |
-
#: EXTENDED\1) github/helper/notices.php:291
|
204 |
-
msgid ""
|
205 |
-
"There was a problem merging the PDF templates folder on the following sites;"
|
206 |
-
msgstr ""
|
207 |
-
|
208 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
209 |
-
#: EXTENDED\1) github/helper/notices.php:304
|
210 |
-
msgid ""
|
211 |
-
"Follow the site links above and try run the PDF template merging function "
|
212 |
-
"again, or reinitialise the software."
|
213 |
-
msgstr ""
|
214 |
-
|
215 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
216 |
-
#: EXTENDED\1) github/helper/notices.php:308
|
217 |
-
msgid ""
|
218 |
-
"An unknown error occured while merging the PDF template folders. Please try "
|
219 |
-
"again."
|
220 |
-
msgstr ""
|
221 |
-
|
222 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
223 |
-
#: EXTENDED\1) github/helper/notices.php:323
|
224 |
-
msgid "There was a network initialisation issue on the following sites;"
|
225 |
-
msgstr ""
|
226 |
-
|
227 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
228 |
-
#: EXTENDED\1) github/helper/notices.php:336
|
229 |
-
msgid "Please try manually initialise the software"
|
230 |
-
msgstr ""
|
231 |
-
|
232 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
233 |
-
#: EXTENDED\1) github/helper/notices.php:340
|
234 |
-
msgid ""
|
235 |
-
"An unknown network initialisation error occured. Please try initialise again."
|
236 |
-
msgstr ""
|
237 |
-
|
238 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
239 |
-
#: EXTENDED\1) github/helper/notices.php:347
|
240 |
-
msgid "You've successfully initialised Gravity PDF."
|
241 |
-
msgstr ""
|
242 |
-
|
243 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
244 |
-
#: EXTENDED\1) github/helper/notices.php:354
|
245 |
-
#: github/view/templates/settings/system-status.php:34
|
246 |
-
#: github/view/templates/settings/system-status.php:41
|
247 |
-
msgid "Gravity Forms "
|
248 |
-
msgstr ""
|
249 |
-
|
250 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
251 |
-
#: EXTENDED\1) github/helper/notices.php:360
|
252 |
-
msgid "Wordpress "
|
253 |
-
msgstr ""
|
254 |
-
|
255 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
256 |
-
#: EXTENDED\1) github/helper/notices.php:366
|
257 |
-
msgid "PHP "
|
258 |
-
msgstr ""
|
259 |
-
|
260 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
261 |
-
#: EXTENDED\1) github/helper/notices.php:372
|
262 |
-
#, php-format
|
263 |
-
msgid ""
|
264 |
-
"If you reinitialise and enable this option %syou will overwrite%s the "
|
265 |
-
"default and example template files in your active theme directory."
|
266 |
-
msgstr ""
|
267 |
-
|
268 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
269 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:255
|
270 |
-
msgid "Order"
|
271 |
-
msgstr ""
|
272 |
-
|
273 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
274 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:266
|
275 |
-
msgid "Product"
|
276 |
-
msgstr ""
|
277 |
-
|
278 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
279 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:267
|
280 |
-
msgid "Qty"
|
281 |
-
msgstr ""
|
282 |
-
|
283 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
284 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:268
|
285 |
-
msgid "Unit Price"
|
286 |
-
msgstr ""
|
287 |
-
|
288 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
289 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:269
|
290 |
-
msgid "Price"
|
291 |
-
msgstr ""
|
292 |
-
|
293 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
294 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:332
|
295 |
-
msgid "Total"
|
296 |
-
msgstr ""
|
297 |
-
|
298 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
299 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:940
|
300 |
-
msgid ""
|
301 |
-
"Activate Gravity Forms Quiz Add On to see global quiz statistics for this "
|
302 |
-
"form"
|
303 |
-
msgstr ""
|
304 |
-
|
305 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
306 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1371
|
307 |
-
#: github/helper/pdf-entry-detail.php:1746
|
308 |
-
msgid "Qty: "
|
309 |
-
msgstr ""
|
310 |
-
|
311 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
312 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1371
|
313 |
-
#: github/helper/pdf-entry-detail.php:1746
|
314 |
-
msgid "Price: "
|
315 |
-
msgstr ""
|
316 |
-
|
317 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
318 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1680
|
319 |
-
msgid "Title"
|
320 |
-
msgstr ""
|
321 |
-
|
322 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
323 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1681
|
324 |
-
msgid "Caption"
|
325 |
-
msgstr ""
|
326 |
-
|
327 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
328 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1682
|
329 |
-
msgid "Description"
|
330 |
-
msgstr ""
|
331 |
-
|
332 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
333 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1687
|
334 |
-
#: github/helper/pdf-entry-detail.php:1706
|
335 |
-
msgid "Click to view"
|
336 |
-
msgstr ""
|
337 |
-
|
338 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
339 |
-
#: EXTENDED\1) github/model/pdf.php:142
|
340 |
-
msgid "View"
|
341 |
-
msgstr ""
|
342 |
-
|
343 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
344 |
-
#: EXTENDED\1) github/model/pdf.php:143
|
345 |
-
msgid "Download"
|
346 |
-
msgstr ""
|
347 |
-
|
348 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
349 |
-
#: EXTENDED\1) github/model/pdf.php:199
|
350 |
-
msgid "View PDFs"
|
351 |
-
msgstr ""
|
352 |
-
|
353 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
354 |
-
#: EXTENDED\1) github/model/pdf.php:234
|
355 |
-
msgid "View PDF"
|
356 |
-
msgstr ""
|
357 |
-
|
358 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
359 |
-
#: EXTENDED\1) github/model/pdf.php:321
|
360 |
-
msgid "Access Denied"
|
361 |
-
msgstr ""
|
362 |
-
|
363 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
364 |
-
#: EXTENDED\1) github/model/settings.php:359
|
365 |
-
msgid "Plugin not yet initialised"
|
366 |
-
msgstr ""
|
367 |
-
|
368 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
369 |
-
#: EXTENDED\1) github/model/settings.php:414
|
370 |
-
msgid ""
|
371 |
-
"There was a problem with your submission. Please reload the page and try "
|
372 |
-
"again"
|
373 |
-
msgstr ""
|
374 |
-
|
375 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
376 |
-
#: EXTENDED\1) github/model/settings.php:431
|
377 |
-
msgid "Please enter a valid email address"
|
378 |
-
msgstr ""
|
379 |
-
|
380 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
381 |
-
#: EXTENDED\1) github/model/settings.php:434
|
382 |
-
msgid "Problem"
|
383 |
-
msgstr ""
|
384 |
-
|
385 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
386 |
-
#: EXTENDED\1) github/model/settings.php:434
|
387 |
-
msgid "Question"
|
388 |
-
msgstr ""
|
389 |
-
|
390 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
391 |
-
#: EXTENDED\1) github/model/settings.php:434
|
392 |
-
msgid "Suggestion"
|
393 |
-
msgstr ""
|
394 |
-
|
395 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
396 |
-
#: EXTENDED\1) github/model/settings.php:438
|
397 |
-
msgid "Please select a valid support type."
|
398 |
-
msgstr ""
|
399 |
-
|
400 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
401 |
-
#: EXTENDED\1) github/model/settings.php:443
|
402 |
-
msgid ""
|
403 |
-
"Please enter information about your support query so we can aid you more "
|
404 |
-
"easily."
|
405 |
-
msgstr ""
|
406 |
-
|
407 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
408 |
-
#: EXTENDED\1) github/model/settings.php:448
|
409 |
-
msgid ""
|
410 |
-
"There is a problem with your support request. Please correct the marked "
|
411 |
-
"issues above."
|
412 |
-
msgstr ""
|
413 |
-
|
414 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
415 |
-
#: EXTENDED\1) github/model/settings.php:458
|
416 |
-
msgid ""
|
417 |
-
"Thank you for your support request. We'll respond to your request in the "
|
418 |
-
"next 24-48 hours."
|
419 |
-
msgstr ""
|
420 |
-
|
421 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
422 |
-
#: EXTENDED\1) github/model/settings.php:516
|
423 |
-
msgid "Support request received. We will responed in 24 to 48 hours."
|
424 |
-
msgstr ""
|
425 |
-
|
426 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
427 |
-
#: EXTENDED\1) github/view/templates/settings/changelog.php:19
|
428 |
-
msgid "Changelog"
|
429 |
-
msgstr ""
|
430 |
-
|
431 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
432 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:41
|
433 |
-
msgid "Gravity PDF"
|
434 |
-
msgstr ""
|
435 |
-
|
436 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
437 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:42
|
438 |
-
msgid ""
|
439 |
-
"Your web server isn't compatible with Gravity PDF. Please see "
|
440 |
-
"the problem areas below."
|
441 |
-
msgstr ""
|
442 |
-
|
443 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
444 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:52
|
445 |
-
msgid "Can't Resolve the Issue?"
|
446 |
-
msgstr ""
|
447 |
-
|
448 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
449 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:53
|
450 |
-
#, php-format
|
451 |
-
msgid ""
|
452 |
-
"Does Gravity PDF detect a problem that your web host won't "
|
453 |
-
"fix? %sWe recommend you move to a quality web hosting service like WP Engine"
|
454 |
-
"%s which runs our software straight out of the box."
|
455 |
-
msgstr ""
|
456 |
-
|
457 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
458 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:19
|
459 |
-
msgid "Welcome to Gravity PDF"
|
460 |
-
msgstr ""
|
461 |
-
|
462 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
463 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:19
|
464 |
-
#: github/view/templates/settings/initialisation.php:66
|
465 |
-
msgid "Initialise Plugin"
|
466 |
-
msgstr ""
|
467 |
-
|
468 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
469 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:23
|
470 |
-
msgid ""
|
471 |
-
"The plugin has successfully installed and is ready to start automating your "
|
472 |
-
"documents."
|
473 |
-
msgstr ""
|
474 |
-
|
475 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
476 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:25
|
477 |
-
msgid "What's next?"
|
478 |
-
msgstr ""
|
479 |
-
|
480 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
481 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:26
|
482 |
-
msgid ""
|
483 |
-
"The next step is to correctly configured the plugin so that you can generate "
|
484 |
-
"PDF documents."
|
485 |
-
msgstr ""
|
486 |
-
|
487 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
488 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:27
|
489 |
-
msgid ""
|
490 |
-
"To help you get started, we've put together a five-part video series with "
|
491 |
-
"the most common plugin configurations."
|
492 |
-
msgstr ""
|
493 |
-
|
494 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
495 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:29
|
496 |
-
msgid "The Basics: Only Download PDF through the Admin Area"
|
497 |
-
msgstr ""
|
498 |
-
|
499 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
500 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:30
|
501 |
-
msgid "The Email: Send Completed PDF via Email"
|
502 |
-
msgstr ""
|
503 |
-
|
504 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
505 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:31
|
506 |
-
msgid ""
|
507 |
-
"The Download: User Downloads PDF after Submitting Form (using a link or auto "
|
508 |
-
"redirecting)"
|
509 |
-
msgstr ""
|
510 |
-
|
511 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
512 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:32
|
513 |
-
msgid "The Email Advanced: Manually Review User Submission before Emailing PDF"
|
514 |
-
msgstr ""
|
515 |
-
|
516 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
517 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:33
|
518 |
-
msgid "The Payment: Send PDF after Capturing Payment using Paypal Standard"
|
519 |
-
msgstr ""
|
520 |
-
|
521 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
522 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:36
|
523 |
-
#, php-format
|
524 |
-
msgid ""
|
525 |
-
"If you know little about PHP we recommend starting with %sPart 1:The Basics"
|
526 |
-
"%s and then watching the tutorial you’re interested in. It will give you the "
|
527 |
-
"foundational skills you need to configure the software."
|
528 |
-
msgstr ""
|
529 |
-
|
530 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
531 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:38
|
532 |
-
msgid "Custom Templates"
|
533 |
-
msgstr ""
|
534 |
-
|
535 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
536 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:39
|
537 |
-
#, php-format
|
538 |
-
msgid ""
|
539 |
-
"Creating a custom template gives you ultimate control of the look and feel "
|
540 |
-
"of your documents using only HTML and CSS. %sWe recommend you review our "
|
541 |
-
"online documentation%s to create and customise your template files."
|
542 |
-
msgstr ""
|
543 |
-
|
544 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
545 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:45
|
546 |
-
msgid ""
|
547 |
-
"To complete the installation, Gravity PDF needs to be "
|
548 |
-
"initialised."
|
549 |
-
msgstr ""
|
550 |
-
|
551 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
552 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:47
|
553 |
-
msgid "What does initialisation do?"
|
554 |
-
msgstr ""
|
555 |
-
|
556 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
557 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:50
|
558 |
-
msgid "Install the template files"
|
559 |
-
msgstr ""
|
560 |
-
|
561 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
562 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:50
|
563 |
-
msgid ""
|
564 |
-
"We create a folder called PDF_EXTENDED_TEMPLATE in your active theme "
|
565 |
-
"directory and move over all the templates and configuration files. This "
|
566 |
-
"folder is where you'll look to configure the software and create your PDF "
|
567 |
-
"templates."
|
568 |
-
msgstr ""
|
569 |
-
|
570 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
571 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:62
|
572 |
-
msgid "Have a problem with the software?"
|
573 |
-
msgstr ""
|
574 |
-
|
575 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
576 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:63
|
577 |
-
msgid ""
|
578 |
-
"Did you switch themes and something went wrong syncing the template folder? "
|
579 |
-
"Try reinitialise the software."
|
580 |
-
msgstr ""
|
581 |
-
|
582 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
583 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:66
|
584 |
-
msgid "Reinitialise Plugin"
|
585 |
-
msgstr ""
|
586 |
-
|
587 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
588 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:68
|
589 |
-
msgid "Reinstall Default and Example Templates"
|
590 |
-
msgstr ""
|
591 |
-
|
592 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
593 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:74
|
594 |
-
msgid "Install a new font?"
|
595 |
-
msgstr ""
|
596 |
-
|
597 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
598 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:75
|
599 |
-
#, php-format
|
600 |
-
msgid ""
|
601 |
-
"Do you want to use a custom font in your template? %sSee our documentation "
|
602 |
-
"on how to correctly install and use a custom font%s before initialising "
|
603 |
-
"below."
|
604 |
-
msgstr ""
|
605 |
-
|
606 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
607 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:76
|
608 |
-
msgid "Initialise Fonts"
|
609 |
-
msgstr ""
|
610 |
-
|
611 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
612 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:26
|
613 |
-
msgid ""
|
614 |
-
"Gravity PDF's support hours are from 9:00am-5:00pm Monday to "
|
615 |
-
"Friday, Sydney Australia time."
|
616 |
-
msgstr ""
|
617 |
-
|
618 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
619 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:29
|
620 |
-
#, php-format
|
621 |
-
msgid "The current time in Sydney Australia is %s."
|
622 |
-
msgstr ""
|
623 |
-
|
624 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
625 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:55
|
626 |
-
msgid "Enter the email address you want us to contact you on."
|
627 |
-
msgstr ""
|
628 |
-
|
629 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
630 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:56
|
631 |
-
msgid ""
|
632 |
-
"Note: To ensure the best support possible, please use the above email to "
|
633 |
-
"respond to all support communications."
|
634 |
-
msgstr ""
|
635 |
-
|
636 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
637 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:92
|
638 |
-
msgid "Enter as much detail about the problem as you can."
|
639 |
-
msgstr ""
|
640 |
-
|
641 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
642 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:93
|
643 |
-
msgid "Please enter as much detail about the problem as you can."
|
644 |
-
msgstr ""
|
645 |
-
|
646 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
647 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:94
|
648 |
-
msgid "Note: Our support representatives can only communicate in English."
|
649 |
-
msgstr ""
|
650 |
-
|
651 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
652 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:97
|
653 |
-
msgid "Request Support"
|
654 |
-
msgstr ""
|
655 |
-
|
656 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
657 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:20
|
658 |
-
msgid "Frequently Asked Questions"
|
659 |
-
msgstr ""
|
660 |
-
|
661 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
662 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:22
|
663 |
-
msgid "Can I exclude a field from showing up in the PDF?"
|
664 |
-
msgstr ""
|
665 |
-
|
666 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
667 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:23
|
668 |
-
msgid ""
|
669 |
-
"I want to have multiple PDF template files generated on one form. How do I "
|
670 |
-
"do it?"
|
671 |
-
msgstr ""
|
672 |
-
|
673 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
674 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:24
|
675 |
-
msgid "I want users to be able to download the PDF from the server."
|
676 |
-
msgstr ""
|
677 |
-
|
678 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
679 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:25
|
680 |
-
msgid "How do I change the PDF size or create a landscape PDF?"
|
681 |
-
msgstr ""
|
682 |
-
|
683 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
684 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:26
|
685 |
-
msgid ""
|
686 |
-
"I am created a custom template. How do I know the names of my fields in the "
|
687 |
-
"$form_data array?"
|
688 |
-
msgstr ""
|
689 |
-
|
690 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
691 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:27
|
692 |
-
msgid "How large a PDF are you able to create/process?"
|
693 |
-
msgstr ""
|
694 |
-
|
695 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
696 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:30
|
697 |
-
#, php-format
|
698 |
-
msgid ""
|
699 |
-
"Got a question that isn't answered above? %sHead to our support forum%s and "
|
700 |
-
"let us know."
|
701 |
-
msgstr ""
|
702 |
-
|
703 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
704 |
-
#: EXTENDED\1) github/view/templates/settings/support.php:20
|
705 |
-
msgid "Support"
|
706 |
-
msgstr ""
|
707 |
-
|
708 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
709 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:19
|
710 |
-
msgid "System Status"
|
711 |
-
msgstr ""
|
712 |
-
|
713 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
714 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:22
|
715 |
-
msgid "Wordpress Version"
|
716 |
-
msgstr ""
|
717 |
-
|
718 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
719 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:25
|
720 |
-
msgid "Wordpress Version "
|
721 |
-
msgstr ""
|
722 |
-
|
723 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
724 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:30
|
725 |
-
msgid "Gravity Forms"
|
726 |
-
msgstr ""
|
727 |
-
|
728 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
729 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:32
|
730 |
-
msgid "Not Installed"
|
731 |
-
msgstr ""
|
732 |
-
|
733 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
734 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:47
|
735 |
-
msgid "PHP Version"
|
736 |
-
msgstr ""
|
737 |
-
|
738 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
739 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:50
|
740 |
-
msgid "PHP Version "
|
741 |
-
msgstr ""
|
742 |
-
|
743 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
744 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:54
|
745 |
-
msgid "MB String"
|
746 |
-
msgstr ""
|
747 |
-
|
748 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
749 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:54
|
750 |
-
#: github/view/templates/settings/system-status.php:62
|
751 |
-
#: github/view/templates/settings/system-status.php:94
|
752 |
-
#: github/view/templates/settings/system-status.php:103
|
753 |
-
#: github/view/templates/settings/system-status.php:110
|
754 |
-
#: github/view/templates/settings/system-status.php:117
|
755 |
-
msgid "Yes"
|
756 |
-
msgstr ""
|
757 |
-
|
758 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
759 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:54
|
760 |
-
#: github/view/templates/settings/system-status.php:62
|
761 |
-
#: github/view/templates/settings/system-status.php:94
|
762 |
-
#: github/view/templates/settings/system-status.php:103
|
763 |
-
#: github/view/templates/settings/system-status.php:110
|
764 |
-
#: github/view/templates/settings/system-status.php:117
|
765 |
-
msgid "No"
|
766 |
-
msgstr ""
|
767 |
-
|
768 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
769 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:58
|
770 |
-
msgid ""
|
771 |
-
"The PHP extension MB String and MB String Regex functions are required to "
|
772 |
-
"use this plugin. Contact your web host to have it enabled."
|
773 |
-
msgstr ""
|
774 |
-
|
775 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
776 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:62
|
777 |
-
msgid "GD Library"
|
778 |
-
msgstr ""
|
779 |
-
|
780 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
781 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:66
|
782 |
-
msgid ""
|
783 |
-
"The PHP extension GD Library is required to use this plugin. Contact your "
|
784 |
-
"web host to have it enabled."
|
785 |
-
msgstr ""
|
786 |
-
|
787 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
788 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:84
|
789 |
-
msgid "Available RAM"
|
790 |
-
msgstr ""
|
791 |
-
|
792 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
793 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:87
|
794 |
-
#, php-format
|
795 |
-
msgid ""
|
796 |
-
"We recommend you have 128MB of available RAM to run this plugin. The minimum "
|
797 |
-
"system requirement is 64MB. %sNot sure what this means? Contact your web "
|
798 |
-
"host and ask them to fix the issue. %sNote: If you run less than 128MB, you "
|
799 |
-
"risk PHP suffering a fatal error which will stop your website from running "
|
800 |
-
"on Gravity Form pages."
|
801 |
-
msgstr ""
|
802 |
-
|
803 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
804 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:94
|
805 |
-
msgid "Uploads Directory Writable?"
|
806 |
-
msgstr ""
|
807 |
-
|
808 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
809 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:97
|
810 |
-
#, php-format
|
811 |
-
msgid ""
|
812 |
-
"Your upload folder is not writable by your web server. Check that \"%s\" is "
|
813 |
-
"writable by your web server otherwise we will attempt to use the FTP "
|
814 |
-
"installer to initialise."
|
815 |
-
msgstr ""
|
816 |
-
|
817 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
818 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:103
|
819 |
-
msgid "PDF Output Directory Writable?"
|
820 |
-
msgstr ""
|
821 |
-
|
822 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
823 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:106
|
824 |
-
#, php-format
|
825 |
-
msgid ""
|
826 |
-
"The plugin's output folder is not writable by your web server. PDFs will not "
|
827 |
-
"be attached to notifications until this problem is fixed. Check that \"%s\" "
|
828 |
-
"is writable by your web server."
|
829 |
-
msgstr ""
|
830 |
-
|
831 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
832 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:110
|
833 |
-
msgid "PDF Font Directory Writable?"
|
834 |
-
msgstr ""
|
835 |
-
|
836 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
837 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:113
|
838 |
-
#, php-format
|
839 |
-
msgid ""
|
840 |
-
"The plugin's font folder is not writable by your web server. Check that \"%s"
|
841 |
-
"\" is writable by your web server otherwise we will attempt to use the FTP "
|
842 |
-
"installer to initialise."
|
843 |
-
msgstr ""
|
844 |
-
|
845 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
846 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:117
|
847 |
-
msgid "mPDF Temporary Directory Writable?"
|
848 |
-
msgstr ""
|
849 |
-
|
850 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
851 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:120
|
852 |
-
#, php-format
|
853 |
-
msgid ""
|
854 |
-
"mPDF temporary directory not writable (%s). Memory and image processing time "
|
855 |
-
"will increase."
|
856 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/pdfextended-fr_FR.mo
DELETED
Binary file
|
languages/pdfextended-fr_FR.po
DELETED
@@ -1,1024 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Gravity PDF\n"
|
4 |
-
"POT-Creation-Date: 2014-11-17 16:14+1000\n"
|
5 |
-
"PO-Revision-Date: 2014-11-17 16:14+1000\n"
|
6 |
-
"Last-Translator: Blue Liquid Designs <enquire@blueliquiddesigns.com.au>\n"
|
7 |
-
"Language-Team: Lumiere de Lune <contact@lumieredelune.com>\n"
|
8 |
-
"Language: fr\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.6.5\n"
|
13 |
-
"X-Poedit-KeywordsList: __;_e\n"
|
14 |
-
"X-Poedit-Basepath: /\n"
|
15 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
-
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
17 |
-
"X-Poedit-SearchPath-0: G:\\Blue Liquid Designs\\4) BLUE LIQUID DESIGNS\\19) "
|
18 |
-
"Gravity PDF\\1) github\n"
|
19 |
-
|
20 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
21 |
-
#: EXTENDED\1) github/helper/api.php:142
|
22 |
-
msgid "Bad Request."
|
23 |
-
msgstr "Mauvais requête."
|
24 |
-
|
25 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
26 |
-
#: EXTENDED\1) github/helper/api.php:150 github/helper/api.php:261
|
27 |
-
msgid "Unauthorized Access."
|
28 |
-
msgstr "Accès non authorisé."
|
29 |
-
|
30 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
31 |
-
#: EXTENDED\1) github/helper/api.php:172
|
32 |
-
msgid "Method not allowed."
|
33 |
-
msgstr "Méthode non autorisée."
|
34 |
-
|
35 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
36 |
-
#: EXTENDED\1) github/helper/api.php:180
|
37 |
-
msgid "Internal API Error."
|
38 |
-
msgstr "Erreur interne de l'API."
|
39 |
-
|
40 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
41 |
-
#: EXTENDED\1) github/helper/api.php:188
|
42 |
-
msgid "API Unavailable."
|
43 |
-
msgstr "API non disponible."
|
44 |
-
|
45 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
46 |
-
#: EXTENDED\1) github/helper/notices.php:54
|
47 |
-
#, php-format
|
48 |
-
msgid "%sGravity PDF Automated Installer%s: "
|
49 |
-
msgstr "%sInstallateur automatique de Gravity PDF%s : "
|
50 |
-
|
51 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
52 |
-
#: EXTENDED\1) github/helper/notices.php:64
|
53 |
-
#, php-format
|
54 |
-
msgid " %sGo to installer%s."
|
55 |
-
msgstr " %sAller à l'installateur%s."
|
56 |
-
|
57 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
58 |
-
#: EXTENDED\1) github/helper/notices.php:74
|
59 |
-
msgid ""
|
60 |
-
"The font files have been successfully installed. A font can be used by "
|
61 |
-
"adding its file name (without .ttf and in lower case) in a CSS font-family "
|
62 |
-
"declaration."
|
63 |
-
msgstr ""
|
64 |
-
"Les fichiers ont été installés avec succès. Une police de caractère peut "
|
65 |
-
"être utilisée en ajoutant le nom de son fichier (sans l'extension .ttf et en "
|
66 |
-
"minuscule) dans une déclaration CSS font-family."
|
67 |
-
|
68 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
69 |
-
#: EXTENDED\1) github/helper/notices.php:85
|
70 |
-
msgid "Could not create font configuration file. Try initialise again."
|
71 |
-
msgstr ""
|
72 |
-
"Impossible de créer le fichier de configuration. Essayez à nouveau de faire "
|
73 |
-
"l'initialisation."
|
74 |
-
|
75 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
76 |
-
#: EXTENDED\1) github/helper/notices.php:101
|
77 |
-
msgid ""
|
78 |
-
"Gravity PDF detected a configuration problem. Please "
|
79 |
-
"reinitialise the plugin."
|
80 |
-
msgstr ""
|
81 |
-
"Gravity PDF a détecté un problème de configuration. Merci de "
|
82 |
-
"réinitialiser l'extension."
|
83 |
-
|
84 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
85 |
-
#: EXTENDED\1) github/helper/notices.php:105
|
86 |
-
#, php-format
|
87 |
-
msgid ""
|
88 |
-
"Gravity PDF detected a configuration problem. Please go to "
|
89 |
-
"the %splugin's settings page%s to reinitialise."
|
90 |
-
msgstr ""
|
91 |
-
"Gravity PDF a détecté un problème de configuration. Merci "
|
92 |
-
"d'aller sur la page des %sréglages de l'extension%s pour la réinitialiser."
|
93 |
-
|
94 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
95 |
-
#: EXTENDED\1) github/helper/notices.php:122
|
96 |
-
msgid ""
|
97 |
-
"Gravity PDF detected a server compatibility problem which "
|
98 |
-
"prevented the software from running. See the System Status section below for "
|
99 |
-
"details."
|
100 |
-
msgstr ""
|
101 |
-
"Gravity PDF a détecté un problème de compatibilité avec le "
|
102 |
-
"serveur qui empêche l'extension de fonctionner. Regardez la section \"Etat "
|
103 |
-
"du Système\" ci-dessous pour plus de détails."
|
104 |
-
|
105 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
106 |
-
#: EXTENDED\1) github/helper/notices.php:126
|
107 |
-
#, php-format
|
108 |
-
msgid ""
|
109 |
-
"Gravity PDF detected a server compatibility problem which "
|
110 |
-
"prevented the software from running. Please go to the %splugin's settings "
|
111 |
-
"page%s to view the issue."
|
112 |
-
msgstr ""
|
113 |
-
"Gravity PDF a détecté un problème de compatibilité avec le "
|
114 |
-
"serveur qui empêche l'extension de fonctionner. Merci d'aller sur la page "
|
115 |
-
"des %sréglages de l'extension%s pour voir les détails."
|
116 |
-
|
117 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
118 |
-
#: EXTENDED\1) github/helper/notices.php:142
|
119 |
-
msgid ""
|
120 |
-
"Welcome to Gravity PDF. Before you can use the plugin "
|
121 |
-
"correctly you need to initilise it."
|
122 |
-
msgstr ""
|
123 |
-
"Bienvenue chez Gravity PDF. Avant d'utiliser l'extension, "
|
124 |
-
"vous devez l'initialiser."
|
125 |
-
|
126 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
127 |
-
#: EXTENDED\1) github/helper/notices.php:146
|
128 |
-
#, php-format
|
129 |
-
msgid ""
|
130 |
-
"Welcome to Gravity PDF. Before you can use the plugin "
|
131 |
-
"correctly you need to initilise it. Please go to the %splugin's settings page"
|
132 |
-
"%s to initialise."
|
133 |
-
msgstr ""
|
134 |
-
"Bienvenue chez Gravity PDF. Avant d'utiliser l'extension, "
|
135 |
-
"vous devez l'initialiser. Merci d'aller sur la page des %sréglages de "
|
136 |
-
"l'extension%s pour l'initialisation."
|
137 |
-
|
138 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
139 |
-
#: EXTENDED\1) github/helper/notices.php:158
|
140 |
-
#, php-format
|
141 |
-
msgid ""
|
142 |
-
"Gravity PDF only works with Gravity Forms version %s and "
|
143 |
-
"higher. Please %supgrade your copy of Gravity Forms%s to use this plugin."
|
144 |
-
msgstr ""
|
145 |
-
"Gravity PDF a besoin de Gravity Forms (version %s et "
|
146 |
-
"supérieures). Merci de %smettre votre version de Gravity Forms à jour%s pour "
|
147 |
-
"utiliser l'extension. "
|
148 |
-
|
149 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
150 |
-
#: EXTENDED\1) github/helper/notices.php:174
|
151 |
-
#, fuzzy, php-format
|
152 |
-
msgid ""
|
153 |
-
"We could not create a template folder in your uploads directory. Please "
|
154 |
-
"ensure %s is writable by your web server and try again."
|
155 |
-
msgstr ""
|
156 |
-
"Nous n'avons pas pu créer un dossier de modèles dans le répertoire de votre "
|
157 |
-
"thème actif. Merci de vérifier qu'il est accessible en écriture par le "
|
158 |
-
"serveur web et de réessayer."
|
159 |
-
|
160 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
161 |
-
#: EXTENDED\1) github/helper/notices.php:189
|
162 |
-
#, fuzzy, php-format
|
163 |
-
msgid ""
|
164 |
-
"We could not create a site folder in your uploads/%s directory. Please "
|
165 |
-
"ensure %s is writable by your web server and try again."
|
166 |
-
msgstr ""
|
167 |
-
"Nous n'avons pas pu créer un dossier de modèles dans le répertoire de votre "
|
168 |
-
"thème actif. Merci de vérifier qu'il est accessible en écriture par le "
|
169 |
-
"serveur web et de réessayer."
|
170 |
-
|
171 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
172 |
-
#: EXTENDED\1) github/helper/notices.php:202
|
173 |
-
#, fuzzy, php-format
|
174 |
-
msgid ""
|
175 |
-
"We could not remove the default template files from %s in your uploads "
|
176 |
-
"directory. Please ensure %s is wriable by your web server and try again."
|
177 |
-
msgstr ""
|
178 |
-
"Nous n'avons pas pu supprimer les modèles par défaut du répertoire Gravity "
|
179 |
-
"PDF dans le répertoire de votre thème actif. Merci de "
|
180 |
-
"vérifier qu'%s est accessible en écriture pour le serveur et de réessayer."
|
181 |
-
|
182 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
183 |
-
#: EXTENDED\1) github/helper/notices.php:215
|
184 |
-
#, fuzzy, php-format
|
185 |
-
msgid ""
|
186 |
-
"We could not move the template files to the %s folder. Please ensure %s is "
|
187 |
-
"wriable by your web server and try again."
|
188 |
-
msgstr ""
|
189 |
-
"Nous n'avons pas pu déplacer les modèles vers le répertoire "
|
190 |
-
"PDF_EXTENDED_TEMPLATES. Merci de vérifier que %s est accessible en écriture "
|
191 |
-
"pour le serveur et de vérifier."
|
192 |
-
|
193 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
194 |
-
#: EXTENDED\1) github/helper/notices.php:233
|
195 |
-
#, php-format
|
196 |
-
msgid ""
|
197 |
-
"Gravity PDF directory structure has been changed. %sMigrate "
|
198 |
-
"Now%s %sUnsure what this means?%s"
|
199 |
-
msgstr ""
|
200 |
-
|
201 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
202 |
-
#: EXTENDED\1) github/helper/notices.php:242
|
203 |
-
#, fuzzy, php-format
|
204 |
-
msgid "%sGravity PDF Automated Template Migration:%s"
|
205 |
-
msgstr "%sInstallateur automatique de Gravity PDF%s : "
|
206 |
-
|
207 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
208 |
-
#: EXTENDED\1) github/helper/notices.php:244
|
209 |
-
#, fuzzy, php-format
|
210 |
-
msgid ""
|
211 |
-
"Your PDF template folder structure was successfully migrated to %s. %sUnsure "
|
212 |
-
"what this means?%s"
|
213 |
-
msgstr ""
|
214 |
-
"Votre configuration PDF et votre dossier de modèle a été transféré avec "
|
215 |
-
"succès vers votre nouveau thème."
|
216 |
-
|
217 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
218 |
-
#: EXTENDED\1) github/helper/notices.php:256
|
219 |
-
msgid ""
|
220 |
-
"Gravity PDF Auto Initialisation Complete across the entire "
|
221 |
-
"network."
|
222 |
-
msgstr ""
|
223 |
-
"Initialisation automatique de Gravity Forms Extended terminée sur la "
|
224 |
-
"totalité du réseau."
|
225 |
-
|
226 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
227 |
-
#: EXTENDED\1) github/helper/notices.php:260
|
228 |
-
msgid ""
|
229 |
-
"Gravity PDF Initialisation Complete across the entire network."
|
230 |
-
msgstr ""
|
231 |
-
"Initialisation de Gravity Forms Extended terminée sur la totalité du réseau."
|
232 |
-
|
233 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
234 |
-
#: EXTENDED\1) github/helper/notices.php:265 github/helper/notices.php:277
|
235 |
-
#, php-format
|
236 |
-
msgid "%sLearn how to configuring the plugin%s."
|
237 |
-
msgstr "%sDécouvrez comment configurer cette extension%s."
|
238 |
-
|
239 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
240 |
-
#: EXTENDED\1) github/helper/notices.php:273
|
241 |
-
msgid "Gravity PDF Auto Initialisation Complete."
|
242 |
-
msgstr "Initialisation automatique de Gravity Forms Extended terminée."
|
243 |
-
|
244 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
245 |
-
#: EXTENDED\1) github/helper/notices.php:291
|
246 |
-
#, fuzzy
|
247 |
-
msgid ""
|
248 |
-
"There was a problem merging the PDF templates folder on the following sites;"
|
249 |
-
msgstr "Il y a eu un problème d'initialisation avec les sites suivants :"
|
250 |
-
|
251 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
252 |
-
#: EXTENDED\1) github/helper/notices.php:304
|
253 |
-
msgid ""
|
254 |
-
"Follow the site links above and try run the PDF template merging function "
|
255 |
-
"again, or reinitialise the software."
|
256 |
-
msgstr ""
|
257 |
-
|
258 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
259 |
-
#: EXTENDED\1) github/helper/notices.php:308
|
260 |
-
msgid ""
|
261 |
-
"An unknown error occured while merging the PDF template folders. Please try "
|
262 |
-
"again."
|
263 |
-
msgstr ""
|
264 |
-
|
265 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
266 |
-
#: EXTENDED\1) github/helper/notices.php:323
|
267 |
-
msgid "There was a network initialisation issue on the following sites;"
|
268 |
-
msgstr "Il y a eu un problème d'initialisation avec les sites suivants :"
|
269 |
-
|
270 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
271 |
-
#: EXTENDED\1) github/helper/notices.php:336
|
272 |
-
msgid "Please try manually initialise the software"
|
273 |
-
msgstr "Essayez d'initialiser l'extension manuellement"
|
274 |
-
|
275 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
276 |
-
#: EXTENDED\1) github/helper/notices.php:340
|
277 |
-
msgid ""
|
278 |
-
"An unknown network initialisation error occured. Please try initialise again."
|
279 |
-
msgstr ""
|
280 |
-
"Une erreur inconnue est survenue lors de l'initialisation. Merci de "
|
281 |
-
"réessayer."
|
282 |
-
|
283 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
284 |
-
#: EXTENDED\1) github/helper/notices.php:347
|
285 |
-
msgid "You've successfully initialised Gravity PDF."
|
286 |
-
msgstr "Vous avez bien réussi à initialiser Gravity PDF."
|
287 |
-
|
288 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
289 |
-
#: EXTENDED\1) github/helper/notices.php:354
|
290 |
-
#: github/view/templates/settings/system-status.php:34
|
291 |
-
#: github/view/templates/settings/system-status.php:41
|
292 |
-
msgid "Gravity Forms "
|
293 |
-
msgstr "Gravity Forms "
|
294 |
-
|
295 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
296 |
-
#: EXTENDED\1) github/helper/notices.php:360
|
297 |
-
msgid "Wordpress "
|
298 |
-
msgstr "Wordpress "
|
299 |
-
|
300 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
301 |
-
#: EXTENDED\1) github/helper/notices.php:366
|
302 |
-
msgid "PHP "
|
303 |
-
msgstr "PHP "
|
304 |
-
|
305 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
306 |
-
#: EXTENDED\1) github/helper/notices.php:372
|
307 |
-
#, php-format
|
308 |
-
msgid ""
|
309 |
-
"If you reinitialise and enable this option %syou will overwrite%s the "
|
310 |
-
"default and example template files in your active theme directory."
|
311 |
-
msgstr ""
|
312 |
-
"Si vous réinitialisez et activer cette option, %svous allez remplacer%s les "
|
313 |
-
"fichier de modèles par défaut et exemple dans le répertoire de votre thème "
|
314 |
-
"actif."
|
315 |
-
|
316 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
317 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:255
|
318 |
-
msgid "Order"
|
319 |
-
msgstr "Commander"
|
320 |
-
|
321 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
322 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:266
|
323 |
-
msgid "Product"
|
324 |
-
msgstr "Produit"
|
325 |
-
|
326 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
327 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:267
|
328 |
-
msgid "Qty"
|
329 |
-
msgstr "Qté"
|
330 |
-
|
331 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
332 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:268
|
333 |
-
msgid "Unit Price"
|
334 |
-
msgstr "Prix unitaire"
|
335 |
-
|
336 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
337 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:269
|
338 |
-
msgid "Price"
|
339 |
-
msgstr "PRix"
|
340 |
-
|
341 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
342 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:332
|
343 |
-
msgid "Total"
|
344 |
-
msgstr "Total"
|
345 |
-
|
346 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
347 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:940
|
348 |
-
msgid ""
|
349 |
-
"Activate Gravity Forms Quiz Add On to see global quiz statistics for this "
|
350 |
-
"form"
|
351 |
-
msgstr ""
|
352 |
-
"Activez Gravity Forms Quiz Add On pour voir les statistiqies globales du "
|
353 |
-
"quiz pour ce formulaire"
|
354 |
-
|
355 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
356 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1371
|
357 |
-
#: github/helper/pdf-entry-detail.php:1746
|
358 |
-
msgid "Qty: "
|
359 |
-
msgstr "Qté : "
|
360 |
-
|
361 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
362 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1371
|
363 |
-
#: github/helper/pdf-entry-detail.php:1746
|
364 |
-
msgid "Price: "
|
365 |
-
msgstr "Prix : "
|
366 |
-
|
367 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
368 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1680
|
369 |
-
msgid "Title"
|
370 |
-
msgstr "Titre"
|
371 |
-
|
372 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
373 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1681
|
374 |
-
msgid "Caption"
|
375 |
-
msgstr "Légende"
|
376 |
-
|
377 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
378 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1682
|
379 |
-
msgid "Description"
|
380 |
-
msgstr "Description"
|
381 |
-
|
382 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
383 |
-
#: EXTENDED\1) github/helper/pdf-entry-detail.php:1687
|
384 |
-
#: github/helper/pdf-entry-detail.php:1706
|
385 |
-
msgid "Click to view"
|
386 |
-
msgstr "Cliquer pour voir"
|
387 |
-
|
388 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
389 |
-
#: EXTENDED\1) github/model/pdf.php:142
|
390 |
-
msgid "View"
|
391 |
-
msgstr "Voir"
|
392 |
-
|
393 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
394 |
-
#: EXTENDED\1) github/model/pdf.php:143
|
395 |
-
msgid "Download"
|
396 |
-
msgstr "Télécharger"
|
397 |
-
|
398 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
399 |
-
#: EXTENDED\1) github/model/pdf.php:199
|
400 |
-
msgid "View PDFs"
|
401 |
-
msgstr "Voir les PDFs"
|
402 |
-
|
403 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
404 |
-
#: EXTENDED\1) github/model/pdf.php:234
|
405 |
-
msgid "View PDF"
|
406 |
-
msgstr "Voir le PDF"
|
407 |
-
|
408 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
409 |
-
#: EXTENDED\1) github/model/pdf.php:321
|
410 |
-
#, fuzzy
|
411 |
-
msgid "Access Denied"
|
412 |
-
msgstr "Accès non authorisé."
|
413 |
-
|
414 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
415 |
-
#: EXTENDED\1) github/model/settings.php:359
|
416 |
-
msgid "Plugin not yet initialised"
|
417 |
-
msgstr "L'extension n'est pas encore initialisée"
|
418 |
-
|
419 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
420 |
-
#: EXTENDED\1) github/model/settings.php:414
|
421 |
-
msgid ""
|
422 |
-
"There was a problem with your submission. Please reload the page and try "
|
423 |
-
"again"
|
424 |
-
msgstr ""
|
425 |
-
"Il y a eu un problème avec votre soumission. Merci de recharger la page et "
|
426 |
-
"de réessayer"
|
427 |
-
|
428 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
429 |
-
#: EXTENDED\1) github/model/settings.php:431
|
430 |
-
msgid "Please enter a valid email address"
|
431 |
-
msgstr "Merci de saisir une adresse email valide"
|
432 |
-
|
433 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
434 |
-
#: EXTENDED\1) github/model/settings.php:434
|
435 |
-
msgid "Problem"
|
436 |
-
msgstr "Problème"
|
437 |
-
|
438 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
439 |
-
#: EXTENDED\1) github/model/settings.php:434
|
440 |
-
msgid "Question"
|
441 |
-
msgstr "Question"
|
442 |
-
|
443 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
444 |
-
#: EXTENDED\1) github/model/settings.php:434
|
445 |
-
msgid "Suggestion"
|
446 |
-
msgstr "Suggestion"
|
447 |
-
|
448 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
449 |
-
#: EXTENDED\1) github/model/settings.php:438
|
450 |
-
msgid "Please select a valid support type."
|
451 |
-
msgstr "Merci de choisir un type de support valide."
|
452 |
-
|
453 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
454 |
-
#: EXTENDED\1) github/model/settings.php:443
|
455 |
-
msgid ""
|
456 |
-
"Please enter information about your support query so we can aid you more "
|
457 |
-
"easily."
|
458 |
-
msgstr ""
|
459 |
-
"Merci d'entrer l'information nécessaire à votre requête pour que nous "
|
460 |
-
"puissions vous aider plus facilement."
|
461 |
-
|
462 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
463 |
-
#: EXTENDED\1) github/model/settings.php:448
|
464 |
-
msgid ""
|
465 |
-
"There is a problem with your support request. Please correct the marked "
|
466 |
-
"issues above."
|
467 |
-
msgstr ""
|
468 |
-
"Il y a un problème avec votre demande de support. Merci de corriger les "
|
469 |
-
"problèmes indiqués ci-dessus."
|
470 |
-
|
471 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
472 |
-
#: EXTENDED\1) github/model/settings.php:458
|
473 |
-
msgid ""
|
474 |
-
"Thank you for your support request. We'll respond to your request in the "
|
475 |
-
"next 24-48 hours."
|
476 |
-
msgstr ""
|
477 |
-
"Merci pour votre demande de support. Nous répondrons à votre demande dans "
|
478 |
-
"les prochaines 24 à 48 heures."
|
479 |
-
|
480 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
481 |
-
#: EXTENDED\1) github/model/settings.php:516
|
482 |
-
msgid "Support request received. We will responed in 24 to 48 hours."
|
483 |
-
msgstr ""
|
484 |
-
"Demande de support reçue. Nous répondrons dans les prochaines 24 à 48 heures."
|
485 |
-
|
486 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
487 |
-
#: EXTENDED\1) github/view/templates/settings/changelog.php:19
|
488 |
-
msgid "Changelog"
|
489 |
-
msgstr "Changelog"
|
490 |
-
|
491 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
492 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:41
|
493 |
-
msgid "Gravity PDF"
|
494 |
-
msgstr "Gravity PDF"
|
495 |
-
|
496 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
497 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:42
|
498 |
-
msgid ""
|
499 |
-
"Your web server isn't compatible with Gravity PDF. Please see "
|
500 |
-
"the problem areas below."
|
501 |
-
msgstr ""
|
502 |
-
"Votre serveur web n'est pas compatible avec Gravity PDF.. "
|
503 |
-
"Merci de résoudre les problèmes ci-dessous."
|
504 |
-
|
505 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
506 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:52
|
507 |
-
msgid "Can't Resolve the Issue?"
|
508 |
-
msgstr "Impossible de résoudre le problème ?"
|
509 |
-
|
510 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
511 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation-tab.php:53
|
512 |
-
#, php-format
|
513 |
-
msgid ""
|
514 |
-
"Does Gravity PDF detect a problem that your web host won't "
|
515 |
-
"fix? %sWe recommend you move to a quality web hosting service like WP Engine"
|
516 |
-
"%s which runs our software straight out of the box."
|
517 |
-
msgstr ""
|
518 |
-
"Est-ce que Gravity PDF détecte un problème que votre "
|
519 |
-
"hébergeur ne peut pas résoudre ? %sNous vous recommandons de changer pour un "
|
520 |
-
"service d'hébergement de qualité comme WP Engine%s qui peut faire tourner "
|
521 |
-
"notre extension sans aucun problème."
|
522 |
-
|
523 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
524 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:19
|
525 |
-
msgid "Welcome to Gravity PDF"
|
526 |
-
msgstr "Bienvenue dans Gravity PDF"
|
527 |
-
|
528 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
529 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:19
|
530 |
-
#: github/view/templates/settings/initialisation.php:66
|
531 |
-
msgid "Initialise Plugin"
|
532 |
-
msgstr "Initiailiser l'extension"
|
533 |
-
|
534 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
535 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:23
|
536 |
-
msgid ""
|
537 |
-
"The plugin has successfully installed and is ready to start automating your "
|
538 |
-
"documents."
|
539 |
-
msgstr ""
|
540 |
-
"L'extension a été installée avec succès, elle est prête à commencer à "
|
541 |
-
"automatiser vos documents."
|
542 |
-
|
543 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
544 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:25
|
545 |
-
msgid "What's next?"
|
546 |
-
msgstr "Et maintenant ?"
|
547 |
-
|
548 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
549 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:26
|
550 |
-
msgid ""
|
551 |
-
"The next step is to correctly configured the plugin so that you can generate "
|
552 |
-
"PDF documents."
|
553 |
-
msgstr ""
|
554 |
-
"La prochaine étape est la configuration correcte de l'extension, afin de "
|
555 |
-
"pouvoir générer des documents PDF."
|
556 |
-
|
557 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
558 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:27
|
559 |
-
msgid ""
|
560 |
-
"To help you get started, we've put together a five-part video series with "
|
561 |
-
"the most common plugin configurations."
|
562 |
-
msgstr ""
|
563 |
-
"Pour vous aider à démarrer, nous avons mis en ligne un tutoriel en cinq "
|
564 |
-
"vidéos (en anglais) avec les configurations les plus courantes de "
|
565 |
-
"l'extension."
|
566 |
-
|
567 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
568 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:29
|
569 |
-
msgid "The Basics: Only Download PDF through the Admin Area"
|
570 |
-
msgstr ""
|
571 |
-
"La base : le téléchargement des PDF se fait seulement à partir de "
|
572 |
-
"l'administration"
|
573 |
-
|
574 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
575 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:30
|
576 |
-
msgid "The Email: Send Completed PDF via Email"
|
577 |
-
msgstr "L'email : l'envoi du PDF terminé par mail"
|
578 |
-
|
579 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
580 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:31
|
581 |
-
msgid ""
|
582 |
-
"The Download: User Downloads PDF after Submitting Form (using a link or auto "
|
583 |
-
"redirecting)"
|
584 |
-
msgstr ""
|
585 |
-
"Le téléchargement : l'utilisateur peut télécharger le PDF après avoir soumis "
|
586 |
-
"un formulaire (en utilisant un lien ou via la redirection)"
|
587 |
-
|
588 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
589 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:32
|
590 |
-
msgid "The Email Advanced: Manually Review User Submission before Emailing PDF"
|
591 |
-
msgstr ""
|
592 |
-
"Les fonctionnalités avancées de l'email : vérification manuelle des données "
|
593 |
-
"soumises par l'utilisateur avant d'envoyer le PDF par mail"
|
594 |
-
|
595 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
596 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:33
|
597 |
-
msgid "The Payment: Send PDF after Capturing Payment using Paypal Standard"
|
598 |
-
msgstr ""
|
599 |
-
"Le paiement : l'envoir du PDF après la réception du paiement via Paypal "
|
600 |
-
"Standard"
|
601 |
-
|
602 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
603 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:36
|
604 |
-
#, php-format
|
605 |
-
msgid ""
|
606 |
-
"If you know little about PHP we recommend starting with %sPart 1:The Basics"
|
607 |
-
"%s and then watching the tutorial you’re interested in. It will give you the "
|
608 |
-
"foundational skills you need to configure the software."
|
609 |
-
msgstr ""
|
610 |
-
"Si vous n'avez pas beaucoup de connaissances en PHP, nous vous recommandons "
|
611 |
-
"de commencer par la %svidéo n°1 : La base%s et ensuite de choisir le "
|
612 |
-
"tutoriel qui vous intéresse. Elle vous donnera les connaissances de base "
|
613 |
-
"dont vous avez besoin pour configurer l'extension. "
|
614 |
-
|
615 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
616 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:38
|
617 |
-
msgid "Custom Templates"
|
618 |
-
msgstr "Modèles personnalisés"
|
619 |
-
|
620 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
621 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:39
|
622 |
-
#, php-format
|
623 |
-
msgid ""
|
624 |
-
"Creating a custom template gives you ultimate control of the look and feel "
|
625 |
-
"of your documents using only HTML and CSS. %sWe recommend you review our "
|
626 |
-
"online documentation%s to create and customise your template files."
|
627 |
-
msgstr ""
|
628 |
-
"La création d'un template personnalisé vous donne un contrôle complet de "
|
629 |
-
"l'apparence de votre document en utilisant seulement HTML et le CSS. %sNous "
|
630 |
-
"vous recommandons de regarder la documentation en ligne (en anglais)%s pour "
|
631 |
-
"savoir comment créer et personnaliser vos fichiers de modèles."
|
632 |
-
|
633 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
634 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:45
|
635 |
-
msgid ""
|
636 |
-
"To complete the installation, Gravity PDF needs to be "
|
637 |
-
"initialised."
|
638 |
-
msgstr ""
|
639 |
-
"Pour terminer l'installation, Gravity PDF doit être "
|
640 |
-
"initialisé."
|
641 |
-
|
642 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
643 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:47
|
644 |
-
msgid "What does initialisation do?"
|
645 |
-
msgstr "Qu'est-ce que l'initialisation ne?"
|
646 |
-
|
647 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
648 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:50
|
649 |
-
msgid "Install the template files"
|
650 |
-
msgstr "Installation des fichiers de modèles"
|
651 |
-
|
652 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
653 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:50
|
654 |
-
msgid ""
|
655 |
-
"We create a folder called PDF_EXTENDED_TEMPLATE in your active theme "
|
656 |
-
"directory and move over all the templates and configuration files. This "
|
657 |
-
"folder is where you'll look to configure the software and create your PDF "
|
658 |
-
"templates."
|
659 |
-
msgstr ""
|
660 |
-
"Nous créons un dossier appelé PDF_EXTENDED_TEMPLATE dans le répertoire de "
|
661 |
-
"votre thème et déplaçons tous les templates et les fichiers de "
|
662 |
-
"configuration. Ce dossier est là où vous trouverez les éléments pour "
|
663 |
-
"configurer l'extension et créer vos modèles PDF. "
|
664 |
-
|
665 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
666 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:62
|
667 |
-
msgid "Have a problem with the software?"
|
668 |
-
msgstr "Avez-vous un problème avec l'extension ?"
|
669 |
-
|
670 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
671 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:63
|
672 |
-
msgid ""
|
673 |
-
"Did you switch themes and something went wrong syncing the template folder? "
|
674 |
-
"Try reinitialise the software."
|
675 |
-
msgstr ""
|
676 |
-
"Avez-vous changé de thèmes et que quelque chose s'est mal passé pendant la "
|
677 |
-
"synchronisation du dossier de modèles ? Essayez de réinitialiser l'extension."
|
678 |
-
|
679 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
680 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:66
|
681 |
-
msgid "Reinitialise Plugin"
|
682 |
-
msgstr "Réinitialisation de l'extension"
|
683 |
-
|
684 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
685 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:68
|
686 |
-
msgid "Reinstall Default and Example Templates"
|
687 |
-
msgstr "Réinstallation des modèles par défaut et des exemples"
|
688 |
-
|
689 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
690 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:74
|
691 |
-
msgid "Install a new font?"
|
692 |
-
msgstr "Installer une nouvelle police ?"
|
693 |
-
|
694 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
695 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:75
|
696 |
-
#, php-format
|
697 |
-
msgid ""
|
698 |
-
"Do you want to use a custom font in your template? %sSee our documentation "
|
699 |
-
"on how to correctly install and use a custom font%s before initialising "
|
700 |
-
"below."
|
701 |
-
msgstr ""
|
702 |
-
"Voulez-vous utiliser une police personnalisée dans votre modèle ? %sRegardez "
|
703 |
-
"dans notre documentation (en) comment installer correctement et utiliser une "
|
704 |
-
"police personnalisée%s avant de faire l'installation ci-dessous."
|
705 |
-
|
706 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
707 |
-
#: EXTENDED\1) github/view/templates/settings/initialisation.php:76
|
708 |
-
msgid "Initialise Fonts"
|
709 |
-
msgstr "Installer les polices de caractères"
|
710 |
-
|
711 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
712 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:26
|
713 |
-
msgid ""
|
714 |
-
"Gravity PDF's support hours are from 9:00am-5:00pm Monday to "
|
715 |
-
"Friday, Sydney Australia time."
|
716 |
-
msgstr ""
|
717 |
-
"Les heures de disponibilité du service de Gravity PDF sont de "
|
718 |
-
"9:00 à 17:00 du Lundi au Vendredi, heure de Sydney (Australie)."
|
719 |
-
|
720 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
721 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:29
|
722 |
-
#, php-format
|
723 |
-
msgid "The current time in Sydney Australia is %s."
|
724 |
-
msgstr "En ce moment, à Sydney en Australie, il est %s."
|
725 |
-
|
726 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
727 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:55
|
728 |
-
msgid "Enter the email address you want us to contact you on."
|
729 |
-
msgstr ""
|
730 |
-
"Saisir l'adresse email à laquelle vous voulez que nous vous contactions."
|
731 |
-
|
732 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
733 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:56
|
734 |
-
msgid ""
|
735 |
-
"Note: To ensure the best support possible, please use the above email to "
|
736 |
-
"respond to all support communications."
|
737 |
-
msgstr ""
|
738 |
-
"NB : pour assurer le meilleur support possible, merci d'utiliser l'email ci-"
|
739 |
-
"dessus pour toutes les réponses au support."
|
740 |
-
|
741 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
742 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:92
|
743 |
-
msgid "Enter as much detail about the problem as you can."
|
744 |
-
msgstr "Donnez autant de détails que possible sur le problème."
|
745 |
-
|
746 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
747 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:93
|
748 |
-
msgid "Please enter as much detail about the problem as you can."
|
749 |
-
msgstr "Merci de donner autant de détails que possible sur le problème."
|
750 |
-
|
751 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
752 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:94
|
753 |
-
msgid "Note: Our support representatives can only communicate in English."
|
754 |
-
msgstr "NB : notre support communique uniquement en anglais."
|
755 |
-
|
756 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
757 |
-
#: EXTENDED\1) github/view/templates/settings/support-form.php:97
|
758 |
-
msgid "Request Support"
|
759 |
-
msgstr "Envoyer au support"
|
760 |
-
|
761 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
762 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:20
|
763 |
-
msgid "Frequently Asked Questions"
|
764 |
-
msgstr "F.A.Q."
|
765 |
-
|
766 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
767 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:22
|
768 |
-
msgid "Can I exclude a field from showing up in the PDF?"
|
769 |
-
msgstr "Puis-je empêcher un champ d'apparaitre dans le PDF ?"
|
770 |
-
|
771 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
772 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:23
|
773 |
-
msgid ""
|
774 |
-
"I want to have multiple PDF template files generated on one form. How do I "
|
775 |
-
"do it?"
|
776 |
-
msgstr ""
|
777 |
-
"Je veux avoir plusieurs modèles PDF pour un formulaire. Comment faire ?"
|
778 |
-
|
779 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
780 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:24
|
781 |
-
msgid "I want users to be able to download the PDF from the server."
|
782 |
-
msgstr ""
|
783 |
-
"Je veux que les utilisateurs puissent télécharger le PDF à partir du serveur."
|
784 |
-
|
785 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
786 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:25
|
787 |
-
msgid "How do I change the PDF size or create a landscape PDF?"
|
788 |
-
msgstr "Comment changer la taille du PDF ou créer un PDF en mode paysage ?"
|
789 |
-
|
790 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
791 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:26
|
792 |
-
msgid ""
|
793 |
-
"I am created a custom template. How do I know the names of my fields in the "
|
794 |
-
"$form_data array?"
|
795 |
-
msgstr ""
|
796 |
-
"Je crée un modèle personnalisé. Comment savoir quels sont les noms de mes "
|
797 |
-
"champs dans $form_data array ?"
|
798 |
-
|
799 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
800 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:27
|
801 |
-
msgid "How large a PDF are you able to create/process?"
|
802 |
-
msgstr "Quelle est la taille maximum de PDF que vous pouvez créer / traiter ?"
|
803 |
-
|
804 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
805 |
-
#: EXTENDED\1) github/view/templates/settings/support-sidebar.php:30
|
806 |
-
#, php-format
|
807 |
-
msgid ""
|
808 |
-
"Got a question that isn't answered above? %sHead to our support forum%s and "
|
809 |
-
"let us know."
|
810 |
-
msgstr ""
|
811 |
-
"Une question pour laquelle il n'y a pas de réponse ? %sAllez la poser sur "
|
812 |
-
"notre forum de support (en)%s."
|
813 |
-
|
814 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
815 |
-
#: EXTENDED\1) github/view/templates/settings/support.php:20
|
816 |
-
msgid "Support"
|
817 |
-
msgstr "Support"
|
818 |
-
|
819 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
820 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:19
|
821 |
-
msgid "System Status"
|
822 |
-
msgstr "Statut du système"
|
823 |
-
|
824 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
825 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:22
|
826 |
-
msgid "Wordpress Version"
|
827 |
-
msgstr "Version de WordPress"
|
828 |
-
|
829 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
830 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:25
|
831 |
-
msgid "Wordpress Version "
|
832 |
-
msgstr "Version de Wordpress "
|
833 |
-
|
834 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
835 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:30
|
836 |
-
msgid "Gravity Forms"
|
837 |
-
msgstr "Gravity Forms"
|
838 |
-
|
839 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
840 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:32
|
841 |
-
msgid "Not Installed"
|
842 |
-
msgstr "Pas installé"
|
843 |
-
|
844 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
845 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:47
|
846 |
-
msgid "PHP Version"
|
847 |
-
msgstr " Version de PHP"
|
848 |
-
|
849 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
850 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:50
|
851 |
-
msgid "PHP Version "
|
852 |
-
msgstr "Version de PHP "
|
853 |
-
|
854 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
855 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:54
|
856 |
-
msgid "MB String"
|
857 |
-
msgstr "MB String"
|
858 |
-
|
859 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
860 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:54
|
861 |
-
#: github/view/templates/settings/system-status.php:62
|
862 |
-
#: github/view/templates/settings/system-status.php:94
|
863 |
-
#: github/view/templates/settings/system-status.php:103
|
864 |
-
#: github/view/templates/settings/system-status.php:110
|
865 |
-
#: github/view/templates/settings/system-status.php:117
|
866 |
-
msgid "Yes"
|
867 |
-
msgstr "Oui"
|
868 |
-
|
869 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
870 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:54
|
871 |
-
#: github/view/templates/settings/system-status.php:62
|
872 |
-
#: github/view/templates/settings/system-status.php:94
|
873 |
-
#: github/view/templates/settings/system-status.php:103
|
874 |
-
#: github/view/templates/settings/system-status.php:110
|
875 |
-
#: github/view/templates/settings/system-status.php:117
|
876 |
-
msgid "No"
|
877 |
-
msgstr "Non"
|
878 |
-
|
879 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
880 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:58
|
881 |
-
msgid ""
|
882 |
-
"The PHP extension MB String and MB String Regex functions are required to "
|
883 |
-
"use this plugin. Contact your web host to have it enabled."
|
884 |
-
msgstr ""
|
885 |
-
"L'extension PHP MB String et les fonctions MB String Regex sont nécessaires "
|
886 |
-
"pour utiliser cette extension. Contactez votre hébergeur pour les faire "
|
887 |
-
"activer."
|
888 |
-
|
889 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
890 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:62
|
891 |
-
msgid "GD Library"
|
892 |
-
msgstr "GD Library"
|
893 |
-
|
894 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
895 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:66
|
896 |
-
msgid ""
|
897 |
-
"The PHP extension GD Library is required to use this plugin. Contact your "
|
898 |
-
"web host to have it enabled."
|
899 |
-
msgstr ""
|
900 |
-
"L'extension PHP GD Librairy est nécessaire pour utiliser cette extension. "
|
901 |
-
"Contactez votre hébergeur pour la faire activer."
|
902 |
-
|
903 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
904 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:84
|
905 |
-
msgid "Available RAM"
|
906 |
-
msgstr "RAM disponible"
|
907 |
-
|
908 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
909 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:87
|
910 |
-
#, php-format
|
911 |
-
msgid ""
|
912 |
-
"We recommend you have 128MB of available RAM to run this plugin. The minimum "
|
913 |
-
"system requirement is 64MB. %sNot sure what this means? Contact your web "
|
914 |
-
"host and ask them to fix the issue. %sNote: If you run less than 128MB, you "
|
915 |
-
"risk PHP suffering a fatal error which will stop your website from running "
|
916 |
-
"on Gravity Form pages."
|
917 |
-
msgstr ""
|
918 |
-
"Nous vous recommandons une mémoire RAM disponible de 128MB pour faire "
|
919 |
-
"tourner cette extension. Le niveau minimum est de 64MB. %sVous n'êtes pas "
|
920 |
-
"sûr de ce que cela signifie ? Contactez votre hébergeur et demandez leur de "
|
921 |
-
"résoudre cela. %sNB : si vous avez moins de 128MB, vous risquez des erreurs "
|
922 |
-
"fatales de PHP qui empêcheront votre site de fonctionner sur les pages avec "
|
923 |
-
"des formulaires Gravity Forms."
|
924 |
-
|
925 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
926 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:94
|
927 |
-
#, fuzzy
|
928 |
-
msgid "Uploads Directory Writable?"
|
929 |
-
msgstr "Répertoire des extensions accessible en écriture ?"
|
930 |
-
|
931 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
932 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:97
|
933 |
-
#, fuzzy, php-format
|
934 |
-
msgid ""
|
935 |
-
"Your upload folder is not writable by your web server. Check that \"%s\" is "
|
936 |
-
"writable by your web server otherwise we will attempt to use the FTP "
|
937 |
-
"installer to initialise."
|
938 |
-
msgstr ""
|
939 |
-
"Le répertoire des polices de l'extension n'est pas accessible en écriture "
|
940 |
-
"par le serveur. Vérifiez que le répertoire \"%s\" est accessible en "
|
941 |
-
"écriture, ou bien nous essayerons d'utiliser l'installateur FTP pour "
|
942 |
-
"l'initialisation. "
|
943 |
-
|
944 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
945 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:103
|
946 |
-
msgid "PDF Output Directory Writable?"
|
947 |
-
msgstr "Répertoire de sortie des PDF accessible en écriture ?"
|
948 |
-
|
949 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
950 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:106
|
951 |
-
#, php-format
|
952 |
-
msgid ""
|
953 |
-
"The plugin's output folder is not writable by your web server. PDFs will not "
|
954 |
-
"be attached to notifications until this problem is fixed. Check that \"%s\" "
|
955 |
-
"is writable by your web server."
|
956 |
-
msgstr ""
|
957 |
-
"Le répertoire de stockage de l'extension n'est pas accessible en écriture "
|
958 |
-
"par le serveur. Les PDF ne pourront pas être joints aux notifications tant "
|
959 |
-
"que ce problème n'est pas réglé. Vérifiez que le répertoire \"%s\" est "
|
960 |
-
"accessible en écriture. "
|
961 |
-
|
962 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
963 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:110
|
964 |
-
msgid "PDF Font Directory Writable?"
|
965 |
-
msgstr "Répertoire des polices de caractère PDF accessible en écriture ?"
|
966 |
-
|
967 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
968 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:113
|
969 |
-
#, php-format
|
970 |
-
msgid ""
|
971 |
-
"The plugin's font folder is not writable by your web server. Check that \"%s"
|
972 |
-
"\" is writable by your web server otherwise we will attempt to use the FTP "
|
973 |
-
"installer to initialise."
|
974 |
-
msgstr ""
|
975 |
-
"Le répertoire des polices de l'extension n'est pas accessible en écriture "
|
976 |
-
"par le serveur. Vérifiez que le répertoire \"%s\" est accessible en "
|
977 |
-
"écriture, ou bien nous essayerons d'utiliser l'installateur FTP pour "
|
978 |
-
"l'initialisation. "
|
979 |
-
|
980 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
981 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:117
|
982 |
-
msgid "mPDF Temporary Directory Writable?"
|
983 |
-
msgstr "Répertoire temporaire de mPDF accessible en écriture ?"
|
984 |
-
|
985 |
-
#: G:\Blue Liquid Designs\4) BLUE LIQUID DESIGNS\19) GRAVITY FORMS PDF
|
986 |
-
#: EXTENDED\1) github/view/templates/settings/system-status.php:120
|
987 |
-
#, fuzzy, php-format
|
988 |
-
msgid ""
|
989 |
-
"mPDF temporary directory not writable (%s). Memory and image processing time "
|
990 |
-
"will increase."
|
991 |
-
msgstr ""
|
992 |
-
"Le répertoire temporaire de mPDF (mPDF/tmp/) n'est pas accessible en "
|
993 |
-
"écriture. La mémoire utilisée et le temps de traitement des images vont "
|
994 |
-
"augmenter."
|
995 |
-
|
996 |
-
#~ msgid ""
|
997 |
-
#~ "There was a problem installing the font files. Check the file permissions "
|
998 |
-
#~ "in the plugin folder and try again."
|
999 |
-
#~ msgstr ""
|
1000 |
-
#~ "Il y a eu un problème lors de l'installation des polices de caractères. "
|
1001 |
-
#~ "Vérifiez les permissions dans le dossier du plugin et réessayer."
|
1002 |
-
|
1003 |
-
#~ msgid ""
|
1004 |
-
#~ "Gravity PDF needs to keep your configuration and templates "
|
1005 |
-
#~ "folder in sync with your current active theme. %sSync Now%s"
|
1006 |
-
#~ msgstr ""
|
1007 |
-
#~ "Gravity PDF a besoin de synchroniser votre configuration "
|
1008 |
-
#~ "et votre répertoire de modèles avec votre thème actif. %sSynchroniser "
|
1009 |
-
#~ "maintenant%s"
|
1010 |
-
|
1011 |
-
#~ msgid "PDF"
|
1012 |
-
#~ msgstr "PDF"
|
1013 |
-
|
1014 |
-
#~ msgid ""
|
1015 |
-
#~ "The plugin folder is not writable by your web server. Check the directory "
|
1016 |
-
#~ "\"%s\" is writable by your web server otherwise we will attempt to use "
|
1017 |
-
#~ "the FTP installer to initialise."
|
1018 |
-
#~ msgstr ""
|
1019 |
-
#~ "Le dossier de l'extension n'est pas accessible en écriture par le "
|
1020 |
-
#~ "serveur. Vérifiez que le répertoire \"%s\" est accessible en écriture, ou "
|
1021 |
-
#~ "bien nous essayerons d'utiliser l'installateur FTP pour l'initialisation. "
|
1022 |
-
|
1023 |
-
#~ msgid "Theme Directory Writable?"
|
1024 |
-
#~ msgstr "Répertoire des thèmes accessible en écriture ?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF.zip
ADDED
Binary file
|
mPDF/CHANGELOG.txt
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
================
|
2 |
-
mPDF 5.7.1
|
3 |
-
1/09/2013
|
4 |
-
================
|
5 |
-
1) FILES: mpdf.php
|
6 |
-
Bug fix; Dollar sign enclosed by <pre> tag causing error.
|
7 |
-
Test e.g.: <pre>Test $1.00 Test</pre> <pre>Test $2.00 Test</pre> <pre>Test $3.00 Test</pre> <pre>Test $4.00 Test</pre>
|
8 |
-
-----------------------------
|
9 |
-
2) FILES: includes/functions.php AND mpdf.php
|
10 |
-
Changes to preg_replace with /e modifier to use preg_replace_callback
|
11 |
-
(/e depracated from PHP 5.5)
|
12 |
-
-----------------------------
|
13 |
-
3) FILES: classes/barcode.php
|
14 |
-
Small change to function barcode_c128() which allows ASCII 0 - 31 to be used in C128A e.g. chr(13) in:
|
15 |
-
<barcode code="5432
1068" type="C128A" />
|
16 |
-
-----------------------------
|
17 |
-
4) FILES: mpdf.php
|
18 |
-
Using $use_kwt ("keep-[heading]-with-table") if <h4></h4> before table is on 2 lines and pagebreak occurs after first line
|
19 |
-
the first line is displayed at the bottom of the 2nd page.
|
20 |
-
Edited so that $use_kwt only works if the HEADING is only one line. Else ignores (but prints correctly)
|
21 |
-
-----------------------------
|
22 |
-
5) FILES: mpdf.php
|
23 |
-
Clearing old temporary files from _MPDF_TEMP_PATH will now ignore "hidden" files e.g. starting with a "." .htaccess, .gitignore etc.
|
24 |
-
and also leave dummy.txt alone
|
25 |
-
-----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/CREDITS.txt
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
/*******************************************************************************
|
4 |
-
* Software: FPDF *
|
5 |
-
* Version: 1.53 *
|
6 |
-
* Date: 2004-12-31 *
|
7 |
-
* Author: Olivier PLATHEY *
|
8 |
-
* License: Freeware *
|
9 |
-
* *
|
10 |
-
* You may use and modify this software as you wish. *
|
11 |
-
*******************************************************************************/
|
12 |
-
|
13 |
-
/*******************************************************************************
|
14 |
-
* HTML2FPDF is a php script to read a HTML text and generate a PDF file. *
|
15 |
-
* Copyright (C) 2004-2005 Renato Coelho *
|
16 |
-
* *
|
17 |
-
* html2fpdf.php, htmltoolkit.php *
|
18 |
-
*******************************************************************************/
|
19 |
-
|
20 |
-
CREDITS From HTML2FPDF:
|
21 |
-
|
22 |
-
-Olivier Plathey for the fpdf.php class [http://www.fpdf.org]
|
23 |
-
-Damon Kohler for the Flowing Block script [mailto:damonkohler@yahoo.com]
|
24 |
-
-Cl�ment Lavoillotte for HTML-oriented FPDF idea
|
25 |
-
-Yamasoft for the gif.php class [http://www.yamasoft.com/]
|
26 |
-
-J�r�me Fenal for the _parsegif() function
|
27 |
-
-"VIETCOM" for the PDFTable code [http://www.freepgs.com/vietcom/tool/pdftable/] [mailto:vncommando@yahoo.com]
|
28 |
-
-Yukihiro O. for the SetDash() function [mailto:yukihiro_o@infoseek.jp]
|
29 |
-
-Ron Korving for the WordWrap() function
|
30 |
-
-Michel Poulain for the DisplayPreferences() function
|
31 |
-
-Patrick Benny for the MultiCellBlt() function idea [no longer in use]
|
32 |
-
-Seb for the _SetTextRendering() and SetTextOutline() functions [mailto:captainseb@wanadoo.fr]
|
33 |
-
-MorphSoft for the colornames list idea
|
34 |
-
-W3SCHOOLS for HTML-related reference info [http://www.w3schools.com/]
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
/****************************************************************************
|
39 |
-
* Software: FPDF_Protection *
|
40 |
-
* Version: 1.02 *
|
41 |
-
* Date: 2005/05/08 *
|
42 |
-
* Author: Klemen VODOPIVEC *
|
43 |
-
* License: Freeware *
|
44 |
-
* *
|
45 |
-
* You may use and modify this software as you wish as stated in original *
|
46 |
-
* FPDF package. *
|
47 |
-
****************************************************************************/
|
48 |
-
|
49 |
-
/****************************************************************************
|
50 |
-
// FPDI - Version 1.2
|
51 |
-
//
|
52 |
-
// Copyright 2004-2007 Setasign - Jan Slabon
|
53 |
-
//
|
54 |
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
55 |
-
// you may not use this file except in compliance with the License.
|
56 |
-
// You may obtain a copy of the License at
|
57 |
-
//
|
58 |
-
// http://www.apache.org/licenses/LICENSE-2.0
|
59 |
-
//
|
60 |
-
// Unless required by applicable law or agreed to in writing, software
|
61 |
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
62 |
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
63 |
-
// See the License for the specific language governing permissions and
|
64 |
-
// limitations under the License.
|
65 |
-
****************************************************************************/
|
66 |
-
|
67 |
-
/****************************************************************************
|
68 |
-
* @copyright Khaled Al-Shamaa 2008
|
69 |
-
* @link http://www.ar-php.org
|
70 |
-
* @author Khaled Al-Shamaa <khaled@ar-php.org>
|
71 |
-
* @desc Set of PHP5 / UTF-8 Classes developed to enhance Arabic web
|
72 |
-
* applications by providing set of tools includes stem-based searching,
|
73 |
-
* translitiration, soundex, Hijri calendar, charset detection and
|
74 |
-
* converter, spell numbers, keyboard language, Muslim prayer time,
|
75 |
-
* auto-summarization, and more...
|
76 |
-
* @package Arabic
|
77 |
-
*
|
78 |
-
* @version 1.8 released in Feb 15, 2009
|
79 |
-
*
|
80 |
-
* @license LGPL
|
81 |
-
****************************************************************************/
|
82 |
-
|
83 |
-
|
84 |
-
This library is free software; you can redistribute it and/or
|
85 |
-
modify it under the terms of the GNU Lesser General Public
|
86 |
-
License as published by the Free Software Foundation;
|
87 |
-
This library is distributed in the hope that it will be useful,
|
88 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
89 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
90 |
-
Lesser General Public License for more details.
|
91 |
-
[http://www.opensource.org/licenses/lgpl-license.php]
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/FONT INFO.txt
DELETED
@@ -1,164 +0,0 @@
|
|
1 |
-
|
2 |
-
=================
|
3 |
-
Open Source Fonts
|
4 |
-
=================
|
5 |
-
mPDF should be able to read most TrueType Unicode font files with a .ttf extension
|
6 |
-
Truetype fonts with .ttf or .otf extension and .ttc TrueType collections should also work OK.
|
7 |
-
|
8 |
-
You will probably therefore have access to any number of fonts, but here are some useful sources for
|
9 |
-
open-source or free-use fonts. Many of these were included with earlier versions of mPDF:
|
10 |
-
|
11 |
-
General collections
|
12 |
-
-------------------
|
13 |
-
- DejaVu font collection from: http://dejavu-fonts.org/wiki/Main_Page (included in the release)
|
14 |
-
- GNU FreeFont from: http://www.gnu.org/software/freefont/
|
15 |
-
- Linux Libertine from: http://www.linuxlibertine.org (use the .ttf files - not the .otf)
|
16 |
-
- Liberation Fonts from: https://fedorahosted.org/liberation-fonts/ or directly https://fedorahosted.org/releases/l/i/liberation-fonts/
|
17 |
-
|
18 |
-
Thai fonts
|
19 |
-
----------
|
20 |
-
- Collection of Thai fonts from: ftp://linux.thai.net/pub/thailinux/software/thai-ttf/
|
21 |
-
|
22 |
-
|
23 |
-
OCR-B
|
24 |
-
-----
|
25 |
-
OCRB (ocrb10) font: http://ansuz.sooke.bc.ca/software/ocrb.php
|
26 |
-
Useful for barcodes (included in the release)
|
27 |
-
|
28 |
-
Pan-Unicode fonts (fonts containing most characters defined in Unicode)
|
29 |
-
-----------------------------------------------------------------------
|
30 |
-
- BitStream Cyberbit from: http://aol-4.vo.llnwd.net/pub/communicator/extras/fonts/windows/
|
31 |
-
Cyberbit.ZIP (or just Google it)
|
32 |
-
(NB if run with $debug_fonts gives warning of invalid table checksum - just turn it off!)
|
33 |
-
- Code2000 (NB shareware) from: http://www.code2000.net/code2000_page.htm
|
34 |
-
- Quivira from: http://www.quivira-font.com/ (combining diacritics are not placed correctly, but has a very full set of glyphs)
|
35 |
-
|
36 |
-
|
37 |
-
CJK (Chinese-Japanese-Korean)
|
38 |
-
-----------------------------
|
39 |
-
HanNomA and B from: http://vietunicode.sourceforge.net/fonts/fonts_hannom.html
|
40 |
-
unBatang_0613 from: http://people.ktug.or.kr/~nomos/mine/UnBatang_0613.ttf
|
41 |
-
Sun-ExtA and Sun-ExtB from: http://www.alanwood.net/unicode/fonts-east-asian.html
|
42 |
-
(http://www.alanwood.net/downloads/index.html)
|
43 |
-
Fonts which contain both Unicode BMP and SIP (Supplementary Ideographic Plane)
|
44 |
-
characters in one file e.g. "AR PL UMing" and "AR PL UKai"
|
45 |
-
from: http://www.freedesktop.org
|
46 |
-
http://www.freedesktop.org/wiki/Software/CJKUnifonts/Download
|
47 |
-
[MS Windows fonts such as MS Mincho and MingLiU also work]
|
48 |
-
Japanese IPA fonts: http://ossipedia.ipa.go.jp/ipafont/index.html
|
49 |
-
|
50 |
-
Arabic/Eastern fonts
|
51 |
-
--------------------
|
52 |
-
- XW Zar fonts can be downloaded from: http://www.redlers.com/downloadfont.html
|
53 |
-
(2 of these fonts are included in the release)
|
54 |
-
(original site in Farsi: http://wiki.irmug.org/index.php/XWZar)
|
55 |
-
- See below for more details and font names of the fonts used in mPDF 4.x
|
56 |
-
|
57 |
-
|
58 |
-
Other sources
|
59 |
-
-------------
|
60 |
-
http://www.unifont.org/fontguide/
|
61 |
-
http://www.alanwood.net/unicode/fonts.html
|
62 |
-
http://cooltext.com (e.g. http://cooltext.com/Fonts-Unicode+Arabic)
|
63 |
-
ApparatusSIL, DoulosSIL, Padauk from SIL: http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&cat_id=FontDownloads
|
64 |
-
DaiBanna (Tai Le)
|
65 |
-
|
66 |
-
Mediaeval & Ancient Scripts
|
67 |
-
---------------------------
|
68 |
-
Junicode: http://junicode.sourceforge.net/
|
69 |
-
Cardo: http://scholarsfonts.net/cardofnt.html
|
70 |
-
|
71 |
-
Syriac fonts
|
72 |
-
------------
|
73 |
-
http://www.bethmardutho.org/meltho/
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
============
|
79 |
-
ARABIC FONTS
|
80 |
-
============
|
81 |
-
You can use any appropriate Unicode-encoded .ttf or .ttc font file for arabic text, but
|
82 |
-
the font file must include the Arabic Presentation Forms-B (U+FE70�U+FEFF).
|
83 |
-
2 of the XW Zar fonts are included in the release.
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
===========
|
88 |
-
INDIC FONTS
|
89 |
-
===========
|
90 |
-
Indic scripts e.g. Hindi, Bengali etc. use conjuct forms which have no Unicode assignment. You
|
91 |
-
cannot therefore use any standard .ttf font files with mPDF.
|
92 |
-
|
93 |
-
A set of fonts has been adapted to use specifically with mPDF. They are based on a set of fonts from:
|
94 |
-
|
95 |
-
http://www.cdacmumbai.in/projects/indix/e_introduction.shtml
|
96 |
-
|
97 |
-
NB These fonts are released under GNU GPL Version 2 license
|
98 |
-
|
99 |
-
You need these adapted fonts (ind_bn_1_001.ttf etc.) to work with mPDF, as the glyphs have been
|
100 |
-
assigned to Unicode values in the Private Use area (U+E000 ->). These are included in the
|
101 |
-
mPDF download.
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
Users of mPDF v4.x
|
106 |
-
------------------
|
107 |
-
The original indic font files do not contain a full set of even basic ASCII
|
108 |
-
characters. The fonts supplied have been "fixed" to include those extra
|
109 |
-
characters. This now works whether the font is subset or not.
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
=========
|
114 |
-
CJK Fonts
|
115 |
-
=========
|
116 |
-
|
117 |
-
|
118 |
-
Supplemental Ideographic Plane
|
119 |
-
==============================
|
120 |
-
SIP = Supplemental Ideographic Plane ( = Plane 2) = U+20000 - U+2FFFF (131072 - 196607)
|
121 |
-
These characters are required for the HKSCS Hong Kong Supplementary Character Set. Fonts with
|
122 |
-
SIP characters are commonly divided into a second file e.g. MingLiU and MingLiU-ExtB
|
123 |
-
|
124 |
-
mPDF requires 2 fonts and they should be cross-referenced in config_fonts.php e.g.
|
125 |
-
"sun-exta" => array(
|
126 |
-
'R' => "Sun-ExtA.ttf",
|
127 |
-
'sip-ext' => 'sun-extb',
|
128 |
-
),
|
129 |
-
"sun-extb" => array(
|
130 |
-
'R' => "Sun-ExtB.ttf",
|
131 |
-
),
|
132 |
-
|
133 |
-
--OR--
|
134 |
-
(NB these ones also define the font number within the TTC Collection as TTCfontID)
|
135 |
-
'mingliu' => array (
|
136 |
-
'R' => 'mingliu.ttc',
|
137 |
-
'TTCfontID' => array (
|
138 |
-
'R' => 1,
|
139 |
-
),
|
140 |
-
'sip-ext' => 'mingliu-extb',
|
141 |
-
),
|
142 |
-
'mingliu-extb' => array (
|
143 |
-
'R' => 'mingliub.ttc',
|
144 |
-
'TTCfontID' => array (
|
145 |
-
'R' => 1,
|
146 |
-
),
|
147 |
-
),
|
148 |
-
'mingliu_hkscs' => array (
|
149 |
-
'R' => 'mingliu.ttc',
|
150 |
-
'TTCfontID' => array (
|
151 |
-
'R' => 3,
|
152 |
-
),
|
153 |
-
'sip-ext' => 'mingliu_hkscs-extb',
|
154 |
-
),
|
155 |
-
'mingliu_hkscs-extb' => array (
|
156 |
-
'R' => 'mingliub.ttc',
|
157 |
-
'TTCfontID' => array (
|
158 |
-
'R' => 3,
|
159 |
-
),
|
160 |
-
),
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/LICENSE.txt
DELETED
@@ -1,340 +0,0 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 2, June 1991
|
3 |
-
|
4 |
-
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
5 |
-
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
6 |
-
Everyone is permitted to copy and distribute verbatim copies
|
7 |
-
of this license document, but changing it is not allowed.
|
8 |
-
|
9 |
-
Preamble
|
10 |
-
|
11 |
-
The licenses for most software are designed to take away your
|
12 |
-
freedom to share and change it. By contrast, the GNU General Public
|
13 |
-
License is intended to guarantee your freedom to share and change free
|
14 |
-
software--to make sure the software is free for all its users. This
|
15 |
-
General Public License applies to most of the Free Software
|
16 |
-
Foundation's software and to any other program whose authors commit to
|
17 |
-
using it. (Some other Free Software Foundation software is covered by
|
18 |
-
the GNU Library General Public License instead.) You can apply it to
|
19 |
-
your programs, too.
|
20 |
-
|
21 |
-
When we speak of free software, we are referring to freedom, not
|
22 |
-
price. Our General Public Licenses are designed to make sure that you
|
23 |
-
have the freedom to distribute copies of free software (and charge for
|
24 |
-
this service if you wish), that you receive source code or can get it
|
25 |
-
if you want it, that you can change the software or use pieces of it
|
26 |
-
in new free programs; and that you know you can do these things.
|
27 |
-
|
28 |
-
To protect your rights, we need to make restrictions that forbid
|
29 |
-
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
-
These restrictions translate to certain responsibilities for you if you
|
31 |
-
distribute copies of the software, or if you modify it.
|
32 |
-
|
33 |
-
For example, if you distribute copies of such a program, whether
|
34 |
-
gratis or for a fee, you must give the recipients all the rights that
|
35 |
-
you have. You must make sure that they, too, receive or can get the
|
36 |
-
source code. And you must show them these terms so they know their
|
37 |
-
rights.
|
38 |
-
|
39 |
-
We protect your rights with two steps: (1) copyright the software, and
|
40 |
-
(2) offer you this license which gives you legal permission to copy,
|
41 |
-
distribute and/or modify the software.
|
42 |
-
|
43 |
-
Also, for each author's protection and ours, we want to make certain
|
44 |
-
that everyone understands that there is no warranty for this free
|
45 |
-
software. If the software is modified by someone else and passed on, we
|
46 |
-
want its recipients to know that what they have is not the original, so
|
47 |
-
that any problems introduced by others will not reflect on the original
|
48 |
-
authors' reputations.
|
49 |
-
|
50 |
-
Finally, any free program is threatened constantly by software
|
51 |
-
patents. We wish to avoid the danger that redistributors of a free
|
52 |
-
program will individually obtain patent licenses, in effect making the
|
53 |
-
program proprietary. To prevent this, we have made it clear that any
|
54 |
-
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
-
|
56 |
-
The precise terms and conditions for copying, distribution and
|
57 |
-
modification follow.
|
58 |
-
|
59 |
-
GNU GENERAL PUBLIC LICENSE
|
60 |
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
-
|
62 |
-
0. This License applies to any program or other work which contains
|
63 |
-
a notice placed by the copyright holder saying it may be distributed
|
64 |
-
under the terms of this General Public License. The "Program", below,
|
65 |
-
refers to any such program or work, and a "work based on the Program"
|
66 |
-
means either the Program or any derivative work under copyright law:
|
67 |
-
that is to say, a work containing the Program or a portion of it,
|
68 |
-
either verbatim or with modifications and/or translated into another
|
69 |
-
language. (Hereinafter, translation is included without limitation in
|
70 |
-
the term "modification".) Each licensee is addressed as "you".
|
71 |
-
|
72 |
-
Activities other than copying, distribution and modification are not
|
73 |
-
covered by this License; they are outside its scope. The act of
|
74 |
-
running the Program is not restricted, and the output from the Program
|
75 |
-
is covered only if its contents constitute a work based on the
|
76 |
-
Program (independent of having been made by running the Program).
|
77 |
-
Whether that is true depends on what the Program does.
|
78 |
-
|
79 |
-
1. You may copy and distribute verbatim copies of the Program's
|
80 |
-
source code as you receive it, in any medium, provided that you
|
81 |
-
conspicuously and appropriately publish on each copy an appropriate
|
82 |
-
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
-
notices that refer to this License and to the absence of any warranty;
|
84 |
-
and give any other recipients of the Program a copy of this License
|
85 |
-
along with the Program.
|
86 |
-
|
87 |
-
You may charge a fee for the physical act of transferring a copy, and
|
88 |
-
you may at your option offer warranty protection in exchange for a fee.
|
89 |
-
|
90 |
-
2. You may modify your copy or copies of the Program or any portion
|
91 |
-
of it, thus forming a work based on the Program, and copy and
|
92 |
-
distribute such modifications or work under the terms of Section 1
|
93 |
-
above, provided that you also meet all of these conditions:
|
94 |
-
|
95 |
-
a) You must cause the modified files to carry prominent notices
|
96 |
-
stating that you changed the files and the date of any change.
|
97 |
-
|
98 |
-
b) You must cause any work that you distribute or publish, that in
|
99 |
-
whole or in part contains or is derived from the Program or any
|
100 |
-
part thereof, to be licensed as a whole at no charge to all third
|
101 |
-
parties under the terms of this License.
|
102 |
-
|
103 |
-
c) If the modified program normally reads commands interactively
|
104 |
-
when run, you must cause it, when started running for such
|
105 |
-
interactive use in the most ordinary way, to print or display an
|
106 |
-
announcement including an appropriate copyright notice and a
|
107 |
-
notice that there is no warranty (or else, saying that you provide
|
108 |
-
a warranty) and that users may redistribute the program under
|
109 |
-
these conditions, and telling the user how to view a copy of this
|
110 |
-
License. (Exception: if the Program itself is interactive but
|
111 |
-
does not normally print such an announcement, your work based on
|
112 |
-
the Program is not required to print an announcement.)
|
113 |
-
|
114 |
-
These requirements apply to the modified work as a whole. If
|
115 |
-
identifiable sections of that work are not derived from the Program,
|
116 |
-
and can be reasonably considered independent and separate works in
|
117 |
-
themselves, then this License, and its terms, do not apply to those
|
118 |
-
sections when you distribute them as separate works. But when you
|
119 |
-
distribute the same sections as part of a whole which is a work based
|
120 |
-
on the Program, the distribution of the whole must be on the terms of
|
121 |
-
this License, whose permissions for other licensees extend to the
|
122 |
-
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
-
|
124 |
-
Thus, it is not the intent of this section to claim rights or contest
|
125 |
-
your rights to work written entirely by you; rather, the intent is to
|
126 |
-
exercise the right to control the distribution of derivative or
|
127 |
-
collective works based on the Program.
|
128 |
-
|
129 |
-
In addition, mere aggregation of another work not based on the Program
|
130 |
-
with the Program (or with a work based on the Program) on a volume of
|
131 |
-
a storage or distribution medium does not bring the other work under
|
132 |
-
the scope of this License.
|
133 |
-
|
134 |
-
3. You may copy and distribute the Program (or a work based on it,
|
135 |
-
under Section 2) in object code or executable form under the terms of
|
136 |
-
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
-
|
138 |
-
a) Accompany it with the complete corresponding machine-readable
|
139 |
-
source code, which must be distributed under the terms of Sections
|
140 |
-
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
-
|
142 |
-
b) Accompany it with a written offer, valid for at least three
|
143 |
-
years, to give any third party, for a charge no more than your
|
144 |
-
cost of physically performing source distribution, a complete
|
145 |
-
machine-readable copy of the corresponding source code, to be
|
146 |
-
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
-
customarily used for software interchange; or,
|
148 |
-
|
149 |
-
c) Accompany it with the information you received as to the offer
|
150 |
-
to distribute corresponding source code. (This alternative is
|
151 |
-
allowed only for noncommercial distribution and only if you
|
152 |
-
received the program in object code or executable form with such
|
153 |
-
an offer, in accord with Subsection b above.)
|
154 |
-
|
155 |
-
The source code for a work means the preferred form of the work for
|
156 |
-
making modifications to it. For an executable work, complete source
|
157 |
-
code means all the source code for all modules it contains, plus any
|
158 |
-
associated interface definition files, plus the scripts used to
|
159 |
-
control compilation and installation of the executable. However, as a
|
160 |
-
special exception, the source code distributed need not include
|
161 |
-
anything that is normally distributed (in either source or binary
|
162 |
-
form) with the major components (compiler, kernel, and so on) of the
|
163 |
-
operating system on which the executable runs, unless that component
|
164 |
-
itself accompanies the executable.
|
165 |
-
|
166 |
-
If distribution of executable or object code is made by offering
|
167 |
-
access to copy from a designated place, then offering equivalent
|
168 |
-
access to copy the source code from the same place counts as
|
169 |
-
distribution of the source code, even though third parties are not
|
170 |
-
compelled to copy the source along with the object code.
|
171 |
-
|
172 |
-
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
-
except as expressly provided under this License. Any attempt
|
174 |
-
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
-
void, and will automatically terminate your rights under this License.
|
176 |
-
However, parties who have received copies, or rights, from you under
|
177 |
-
this License will not have their licenses terminated so long as such
|
178 |
-
parties remain in full compliance.
|
179 |
-
|
180 |
-
5. You are not required to accept this License, since you have not
|
181 |
-
signed it. However, nothing else grants you permission to modify or
|
182 |
-
distribute the Program or its derivative works. These actions are
|
183 |
-
prohibited by law if you do not accept this License. Therefore, by
|
184 |
-
modifying or distributing the Program (or any work based on the
|
185 |
-
Program), you indicate your acceptance of this License to do so, and
|
186 |
-
all its terms and conditions for copying, distributing or modifying
|
187 |
-
the Program or works based on it.
|
188 |
-
|
189 |
-
6. Each time you redistribute the Program (or any work based on the
|
190 |
-
Program), the recipient automatically receives a license from the
|
191 |
-
original licensor to copy, distribute or modify the Program subject to
|
192 |
-
these terms and conditions. You may not impose any further
|
193 |
-
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
-
You are not responsible for enforcing compliance by third parties to
|
195 |
-
this License.
|
196 |
-
|
197 |
-
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
-
infringement or for any other reason (not limited to patent issues),
|
199 |
-
conditions are imposed on you (whether by court order, agreement or
|
200 |
-
otherwise) that contradict the conditions of this License, they do not
|
201 |
-
excuse you from the conditions of this License. If you cannot
|
202 |
-
distribute so as to satisfy simultaneously your obligations under this
|
203 |
-
License and any other pertinent obligations, then as a consequence you
|
204 |
-
may not distribute the Program at all. For example, if a patent
|
205 |
-
license would not permit royalty-free redistribution of the Program by
|
206 |
-
all those who receive copies directly or indirectly through you, then
|
207 |
-
the only way you could satisfy both it and this License would be to
|
208 |
-
refrain entirely from distribution of the Program.
|
209 |
-
|
210 |
-
If any portion of this section is held invalid or unenforceable under
|
211 |
-
any particular circumstance, the balance of the section is intended to
|
212 |
-
apply and the section as a whole is intended to apply in other
|
213 |
-
circumstances.
|
214 |
-
|
215 |
-
It is not the purpose of this section to induce you to infringe any
|
216 |
-
patents or other property right claims or to contest validity of any
|
217 |
-
such claims; this section has the sole purpose of protecting the
|
218 |
-
integrity of the free software distribution system, which is
|
219 |
-
implemented by public license practices. Many people have made
|
220 |
-
generous contributions to the wide range of software distributed
|
221 |
-
through that system in reliance on consistent application of that
|
222 |
-
system; it is up to the author/donor to decide if he or she is willing
|
223 |
-
to distribute software through any other system and a licensee cannot
|
224 |
-
impose that choice.
|
225 |
-
|
226 |
-
This section is intended to make thoroughly clear what is believed to
|
227 |
-
be a consequence of the rest of this License.
|
228 |
-
|
229 |
-
8. If the distribution and/or use of the Program is restricted in
|
230 |
-
certain countries either by patents or by copyrighted interfaces, the
|
231 |
-
original copyright holder who places the Program under this License
|
232 |
-
may add an explicit geographical distribution limitation excluding
|
233 |
-
those countries, so that distribution is permitted only in or among
|
234 |
-
countries not thus excluded. In such case, this License incorporates
|
235 |
-
the limitation as if written in the body of this License.
|
236 |
-
|
237 |
-
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
-
of the General Public License from time to time. Such new versions will
|
239 |
-
be similar in spirit to the present version, but may differ in detail to
|
240 |
-
address new problems or concerns.
|
241 |
-
|
242 |
-
Each version is given a distinguishing version number. If the Program
|
243 |
-
specifies a version number of this License which applies to it and "any
|
244 |
-
later version", you have the option of following the terms and conditions
|
245 |
-
either of that version or of any later version published by the Free
|
246 |
-
Software Foundation. If the Program does not specify a version number of
|
247 |
-
this License, you may choose any version ever published by the Free Software
|
248 |
-
Foundation.
|
249 |
-
|
250 |
-
10. If you wish to incorporate parts of the Program into other free
|
251 |
-
programs whose distribution conditions are different, write to the author
|
252 |
-
to ask for permission. For software which is copyrighted by the Free
|
253 |
-
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
-
make exceptions for this. Our decision will be guided by the two goals
|
255 |
-
of preserving the free status of all derivatives of our free software and
|
256 |
-
of promoting the sharing and reuse of software generally.
|
257 |
-
|
258 |
-
NO WARRANTY
|
259 |
-
|
260 |
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
-
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
-
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
-
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
-
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
-
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
-
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
-
REPAIR OR CORRECTION.
|
269 |
-
|
270 |
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
-
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
-
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
-
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
-
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
-
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
-
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
-
POSSIBILITY OF SUCH DAMAGES.
|
279 |
-
|
280 |
-
END OF TERMS AND CONDITIONS
|
281 |
-
|
282 |
-
How to Apply These Terms to Your New Programs
|
283 |
-
|
284 |
-
If you develop a new program, and you want it to be of the greatest
|
285 |
-
possible use to the public, the best way to achieve this is to make it
|
286 |
-
free software which everyone can redistribute and change under these terms.
|
287 |
-
|
288 |
-
To do so, attach the following notices to the program. It is safest
|
289 |
-
to attach them to the start of each source file to most effectively
|
290 |
-
convey the exclusion of warranty; and each file should have at least
|
291 |
-
the "copyright" line and a pointer to where the full notice is found.
|
292 |
-
|
293 |
-
<one line to give the program's name and a brief idea of what it does.>
|
294 |
-
Copyright (C) <year> <name of author>
|
295 |
-
|
296 |
-
This program is free software; you can redistribute it and/or modify
|
297 |
-
it under the terms of the GNU General Public License as published by
|
298 |
-
the Free Software Foundation; either version 2 of the License, or
|
299 |
-
(at your option) any later version.
|
300 |
-
|
301 |
-
This program is distributed in the hope that it will be useful,
|
302 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
-
GNU General Public License for more details.
|
305 |
-
|
306 |
-
You should have received a copy of the GNU General Public License
|
307 |
-
along with this program; if not, write to the Free Software
|
308 |
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
309 |
-
|
310 |
-
|
311 |
-
Also add information on how to contact you by electronic and paper mail.
|
312 |
-
|
313 |
-
If the program is interactive, make it output a short notice like this
|
314 |
-
when it starts in an interactive mode:
|
315 |
-
|
316 |
-
Gnomovision version 69, Copyright (C) year name of author
|
317 |
-
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
318 |
-
This is free software, and you are welcome to redistribute it
|
319 |
-
under certain conditions; type `show c' for details.
|
320 |
-
|
321 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
322 |
-
parts of the General Public License. Of course, the commands you use may
|
323 |
-
be called something other than `show w' and `show c'; they could even be
|
324 |
-
mouse-clicks or menu items--whatever suits your program.
|
325 |
-
|
326 |
-
You should also get your employer (if you work as a programmer) or your
|
327 |
-
school, if any, to sign a "copyright disclaimer" for the program, if
|
328 |
-
necessary. Here is a sample; alter the names:
|
329 |
-
|
330 |
-
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
331 |
-
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
332 |
-
|
333 |
-
<signature of Ty Coon>, 1 April 1989
|
334 |
-
Ty Coon, President of Vice
|
335 |
-
|
336 |
-
This General Public License does not permit incorporating your program into
|
337 |
-
proprietary programs. If your program is a subroutine library, you may
|
338 |
-
consider it more useful to permit linking proprietary applications with the
|
339 |
-
library. If this is what you want to do, use the GNU Library General
|
340 |
-
Public License instead of this License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/README.txt
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
Upgrading
|
2 |
-
============
|
3 |
-
|
4 |
-
To upgrade from mPDF 5.7 to 5.7.1, simply upload the 3 files to their corresponding folders, overwriting files as required.
|
5 |
-
|
|
|
|
|
|
|
|
|
|
mPDF/classes/barcode.php
DELETED
@@ -1,1966 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Adapted for mPDF from TCPDF barcode. Original Details left below.
|
4 |
-
|
5 |
-
//============================================================+
|
6 |
-
// File name : barcodes.php
|
7 |
-
// Begin : 2008-06-09
|
8 |
-
// Last Update : 2009-04-15
|
9 |
-
// Version : 1.0.008
|
10 |
-
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
|
11 |
-
// ----------------------------------------------------------------------------
|
12 |
-
// Copyright (C) 2008-2009 Nicola Asuni - Tecnick.com S.r.l.
|
13 |
-
//
|
14 |
-
// This program is free software: you can redistribute it and/or modify
|
15 |
-
// it under the terms of the GNU Lesser General Public License as published by
|
16 |
-
// the Free Software Foundation, either version 2.1 of the License, or
|
17 |
-
// (at your option) any later version.
|
18 |
-
//
|
19 |
-
// This program is distributed in the hope that it will be useful,
|
20 |
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
-
// GNU Lesser General Public License for more details.
|
23 |
-
//
|
24 |
-
// You should have received a copy of the GNU Lesser General Public License
|
25 |
-
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
26 |
-
//
|
27 |
-
// See LICENSE.TXT file for more information.
|
28 |
-
// ----------------------------------------------------------------------------
|
29 |
-
//
|
30 |
-
// Description : PHP class to creates array representations for
|
31 |
-
// common 1D barcodes to be used with TCPDF.
|
32 |
-
//
|
33 |
-
// Author: Nicola Asuni
|
34 |
-
//
|
35 |
-
// (c) Copyright:
|
36 |
-
// Nicola Asuni
|
37 |
-
// Tecnick.com S.r.l.
|
38 |
-
// Via della Pace, 11
|
39 |
-
// 09044 Quartucciu (CA)
|
40 |
-
// ITALY
|
41 |
-
// www.tecnick.com
|
42 |
-
// info@tecnick.com
|
43 |
-
//============================================================+
|
44 |
-
|
45 |
-
class PDFBarcode {
|
46 |
-
|
47 |
-
protected $barcode_array;
|
48 |
-
protected $gapwidth;
|
49 |
-
protected $print_ratio;
|
50 |
-
protected $daft;
|
51 |
-
|
52 |
-
public function __construct() {
|
53 |
-
|
54 |
-
}
|
55 |
-
|
56 |
-
public function getBarcodeArray($code, $type, $pr='') {
|
57 |
-
$this->setBarcode($code, $type, $pr);
|
58 |
-
return $this->barcode_array;
|
59 |
-
}
|
60 |
-
public function getChecksum($code, $type) {
|
61 |
-
$this->setBarcode($code, $type);
|
62 |
-
if (!$this->barcode_array) { return ''; }
|
63 |
-
else { return $this->barcode_array['checkdigit']; }
|
64 |
-
}
|
65 |
-
|
66 |
-
public function setBarcode($code, $type, $pr='') {
|
67 |
-
$this->print_ratio = 1;
|
68 |
-
switch (strtoupper($type)) {
|
69 |
-
case 'ISBN':
|
70 |
-
case 'ISSN':
|
71 |
-
case 'EAN13': { // EAN 13
|
72 |
-
$arrcode = $this->barcode_eanupc($code, 13);
|
73 |
-
$arrcode['lightmL'] = 11; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
74 |
-
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
75 |
-
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
76 |
-
$arrcode['nom-H'] = 25.93; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
77 |
-
break;
|
78 |
-
}
|
79 |
-
case 'UPCA': { // UPC-A
|
80 |
-
$arrcode = $this->barcode_eanupc($code, 12);
|
81 |
-
$arrcode['lightmL'] = 9; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
82 |
-
$arrcode['lightmR'] = 9; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
83 |
-
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
84 |
-
$arrcode['nom-H'] = 25.91; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
85 |
-
break;
|
86 |
-
}
|
87 |
-
case 'UPCE': { // UPC-E
|
88 |
-
$arrcode = $this->barcode_eanupc($code, 6);
|
89 |
-
$arrcode['lightmL'] = 9; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
90 |
-
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
91 |
-
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
92 |
-
$arrcode['nom-H'] = 25.93; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
93 |
-
break;
|
94 |
-
}
|
95 |
-
case 'EAN8': { // EAN 8
|
96 |
-
$arrcode = $this->barcode_eanupc($code, 8);
|
97 |
-
$arrcode['lightmL'] = 7; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
98 |
-
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
99 |
-
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
100 |
-
$arrcode['nom-H'] = 21.64; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
101 |
-
break;
|
102 |
-
}
|
103 |
-
case 'EAN2': { // 2-Digits UPC-Based Extention
|
104 |
-
$arrcode = $this->barcode_eanext($code, 2);
|
105 |
-
$arrcode['lightmL'] = 7; // LEFT light margin = x X-dim (estimated)
|
106 |
-
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (estimated)
|
107 |
-
$arrcode['sepM'] = 9; // SEPARATION margin = x X-dim (http://web.archive.org/web/19990501035133/http://www.uc-council.org/d36-d.htm)
|
108 |
-
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
109 |
-
$arrcode['nom-H'] = 20; // Nominal bar height in mm incl. numerals (estimated) not used when combined
|
110 |
-
break;
|
111 |
-
}
|
112 |
-
case 'EAN5': { // 5-Digits UPC-Based Extention
|
113 |
-
$arrcode = $this->barcode_eanext($code, 5);
|
114 |
-
$arrcode['lightmL'] = 7; // LEFT light margin = x X-dim (estimated)
|
115 |
-
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (estimated)
|
116 |
-
$arrcode['sepM'] = 9; // SEPARATION margin = x X-dim (http://web.archive.org/web/19990501035133/http://www.uc-council.org/d36-d.htm)
|
117 |
-
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
118 |
-
$arrcode['nom-H'] = 20; // Nominal bar height in mm incl. numerals (estimated) not used when combined
|
119 |
-
break;
|
120 |
-
}
|
121 |
-
|
122 |
-
case 'IMB': { // IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
|
123 |
-
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
124 |
-
$bpi = 22; // Bars per inch
|
125 |
-
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
126 |
-
$this->gapwidth = ((25.4/$bpi) - $xdim)/$xdim;
|
127 |
-
$this->daft = array('D'=>2, 'A'=>2, 'F'=>3, 'T'=>1); // Descender; Ascender; Full; Tracker bar heights
|
128 |
-
$arrcode = $this->barcode_imb($code);
|
129 |
-
$arrcode['nom-X'] = $xdim ;
|
130 |
-
$arrcode['nom-H'] = 3.68; // Nominal value for Height of Full bar in mm (spec.)
|
131 |
-
// USPS-B-3200 Revision C = 4.623
|
132 |
-
// USPS-B-3200 Revision E = 3.68
|
133 |
-
$arrcode['quietL'] = 3.175; // LEFT Quiet margin = mm (spec.)
|
134 |
-
$arrcode['quietR'] = 3.175; // RIGHT Quiet margin = mm (spec.)
|
135 |
-
$arrcode['quietTB'] = 0.711; // TOP/BOTTOM Quiet margin = mm (spec.)
|
136 |
-
break;
|
137 |
-
}
|
138 |
-
case 'RM4SCC': { // RM4SCC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
|
139 |
-
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
140 |
-
$bpi = 22; // Bars per inch
|
141 |
-
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
142 |
-
$this->gapwidth = ((25.4/$bpi) - $xdim)/$xdim;
|
143 |
-
$this->daft = array('D'=>5, 'A'=>5, 'F'=>8, 'T'=>2); // Descender; Ascender; Full; Tracker bar heights
|
144 |
-
$arrcode = $this->barcode_rm4scc($code, false);
|
145 |
-
$arrcode['nom-X'] = $xdim ;
|
146 |
-
$arrcode['nom-H'] = 5.0; // Nominal value for Height of Full bar in mm (spec.)
|
147 |
-
$arrcode['quietL'] = 2; // LEFT Quiet margin = mm (spec.)
|
148 |
-
$arrcode['quietR'] = 2; // RIGHT Quiet margin = mm (spec.)
|
149 |
-
$arrcode['quietTB'] = 2; // TOP/BOTTOM Quiet margin = mm (spec?)
|
150 |
-
break;
|
151 |
-
}
|
152 |
-
case 'KIX': { // KIX (Klant index - Customer index)
|
153 |
-
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
154 |
-
$bpi = 22; // Bars per inch
|
155 |
-
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
156 |
-
$this->gapwidth = ((25.4/$bpi) - $xdim)/$xdim;
|
157 |
-
$this->daft = array('D'=>5, 'A'=>5, 'F'=>8, 'T'=>2); // Descender; Ascender; Full; Tracker bar heights
|
158 |
-
$arrcode = $this->barcode_rm4scc($code, true);
|
159 |
-
$arrcode['nom-X'] = $xdim ;
|
160 |
-
$arrcode['nom-H'] = 5.0; // Nominal value for Height of Full bar in mm (? spec.)
|
161 |
-
$arrcode['quietL'] = 2; // LEFT Quiet margin = mm (spec.)
|
162 |
-
$arrcode['quietR'] = 2; // RIGHT Quiet margin = mm (spec.)
|
163 |
-
$arrcode['quietTB'] = 2; // TOP/BOTTOM Quiet margin = mm (spec.)
|
164 |
-
break;
|
165 |
-
}
|
166 |
-
case 'POSTNET': { // POSTNET
|
167 |
-
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
168 |
-
$bpi = 22; // Bars per inch
|
169 |
-
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
170 |
-
$this->gapwidth = ((25.4/$bpi) - $xdim)/$xdim;
|
171 |
-
$arrcode = $this->barcode_postnet($code, false);
|
172 |
-
$arrcode['nom-X'] = $xdim ;
|
173 |
-
$arrcode['nom-H'] = 3.175; // Nominal value for Height of Full bar in mm (spec.)
|
174 |
-
$arrcode['quietL'] = 3.175; // LEFT Quiet margin = mm (?spec.)
|
175 |
-
$arrcode['quietR'] = 3.175; // RIGHT Quiet margin = mm (?spec.)
|
176 |
-
$arrcode['quietTB'] = 1.016; // TOP/BOTTOM Quiet margin = mm (?spec.)
|
177 |
-
break;
|
178 |
-
}
|
179 |
-
case 'PLANET': { // PLANET
|
180 |
-
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
181 |
-
$bpi = 22; // Bars per inch
|
182 |
-
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
183 |
-
$this->gapwidth = ((25.4/$bpi) - $xdim)/$xdim;
|
184 |
-
$arrcode = $this->barcode_postnet($code, true);
|
185 |
-
$arrcode['nom-X'] = $xdim ;
|
186 |
-
$arrcode['nom-H'] = 3.175; // Nominal value for Height of Full bar in mm (spec.)
|
187 |
-
$arrcode['quietL'] = 3.175; // LEFT Quiet margin = mm (?spec.)
|
188 |
-
$arrcode['quietR'] = 3.175; // RIGHT Quiet margin = mm (?spec.)
|
189 |
-
$arrcode['quietTB'] = 1.016; // TOP/BOTTOM Quiet margin = mm (?spec.)
|
190 |
-
break;
|
191 |
-
}
|
192 |
-
|
193 |
-
case 'C93': { // CODE 93 - USS-93
|
194 |
-
$arrcode = $this->barcode_code93($code);
|
195 |
-
if ($arrcode == false) { break; }
|
196 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
197 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
198 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
199 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
200 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
201 |
-
break;
|
202 |
-
}
|
203 |
-
case 'CODE11': { // CODE 11
|
204 |
-
if ($pr > 0) { $this->print_ratio = $pr; }
|
205 |
-
else { $this->print_ratio = 3; } // spec: Pr= 1:2.24 - 1:3.5
|
206 |
-
$arrcode = $this->barcode_code11($code);
|
207 |
-
if ($arrcode == false) { break; }
|
208 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
209 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
210 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
211 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
212 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
213 |
-
break;
|
214 |
-
}
|
215 |
-
case 'MSI': // MSI (Variation of Plessey code)
|
216 |
-
case 'MSI+': { // MSI + CHECKSUM (modulo 11)
|
217 |
-
if (strtoupper($type)=='MSI') { $arrcode = $this->barcode_msi($code, false); }
|
218 |
-
if (strtoupper($type)=='MSI+') { $arrcode = $this->barcode_msi($code, true); }
|
219 |
-
if ($arrcode == false) { break; }
|
220 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
221 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
222 |
-
$arrcode['lightmL'] = 12; // LEFT light margin = x X-dim (spec.)
|
223 |
-
$arrcode['lightmR'] = 12; // RIGHT light margin = x X-dim (spec.)
|
224 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
225 |
-
break;
|
226 |
-
}
|
227 |
-
case 'CODABAR': { // CODABAR
|
228 |
-
if ($pr > 0) { $this->print_ratio = $pr; }
|
229 |
-
else { $this->print_ratio = 2.5; } // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
230 |
-
if (strtoupper($type)=='CODABAR') { $arrcode = $this->barcode_codabar($code); }
|
231 |
-
if ($arrcode == false) { break; }
|
232 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
233 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
234 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
235 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
236 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
237 |
-
break;
|
238 |
-
}
|
239 |
-
case 'C128A': // CODE 128 A
|
240 |
-
case 'C128B': // CODE 128 B
|
241 |
-
case 'C128C': // CODE 128 C
|
242 |
-
case 'EAN128A': // EAN 128 A
|
243 |
-
case 'EAN128B': // EAN 128 B
|
244 |
-
case 'EAN128C': { // EAN 128 C
|
245 |
-
if (strtoupper($type)=='C128A') { $arrcode = $this->barcode_c128($code, 'A'); }
|
246 |
-
if (strtoupper($type)=='C128B') { $arrcode = $this->barcode_c128($code, 'B'); }
|
247 |
-
if (strtoupper($type)=='C128C') { $arrcode = $this->barcode_c128($code, 'C'); }
|
248 |
-
if (strtoupper($type)=='EAN128A') { $arrcode = $this->barcode_c128($code, 'A', true); }
|
249 |
-
if (strtoupper($type)=='EAN128B') { $arrcode = $this->barcode_c128($code, 'B', true); }
|
250 |
-
if (strtoupper($type)=='EAN128C') { $arrcode = $this->barcode_c128($code, 'C', true); }
|
251 |
-
if ($arrcode == false) { break; }
|
252 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
253 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
254 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
255 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
256 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
257 |
-
break;
|
258 |
-
}
|
259 |
-
case 'C39': // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
|
260 |
-
case 'C39+': // CODE 39 with checksum
|
261 |
-
case 'C39E': // CODE 39 EXTENDED
|
262 |
-
case 'C39E+': { // CODE 39 EXTENDED + CHECKSUM
|
263 |
-
if ($pr > 0) { $this->print_ratio = $pr; }
|
264 |
-
else { $this->print_ratio = 2.5; } // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
265 |
-
$code = str_replace(chr(194).chr(160), ' ', $code); // mPDF 5.3.95 (for utf-8 encoded)
|
266 |
-
$code = str_replace(chr(160), ' ', $code); // mPDF 5.3.95 (for win-1252)
|
267 |
-
if (strtoupper($type)=='C39') { $arrcode = $this->barcode_code39($code, false, false); }
|
268 |
-
if (strtoupper($type)=='C39+') { $arrcode = $this->barcode_code39($code, false, true); }
|
269 |
-
if (strtoupper($type)=='C39E') { $arrcode = $this->barcode_code39($code, true, false); }
|
270 |
-
if (strtoupper($type)=='C39E+') { $arrcode = $this->barcode_code39($code, true, true); }
|
271 |
-
if ($arrcode == false) { break; }
|
272 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
273 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
274 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
275 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
276 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
277 |
-
break;
|
278 |
-
}
|
279 |
-
case 'S25': // Standard 2 of 5
|
280 |
-
case 'S25+': { // Standard 2 of 5 + CHECKSUM
|
281 |
-
if ($pr > 0) { $this->print_ratio = $pr; }
|
282 |
-
else { $this->print_ratio = 3; } // spec: Pr=1:3/1:4.5
|
283 |
-
if (strtoupper($type)=='S25') { $arrcode = $this->barcode_s25($code, false); }
|
284 |
-
if (strtoupper($type)=='S25+') { $arrcode = $this->barcode_s25($code, true); }
|
285 |
-
if ($arrcode == false) { break; }
|
286 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
287 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
288 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
289 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
290 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
291 |
-
break;
|
292 |
-
}
|
293 |
-
case 'I25': // Interleaved 2 of 5
|
294 |
-
case 'I25+': { // Interleaved 2 of 5 + CHECKSUM
|
295 |
-
if ($pr > 0) { $this->print_ratio = $pr; }
|
296 |
-
else { $this->print_ratio = 2.5; } // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
297 |
-
if (strtoupper($type)=='I25') { $arrcode = $this->barcode_i25($code, false); }
|
298 |
-
if (strtoupper($type)=='I25+') { $arrcode = $this->barcode_i25($code, true); }
|
299 |
-
if ($arrcode == false) { break; }
|
300 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
301 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
302 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
303 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
304 |
-
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
305 |
-
break;
|
306 |
-
}
|
307 |
-
case 'I25B': // Interleaved 2 of 5 + Bearer bars
|
308 |
-
case 'I25B+': { // Interleaved 2 of 5 + CHECKSUM + Bearer bars
|
309 |
-
if ($pr > 0) { $this->print_ratio = $pr; }
|
310 |
-
else { $this->print_ratio = 2.5; } // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
311 |
-
if (strtoupper($type)=='I25B') { $arrcode = $this->barcode_i25($code, false); }
|
312 |
-
if (strtoupper($type)=='I25B+') { $arrcode = $this->barcode_i25($code, true); }
|
313 |
-
if ($arrcode == false) { break; }
|
314 |
-
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
315 |
-
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
316 |
-
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
317 |
-
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
318 |
-
$arrcode['lightTB'] = 2; // TOP/BOTTOM light margin = x X-dim (non-spec.) - used for bearer bars
|
319 |
-
break;
|
320 |
-
}
|
321 |
-
default: {
|
322 |
-
$this->barcode_array = false;
|
323 |
-
}
|
324 |
-
}
|
325 |
-
$this->barcode_array = $arrcode;
|
326 |
-
}
|
327 |
-
|
328 |
-
/**
|
329 |
-
* CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
|
330 |
-
*/
|
331 |
-
protected function barcode_code39($code, $extended=false, $checksum=false) {
|
332 |
-
$chr['0'] = '111221211';
|
333 |
-
$chr['1'] = '211211112';
|
334 |
-
$chr['2'] = '112211112';
|
335 |
-
$chr['3'] = '212211111';
|
336 |
-
$chr['4'] = '111221112';
|
337 |
-
$chr['5'] = '211221111';
|
338 |
-
$chr['6'] = '112221111';
|
339 |
-
$chr['7'] = '111211212';
|
340 |
-
$chr['8'] = '211211211';
|
341 |
-
$chr['9'] = '112211211';
|
342 |
-
$chr['A'] = '211112112';
|
343 |
-
$chr['B'] = '112112112';
|
344 |
-
$chr['C'] = '212112111';
|
345 |
-
$chr['D'] = '111122112';
|
346 |
-
$chr['E'] = '211122111';
|
347 |
-
$chr['F'] = '112122111';
|
348 |
-
$chr['G'] = '111112212';
|
349 |
-
$chr['H'] = '211112211';
|
350 |
-
$chr['I'] = '112112211';
|
351 |
-
$chr['J'] = '111122211';
|
352 |
-
$chr['K'] = '211111122';
|
353 |
-
$chr['L'] = '112111122';
|
354 |
-
$chr['M'] = '212111121';
|
355 |
-
$chr['N'] = '111121122';
|
356 |
-
$chr['O'] = '211121121';
|
357 |
-
$chr['P'] = '112121121';
|
358 |
-
$chr['Q'] = '111111222';
|
359 |
-
$chr['R'] = '211111221';
|
360 |
-
$chr['S'] = '112111221';
|
361 |
-
$chr['T'] = '111121221';
|
362 |
-
$chr['U'] = '221111112';
|
363 |
-
$chr['V'] = '122111112';
|
364 |
-
$chr['W'] = '222111111';
|
365 |
-
$chr['X'] = '121121112';
|
366 |
-
$chr['Y'] = '221121111';
|
367 |
-
$chr['Z'] = '122121111';
|
368 |
-
$chr['-'] = '121111212';
|
369 |
-
$chr['.'] = '221111211';
|
370 |
-
$chr[' '] = '122111211';
|
371 |
-
$chr['$'] = '121212111';
|
372 |
-
$chr['/'] = '121211121';
|
373 |
-
$chr['+'] = '121112121';
|
374 |
-
$chr['%'] = '111212121';
|
375 |
-
$chr['*'] = '121121211';
|
376 |
-
|
377 |
-
$code = strtoupper($code);
|
378 |
-
if ($extended) {
|
379 |
-
// extended mode
|
380 |
-
$code = $this->encode_code39_ext($code);
|
381 |
-
}
|
382 |
-
if ($code === false) {
|
383 |
-
return false;
|
384 |
-
}
|
385 |
-
if ($checksum) {
|
386 |
-
// checksum
|
387 |
-
$checkdigit = $this->checksum_code39($code);
|
388 |
-
$code .= $checkdigit ;
|
389 |
-
}
|
390 |
-
// add start and stop codes
|
391 |
-
$code = '*'.$code.'*';
|
392 |
-
|
393 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
394 |
-
$k = 0;
|
395 |
-
$clen = strlen($code);
|
396 |
-
for ($i = 0; $i < $clen; ++$i) {
|
397 |
-
$char = $code[$i];
|
398 |
-
if(!isset($chr[$char])) {
|
399 |
-
// invalid character
|
400 |
-
return false;
|
401 |
-
}
|
402 |
-
for ($j = 0; $j < 9; ++$j) {
|
403 |
-
if (($j % 2) == 0) {
|
404 |
-
$t = true; // bar
|
405 |
-
} else {
|
406 |
-
$t = false; // space
|
407 |
-
}
|
408 |
-
$x = $chr[$char][$j];
|
409 |
-
if ($x == 2) { $w = $this->print_ratio; }
|
410 |
-
else { $w = 1; }
|
411 |
-
|
412 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
413 |
-
$bararray['maxw'] += $w;
|
414 |
-
++$k;
|
415 |
-
}
|
416 |
-
$bararray['bcode'][$k] = array('t' => false, 'w' => 1, 'h' => 1, 'p' => 0);
|
417 |
-
$bararray['maxw'] += 1;
|
418 |
-
++$k;
|
419 |
-
}
|
420 |
-
$bararray['checkdigit'] = $checkdigit;
|
421 |
-
return $bararray;
|
422 |
-
}
|
423 |
-
|
424 |
-
/**
|
425 |
-
* Encode a string to be used for CODE 39 Extended mode.
|
426 |
-
*/
|
427 |
-
protected function encode_code39_ext($code) {
|
428 |
-
$encode = array(
|
429 |
-
chr(0) => '%U', chr(1) => '$A', chr(2) => '$B', chr(3) => '$C',
|
430 |
-
chr(4) => '$D', chr(5) => '$E', chr(6) => '$F', chr(7) => '$G',
|
431 |
-
chr(8) => '$H', chr(9) => '$I', chr(10) => '$J', chr(11) => '£K',
|
432 |
-
chr(12) => '$L', chr(13) => '$M', chr(14) => '$N', chr(15) => '$O',
|
433 |
-
chr(16) => '$P', chr(17) => '$Q', chr(18) => '$R', chr(19) => '$S',
|
434 |
-
chr(20) => '$T', chr(21) => '$U', chr(22) => '$V', chr(23) => '$W',
|
435 |
-
chr(24) => '$X', chr(25) => '$Y', chr(26) => '$Z', chr(27) => '%A',
|
436 |
-
chr(28) => '%B', chr(29) => '%C', chr(30) => '%D', chr(31) => '%E',
|
437 |
-
chr(32) => ' ', chr(33) => '/A', chr(34) => '/B', chr(35) => '/C',
|
438 |
-
chr(36) => '/D', chr(37) => '/E', chr(38) => '/F', chr(39) => '/G',
|
439 |
-
chr(40) => '/H', chr(41) => '/I', chr(42) => '/J', chr(43) => '/K',
|
440 |
-
chr(44) => '/L', chr(45) => '-', chr(46) => '.', chr(47) => '/O',
|
441 |
-
chr(48) => '0', chr(49) => '1', chr(50) => '2', chr(51) => '3',
|
442 |
-
chr(52) => '4', chr(53) => '5', chr(54) => '6', chr(55) => '7',
|
443 |
-
chr(56) => '8', chr(57) => '9', chr(58) => '/Z', chr(59) => '%F',
|
444 |
-
chr(60) => '%G', chr(61) => '%H', chr(62) => '%I', chr(63) => '%J',
|
445 |
-
chr(64) => '%V', chr(65) => 'A', chr(66) => 'B', chr(67) => 'C',
|
446 |
-
chr(68) => 'D', chr(69) => 'E', chr(70) => 'F', chr(71) => 'G',
|
447 |
-
chr(72) => 'H', chr(73) => 'I', chr(74) => 'J', chr(75) => 'K',
|
448 |
-
chr(76) => 'L', chr(77) => 'M', chr(78) => 'N', chr(79) => 'O',
|
449 |
-
chr(80) => 'P', chr(81) => 'Q', chr(82) => 'R', chr(83) => 'S',
|
450 |
-
chr(84) => 'T', chr(85) => 'U', chr(86) => 'V', chr(87) => 'W',
|
451 |
-
chr(88) => 'X', chr(89) => 'Y', chr(90) => 'Z', chr(91) => '%K',
|
452 |
-
chr(92) => '%L', chr(93) => '%M', chr(94) => '%N', chr(95) => '%O',
|
453 |
-
chr(96) => '%W', chr(97) => '+A', chr(98) => '+B', chr(99) => '+C',
|
454 |
-
chr(100) => '+D', chr(101) => '+E', chr(102) => '+F', chr(103) => '+G',
|
455 |
-
chr(104) => '+H', chr(105) => '+I', chr(106) => '+J', chr(107) => '+K',
|
456 |
-
chr(108) => '+L', chr(109) => '+M', chr(110) => '+N', chr(111) => '+O',
|
457 |
-
chr(112) => '+P', chr(113) => '+Q', chr(114) => '+R', chr(115) => '+S',
|
458 |
-
chr(116) => '+T', chr(117) => '+U', chr(118) => '+V', chr(119) => '+W',
|
459 |
-
chr(120) => '+X', chr(121) => '+Y', chr(122) => '+Z', chr(123) => '%P',
|
460 |
-
chr(124) => '%Q', chr(125) => '%R', chr(126) => '%S', chr(127) => '%T');
|
461 |
-
$code_ext = '';
|
462 |
-
$clen = strlen($code);
|
463 |
-
for ($i = 0 ; $i < $clen; ++$i) {
|
464 |
-
if (ord($code[$i]) > 127) {
|
465 |
-
return false;
|
466 |
-
}
|
467 |
-
$code_ext .= $encode[$code[$i]];
|
468 |
-
}
|
469 |
-
return $code_ext;
|
470 |
-
}
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Calculate CODE 39 checksum (modulo 43).
|
474 |
-
*/
|
475 |
-
protected function checksum_code39($code) {
|
476 |
-
$chars = array(
|
477 |
-
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
478 |
-
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
|
479 |
-
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
480 |
-
'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%');
|
481 |
-
$sum = 0;
|
482 |
-
$clen = strlen($code);
|
483 |
-
for ($i = 0 ; $i < $clen; ++$i) {
|
484 |
-
$k = array_keys($chars, $code[$i]);
|
485 |
-
$sum += $k[0];
|
486 |
-
}
|
487 |
-
$j = ($sum % 43);
|
488 |
-
return $chars[$j];
|
489 |
-
}
|
490 |
-
|
491 |
-
/**
|
492 |
-
* CODE 93 - USS-93
|
493 |
-
* Compact code similar to Code 39
|
494 |
-
*/
|
495 |
-
protected function barcode_code93($code) {
|
496 |
-
$chr['0'] = '131112';
|
497 |
-
$chr['1'] = '111213';
|
498 |
-
$chr['2'] = '111312';
|
499 |
-
$chr['3'] = '111411';
|
500 |
-
$chr['4'] = '121113';
|
501 |
-
$chr['5'] = '121212';
|
502 |
-
$chr['6'] = '121311';
|
503 |
-
$chr['7'] = '111114';
|
504 |
-
$chr['8'] = '131211';
|
505 |
-
$chr['9'] = '141111';
|
506 |
-
$chr['A'] = '211113';
|
507 |
-
$chr['B'] = '211212';
|
508 |
-
$chr['C'] = '211311';
|
509 |
-
$chr['D'] = '221112';
|
510 |
-
$chr['E'] = '221211';
|
511 |
-
$chr['F'] = '231111';
|
512 |
-
$chr['G'] = '112113';
|
513 |
-
$chr['H'] = '112212';
|
514 |
-
$chr['I'] = '112311';
|
515 |
-
$chr['J'] = '122112';
|
516 |
-
$chr['K'] = '132111';
|
517 |
-
$chr['L'] = '111123';
|
518 |
-
$chr['M'] = '111222';
|
519 |
-
$chr['N'] = '111321';
|
520 |
-
$chr['O'] = '121122';
|
521 |
-
$chr['P'] = '131121';
|
522 |
-
$chr['Q'] = '212112';
|
523 |
-
$chr['R'] = '212211';
|
524 |
-
$chr['S'] = '211122';
|
525 |
-
$chr['T'] = '211221';
|
526 |
-
$chr['U'] = '221121';
|
527 |
-
$chr['V'] = '222111';
|
528 |
-
$chr['W'] = '112122';
|
529 |
-
$chr['X'] = '112221';
|
530 |
-
$chr['Y'] = '122121';
|
531 |
-
$chr['Z'] = '123111';
|
532 |
-
$chr['-'] = '121131';
|
533 |
-
$chr['.'] = '311112';
|
534 |
-
$chr[' '] = '311211';
|
535 |
-
$chr['$'] = '321111';
|
536 |
-
$chr['/'] = '112131';
|
537 |
-
$chr['+'] = '113121';
|
538 |
-
$chr['%'] = '211131';
|
539 |
-
$chr[128] = '121221'; // ($)
|
540 |
-
$chr[129] = '311121'; // (/)
|
541 |
-
$chr[130] = '122211'; // (+)
|
542 |
-
$chr[131] = '312111'; // (%)
|
543 |
-
$chr['*'] = '111141';
|
544 |
-
$code = strtoupper($code);
|
545 |
-
$encode = array(
|
546 |
-
chr(0) => chr(131).'U', chr(1) => chr(128).'A', chr(2) => chr(128).'B', chr(3) => chr(128).'C',
|
547 |
-
chr(4) => chr(128).'D', chr(5) => chr(128).'E', chr(6) => chr(128).'F', chr(7) => chr(128).'G',
|
548 |
-
chr(8) => chr(128).'H', chr(9) => chr(128).'I', chr(10) => chr(128).'J', chr(11) => '£K',
|
549 |
-
chr(12) => chr(128).'L', chr(13) => chr(128).'M', chr(14) => chr(128).'N', chr(15) => chr(128).'O',
|
550 |
-
chr(16) => chr(128).'P', chr(17) => chr(128).'Q', chr(18) => chr(128).'R', chr(19) => chr(128).'S',
|
551 |
-
chr(20) => chr(128).'T', chr(21) => chr(128).'U', chr(22) => chr(128).'V', chr(23) => chr(128).'W',
|
552 |
-
chr(24) => chr(128).'X', chr(25) => chr(128).'Y', chr(26) => chr(128).'Z', chr(27) => chr(131).'A',
|
553 |
-
chr(28) => chr(131).'B', chr(29) => chr(131).'C', chr(30) => chr(131).'D', chr(31) => chr(131).'E',
|
554 |
-
chr(32) => ' ', chr(33) => chr(129).'A', chr(34) => chr(129).'B', chr(35) => chr(129).'C',
|
555 |
-
chr(36) => chr(129).'D', chr(37) => chr(129).'E', chr(38) => chr(129).'F', chr(39) => chr(129).'G',
|
556 |
-
chr(40) => chr(129).'H', chr(41) => chr(129).'I', chr(42) => chr(129).'J', chr(43) => chr(129).'K',
|
557 |
-
chr(44) => chr(129).'L', chr(45) => '-', chr(46) => '.', chr(47) => chr(129).'O',
|
558 |
-
chr(48) => '0', chr(49) => '1', chr(50) => '2', chr(51) => '3',
|
559 |
-
chr(52) => '4', chr(53) => '5', chr(54) => '6', chr(55) => '7',
|
560 |
-
chr(56) => '8', chr(57) => '9', chr(58) => chr(129).'Z', chr(59) => chr(131).'F',
|
561 |
-
chr(60) => chr(131).'G', chr(61) => chr(131).'H', chr(62) => chr(131).'I', chr(63) => chr(131).'J',
|
562 |
-
chr(64) => chr(131).'V', chr(65) => 'A', chr(66) => 'B', chr(67) => 'C',
|
563 |
-
chr(68) => 'D', chr(69) => 'E', chr(70) => 'F', chr(71) => 'G',
|
564 |
-
chr(72) => 'H', chr(73) => 'I', chr(74) => 'J', chr(75) => 'K',
|
565 |
-
chr(76) => 'L', chr(77) => 'M', chr(78) => 'N', chr(79) => 'O',
|
566 |
-
chr(80) => 'P', chr(81) => 'Q', chr(82) => 'R', chr(83) => 'S',
|
567 |
-
chr(84) => 'T', chr(85) => 'U', chr(86) => 'V', chr(87) => 'W',
|
568 |
-
chr(88) => 'X', chr(89) => 'Y', chr(90) => 'Z', chr(91) => chr(131).'K',
|
569 |
-
chr(92) => chr(131).'L', chr(93) => chr(131).'M', chr(94) => chr(131).'N', chr(95) => chr(131).'O',
|
570 |
-
chr(96) => chr(131).'W', chr(97) => chr(130).'A', chr(98) => chr(130).'B', chr(99) => chr(130).'C',
|
571 |
-
chr(100) => chr(130).'D', chr(101) => chr(130).'E', chr(102) => chr(130).'F', chr(103) => chr(130).'G',
|
572 |
-
chr(104) => chr(130).'H', chr(105) => chr(130).'I', chr(106) => chr(130).'J', chr(107) => chr(130).'K',
|
573 |
-
chr(108) => chr(130).'L', chr(109) => chr(130).'M', chr(110) => chr(130).'N', chr(111) => chr(130).'O',
|
574 |
-
chr(112) => chr(130).'P', chr(113) => chr(130).'Q', chr(114) => chr(130).'R', chr(115) => chr(130).'S',
|
575 |
-
chr(116) => chr(130).'T', chr(117) => chr(130).'U', chr(118) => chr(130).'V', chr(119) => chr(130).'W',
|
576 |
-
chr(120) => chr(130).'X', chr(121) => chr(130).'Y', chr(122) => chr(130).'Z', chr(123) => chr(131).'P',
|
577 |
-
chr(124) => chr(131).'Q', chr(125) => chr(131).'R', chr(126) => chr(131).'S', chr(127) => chr(131).'T');
|
578 |
-
$code_ext = '';
|
579 |
-
$clen = strlen($code);
|
580 |
-
for ($i = 0 ; $i < $clen; ++$i) {
|
581 |
-
if (ord($code[$i]) > 127) {
|
582 |
-
return false;
|
583 |
-
}
|
584 |
-
$code_ext .= $encode[$code[$i]];
|
585 |
-
}
|
586 |
-
// checksum
|
587 |
-
$checkdigit = $this->checksum_code93($code);
|
588 |
-
$code .= $checkdigit ;
|
589 |
-
// add start and stop codes
|
590 |
-
$code = '*'.$code.'*';
|
591 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
592 |
-
$k = 0;
|
593 |
-
$clen = strlen($code);
|
594 |
-
for ($i = 0; $i < $clen; ++$i) {
|
595 |
-
$char = $code[$i];
|
596 |
-
if(!isset($chr[$char])) {
|
597 |
-
// invalid character
|
598 |
-
return false;
|
599 |
-
}
|
600 |
-
for ($j = 0; $j < 6; ++$j) {
|
601 |
-
if (($j % 2) == 0) {
|
602 |
-
$t = true; // bar
|
603 |
-
} else {
|
604 |
-
$t = false; // space
|
605 |
-
}
|
606 |
-
$w = $chr[$char][$j];
|
607 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
608 |
-
$bararray['maxw'] += $w;
|
609 |
-
++$k;
|
610 |
-
}
|
611 |
-
}
|
612 |
-
$bararray['bcode'][$k] = array('t' => true, 'w' => 1, 'h' => 1, 'p' => 0);
|
613 |
-
$bararray['maxw'] += 1;
|
614 |
-
++$k;
|
615 |
-
$bararray['checkdigit'] = $checkdigit;
|
616 |
-
return $bararray;
|
617 |
-
}
|
618 |
-
|
619 |
-
/**
|
620 |
-
* Calculate CODE 93 checksum (modulo 47).
|
621 |
-
*/
|
622 |
-
protected function checksum_code93($code) {
|
623 |
-
$chars = array(
|
624 |
-
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
625 |
-
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
|
626 |
-
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
627 |
-
'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%');
|
628 |
-
// translate special characters
|
629 |
-
$code = strtr($code, chr(128).chr(129).chr(130).chr(131), '$/+%');
|
630 |
-
$len = strlen($code);
|
631 |
-
// calculate check digit C
|
632 |
-
$p = 1;
|
633 |
-
$check = 0;
|
634 |
-
for ($i = ($len - 1); $i >= 0; --$i) {
|
635 |
-
$k = array_keys($chars, $code[$i]);
|
636 |
-
$check += ($k[0] * $p);
|
637 |
-
++$p;
|
638 |
-
if ($p > 20) {
|
639 |
-
$p = 1;
|
640 |
-
}
|
641 |
-
}
|
642 |
-
$check %= 47;
|
643 |
-
$c = $chars[$check];
|
644 |
-
$code .= $c;
|
645 |
-
// calculate check digit K
|
646 |
-
$p = 1;
|
647 |
-
$check = 0;
|
648 |
-
for ($i = $len; $i >= 0; --$i) {
|
649 |
-
$k = array_keys($chars, $code[$i]);
|
650 |
-
$check += ($k[0] * $p);
|
651 |
-
++$p;
|
652 |
-
if ($p > 15) {
|
653 |
-
$p = 1;
|
654 |
-
}
|
655 |
-
}
|
656 |
-
$check %= 47;
|
657 |
-
$k = $chars[$check];
|
658 |
-
return $c.$k;
|
659 |
-
}
|
660 |
-
|
661 |
-
/**
|
662 |
-
* Checksum for standard 2 of 5 barcodes.
|
663 |
-
*/
|
664 |
-
protected function checksum_s25($code) {
|
665 |
-
$len = strlen($code);
|
666 |
-
$sum = 0;
|
667 |
-
for ($i = 0; $i < $len; $i+=2) {
|
668 |
-
$sum += $code[$i];
|
669 |
-
}
|
670 |
-
$sum *= 3;
|
671 |
-
for ($i = 1; $i < $len; $i+=2) {
|
672 |
-
$sum += ($code[$i]);
|
673 |
-
}
|
674 |
-
$r = $sum % 10;
|
675 |
-
if($r > 0) {
|
676 |
-
$r = (10 - $r);
|
677 |
-
}
|
678 |
-
return $r;
|
679 |
-
}
|
680 |
-
|
681 |
-
/**
|
682 |
-
* MSI.
|
683 |
-
* Variation of Plessey code, with similar applications
|
684 |
-
* Contains digits (0 to 9) and encodes the data only in the width of bars.
|
685 |
-
*/
|
686 |
-
protected function barcode_msi($code, $checksum=false) {
|
687 |
-
$chr['0'] = '100100100100';
|
688 |
-
$chr['1'] = '100100100110';
|
689 |
-
$chr['2'] = '100100110100';
|
690 |
-
$chr['3'] = '100100110110';
|
691 |
-
$chr['4'] = '100110100100';
|
692 |
-
$chr['5'] = '100110100110';
|
693 |
-
$chr['6'] = '100110110100';
|
694 |
-
$chr['7'] = '100110110110';
|
695 |
-
$chr['8'] = '110100100100';
|
696 |
-
$chr['9'] = '110100100110';
|
697 |
-
$chr['A'] = '110100110100';
|
698 |
-
$chr['B'] = '110100110110';
|
699 |
-
$chr['C'] = '110110100100';
|
700 |
-
$chr['D'] = '110110100110';
|
701 |
-
$chr['E'] = '110110110100';
|
702 |
-
$chr['F'] = '110110110110';
|
703 |
-
if ($checksum) {
|
704 |
-
// add checksum
|
705 |
-
$clen = strlen($code);
|
706 |
-
$p = 2;
|
707 |
-
$check = 0;
|
708 |
-
for ($i = ($clen - 1); $i >= 0; --$i) {
|
709 |
-
$check += (hexdec($code[$i]) * $p);
|
710 |
-
++$p;
|
711 |
-
if ($p > 7) {
|
712 |
-
$p = 2;
|
713 |
-
}
|
714 |
-
}
|
715 |
-
$check %= 11;
|
716 |
-
if ($check > 0) {
|
717 |
-
$check = 11 - $check;
|
718 |
-
}
|
719 |
-
$code .= $check;
|
720 |
-
$checkdigit = $check;
|
721 |
-
}
|
722 |
-
$seq = '110'; // left guard
|
723 |
-
$clen = strlen($code);
|
724 |
-
for ($i = 0; $i < $clen; ++$i) {
|
725 |
-
$digit = $code[$i];
|
726 |
-
if (!isset($chr[$digit])) {
|
727 |
-
// invalid character
|
728 |
-
return false;
|
729 |
-
}
|
730 |
-
$seq .= $chr[$digit];
|
731 |
-
}
|
732 |
-
$seq .= '1001'; // right guard
|
733 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
734 |
-
$bararray['checkdigit'] = $checkdigit;
|
735 |
-
return $this->binseq_to_array($seq, $bararray);
|
736 |
-
}
|
737 |
-
|
738 |
-
/**
|
739 |
-
* Standard 2 of 5 barcodes.
|
740 |
-
* Used in airline ticket marking, photofinishing
|
741 |
-
* Contains digits (0 to 9) and encodes the data only in the width of bars.
|
742 |
-
*/
|
743 |
-
protected function barcode_s25($code, $checksum=false) {
|
744 |
-
$chr['0'] = '10101110111010';
|
745 |
-
$chr['1'] = '11101010101110';
|
746 |
-
$chr['2'] = '10111010101110';
|
747 |
-
$chr['3'] = '11101110101010';
|
748 |
-
$chr['4'] = '10101110101110';
|
749 |
-
$chr['5'] = '11101011101010';
|
750 |
-
$chr['6'] = '10111011101010';
|
751 |
-
$chr['7'] = '10101011101110';
|
752 |
-
$chr['8'] = '10101110111010';
|
753 |
-
$chr['9'] = '10111010111010';
|
754 |
-
if ($checksum) {
|
755 |
-
// add checksum
|
756 |
-
$checkdigit = $this->checksum_s25($code);
|
757 |
-
$code .= $checkdigit ;
|
758 |
-
}
|
759 |
-
if((strlen($code) % 2) != 0) {
|
760 |
-
// add leading zero if code-length is odd
|
761 |
-
$code = '0'.$code;
|
762 |
-
}
|
763 |
-
$seq = '11011010';
|
764 |
-
$clen = strlen($code);
|
765 |
-
for ($i = 0; $i < $clen; ++$i) {
|
766 |
-
$digit = $code[$i];
|
767 |
-
if (!isset($chr[$digit])) {
|
768 |
-
// invalid character
|
769 |
-
return false;
|
770 |
-
}
|
771 |
-
$seq .= $chr[$digit];
|
772 |
-
}
|
773 |
-
$seq .= '1101011';
|
774 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
775 |
-
$bararray['checkdigit'] = $checkdigit;
|
776 |
-
return $this->binseq_to_array($seq, $bararray);
|
777 |
-
}
|
778 |
-
|
779 |
-
/**
|
780 |
-
* Convert binary barcode sequence to barcode array
|
781 |
-
*/
|
782 |
-
protected function binseq_to_array($seq, $bararray) {
|
783 |
-
$len = strlen($seq);
|
784 |
-
$w = 0;
|
785 |
-
$k = 0;
|
786 |
-
for ($i = 0; $i < $len; ++$i) {
|
787 |
-
$w += 1;
|
788 |
-
if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq[$i] != $seq[($i+1)]))) {
|
789 |
-
if ($seq[$i] == '1') {
|
790 |
-
$t = true; // bar
|
791 |
-
} else {
|
792 |
-
$t = false; // space
|
793 |
-
}
|
794 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
795 |
-
$bararray['maxw'] += $w;
|
796 |
-
++$k;
|
797 |
-
$w = 0;
|
798 |
-
}
|
799 |
-
}
|
800 |
-
return $bararray;
|
801 |
-
}
|
802 |
-
|
803 |
-
/**
|
804 |
-
* Interleaved 2 of 5 barcodes.
|
805 |
-
* Compact numeric code, widely used in industry, air cargo
|
806 |
-
* Contains digits (0 to 9) and encodes the data in the width of both bars and spaces.
|
807 |
-
*/
|
808 |
-
protected function barcode_i25($code, $checksum=false) {
|
809 |
-
$chr['0'] = '11221';
|
810 |
-
$chr['1'] = '21112';
|
811 |
-
$chr['2'] = '12112';
|
812 |
-
$chr['3'] = '22111';
|
813 |
-
$chr['4'] = '11212';
|
814 |
-
$chr['5'] = '21211';
|
815 |
-
$chr['6'] = '12211';
|
816 |
-
$chr['7'] = '11122';
|
817 |
-
$chr['8'] = '21121';
|
818 |
-
$chr['9'] = '12121';
|
819 |
-
$chr['A'] = '11';
|
820 |
-
$chr['Z'] = '21';
|
821 |
-
if ($checksum) {
|
822 |
-
// add checksum
|
823 |
-
$checkdigit = $this->checksum_s25($code);
|
824 |
-
$code .= $checkdigit ;
|
825 |
-
}
|
826 |
-
if((strlen($code) % 2) != 0) {
|
827 |
-
// add leading zero if code-length is odd
|
828 |
-
$code = '0'.$code;
|
829 |
-
}
|
830 |
-
// add start and stop codes
|
831 |
-
$code = 'AA'.strtolower($code).'ZA';
|
832 |
-
|
833 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
834 |
-
$k = 0;
|
835 |
-
$clen = strlen($code);
|
836 |
-
for ($i = 0; $i < $clen; $i = ($i + 2)) {
|
837 |
-
$char_bar = $code[$i];
|
838 |
-
$char_space = $code[$i+1];
|
839 |
-
if((!isset($chr[$char_bar])) OR (!isset($chr[$char_space]))) {
|
840 |
-
// invalid character
|
841 |
-
return false;
|
842 |
-
}
|
843 |
-
// create a bar-space sequence
|
844 |
-
$seq = '';
|
845 |
-
$chrlen = strlen($chr[$char_bar]);
|
846 |
-
for ($s = 0; $s < $chrlen; $s++){
|
847 |
-
$seq .= $chr[$char_bar][$s] . $chr[$char_space][$s];
|
848 |
-
}
|
849 |
-
$seqlen = strlen($seq);
|
850 |
-
for ($j = 0; $j < $seqlen; ++$j) {
|
851 |
-
if (($j % 2) == 0) {
|
852 |
-
$t = true; // bar
|
853 |
-
} else {
|
854 |
-
$t = false; // space
|
855 |
-
}
|
856 |
-
$x = $seq[$j];
|
857 |
-
if ($x == 2) { $w = $this->print_ratio; }
|
858 |
-
else { $w = 1; }
|
859 |
-
|
860 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
861 |
-
$bararray['maxw'] += $w;
|
862 |
-
++$k;
|
863 |
-
}
|
864 |
-
}
|
865 |
-
$bararray['checkdigit'] = $checkdigit;
|
866 |
-
return $bararray;
|
867 |
-
}
|
868 |
-
|
869 |
-
/**
|
870 |
-
* C128 barcodes.
|
871 |
-
* Very capable code, excellent density, high reliability; in very wide use world-wide
|
872 |
-
*/
|
873 |
-
protected function barcode_c128($code, $type='B', $ean=false) {
|
874 |
-
$code = strcode2utf($code); // mPDF 5.7.1 Allows e.g. <barcode code="5432
1068" type="C128A" />
|
875 |
-
$chr = array(
|
876 |
-
'212222', /* 00 */
|
877 |
-
'222122', /* 01 */
|
878 |
-
'222221', /* 02 */
|
879 |
-
'121223', /* 03 */
|
880 |
-
'121322', /* 04 */
|
881 |
-
'131222', /* 05 */
|
882 |
-
'122213', /* 06 */
|
883 |
-
'122312', /* 07 */
|
884 |
-
'132212', /* 08 */
|
885 |
-
'221213', /* 09 */
|
886 |
-
'221312', /* 10 */
|
887 |
-
'231212', /* 11 */
|
888 |
-
'112232', /* 12 */
|
889 |
-
'122132', /* 13 */
|
890 |
-
'122231', /* 14 */
|
891 |
-
'113222', /* 15 */
|
892 |
-
'123122', /* 16 */
|
893 |
-
'123221', /* 17 */
|
894 |
-
'223211', /* 18 */
|
895 |
-
'221132', /* 19 */
|
896 |
-
'221231', /* 20 */
|
897 |
-
'213212', /* 21 */
|
898 |
-
'223112', /* 22 */
|
899 |
-
'312131', /* 23 */
|
900 |
-
'311222', /* 24 */
|
901 |
-
'321122', /* 25 */
|
902 |
-
'321221', /* 26 */
|
903 |
-
'312212', /* 27 */
|
904 |
-
'322112', /* 28 */
|
905 |
-
'322211', /* 29 */
|
906 |
-
'212123', /* 30 */
|
907 |
-
'212321', /* 31 */
|
908 |
-
'232121', /* 32 */
|
909 |
-
'111323', /* 33 */
|
910 |
-
'131123', /* 34 */
|
911 |
-
'131321', /* 35 */
|
912 |
-
'112313', /* 36 */
|
913 |
-
'132113', /* 37 */
|
914 |
-
'132311', /* 38 */
|
915 |
-
'211313', /* 39 */
|
916 |
-
'231113', /* 40 */
|
917 |
-
'231311', /* 41 */
|
918 |
-
'112133', /* 42 */
|
919 |
-
'112331', /* 43 */
|
920 |
-
'132131', /* 44 */
|
921 |
-
'113123', /* 45 */
|
922 |
-
'113321', /* 46 */
|
923 |
-
'133121', /* 47 */
|
924 |
-
'313121', /* 48 */
|
925 |
-
'211331', /* 49 */
|
926 |
-
'231131', /* 50 */
|
927 |
-
'213113', /* 51 */
|
928 |
-
'213311', /* 52 */
|
929 |
-
'213131', /* 53 */
|
930 |
-
'311123', /* 54 */
|
931 |
-
'311321', /* 55 */
|
932 |
-
'331121', /* 56 */
|
933 |
-
'312113', /* 57 */
|
934 |
-
'312311', /* 58 */
|
935 |
-
'332111', /* 59 */
|
936 |
-
'314111', /* 60 */
|
937 |
-
'221411', /* 61 */
|
938 |
-
'431111', /* 62 */
|
939 |
-
'111224', /* 63 */
|
940 |
-
'111422', /* 64 */
|
941 |
-
'121124', /* 65 */
|
942 |
-
'121421', /* 66 */
|
943 |
-
'141122', /* 67 */
|
944 |
-
'141221', /* 68 */
|
945 |
-
'112214', /* 69 */
|
946 |
-
'112412', /* 70 */
|
947 |
-
'122114', /* 71 */
|
948 |
-
'122411', /* 72 */
|
949 |
-
'142112', /* 73 */
|
950 |
-
'142211', /* 74 */
|
951 |
-
'241211', /* 75 */
|
952 |
-
'221114', /* 76 */
|
953 |
-
'413111', /* 77 */
|
954 |
-
'241112', /* 78 */
|
955 |
-
'134111', /* 79 */
|
956 |
-
'111242', /* 80 */
|
957 |
-
'121142', /* 81 */
|
958 |
-
'121241', /* 82 */
|
959 |
-
'114212', /* 83 */
|
960 |
-
'124112', /* 84 */
|
961 |
-
'124211', /* 85 */
|
962 |
-
'411212', /* 86 */
|
963 |
-
'421112', /* 87 */
|
964 |
-
'421211', /* 88 */
|
965 |
-
'212141', /* 89 */
|
966 |
-
'214121', /* 90 */
|
967 |
-
'412121', /* 91 */
|
968 |
-
'111143', /* 92 */
|
969 |
-
'111341', /* 93 */
|
970 |
-
'131141', /* 94 */
|
971 |
-
'114113', /* 95 */
|
972 |
-
'114311', /* 96 */
|
973 |
-
'411113', /* 97 */
|
974 |
-
'411311', /* 98 */
|
975 |
-
'113141', /* 99 */
|
976 |
-
'114131', /* 100 */
|
977 |
-
'311141', /* 101 */
|
978 |
-
'411131', /* 102 */
|
979 |
-
'211412', /* 103 START A */
|
980 |
-
'211214', /* 104 START B */
|
981 |
-
'211232', /* 105 START C */
|
982 |
-
'233111', /* STOP */
|
983 |
-
'200000' /* END */
|
984 |
-
);
|
985 |
-
$keys = '';
|
986 |
-
switch(strtoupper($type)) {
|
987 |
-
case 'A': {
|
988 |
-
$startid = 103;
|
989 |
-
$keys = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_';
|
990 |
-
for ($i = 0; $i < 32; ++$i) {
|
991 |
-
$keys .= chr($i);
|
992 |
-
}
|
993 |
-
break;
|
994 |
-
}
|
995 |
-
case 'B': {
|
996 |
-
$startid = 104;
|
997 |
-
$keys = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'.chr(127);
|
998 |
-
break;
|
999 |
-
}
|
1000 |
-
case 'C': {
|
1001 |
-
$startid = 105;
|
1002 |
-
$keys = '';
|
1003 |
-
if ((strlen($code) % 2) != 0) {
|
1004 |
-
// The length of barcode value must be even ($code). You must pad the number with zeros
|
1005 |
-
return false;
|
1006 |
-
}
|
1007 |
-
for ($i = 0; $i <= 99; ++$i) {
|
1008 |
-
$keys .= chr($i);
|
1009 |
-
}
|
1010 |
-
$new_code = '';
|
1011 |
-
$hclen = (strlen($code) / 2);
|
1012 |
-
for ($i = 0; $i < $hclen; ++$i) {
|
1013 |
-
$new_code .= chr(intval($code{(2 * $i)}.$code{(2 * $i + 1)}));
|
1014 |
-
}
|
1015 |
-
$code = $new_code;
|
1016 |
-
break;
|
1017 |
-
}
|
1018 |
-
default: {
|
1019 |
-
return false;
|
1020 |
-
}
|
1021 |
-
}
|
1022 |
-
|
1023 |
-
// calculate check character
|
1024 |
-
$sum = $startid;
|
1025 |
-
if ($ean) { $code = chr(102) . $code; } // Add FNC 1 - which identifies it as EAN-128
|
1026 |
-
$clen = strlen($code);
|
1027 |
-
for ($i = 0; $i < $clen; ++$i) {
|
1028 |
-
if ($ean && $i==0) { $sum += 102; }
|
1029 |
-
else { $sum += (strpos($keys, $code[$i]) * ($i+1)); }
|
1030 |
-
}
|
1031 |
-
$check = ($sum % 103);
|
1032 |
-
$checkdigit = $check ;
|
1033 |
-
// add start, check and stop codes
|
1034 |
-
$code = chr($startid).$code.chr($check).chr(106).chr(107);
|
1035 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1036 |
-
$k = 0;
|
1037 |
-
$len = strlen($code);
|
1038 |
-
for ($i = 0; $i < $len; ++$i) {
|
1039 |
-
$ck = strpos($keys, $code[$i]);
|
1040 |
-
if (($i == 0) || ($ean && $i==1) | ($i > ($len-4))) {
|
1041 |
-
$char_num = ord($code[$i]);
|
1042 |
-
$seq = $chr[$char_num];
|
1043 |
-
} elseif(($ck >= 0) AND isset($chr[$ck])) {
|
1044 |
-
$seq = $chr[$ck];
|
1045 |
-
} else {
|
1046 |
-
// invalid character
|
1047 |
-
return false;
|
1048 |
-
}
|
1049 |
-
for ($j = 0; $j < 6; ++$j) {
|
1050 |
-
if (($j % 2) == 0) {
|
1051 |
-
$t = true; // bar
|
1052 |
-
} else {
|
1053 |
-
$t = false; // space
|
1054 |
-
}
|
1055 |
-
$w = $seq[$j];
|
1056 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1057 |
-
$bararray['maxw'] += $w;
|
1058 |
-
++$k;
|
1059 |
-
}
|
1060 |
-
}
|
1061 |
-
$bararray['checkdigit'] = $checkdigit;
|
1062 |
-
return $bararray;
|
1063 |
-
}
|
1064 |
-
|
1065 |
-
/**
|
1066 |
-
* EAN13 and UPC-A barcodes.
|
1067 |
-
* EAN13: European Article Numbering international retail product code
|
1068 |
-
* UPC-A: Universal product code seen on almost all retail products in the USA and Canada
|
1069 |
-
* UPC-E: Short version of UPC symbol
|
1070 |
-
*/
|
1071 |
-
protected function barcode_eanupc($code, $len=13) {
|
1072 |
-
$upce = false;
|
1073 |
-
$checkdigit = false;
|
1074 |
-
if ($len == 6) {
|
1075 |
-
$len = 12; // UPC-A
|
1076 |
-
$upce = true; // UPC-E mode
|
1077 |
-
}
|
1078 |
-
$data_len = $len - 1;
|
1079 |
-
//Padding
|
1080 |
-
$code = str_pad($code, $data_len, '0', STR_PAD_LEFT);
|
1081 |
-
$code_len = strlen($code);
|
1082 |
-
// calculate check digit
|
1083 |
-
$sum_a = 0;
|
1084 |
-
for ($i = 1; $i < $data_len; $i+=2) {
|
1085 |
-
$sum_a += $code[$i];
|
1086 |
-
}
|
1087 |
-
if ($len > 12) {
|
1088 |
-
$sum_a *= 3;
|
1089 |
-
}
|
1090 |
-
$sum_b = 0;
|
1091 |
-
for ($i = 0; $i < $data_len; $i+=2) {
|
1092 |
-
$sum_b += ($code[$i]);
|
1093 |
-
}
|
1094 |
-
if ($len < 13) {
|
1095 |
-
$sum_b *= 3;
|
1096 |
-
}
|
1097 |
-
$r = ($sum_a + $sum_b) % 10;
|
1098 |
-
if($r > 0) {
|
1099 |
-
$r = (10 - $r);
|
1100 |
-
}
|
1101 |
-
if ($code_len == $data_len) {
|
1102 |
-
// add check digit
|
1103 |
-
$code .= $r;
|
1104 |
-
$checkdigit = $r;
|
1105 |
-
} elseif ($r !== intval($code[$data_len])) {
|
1106 |
-
// wrong checkdigit
|
1107 |
-
return false;
|
1108 |
-
}
|
1109 |
-
if ($len == 12) {
|
1110 |
-
// UPC-A
|
1111 |
-
$code = '0'.$code;
|
1112 |
-
++$len;
|
1113 |
-
}
|
1114 |
-
if ($upce) {
|
1115 |
-
// convert UPC-A to UPC-E
|
1116 |
-
$tmp = substr($code, 4, 3);
|
1117 |
-
$prod_code = intval(substr($code,7,5)); // product code
|
1118 |
-
$invalid_upce = false;
|
1119 |
-
if (($tmp == '000') OR ($tmp == '100') OR ($tmp == '200')) {
|
1120 |
-
// manufacturer code ends in 000, 100, or 200
|
1121 |
-
$upce_code = substr($code, 2, 2).substr($code, 9, 3).substr($code, 4, 1);
|
1122 |
-
if ($prod_code > 999) { $invalid_upce = true; }
|
1123 |
-
} else {
|
1124 |
-
$tmp = substr($code, 5, 2);
|
1125 |
-
if ($tmp == '00') {
|
1126 |
-
// manufacturer code ends in 00
|
1127 |
-
$upce_code = substr($code, 2, 3).substr($code, 10, 2).'3';
|
1128 |
-
if ($prod_code > 99) { $invalid_upce = true; }
|
1129 |
-
} else {
|
1130 |
-
$tmp = substr($code, 6, 1);
|
1131 |
-
if ($tmp == '0') {
|
1132 |
-
// manufacturer code ends in 0
|
1133 |
-
$upce_code = substr($code, 2, 4).substr($code, 11, 1).'4';
|
1134 |
-
if ($prod_code > 9) { $invalid_upce = true; }
|
1135 |
-
} else {
|
1136 |
-
// manufacturer code does not end in zero
|
1137 |
-
$upce_code = substr($code, 2, 5).substr($code, 11, 1);
|
1138 |
-
if ($prod_code > 9) { $invalid_upce = true; }
|
1139 |
-
}
|
1140 |
-
}
|
1141 |
-
}
|
1142 |
-
if ($invalid_upce) { die("Error - UPC-A cannot produce a valid UPC-E barcode"); } // Error generating a UPCE code
|
1143 |
-
}
|
1144 |
-
//Convert digits to bars
|
1145 |
-
$codes = array(
|
1146 |
-
'A'=>array( // left odd parity
|
1147 |
-
'0'=>'0001101',
|
1148 |
-
'1'=>'0011001',
|
1149 |
-
'2'=>'0010011',
|
1150 |
-
'3'=>'0111101',
|
1151 |
-
'4'=>'0100011',
|
1152 |
-
'5'=>'0110001',
|
1153 |
-
'6'=>'0101111',
|
1154 |
-
'7'=>'0111011',
|
1155 |
-
'8'=>'0110111',
|
1156 |
-
'9'=>'0001011'),
|
1157 |
-
'B'=>array( // left even parity
|
1158 |
-
'0'=>'0100111',
|
1159 |
-
'1'=>'0110011',
|
1160 |
-
'2'=>'0011011',
|
1161 |
-
'3'=>'0100001',
|
1162 |
-
'4'=>'0011101',
|
1163 |
-
'5'=>'0111001',
|
1164 |
-
'6'=>'0000101',
|
1165 |
-
'7'=>'0010001',
|
1166 |
-
'8'=>'0001001',
|
1167 |
-
'9'=>'0010111'),
|
1168 |
-
'C'=>array( // right
|
1169 |
-
'0'=>'1110010',
|
1170 |
-
'1'=>'1100110',
|
1171 |
-
'2'=>'1101100',
|
1172 |
-
'3'=>'1000010',
|
1173 |
-
'4'=>'1011100',
|
1174 |
-
'5'=>'1001110',
|
1175 |
-
'6'=>'1010000',
|
1176 |
-
'7'=>'1000100',
|
1177 |
-
'8'=>'1001000',
|
1178 |
-
'9'=>'1110100')
|
1179 |
-
);
|
1180 |
-
$parities = array(
|
1181 |
-
'0'=>array('A','A','A','A','A','A'),
|
1182 |
-
'1'=>array('A','A','B','A','B','B'),
|
1183 |
-
'2'=>array('A','A','B','B','A','B'),
|
1184 |
-
'3'=>array('A','A','B','B','B','A'),
|
1185 |
-
'4'=>array('A','B','A','A','B','B'),
|
1186 |
-
'5'=>array('A','B','B','A','A','B'),
|
1187 |
-
'6'=>array('A','B','B','B','A','A'),
|
1188 |
-
'7'=>array('A','B','A','B','A','B'),
|
1189 |
-
'8'=>array('A','B','A','B','B','A'),
|
1190 |
-
'9'=>array('A','B','B','A','B','A')
|
1191 |
-
);
|
1192 |
-
$upce_parities = array();
|
1193 |
-
$upce_parities[0] = array(
|
1194 |
-
'0'=>array('B','B','B','A','A','A'),
|
1195 |
-
'1'=>array('B','B','A','B','A','A'),
|
1196 |
-
'2'=>array('B','B','A','A','B','A'),
|
1197 |
-
'3'=>array('B','B','A','A','A','B'),
|
1198 |
-
'4'=>array('B','A','B','B','A','A'),
|
1199 |
-
'5'=>array('B','A','A','B','B','A'),
|
1200 |
-
'6'=>array('B','A','A','A','B','B'),
|
1201 |
-
'7'=>array('B','A','B','A','B','A'),
|
1202 |
-
'8'=>array('B','A','B','A','A','B'),
|
1203 |
-
'9'=>array('B','A','A','B','A','B')
|
1204 |
-
);
|
1205 |
-
$upce_parities[1] = array(
|
1206 |
-
'0'=>array('A','A','A','B','B','B'),
|
1207 |
-
'1'=>array('A','A','B','A','B','B'),
|
1208 |
-
'2'=>array('A','A','B','B','A','B'),
|
1209 |
-
'3'=>array('A','A','B','B','B','A'),
|
1210 |
-
'4'=>array('A','B','A','A','B','B'),
|
1211 |
-
'5'=>array('A','B','B','A','A','B'),
|
1212 |
-
'6'=>array('A','B','B','B','A','A'),
|
1213 |
-
'7'=>array('A','B','A','B','A','B'),
|
1214 |
-
'8'=>array('A','B','A','B','B','A'),
|
1215 |
-
'9'=>array('A','B','B','A','B','A')
|
1216 |
-
);
|
1217 |
-
$k = 0;
|
1218 |
-
$seq = '101'; // left guard bar
|
1219 |
-
if ($upce) {
|
1220 |
-
$bararray = array('code' => $upce_code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1221 |
-
$p = $upce_parities[$code{1}][$r];
|
1222 |
-
for ($i = 0; $i < 6; ++$i) {
|
1223 |
-
$seq .= $codes[$p[$i]][$upce_code[$i]];
|
1224 |
-
}
|
1225 |
-
$seq .= '010101'; // right guard bar
|
1226 |
-
} else {
|
1227 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1228 |
-
$half_len = ceil($len / 2);
|
1229 |
-
if ($len == 8) {
|
1230 |
-
for ($i = 0; $i < $half_len; ++$i) {
|
1231 |
-
$seq .= $codes['A'][$code[$i]];
|
1232 |
-
}
|
1233 |
-
} else {
|
1234 |
-
$p = $parities[$code{0}];
|
1235 |
-
for ($i = 1; $i < $half_len; ++$i) {
|
1236 |
-
$seq .= $codes[$p[$i-1]][$code[$i]];
|
1237 |
-
}
|
1238 |
-
}
|
1239 |
-
$seq .= '01010'; // center guard bar
|
1240 |
-
for ($i = $half_len; $i < $len; ++$i) {
|
1241 |
-
$seq .= $codes['C'][$code[$i]];
|
1242 |
-
}
|
1243 |
-
$seq .= '101'; // right guard bar
|
1244 |
-
}
|
1245 |
-
$clen = strlen($seq);
|
1246 |
-
$w = 0;
|
1247 |
-
for ($i = 0; $i < $clen; ++$i) {
|
1248 |
-
$w += 1;
|
1249 |
-
if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq[$i] != $seq[($i+1)]))) {
|
1250 |
-
if ($seq[$i] == '1') {
|
1251 |
-
$t = true; // bar
|
1252 |
-
} else {
|
1253 |
-
$t = false; // space
|
1254 |
-
}
|
1255 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1256 |
-
$bararray['maxw'] += $w;
|
1257 |
-
++$k;
|
1258 |
-
$w = 0;
|
1259 |
-
}
|
1260 |
-
}
|
1261 |
-
$bararray['checkdigit'] = $checkdigit;
|
1262 |
-
return $bararray;
|
1263 |
-
}
|
1264 |
-
|
1265 |
-
/**
|
1266 |
-
* UPC-Based Extentions
|
1267 |
-
* 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers
|
1268 |
-
* 5-Digit Ext.: Used to mark suggested retail price of books
|
1269 |
-
*/
|
1270 |
-
protected function barcode_eanext($code, $len=5) {
|
1271 |
-
//Padding
|
1272 |
-
$code = str_pad($code, $len, '0', STR_PAD_LEFT);
|
1273 |
-
// calculate check digit
|
1274 |
-
if ($len == 2) {
|
1275 |
-
$r = $code % 4;
|
1276 |
-
} elseif ($len == 5) {
|
1277 |
-
$r = (3 * ($code{0} + $code{2} + $code{4})) + (9 * ($code{1} + $code{3}));
|
1278 |
-
$r %= 10;
|
1279 |
-
} else {
|
1280 |
-
return false;
|
1281 |
-
}
|
1282 |
-
//Convert digits to bars
|
1283 |
-
$codes = array(
|
1284 |
-
'A'=>array( // left odd parity
|
1285 |
-
'0'=>'0001101',
|
1286 |
-
'1'=>'0011001',
|
1287 |
-
'2'=>'0010011',
|
1288 |
-
'3'=>'0111101',
|
1289 |
-
'4'=>'0100011',
|
1290 |
-
'5'=>'0110001',
|
1291 |
-
'6'=>'0101111',
|
1292 |
-
'7'=>'0111011',
|
1293 |
-
'8'=>'0110111',
|
1294 |
-
'9'=>'0001011'),
|
1295 |
-
'B'=>array( // left even parity
|
1296 |
-
'0'=>'0100111',
|
1297 |
-
'1'=>'0110011',
|
1298 |
-
'2'=>'0011011',
|
1299 |
-
'3'=>'0100001',
|
1300 |
-
'4'=>'0011101',
|
1301 |
-
'5'=>'0111001',
|
1302 |
-
'6'=>'0000101',
|
1303 |
-
'7'=>'0010001',
|
1304 |
-
'8'=>'0001001',
|
1305 |
-
'9'=>'0010111')
|
1306 |
-
);
|
1307 |
-
$parities = array();
|
1308 |
-
$parities[2] = array(
|
1309 |
-
'0'=>array('A','A'),
|
1310 |
-
'1'=>array('A','B'),
|
1311 |
-
'2'=>array('B','A'),
|
1312 |
-
'3'=>array('B','B')
|
1313 |
-
);
|
1314 |
-
$parities[5] = array(
|
1315 |
-
'0'=>array('B','B','A','A','A'),
|
1316 |
-
'1'=>array('B','A','B','A','A'),
|
1317 |
-
'2'=>array('B','A','A','B','A'),
|
1318 |
-
'3'=>array('B','A','A','A','B'),
|
1319 |
-
'4'=>array('A','B','B','A','A'),
|
1320 |
-
'5'=>array('A','A','B','B','A'),
|
1321 |
-
'6'=>array('A','A','A','B','B'),
|
1322 |
-
'7'=>array('A','B','A','B','A'),
|
1323 |
-
'8'=>array('A','B','A','A','B'),
|
1324 |
-
'9'=>array('A','A','B','A','B')
|
1325 |
-
);
|
1326 |
-
$p = $parities[$len][$r];
|
1327 |
-
$seq = '1011'; // left guard bar
|
1328 |
-
$seq .= $codes[$p[0]][$code{0}];
|
1329 |
-
for ($i = 1; $i < $len; ++$i) {
|
1330 |
-
$seq .= '01'; // separator
|
1331 |
-
$seq .= $codes[$p[$i]][$code[$i]];
|
1332 |
-
}
|
1333 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1334 |
-
return $this->binseq_to_array($seq, $bararray);
|
1335 |
-
}
|
1336 |
-
|
1337 |
-
/**
|
1338 |
-
* POSTNET and PLANET barcodes.
|
1339 |
-
* Used by U.S. Postal Service for automated mail sorting
|
1340 |
-
*/
|
1341 |
-
protected function barcode_postnet($code, $planet=false) {
|
1342 |
-
// bar lenght
|
1343 |
-
if ($planet) {
|
1344 |
-
$barlen = Array(
|
1345 |
-
0 => Array(1,1,2,2,2),
|
1346 |
-
1 => Array(2,2,2,1,1),
|
1347 |
-
2 => Array(2,2,1,2,1),
|
1348 |
-
3 => Array(2,2,1,1,2),
|
1349 |
-
4 => Array(2,1,2,2,1),
|
1350 |
-
5 => Array(2,1,2,1,2),
|
1351 |
-
6 => Array(2,1,1,2,2),
|
1352 |
-
7 => Array(1,2,2,2,1),
|
1353 |
-
8 => Array(1,2,2,1,2),
|
1354 |
-
9 => Array(1,2,1,2,2)
|
1355 |
-
);
|
1356 |
-
} else {
|
1357 |
-
$barlen = Array(
|
1358 |
-
0 => Array(2,2,1,1,1),
|
1359 |
-
1 => Array(1,1,1,2,2),
|
1360 |
-
2 => Array(1,1,2,1,2),
|
1361 |
-
3 => Array(1,1,2,2,1),
|
1362 |
-
4 => Array(1,2,1,1,2),
|
1363 |
-
5 => Array(1,2,1,2,1),
|
1364 |
-
6 => Array(1,2,2,1,1),
|
1365 |
-
7 => Array(2,1,1,1,2),
|
1366 |
-
8 => Array(2,1,1,2,1),
|
1367 |
-
9 => Array(2,1,2,1,1)
|
1368 |
-
);
|
1369 |
-
}
|
1370 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 5, 'bcode' => array());
|
1371 |
-
$k = 0;
|
1372 |
-
$code = str_replace('-', '', $code);
|
1373 |
-
$code = str_replace(' ', '', $code);
|
1374 |
-
$len = strlen($code);
|
1375 |
-
// calculate checksum
|
1376 |
-
$sum = 0;
|
1377 |
-
for ($i = 0; $i < $len; ++$i) {
|
1378 |
-
$sum += intval($code[$i]);
|
1379 |
-
}
|
1380 |
-
$chkd = ($sum % 10);
|
1381 |
-
if($chkd > 0) {
|
1382 |
-
$chkd = (10 - $chkd);
|
1383 |
-
}
|
1384 |
-
$code .= $chkd;
|
1385 |
-
$checkdigit = $chkd;
|
1386 |
-
$len = strlen($code);
|
1387 |
-
// start bar
|
1388 |
-
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => 5, 'p' => 0);
|
1389 |
-
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth , 'h' => 5, 'p' => 0);
|
1390 |
-
$bararray['maxw'] += (1 + $this->gapwidth );
|
1391 |
-
for ($i = 0; $i < $len; ++$i) {
|
1392 |
-
for ($j = 0; $j < 5; ++$j) {
|
1393 |
-
$bh = $barlen[$code[$i]][$j];
|
1394 |
-
if ($bh == 2) {
|
1395 |
-
$h = 5;
|
1396 |
-
$p = 0;
|
1397 |
-
}
|
1398 |
-
else {
|
1399 |
-
$h = 2;
|
1400 |
-
$p = 3;
|
1401 |
-
}
|
1402 |
-
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
|
1403 |
-
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth , 'h' => 2, 'p' => 0);
|
1404 |
-
$bararray['maxw'] += (1 + $this->gapwidth );
|
1405 |
-
}
|
1406 |
-
}
|
1407 |
-
// end bar
|
1408 |
-
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => 5, 'p' => 0);
|
1409 |
-
$bararray['maxw'] += 1;
|
1410 |
-
$bararray['checkdigit'] = $checkdigit;
|
1411 |
-
return $bararray;
|
1412 |
-
}
|
1413 |
-
|
1414 |
-
/**
|
1415 |
-
* RM4SCC - CBC - KIX
|
1416 |
-
* RM4SCC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index)
|
1417 |
-
* RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service.
|
1418 |
-
*/
|
1419 |
-
protected function barcode_rm4scc($code, $kix=false) {
|
1420 |
-
$notkix = !$kix;
|
1421 |
-
// bar mode
|
1422 |
-
// 1 = pos 1, length 2
|
1423 |
-
// 2 = pos 1, length 3
|
1424 |
-
// 3 = pos 2, length 1
|
1425 |
-
// 4 = pos 2, length 2
|
1426 |
-
$barmode = array(
|
1427 |
-
'0' => array(3,3,2,2),
|
1428 |
-
'1' => array(3,4,1,2),
|
1429 |
-
'2' => array(3,4,2,1),
|
1430 |
-
'3' => array(4,3,1,2),
|
1431 |
-
'4' => array(4,3,2,1),
|
1432 |
-
'5' => array(4,4,1,1),
|
1433 |
-
'6' => array(3,1,4,2),
|
1434 |
-
'7' => array(3,2,3,2),
|
1435 |
-
'8' => array(3,2,4,1),
|
1436 |
-
'9' => array(4,1,3,2),
|
1437 |
-
'A' => array(4,1,4,1),
|
1438 |
-
'B' => array(4,2,3,1),
|
1439 |
-
'C' => array(3,1,2,4),
|
1440 |
-
'D' => array(3,2,1,4),
|
1441 |
-
'E' => array(3,2,2,3),
|
1442 |
-
'F' => array(4,1,1,4),
|
1443 |
-
'G' => array(4,1,2,3),
|
1444 |
-
'H' => array(4,2,1,3),
|
1445 |
-
'I' => array(1,3,4,2),
|
1446 |
-
'J' => array(1,4,3,2),
|
1447 |
-
'K' => array(1,4,4,1),
|
1448 |
-
'L' => array(2,3,3,2),
|
1449 |
-
'M' => array(2,3,4,1),
|
1450 |
-
'N' => array(2,4,3,1),
|
1451 |
-
'O' => array(1,3,2,4),
|
1452 |
-
'P' => array(1,4,1,4),
|
1453 |
-
'Q' => array(1,4,2,3),
|
1454 |
-
'R' => array(2,3,1,4),
|
1455 |
-
'S' => array(2,3,2,3),
|
1456 |
-
'T' => array(2,4,1,3),
|
1457 |
-
'U' => array(1,1,4,4),
|
1458 |
-
'V' => array(1,2,3,4),
|
1459 |
-
'W' => array(1,2,4,3),
|
1460 |
-
'X' => array(2,1,3,4),
|
1461 |
-
'Y' => array(2,1,4,3),
|
1462 |
-
'Z' => array(2,2,3,3)
|
1463 |
-
);
|
1464 |
-
$code = strtoupper($code);
|
1465 |
-
$len = strlen($code);
|
1466 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => $this->daft['F'], 'bcode' => array());
|
1467 |
-
if ($notkix) {
|
1468 |
-
// table for checksum calculation (row,col)
|
1469 |
-
$checktable = array(
|
1470 |
-
'0' => array(1,1),
|
1471 |
-
'1' => array(1,2),
|
1472 |
-
'2' => array(1,3),
|
1473 |
-
'3' => array(1,4),
|
1474 |
-
'4' => array(1,5),
|
1475 |
-
'5' => array(1,0),
|
1476 |
-
'6' => array(2,1),
|
1477 |
-
'7' => array(2,2),
|
1478 |
-
'8' => array(2,3),
|
1479 |
-
'9' => array(2,4),
|
1480 |
-
'A' => array(2,5),
|
1481 |
-
'B' => array(2,0),
|
1482 |
-
'C' => array(3,1),
|
1483 |
-
'D' => array(3,2),
|
1484 |
-
'E' => array(3,3),
|
1485 |
-
'F' => array(3,4),
|
1486 |
-
'G' => array(3,5),
|
1487 |
-
'H' => array(3,0),
|
1488 |
-
'I' => array(4,1),
|
1489 |
-
'J' => array(4,2),
|
1490 |
-
'K' => array(4,3),
|
1491 |
-
'L' => array(4,4),
|
1492 |
-
'M' => array(4,5),
|
1493 |
-
'N' => array(4,0),
|
1494 |
-
'O' => array(5,1),
|
1495 |
-
'P' => array(5,2),
|
1496 |
-
'Q' => array(5,3),
|
1497 |
-
'R' => array(5,4),
|
1498 |
-
'S' => array(5,5),
|
1499 |
-
'T' => array(5,0),
|
1500 |
-
'U' => array(0,1),
|
1501 |
-
'V' => array(0,2),
|
1502 |
-
'W' => array(0,3),
|
1503 |
-
'X' => array(0,4),
|
1504 |
-
'Y' => array(0,5),
|
1505 |
-
'Z' => array(0,0)
|
1506 |
-
);
|
1507 |
-
$row = 0;
|
1508 |
-
$col = 0;
|
1509 |
-
for ($i = 0; $i < $len; ++$i) {
|
1510 |
-
$row += $checktable[$code[$i]][0];
|
1511 |
-
$col += $checktable[$code[$i]][1];
|
1512 |
-
}
|
1513 |
-
$row %= 6;
|
1514 |
-
$col %= 6;
|
1515 |
-
$chk = array_keys($checktable, array($row,$col));
|
1516 |
-
$code .= $chk[0];
|
1517 |
-
$bararray['checkdigit'] = $chk[0];
|
1518 |
-
++$len;
|
1519 |
-
}
|
1520 |
-
$k = 0;
|
1521 |
-
if ($notkix) {
|
1522 |
-
// start bar
|
1523 |
-
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $this->daft['A'] , 'p' => 0);
|
1524 |
-
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth , 'h' => $this->daft['A'] , 'p' => 0);
|
1525 |
-
$bararray['maxw'] += (1 + $this->gapwidth) ;
|
1526 |
-
}
|
1527 |
-
for ($i = 0; $i < $len; ++$i) {
|
1528 |
-
for ($j = 0; $j < 4; ++$j) {
|
1529 |
-
switch ($barmode[$code[$i]][$j]) {
|
1530 |
-
case 1: {
|
1531 |
-
// ascender (A)
|
1532 |
-
$p = 0;
|
1533 |
-
$h = $this->daft['A'];
|
1534 |
-
break;
|
1535 |
-
}
|
1536 |
-
case 2: {
|
1537 |
-
// full bar (F)
|
1538 |
-
$p = 0;
|
1539 |
-
$h = $this->daft['F'];
|
1540 |
-
break;
|
1541 |
-
}
|
1542 |
-
case 3: {
|
1543 |
-
// tracker (T)
|
1544 |
-
$p = ($this->daft['F'] - $this->daft['T'])/2;
|
1545 |
-
$h = $this->daft['T'];
|
1546 |
-
break;
|
1547 |
-
}
|
1548 |
-
case 4: {
|
1549 |
-
// descender (D)
|
1550 |
-
$p = $this->daft['F'] - $this->daft['D'];
|
1551 |
-
$h = $this->daft['D'];
|
1552 |
-
break;
|
1553 |
-
}
|
1554 |
-
}
|
1555 |
-
|
1556 |
-
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
|
1557 |
-
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth, 'h' => 2, 'p' => 0);
|
1558 |
-
$bararray['maxw'] += (1 + $this->gapwidth) ;
|
1559 |
-
}
|
1560 |
-
}
|
1561 |
-
if ($notkix) {
|
1562 |
-
// stop bar
|
1563 |
-
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $this->daft['F'], 'p' => 0);
|
1564 |
-
$bararray['maxw'] += 1;
|
1565 |
-
}
|
1566 |
-
return $bararray;
|
1567 |
-
}
|
1568 |
-
|
1569 |
-
/**
|
1570 |
-
* CODABAR barcodes.
|
1571 |
-
* Older code often used in library systems, sometimes in blood banks
|
1572 |
-
*/
|
1573 |
-
protected function barcode_codabar($code) {
|
1574 |
-
$chr = array(
|
1575 |
-
'0' => '11111221',
|
1576 |
-
'1' => '11112211',
|
1577 |
-
'2' => '11121121',
|
1578 |
-
'3' => '22111111',
|
1579 |
-
'4' => '11211211',
|
1580 |
-
'5' => '21111211',
|
1581 |
-
'6' => '12111121',
|
1582 |
-
'7' => '12112111',
|
1583 |
-
'8' => '12211111',
|
1584 |
-
'9' => '21121111',
|
1585 |
-
'-' => '11122111',
|
1586 |
-
'$' => '11221111',
|
1587 |
-
':' => '21112121',
|
1588 |
-
'/' => '21211121',
|
1589 |
-
'.' => '21212111',
|
1590 |
-
'+' => '11222221',
|
1591 |
-
'A' => '11221211',
|
1592 |
-
'B' => '12121121',
|
1593 |
-
'C' => '11121221',
|
1594 |
-
'D' => '11122211'
|
1595 |
-
);
|
1596 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1597 |
-
$k = 0;
|
1598 |
-
$w = 0;
|
1599 |
-
$seq = '';
|
1600 |
-
$code = strtoupper($code);
|
1601 |
-
$len = strlen($code);
|
1602 |
-
for ($i = 0; $i < $len; ++$i) {
|
1603 |
-
if (!isset($chr[$code[$i]])) {
|
1604 |
-
return false;
|
1605 |
-
}
|
1606 |
-
$seq = $chr[$code[$i]];
|
1607 |
-
for ($j = 0; $j < 8; ++$j) {
|
1608 |
-
if (($j % 2) == 0) {
|
1609 |
-
$t = true; // bar
|
1610 |
-
} else {
|
1611 |
-
$t = false; // space
|
1612 |
-
}
|
1613 |
-
$x = $seq[$j];
|
1614 |
-
if ($x == 2) { $w = $this->print_ratio; }
|
1615 |
-
else { $w = 1; }
|
1616 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1617 |
-
$bararray['maxw'] += $w;
|
1618 |
-
++$k;
|
1619 |
-
}
|
1620 |
-
}
|
1621 |
-
return $bararray;
|
1622 |
-
}
|
1623 |
-
|
1624 |
-
/**
|
1625 |
-
* CODE11 barcodes.
|
1626 |
-
* Used primarily for labeling telecommunications equipment
|
1627 |
-
*/
|
1628 |
-
protected function barcode_code11($code) {
|
1629 |
-
$chr = array(
|
1630 |
-
'0' => '111121',
|
1631 |
-
'1' => '211121',
|
1632 |
-
'2' => '121121',
|
1633 |
-
'3' => '221111',
|
1634 |
-
'4' => '112121',
|
1635 |
-
'5' => '212111',
|
1636 |
-
'6' => '122111',
|
1637 |
-
'7' => '111221',
|
1638 |
-
'8' => '211211',
|
1639 |
-
'9' => '211111',
|
1640 |
-
'-' => '112111',
|
1641 |
-
'S' => '112211'
|
1642 |
-
);
|
1643 |
-
|
1644 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1645 |
-
$k = 0;
|
1646 |
-
$w = 0;
|
1647 |
-
$seq = '';
|
1648 |
-
$len = strlen($code);
|
1649 |
-
// calculate check digit C
|
1650 |
-
$p = 1;
|
1651 |
-
$check = 0;
|
1652 |
-
for ($i = ($len - 1); $i >= 0; --$i) {
|
1653 |
-
$digit = $code[$i];
|
1654 |
-
if ($digit == '-') {
|
1655 |
-
$dval = 10;
|
1656 |
-
} else {
|
1657 |
-
$dval = intval($digit);
|
1658 |
-
}
|
1659 |
-
$check += ($dval * $p);
|
1660 |
-
++$p;
|
1661 |
-
if ($p > 10) {
|
1662 |
-
$p = 1;
|
1663 |
-
}
|
1664 |
-
}
|
1665 |
-
$check %= 11;
|
1666 |
-
if ($check == 10) {
|
1667 |
-
$check = '-';
|
1668 |
-
}
|
1669 |
-
$code .= $check;
|
1670 |
-
$checkdigit = $check;
|
1671 |
-
if ($len > 10) {
|
1672 |
-
// calculate check digit K
|
1673 |
-
$p = 1;
|
1674 |
-
$check = 0;
|
1675 |
-
for ($i = $len; $i >= 0; --$i) {
|
1676 |
-
$digit = $code[$i];
|
1677 |
-
if ($digit == '-') {
|
1678 |
-
$dval = 10;
|
1679 |
-
} else {
|
1680 |
-
$dval = intval($digit);
|
1681 |
-
}
|
1682 |
-
$check += ($dval * $p);
|
1683 |
-
++$p;
|
1684 |
-
if ($p > 9) {
|
1685 |
-
$p = 1;
|
1686 |
-
}
|
1687 |
-
}
|
1688 |
-
$check %= 11;
|
1689 |
-
$code .= $check;
|
1690 |
-
$checkdigit .= $check;
|
1691 |
-
++$len;
|
1692 |
-
}
|
1693 |
-
$code = 'S'.$code.'S';
|
1694 |
-
$len += 3;
|
1695 |
-
for ($i = 0; $i < $len; ++$i) {
|
1696 |
-
if (!isset($chr[$code[$i]])) {
|
1697 |
-
return false;
|
1698 |
-
}
|
1699 |
-
$seq = $chr[$code[$i]];
|
1700 |
-
for ($j = 0; $j < 6; ++$j) {
|
1701 |
-
if (($j % 2) == 0) {
|
1702 |
-
$t = true; // bar
|
1703 |
-
} else {
|
1704 |
-
$t = false; // space
|
1705 |
-
}
|
1706 |
-
$x = $seq[$j];
|
1707 |
-
if ($x == 2) { $w = $this->print_ratio; }
|
1708 |
-
else { $w = 1; }
|
1709 |
-
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1710 |
-
$bararray['maxw'] += $w;
|
1711 |
-
++$k;
|
1712 |
-
}
|
1713 |
-
}
|
1714 |
-
$bararray['checkdigit'] = $checkdigit;
|
1715 |
-
return $bararray;
|
1716 |
-
}
|
1717 |
-
|
1718 |
-
|
1719 |
-
/**
|
1720 |
-
* IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
|
1721 |
-
* (requires PHP bcmath extension)
|
1722 |
-
* Intelligent Mail barcode is a 65-bar code for use on mail in the United States.
|
1723 |
-
* The fields are described as follows:<ul><li>The Barcode Identifier shall be assigned by USPS to encode the presort identification that is currently printed in human readable form on the optional endorsement line (OEL) as well as for future USPS use. This shall be two digits, with the second digit in the range of 0-4. The allowable encoding ranges shall be 00-04, 10-14, 20-24, 30-34, 40-44, 50-54, 60-64, 70-74, 80-84, and 90-94.</li><li>The Service Type Identifier shall be assigned by USPS for any combination of services requested on the mailpiece. The allowable encoding range shall be 000-999. Each 3-digit value shall correspond to a particular mail class with a particular combination of service(s). Each service program, such as OneCode Confirm and OneCode ACS, shall provide the list of Service Type Identifier values.</li><li>The Mailer or Customer Identifier shall be assigned by USPS as a unique, 6 or 9 digit number that identifies a business entity. The allowable encoding range for the 6 digit Mailer ID shall be 000000- 899999, while the allowable encoding range for the 9 digit Mailer ID shall be 900000000-999999999.</li><li>The Serial or Sequence Number shall be assigned by the mailer for uniquely identifying and tracking mailpieces. The allowable encoding range shall be 000000000-999999999 when used with a 6 digit Mailer ID and 000000-999999 when used with a 9 digit Mailer ID. e. The Delivery Point ZIP Code shall be assigned by the mailer for routing the mailpiece. This shall replace POSTNET for routing the mailpiece to its final delivery point. The length may be 0, 5, 9, or 11 digits. The allowable encoding ranges shall be no ZIP Code, 00000-99999, 000000000-999999999, and 00000000000-99999999999.</li></ul>
|
1724 |
-
*/
|
1725 |
-
protected function barcode_imb($code) {
|
1726 |
-
$asc_chr = array(4,0,2,6,3,5,1,9,8,7,1,2,0,6,4,8,2,9,5,3,0,1,3,7,4,6,8,9,2,0,5,1,9,4,3,8,6,7,1,2,4,3,9,5,7,8,3,0,2,1,4,0,9,1,7,0,2,4,6,3,7,1,9,5,8);
|
1727 |
-
$dsc_chr = array(7,1,9,5,8,0,2,4,6,3,5,8,9,7,3,0,6,1,7,4,6,8,9,2,5,1,7,5,4,3,8,7,6,0,2,5,4,9,3,0,1,6,8,2,0,4,5,9,6,7,5,2,6,3,8,5,1,9,8,7,4,0,2,6,3);
|
1728 |
-
$asc_pos = array(3,0,8,11,1,12,8,11,10,6,4,12,2,7,9,6,7,9,2,8,4,0,12,7,10,9,0,7,10,5,7,9,6,8,2,12,1,4,2,0,1,5,4,6,12,1,0,9,4,7,5,10,2,6,9,11,2,12,6,7,5,11,0,3,2);
|
1729 |
-
$dsc_pos = array(2,10,12,5,9,1,5,4,3,9,11,5,10,1,6,3,4,1,10,0,2,11,8,6,1,12,3,8,6,4,4,11,0,6,1,9,11,5,3,7,3,10,7,11,8,2,10,3,5,8,0,3,12,11,8,4,5,1,3,0,7,12,9,8,10);
|
1730 |
-
$code_arr = explode('-', $code);
|
1731 |
-
$tracking_number = $code_arr[0];
|
1732 |
-
if (isset($code_arr[1])) {
|
1733 |
-
$routing_code = $code_arr[1];
|
1734 |
-
} else {
|
1735 |
-
$routing_code = '';
|
1736 |
-
}
|
1737 |
-
// Conversion of Routing Code
|
1738 |
-
switch (strlen($routing_code)) {
|
1739 |
-
case 0: {
|
1740 |
-
$binary_code = 0;
|
1741 |
-
break;
|
1742 |
-
}
|
1743 |
-
case 5: {
|
1744 |
-
$binary_code = bcadd($routing_code, '1');
|
1745 |
-
break;
|
1746 |
-
}
|
1747 |
-
case 9: {
|
1748 |
-
$binary_code = bcadd($routing_code, '100001');
|
1749 |
-
break;
|
1750 |
-
}
|
1751 |
-
case 11: {
|
1752 |
-
$binary_code = bcadd($routing_code, '1000100001');
|
1753 |
-
break;
|
1754 |
-
}
|
1755 |
-
default: {
|
1756 |
-
return false;
|
1757 |
-
break;
|
1758 |
-
}
|
1759 |
-
}
|
1760 |
-
$binary_code = bcmul($binary_code, 10);
|
1761 |
-
$binary_code = bcadd($binary_code, $tracking_number{0});
|
1762 |
-
$binary_code = bcmul($binary_code, 5);
|
1763 |
-
$binary_code = bcadd($binary_code, $tracking_number{1});
|
1764 |
-
$binary_code .= substr($tracking_number, 2, 18);
|
1765 |
-
// convert to hexadecimal
|
1766 |
-
$binary_code = $this->dec_to_hex($binary_code);
|
1767 |
-
// pad to get 13 bytes
|
1768 |
-
$binary_code = str_pad($binary_code, 26, '0', STR_PAD_LEFT);
|
1769 |
-
// convert string to array of bytes
|
1770 |
-
$binary_code_arr = chunk_split($binary_code, 2, "\r");
|
1771 |
-
$binary_code_arr = substr($binary_code_arr, 0, -1);
|
1772 |
-
$binary_code_arr = explode("\r", $binary_code_arr);
|
1773 |
-
// calculate frame check sequence
|
1774 |
-
$fcs = $this->imb_crc11fcs($binary_code_arr);
|
1775 |
-
// exclude first 2 bits from first byte
|
1776 |
-
$first_byte = sprintf('%2s', dechex((hexdec($binary_code_arr[0]) << 2) >> 2));
|
1777 |
-
$binary_code_102bit = $first_byte.substr($binary_code, 2);
|
1778 |
-
// convert binary data to codewords
|
1779 |
-
$codewords = array();
|
1780 |
-
$data = $this->hex_to_dec($binary_code_102bit);
|
1781 |
-
$codewords[0] = bcmod($data, 636) * 2;
|
1782 |
-
$data = bcdiv($data, 636);
|
1783 |
-
for ($i = 1; $i < 9; ++$i) {
|
1784 |
-
$codewords[$i] = bcmod($data, 1365);
|
1785 |
-
$data = bcdiv($data, 1365);
|
1786 |
-
}
|
1787 |
-
$codewords[9] = $data;
|
1788 |
-
if (($fcs >> 10) == 1) {
|
1789 |
-
$codewords[9] += 659;
|
1790 |
-
}
|
1791 |
-
// generate lookup tables
|
1792 |
-
$table2of13 = $this->imb_tables(2, 78);
|
1793 |
-
$table5of13 = $this->imb_tables(5, 1287);
|
1794 |
-
// convert codewords to characters
|
1795 |
-
$characters = array();
|
1796 |
-
$bitmask = 512;
|
1797 |
-
foreach($codewords as $k => $val) {
|
1798 |
-
if ($val <= 1286) {
|
1799 |
-
$chrcode = $table5of13[$val];
|
1800 |
-
} else {
|
1801 |
-
$chrcode = $table2of13[($val - 1287)];
|
1802 |
-
}
|
1803 |
-
if (($fcs & $bitmask) > 0) {
|
1804 |
-
// bitwise invert
|
1805 |
-
$chrcode = ((~$chrcode) & 8191);
|
1806 |
-
}
|
1807 |
-
$characters[] = $chrcode;
|
1808 |
-
$bitmask /= 2;
|
1809 |
-
}
|
1810 |
-
$characters = array_reverse($characters);
|
1811 |
-
// build bars
|
1812 |
-
$k = 0;
|
1813 |
-
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => $this->daft['F'], 'bcode' => array());
|
1814 |
-
for ($i = 0; $i < 65; ++$i) {
|
1815 |
-
$asc = (($characters[$asc_chr[$i]] & pow(2, $asc_pos[$i])) > 0);
|
1816 |
-
$dsc = (($characters[$dsc_chr[$i]] & pow(2, $dsc_pos[$i])) > 0);
|
1817 |
-
if ($asc AND $dsc) {
|
1818 |
-
// full bar (F)
|
1819 |
-
$p = 0;
|
1820 |
-
$h = $this->daft['F'];
|
1821 |
-
} elseif ($asc) {
|
1822 |
-
// ascender (A)
|
1823 |
-
$p = 0;
|
1824 |
-
$h = $this->daft['A'];
|
1825 |
-
} elseif ($dsc) {
|
1826 |
-
// descender (D)
|
1827 |
-
$p = $this->daft['F'] - $this->daft['D'];
|
1828 |
-
$h = $this->daft['D'];
|
1829 |
-
} else {
|
1830 |
-
// tracker (T)
|
1831 |
-
$p = ($this->daft['F'] - $this->daft['T'])/2;
|
1832 |
-
$h = $this->daft['T'];
|
1833 |
-
}
|
1834 |
-
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
|
1835 |
-
// Gap
|
1836 |
-
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth , 'h' => 1, 'p' => 0);
|
1837 |
-
$bararray['maxw'] += (1 + $this->gapwidth );
|
1838 |
-
}
|
1839 |
-
unset($bararray['bcode'][($k - 1)]);
|
1840 |
-
$bararray['maxw'] -= $this->gapwidth ;
|
1841 |
-
return $bararray;
|
1842 |
-
}
|
1843 |
-
|
1844 |
-
/**
|
1845 |
-
* Convert large integer number to hexadecimal representation.
|
1846 |
-
* (requires PHP bcmath extension)
|
1847 |
-
*/
|
1848 |
-
public function dec_to_hex($number) {
|
1849 |
-
$i = 0;
|
1850 |
-
$hex = array();
|
1851 |
-
if($number == 0) {
|
1852 |
-
return '00';
|
1853 |
-
}
|
1854 |
-
while($number > 0) {
|
1855 |
-
if($number == 0) {
|
1856 |
-
array_push($hex, '0');
|
1857 |
-
} else {
|
1858 |
-
array_push($hex, strtoupper(dechex(bcmod($number, '16'))));
|
1859 |
-
$number = bcdiv($number, '16', 0);
|
1860 |
-
}
|
1861 |
-
}
|
1862 |
-
$hex = array_reverse($hex);
|
1863 |
-
return implode($hex);
|
1864 |
-
}
|
1865 |
-
|
1866 |
-
/**
|
1867 |
-
* Convert large hexadecimal number to decimal representation (string).
|
1868 |
-
* (requires PHP bcmath extension)
|
1869 |
-
*/
|
1870 |
-
public function hex_to_dec($hex) {
|
1871 |
-
$dec = 0;
|
1872 |
-
$bitval = 1;
|
1873 |
-
$len = strlen($hex);
|
1874 |
-
for($pos = ($len - 1); $pos >= 0; --$pos) {
|
1875 |
-
$dec = bcadd($dec, bcmul(hexdec($hex[$pos]), $bitval));
|
1876 |
-
$bitval = bcmul($bitval, 16);
|
1877 |
-
}
|
1878 |
-
return $dec;
|
1879 |
-
}
|
1880 |
-
|
1881 |
-
/**
|
1882 |
-
* Intelligent Mail Barcode calculation of Frame Check Sequence
|
1883 |
-
*/
|
1884 |
-
protected function imb_crc11fcs($code_arr) {
|
1885 |
-
$genpoly = 0x0F35; // generator polynomial
|
1886 |
-
$fcs = 0x07FF; // Frame Check Sequence
|
1887 |
-
// do most significant byte skipping the 2 most significant bits
|
1888 |
-
$data = hexdec($code_arr[0]) << 5;
|
1889 |
-
for ($bit = 2; $bit < 8; ++$bit) {
|
1890 |
-
if (($fcs ^ $data) & 0x400) {
|
1891 |
-
$fcs = ($fcs << 1) ^ $genpoly;
|
1892 |
-
} else {
|
1893 |
-
$fcs = ($fcs << 1);
|
1894 |
-
}
|
1895 |
-
$fcs &= 0x7FF;
|
1896 |
-
$data <<= 1;
|
1897 |
-
}
|
1898 |
-
// do rest of bytes
|
1899 |
-
for ($byte = 1; $byte < 13; ++$byte) {
|
1900 |
-
$data = hexdec($code_arr[$byte]) << 3;
|
1901 |
-
for ($bit = 0; $bit < 8; ++$bit) {
|
1902 |
-
if (($fcs ^ $data) & 0x400) {
|
1903 |
-
$fcs = ($fcs << 1) ^ $genpoly;
|
1904 |
-
} else {
|
1905 |
-
$fcs = ($fcs << 1);
|
1906 |
-
}
|
1907 |
-
$fcs &= 0x7FF;
|
1908 |
-
$data <<= 1;
|
1909 |
-
}
|
1910 |
-
}
|
1911 |
-
return $fcs;
|
1912 |
-
}
|
1913 |
-
|
1914 |
-
/**
|
1915 |
-
* Reverse unsigned short value
|
1916 |
-
*/
|
1917 |
-
protected function imb_reverse_us($num) {
|
1918 |
-
$rev = 0;
|
1919 |
-
for ($i = 0; $i < 16; ++$i) {
|
1920 |
-
$rev <<= 1;
|
1921 |
-
$rev |= ($num & 1);
|
1922 |
-
$num >>= 1;
|
1923 |
-
}
|
1924 |
-
return $rev;
|
1925 |
-
}
|
1926 |
-
|
1927 |
-
/**
|
1928 |
-
* generate Nof13 tables used for Intelligent Mail Barcode
|
1929 |
-
*/
|
1930 |
-
protected function imb_tables($n, $size) {
|
1931 |
-
$table = array();
|
1932 |
-
$lli = 0; // LUT lower index
|
1933 |
-
$lui = $size - 1; // LUT upper index
|
1934 |
-
for ($count = 0; $count < 8192; ++$count) {
|
1935 |
-
$bit_count = 0;
|
1936 |
-
for ($bit_index = 0; $bit_index < 13; ++$bit_index) {
|
1937 |
-
$bit_count += intval(($count & (1 << $bit_index)) != 0);
|
1938 |
-
}
|
1939 |
-
// if we don't have the right number of bits on, go on to the next value
|
1940 |
-
if ($bit_count == $n) {
|
1941 |
-
$reverse = ($this->imb_reverse_us($count) >> 3);
|
1942 |
-
// if the reverse is less than count, we have already visited this pair before
|
1943 |
-
if ($reverse >= $count) {
|
1944 |
-
// If count is symmetric, place it at the first free slot from the end of the list.
|
1945 |
-
// Otherwise, place it at the first free slot from the beginning of the list AND place $reverse ath the next free slot from the beginning of the list
|
1946 |
-
if ($reverse == $count) {
|
1947 |
-
$table[$lui] = $count;
|
1948 |
-
--$lui;
|
1949 |
-
} else {
|
1950 |
-
$table[$lli] = $count;
|
1951 |
-
++$lli;
|
1952 |
-
$table[$lli] = $reverse;
|
1953 |
-
++$lli;
|
1954 |
-
}
|
1955 |
-
}
|
1956 |
-
}
|
1957 |
-
}
|
1958 |
-
return $table;
|
1959 |
-
}
|
1960 |
-
|
1961 |
-
} // end of class
|
1962 |
-
|
1963 |
-
//============================================================+
|
1964 |
-
// END OF FILE
|
1965 |
-
//============================================================+
|
1966 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/bmp.php
DELETED
@@ -1,248 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class bmp {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
|
7 |
-
function bmp(&$mpdf) {
|
8 |
-
$this->mpdf = $mpdf;
|
9 |
-
}
|
10 |
-
|
11 |
-
|
12 |
-
function _getBMPimage($data, $file) {
|
13 |
-
$info = array();
|
14 |
-
// Adapted from script by Valentin Schmidt
|
15 |
-
// http://staff.dasdeck.de/valentin/fpdf/fpdf_bmp/
|
16 |
-
$bfOffBits=$this->_fourbytes2int_le(substr($data,10,4));
|
17 |
-
$width=$this->_fourbytes2int_le(substr($data,18,4));
|
18 |
-
$height=$this->_fourbytes2int_le(substr($data,22,4));
|
19 |
-
$flip = ($height<0);
|
20 |
-
if ($flip) $height =-$height;
|
21 |
-
$biBitCount=$this->_twobytes2int_le(substr($data,28,2));
|
22 |
-
$biCompression=$this->_fourbytes2int_le(substr($data,30,4));
|
23 |
-
$info = array('w'=>$width, 'h'=>$height);
|
24 |
-
if ($biBitCount<16){
|
25 |
-
$info['cs'] = 'Indexed';
|
26 |
-
$info['bpc'] = $biBitCount;
|
27 |
-
$palStr = substr($data,54,($bfOffBits-54));
|
28 |
-
$pal = '';
|
29 |
-
$cnt = strlen($palStr)/4;
|
30 |
-
for ($i=0;$i<$cnt;$i++){
|
31 |
-
$n = 4*$i;
|
32 |
-
$pal .= $palStr[$n+2].$palStr[$n+1].$palStr[$n];
|
33 |
-
}
|
34 |
-
$info['pal'] = $pal;
|
35 |
-
}
|
36 |
-
else{
|
37 |
-
$info['cs'] = 'DeviceRGB';
|
38 |
-
$info['bpc'] = 8;
|
39 |
-
}
|
40 |
-
|
41 |
-
if ($this->mpdf->restrictColorSpace==1 || $this->mpdf->PDFX || $this->mpdf->restrictColorSpace==3) {
|
42 |
-
if (($this->mpdf->PDFA && !$this->mpdf->PDFAauto) || ($this->mpdf->PDFX && !$this->mpdf->PDFXauto)) { $this->mpdf->PDFAXwarnings[] = "Image cannot be converted to suitable colour space for PDFA or PDFX file - ".$file." - (Image replaced by 'no-image'.)"; }
|
43 |
-
return array('error' => "BMP Image cannot be converted to suitable colour space - ".$file." - (Image replaced by 'no-image'.)");
|
44 |
-
}
|
45 |
-
|
46 |
-
$biXPelsPerMeter=$this->_fourbytes2int_le(substr($data,38,4)); // horizontal pixels per meter, usually set to zero
|
47 |
-
//$biYPelsPerMeter=$this->_fourbytes2int_le(substr($data,42,4)); // vertical pixels per meter, usually set to zero
|
48 |
-
$biXPelsPerMeter=round($biXPelsPerMeter/1000 *25.4);
|
49 |
-
//$biYPelsPerMeter=round($biYPelsPerMeter/1000 *25.4);
|
50 |
-
$info['set-dpi'] = $biXPelsPerMeter;
|
51 |
-
|
52 |
-
switch ($biCompression){
|
53 |
-
case 0:
|
54 |
-
$str = substr($data,$bfOffBits);
|
55 |
-
break;
|
56 |
-
case 1: # BI_RLE8
|
57 |
-
$str = $this->rle8_decode(substr($data,$bfOffBits), $width);
|
58 |
-
break;
|
59 |
-
case 2: # BI_RLE4
|
60 |
-
$str = $this->rle4_decode(substr($data,$bfOffBits), $width);
|
61 |
-
break;
|
62 |
-
}
|
63 |
-
$bmpdata = '';
|
64 |
-
$padCnt = (4-ceil(($width/(8/$biBitCount)))%4)%4;
|
65 |
-
switch ($biBitCount){
|
66 |
-
case 1:
|
67 |
-
case 4:
|
68 |
-
case 8:
|
69 |
-
$w = floor($width/(8/$biBitCount)) + ($width%(8/$biBitCount)?1:0);
|
70 |
-
$w_row = $w + $padCnt;
|
71 |
-
if ($flip){
|
72 |
-
for ($y=0;$y<$height;$y++){
|
73 |
-
$y0 = $y*$w_row;
|
74 |
-
for ($x=0;$x<$w;$x++)
|
75 |
-
$bmpdata .= $str[$y0+$x];
|
76 |
-
}
|
77 |
-
}else{
|
78 |
-
for ($y=$height-1;$y>=0;$y--){
|
79 |
-
$y0 = $y*$w_row;
|
80 |
-
for ($x=0;$x<$w;$x++)
|
81 |
-
$bmpdata .= $str[$y0+$x];
|
82 |
-
}
|
83 |
-
}
|
84 |
-
break;
|
85 |
-
|
86 |
-
case 16:
|
87 |
-
$w_row = $width*2 + $padCnt;
|
88 |
-
if ($flip){
|
89 |
-
for ($y=0;$y<$height;$y++){
|
90 |
-
$y0 = $y*$w_row;
|
91 |
-
for ($x=0;$x<$width;$x++){
|
92 |
-
$n = (ord( $str[$y0 + 2*$x + 1])*256 + ord( $str[$y0 + 2*$x]));
|
93 |
-
$b = ($n & 31)<<3; $g = ($n & 992)>>2; $r = ($n & 31744)>>7128;
|
94 |
-
$bmpdata .= chr($r) . chr($g) . chr($b);
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}else{
|
98 |
-
for ($y=$height-1;$y>=0;$y--){
|
99 |
-
$y0 = $y*$w_row;
|
100 |
-
for ($x=0;$x<$width;$x++){
|
101 |
-
$n = (ord( $str[$y0 + 2*$x + 1])*256 + ord( $str[$y0 + 2*$x]));
|
102 |
-
$b = ($n & 31)<<3; $g = ($n & 992)>>2; $r = ($n & 31744)>>7;
|
103 |
-
$bmpdata .= chr($r) . chr($g) . chr($b);
|
104 |
-
}
|
105 |
-
}
|
106 |
-
}
|
107 |
-
break;
|
108 |
-
|
109 |
-
case 24:
|
110 |
-
case 32:
|
111 |
-
$byteCnt = $biBitCount/8;
|
112 |
-
$w_row = $width*$byteCnt + $padCnt;
|
113 |
-
|
114 |
-
if ($flip){
|
115 |
-
for ($y=0;$y<$height;$y++){
|
116 |
-
$y0 = $y*$w_row;
|
117 |
-
for ($x=0;$x<$width;$x++){
|
118 |
-
$i = $y0 + $x*$byteCnt ; # + 1
|
119 |
-
$bmpdata .= $str[$i+2].$str[$i+1].$str[$i];
|
120 |
-
}
|
121 |
-
}
|
122 |
-
}else{
|
123 |
-
for ($y=$height-1;$y>=0;$y--){
|
124 |
-
$y0 = $y*$w_row;
|
125 |
-
for ($x=0;$x<$width;$x++){
|
126 |
-
$i = $y0 + $x*$byteCnt ; # + 1
|
127 |
-
$bmpdata .= $str[$i+2].$str[$i+1].$str[$i];
|
128 |
-
}
|
129 |
-
}
|
130 |
-
}
|
131 |
-
break;
|
132 |
-
|
133 |
-
default:
|
134 |
-
return array('error' => 'Error parsing BMP image - Unsupported image biBitCount');
|
135 |
-
}
|
136 |
-
if ($this->mpdf->compress) {
|
137 |
-
$bmpdata=gzcompress($bmpdata);
|
138 |
-
$info['f']='FlateDecode';
|
139 |
-
}
|
140 |
-
$info['data']=$bmpdata;
|
141 |
-
$info['type']='bmp';
|
142 |
-
return $info;
|
143 |
-
}
|
144 |
-
|
145 |
-
function _fourbytes2int_le($s) {
|
146 |
-
//Read a 4-byte integer from string
|
147 |
-
return (ord($s[3])<<24) + (ord($s[2])<<16) + (ord($s[1])<<8) + ord($s[0]);
|
148 |
-
}
|
149 |
-
|
150 |
-
function _twobytes2int_le($s) {
|
151 |
-
//Read a 2-byte integer from string
|
152 |
-
return (ord(substr($s, 1, 1))<<8) + ord(substr($s, 0, 1));
|
153 |
-
}
|
154 |
-
|
155 |
-
|
156 |
-
# Decoder for RLE8 compression in windows bitmaps
|
157 |
-
# see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp
|
158 |
-
function rle8_decode ($str, $width){
|
159 |
-
$lineWidth = $width + (3 - ($width-1) % 4);
|
160 |
-
$out = '';
|
161 |
-
$cnt = strlen($str);
|
162 |
-
for ($i=0;$i<$cnt;$i++){
|
163 |
-
$o = ord($str[$i]);
|
164 |
-
switch ($o){
|
165 |
-
case 0: # ESCAPE
|
166 |
-
$i++;
|
167 |
-
switch (ord($str[$i])){
|
168 |
-
case 0: # NEW LINE
|
169 |
-
$padCnt = $lineWidth - strlen($out)%$lineWidth;
|
170 |
-
if ($padCnt<$lineWidth) $out .= str_repeat(chr(0), $padCnt); # pad line
|
171 |
-
break;
|
172 |
-
case 1: # END OF FILE
|
173 |
-
$padCnt = $lineWidth - strlen($out)%$lineWidth;
|
174 |
-
if ($padCnt<$lineWidth) $out .= str_repeat(chr(0), $padCnt); # pad line
|
175 |
-
break 3;
|
176 |
-
case 2: # DELTA
|
177 |
-
$i += 2;
|
178 |
-
break;
|
179 |
-
default: # ABSOLUTE MODE
|
180 |
-
$num = ord($str[$i]);
|
181 |
-
for ($j=0;$j<$num;$j++)
|
182 |
-
$out .= $str[++$i];
|
183 |
-
if ($num % 2) $i++;
|
184 |
-
}
|
185 |
-
break;
|
186 |
-
default:
|
187 |
-
$out .= str_repeat($str[++$i], $o);
|
188 |
-
}
|
189 |
-
}
|
190 |
-
return $out;
|
191 |
-
}
|
192 |
-
|
193 |
-
# Decoder for RLE4 compression in windows bitmaps
|
194 |
-
# see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp
|
195 |
-
function rle4_decode ($str, $width){
|
196 |
-
$w = floor($width/2) + ($width % 2);
|
197 |
-
$lineWidth = $w + (3 - ( ($width-1) / 2) % 4);
|
198 |
-
$pixels = array();
|
199 |
-
$cnt = strlen($str);
|
200 |
-
for ($i=0;$i<$cnt;$i++){
|
201 |
-
$o = ord($str[$i]);
|
202 |
-
switch ($o){
|
203 |
-
case 0: # ESCAPE
|
204 |
-
$i++;
|
205 |
-
switch (ord($str[$i])){
|
206 |
-
case 0: # NEW LINE
|
207 |
-
while (count($pixels)%$lineWidth!=0)
|
208 |
-
$pixels[]=0;
|
209 |
-
break;
|
210 |
-
case 1: # END OF FILE
|
211 |
-
while (count($pixels)%$lineWidth!=0)
|
212 |
-
$pixels[]=0;
|
213 |
-
break 3;
|
214 |
-
case 2: # DELTA
|
215 |
-
$i += 2;
|
216 |
-
break;
|
217 |
-
default: # ABSOLUTE MODE
|
218 |
-
$num = ord($str[$i]);
|
219 |
-
for ($j=0;$j<$num;$j++){
|
220 |
-
if ($j%2==0){
|
221 |
-
$c = ord($str[++$i]);
|
222 |
-
$pixels[] = ($c & 240)>>4;
|
223 |
-
} else
|
224 |
-
$pixels[] = $c & 15;
|
225 |
-
}
|
226 |
-
if ($num % 2) $i++;
|
227 |
-
}
|
228 |
-
break;
|
229 |
-
default:
|
230 |
-
$c = ord($str[++$i]);
|
231 |
-
for ($j=0;$j<$o;$j++)
|
232 |
-
$pixels[] = ($j%2==0 ? ($c & 240)>>4 : $c & 15);
|
233 |
-
}
|
234 |
-
}
|
235 |
-
|
236 |
-
$out = '';
|
237 |
-
if (count($pixels)%2) $pixels[]=0;
|
238 |
-
$cnt = count($pixels)/2;
|
239 |
-
for ($i=0;$i<$cnt;$i++)
|
240 |
-
$out .= chr(16*$pixels[2*$i] + $pixels[2*$i+1]);
|
241 |
-
return $out;
|
242 |
-
}
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
}
|
247 |
-
|
248 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/cssmgr.php
DELETED
@@ -1,1602 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class cssmgr {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
|
7 |
-
var $tablecascadeCSS;
|
8 |
-
var $listcascadeCSS;
|
9 |
-
var $cascadeCSS;
|
10 |
-
var $CSS;
|
11 |
-
var $tbCSSlvl;
|
12 |
-
var $listCSSlvl;
|
13 |
-
|
14 |
-
|
15 |
-
function cssmgr(&$mpdf) {
|
16 |
-
$this->mpdf = $mpdf;
|
17 |
-
$this->tablecascadeCSS = array();
|
18 |
-
$this->listcascadeCSS = array();
|
19 |
-
$this->CSS=array();
|
20 |
-
$this->cascadeCSS = array();
|
21 |
-
$this->tbCSSlvl = 0;
|
22 |
-
$this->listCSSlvl = 0;
|
23 |
-
}
|
24 |
-
|
25 |
-
|
26 |
-
function ReadDefaultCSS($CSSstr) {
|
27 |
-
$CSS = array();
|
28 |
-
$CSSstr = preg_replace('|/\*.*?\*/|s',' ',$CSSstr);
|
29 |
-
$CSSstr = preg_replace('/[\s\n\r\t\f]/s',' ',$CSSstr);
|
30 |
-
$CSSstr = preg_replace('/(<\!\-\-|\-\->)/s',' ',$CSSstr);
|
31 |
-
if ($CSSstr ) {
|
32 |
-
preg_match_all('/(.*?)\{(.*?)\}/',$CSSstr,$styles);
|
33 |
-
for($i=0; $i < count($styles[1]) ; $i++) {
|
34 |
-
$stylestr= trim($styles[2][$i]);
|
35 |
-
$stylearr = explode(';',$stylestr);
|
36 |
-
foreach($stylearr AS $sta) {
|
37 |
-
if (trim($sta)) {
|
38 |
-
// Changed to allow style="background: url('http://www.bpm1.com/bg.jpg')"
|
39 |
-
list($property,$value) = explode(':',$sta,2);
|
40 |
-
$property = trim($property);
|
41 |
-
$value = preg_replace('/\s*!important/i','',$value);
|
42 |
-
$value = trim($value);
|
43 |
-
if ($property && ($value || $value==='0')) {
|
44 |
-
$classproperties[strtoupper($property)] = $value;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
-
$classproperties = $this->fixCSS($classproperties);
|
49 |
-
$tagstr = strtoupper(trim($styles[1][$i]));
|
50 |
-
$tagarr = explode(',',$tagstr);
|
51 |
-
foreach($tagarr AS $tg) {
|
52 |
-
$tags = preg_split('/\s+/',trim($tg));
|
53 |
-
$level = count($tags);
|
54 |
-
if ($level == 1) { // e.g. p or .class or #id or p.class or p#id
|
55 |
-
$t = trim($tags[0]);
|
56 |
-
if ($t) {
|
57 |
-
$tag = '';
|
58 |
-
if (preg_match('/^('.$this->mpdf->allowedCSStags.')$/',$t)) { $tag= $t; }
|
59 |
-
if ($this->CSS[$tag] && $tag) { $CSS[$tag] = $this->array_merge_recursive_unique($CSS[$tag], $classproperties); }
|
60 |
-
else if ($tag) { $CSS[$tag] = $classproperties; }
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
$properties = array();
|
65 |
-
$values = array();
|
66 |
-
$classproperties = array();
|
67 |
-
}
|
68 |
-
|
69 |
-
} // end of if
|
70 |
-
return $CSS;
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
function ReadCSS($html) {
|
76 |
-
preg_match_all('/<style[^>]*media=["\']([^"\'>]*)["\'].*?<\/style>/is',$html,$m);
|
77 |
-
for($i=0; $i<count($m[0]); $i++) {
|
78 |
-
if ($this->mpdf->CSSselectMedia && !preg_match('/('.trim($this->mpdf->CSSselectMedia).'|all)/i',$m[1][$i])) {
|
79 |
-
$html = preg_replace('/'.preg_quote($m[0][$i],'/').'/','',$html);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
preg_match_all('/<link[^>]*media=["\']([^"\'>]*)["\'].*?>/is',$html,$m);
|
83 |
-
for($i=0; $i<count($m[0]); $i++) {
|
84 |
-
if ($this->mpdf->CSSselectMedia && !preg_match('/('.trim($this->mpdf->CSSselectMedia).'|all)/i',$m[1][$i])) {
|
85 |
-
$html = preg_replace('/'.preg_quote($m[0][$i],'/').'/','',$html);
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
// mPDF 5.5.02
|
90 |
-
// Remove Comment tags <!-- ... --> inside CSS as <style> in HTML document
|
91 |
-
// Remove Comment tags /* ... */ inside CSS as <style> in HTML document
|
92 |
-
// But first, we replace upper and mixed case closing style tag with lower
|
93 |
-
// case so we can use str_replace later.
|
94 |
-
preg_replace('/<\/style>/i', '</style>', $html);
|
95 |
-
preg_match_all('/<style.*?>(.*?)<\/style>/si',$html,$m);
|
96 |
-
if (count($m[1])) {
|
97 |
-
for($i=0;$i<count($m[1]);$i++) {
|
98 |
-
// Remove comment tags
|
99 |
-
$sub = preg_replace('/(<\!\-\-|\-\->)/s',' ',$m[1][$i]);
|
100 |
-
$sub = '>'.preg_replace('|/\*.*?\*/|s',' ',$sub).'</style>';
|
101 |
-
$html = str_replace('>'.$m[1][$i].'</style>', $sub, $html);
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
|
106 |
-
$html = preg_replace('/<!--mpdf/i','',$html);
|
107 |
-
$html = preg_replace('/mpdf-->/i','',$html);
|
108 |
-
$html = preg_replace('/<\!\-\-.*?\-\->/s',' ',$html);
|
109 |
-
|
110 |
-
$match = 0; // no match for instance
|
111 |
-
$regexp = ''; // This helps debugging: showing what is the REAL string being processed
|
112 |
-
$CSSext = array();
|
113 |
-
|
114 |
-
//CSS inside external files
|
115 |
-
$regexp = '/<link[^>]*rel=["\']stylesheet["\'][^>]*href=["\']([^>"\']*)["\'].*?>/si';
|
116 |
-
$x = preg_match_all($regexp,$html,$cxt);
|
117 |
-
if ($x) {
|
118 |
-
$match += $x;
|
119 |
-
$CSSext = $cxt[1];
|
120 |
-
}
|
121 |
-
|
122 |
-
$regexp = '/<link[^>]*href=["\']([^>"\']*)["\'][^>]*?rel=["\']stylesheet["\'].*?>/si';
|
123 |
-
$x = preg_match_all($regexp,$html,$cxt);
|
124 |
-
if ($x) {
|
125 |
-
$match += $x;
|
126 |
-
$CSSext = array_merge($CSSext,$cxt[1]);
|
127 |
-
}
|
128 |
-
|
129 |
-
// look for @import stylesheets
|
130 |
-
//$regexp = '/@import url\([\'\"]{0,1}([^\)]*?\.css)[\'\"]{0,1}\)/si';
|
131 |
-
$regexp = '/@import url\([\'\"]{0,1}([^\)]*?\.css(\?\S+)?)[\'\"]{0,1}\)/si';
|
132 |
-
$x = preg_match_all($regexp,$html,$cxt);
|
133 |
-
if ($x) {
|
134 |
-
$match += $x;
|
135 |
-
$CSSext = array_merge($CSSext,$cxt[1]);
|
136 |
-
}
|
137 |
-
|
138 |
-
// look for @import without the url()
|
139 |
-
//$regexp = '/@import [\'\"]{0,1}([^;]*?\.css)[\'\"]{0,1}/si';
|
140 |
-
$regexp = '/@import [\'\"]{0,1}([^;]*?\.css(\?\S+)?)[\'\"]{0,1}/si';
|
141 |
-
$x = preg_match_all($regexp,$html,$cxt);
|
142 |
-
if ($x) {
|
143 |
-
$match += $x;
|
144 |
-
$CSSext = array_merge($CSSext,$cxt[1]);
|
145 |
-
}
|
146 |
-
|
147 |
-
$ind = 0;
|
148 |
-
$CSSstr = '';
|
149 |
-
|
150 |
-
if (!is_array($this->cascadeCSS)) $this->cascadeCSS = array();
|
151 |
-
|
152 |
-
while($match){
|
153 |
-
$path = $CSSext[$ind];
|
154 |
-
$this->mpdf->GetFullPath($path);
|
155 |
-
$CSSextblock = $this->mpdf->_get_file($path);
|
156 |
-
if ($CSSextblock) {
|
157 |
-
// look for embedded @import stylesheets in other stylesheets
|
158 |
-
// and fix url paths (including background-images) relative to stylesheet
|
159 |
-
//$regexpem = '/@import url\([\'\"]{0,1}(.*?\.css)[\'\"]{0,1}\)/si';
|
160 |
-
$regexpem = '/@import url\([\'\"]{0,1}(.*?\.css(\?\S+)?)[\'\"]{0,1}\)/si';
|
161 |
-
$xem = preg_match_all($regexpem,$CSSextblock,$cxtem);
|
162 |
-
$cssBasePath = preg_replace('/\/[^\/]*$/','',$path) . '/';
|
163 |
-
if ($xem) {
|
164 |
-
foreach($cxtem[1] AS $cxtembedded) {
|
165 |
-
// path is relative to original stlyesheet!!
|
166 |
-
$this->mpdf->GetFullPath($cxtembedded, $cssBasePath );
|
167 |
-
$match++;
|
168 |
-
$CSSext[] = $cxtembedded;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
$regexpem = '/(background[^;]*url\s*\(\s*[\'\"]{0,1})([^\)\'\"]*)([\'\"]{0,1}\s*\))/si';
|
172 |
-
$xem = preg_match_all($regexpem,$CSSextblock,$cxtem);
|
173 |
-
if ($xem) {
|
174 |
-
for ($i=0;$i<count($cxtem[0]);$i++) {
|
175 |
-
// path is relative to original stlyesheet!!
|
176 |
-
$embedded = $cxtem[2][$i];
|
177 |
-
if (!preg_match('/^data:image/i', $embedded)) { // mPDF 5.5.13
|
178 |
-
$this->mpdf->GetFullPath($embedded, $cssBasePath );
|
179 |
-
$CSSextblock = preg_replace('/'.preg_quote($cxtem[0][$i],'/').'/', ($cxtem[1][$i].$embedded.$cxtem[3][$i]), $CSSextblock);
|
180 |
-
}
|
181 |
-
}
|
182 |
-
}
|
183 |
-
$CSSstr .= ' '.$CSSextblock;
|
184 |
-
}
|
185 |
-
$match--;
|
186 |
-
$ind++;
|
187 |
-
} //end of match
|
188 |
-
|
189 |
-
$match = 0; // reset value, if needed
|
190 |
-
// CSS as <style> in HTML document
|
191 |
-
$regexp = '/<style.*?>(.*?)<\/style>/si';
|
192 |
-
$match = preg_match_all($regexp,$html,$CSSblock);
|
193 |
-
if ($match) {
|
194 |
-
$tmpCSSstr = implode(' ',$CSSblock[1]);
|
195 |
-
$regexpem = '/(background[^;]*url\s*\(\s*[\'\"]{0,1})([^\)\'\"]*)([\'\"]{0,1}\s*\))/si';
|
196 |
-
$xem = preg_match_all($regexpem,$tmpCSSstr ,$cxtem);
|
197 |
-
if ($xem) {
|
198 |
-
for ($i=0;$i<count($cxtem[0]);$i++) {
|
199 |
-
$embedded = $cxtem[2][$i];
|
200 |
-
if (!preg_match('/^data:image/i', $embedded)) { // mPDF 5.5.13
|
201 |
-
//$this->mpdf->GetFullPath($embedded); /* Blue Liquid Designs Removed to allow both URL and PATHs to images */
|
202 |
-
$tmpCSSstr = preg_replace('/'.preg_quote($cxtem[0][$i],'/').'/', ($cxtem[1][$i].$embedded.$cxtem[3][$i]), $tmpCSSstr );
|
203 |
-
}
|
204 |
-
}
|
205 |
-
}
|
206 |
-
$CSSstr .= ' '.$tmpCSSstr;
|
207 |
-
}
|
208 |
-
// Remove comments
|
209 |
-
$CSSstr = preg_replace('|/\*.*?\*/|s',' ',$CSSstr);
|
210 |
-
$CSSstr = preg_replace('/[\s\n\r\t\f]/s',' ',$CSSstr);
|
211 |
-
|
212 |
-
if (preg_match('/@media/',$CSSstr)) {
|
213 |
-
preg_match_all('/@media(.*?)\{(([^\{\}]*\{[^\{\}]*\})+)\s*\}/is',$CSSstr,$m);
|
214 |
-
for($i=0; $i<count($m[0]); $i++) {
|
215 |
-
if ($this->mpdf->CSSselectMedia && !preg_match('/('.trim($this->mpdf->CSSselectMedia).'|all)/i',$m[1][$i])) {
|
216 |
-
$CSSstr = preg_replace('/'.preg_quote($m[0][$i],'/').'/','',$CSSstr);
|
217 |
-
}
|
218 |
-
else {
|
219 |
-
$CSSstr = preg_replace('/'.preg_quote($m[0][$i],'/').'/',' '.$m[2][$i].' ',$CSSstr);
|
220 |
-
}
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
// Replace any background: url(data:image... with temporary image file reference
|
225 |
-
preg_match_all("/(url\(data:image\/(jpeg|gif|png);base64,(.*?)\))/si", $CSSstr, $idata); // mPDF 5.7.2
|
226 |
-
if (count($idata[0])) {
|
227 |
-
for($i=0;$i<count($idata[0]);$i++) {
|
228 |
-
$file = _MPDF_TEMP_PATH.'_tempCSSidata'.RAND(1,10000).'_'.$i.'.'.$idata[2][$i];
|
229 |
-
//Save to local file
|
230 |
-
file_put_contents($file, base64_decode($idata[3][$i]));
|
231 |
-
// $this->mpdf->GetFullPath($file); // ? is this needed - NO mPDF 5.6.03
|
232 |
-
$CSSstr = str_replace($idata[0][$i], 'url("'.$file.'")', $CSSstr); // mPDF 5.5.17
|
233 |
-
}
|
234 |
-
}
|
235 |
-
|
236 |
-
$CSSstr = preg_replace('/(<\!\-\-|\-\->)/s',' ',$CSSstr);
|
237 |
-
if ($CSSstr ) {
|
238 |
-
preg_match_all('/(.*?)\{(.*?)\}/',$CSSstr,$styles);
|
239 |
-
for($i=0; $i < count($styles[1]) ; $i++) {
|
240 |
-
// SET array e.g. $classproperties['COLOR'] = '#ffffff';
|
241 |
-
$stylestr= trim($styles[2][$i]);
|
242 |
-
$stylearr = explode(';',$stylestr);
|
243 |
-
foreach($stylearr AS $sta) {
|
244 |
-
if (trim($sta)) {
|
245 |
-
// Changed to allow style="background: url('http://www.bpm1.com/bg.jpg')"
|
246 |
-
list($property,$value) = explode(':',$sta,2);
|
247 |
-
$property = trim($property);
|
248 |
-
$value = preg_replace('/\s*!important/i','',$value);
|
249 |
-
$value = trim($value);
|
250 |
-
if ($property && ($value || $value==='0')) {
|
251 |
-
// Ignores -webkit-gradient so doesn't override -moz-
|
252 |
-
if ((strtoupper($property)=='BACKGROUND-IMAGE' || strtoupper($property)=='BACKGROUND') && preg_match('/-webkit-gradient/i',$value)) {
|
253 |
-
continue;
|
254 |
-
}
|
255 |
-
$classproperties[strtoupper($property)] = $value;
|
256 |
-
}
|
257 |
-
}
|
258 |
-
}
|
259 |
-
$classproperties = $this->fixCSS($classproperties);
|
260 |
-
$tagstr = strtoupper(trim($styles[1][$i]));
|
261 |
-
$tagarr = explode(',',$tagstr);
|
262 |
-
$pageselectors = false; // used to turn on $this->mpdf->mirrorMargins
|
263 |
-
foreach($tagarr AS $tg) {
|
264 |
-
// mPDF 5.7.4
|
265 |
-
if (preg_match('/NTH-CHILD\((\s*(([\-+]?\d*)N(\s*[\-+]\s*\d+)?|[\-+]?\d+|ODD|EVEN)\s*)\)/',$tg,$m) ) {
|
266 |
-
$tg = preg_replace('/NTH-CHILD\(.*\)/', 'NTH-CHILD('.str_replace(' ','',$m[1]).')', $tg);
|
267 |
-
}
|
268 |
-
$tags = preg_split('/\s+/',trim($tg));
|
269 |
-
$level = count($tags);
|
270 |
-
$t = '';
|
271 |
-
$t2 = '';
|
272 |
-
$t3 = '';
|
273 |
-
if (trim($tags[0])=='@PAGE') {
|
274 |
-
if (isset($tags[0])) { $t = trim($tags[0]); }
|
275 |
-
if (isset($tags[1])) { $t2 = trim($tags[1]); }
|
276 |
-
if (isset($tags[2])) { $t3 = trim($tags[2]); }
|
277 |
-
$tag = '';
|
278 |
-
if ($level==1) { $tag = $t; }
|
279 |
-
else if ($level==2 && preg_match('/^[:](.*)$/',$t2,$m)) {
|
280 |
-
$tag = $t.'>>PSEUDO>>'.$m[1];
|
281 |
-
if ($m[1]=='LEFT' || $m[1]=='RIGHT') { $pageselectors = true; } // used to turn on $this->mpdf->mirrorMargins
|
282 |
-
}
|
283 |
-
else if ($level==2) { $tag = $t.'>>NAMED>>'.$t2; }
|
284 |
-
else if ($level==3 && preg_match('/^[:](.*)$/',$t3,$m)) {
|
285 |
-
$tag = $t.'>>NAMED>>'.$t2.'>>PSEUDO>>'.$m[1];
|
286 |
-
if ($m[1]=='LEFT' || $m[1]=='RIGHT') { $pageselectors = true; } // used to turn on $this->mpdf->mirrorMargins
|
287 |
-
}
|
288 |
-
if (isset($this->CSS[$tag]) && $tag) { $this->CSS[$tag] = $this->array_merge_recursive_unique($this->CSS[$tag], $classproperties); }
|
289 |
-
else if ($tag) { $this->CSS[$tag] = $classproperties; }
|
290 |
-
}
|
291 |
-
|
292 |
-
else if ($level == 1) { // e.g. p or .class or #id or p.class or p#id
|
293 |
-
if (isset($tags[0])) { $t = trim($tags[0]); }
|
294 |
-
if ($t) {
|
295 |
-
$tag = '';
|
296 |
-
if (preg_match('/^[.](.*)$/',$t,$m)) { $tag = 'CLASS>>'.$m[1]; }
|
297 |
-
else if (preg_match('/^[#](.*)$/',$t,$m)) { $tag = 'ID>>'.$m[1]; }
|
298 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')[.](.*)$/',$t,$m)) { $tag = $m[1].'>>CLASS>>'.$m[2]; }
|
299 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')\s*:NTH-CHILD\((.*)\)$/',$t,$m)) { $tag = $m[1].'>>SELECTORNTHCHILD>>'.$m[2]; }
|
300 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')[#](.*)$/',$t,$m)) { $tag = $m[1].'>>ID>>'.$m[2]; }
|
301 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')$/',$t)) { $tag= $t; }
|
302 |
-
if (isset($this->CSS[$tag]) && $tag) { $this->CSS[$tag] = $this->array_merge_recursive_unique($this->CSS[$tag], $classproperties); }
|
303 |
-
else if ($tag) { $this->CSS[$tag] = $classproperties; }
|
304 |
-
}
|
305 |
-
}
|
306 |
-
else {
|
307 |
-
$tmp = array();
|
308 |
-
for($n=0;$n<$level;$n++) {
|
309 |
-
if (isset($tags[$n])) { $t = trim($tags[$n]); }
|
310 |
-
else { $t = ''; }
|
311 |
-
if ($t) {
|
312 |
-
$tag = '';
|
313 |
-
if (preg_match('/^[.](.*)$/',$t,$m)) { $tag = 'CLASS>>'.$m[1]; }
|
314 |
-
else if (preg_match('/^[#](.*)$/',$t,$m)) { $tag = 'ID>>'.$m[1]; }
|
315 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')[.](.*)$/',$t,$m)) { $tag = $m[1].'>>CLASS>>'.$m[2]; }
|
316 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')\s*:NTH-CHILD\((.*)\)$/',$t,$m)) { $tag = $m[1].'>>SELECTORNTHCHILD>>'.$m[2]; }
|
317 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')[#](.*)$/',$t,$m)) { $tag = $m[1].'>>ID>>'.$m[2]; }
|
318 |
-
else if (preg_match('/^('.$this->mpdf->allowedCSStags.')$/',$t)) { $tag= $t; }
|
319 |
-
|
320 |
-
if ($tag) $tmp[] = $tag;
|
321 |
-
else { break; }
|
322 |
-
}
|
323 |
-
}
|
324 |
-
|
325 |
-
if ($tag) {
|
326 |
-
$x = &$this->cascadeCSS;
|
327 |
-
foreach($tmp AS $tp) { $x = &$x[$tp]; }
|
328 |
-
$x = $this->array_merge_recursive_unique($x, $classproperties);
|
329 |
-
$x['depth'] = $level;
|
330 |
-
}
|
331 |
-
}
|
332 |
-
}
|
333 |
-
if ($pageselectors) { $this->mpdf->mirrorMargins = true; }
|
334 |
-
$properties = array();
|
335 |
-
$values = array();
|
336 |
-
$classproperties = array();
|
337 |
-
}
|
338 |
-
} // end of if
|
339 |
-
//Remove CSS (tags and content), if any
|
340 |
-
$regexp = '/<style.*?>(.*?)<\/style>/si'; // it can be <style> or <style type="txt/css">
|
341 |
-
$html = preg_replace($regexp,'',$html);
|
342 |
-
//print_r($this->CSS); exit;
|
343 |
-
//print_r($this->cascadeCSS); exit;
|
344 |
-
return $html;
|
345 |
-
}
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
function readInlineCSS($html) {
|
350 |
-
//Fix incomplete CSS code
|
351 |
-
$size = strlen($html)-1;
|
352 |
-
if (substr($html,$size,1) != ';') $html .= ';';
|
353 |
-
//Make CSS[Name-of-the-class] = array(key => value)
|
354 |
-
$regexp = '|\\s*?(\\S+?):(.+?);|i';
|
355 |
-
preg_match_all( $regexp, $html, $styleinfo);
|
356 |
-
$properties = $styleinfo[1];
|
357 |
-
$values = $styleinfo[2];
|
358 |
-
//Array-properties and Array-values must have the SAME SIZE!
|
359 |
-
$classproperties = array();
|
360 |
-
for($i = 0; $i < count($properties) ; $i++) {
|
361 |
-
// Ignores -webkit-gradient so doesn't override -moz-
|
362 |
-
if ((strtoupper($properties[$i])=='BACKGROUND-IMAGE' || strtoupper($properties[$i])=='BACKGROUND') && preg_match('/-webkit-gradient/i',$values[$i])) {
|
363 |
-
continue;
|
364 |
-
}
|
365 |
-
$classproperties[strtoupper($properties[$i])] = trim($values[$i]);
|
366 |
-
}
|
367 |
-
return $this->fixCSS($classproperties);
|
368 |
-
}
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
function _fix_borderStr($bd) {
|
373 |
-
preg_match_all("/\((.*?)\)/", $bd, $m);
|
374 |
-
if (count($m[1])) {
|
375 |
-
for($i=0;$i<count($m[1]);$i++) {
|
376 |
-
$sub = preg_replace("/ /", "", $m[1][$i]);
|
377 |
-
$bd = preg_replace('/'.preg_quote($m[1][$i], '/').'/si', $sub, $bd);
|
378 |
-
}
|
379 |
-
}
|
380 |
-
|
381 |
-
$prop = preg_split('/\s+/',trim($bd));
|
382 |
-
$w = 'medium';
|
383 |
-
$c = '#000000';
|
384 |
-
$s = 'none';
|
385 |
-
|
386 |
-
if ( count($prop) == 1 ) {
|
387 |
-
// solid
|
388 |
-
if (in_array($prop[0],$this->mpdf->borderstyles) || $prop[0] == 'none' || $prop[0] == 'hidden' ) { $s = $prop[0]; }
|
389 |
-
// #000000
|
390 |
-
else if (is_array($this->mpdf->ConvertColor($prop[0]))) { $c = $prop[0]; }
|
391 |
-
// 1px
|
392 |
-
else { $w = $prop[0]; }
|
393 |
-
}
|
394 |
-
else if (count($prop) == 2 ) {
|
395 |
-
// 1px solid
|
396 |
-
if (in_array($prop[1],$this->mpdf->borderstyles) || $prop[1] == 'none' || $prop[1] == 'hidden' ) { $w = $prop[0]; $s = $prop[1]; }
|
397 |
-
// solid #000000
|
398 |
-
else if (in_array($prop[0],$this->mpdf->borderstyles) || $prop[0] == 'none' || $prop[0] == 'hidden' ) { $s = $prop[0]; $c = $prop[1]; }
|
399 |
-
// 1px #000000
|
400 |
-
else { $w = $prop[0]; $c = $prop[1]; }
|
401 |
-
}
|
402 |
-
else if ( count($prop) == 3 ) {
|
403 |
-
// Change #000000 1px solid to 1px solid #000000 (proper)
|
404 |
-
if (substr($prop[0],0,1) == '#') { $c = $prop[0]; $w = $prop[1]; $s = $prop[2]; }
|
405 |
-
// Change solid #000000 1px to 1px solid #000000 (proper)
|
406 |
-
else if (substr($prop[0],1,1) == '#') { $s = $prop[0]; $c = $prop[1]; $w = $prop[2]; }
|
407 |
-
// Change solid 1px #000000 to 1px solid #000000 (proper)
|
408 |
-
else if (in_array($prop[0],$this->mpdf->borderstyles) || $prop[0] == 'none' || $prop[0] == 'hidden' ) {
|
409 |
-
$s = $prop[0]; $w = $prop[1]; $c = $prop[2];
|
410 |
-
}
|
411 |
-
else { $w = $prop[0]; $s = $prop[1]; $c = $prop[2]; }
|
412 |
-
}
|
413 |
-
else { return ''; }
|
414 |
-
$s = strtolower($s);
|
415 |
-
return $w.' '.$s.' '.$c;
|
416 |
-
}
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
function fixCSS($prop) {
|
421 |
-
if (!is_array($prop) || (count($prop)==0)) return array();
|
422 |
-
$newprop = array();
|
423 |
-
foreach($prop AS $k => $v) {
|
424 |
-
if ($k != 'BACKGROUND-IMAGE' && $k != 'BACKGROUND' && $k != 'ODD-HEADER-NAME' && $k != 'EVEN-HEADER-NAME' && $k != 'ODD-FOOTER-NAME' && $k != 'EVEN-FOOTER-NAME' && $k != 'HEADER' && $k != 'FOOTER') {
|
425 |
-
$v = strtolower($v);
|
426 |
-
}
|
427 |
-
|
428 |
-
if ($k == 'FONT') {
|
429 |
-
$s = trim($v);
|
430 |
-
preg_match_all('/\"(.*?)\"/',$s,$ff);
|
431 |
-
if (count($ff[1])) {
|
432 |
-
foreach($ff[1] AS $ffp) {
|
433 |
-
$w = preg_split('/\s+/',$ffp);
|
434 |
-
$s = preg_replace('/\"'.$ffp.'\"/',$w[0],$s);
|
435 |
-
}
|
436 |
-
}
|
437 |
-
preg_match_all('/\'(.*?)\'/',$s,$ff);
|
438 |
-
if (count($ff[1])) {
|
439 |
-
foreach($ff[1] AS $ffp) {
|
440 |
-
$w = preg_split('/\s+/',$ffp);
|
441 |
-
$s = preg_replace('/\''.$ffp.'\'/',$w[0],$s);
|
442 |
-
}
|
443 |
-
}
|
444 |
-
$s = preg_replace('/\s*,\s*/',',',$s);
|
445 |
-
$bits = preg_split('/\s+/',$s);
|
446 |
-
if (count($bits)>1) {
|
447 |
-
$k = 'FONT-FAMILY'; $v = $bits[(count($bits)-1)];
|
448 |
-
$fs = $bits[(count($bits)-2)];
|
449 |
-
if (preg_match('/(.*?)\/(.*)/',$fs, $fsp)) {
|
450 |
-
$newprop['FONT-SIZE'] = $fsp[1];
|
451 |
-
$newprop['LINE-HEIGHT'] = $fsp[2];
|
452 |
-
}
|
453 |
-
else { $newprop['FONT-SIZE'] = $fs; }
|
454 |
-
if (preg_match('/(italic|oblique)/i',$s)) { $newprop['FONT-STYLE'] = 'italic'; }
|
455 |
-
else { $newprop['FONT-STYLE'] = 'normal'; }
|
456 |
-
if (preg_match('/bold/i',$s)) { $newprop['FONT-WEIGHT'] = 'bold'; }
|
457 |
-
else { $newprop['FONT-WEIGHT'] = 'normal'; }
|
458 |
-
if (preg_match('/small-caps/i',$s)) { $newprop['TEXT-TRANSFORM'] = 'uppercase'; }
|
459 |
-
}
|
460 |
-
}
|
461 |
-
if ($k == 'FONT-FAMILY') {
|
462 |
-
$aux_fontlist = explode(",",$v);
|
463 |
-
$found = 0;
|
464 |
-
foreach($aux_fontlist AS $f) {
|
465 |
-
$fonttype = trim($f);
|
466 |
-
$fonttype = preg_replace('/["\']*(.*?)["\']*/','\\1',$fonttype);
|
467 |
-
$fonttype = preg_replace('/ /','',$fonttype);
|
468 |
-
$v = strtolower(trim($fonttype));
|
469 |
-
if (isset($this->mpdf->fonttrans[$v]) && $this->mpdf->fonttrans[$v]) { $v = $this->mpdf->fonttrans[$v]; }
|
470 |
-
if ((!$this->mpdf->onlyCoreFonts && in_array($v,$this->mpdf->available_unifonts)) ||
|
471 |
-
in_array($v,array('ccourier','ctimes','chelvetica')) ||
|
472 |
-
($this->mpdf->onlyCoreFonts && in_array($v,array('courier','times','helvetica','arial'))) ||
|
473 |
-
in_array($v, array('sjis','uhc','big5','gb'))) {
|
474 |
-
$newprop[$k] = $v;
|
475 |
-
$found = 1;
|
476 |
-
break;
|
477 |
-
}
|
478 |
-
}
|
479 |
-
if (!$found) {
|
480 |
-
foreach($aux_fontlist AS $f) {
|
481 |
-
$fonttype = trim($f);
|
482 |
-
$fonttype = preg_replace('/["\']*(.*?)["\']*/','\\1',$fonttype);
|
483 |
-
$fonttype = preg_replace('/ /','',$fonttype);
|
484 |
-
$v = strtolower(trim($fonttype));
|
485 |
-
if (isset($this->mpdf->fonttrans[$v]) && $this->mpdf->fonttrans[$v]) { $v = $this->mpdf->fonttrans[$v]; }
|
486 |
-
if (in_array($v,$this->mpdf->sans_fonts) || in_array($v,$this->mpdf->serif_fonts) || in_array($v,$this->mpdf->mono_fonts) ) {
|
487 |
-
$newprop[$k] = $v;
|
488 |
-
break;
|
489 |
-
}
|
490 |
-
}
|
491 |
-
}
|
492 |
-
}
|
493 |
-
else if ($k == 'MARGIN') {
|
494 |
-
$tmp = $this->expand24($v);
|
495 |
-
$newprop['MARGIN-TOP'] = $tmp['T'];
|
496 |
-
$newprop['MARGIN-RIGHT'] = $tmp['R'];
|
497 |
-
$newprop['MARGIN-BOTTOM'] = $tmp['B'];
|
498 |
-
$newprop['MARGIN-LEFT'] = $tmp['L'];
|
499 |
-
}
|
500 |
-
/*-- BORDER-RADIUS --*/
|
501 |
-
else if ($k == 'BORDER-RADIUS' || $k == 'BORDER-TOP-LEFT-RADIUS' || $k == 'BORDER-TOP-RIGHT-RADIUS' || $k == 'BORDER-BOTTOM-LEFT-RADIUS' || $k == 'BORDER-BOTTOM-RIGHT-RADIUS') {
|
502 |
-
$tmp = $this->border_radius_expand($v,$k);
|
503 |
-
if (isset($tmp['TL-H'])) $newprop['BORDER-TOP-LEFT-RADIUS-H'] = $tmp['TL-H'];
|
504 |
-
if (isset($tmp['TL-V'])) $newprop['BORDER-TOP-LEFT-RADIUS-V'] = $tmp['TL-V'];
|
505 |
-
if (isset($tmp['TR-H'])) $newprop['BORDER-TOP-RIGHT-RADIUS-H'] = $tmp['TR-H'];
|
506 |
-
if (isset($tmp['TR-V'])) $newprop['BORDER-TOP-RIGHT-RADIUS-V'] = $tmp['TR-V'];
|
507 |
-
if (isset($tmp['BL-H'])) $newprop['BORDER-BOTTOM-LEFT-RADIUS-H'] = $tmp['BL-H'];
|
508 |
-
if (isset($tmp['BL-V'])) $newprop['BORDER-BOTTOM-LEFT-RADIUS-V'] = $tmp['BL-V'];
|
509 |
-
if (isset($tmp['BR-H'])) $newprop['BORDER-BOTTOM-RIGHT-RADIUS-H'] = $tmp['BR-H'];
|
510 |
-
if (isset($tmp['BR-V'])) $newprop['BORDER-BOTTOM-RIGHT-RADIUS-V'] = $tmp['BR-V'];
|
511 |
-
}
|
512 |
-
/*-- END BORDER-RADIUS --*/
|
513 |
-
else if ($k == 'PADDING') {
|
514 |
-
$tmp = $this->expand24($v);
|
515 |
-
$newprop['PADDING-TOP'] = $tmp['T'];
|
516 |
-
$newprop['PADDING-RIGHT'] = $tmp['R'];
|
517 |
-
$newprop['PADDING-BOTTOM'] = $tmp['B'];
|
518 |
-
$newprop['PADDING-LEFT'] = $tmp['L'];
|
519 |
-
}
|
520 |
-
else if ($k == 'BORDER') {
|
521 |
-
if ($v == '1') { $v = '1px solid #000000'; }
|
522 |
-
else { $v = $this->_fix_borderStr($v); }
|
523 |
-
$newprop['BORDER-TOP'] = $v;
|
524 |
-
$newprop['BORDER-RIGHT'] = $v;
|
525 |
-
$newprop['BORDER-BOTTOM'] = $v;
|
526 |
-
$newprop['BORDER-LEFT'] = $v;
|
527 |
-
}
|
528 |
-
else if ($k == 'BORDER-TOP') {
|
529 |
-
$newprop['BORDER-TOP'] = $this->_fix_borderStr($v);
|
530 |
-
}
|
531 |
-
else if ($k == 'BORDER-RIGHT') {
|
532 |
-
$newprop['BORDER-RIGHT'] = $this->_fix_borderStr($v);
|
533 |
-
}
|
534 |
-
else if ($k == 'BORDER-BOTTOM') {
|
535 |
-
$newprop['BORDER-BOTTOM'] = $this->_fix_borderStr($v);
|
536 |
-
}
|
537 |
-
else if ($k == 'BORDER-LEFT') {
|
538 |
-
$newprop['BORDER-LEFT'] = $this->_fix_borderStr($v);
|
539 |
-
}
|
540 |
-
else if ($k == 'BORDER-STYLE') {
|
541 |
-
$e = $this->expand24($v);
|
542 |
-
$newprop['BORDER-TOP-STYLE'] = $e['T'];
|
543 |
-
$newprop['BORDER-RIGHT-STYLE'] = $e['R'];
|
544 |
-
$newprop['BORDER-BOTTOM-STYLE'] = $e['B'];
|
545 |
-
$newprop['BORDER-LEFT-STYLE'] = $e['L'];
|
546 |
-
}
|
547 |
-
else if ($k == 'BORDER-WIDTH') {
|
548 |
-
$e = $this->expand24($v);
|
549 |
-
$newprop['BORDER-TOP-WIDTH'] = $e['T'];
|
550 |
-
$newprop['BORDER-RIGHT-WIDTH'] = $e['R'];
|
551 |
-
$newprop['BORDER-BOTTOM-WIDTH'] = $e['B'];
|
552 |
-
$newprop['BORDER-LEFT-WIDTH'] = $e['L'];
|
553 |
-
}
|
554 |
-
else if ($k == 'BORDER-COLOR') {
|
555 |
-
$e = $this->expand24($v);
|
556 |
-
$newprop['BORDER-TOP-COLOR'] = $e['T'];
|
557 |
-
$newprop['BORDER-RIGHT-COLOR'] = $e['R'];
|
558 |
-
$newprop['BORDER-BOTTOM-COLOR'] = $e['B'];
|
559 |
-
$newprop['BORDER-LEFT-COLOR'] = $e['L'];
|
560 |
-
}
|
561 |
-
|
562 |
-
else if ($k == 'BORDER-SPACING') {
|
563 |
-
$prop = preg_split('/\s+/',trim($v));
|
564 |
-
if (count($prop) == 1 ) {
|
565 |
-
$newprop['BORDER-SPACING-H'] = $prop[0];
|
566 |
-
$newprop['BORDER-SPACING-V'] = $prop[0];
|
567 |
-
}
|
568 |
-
else if (count($prop) == 2 ) {
|
569 |
-
$newprop['BORDER-SPACING-H'] = $prop[0];
|
570 |
-
$newprop['BORDER-SPACING-V'] = $prop[1];
|
571 |
-
}
|
572 |
-
}
|
573 |
-
else if ($k == 'TEXT-OUTLINE') { // mPDF 5.6.07
|
574 |
-
$prop = preg_split('/\s+/',trim($v));
|
575 |
-
if (trim(strtolower($v)) == 'none' ) {
|
576 |
-
$newprop['TEXT-OUTLINE'] = 'none';
|
577 |
-
}
|
578 |
-
else if (count($prop) == 2 ) {
|
579 |
-
$newprop['TEXT-OUTLINE-WIDTH'] = $prop[0];
|
580 |
-
$newprop['TEXT-OUTLINE-COLOR'] = $prop[1];
|
581 |
-
}
|
582 |
-
else if (count($prop) == 3 ) {
|
583 |
-
$newprop['TEXT-OUTLINE-WIDTH'] = $prop[0];
|
584 |
-
$newprop['TEXT-OUTLINE-COLOR'] = $prop[2];
|
585 |
-
}
|
586 |
-
}
|
587 |
-
else if ($k == 'SIZE') {
|
588 |
-
$prop = preg_split('/\s+/',trim($v));
|
589 |
-
if (preg_match('/(auto|portrait|landscape)/',$prop[0])) {
|
590 |
-
$newprop['SIZE'] = strtoupper($prop[0]);
|
591 |
-
}
|
592 |
-
else if (count($prop) == 1 ) {
|
593 |
-
$newprop['SIZE']['W'] = $this->mpdf->ConvertSize($prop[0]);
|
594 |
-
$newprop['SIZE']['H'] = $this->mpdf->ConvertSize($prop[0]);
|
595 |
-
}
|
596 |
-
else if (count($prop) == 2 ) {
|
597 |
-
$newprop['SIZE']['W'] = $this->mpdf->ConvertSize($prop[0]);
|
598 |
-
$newprop['SIZE']['H'] = $this->mpdf->ConvertSize($prop[1]);
|
599 |
-
}
|
600 |
-
}
|
601 |
-
else if ($k == 'SHEET-SIZE') {
|
602 |
-
$prop = preg_split('/\s+/',trim($v));
|
603 |
-
if (count($prop) == 2 ) {
|
604 |
-
$newprop['SHEET-SIZE'] = array($this->mpdf->ConvertSize($prop[0]), $this->mpdf->ConvertSize($prop[1]));
|
605 |
-
}
|
606 |
-
else {
|
607 |
-
if(preg_match('/([0-9a-zA-Z]*)-L/i',$v,$m)) { // e.g. A4-L = A$ landscape
|
608 |
-
$ft = $this->mpdf->_getPageFormat($m[1]);
|
609 |
-
$format = array($ft[1],$ft[0]);
|
610 |
-
}
|
611 |
-
else { $format = $this->mpdf->_getPageFormat($v); }
|
612 |
-
if ($format) { $newprop['SHEET-SIZE'] = array($format[0]/_MPDFK, $format[1]/_MPDFK); }
|
613 |
-
}
|
614 |
-
}
|
615 |
-
else if ($k == 'BACKGROUND') {
|
616 |
-
$bg = $this->parseCSSbackground($v);
|
617 |
-
if ($bg['c']) { $newprop['BACKGROUND-COLOR'] = $bg['c']; }
|
618 |
-
else { $newprop['BACKGROUND-COLOR'] = 'transparent'; }
|
619 |
-
/*-- BACKGROUNDS --*/
|
620 |
-
if ($bg['i']) {
|
621 |
-
$newprop['BACKGROUND-IMAGE'] = $bg['i'];
|
622 |
-
if ($bg['r']) { $newprop['BACKGROUND-REPEAT'] = $bg['r']; }
|
623 |
-
if ($bg['p']) { $newprop['BACKGROUND-POSITION'] = $bg['p']; }
|
624 |
-
}
|
625 |
-
else { $newprop['BACKGROUND-IMAGE'] = ''; }
|
626 |
-
/*-- END BACKGROUNDS --*/
|
627 |
-
}
|
628 |
-
/*-- BACKGROUNDS --*/
|
629 |
-
else if ($k == 'BACKGROUND-IMAGE') {
|
630 |
-
if (preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient\(.*\)/i',$v,$m)) {
|
631 |
-
$newprop['BACKGROUND-IMAGE'] = $m[0];
|
632 |
-
continue;
|
633 |
-
}
|
634 |
-
if (preg_match('/url\([\'\"]{0,1}(.*?)[\'\"]{0,1}\)/i',$v,$m)) {
|
635 |
-
$newprop['BACKGROUND-IMAGE'] = $m[1];
|
636 |
-
}
|
637 |
-
|
638 |
-
else if (strtolower($v)=='none') { $newprop['BACKGROUND-IMAGE'] = ''; }
|
639 |
-
|
640 |
-
}
|
641 |
-
else if ($k == 'BACKGROUND-REPEAT') {
|
642 |
-
if (preg_match('/(repeat-x|repeat-y|no-repeat|repeat)/i',$v,$m)) {
|
643 |
-
$newprop['BACKGROUND-REPEAT'] = strtolower($m[1]);
|
644 |
-
}
|
645 |
-
}
|
646 |
-
else if ($k == 'BACKGROUND-POSITION') {
|
647 |
-
$s = $v;
|
648 |
-
$bits = preg_split('/\s+/',trim($s));
|
649 |
-
// These should be Position x1 or x2
|
650 |
-
if (count($bits)==1) {
|
651 |
-
if (preg_match('/bottom/',$bits[0])) { $bg['p'] = '50% 100%'; }
|
652 |
-
else if (preg_match('/top/',$bits[0])) { $bg['p'] = '50% 0%'; }
|
653 |
-
else { $bg['p'] = $bits[0] . ' 50%'; }
|
654 |
-
}
|
655 |
-
else if (count($bits)==2) {
|
656 |
-
// Can be either right center or center right
|
657 |
-
if (preg_match('/(top|bottom)/',$bits[0]) || preg_match('/(left|right)/',$bits[1])) {
|
658 |
-
$bg['p'] = $bits[1] . ' '.$bits[0];
|
659 |
-
}
|
660 |
-
else {
|
661 |
-
$bg['p'] = $bits[0] . ' '.$bits[1];
|
662 |
-
}
|
663 |
-
}
|
664 |
-
if ($bg['p']) {
|
665 |
-
$bg['p'] = preg_replace('/(left|top)/','0%',$bg['p']);
|
666 |
-
$bg['p'] = preg_replace('/(right|bottom)/','100%',$bg['p']);
|
667 |
-
$bg['p'] = preg_replace('/(center)/','50%',$bg['p']);
|
668 |
-
if (!preg_match('/[\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)* [\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)*/',$bg['p'])) {
|
669 |
-
$bg['p'] = false;
|
670 |
-
}
|
671 |
-
}
|
672 |
-
if ($bg['p']) { $newprop['BACKGROUND-POSITION'] = $bg['p']; }
|
673 |
-
}
|
674 |
-
/*-- END BACKGROUNDS --*/
|
675 |
-
else if ($k == 'IMAGE-ORIENTATION') {
|
676 |
-
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i',$v,$m)) {
|
677 |
-
$angle = $m[1] + 0;
|
678 |
-
if (strtolower($m[2])=='deg') { $angle = $angle; }
|
679 |
-
else if (strtolower($m[2])=='grad') { $angle *= (360/400); }
|
680 |
-
else if (strtolower($m[2])=='rad') { $angle = rad2deg($angle); }
|
681 |
-
while($angle < 0) { $angle += 360; }
|
682 |
-
$angle = ($angle % 360);
|
683 |
-
$angle /= 90;
|
684 |
-
$angle = round($angle) * 90;
|
685 |
-
$newprop['IMAGE-ORIENTATION'] = $angle;
|
686 |
-
}
|
687 |
-
}
|
688 |
-
// mPDF 5.6.13
|
689 |
-
else if ($k == 'TEXT-ALIGN') {
|
690 |
-
if (preg_match('/["\'](.){1}["\']/i',$v,$m)) {
|
691 |
-
$d = array_search($m[1],$this->mpdf->decimal_align);
|
692 |
-
if ($d !== false) { $newprop['TEXT-ALIGN'] = $d; }
|
693 |
-
if (preg_match('/(center|left|right)/i',$v,$m)) { $newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1],0,1)); }
|
694 |
-
else { $newprop['TEXT-ALIGN'] .= 'R'; } // default = R
|
695 |
-
}
|
696 |
-
else if (preg_match('/["\'](\\\[a-fA-F0-9]{1,6})["\']/i',$v,$m)) {
|
697 |
-
$utf8 = codeHex2utf(substr($m[1],1,6));
|
698 |
-
$d = array_search($utf8,$this->mpdf->decimal_align);
|
699 |
-
if ($d !== false) { $newprop['TEXT-ALIGN'] = $d; }
|
700 |
-
if (preg_match('/(center|left|right)/i',$v,$m)) { $newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1],0,1)); }
|
701 |
-
else { $newprop['TEXT-ALIGN'] .= 'R'; } // default = R
|
702 |
-
}
|
703 |
-
else { $newprop[$k] = $v; }
|
704 |
-
}
|
705 |
-
else if ($k == 'LIST-STYLE') { // mPDF 5.7.2
|
706 |
-
if (preg_match('/(lower-roman|upper-roman|lower-latin|lower-alpha|upper-latin|upper-alpha|none|decimal|disc|circle|square|arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu|cambodian|khmer|lao)/i',$v,$m)
|
707 |
-
|| preg_match('/U\+([a-fA-F0-9]+)/i',$v,$m)) {
|
708 |
-
$newprop['LIST-STYLE-TYPE'] = strtolower(trim($m[1]));
|
709 |
-
}
|
710 |
-
}
|
711 |
-
|
712 |
-
|
713 |
-
else {
|
714 |
-
$newprop[$k] = $v;
|
715 |
-
}
|
716 |
-
}
|
717 |
-
|
718 |
-
return $newprop;
|
719 |
-
}
|
720 |
-
|
721 |
-
function setCSSboxshadow($v) {
|
722 |
-
$sh = array();
|
723 |
-
$c = preg_match_all('/(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl)\(.*?\)/',$v,$x); // mPDF 5.6.05
|
724 |
-
for($i=0; $i<$c; $i++) {
|
725 |
-
$col = preg_replace('/,/','*',$x[0][$i]);
|
726 |
-
$v = preg_replace('/'.preg_quote($x[0][$i],'/').'/',$col,$v);
|
727 |
-
}
|
728 |
-
$ss = explode(',',$v);
|
729 |
-
foreach ($ss AS $s) {
|
730 |
-
$new = array('inset'=>false, 'blur'=>0, 'spread'=>0);
|
731 |
-
if (preg_match('/inset/i',$s)) { $new['inset'] = true; $s = preg_replace('/\s*inset\s*/','',$s); }
|
732 |
-
$p = explode(' ',trim($s));
|
733 |
-
if (isset($p[0])) { $new['x'] = $this->mpdf->ConvertSize(trim($p[0]),$this->mpdf->blk[$this->mpdf->blklvl-1]['inner_width'],$this->mpdf->FontSize,false); }
|
734 |
-
if (isset($p[1])) { $new['y'] = $this->mpdf->ConvertSize(trim($p[1]),$this->mpdf->blk[$this->mpdf->blklvl-1]['inner_width'],$this->mpdf->FontSize,false); }
|
735 |
-
if (isset($p[2])) {
|
736 |
-
if (preg_match('/^\s*[\.\-0-9]/',$p[2])) {
|
737 |
-
$new['blur'] = $this->mpdf->ConvertSize(trim($p[2]),$this->mpdf->blk[$this->mpdf->blklvl-1]['inner_width'],$this->mpdf->FontSize,false);
|
738 |
-
}
|
739 |
-
else { $new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/',',',$p[2])); }
|
740 |
-
if (isset($p[3])) {
|
741 |
-
if (preg_match('/^\s*[\.\-0-9]/',$p[3])) {
|
742 |
-
$new['spread'] = $this->mpdf->ConvertSize(trim($p[3]),$this->mpdf->blk[$this->mpdf->blklvl-1]['inner_width'],$this->mpdf->FontSize,false);
|
743 |
-
}
|
744 |
-
else { $new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/',',',$p[3])); }
|
745 |
-
if (isset($p[4])) {
|
746 |
-
$new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/',',',$p[4]));
|
747 |
-
}
|
748 |
-
}
|
749 |
-
}
|
750 |
-
if (!$new['col']) { $new['col'] = $this->mpdf->ConvertColor('#888888'); }
|
751 |
-
if (isset($new['y'])) { array_unshift($sh, $new); }
|
752 |
-
}
|
753 |
-
return $sh;
|
754 |
-
}
|
755 |
-
|
756 |
-
function setCSStextshadow($v) {
|
757 |
-
$sh = array();
|
758 |
-
$c = preg_match_all('/(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl)\(.*?\)/',$v,$x); // mPDF 5.6.05
|
759 |
-
for($i=0; $i<$c; $i++) {
|
760 |
-
$col = preg_replace('/,/','*',$x[0][$i]);
|
761 |
-
$v = preg_replace('/'.preg_quote($x[0][$i],'/').'/',$col,$v);
|
762 |
-
}
|
763 |
-
$ss = explode(',',$v);
|
764 |
-
foreach ($ss AS $s) {
|
765 |
-
$new = array('blur'=>0);
|
766 |
-
$p = explode(' ',trim($s));
|
767 |
-
if (isset($p[0])) { $new['x'] = $this->mpdf->ConvertSize(trim($p[0]),$this->mpdf->blk[$this->mpdf->blklvl-1]['inner_width'],$this->mpdf->FontSize,false); }
|
768 |
-
if (isset($p[1])) { $new['y'] = $this->mpdf->ConvertSize(trim($p[1]),$this->mpdf->blk[$this->mpdf->blklvl-1]['inner_width'],$this->mpdf->FontSize,false); }
|
769 |
-
if (isset($p[2])) {
|
770 |
-
if (preg_match('/^\s*[\.\-0-9]/',$p[2])) {
|
771 |
-
$new['blur'] = $this->mpdf->ConvertSize(trim($p[2]),$this->mpdf->blk[$this->mpdf->blklvl-1]['inner_width'],$this->mpdf->FontSize,false);
|
772 |
-
}
|
773 |
-
else { $new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/',',',$p[2])); }
|
774 |
-
if (isset($p[3])) {
|
775 |
-
$new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/',',',$p[3]));
|
776 |
-
}
|
777 |
-
}
|
778 |
-
if (!$new['col']) { $new['col'] = $this->mpdf->ConvertColor('#888888'); }
|
779 |
-
if (isset($new['y'])) { array_unshift($sh, $new); }
|
780 |
-
}
|
781 |
-
return $sh;
|
782 |
-
}
|
783 |
-
|
784 |
-
function parseCSSbackground($s) {
|
785 |
-
$bg = array('c'=>false, 'i'=>false, 'r'=>false, 'p'=>false, );
|
786 |
-
/*-- BACKGROUNDS --*/
|
787 |
-
if (preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient\(.*\)/i',$s,$m)) {
|
788 |
-
$bg['i'] = $m[0];
|
789 |
-
}
|
790 |
-
else
|
791 |
-
/*-- END BACKGROUNDS --*/
|
792 |
-
if (preg_match('/url\(/i',$s)) {
|
793 |
-
// If color, set and strip it off
|
794 |
-
// mPDF 5.6.05
|
795 |
-
if (preg_match('/^\s*(#[0-9a-fA-F]{3,6}|(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl|spot)\(.*?\)|[a-zA-Z]{3,})\s+(url\(.*)/i',$s,$m)) {
|
796 |
-
$bg['c'] = strtolower($m[1]);
|
797 |
-
$s = $m[3];
|
798 |
-
}
|
799 |
-
/*-- BACKGROUNDS --*/
|
800 |
-
if (preg_match('/url\([\'\"]{0,1}(.*?)[\'\"]{0,1}\)\s*(.*)/i',$s,$m)) {
|
801 |
-
$bg['i'] = $m[1];
|
802 |
-
$s = strtolower($m[2]);
|
803 |
-
if (preg_match('/(repeat-x|repeat-y|no-repeat|repeat)/',$s,$m)) {
|
804 |
-
$bg['r'] = $m[1];
|
805 |
-
}
|
806 |
-
// Remove repeat, attachment (discarded) and also any inherit
|
807 |
-
$s = preg_replace('/(repeat-x|repeat-y|no-repeat|repeat|scroll|fixed|inherit)/','',$s);
|
808 |
-
$bits = preg_split('/\s+/',trim($s));
|
809 |
-
// These should be Position x1 or x2
|
810 |
-
if (count($bits)==1) {
|
811 |
-
if (preg_match('/bottom/',$bits[0])) { $bg['p'] = '50% 100%'; }
|
812 |
-
else if (preg_match('/top/',$bits[0])) { $bg['p'] = '50% 0%'; }
|
813 |
-
else { $bg['p'] = $bits[0] . ' 50%'; }
|
814 |
-
}
|
815 |
-
else if (count($bits)==2) {
|
816 |
-
// Can be either right center or center right
|
817 |
-
if (preg_match('/(top|bottom)/',$bits[0]) || preg_match('/(left|right)/',$bits[1])) {
|
818 |
-
$bg['p'] = $bits[1] . ' '.$bits[0];
|
819 |
-
}
|
820 |
-
else {
|
821 |
-
$bg['p'] = $bits[0] . ' '.$bits[1];
|
822 |
-
}
|
823 |
-
}
|
824 |
-
if ($bg['p']) {
|
825 |
-
$bg['p'] = preg_replace('/(left|top)/','0%',$bg['p']);
|
826 |
-
$bg['p'] = preg_replace('/(right|bottom)/','100%',$bg['p']);
|
827 |
-
$bg['p'] = preg_replace('/(center)/','50%',$bg['p']);
|
828 |
-
if (!preg_match('/[\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)* [\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)*/',$bg['p'])) {
|
829 |
-
$bg['p'] = false;
|
830 |
-
}
|
831 |
-
}
|
832 |
-
}
|
833 |
-
/*-- END BACKGROUNDS --*/
|
834 |
-
}
|
835 |
-
else if (preg_match('/^\s*(#[0-9a-fA-F]{3,6}|(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl|spot)\(.*?\)|[a-zA-Z]{3,})/i',$s,$m)) { $bg['c'] = strtolower($m[1]); } // mPDF 5.6.05
|
836 |
-
return ($bg);
|
837 |
-
}
|
838 |
-
|
839 |
-
|
840 |
-
function expand24($mp) {
|
841 |
-
$prop = preg_split('/\s+/',trim($mp));
|
842 |
-
if (count($prop) == 1 ) {
|
843 |
-
return array('T' => $prop[0], 'R' => $prop[0], 'B' => $prop[0], 'L'=> $prop[0]);
|
844 |
-
}
|
845 |
-
if (count($prop) == 2 ) {
|
846 |
-
return array('T' => $prop[0], 'R' => $prop[1], 'B' => $prop[0], 'L'=> $prop[1]);
|
847 |
-
}
|
848 |
-
|
849 |
-
if (count($prop) == 3 ) {
|
850 |
-
return array('T' => $prop[0], 'R' => $prop[1], 'B' => $prop[2], 'L'=> $prop[1]);
|
851 |
-
}
|
852 |
-
if (count($prop) == 4 ) {
|
853 |
-
return array('T' => $prop[0], 'R' => $prop[1], 'B' => $prop[2], 'L'=> $prop[3]);
|
854 |
-
}
|
855 |
-
return array();
|
856 |
-
}
|
857 |
-
|
858 |
-
/*-- BORDER-RADIUS --*/
|
859 |
-
function border_radius_expand($val,$k) {
|
860 |
-
$b = array();
|
861 |
-
if ($k == 'BORDER-RADIUS') {
|
862 |
-
$hv = explode('/',trim($val));
|
863 |
-
$prop = preg_split('/\s+/',trim($hv[0]));
|
864 |
-
if (count($prop)==1) {
|
865 |
-
$b['TL-H'] = $b['TR-H'] = $b['BR-H'] = $b['BL-H'] = $prop[0];
|
866 |
-
}
|
867 |
-
else if (count($prop)==2) {
|
868 |
-
$b['TL-H'] = $b['BR-H'] = $prop[0];
|
869 |
-
$b['TR-H'] = $b['BL-H'] = $prop[1];
|
870 |
-
}
|
871 |
-
else if (count($prop)==3) {
|
872 |
-
$b['TL-H'] = $prop[0];
|
873 |
-
$b['TR-H'] = $b['BL-H'] = $prop[1];
|
874 |
-
$b['BR-H'] = $prop[2];
|
875 |
-
}
|
876 |
-
else if (count($prop)==4) {
|
877 |
-
$b['TL-H'] = $prop[0];
|
878 |
-
$b['TR-H'] = $prop[1];
|
879 |
-
$b['BR-H'] = $prop[2];
|
880 |
-
$b['BL-H'] = $prop[3];
|
881 |
-
}
|
882 |
-
if (count($hv)==2) {
|
883 |
-
$prop = preg_split('/\s+/',trim($hv[1]));
|
884 |
-
if (count($prop)==1) {
|
885 |
-
$b['TL-V'] = $b['TR-V'] = $b['BR-V'] = $b['BL-V'] = $prop[0];
|
886 |
-
}
|
887 |
-
else if (count($prop)==2) {
|
888 |
-
$b['TL-V'] = $b['BR-V'] = $prop[0];
|
889 |
-
$b['TR-V'] = $b['BL-V'] = $prop[1];
|
890 |
-
}
|
891 |
-
else if (count($prop)==3) {
|
892 |
-
$b['TL-V'] = $prop[0];
|
893 |
-
$b['TR-V'] = $b['BL-V'] = $prop[1];
|
894 |
-
$b['BR-V'] = $prop[2];
|
895 |
-
}
|
896 |
-
else if (count($prop)==4) {
|
897 |
-
$b['TL-V'] = $prop[0];
|
898 |
-
$b['TR-V'] = $prop[1];
|
899 |
-
$b['BR-V'] = $prop[2];
|
900 |
-
$b['BL-V'] = $prop[3];
|
901 |
-
}
|
902 |
-
}
|
903 |
-
else {
|
904 |
-
$b['TL-V'] = $b['TL-H'];
|
905 |
-
$b['TR-V'] = $b['TR-H'];
|
906 |
-
$b['BL-V'] = $b['BL-H'];
|
907 |
-
$b['BR-V'] = $b['BR-H'];
|
908 |
-
}
|
909 |
-
return $b;
|
910 |
-
}
|
911 |
-
|
912 |
-
// Parse 2
|
913 |
-
$h = 0;
|
914 |
-
$v = 0;
|
915 |
-
$prop = preg_split('/\s+/',trim($val));
|
916 |
-
if (count($prop)==1) { $h = $v = $val; }
|
917 |
-
else { $h = $prop[0]; $v = $prop[1]; }
|
918 |
-
if ($h==0 || $v==0) { $h = $v = 0; }
|
919 |
-
if ($k == 'BORDER-TOP-LEFT-RADIUS') {
|
920 |
-
$b['TL-H'] = $h;
|
921 |
-
$b['TL-V'] = $v;
|
922 |
-
}
|
923 |
-
else if ($k == 'BORDER-TOP-RIGHT-RADIUS') {
|
924 |
-
$b['TR-H'] = $h;
|
925 |
-
$b['TR-V'] = $v;
|
926 |
-
}
|
927 |
-
else if ($k == 'BORDER-BOTTOM-LEFT-RADIUS') {
|
928 |
-
$b['BL-H'] = $h;
|
929 |
-
$b['BL-V'] = $v;
|
930 |
-
}
|
931 |
-
else if ($k == 'BORDER-BOTTOM-RIGHT-RADIUS') {
|
932 |
-
$b['BR-H'] = $h;
|
933 |
-
$b['BR-V'] = $v;
|
934 |
-
}
|
935 |
-
return $b;
|
936 |
-
|
937 |
-
}
|
938 |
-
/*-- END BORDER-RADIUS --*/
|
939 |
-
|
940 |
-
function _mergeCSS($p, &$t) {
|
941 |
-
// Save Cascading CSS e.g. "div.topic p" at this block level
|
942 |
-
if (isset($p) && $p) {
|
943 |
-
if ($t) {
|
944 |
-
$t = $this->array_merge_recursive_unique($t, $p);
|
945 |
-
}
|
946 |
-
else { $t = $p; }
|
947 |
-
}
|
948 |
-
}
|
949 |
-
|
950 |
-
// for CSS handling
|
951 |
-
function array_merge_recursive_unique($array1, $array2) {
|
952 |
-
$arrays = func_get_args();
|
953 |
-
$narrays = count($arrays);
|
954 |
-
$ret = $arrays[0];
|
955 |
-
for ($i = 1; $i < $narrays; $i ++) {
|
956 |
-
foreach ($arrays[$i] as $key => $value) {
|
957 |
-
if (((string) $key) === ((string) intval($key))) { // integer or string as integer key - append
|
958 |
-
$ret[] = $value;
|
959 |
-
}
|
960 |
-
else { // string key - merge
|
961 |
-
if (is_array($value) && isset($ret[$key])) {
|
962 |
-
$ret[$key] = $this->array_merge_recursive_unique($ret[$key], $value);
|
963 |
-
}
|
964 |
-
else {
|
965 |
-
$ret[$key] = $value;
|
966 |
-
}
|
967 |
-
}
|
968 |
-
}
|
969 |
-
}
|
970 |
-
return $ret;
|
971 |
-
}
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
function _mergeFullCSS($p, &$t, $tag, $classes, $id) {
|
976 |
-
$this->_mergeCSS($p[$tag], $t);
|
977 |
-
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
978 |
-
foreach($classes AS $class) {
|
979 |
-
$this->_mergeCSS($p['CLASS>>'.$class], $t);
|
980 |
-
}
|
981 |
-
// STYLESHEET nth-child SELECTOR e.g. tr:nth-child(odd) td:nth-child(2n+1)
|
982 |
-
if ($tag=='TR' && isset($p) && $p) {
|
983 |
-
foreach($p AS $k=>$val) {
|
984 |
-
if (preg_match('/'.$tag.'>>SELECTORNTHCHILD>>(.*)/',$k, $m)) {
|
985 |
-
$select = false;
|
986 |
-
if ($tag=='TR') {
|
987 |
-
$row = $this->mpdf->row;
|
988 |
-
$thnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) : 0);
|
989 |
-
$tfnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) : 0);
|
990 |
-
if ($this->mpdf->tabletfoot) { $row -= $thnr; }
|
991 |
-
else if (!$this->mpdf->tablethead) { $row -= ($thnr + $tfnr); }
|
992 |
-
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/',$m[1],$a)) { // mPDF 5.7.4
|
993 |
-
$select = $this->_nthchild($a, $row);
|
994 |
-
}
|
995 |
-
}
|
996 |
-
else if ($tag=='TD' || $tag=='TH') {
|
997 |
-
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/',$m[1],$a)) { // mPDF 5.7.4
|
998 |
-
$select = $this->_nthchild($a, $this->mpdf->col);
|
999 |
-
}
|
1000 |
-
}
|
1001 |
-
if ($select) {
|
1002 |
-
$this->_mergeCSS($p[$tag.'>>SELECTORNTHCHILD>>'.$m[1]], $t);
|
1003 |
-
}
|
1004 |
-
}
|
1005 |
-
}
|
1006 |
-
}
|
1007 |
-
// STYLESHEET CLASS e.g. #smallone{} #redletter{}
|
1008 |
-
if (isset($id) && $id) {
|
1009 |
-
$this->_mergeCSS($p['ID>>'.$id], $t);
|
1010 |
-
}
|
1011 |
-
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1012 |
-
foreach($classes AS $class) {
|
1013 |
-
$this->_mergeCSS($p[$tag.'>>CLASS>>'.$class], $t);
|
1014 |
-
}
|
1015 |
-
// STYLESHEET CLASS e.g. #smallone{} #redletter{}
|
1016 |
-
if (isset($id)) {
|
1017 |
-
$this->_mergeCSS($p[$tag.'>>ID>>'.$id], $t);
|
1018 |
-
}
|
1019 |
-
}
|
1020 |
-
|
1021 |
-
function setBorderDominance($prop, $val) {
|
1022 |
-
if (isset($prop['BORDER-LEFT']) && $prop['BORDER-LEFT']) { $this->cell_border_dominance_L = $val; }
|
1023 |
-
if (isset($prop['BORDER-RIGHT']) && $prop['BORDER-RIGHT']) { $this->cell_border_dominance_R = $val; }
|
1024 |
-
if (isset($prop['BORDER-TOP']) && $prop['BORDER-TOP']) { $this->cell_border_dominance_T = $val; }
|
1025 |
-
if (isset($prop['BORDER-BOTTOM']) && $prop['BORDER-BOTTOM']) { $this->cell_border_dominance_B = $val; }
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
function _set_mergedCSS(&$m, &$p, $d=true, $bd=false) {
|
1029 |
-
if (isset($m)) {
|
1030 |
-
if ((isset($m['depth']) && $m['depth']>1) || $d==false) { // include check for 'depth'
|
1031 |
-
if ($bd) { $this->setBorderDominance($m, $bd); } // *TABLES*
|
1032 |
-
if (is_array($m)) {
|
1033 |
-
$p = array_merge($p,$m);
|
1034 |
-
$this->_mergeBorders($p,$m);
|
1035 |
-
}
|
1036 |
-
}
|
1037 |
-
}
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
|
1041 |
-
function _mergeBorders(&$b, &$a) { // Merges $a['BORDER-TOP-STYLE'] to $b['BORDER-TOP'] etc.
|
1042 |
-
foreach(array('TOP','RIGHT','BOTTOM','LEFT') AS $side) {
|
1043 |
-
foreach(array('STYLE','WIDTH','COLOR') AS $el) {
|
1044 |
-
if (isset($a['BORDER-'.$side.'-'.$el])) { // e.g. $b['BORDER-TOP-STYLE']
|
1045 |
-
$s = trim($a['BORDER-'.$side.'-'.$el]);
|
1046 |
-
if (isset($b['BORDER-'.$side])) { // e.g. $b['BORDER-TOP']
|
1047 |
-
$p = trim($b['BORDER-'.$side]);
|
1048 |
-
}
|
1049 |
-
else { $p = ''; }
|
1050 |
-
if ($el=='STYLE') {
|
1051 |
-
if ($p) { $b['BORDER-'.$side] = preg_replace('/(\S+)\s+(\S+)\s+(\S+)/', '\\1 '.$s.' \\3', $p); }
|
1052 |
-
else { $b['BORDER-'.$side] = '0px '.$s.' #000000'; }
|
1053 |
-
}
|
1054 |
-
else if ($el=='WIDTH') {
|
1055 |
-
if ($p) { $b['BORDER-'.$side] = preg_replace('/(\S+)\s+(\S+)\s+(\S+)/', $s.' \\2 \\3', $p); }
|
1056 |
-
else { $b['BORDER-'.$side] = $s.' none #000000'; }
|
1057 |
-
}
|
1058 |
-
else if ($el=='COLOR') {
|
1059 |
-
if ($p) { $b['BORDER-'.$side] = preg_replace('/(\S+)\s+(\S+)\s+(\S+)/', '\\1 \\2 '.$s, $p); }
|
1060 |
-
else { $b['BORDER-'.$side] = '0px none '.$s; }
|
1061 |
-
}
|
1062 |
-
}
|
1063 |
-
}
|
1064 |
-
}
|
1065 |
-
}
|
1066 |
-
|
1067 |
-
|
1068 |
-
function MergeCSS($inherit,$tag,$attr) {
|
1069 |
-
$p = array();
|
1070 |
-
$zp = array();
|
1071 |
-
|
1072 |
-
$classes = array();
|
1073 |
-
if (isset($attr['CLASS'])) {
|
1074 |
-
$classes = preg_split('/\s+/',$attr['CLASS']);
|
1075 |
-
}
|
1076 |
-
if (!isset($attr['ID'])) { $attr['ID']=''; }
|
1077 |
-
//===============================================
|
1078 |
-
/*-- TABLES --*/
|
1079 |
-
// Set Inherited properties
|
1080 |
-
if ($inherit == 'TOPTABLE') { // $tag = TABLE
|
1081 |
-
//===============================================
|
1082 |
-
// Save Cascading CSS e.g. "div.topic p" at this block level
|
1083 |
-
|
1084 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'])) {
|
1085 |
-
$this->tablecascadeCSS[0] = $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'];
|
1086 |
-
}
|
1087 |
-
else {
|
1088 |
-
$this->tablecascadeCSS[0] = $this->cascadeCSS;
|
1089 |
-
}
|
1090 |
-
}
|
1091 |
-
//===============================================
|
1092 |
-
// Set Inherited properties
|
1093 |
-
if ($inherit == 'TOPTABLE' || $inherit == 'TABLE') {
|
1094 |
-
//Cascade everything from last level that is not an actual property, or defined by current tag/attributes
|
1095 |
-
if (isset($this->tablecascadeCSS[$this->tbCSSlvl-1]) && is_array($this->tablecascadeCSS[$this->tbCSSlvl-1])) {
|
1096 |
-
foreach($this->tablecascadeCSS[$this->tbCSSlvl-1] AS $k=>$v) {
|
1097 |
-
$this->tablecascadeCSS[$this->tbCSSlvl][$k] = $v;
|
1098 |
-
}
|
1099 |
-
}
|
1100 |
-
$this->_mergeFullCSS($this->cascadeCSS, $this->tablecascadeCSS[$this->tbCSSlvl], $tag, $classes, $attr['ID']);
|
1101 |
-
//===============================================
|
1102 |
-
// Cascading forward CSS e.g. "table.topic td" for this table in $this->tablecascadeCSS
|
1103 |
-
//===============================================
|
1104 |
-
// STYLESHEET TAG e.g. table
|
1105 |
-
$this->_mergeFullCSS($this->tablecascadeCSS[$this->tbCSSlvl-1], $this->tablecascadeCSS[$this->tbCSSlvl], $tag, $classes, $attr['ID']);
|
1106 |
-
//===============================================
|
1107 |
-
}
|
1108 |
-
/*-- END TABLES --*/
|
1109 |
-
//===============================================
|
1110 |
-
/*-- LISTS --*/
|
1111 |
-
// Set Inherited properties
|
1112 |
-
if ($inherit == 'TOPLIST') { // $tag = UL,OL
|
1113 |
-
//===============================================
|
1114 |
-
// Save Cascading CSS e.g. "div.topic p" at this block level
|
1115 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'])) {
|
1116 |
-
$this->listcascadeCSS[0] = $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'];
|
1117 |
-
}
|
1118 |
-
else {
|
1119 |
-
$this->listcascadeCSS[0] = $this->cascadeCSS;
|
1120 |
-
}
|
1121 |
-
}
|
1122 |
-
//===============================================
|
1123 |
-
// Set Inherited properties
|
1124 |
-
if ($inherit == 'TOPLIST' || $inherit == 'LIST') {
|
1125 |
-
//Cascade everything from last level that is not an actual property, or defined by current tag/attributes
|
1126 |
-
if (isset($this->listcascadeCSS[$this->listCSSlvl-1]) && is_array($this->listcascadeCSS[$this->listCSSlvl-1])) {
|
1127 |
-
foreach($this->listcascadeCSS[$this->listCSSlvl-1] AS $k=>$v) {
|
1128 |
-
$this->listcascadeCSS[$this->listCSSlvl][$k] = $v;
|
1129 |
-
}
|
1130 |
-
}
|
1131 |
-
$this->_mergeFullCSS($this->cascadeCSS, $this->listcascadeCSS[$this->listCSSlvl], $tag, $classes, $attr['ID']);
|
1132 |
-
//===============================================
|
1133 |
-
// Cascading forward CSS e.g. "table.topic td" for this list in $this->listcascadeCSS
|
1134 |
-
//===============================================
|
1135 |
-
// STYLESHEET TAG e.g. table
|
1136 |
-
$this->_mergeFullCSS($this->listcascadeCSS[$this->listCSSlvl-1], $this->listcascadeCSS[$this->listCSSlvl], $tag, $classes, $attr['ID']);
|
1137 |
-
//===============================================
|
1138 |
-
}
|
1139 |
-
/*-- END LISTS --*/
|
1140 |
-
//===============================================
|
1141 |
-
// Set Inherited properties
|
1142 |
-
if ($inherit == 'BLOCK') {
|
1143 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS']) && is_array($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS'])) {
|
1144 |
-
foreach($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS'] AS $k=>$v) {
|
1145 |
-
$this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$k] = $v;
|
1146 |
-
|
1147 |
-
}
|
1148 |
-
}
|
1149 |
-
|
1150 |
-
//===============================================
|
1151 |
-
// Save Cascading CSS e.g. "div.topic p" at this block level
|
1152 |
-
$this->_mergeFullCSS($this->cascadeCSS, $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'], $tag, $classes, $attr['ID']);
|
1153 |
-
//===============================================
|
1154 |
-
// Cascading forward CSS
|
1155 |
-
//===============================================
|
1156 |
-
$this->_mergeFullCSS($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS'], $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'], $tag, $classes, $attr['ID']);
|
1157 |
-
//===============================================
|
1158 |
-
// Block properties
|
1159 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['margin_collapse']) && $this->mpdf->blk[$this->mpdf->blklvl-1]['margin_collapse']) { $p['MARGIN-COLLAPSE'] = 'COLLAPSE'; } // custom tag, but follows CSS principle that border-collapse is inherited
|
1160 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['line_height']) && $this->mpdf->blk[$this->mpdf->blklvl-1]['line_height']) { $p['LINE-HEIGHT'] = $this->mpdf->blk[$this->mpdf->blklvl-1]['line_height']; }
|
1161 |
-
|
1162 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['direction']) && $this->mpdf->blk[$this->mpdf->blklvl-1]['direction']) { $p['DIRECTION'] = $this->mpdf->blk[$this->mpdf->blklvl-1]['direction']; }
|
1163 |
-
|
1164 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['align']) && $this->mpdf->blk[$this->mpdf->blklvl-1]['align']) {
|
1165 |
-
if ($this->mpdf->blk[$this->mpdf->blklvl-1]['align'] == 'L') { $p['TEXT-ALIGN'] = 'left'; }
|
1166 |
-
else if ($this->mpdf->blk[$this->mpdf->blklvl-1]['align'] == 'J') { $p['TEXT-ALIGN'] = 'justify'; }
|
1167 |
-
else if ($this->mpdf->blk[$this->mpdf->blklvl-1]['align'] == 'R') { $p['TEXT-ALIGN'] = 'right'; }
|
1168 |
-
else if ($this->mpdf->blk[$this->mpdf->blklvl-1]['align'] == 'C') { $p['TEXT-ALIGN'] = 'center'; }
|
1169 |
-
}
|
1170 |
-
if ($this->mpdf->ColActive || $this->mpdf->keep_block_together) {
|
1171 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['bgcolor']) && $this->mpdf->blk[$this->mpdf->blklvl-1]['bgcolor']) { // Doesn't officially inherit, but default value is transparent (?=inherited)
|
1172 |
-
$cor = $this->mpdf->blk[$this->mpdf->blklvl-1]['bgcolorarray' ];
|
1173 |
-
$p['BACKGROUND-COLOR'] = $this->mpdf->_colAtoString($cor);
|
1174 |
-
}
|
1175 |
-
}
|
1176 |
-
|
1177 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['text_indent']) && ($this->mpdf->blk[$this->mpdf->blklvl-1]['text_indent'] || $this->mpdf->blk[$this->mpdf->blklvl-1]['text_indent']===0)) { $p['TEXT-INDENT'] = $this->mpdf->blk[$this->mpdf->blklvl-1]['text_indent']; }
|
1178 |
-
if (isset($this->mpdf->blk[$this->mpdf->blklvl-1]['InlineProperties'])) {
|
1179 |
-
$biilp = $this->mpdf->blk[$this->mpdf->blklvl-1]['InlineProperties'];
|
1180 |
-
}
|
1181 |
-
else { $biilp = null; }
|
1182 |
-
if (isset($biilp[ 'family' ]) && $biilp[ 'family' ]) { $p['FONT-FAMILY'] = $biilp[ 'family' ]; }
|
1183 |
-
if (isset($biilp[ 'I' ]) && $biilp[ 'I' ]) { $p['FONT-STYLE'] = 'italic'; }
|
1184 |
-
if (isset($biilp[ 'sizePt' ]) && $biilp[ 'sizePt' ]) { $p['FONT-SIZE'] = $biilp[ 'sizePt' ] . 'pt'; }
|
1185 |
-
if (isset($biilp[ 'B' ]) && $biilp[ 'B' ]) { $p['FONT-WEIGHT'] = 'bold'; }
|
1186 |
-
if (isset($biilp[ 'colorarray' ]) && $biilp[ 'colorarray' ]) {
|
1187 |
-
$cor = $biilp[ 'colorarray' ];
|
1188 |
-
$p['COLOR'] = $this->mpdf->_colAtoString($cor);
|
1189 |
-
}
|
1190 |
-
if (isset($biilp[ 'fontkerning' ])) {
|
1191 |
-
if ($biilp[ 'fontkerning' ]) { $p['FONT-KERNING'] = 'normal'; }
|
1192 |
-
else { $p['FONT-KERNING'] = 'none'; }
|
1193 |
-
}
|
1194 |
-
if (isset($biilp[ 'lSpacingCSS' ]) && $biilp[ 'lSpacingCSS' ]) { $p['LETTER-SPACING'] = $biilp[ 'lSpacingCSS' ]; }
|
1195 |
-
if (isset($biilp[ 'wSpacingCSS' ]) && $biilp[ 'wSpacingCSS' ]) { $p['WORD-SPACING'] = $biilp[ 'wSpacingCSS' ]; }
|
1196 |
-
if (isset($biilp[ 'toupper' ]) && $biilp[ 'toupper' ]) { $p['TEXT-TRANSFORM'] = 'uppercase'; }
|
1197 |
-
else if (isset($biilp[ 'tolower' ]) && $biilp[ 'tolower' ]) { $p['TEXT-TRANSFORM'] = 'lowercase'; }
|
1198 |
-
else if (isset($biilp[ 'capitalize' ]) && $biilp[ 'capitalize' ]) { $p['TEXT-TRANSFORM'] = 'capitalize'; }
|
1199 |
-
// CSS says text-decoration is not inherited, but IE7 does??
|
1200 |
-
if (isset($biilp[ 'underline' ]) && $biilp[ 'underline' ]) { $p['TEXT-DECORATION'] = 'underline'; }
|
1201 |
-
if (isset($biilp[ 'smCaps' ]) && $biilp[ 'smCaps' ]) { $p['FONT-VARIANT'] = 'small-caps'; }
|
1202 |
-
|
1203 |
-
}
|
1204 |
-
//===============================================
|
1205 |
-
//===============================================
|
1206 |
-
/*-- LISTS --*/
|
1207 |
-
// Set Inherited properties
|
1208 |
-
if ($inherit == 'TOPLIST') {
|
1209 |
-
if ($this->listCSSlvl == 1) {
|
1210 |
-
$bilp = $this->mpdf->blk[$this->mpdf->blklvl]['InlineProperties'];
|
1211 |
-
if (isset($bilp[ 'family' ]) && $bilp[ 'family' ]) { $p['FONT-FAMILY'] = $bilp[ 'family' ]; }
|
1212 |
-
if (isset($bilp[ 'I' ]) && $bilp[ 'I' ]) { $p['FONT-STYLE'] = 'italic'; }
|
1213 |
-
if (isset($bilp[ 'sizePt' ]) && $bilp[ 'sizePt' ]) { $p['FONT-SIZE'] = $bilp[ 'sizePt' ] . 'pt'; }
|
1214 |
-
if (isset($bilp[ 'B' ]) && $bilp[ 'B' ]) { $p['FONT-WEIGHT'] = 'bold'; }
|
1215 |
-
if (isset($bilp[ 'colorarray' ]) && $bilp[ 'colorarray' ]) {
|
1216 |
-
$cor = $bilp[ 'colorarray' ];
|
1217 |
-
$p['COLOR'] = $this->mpdf->_colAtoString($cor);
|
1218 |
-
}
|
1219 |
-
if (isset($bilp[ 'toupper' ]) && $bilp[ 'toupper' ]) { $p['TEXT-TRANSFORM'] = 'uppercase'; }
|
1220 |
-
else if (isset($bilp[ 'tolower' ]) && $bilp[ 'tolower' ]) { $p['TEXT-TRANSFORM'] = 'lowercase'; }
|
1221 |
-
else if (isset($bilp[ 'capitalize' ]) && $bilp[ 'capitalize' ]) { $p['TEXT-TRANSFORM'] = 'capitalize'; }
|
1222 |
-
if (isset($bilp[ 'fontkerning' ])) {
|
1223 |
-
if ($bilp[ 'fontkerning' ]) { $p['FONT-KERNING'] = 'normal'; }
|
1224 |
-
else { $p['FONT-KERNING'] = 'none'; }
|
1225 |
-
}
|
1226 |
-
if (isset($bilp[ 'lSpacingCSS' ]) && $bilp[ 'lSpacingCSS' ]) { $p['LETTER-SPACING'] = $bilp[ 'lSpacingCSS' ]; }
|
1227 |
-
if (isset($bilp[ 'wSpacingCSS' ]) && $bilp[ 'wSpacingCSS' ]) { $p['WORD-SPACING'] = $bilp[ 'wSpacingCSS' ]; }
|
1228 |
-
// CSS says text-decoration is not inherited, but IE7 does??
|
1229 |
-
if (isset($bilp[ 'underline' ]) && $bilp[ 'underline' ]) { $p['TEXT-DECORATION'] = 'underline'; }
|
1230 |
-
if (isset($bilp[ 'smCaps' ]) && $bilp[ 'smCaps' ]) { $p['FONT-VARIANT'] = 'small-caps'; }
|
1231 |
-
if ($tag=='LI') {
|
1232 |
-
// Note to self - this should never work, as TOPLIST is not called when LI (see code removed in v5.3)
|
1233 |
-
$this->mpdf->Error("If you see this message, please report this as a bug to the mPDF Forum.");
|
1234 |
-
}
|
1235 |
-
}
|
1236 |
-
}
|
1237 |
-
/*-- END LISTS --*/
|
1238 |
-
//===============================================
|
1239 |
-
//===============================================
|
1240 |
-
// DEFAULT for this TAG set in DefaultCSS
|
1241 |
-
if (isset($this->mpdf->defaultCSS[$tag])) {
|
1242 |
-
$zp = $this->fixCSS($this->mpdf->defaultCSS[$tag]);
|
1243 |
-
if (is_array($zp)) { // Default overwrites Inherited
|
1244 |
-
$p = array_merge($p,$zp); // !! Note other way round !!
|
1245 |
-
$this->_mergeBorders($p,$zp);
|
1246 |
-
}
|
1247 |
-
}
|
1248 |
-
//===============================================
|
1249 |
-
/*-- TABLES --*/
|
1250 |
-
// mPDF 5.7.3
|
1251 |
-
// cellSpacing overwrites TABLE default but not specific CSS set on table
|
1252 |
-
if ($tag=='TABLE' && isset($attr['CELLSPACING'])) {
|
1253 |
-
$p['BORDER-SPACING-H'] = $p['BORDER-SPACING-V'] = $attr['CELLSPACING'];
|
1254 |
-
}
|
1255 |
-
// cellPadding overwrites TD/TH default but not specific CSS set on cell
|
1256 |
-
if (($tag=='TD' || $tag=='TH') && isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding']) && ($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'] || $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding']==='0')) { // mPDF 5.7.3
|
1257 |
-
$p['PADDING-LEFT'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1258 |
-
$p['PADDING-RIGHT'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1259 |
-
$p['PADDING-TOP'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1260 |
-
$p['PADDING-BOTTOM'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1261 |
-
}
|
1262 |
-
/*-- END TABLES --*/
|
1263 |
-
//===============================================
|
1264 |
-
// STYLESHEET TAG e.g. h1 p div table
|
1265 |
-
if (isset($this->CSS[$tag]) && $this->CSS[$tag]) {
|
1266 |
-
$zp = $this->CSS[$tag];
|
1267 |
-
if ($tag=='TD' || $tag=='TH') { $this->setBorderDominance($zp, 9); } // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1268 |
-
if (is_array($zp)) {
|
1269 |
-
$p = array_merge($p,$zp);
|
1270 |
-
$this->_mergeBorders($p,$zp);
|
1271 |
-
}
|
1272 |
-
}
|
1273 |
-
//===============================================
|
1274 |
-
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1275 |
-
foreach($classes AS $class) {
|
1276 |
-
$zp = array();
|
1277 |
-
if (isset($this->CSS['CLASS>>'.$class]) && $this->CSS['CLASS>>'.$class]) { $zp = $this->CSS['CLASS>>'.$class]; }
|
1278 |
-
if ($tag=='TD' || $tag=='TH') { $this->setBorderDominance($zp, 9); } // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1279 |
-
if (is_array($zp)) {
|
1280 |
-
$p = array_merge($p,$zp);
|
1281 |
-
$this->_mergeBorders($p,$zp);
|
1282 |
-
}
|
1283 |
-
}
|
1284 |
-
//===============================================
|
1285 |
-
/*-- TABLES --*/
|
1286 |
-
// STYLESHEET nth-child SELECTOR e.g. tr:nth-child(odd) td:nth-child(2n+1)
|
1287 |
-
if ($tag=='TR' || $tag=='TD' || $tag=='TH') {
|
1288 |
-
foreach($this->CSS AS $k=>$val) {
|
1289 |
-
if (preg_match('/'.$tag.'>>SELECTORNTHCHILD>>(.*)/',$k, $m)) {
|
1290 |
-
$select = false;
|
1291 |
-
if ($tag=='TR') {
|
1292 |
-
$row = $this->mpdf->row;
|
1293 |
-
$thnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) : 0);
|
1294 |
-
$tfnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) : 0);
|
1295 |
-
if ($this->mpdf->tabletfoot) { $row -= $thnr; }
|
1296 |
-
else if (!$this->mpdf->tablethead) { $row -= ($thnr + $tfnr); }
|
1297 |
-
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/',$m[1],$a)) { // mPDF 5.7.4
|
1298 |
-
$select = $this->_nthchild($a, $row);
|
1299 |
-
}
|
1300 |
-
}
|
1301 |
-
else if ($tag=='TD' || $tag=='TH') {
|
1302 |
-
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/',$m[1],$a)) { // mPDF 5.7.4
|
1303 |
-
$select = $this->_nthchild($a, $this->mpdf->col);
|
1304 |
-
}
|
1305 |
-
}
|
1306 |
-
if ($select) {
|
1307 |
-
$zp = $this->CSS[$tag.'>>SELECTORNTHCHILD>>'.$m[1]];
|
1308 |
-
if ($tag=='TD' || $tag=='TH') { $this->setBorderDominance($zp, 9); }
|
1309 |
-
if (is_array($zp)) {
|
1310 |
-
$p = array_merge($p,$zp);
|
1311 |
-
$this->_mergeBorders($p,$zp);
|
1312 |
-
}
|
1313 |
-
}
|
1314 |
-
}
|
1315 |
-
}
|
1316 |
-
}
|
1317 |
-
/*-- END TABLES --*/
|
1318 |
-
//===============================================
|
1319 |
-
// STYLESHEET ID e.g. #smallone{} #redletter{}
|
1320 |
-
if (isset($attr['ID']) && isset($this->CSS['ID>>'.$attr['ID']]) && $this->CSS['ID>>'.$attr['ID']]) {
|
1321 |
-
$zp = $this->CSS['ID>>'.$attr['ID']];
|
1322 |
-
if ($tag=='TD' || $tag=='TH') { $this->setBorderDominance($zp, 9); } // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1323 |
-
if (is_array($zp)) {
|
1324 |
-
$p = array_merge($p,$zp);
|
1325 |
-
$this->_mergeBorders($p,$zp);
|
1326 |
-
}
|
1327 |
-
}
|
1328 |
-
//===============================================
|
1329 |
-
// STYLESHEET CLASS e.g. p.smallone{} div.redletter{}
|
1330 |
-
foreach($classes AS $class) {
|
1331 |
-
$zp = array();
|
1332 |
-
if (isset($this->CSS[$tag.'>>CLASS>>'.$class]) && $this->CSS[$tag.'>>CLASS>>'.$class]) { $zp = $this->CSS[$tag.'>>CLASS>>'.$class]; }
|
1333 |
-
if ($tag=='TD' || $tag=='TH') { $this->setBorderDominance($zp, 9); } // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1334 |
-
if (is_array($zp)) {
|
1335 |
-
$p = array_merge($p,$zp);
|
1336 |
-
$this->_mergeBorders($p,$zp);
|
1337 |
-
}
|
1338 |
-
}
|
1339 |
-
//===============================================
|
1340 |
-
// STYLESHEET CLASS e.g. p#smallone{} div#redletter{}
|
1341 |
-
if (isset($attr['ID']) && isset($this->CSS[$tag.'>>ID>>'.$attr['ID']]) && $this->CSS[$tag.'>>ID>>'.$attr['ID']]) {
|
1342 |
-
$zp = $this->CSS[$tag.'>>ID>>'.$attr['ID']];
|
1343 |
-
if ($tag=='TD' || $tag=='TH') { $this->setBorderDominance($zp, 9); } // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1344 |
-
if (is_array($zp)) {
|
1345 |
-
$p = array_merge($p,$zp);
|
1346 |
-
$this->_mergeBorders($p,$zp);
|
1347 |
-
}
|
1348 |
-
}
|
1349 |
-
//===============================================
|
1350 |
-
// Cascaded e.g. div.class p only works for block level
|
1351 |
-
if ($inherit == 'BLOCK') {
|
1352 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS'][$tag], $p);
|
1353 |
-
foreach($classes AS $class) {
|
1354 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS']['CLASS>>'.$class], $p);
|
1355 |
-
}
|
1356 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS']['ID>>'.$attr['ID']], $p);
|
1357 |
-
foreach($classes AS $class) {
|
1358 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS'][$tag.'>>CLASS>>'.$class], $p);
|
1359 |
-
}
|
1360 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl-1]['cascadeCSS'][$tag.'>>ID>>'.$attr['ID']], $p);
|
1361 |
-
}
|
1362 |
-
else if ($inherit == 'INLINE') {
|
1363 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$tag], $p);
|
1364 |
-
foreach($classes AS $class) {
|
1365 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS']['CLASS>>'.$class], $p);
|
1366 |
-
}
|
1367 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS']['ID>>'.$attr['ID']], $p);
|
1368 |
-
foreach($classes AS $class) {
|
1369 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$tag.'>>CLASS>>'.$class], $p);
|
1370 |
-
}
|
1371 |
-
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$tag.'>>ID>>'.$attr['ID']], $p);
|
1372 |
-
}
|
1373 |
-
/*-- TABLES --*/
|
1374 |
-
else if ($inherit == 'TOPTABLE' || $inherit == 'TABLE') { // NB looks at $this->tablecascadeCSS-1 for cascading CSS
|
1375 |
-
// false, 9 = don't check for 'depth' and do set border dominance
|
1376 |
-
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl-1][$tag], $p, false, 9);
|
1377 |
-
foreach($classes AS $class) {
|
1378 |
-
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl-1]['CLASS>>'.$class], $p, false, 9);
|
1379 |
-
}
|
1380 |
-
// STYLESHEET nth-child SELECTOR e.g. tr:nth-child(odd) td:nth-child(2n+1)
|
1381 |
-
if ($tag=='TR' || $tag=='TD' || $tag=='TH') {
|
1382 |
-
foreach($this->tablecascadeCSS[$this->tbCSSlvl-1] AS $k=>$val) {
|
1383 |
-
if (preg_match('/'.$tag.'>>SELECTORNTHCHILD>>(.*)/',$k, $m)) {
|
1384 |
-
$select = false;
|
1385 |
-
if ($tag=='TR') {
|
1386 |
-
$row = $this->mpdf->row;
|
1387 |
-
$thnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) : 0);
|
1388 |
-
$tfnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) : 0);
|
1389 |
-
if ($this->mpdf->tabletfoot) { $row -= $thnr; }
|
1390 |
-
else if (!$this->mpdf->tablethead) { $row -= ($thnr + $tfnr); }
|
1391 |
-
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/',$m[1],$a)) { // mPDF 5.7.4
|
1392 |
-
$select = $this->_nthchild($a, $row);
|
1393 |
-
}
|
1394 |
-
}
|
1395 |
-
else if ($tag=='TD' || $tag=='TH') {
|
1396 |
-
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/',$m[1],$a)) { // mPDF 5.7.4
|
1397 |
-
$select = $this->_nthchild($a, $this->mpdf->col);
|
1398 |
-
}
|
1399 |
-
}
|
1400 |
-
if ($select) {
|
1401 |
-
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl-1][$tag.'>>SELECTORNTHCHILD>>'.$m[1]], $p, false, 9);
|
1402 |
-
}
|
1403 |
-
}
|
1404 |
-
}
|
1405 |
-
}
|
1406 |
-
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl-1]['ID>>'.$attr['ID']], $p, false, 9);
|
1407 |
-
foreach($classes AS $class) {
|
1408 |
-
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl-1][$tag.'>>CLASS>>'.$class], $p, false, 9);
|
1409 |
-
}
|
1410 |
-
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl-1][$tag.'>>ID>>'.$attr['ID']], $p, false, 9);
|
1411 |
-
}
|
1412 |
-
/*-- END TABLES --*/
|
1413 |
-
//===============================================
|
1414 |
-
/*-- LISTS --*/
|
1415 |
-
else if ($inherit == 'TOPLIST' || $inherit == 'LIST') { // NB looks at $this->listcascadeCSS-1 for cascading CSS
|
1416 |
-
// false = don't check for 'depth'
|
1417 |
-
$this->_set_mergedCSS($this->listcascadeCSS[$this->listCSSlvl-1][$tag], $p, false);
|
1418 |
-
foreach($classes AS $class) {
|
1419 |
-
$this->_set_mergedCSS($this->listcascadeCSS[$this->listCSSlvl-1]['CLASS>>'.$class], $p, false);
|
1420 |
-
}
|
1421 |
-
$this->_set_mergedCSS($this->listcascadeCSS[$this->listCSSlvl-1]['ID>>'.$attr['ID']], $p, false);
|
1422 |
-
foreach($classes AS $class) {
|
1423 |
-
$this->_set_mergedCSS($this->listcascadeCSS[$this->listCSSlvl-1][$tag.'>>CLASS>>'.$class], $p, false);
|
1424 |
-
}
|
1425 |
-
$this->_set_mergedCSS($this->listcascadeCSS[$this->listCSSlvl-1][$tag.'>>ID>>'.$attr['ID']], $p, false);
|
1426 |
-
}
|
1427 |
-
/*-- END LISTS --*/
|
1428 |
-
//===============================================
|
1429 |
-
//===============================================
|
1430 |
-
// INLINE STYLE e.g. style="CSS:property"
|
1431 |
-
if (isset($attr['STYLE'])) {
|
1432 |
-
$zp = $this->readInlineCSS($attr['STYLE']);
|
1433 |
-
if ($tag=='TD' || $tag=='TH') { $this->setBorderDominance($zp, 9); } // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1434 |
-
if (is_array($zp)) {
|
1435 |
-
$p = array_merge($p,$zp);
|
1436 |
-
$this->_mergeBorders($p,$zp);
|
1437 |
-
}
|
1438 |
-
}
|
1439 |
-
//===============================================
|
1440 |
-
//===============================================
|
1441 |
-
// INLINE ATTRIBUTES e.g. .. ALIGN="CENTER">
|
1442 |
-
if (isset($attr['LANG']) and $attr['LANG']!='') {
|
1443 |
-
$p['LANG'] = $attr['LANG'];
|
1444 |
-
}
|
1445 |
-
if (isset($attr['COLOR']) and $attr['COLOR']!='') {
|
1446 |
-
$p['COLOR'] = $attr['COLOR'];
|
1447 |
-
}
|
1448 |
-
if ($tag != 'INPUT') {
|
1449 |
-
if (isset($attr['WIDTH']) and $attr['WIDTH']!='') {
|
1450 |
-
$p['WIDTH'] = $attr['WIDTH'];
|
1451 |
-
}
|
1452 |
-
if (isset($attr['HEIGHT']) and $attr['HEIGHT']!='') {
|
1453 |
-
$p['HEIGHT'] = $attr['HEIGHT'];
|
1454 |
-
}
|
1455 |
-
}
|
1456 |
-
if ($tag == 'FONT') {
|
1457 |
-
if (isset($attr['FACE'])) {
|
1458 |
-
$p['FONT-FAMILY'] = $attr['FACE'];
|
1459 |
-
}
|
1460 |
-
if (isset($attr['SIZE']) and $attr['SIZE']!='') {
|
1461 |
-
$s = '';
|
1462 |
-
if ($attr['SIZE'] === '+1') { $s = '120%'; }
|
1463 |
-
else if ($attr['SIZE'] === '-1') { $s = '86%'; }
|
1464 |
-
else if ($attr['SIZE'] === '1') { $s = 'XX-SMALL'; }
|
1465 |
-
else if ($attr['SIZE'] == '2') { $s = 'X-SMALL'; }
|
1466 |
-
else if ($attr['SIZE'] == '3') { $s = 'SMALL'; }
|
1467 |
-
else if ($attr['SIZE'] == '4') { $s = 'MEDIUM'; }
|
1468 |
-
else if ($attr['SIZE'] == '5') { $s = 'LARGE'; }
|
1469 |
-
else if ($attr['SIZE'] == '6') { $s = 'X-LARGE'; }
|
1470 |
-
else if ($attr['SIZE'] == '7') { $s = 'XX-LARGE'; }
|
1471 |
-
if ($s) $p['FONT-SIZE'] = $s;
|
1472 |
-
}
|
1473 |
-
}
|
1474 |
-
if (isset($attr['VALIGN']) and $attr['VALIGN']!='') {
|
1475 |
-
$p['VERTICAL-ALIGN'] = $attr['VALIGN'];
|
1476 |
-
}
|
1477 |
-
if (isset($attr['VSPACE']) and $attr['VSPACE']!='') {
|
1478 |
-
$p['MARGIN-TOP'] = $attr['VSPACE'];
|
1479 |
-
$p['MARGIN-BOTTOM'] = $attr['VSPACE'];
|
1480 |
-
}
|
1481 |
-
if (isset($attr['HSPACE']) and $attr['HSPACE']!='') {
|
1482 |
-
$p['MARGIN-LEFT'] = $attr['HSPACE'];
|
1483 |
-
$p['MARGIN-RIGHT'] = $attr['HSPACE'];
|
1484 |
-
}
|
1485 |
-
//===============================================
|
1486 |
-
return $p;
|
1487 |
-
}
|
1488 |
-
|
1489 |
-
function PreviewBlockCSS($tag,$attr) {
|
1490 |
-
// Looks ahead from current block level to a new level
|
1491 |
-
$p = array();
|
1492 |
-
$zp = array();
|
1493 |
-
$oldcascadeCSS = $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'];
|
1494 |
-
$classes = array();
|
1495 |
-
if (isset($attr['CLASS'])) { $classes = preg_split('/\s+/',$attr['CLASS']); }
|
1496 |
-
//===============================================
|
1497 |
-
// DEFAULT for this TAG set in DefaultCSS
|
1498 |
-
if (isset($this->mpdf->defaultCSS[$tag])) {
|
1499 |
-
$zp = $this->fixCSS($this->mpdf->defaultCSS[$tag]);
|
1500 |
-
if (is_array($zp)) { $p = array_merge($zp,$p); } // Inherited overwrites default
|
1501 |
-
}
|
1502 |
-
// STYLESHEET TAG e.g. h1 p div table
|
1503 |
-
if (isset($this->CSS[$tag])) {
|
1504 |
-
$zp = $this->CSS[$tag];
|
1505 |
-
if (is_array($zp)) { $p = array_merge($p,$zp); }
|
1506 |
-
}
|
1507 |
-
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1508 |
-
foreach($classes AS $class) {
|
1509 |
-
$zp = array();
|
1510 |
-
if (isset($this->CSS['CLASS>>'.$class])) { $zp = $this->CSS['CLASS>>'.$class]; }
|
1511 |
-
if (is_array($zp)) { $p = array_merge($p,$zp); }
|
1512 |
-
}
|
1513 |
-
// STYLESHEET ID e.g. #smallone{} #redletter{}
|
1514 |
-
if (isset($attr['ID']) && isset($this->CSS['ID>>'.$attr['ID']])) {
|
1515 |
-
$zp = $this->CSS['ID>>'.$attr['ID']];
|
1516 |
-
if (is_array($zp)) { $p = array_merge($p,$zp); }
|
1517 |
-
}
|
1518 |
-
// STYLESHEET CLASS e.g. p.smallone{} div.redletter{}
|
1519 |
-
foreach($classes AS $class) {
|
1520 |
-
$zp = array();
|
1521 |
-
if (isset($this->CSS[$tag.'>>CLASS>>'.$class])) { $zp = $this->CSS[$tag.'>>CLASS>>'.$class]; }
|
1522 |
-
if (is_array($zp)) { $p = array_merge($p,$zp); }
|
1523 |
-
}
|
1524 |
-
// STYLESHEET CLASS e.g. p#smallone{} div#redletter{}
|
1525 |
-
if (isset($attr['ID']) && isset($this->CSS[$tag.'>>ID>>'.$attr['ID']])) {
|
1526 |
-
$zp = $this->CSS[$tag.'>>ID>>'.$attr['ID']];
|
1527 |
-
if (is_array($zp)) { $p = array_merge($p,$zp); }
|
1528 |
-
}
|
1529 |
-
//===============================================
|
1530 |
-
// STYLESHEET TAG e.g. div h1 div p
|
1531 |
-
|
1532 |
-
$this->_set_mergedCSS($oldcascadeCSS[$tag], $p);
|
1533 |
-
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1534 |
-
foreach($classes AS $class) {
|
1535 |
-
|
1536 |
-
$this->_set_mergedCSS($oldcascadeCSS['CLASS>>'.$class], $p);
|
1537 |
-
}
|
1538 |
-
// STYLESHEET CLASS e.g. #smallone{} #redletter{}
|
1539 |
-
if (isset($attr['ID'])) {
|
1540 |
-
|
1541 |
-
$this->_set_mergedCSS($oldcascadeCSS['ID>>'.$attr['ID']], $p);
|
1542 |
-
}
|
1543 |
-
// STYLESHEET CLASS e.g. div.smallone{} p.redletter{}
|
1544 |
-
foreach($classes AS $class) {
|
1545 |
-
|
1546 |
-
$this->_set_mergedCSS($oldcascadeCSS[$tag.'>>CLASS>>'.$class], $p);
|
1547 |
-
}
|
1548 |
-
// STYLESHEET CLASS e.g. div#smallone{} p#redletter{}
|
1549 |
-
if (isset($attr['ID'])) {
|
1550 |
-
|
1551 |
-
$this->_set_mergedCSS($oldcascadeCSS[$tag.'>>ID>>'.$attr['ID']], $p);
|
1552 |
-
}
|
1553 |
-
//===============================================
|
1554 |
-
// INLINE STYLE e.g. style="CSS:property"
|
1555 |
-
if (isset($attr['STYLE'])) {
|
1556 |
-
$zp = $this->readInlineCSS($attr['STYLE']);
|
1557 |
-
if (is_array($zp)) { $p = array_merge($p,$zp); }
|
1558 |
-
}
|
1559 |
-
//===============================================
|
1560 |
-
return $p;
|
1561 |
-
}
|
1562 |
-
|
1563 |
-
// mPDF 5.7.4 nth-child
|
1564 |
-
function _nthchild($f, $c) {
|
1565 |
-
// $f is formual e.g. 2N+1 spilt into a preg_match array
|
1566 |
-
// $c is the comparator value e.g row or column number
|
1567 |
-
$c += 1;
|
1568 |
-
$select = false;
|
1569 |
-
$a=1; $b=1;
|
1570 |
-
if ($f[0]=='ODD') { $a=2; $b=1; }
|
1571 |
-
else if ($f[0]=='EVEN') { $a=2; $b=0; }
|
1572 |
-
else if (count($f)==2) { $a=0; $b=$f[1]+0; } // e.g. (+6)
|
1573 |
-
else if (count($f)==3) { // e.g. (2N)
|
1574 |
-
if ($f[2]=='') { $a=1; }
|
1575 |
-
else if ($f[2]=='-') { $a=-1; }
|
1576 |
-
else { $a=$f[2]+0; }
|
1577 |
-
$b=0;
|
1578 |
-
}
|
1579 |
-
else if (count($f)==4) { // e.g. (2N+6)
|
1580 |
-
if ($f[2]=='') { $a=1; }
|
1581 |
-
else if ($f[2]=='-') { $a=-1; }
|
1582 |
-
else { $a=$f[2]+0; }
|
1583 |
-
$b=$f[3]+0;
|
1584 |
-
}
|
1585 |
-
else { return false; }
|
1586 |
-
if ($a>0) {
|
1587 |
-
if (((($c % $a) - $b) % $a) == 0 && $c >= $b) { $select = true; }
|
1588 |
-
}
|
1589 |
-
else if ($a==0) {
|
1590 |
-
if ($c == $b) { $select = true; }
|
1591 |
-
}
|
1592 |
-
else { // if ($a<0)
|
1593 |
-
if (((($c % $a) - $b) % $a) == 0 && $c <= $b) { $select = true; }
|
1594 |
-
}
|
1595 |
-
return $select;
|
1596 |
-
}
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
} // end of class
|
1601 |
-
|
1602 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/directw.php
DELETED
@@ -1,408 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class directw {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
|
7 |
-
function directw(&$mpdf) {
|
8 |
-
$this->mpdf = $mpdf;
|
9 |
-
}
|
10 |
-
|
11 |
-
|
12 |
-
function Write($h,$txt,$currentx=0,$link='',$directionality='ltr',$align='') {
|
13 |
-
if (!$align) {
|
14 |
-
if ($directionality=='rtl') { $align = 'R'; }
|
15 |
-
else { $align = 'L'; }
|
16 |
-
}
|
17 |
-
if ($h == 0) { $this->mpdf->SetLineHeight(); $h = $this->mpdf->lineheight; }
|
18 |
-
//Output text in flowing mode
|
19 |
-
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
20 |
-
|
21 |
-
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
|
22 |
-
$s=str_replace("\r",'',$txt);
|
23 |
-
if ($this->mpdf->usingCoreFont) { $nb=strlen($s); }
|
24 |
-
else {
|
25 |
-
$nb=mb_strlen($s, $this->mpdf->mb_enc );
|
26 |
-
// handle single space character
|
27 |
-
if(($nb==1) && $s == " ") {
|
28 |
-
$this->mpdf->x += $this->mpdf->GetStringWidth($s);
|
29 |
-
return;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
$sep=-1;
|
33 |
-
$i=0;
|
34 |
-
$j=0;
|
35 |
-
$l=0;
|
36 |
-
$nl=1;
|
37 |
-
if (!$this->mpdf->usingCoreFont) {
|
38 |
-
if (preg_match("/([".$this->mpdf->pregRTLchars."])/u", $txt)) { $this->mpdf->biDirectional = true; } // *RTL*
|
39 |
-
$checkCursive=false;
|
40 |
-
if ($this->mpdf->biDirectional) { $checkCursive=true; } // *RTL*
|
41 |
-
else if (isset($this->mpdf->CurrentFont['indic']) && $this->mpdf->CurrentFont['indic']) { $checkCursive=true; } // *INDIC*
|
42 |
-
while($i<$nb) {
|
43 |
-
//Get next character
|
44 |
-
$c = mb_substr($s,$i,1,$this->mpdf->mb_enc );
|
45 |
-
if($c == "\n") {
|
46 |
-
// WORD SPACING
|
47 |
-
$this->mpdf->ResetSpacing();
|
48 |
-
//Explicit line break
|
49 |
-
$tmp = rtrim(mb_substr($s,$j,$i-$j,$this->mpdf->mb_enc));
|
50 |
-
if ($directionality == 'rtl' && $align == 'J') { $align = 'R'; } // *RTL*
|
51 |
-
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
|
52 |
-
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
53 |
-
$i++;
|
54 |
-
$sep = -1;
|
55 |
-
$j = $i;
|
56 |
-
$l = 0;
|
57 |
-
if($nl == 1) {
|
58 |
-
if ($currentx != 0) $this->mpdf->x=$currentx;
|
59 |
-
else $this->mpdf->x=$this->mpdf->lMargin;
|
60 |
-
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
61 |
-
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
|
62 |
-
}
|
63 |
-
$nl++;
|
64 |
-
continue;
|
65 |
-
}
|
66 |
-
if($c == " ") { $sep= $i; }
|
67 |
-
$l += $this->mpdf->GetCharWidthNonCore($c); // mPDF 5.3.04
|
68 |
-
if($l > $wmax) {
|
69 |
-
//Automatic line break (word wrapping)
|
70 |
-
if($sep == -1) {
|
71 |
-
// WORD SPACING
|
72 |
-
$this->mpdf->ResetSpacing();
|
73 |
-
if($this->mpdf->x > $this->mpdf->lMargin) {
|
74 |
-
//Move to next line
|
75 |
-
if ($currentx != 0) $this->mpdf->x=$currentx;
|
76 |
-
else $this->mpdf->x=$this->mpdf->lMargin;
|
77 |
-
$this->mpdf->y+=$h;
|
78 |
-
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
|
79 |
-
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
|
80 |
-
$i++;
|
81 |
-
$nl++;
|
82 |
-
continue;
|
83 |
-
}
|
84 |
-
if($i==$j) { $i++; }
|
85 |
-
$tmp = rtrim(mb_substr($s,$j,$i-$j,$this->mpdf->mb_enc));
|
86 |
-
if ($directionality == 'rtl' && $align == 'J') { $align = 'R'; } // *RTL*
|
87 |
-
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
|
88 |
-
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
89 |
-
}
|
90 |
-
else {
|
91 |
-
$tmp = rtrim(mb_substr($s,$j,$sep-$j,$this->mpdf->mb_enc));
|
92 |
-
if ($directionality == 'rtl' && $align == 'J') { $align = 'R'; } // *RTL*
|
93 |
-
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
|
94 |
-
|
95 |
-
if($align=='J') {
|
96 |
-
//////////////////////////////////////////
|
97 |
-
// JUSTIFY J using Unicode fonts (Word spacing doesn't work)
|
98 |
-
// WORD SPACING
|
99 |
-
// Change NON_BREAKING SPACE to spaces so they are 'spaced' properly
|
100 |
-
$tmp = str_replace(chr(194).chr(160),chr(32),$tmp );
|
101 |
-
$len_ligne = $this->mpdf->GetStringWidth($tmp );
|
102 |
-
$nb_carac = mb_strlen( $tmp , $this->mpdf->mb_enc ) ;
|
103 |
-
$nb_spaces = mb_substr_count( $tmp ,' ', $this->mpdf->mb_enc ) ;
|
104 |
-
$inclCursive=false;
|
105 |
-
if ($checkCursive) {
|
106 |
-
if (preg_match("/([".$this->mpdf->pregRTLchars."])/u", $tmp)) { $inclCursive = true; } // *RTL*
|
107 |
-
if (preg_match("/([".$this->mpdf->pregHIchars.$this->mpdf->pregBNchars.$this->mpdf->pregPAchars."])/u", $tmp)) { $inclCursive = true; } // *INDIC*
|
108 |
-
}
|
109 |
-
list($charspacing,$ws) = $this->mpdf->GetJspacing($nb_carac,$nb_spaces,((($w-2) - $len_ligne) * _MPDFK),$inclCursive);
|
110 |
-
$this->mpdf->SetSpacing($charspacing,$ws);
|
111 |
-
//////////////////////////////////////////
|
112 |
-
}
|
113 |
-
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
114 |
-
$i=$sep+1;
|
115 |
-
}
|
116 |
-
$sep = -1;
|
117 |
-
$j = $i;
|
118 |
-
$l = 0;
|
119 |
-
if($nl==1) {
|
120 |
-
if ($currentx != 0) $this->mpdf->x=$currentx;
|
121 |
-
else $this->mpdf->x=$this->mpdf->lMargin;
|
122 |
-
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
|
123 |
-
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
|
124 |
-
}
|
125 |
-
$nl++;
|
126 |
-
}
|
127 |
-
else { $i++; }
|
128 |
-
}
|
129 |
-
//Last chunk
|
130 |
-
// WORD SPACING
|
131 |
-
$this->mpdf->ResetSpacing();
|
132 |
-
}
|
133 |
-
else {
|
134 |
-
while($i<$nb) {
|
135 |
-
//Get next character
|
136 |
-
$c=$s[$i];
|
137 |
-
if($c == "\n") {
|
138 |
-
//Explicit line break
|
139 |
-
// WORD SPACING
|
140 |
-
$this->mpdf->ResetSpacing();
|
141 |
-
$this->mpdf->Cell($w, $h, substr($s, $j, $i-$j), 0, 2, $align, $fill, $link);
|
142 |
-
$i++;
|
143 |
-
$sep = -1;
|
144 |
-
$j = $i;
|
145 |
-
$l = 0;
|
146 |
-
if($nl == 1) {
|
147 |
-
if ($currentx != 0) $this->mpdf->x=$currentx;
|
148 |
-
else $this->mpdf->x=$this->mpdf->lMargin;
|
149 |
-
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
150 |
-
$wmax=$w-($this->mpdf->cMarginL+$this->mpdf->cMarginR);
|
151 |
-
}
|
152 |
-
$nl++;
|
153 |
-
continue;
|
154 |
-
}
|
155 |
-
if($c == " ") { $sep= $i; }
|
156 |
-
$l += $this->mpdf->GetCharWidthCore($c); // mPDF 5.3.04
|
157 |
-
if($l > $wmax) {
|
158 |
-
//Automatic line break (word wrapping)
|
159 |
-
if($sep == -1) {
|
160 |
-
// WORD SPACING
|
161 |
-
$this->mpdf->ResetSpacing();
|
162 |
-
if($this->mpdf->x > $this->mpdf->lMargin) {
|
163 |
-
//Move to next line
|
164 |
-
if ($currentx != 0) $this->mpdf->x=$currentx;
|
165 |
-
else $this->mpdf->x=$this->mpdf->lMargin;
|
166 |
-
$this->mpdf->y+=$h;
|
167 |
-
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
|
168 |
-
$wmax=$w-($this->mpdf->cMarginL+$this->mpdf->cMarginR);
|
169 |
-
$i++;
|
170 |
-
$nl++;
|
171 |
-
continue;
|
172 |
-
}
|
173 |
-
if($i==$j) { $i++; }
|
174 |
-
$this->mpdf->Cell($w, $h, substr($s, $j, $i-$j), 0, 2, $align, $fill, $link);
|
175 |
-
}
|
176 |
-
else {
|
177 |
-
$tmp = substr($s, $j, $sep-$j);
|
178 |
-
if($align=='J') {
|
179 |
-
//////////////////////////////////////////
|
180 |
-
// JUSTIFY J using Unicode fonts (Word spacing doesn't work)
|
181 |
-
// WORD SPACING
|
182 |
-
// Change NON_BREAKING SPACE to spaces so they are 'spaced' properly
|
183 |
-
$tmp = str_replace(chr(160),chr(32),$tmp );
|
184 |
-
$len_ligne = $this->mpdf->GetStringWidth($tmp );
|
185 |
-
$nb_carac = strlen( $tmp ) ;
|
186 |
-
$nb_spaces = substr_count( $tmp ,' ' ) ;
|
187 |
-
list($charspacing,$ws) = $this->mpdf->GetJspacing($nb_carac,$nb_spaces,((($w-2) - $len_ligne) * _MPDFK),$false);
|
188 |
-
$this->mpdf->SetSpacing($charspacing,$ws);
|
189 |
-
//////////////////////////////////////////
|
190 |
-
}
|
191 |
-
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
192 |
-
$i=$sep+1;
|
193 |
-
}
|
194 |
-
$sep = -1;
|
195 |
-
$j = $i;
|
196 |
-
$l = 0;
|
197 |
-
if($nl==1) {
|
198 |
-
if ($currentx != 0) $this->mpdf->x=$currentx;
|
199 |
-
else $this->mpdf->x=$this->mpdf->lMargin;
|
200 |
-
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
|
201 |
-
$wmax=$w-($this->mpdf->cMarginL+$this->mpdf->cMarginR);
|
202 |
-
}
|
203 |
-
$nl++;
|
204 |
-
}
|
205 |
-
else {
|
206 |
-
$i++;
|
207 |
-
}
|
208 |
-
}
|
209 |
-
// WORD SPACING
|
210 |
-
$this->mpdf->ResetSpacing();
|
211 |
-
}
|
212 |
-
//Last chunk
|
213 |
-
if($i!=$j) {
|
214 |
-
if ($currentx != 0) $this->mpdf->x=$currentx;
|
215 |
-
else $this->mpdf->x=$this->mpdf->lMargin;
|
216 |
-
if ($this->mpdf->usingCoreFont) { $tmp = substr($s,$j,$i-$j); }
|
217 |
-
else {
|
218 |
-
$tmp = mb_substr($s,$j,$i-$j,$this->mpdf->mb_enc);
|
219 |
-
if ($directionality == 'rtl' && $align == 'J') { $align = 'R'; } // *RTL*
|
220 |
-
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
|
221 |
-
}
|
222 |
-
$this->mpdf->Cell($w,$h,$tmp,0,0,$align,$fill,$link);
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
|
227 |
-
function CircularText($x, $y, $r, $text, $align='top', $fontfamily='', $fontsizePt=0, $fontstyle='', $kerning=120, $fontwidth=100, $divider='') { // mPDF 5.5.23
|
228 |
-
if ($font || $fontstyle || $fontsizePt) $this->mpdf->SetFont($fontfamily,$fontstyle,$fontsizePt);
|
229 |
-
$kerning/=100;
|
230 |
-
$fontwidth/=100;
|
231 |
-
if($kerning==0) $this->mpdf->Error('Please use values unequal to zero for kerning (CircularText)');
|
232 |
-
if($fontwidth==0) $this->mpdf->Error('Please use values unequal to zero for font width (CircularText)');
|
233 |
-
$text=str_replace("\r",'',$text);
|
234 |
-
//circumference
|
235 |
-
$u=($r*2)*M_PI;
|
236 |
-
// mPDF 5.5.23
|
237 |
-
$checking = true;
|
238 |
-
$autoset = false;
|
239 |
-
while($checking) {
|
240 |
-
$t=0;
|
241 |
-
$w = array();
|
242 |
-
if ($this->mpdf->usingCoreFont) {
|
243 |
-
$nb=strlen($text);
|
244 |
-
for($i=0; $i<$nb; $i++){
|
245 |
-
$w[$i]=$this->mpdf->GetStringWidth($text[$i]);
|
246 |
-
$w[$i]*=$kerning*$fontwidth;
|
247 |
-
$t+=$w[$i];
|
248 |
-
}
|
249 |
-
}
|
250 |
-
else {
|
251 |
-
$nb=mb_strlen($text, $this->mpdf->mb_enc );
|
252 |
-
$lastchar = '';
|
253 |
-
$unicode = $this->mpdf->UTF8StringToArray($text);
|
254 |
-
for($i=0; $i<$nb; $i++){
|
255 |
-
$c = mb_substr($text,$i,1,$this->mpdf->mb_enc );
|
256 |
-
$w[$i]=$this->mpdf->GetStringWidth($c);
|
257 |
-
$w[$i]*=$kerning*$fontwidth;
|
258 |
-
$char = $unicode[$i];
|
259 |
-
if ($this->mpdf->useKerning && $lastchar) {
|
260 |
-
if (isset($this->mpdf->CurrentFont['kerninfo'][$lastchar][$char])) {
|
261 |
-
$tk = $this->mpdf->CurrentFont['kerninfo'][$lastchar][$char] * ($this->mpdf->FontSize/ 1000) * $kerning * $fontwidth;
|
262 |
-
$w[$i] += $tk/2;
|
263 |
-
$w[$i-1] += $tk/2;
|
264 |
-
$t+=$tk;
|
265 |
-
}
|
266 |
-
}
|
267 |
-
$lastchar = $char;
|
268 |
-
$t+=$w[$i];
|
269 |
-
}
|
270 |
-
}
|
271 |
-
if ($fontsizePt>=0 || $autoset) { $checking = false; }
|
272 |
-
else {
|
273 |
-
$t+=$this->mpdf->GetStringWidth(' ');
|
274 |
-
if ($divider)
|
275 |
-
$t+=$this->mpdf->GetStringWidth(' ');
|
276 |
-
if ($fontsizePt==-2)
|
277 |
-
$fontsizePt = $this->mpdf->FontSizePt * 0.5 * $u/$t;
|
278 |
-
else
|
279 |
-
$fontsizePt = $this->mpdf->FontSizePt * $u/$t;
|
280 |
-
$this->mpdf->SetFontSize($fontsizePt);
|
281 |
-
$autoset = true;
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
//total width of string in degrees
|
286 |
-
$d=($t/$u)*360;
|
287 |
-
|
288 |
-
$this->mpdf->StartTransform();
|
289 |
-
// rotate matrix for the first letter to center the text
|
290 |
-
// (half of total degrees)
|
291 |
-
if($align=='top'){
|
292 |
-
$this->mpdf->transformRotate(-$d/2, $x, $y);
|
293 |
-
}
|
294 |
-
else{
|
295 |
-
$this->mpdf->transformRotate($d/2, $x, $y);
|
296 |
-
}
|
297 |
-
//run through the string
|
298 |
-
for($i=0; $i<$nb; $i++){
|
299 |
-
if($align=='top'){
|
300 |
-
//rotate matrix half of the width of current letter + half of the width of preceding letter
|
301 |
-
if($i==0){
|
302 |
-
$this->mpdf->transformRotate((($w[$i]/2)/$u)*360, $x, $y);
|
303 |
-
}
|
304 |
-
else{
|
305 |
-
$this->mpdf->transformRotate((($w[$i]/2+$w[$i-1]/2)/$u)*360, $x, $y);
|
306 |
-
}
|
307 |
-
if($fontwidth!=1){
|
308 |
-
$this->mpdf->StartTransform();
|
309 |
-
$this->mpdf->transformScale($fontwidth*100, 100, $x, $y);
|
310 |
-
}
|
311 |
-
$this->mpdf->SetXY($x-$w[$i]/2, $y-$r);
|
312 |
-
}
|
313 |
-
else{
|
314 |
-
//rotate matrix half of the width of current letter + half of the width of preceding letter
|
315 |
-
if($i==0){
|
316 |
-
$this->mpdf->transformRotate(-(($w[$i]/2)/$u)*360, $x, $y);
|
317 |
-
}
|
318 |
-
else{
|
319 |
-
$this->mpdf->transformRotate(-(($w[$i]/2+$w[$i-1]/2)/$u)*360, $x, $y);
|
320 |
-
}
|
321 |
-
if($fontwidth!=1){
|
322 |
-
$this->mpdf->StartTransform();
|
323 |
-
$this->mpdf->transformScale($fontwidth*100, 100, $x, $y);
|
324 |
-
}
|
325 |
-
$this->mpdf->SetXY($x-$w[$i]/2, $y+$r-($this->mpdf->FontSize));
|
326 |
-
}
|
327 |
-
if ($this->mpdf->usingCoreFont) { $c=$text[$i]; }
|
328 |
-
else { $c = mb_substr($text,$i,1,$this->mpdf->mb_enc ); }
|
329 |
-
$this->mpdf->Cell(($w[$i]),$this->mpdf->FontSize,$c,0,0,'C'); // mPDF 5.3.53
|
330 |
-
if($fontwidth!=1){
|
331 |
-
$this->mpdf->StopTransform();
|
332 |
-
}
|
333 |
-
}
|
334 |
-
$this->mpdf->StopTransform();
|
335 |
-
|
336 |
-
// mPDF 5.5.23
|
337 |
-
if($align=='top' && $divider!=''){
|
338 |
-
$wc=$this->mpdf->GetStringWidth($divider);
|
339 |
-
$wc*=$kerning*$fontwidth;
|
340 |
-
|
341 |
-
$this->mpdf->StartTransform();
|
342 |
-
$this->mpdf->transformRotate(90, $x, $y);
|
343 |
-
$this->mpdf->SetXY($x-$wc/2, $y-$r);
|
344 |
-
$this->mpdf->Cell(($wc),$this->mpdf->FontSize,$divider,0,0,'C');
|
345 |
-
$this->mpdf->StopTransform();
|
346 |
-
|
347 |
-
$this->mpdf->StartTransform();
|
348 |
-
$this->mpdf->transformRotate(-90, $x, $y);
|
349 |
-
$this->mpdf->SetXY($x-$wc/2, $y-$r);
|
350 |
-
$this->mpdf->Cell(($wc),$this->mpdf->FontSize,$divider,0,0,'C');
|
351 |
-
$this->mpdf->StopTransform();
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
function Shaded_box( $text,$font='',$fontstyle='B',$szfont='',$width='70%',$style='DF',$radius=2.5,$fill='#FFFFFF',$color='#000000',$pad=2 )
|
356 |
-
{
|
357 |
-
// F (shading - no line),S (line, no shading),DF (both)
|
358 |
-
if (!$font) { $font= $this->mpdf->default_font; }
|
359 |
-
if (!$szfont) { $szfont = ($this->mpdf->default_font_size * 1.8); }
|
360 |
-
|
361 |
-
$text = $this->mpdf->purify_utf8_text($text);
|
362 |
-
if ($this->mpdf->text_input_as_HTML) {
|
363 |
-
$text = $this->mpdf->all_entities_to_utf8($text);
|
364 |
-
}
|
365 |
-
if ($this->mpdf->usingCoreFont) { $text = mb_convert_encoding($text,$this->mpdf->mb_enc,'UTF-8'); }
|
366 |
-
// DIRECTIONALITY
|
367 |
-
$this->mpdf->magic_reverse_dir($text, true, $this->mpdf->directionality); // *RTL*
|
368 |
-
// Font-specific ligature substitution for Indic fonts
|
369 |
-
if (isset($this->mpdf->CurrentFont['indic']) && $this->mpdf->CurrentFont['indic']) $this->mpdf->ConvertIndic($text); // *INDIC*
|
370 |
-
$text = ' '.$text.' ';
|
371 |
-
if (!$width) { $width = $this->mpdf->pgwidth; } else { $width=$this->mpdf->ConvertSize($width,$this->mpdf->pgwidth); }
|
372 |
-
$midpt = $this->mpdf->lMargin+($this->mpdf->pgwidth/2);
|
373 |
-
$r1 = $midpt-($width/2); //($this->mpdf->w / 2) - 40;
|
374 |
-
$r2 = $r1 + $width; //$r1 + 80;
|
375 |
-
$y1 = $this->mpdf->y;
|
376 |
-
|
377 |
-
|
378 |
-
$mid = ($r1 + $r2 ) / 2;
|
379 |
-
$loop = 0;
|
380 |
-
|
381 |
-
while ( $loop == 0 )
|
382 |
-
{
|
383 |
-
$this->mpdf->SetFont( $font, $fontstyle, $szfont );
|
384 |
-
$sz = $this->mpdf->GetStringWidth( $text );
|
385 |
-
if ( ($r1+$sz) > $r2 )
|
386 |
-
$szfont --;
|
387 |
-
else
|
388 |
-
$loop ++;
|
389 |
-
}
|
390 |
-
|
391 |
-
$y2 = $this->mpdf->FontSize+($pad*2);
|
392 |
-
|
393 |
-
$this->mpdf->SetLineWidth(0.1);
|
394 |
-
$fc = $this->mpdf->ConvertColor($fill);
|
395 |
-
$tc = $this->mpdf->ConvertColor($color);
|
396 |
-
$this->mpdf->SetFColor($fc);
|
397 |
-
$this->mpdf->SetTColor($tc);
|
398 |
-
$this->mpdf->RoundedRect($r1, $y1, ($r2 - $r1), $y2, $radius, $style);
|
399 |
-
$this->mpdf->SetX( $r1);
|
400 |
-
$this->mpdf->Cell($r2-$r1, $y2, $text, 0, 1, "C" );
|
401 |
-
$this->mpdf->SetY($y1+$y2+2); // +2 = mm margin below shaded box
|
402 |
-
$this->mpdf->Reset();
|
403 |
-
}
|
404 |
-
|
405 |
-
|
406 |
-
}
|
407 |
-
|
408 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/form.php
DELETED
@@ -1,1498 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class form {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
|
7 |
-
var $forms;
|
8 |
-
var $formn;
|
9 |
-
|
10 |
-
//Active Forms
|
11 |
-
var $formSubmitNoValueFields;
|
12 |
-
var $formExportType;
|
13 |
-
var $formSelectDefaultOption;
|
14 |
-
var $formUseZapD;
|
15 |
-
/* Form Styles */
|
16 |
-
var $form_border_color;
|
17 |
-
var $form_background_color;
|
18 |
-
var $form_border_width;
|
19 |
-
var $form_border_style;
|
20 |
-
var $form_button_border_color;
|
21 |
-
var $form_button_background_color;
|
22 |
-
var $form_button_border_width;
|
23 |
-
var $form_button_border_style;
|
24 |
-
var $form_radio_color;
|
25 |
-
var $form_radio_background_color;
|
26 |
-
|
27 |
-
var $form_element_spacing;
|
28 |
-
|
29 |
-
// Active forms
|
30 |
-
var $formMethod;
|
31 |
-
var $formAction;
|
32 |
-
var $form_fonts;
|
33 |
-
var $form_radio_groups;
|
34 |
-
var $form_checkboxes;
|
35 |
-
var $pdf_acro_array;
|
36 |
-
|
37 |
-
var $pdf_array_co;
|
38 |
-
var $array_form_button_js;
|
39 |
-
var $array_form_choice_js;
|
40 |
-
var $array_form_text_js;
|
41 |
-
|
42 |
-
/* Button Text */
|
43 |
-
var $form_button_text;
|
44 |
-
var $form_button_text_over;
|
45 |
-
var $form_button_text_click;
|
46 |
-
var $form_button_icon;
|
47 |
-
|
48 |
-
|
49 |
-
// FORMS
|
50 |
-
var $textarea_lineheight;
|
51 |
-
|
52 |
-
function form(&$mpdf) {
|
53 |
-
$this->mpdf = $mpdf;
|
54 |
-
|
55 |
-
// ACTIVE FORMS
|
56 |
-
$this->formExportType = 'xfdf'; // 'xfdf' or 'html'
|
57 |
-
$this->formSubmitNoValueFields = true; // Whether to include blank fields when submitting data
|
58 |
-
$this->formSelectDefaultOption = true; // for Select drop down box; if no option is explicitly maked as selected,
|
59 |
-
// this determines whether to select 1st option (as per browser)
|
60 |
-
// - affects whether "required" attribute is relevant
|
61 |
-
$this->formUseZapD = true; // Determine whether to use ZapfDingbat icons for radio/checkboxes
|
62 |
-
|
63 |
-
// FORM STYLES
|
64 |
-
// These can alternatively use a 4 number string to represent CMYK colours
|
65 |
-
$this->form_border_color = '0.6 0.6 0.72'; // RGB
|
66 |
-
$this->form_background_color = '0.975 0.975 0.975'; // RGB
|
67 |
-
$this->form_border_width = '1'; // 0 doesn't seem to work as it should
|
68 |
-
$this->form_border_style = 'S'; // B - Bevelled; D - Double
|
69 |
-
$this->form_button_border_color = '0.2 0.2 0.55';
|
70 |
-
$this->form_button_background_color = '0.941 0.941 0.941';
|
71 |
-
$this->form_button_border_width = '1';
|
72 |
-
$this->form_button_border_style = 'S';
|
73 |
-
$this->form_radio_color = '0.0 0.0 0.4'; // radio and checkbox
|
74 |
-
$this->form_radio_background_color = '0.9 0.9 0.9';
|
75 |
-
|
76 |
-
// FORMS
|
77 |
-
$this->textarea_lineheight = 1.25;
|
78 |
-
|
79 |
-
// FORM ELEMENT SPACING
|
80 |
-
$this->form_element_spacing['select']['outer']['h'] = 0.5; // Horizontal spacing around SELECT
|
81 |
-
$this->form_element_spacing['select']['outer']['v'] = 0.5; // Vertical spacing around SELECT
|
82 |
-
$this->form_element_spacing['select']['inner']['h'] = 0.7; // Horizontal padding around SELECT
|
83 |
-
$this->form_element_spacing['select']['inner']['v'] = 0.7; // Vertical padding around SELECT
|
84 |
-
$this->form_element_spacing['input']['outer']['h'] = 0.5;
|
85 |
-
$this->form_element_spacing['input']['outer']['v'] = 0.5;
|
86 |
-
$this->form_element_spacing['input']['inner']['h'] = 0.7;
|
87 |
-
$this->form_element_spacing['input']['inner']['v'] = 0.7;
|
88 |
-
$this->form_element_spacing['textarea']['outer']['h'] = 0.5;
|
89 |
-
$this->form_element_spacing['textarea']['outer']['v'] = 0.5;
|
90 |
-
$this->form_element_spacing['textarea']['inner']['h'] = 1;
|
91 |
-
$this->form_element_spacing['textarea']['inner']['v'] = 0.5;
|
92 |
-
$this->form_element_spacing['button']['outer']['h'] = 0.5;
|
93 |
-
$this->form_element_spacing['button']['outer']['v'] = 0.5;
|
94 |
-
$this->form_element_spacing['button']['inner']['h'] = 2;
|
95 |
-
$this->form_element_spacing['button']['inner']['v'] = 1;
|
96 |
-
|
97 |
-
// INITIALISE non-configurable
|
98 |
-
$this->formMethod = 'POST';
|
99 |
-
$this->formAction = '';
|
100 |
-
$this->form_fonts = array();
|
101 |
-
$this->form_radio_groups = array();
|
102 |
-
$this->form_checkboxes = false;
|
103 |
-
$this->forms = array();
|
104 |
-
$this->pdf_array_co = '';
|
105 |
-
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
function print_ob_text($objattr,$w,$h,$texto,$rtlalign,$k,$blockdir) {
|
111 |
-
// TEXT/PASSWORD INPUT
|
112 |
-
if ($this->mpdf->useActiveForms) {
|
113 |
-
// Flags: 1 - Readonly; 2 - Required; 3 - No export; 13 - textarea; 14 - Password
|
114 |
-
$flags = array();
|
115 |
-
if ($objattr['disabled'] || $objattr['readonly']) { $flags[] = 1; } // readonly
|
116 |
-
if ($objattr['disabled']) { $flags[] = 3; } // no export
|
117 |
-
if ($objattr['disabled']) { $objattr['color'] = array(3,128,128,128); } // gray out disabled
|
118 |
-
if ($objattr['required']) { $flags[] = 2; } // required
|
119 |
-
if (!$objattr['spellcheck']) { $flags[] = 23; } // DoNotSpellCheck
|
120 |
-
if ($objattr['subtype']=='PASSWORD') { $flags[] = 14; }
|
121 |
-
$this->mpdf->SetTColor($objattr['color']);
|
122 |
-
$fieldalign = $rtlalign;
|
123 |
-
if ($objattr['text_align']) { $fieldalign = $objattr['text_align']; }
|
124 |
-
if ($objattr['subtype']=='PASSWORD') { $val = $objattr['value']; }
|
125 |
-
else { $val = $objattr['text']; }
|
126 |
-
// mPDF 5.3.25
|
127 |
-
$js = array();
|
128 |
-
if ($objattr['onCalculate']) { $js[] = array('C', $objattr['onCalculate']); }
|
129 |
-
if ($objattr['onValidate']) { $js[] = array('V', $objattr['onValidate']); }
|
130 |
-
if ($objattr['onFormat']) { $js[] = array('F', $objattr['onFormat']); }
|
131 |
-
if ($objattr['onKeystroke']) { $js[] = array('K', $objattr['onKeystroke']); }
|
132 |
-
$this->SetFormText( $w, $h, $objattr['fieldname'], $val, $val, $objattr['title'], $flags, $fieldalign, false, $objattr['maxlength'], $js, $objattr['background-col'], $objattr['border-col'] );
|
133 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
134 |
-
}
|
135 |
-
else {
|
136 |
-
$w -= $this->form_element_spacing['input']['outer']['h']*2 /$k;
|
137 |
-
$h -= $this->form_element_spacing['input']['outer']['v']*2 /$k;
|
138 |
-
$this->mpdf->x += $this->form_element_spacing['input']['outer']['h'] /$k;
|
139 |
-
$this->mpdf->y += $this->form_element_spacing['input']['outer']['v'] /$k;
|
140 |
-
// Chop texto to max length $w-inner-padding
|
141 |
-
while ($this->mpdf->GetStringWidth($texto) > $w-($this->form_element_spacing['input']['inner']['h']*2)) {
|
142 |
-
$texto = mb_substr($texto,0,mb_strlen($texto,$this->mpdf->mb_enc)-1,$this->mpdf->mb_enc);
|
143 |
-
}
|
144 |
-
$save_linemaxfontsize = $this->mpdf->linemaxfontsize;
|
145 |
-
$this->mpdf->linemaxfontsize = $this->mpdf->FontSize;
|
146 |
-
$this->mpdf->SetLineWidth(0.2 /$k );
|
147 |
-
$this->mpdf->magic_reverse_dir($texto, false, $blockdir); // *RTL*
|
148 |
-
if (isset($objattr['disabled']) && $objattr['disabled']) {
|
149 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(225));
|
150 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(127));
|
151 |
-
}
|
152 |
-
else if (isset($objattr['readonly']) && $objattr['readonly']) {
|
153 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(225));
|
154 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
155 |
-
}
|
156 |
-
else {
|
157 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(250));
|
158 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
159 |
-
}
|
160 |
-
$this->mpdf->Cell($w,$h,$texto,1,0,$rtlalign,1,'',0,$this->form_element_spacing['input']['inner']['h'] /$k ,$this->form_element_spacing['input']['inner']['h'] /$k , 'M');
|
161 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(255));
|
162 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
163 |
-
$this->mpdf->linemaxfontsize = $save_linemaxfontsize;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
function print_ob_textarea($objattr,$w,$h,$texto,$rtlalign,$k,$blockdir) {
|
168 |
-
// TEXTAREA
|
169 |
-
if ($this->mpdf->useActiveForms) {
|
170 |
-
// Flags: 1 - Readonly; 2 - Required; 3 - No export; 13 - textarea; 14 - Password
|
171 |
-
$flags = array();
|
172 |
-
$flags = array(13); // textarea
|
173 |
-
if ($objattr['disabled'] || $objattr['readonly']) { $flags[] = 1; } // readonly
|
174 |
-
if ($objattr['disabled']) { $flags[] = 3; } // no export
|
175 |
-
if ($objattr['disabled']) { $objattr['color'] = array(3,128,128,128); } // gray out disabled
|
176 |
-
if ($objattr['required']) { $flags[] = 2; } // required
|
177 |
-
if (!$objattr['spellcheck']) { $flags[] = 23; } // DoNotSpellCheck
|
178 |
-
if ($objattr['donotscroll']) { $flags[] = 24; } // DoNotScroll
|
179 |
-
$this->mpdf->SetTColor($objattr['color']);
|
180 |
-
$fieldalign = $rtlalign;
|
181 |
-
if ($texto == ' ') { $texto = ''; } // mPDF 5.3.24
|
182 |
-
if ($objattr['text_align']) { $fieldalign = $objattr['text_align']; }
|
183 |
-
// mPDF 5.3.25
|
184 |
-
$js = array();
|
185 |
-
if ($objattr['onCalculate']) { $js[] = array('C', $objattr['onCalculate']); }
|
186 |
-
if ($objattr['onValidate']) { $js[] = array('V', $objattr['onValidate']); }
|
187 |
-
if ($objattr['onFormat']) { $js[] = array('F', $objattr['onFormat']); }
|
188 |
-
if ($objattr['onKeystroke']) { $js[] = array('K', $objattr['onKeystroke']); }
|
189 |
-
$this->SetFormText( $w, $h, $objattr['fieldname'], $texto, $texto, $objattr['title'], $flags, $fieldalign , false, -1, $js, $objattr['background-col'], $objattr['border-col'] );
|
190 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
191 |
-
}
|
192 |
-
else {
|
193 |
-
$w -= $this->form_element_spacing['textarea']['outer']['h']*2 /$k ;
|
194 |
-
$h -= $this->form_element_spacing['textarea']['outer']['v']*2 /$k ;
|
195 |
-
$this->mpdf->x += $this->form_element_spacing['textarea']['outer']['h'] /$k ;
|
196 |
-
$this->mpdf->y += $this->form_element_spacing['textarea']['outer']['v'] /$k ;
|
197 |
-
$this->mpdf->SetLineWidth(0.2 /$k );
|
198 |
-
if (isset($objattr['disabled']) && $objattr['disabled']) {
|
199 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(225));
|
200 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(127));
|
201 |
-
}
|
202 |
-
else if (isset($objattr['readonly']) && $objattr['readonly']) {
|
203 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(225));
|
204 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
205 |
-
}
|
206 |
-
else {
|
207 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(250));
|
208 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
209 |
-
}
|
210 |
-
$this->mpdf->Rect($this->mpdf->x,$this->mpdf->y,$w,$h,'DF');
|
211 |
-
$w -= $this->form_element_spacing['textarea']['inner']['h']*2 /$k ;
|
212 |
-
$this->mpdf->x += $this->form_element_spacing['textarea']['inner']['h'] /$k ;
|
213 |
-
$this->mpdf->y += $this->form_element_spacing['textarea']['inner']['v'] /$k ;
|
214 |
-
$linesneeded = $this->mpdf->WordWrap($texto,$w);
|
215 |
-
if ($linesneeded > $objattr['rows']) { //Too many words inside textarea
|
216 |
-
$textoaux = explode("\n",$texto);
|
217 |
-
$texto = '';
|
218 |
-
for($i=0;$i<$objattr['rows'];$i++) {
|
219 |
-
if ($i == ($objattr['rows']-1)) $texto .= $textoaux[$i];
|
220 |
-
else $texto .= $textoaux[$i] . "\n";
|
221 |
-
}
|
222 |
-
$texto = mb_substr($texto,0,mb_strlen($texto,$this->mpdf->mb_enc)-4,$this->mpdf->mb_enc) . "...";
|
223 |
-
}
|
224 |
-
if ($texto != '') $this->mpdf->MultiCell($w,$this->mpdf->FontSize*$this->textarea_lineheight,$texto,0,'',0,'',$blockdir,true);
|
225 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(255));
|
226 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
227 |
-
}
|
228 |
-
}
|
229 |
-
|
230 |
-
function print_ob_select($objattr,$w,$h,$texto,$rtlalign,$k,$blockdir) {
|
231 |
-
// SELECT
|
232 |
-
if ($this->mpdf->useActiveForms) {
|
233 |
-
// Flags: 1 - Readonly; 2 - Required; 3 - No export; 19 - edit (only if combo)
|
234 |
-
$flags = array();
|
235 |
-
if ($objattr['disabled']) { $flags[] = 1; } // readonly
|
236 |
-
if ($objattr['disabled']) { $flags[] = 3; } // no export
|
237 |
-
if ($objattr['disabled']) { $objattr['color'] = array(3,128,128,128); } // gray out disabled
|
238 |
-
if ($objattr['required']) { $flags[] = 2; } // required
|
239 |
-
if ($objattr['multiple'] && $objattr['size']>1) { $flags[] = 22; } //flag 22 = multiselect (listbox)
|
240 |
-
if ($objattr['size']<2) {
|
241 |
-
$flags[] = 18; //flag 18 = combobox (else a listbox)
|
242 |
-
if ($objattr['editable']) { $flags[] = 19; } // editable
|
243 |
-
}
|
244 |
-
// only spellcheck if combo and editable
|
245 |
-
if (!$objattr['spellcheck'] || $objattr['size']>1 || !$objattr['editable']) { $flags[] = 23; } // DoNotSpellCheck
|
246 |
-
if ($objattr['subtype']=='PASSWORD') { $flags[] = 14; }
|
247 |
-
if ($objattr['onChange']) { $js = $objattr['onChange']; }
|
248 |
-
else { $js = ''; } // mPDF 5.3.37
|
249 |
-
$data = array('VAL' => array(), 'OPT' => array(), 'SEL' => array(), );
|
250 |
-
for($i=0; $i<count($objattr['items']); $i++) {
|
251 |
-
$item = $objattr['items'][$i];
|
252 |
-
$data['VAL'][] = $item['exportValue'];
|
253 |
-
$data['OPT'][] = $item['content'];
|
254 |
-
if ($item['selected']) { $data['SEL'][] = $i; }
|
255 |
-
}
|
256 |
-
if (count($data['SEL'])==0 && $this->formSelectDefaultOption) {$data['SEL'][] = 0; }
|
257 |
-
$this->mpdf->SetTColor($objattr['color']);
|
258 |
-
$this->SetFormChoice( $w, $h, $objattr['fieldname'], $flags, $data, $rtlalign, $js );
|
259 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
260 |
-
}
|
261 |
-
else {
|
262 |
-
$save_linemaxfontsize = $this->mpdf->linemaxfontsize;
|
263 |
-
$this->mpdf->linemaxfontsize = $this->mpdf->FontSize;
|
264 |
-
$this->mpdf->magic_reverse_dir($texto, false, $blockdir); // *RTL*
|
265 |
-
$this->mpdf->SetLineWidth(0.2 /$k );
|
266 |
-
if (isset($objattr['disabled']) && $objattr['disabled']) {
|
267 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(225));
|
268 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(127));
|
269 |
-
}
|
270 |
-
else {
|
271 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(250));
|
272 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
273 |
-
}
|
274 |
-
$w -= $this->form_element_spacing['select']['outer']['h']*2 /$k ;
|
275 |
-
$h -= $this->form_element_spacing['select']['outer']['v']*2 /$k ;
|
276 |
-
$this->mpdf->x += $this->form_element_spacing['select']['outer']['h'] /$k ;
|
277 |
-
$this->mpdf->y += $this->form_element_spacing['select']['outer']['v'] /$k ;
|
278 |
-
$this->mpdf->Cell($w-($this->mpdf->FontSize*1.4),$h,$texto,1,0,$rtlalign,1,'',0,$this->form_element_spacing['select']['inner']['h'] /$k,$this->form_element_spacing['select']['inner']['h'] /$k , 'M') ;
|
279 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(190));
|
280 |
-
$save_font = $this->mpdf->FontFamily;
|
281 |
-
$save_currentfont = $this->mpdf->currentfontfamily;
|
282 |
-
if ($this->mpdf->PDFA || $this->mpdf->PDFX) {
|
283 |
-
if (($this->mpdf->PDFA && !$this->mpdf->PDFAauto) || ($this->mpdf->PDFX && !$this->mpdf->PDFXauto)) { $this->mpdf->PDFAXwarnings[] = "Core Adobe font Zapfdingbats cannot be embedded in mPDF - used in Form element: Select - which is required for PDFA1-b or PDFX/1-a. (Different character/font will be substituted.)"; }
|
284 |
-
$this->mpdf->SetFont('sans');
|
285 |
-
if ($this->mpdf->_charDefined($this->mpdf->CurrentFont['cw'], 9660)) { $down = "\xe2\x96\xbc"; }
|
286 |
-
else { $down = '='; }
|
287 |
-
$this->mpdf->Cell(($this->mpdf->FontSize*1.4),$h,$down,1,0,'C',1,'',0,0,0, 'M') ;
|
288 |
-
}
|
289 |
-
else {
|
290 |
-
$this->mpdf->SetFont('czapfdingbats','',0);
|
291 |
-
$this->mpdf->Cell(($this->mpdf->FontSize*1.4),$h,chr(116),1,0,'C',1,'',0,0,0, 'M') ;
|
292 |
-
}
|
293 |
-
$this->mpdf->SetFont($save_font,'',0);
|
294 |
-
$this->mpdf->currentfontfamily = $save_currentfont;
|
295 |
-
$this->mpdf->linemaxfontsize = $save_linemaxfontsize;
|
296 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(255));
|
297 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
298 |
-
}
|
299 |
-
}
|
300 |
-
|
301 |
-
function print_ob_imageinput($objattr,$w,$h,$texto,$rtlalign,$k,$blockdir) {
|
302 |
-
// INPUT/BUTTON as IMAGE
|
303 |
-
if ($this->mpdf->useActiveForms) {
|
304 |
-
// Flags: 1 - Readonly; 3 - No export;
|
305 |
-
$flags = array();
|
306 |
-
if ($objattr['disabled']) { $flags[] = 1; } // readonly
|
307 |
-
if ($objattr['disabled']) { $flags[] = 3; } // no export
|
308 |
-
if ($objattr['onClick']) { $js = $objattr['onClick']; }
|
309 |
-
else { $js = ''; }
|
310 |
-
$this->SetJSButton( $w, $h, $objattr['fieldname'], $objattr['value'], $js, $objattr['ID'], $objattr['title'], $flags, $objattr['Indexed']);
|
311 |
-
}
|
312 |
-
else {
|
313 |
-
$this->mpdf->y = $objattr['INNER-Y'];
|
314 |
-
$this->mpdf->_out( sprintf("q %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q",$objattr['INNER-WIDTH'] *_MPDFK,$objattr['INNER-HEIGHT'] *_MPDFK,$objattr['INNER-X'] *_MPDFK,($this->mpdf->h-($objattr['INNER-Y'] +$objattr['INNER-HEIGHT'] ))*_MPDFK,$objattr['ID'] ) );
|
315 |
-
if (isset($objattr['BORDER-WIDTH']) && $objattr['BORDER-WIDTH']) { $this->mpdf->PaintImgBorder($objattr,$is_table); }
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
function print_ob_button($objattr,$w,$h,$texto,$rtlalign,$k,$blockdir) {
|
320 |
-
// BUTTON
|
321 |
-
if ($this->mpdf->useActiveForms) {
|
322 |
-
// Flags: 1 - Readonly; 3 - No export;
|
323 |
-
$flags = array();
|
324 |
-
if ($objattr['disabled']) { $flags[] = 1; } // readonly
|
325 |
-
if ($objattr['disabled']) { $flags[] = 3; } // no export
|
326 |
-
if ($objattr['disabled']) { $objattr['color'] = array(3,128,128,128); }
|
327 |
-
$this->mpdf->SetTColor($objattr['color']);
|
328 |
-
if ($objattr['subtype'] == 'RESET') {
|
329 |
-
$this->SetFormButtonText( $objattr['value'] );
|
330 |
-
$this->SetFormReset( $w, $h, $objattr['fieldname'], $objattr['value'], $objattr['title'], $flags, $objattr['background-col'], $objattr['border-col'], $objattr['noprint'] );
|
331 |
-
}
|
332 |
-
else if ($objattr['subtype'] == 'SUBMIT') {
|
333 |
-
$url = $this->formAction;
|
334 |
-
$type = $this->formExportType;
|
335 |
-
$method = $this->formMethod;
|
336 |
-
$this->SetFormButtonText( $objattr['value'] );
|
337 |
-
$this->SetFormSubmit( $w, $h, $objattr['fieldname'], $objattr['value'], $url, $objattr['title'], $type, $method, $flags, $objattr['background-col'], $objattr['border-col'], $objattr['noprint'] );
|
338 |
-
}
|
339 |
-
else if ($objattr['subtype'] == 'BUTTON') {
|
340 |
-
$this->SetFormButtonText( $objattr['value'] );
|
341 |
-
if ($objattr['onClick']) { $js = $objattr['onClick']; }
|
342 |
-
else { $js = ''; }
|
343 |
-
$this->SetJSButton( $w, $h, $objattr['fieldname'], $objattr['value'], $js, 0, $objattr['title'], $flags, false, $objattr['background-col'], $objattr['border-col'], $objattr['noprint'] );
|
344 |
-
}
|
345 |
-
$this->mpdf->SetTColor($this->mpdf->ConvertColor(0));
|
346 |
-
}
|
347 |
-
else {
|
348 |
-
$this->mpdf->SetLineWidth(0.2 /$k );
|
349 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(190));
|
350 |
-
$w -= $this->form_element_spacing['button']['outer']['h']*2 /$k ;
|
351 |
-
$h -= $this->form_element_spacing['button']['outer']['v']*2 /$k ;
|
352 |
-
$this->mpdf->x += $this->form_element_spacing['button']['outer']['h'] /$k ;
|
353 |
-
$this->mpdf->y += $this->form_element_spacing['button']['outer']['v'] /$k ;
|
354 |
-
$this->mpdf->RoundedRect($this->mpdf->x, $this->mpdf->y, $w, $h, 0.5 /$k , 'DF');
|
355 |
-
$w -= $this->form_element_spacing['button']['inner']['h']*2 /$k ;
|
356 |
-
$h -= $this->form_element_spacing['button']['inner']['v']*2 /$k ;
|
357 |
-
$this->mpdf->x += $this->form_element_spacing['button']['inner']['h'] /$k ;
|
358 |
-
$this->mpdf->y += $this->form_element_spacing['button']['inner']['v'] /$k ;
|
359 |
-
$save_linemaxfontsize = $this->mpdf->linemaxfontsize;
|
360 |
-
$this->mpdf->linemaxfontsize = $this->mpdf->FontSize;
|
361 |
-
$this->mpdf->magic_reverse_dir($texto, false, $blockdir); // *RTL*
|
362 |
-
$this->mpdf->Cell($w,$h,$texto,'',0,'C',0,'',0,0,0, 'M') ;
|
363 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(0));
|
364 |
-
$this->mpdf->linemaxfontsize = $save_linemaxfontsize;
|
365 |
-
}
|
366 |
-
}
|
367 |
-
|
368 |
-
function print_ob_checkbox($objattr,$w,$h,$texto,$rtlalign,$k,$blockdir,$x,$y) {
|
369 |
-
// CHECKBOX
|
370 |
-
if ($this->mpdf->useActiveForms) {
|
371 |
-
// Flags: 1 - Readonly; 2 - Required; 3 - No export;
|
372 |
-
$flags = array();
|
373 |
-
if ($objattr['disabled']) { $flags[] = 1; } // readonly
|
374 |
-
if ($objattr['disabled']) { $flags[] = 3; } // no export
|
375 |
-
$checked = false;
|
376 |
-
if ($objattr['checked']) { $checked = true; }
|
377 |
-
if ($this->formUseZapD) {
|
378 |
-
$save_font = $this->mpdf->FontFamily;
|
379 |
-
$save_currentfont = $this->mpdf->currentfontfamily;
|
380 |
-
$this->mpdf->SetFont('czapfdingbats','',0);
|
381 |
-
}
|
382 |
-
$this->SetCheckBox( $w, $h, $objattr['fieldname'], $objattr['value'], $objattr['title'], $checked, $flags, $objattr['disabled'] );
|
383 |
-
if ($this->formUseZapD) {
|
384 |
-
$this->mpdf->SetFont($save_font,'',0);
|
385 |
-
$this->mpdf->currentfontfamily = $save_currentfont;
|
386 |
-
}
|
387 |
-
}
|
388 |
-
else {
|
389 |
-
$iw = $w * 0.7;
|
390 |
-
$ih = $h * 0.7;
|
391 |
-
$lx = $x + (($w-$iw)/2);
|
392 |
-
$ty = $y + (($h-$ih)/2);
|
393 |
-
$rx = $lx + $iw;
|
394 |
-
$by = $ty + $ih;
|
395 |
-
$this->mpdf->SetLineWidth(0.2 /$k );
|
396 |
-
if (isset($objattr['disabled']) && $objattr['disabled']) {
|
397 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(225));
|
398 |
-
$this->mpdf->SetDColor($this->mpdf->ConvertColor(127));
|
399 |
-
}
|
400 |
-
else {
|
401 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(250));
|
402 |
-
$this->mpdf->SetDColor($this->mpdf->ConvertColor(0));
|
403 |
-
}
|
404 |
-
$this->mpdf->Rect($lx,$ty,$iw,$ih,'DF');
|
405 |
-
if (isset($objattr['checked']) && $objattr['checked']) {
|
406 |
-
//Round join and cap
|
407 |
-
$this->mpdf->SetLineCap(1);
|
408 |
-
$this->mpdf->Line($lx,$ty,$rx,$by);
|
409 |
-
$this->mpdf->Line($lx,$by,$rx,$ty);
|
410 |
-
//Set line cap style back to square
|
411 |
-
$this->mpdf->SetLineCap(2);
|
412 |
-
}
|
413 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(255));
|
414 |
-
$this->mpdf->SetDColor($this->mpdf->ConvertColor(0));
|
415 |
-
}
|
416 |
-
}
|
417 |
-
|
418 |
-
function print_ob_radio($objattr,$w,$h,$texto,$rtlalign,$k,$blockdir,$x,$y) {
|
419 |
-
// RADIO
|
420 |
-
if ($this->mpdf->useActiveForms) {
|
421 |
-
// Flags: 1 - Readonly; 2 - Required; 3 - No export;
|
422 |
-
$flags = array();
|
423 |
-
if ($objattr['disabled']) { $flags[] = 1; } // readonly
|
424 |
-
if ($objattr['disabled']) { $flags[] = 3; } // no export
|
425 |
-
$checked = false;
|
426 |
-
if ($objattr['checked']) { $checked = true; }
|
427 |
-
if ($this->formUseZapD) {
|
428 |
-
$save_font = $this->mpdf->FontFamily;
|
429 |
-
$save_currentfont = $this->mpdf->currentfontfamily;
|
430 |
-
$this->mpdf->SetFont('czapfdingbats','',0);
|
431 |
-
}
|
432 |
-
$this->SetRadio( $w, $h, $objattr['fieldname'], $objattr['value'], $objattr['title'], $checked, $flags, $objattr['disabled'] );
|
433 |
-
if ($this->formUseZapD) {
|
434 |
-
$this->mpdf->SetFont($save_font,'',0);
|
435 |
-
$this->mpdf->currentfontfamily = $save_currentfont;
|
436 |
-
}
|
437 |
-
}
|
438 |
-
else {
|
439 |
-
$this->mpdf->SetLineWidth(0.2 /$k );
|
440 |
-
$radius = $this->mpdf->FontSize *0.35;
|
441 |
-
$cx = $x + ($w/2);
|
442 |
-
$cy = $y + ($h/2);
|
443 |
-
if (isset($objattr['disabled']) && $objattr['disabled']) {
|
444 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(127));
|
445 |
-
$this->mpdf->SetDColor($this->mpdf->ConvertColor(127));
|
446 |
-
}
|
447 |
-
else {
|
448 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(0));
|
449 |
-
$this->mpdf->SetDColor($this->mpdf->ConvertColor(0));
|
450 |
-
}
|
451 |
-
$this->mpdf->Circle($cx,$cy,$radius,'D');
|
452 |
-
if (isset($objattr['checked']) && $objattr['checked']) {
|
453 |
-
$this->mpdf->Circle($cx,$cy,$radius*0.4,'DF');
|
454 |
-
}
|
455 |
-
$this->mpdf->SetFColor($this->mpdf->ConvertColor(255));
|
456 |
-
$this->mpdf->SetDColor($this->mpdf->ConvertColor(0));
|
457 |
-
|
458 |
-
}
|
459 |
-
}
|
460 |
-
|
461 |
-
|
462 |
-
// In _putpages
|
463 |
-
function countPageForms($n, &$totaladdnum) {
|
464 |
-
foreach( $this->forms as $form ) {
|
465 |
-
if ( $form['page'] == $n ) {
|
466 |
-
$totaladdnum++;
|
467 |
-
if ( $form['typ'] == 'Tx' ) {
|
468 |
-
if ( isset($this->array_form_text_js[$form['T']]) ) {
|
469 |
-
if ( isset($this->array_form_text_js[$form['T']]['F']) ) { $totaladdnum++; }
|
470 |
-
if ( isset($this->array_form_text_js[$form['T']]['K']) ) { $totaladdnum++; }
|
471 |
-
if ( isset($this->array_form_text_js[$form['T']]['V']) ) { $totaladdnum++; }
|
472 |
-
if ( isset($this->array_form_text_js[$form['T']]['C']) ) { $totaladdnum++; }
|
473 |
-
}
|
474 |
-
}
|
475 |
-
if ( $form['typ'] == 'Bt' ) {
|
476 |
-
if ( isset($this->array_form_button_js[$form['T']]) ) { $totaladdnum++; }
|
477 |
-
if ( isset($this->form_button_icon[$form['T']]) ) {
|
478 |
-
$totaladdnum++;
|
479 |
-
if ( $this->form_button_icon[$form['T']]['Indexed'] ) { $totaladdnum++; }
|
480 |
-
}
|
481 |
-
if ( $form['subtype'] == 'radio' ) { $totaladdnum+=2; }
|
482 |
-
else if ( $form['subtype'] == 'checkbox' && $this->formUseZapD ) { $totaladdnum++; }
|
483 |
-
else if ( $form['subtype'] == 'checkbox' && !$this->formUseZapD ) { $totaladdnum+=2; }
|
484 |
-
}
|
485 |
-
if ( $form['typ'] == 'Ch' ) {
|
486 |
-
if ( isset($this->array_form_choice_js[$form['T']]) ) { $totaladdnum++; }
|
487 |
-
}
|
488 |
-
}
|
489 |
-
}
|
490 |
-
}
|
491 |
-
|
492 |
-
// In _putpages
|
493 |
-
function addFormIds($n, &$s, &$annotid) {
|
494 |
-
foreach( $this->forms as $form ) {
|
495 |
-
if ( $form['page'] == $n ) {
|
496 |
-
$s .= ($annotid) . ' 0 R ';
|
497 |
-
$annotid++;
|
498 |
-
if ( $form['typ'] == 'Tx' ) {
|
499 |
-
if ( isset($this->array_form_text_js[$form['T']]) ) {
|
500 |
-
if ( isset($this->array_form_text_js[$form['T']]['F']) ) { $annotid++; }
|
501 |
-
if ( isset($this->array_form_text_js[$form['T']]['K']) ) { $annotid++; }
|
502 |
-
if ( isset($this->array_form_text_js[$form['T']]['V']) ) { $annotid++; }
|
503 |
-
if ( isset($this->array_form_text_js[$form['T']]['C']) ) { $annotid++; }
|
504 |
-
}
|
505 |
-
}
|
506 |
-
if ( $form['typ'] == 'Bt' ) {
|
507 |
-
if ( isset($this->array_form_button_js[$form['T']]) ) { $annotid++; }
|
508 |
-
if ( isset($this->form_button_icon[$form['T']]) ) {
|
509 |
-
$annotid++;
|
510 |
-
if ( $this->form_button_icon[$form['T']]['Indexed'] ) { $annotid++; }
|
511 |
-
}
|
512 |
-
if ( $form['subtype'] == 'radio' ) { $annotid+=2; }
|
513 |
-
else if ( $form['subtype'] == 'checkbox' && $this->formUseZapD ) { $annotid++; }
|
514 |
-
else if ( $form['subtype'] == 'checkbox' && !$this->formUseZapD ) { $annotid+=2; }
|
515 |
-
}
|
516 |
-
if ( $form['typ'] == 'Ch' ) {
|
517 |
-
if ( isset($this->array_form_choice_js[$form['T']]) ) { $annotid++; }
|
518 |
-
}
|
519 |
-
}
|
520 |
-
}
|
521 |
-
}
|
522 |
-
|
523 |
-
// In _putannots
|
524 |
-
function _putFormItems($n, $hPt) {
|
525 |
-
foreach( $this->forms as $val) {
|
526 |
-
if ( $val['page'] == $n ) {
|
527 |
-
if ( $val['typ'] == 'Tx' ) $this->_putform_tx( $val, $hPt );
|
528 |
-
if ( $val['typ'] == 'Ch' ) $this->_putform_ch( $val, $hPt );
|
529 |
-
if ( $val['typ'] == 'Bt' ) $this->_putform_bt( $val, $hPt );
|
530 |
-
}
|
531 |
-
}
|
532 |
-
}
|
533 |
-
|
534 |
-
// In _putannots
|
535 |
-
function _putRadioItems($n) {
|
536 |
-
// Output Radio Groups
|
537 |
-
$key = 1;
|
538 |
-
foreach($this->form_radio_groups AS $name=>$frg) {
|
539 |
-
$this->mpdf->_newobj();
|
540 |
-
$this->pdf_acro_array .= $this->mpdf->n.' 0 R ';
|
541 |
-
$this->mpdf->_out('<<');
|
542 |
-
$this->mpdf->_out('/Type /Annot ');
|
543 |
-
$this->mpdf->_out('/Subtype /Widget');
|
544 |
-
$this->mpdf->_out('/NM '.$this->mpdf->_textstring(sprintf('%04u-%04u', $n, (3000 + $key++))));
|
545 |
-
$this->mpdf->_out('/M '.$this->mpdf->_textstring('D:'.date('YmdHis')));
|
546 |
-
$this->mpdf->_out('/Rect [0 0 0 0] ');
|
547 |
-
$this->mpdf->_out('/FT /Btn ');
|
548 |
-
if ($frg['disabled']) { $flags=array(1,3,15,16); } // NoExport and readonly
|
549 |
-
else { $flags=array(15,16); } // Flags for Radiobutton, and NoToggleToOff
|
550 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($flags) );
|
551 |
-
$kstr = '';
|
552 |
-
$optstr = '';
|
553 |
-
foreach($frg['kids'] AS $kid) {
|
554 |
-
$kstr .= $this->forms[$kid['n']]['obj'].' 0 R ';
|
555 |
-
// $optstr .= ' '.$this->mpdf->_textstring($kid['OPT']).' ';
|
556 |
-
}
|
557 |
-
$this->mpdf->_out('/Kids [ '.$kstr.' ] '); // 11 0 R 12 0 R etc.
|
558 |
-
// $this->mpdf->_out('/Opt [ '.$optstr.' ] ');
|
559 |
-
|
560 |
-
//V entry holds index corresponding to the appearance state of
|
561 |
-
//whichever child field is currently in the on state = or Off
|
562 |
-
if (isset($frg['on'])) { $state = $frg['on']; }
|
563 |
-
else { $state = 'Off'; }
|
564 |
-
$this->mpdf->_out('/V /'.$state.' ');
|
565 |
-
$this->mpdf->_out('/DV /'.$state.' ');
|
566 |
-
$this->mpdf->_out('/T '.$this->mpdf->_textstring($name).' ');
|
567 |
-
$this->mpdf->_out('>>');
|
568 |
-
$this->mpdf->_out('endobj');
|
569 |
-
}
|
570 |
-
}
|
571 |
-
|
572 |
-
function _putFormsCatalog() {
|
573 |
-
if (isset($this->pdf_acro_array) ) {
|
574 |
-
$this->mpdf->_out('/AcroForm << /DA (/F1 0 Tf 0 g )');
|
575 |
-
$this->mpdf->_out('/Q 0');
|
576 |
-
$this->mpdf->_out('/Fields ['.$this->pdf_acro_array.']');
|
577 |
-
$f = '';
|
578 |
-
foreach($this->form_fonts AS $fn) {
|
579 |
-
if (is_array($this->mpdf->fonts[$fn]['n'])) { $this->mpdf->Error("Cannot use fonts with SMP or SIP characters for interactive Form elements"); }
|
580 |
-
$f .= '/F'.$this->mpdf->fonts[$fn]['i'].' '.$this->mpdf->fonts[$fn]['n'].' 0 R ';
|
581 |
-
}
|
582 |
-
$this->mpdf->_out('/DR << /Font << '.$f.' >> >>');
|
583 |
-
// CO Calculation Order
|
584 |
-
if ( $this->pdf_array_co ) {
|
585 |
-
$this->mpdf->_out('/CO ['.$this->pdf_array_co.']');
|
586 |
-
}
|
587 |
-
$this->mpdf->_out('/NeedAppearances true');
|
588 |
-
$this->mpdf->_out('>>');
|
589 |
-
}
|
590 |
-
}
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
function SetFormButtonJS( $name, $js ) {
|
595 |
-
$js = str_replace("\t",' ', trim($js) );
|
596 |
-
if ( isset($name) && isset($js) ) {
|
597 |
-
$this->array_form_button_js[$this->mpdf->_escape($name)] = array(
|
598 |
-
'js' => $js
|
599 |
-
);
|
600 |
-
}
|
601 |
-
}
|
602 |
-
|
603 |
-
function SetFormChoiceJS( $name, $js ) {
|
604 |
-
$js = str_replace("\t",' ', trim($js) );
|
605 |
-
if ( isset($name) && isset($js) ) {
|
606 |
-
$this->array_form_choice_js[$this->mpdf->_escape($name)] = array(
|
607 |
-
'js' => $js
|
608 |
-
);
|
609 |
-
}
|
610 |
-
}
|
611 |
-
|
612 |
-
function SetFormTextJS( $name, $js) {
|
613 |
-
for ($i=0; $i<count($js); $i++) {
|
614 |
-
$j = str_replace("\t",' ', trim($js[$i][1]) );
|
615 |
-
$format = $js[$i][0];
|
616 |
-
if ($name) {
|
617 |
-
$this->array_form_text_js[$this->mpdf->_escape($name)][$format] = array('js' => $j);
|
618 |
-
}
|
619 |
-
}
|
620 |
-
}
|
621 |
-
|
622 |
-
|
623 |
-
function Win1252ToPDFDocEncoding($txt) {
|
624 |
-
$Win1252ToPDFDocEncoding = array(
|
625 |
-
chr(0200) => chr(0240), chr(0214) => chr(0226), chr(0212) => chr(0227), chr(0237) => chr(0230),
|
626 |
-
chr(0225) => chr(0200), chr(0210) => chr(0032), chr(0206) => chr(0201), chr(0207) => chr(0202),
|
627 |
-
chr(0205) => chr(0203), chr(0227) => chr(0204), chr(0226) => chr(0205), chr(0203) => chr(0206),
|
628 |
-
chr(0213) => chr(0210), chr(0233) => chr(0211), chr(0211) => chr(0213), chr(0204) => chr(0214),
|
629 |
-
chr(0223) => chr(0215), chr(0224) => chr(0216), chr(0221) => chr(0217), chr(0222) => chr(0220),
|
630 |
-
chr(0202) => chr(0221), chr(0232) => chr(0235), chr(0230) => chr(0037), chr(0231) => chr(0222),
|
631 |
-
chr(0216) => chr(0231), chr(0240) => chr(0040)
|
632 |
-
); // mPDF 5.3.46
|
633 |
-
return strtr($txt, $Win1252ToPDFDocEncoding );
|
634 |
-
}
|
635 |
-
|
636 |
-
|
637 |
-
function SetFormText( $w, $h, $name, $value = '', $default = '', $title = '', $flags = array(), $align='L', $hidden = false, $maxlen=-1, $js='', $background_col=false, $border_col=false ) {
|
638 |
-
// Flags: 1 - Readonly; 2 - Required; 3 - No export; 13 - textarea; 14 - Password
|
639 |
-
$this->formn++;
|
640 |
-
if( $align == 'C' ) { $align = '1'; }
|
641 |
-
else if( $align == 'R' ) { $align = '2'; }
|
642 |
-
else { $align = '0'; }
|
643 |
-
if ($maxlen < 1) { $maxlen = false; }
|
644 |
-
if (!preg_match('/^[a-zA-Z0-9_:\-]+$/', $name)) {
|
645 |
-
$this->mpdf->Error("Field [".$name."] must have a name attribute, which can only contain letters, numbers, colon(:), undersore(_) or hyphen(-)");
|
646 |
-
}
|
647 |
-
if ($this->mpdf->onlyCoreFonts) {
|
648 |
-
$value = $this->Win1252ToPDFDocEncoding($value);
|
649 |
-
$default = $this->Win1252ToPDFDocEncoding($default);
|
650 |
-
$title = $this->Win1252ToPDFDocEncoding($title);
|
651 |
-
}
|
652 |
-
else {
|
653 |
-
if (isset($this->mpdf->CurrentFont['subset'])) {
|
654 |
-
$this->mpdf->UTF8StringToArray($value, true); // Add characters to font subset
|
655 |
-
$this->mpdf->UTF8StringToArray($default, true); // Add characters to font subset
|
656 |
-
$this->mpdf->UTF8StringToArray($title, true); // Add characters to font subset
|
657 |
-
}
|
658 |
-
if ($value) $value = $this->mpdf->UTF8ToUTF16BE($value, true);
|
659 |
-
if ($default ) $default = $this->mpdf->UTF8ToUTF16BE($default, true);
|
660 |
-
$title = $this->mpdf->UTF8ToUTF16BE($title, true);
|
661 |
-
}
|
662 |
-
if ($background_col) { $bg_c = $this->mpdf->SetColor($background_col, 'CodeOnly'); }
|
663 |
-
else { $bg_c = $this->form_background_color; }
|
664 |
-
if ($border_col) { $bc_c = $this->mpdf->SetColor($border_col, 'CodeOnly'); }
|
665 |
-
else { $bc_c = $this->form_border_color; }
|
666 |
-
$f = array( 'n' => $this->formn,
|
667 |
-
'typ' => 'Tx',
|
668 |
-
'page' => $this->mpdf->page,
|
669 |
-
'x' => $this->mpdf->x,
|
670 |
-
'y' => $this->mpdf->y,
|
671 |
-
'w' => $w,
|
672 |
-
'h' => $h,
|
673 |
-
'T' => $name,
|
674 |
-
'FF' => $flags,
|
675 |
-
'V' => $value,
|
676 |
-
'DV' => $default,
|
677 |
-
'TU' => $title,
|
678 |
-
'hidden' => $hidden,
|
679 |
-
'Q' => $align,
|
680 |
-
'maxlen' => $maxlen,
|
681 |
-
'BS_W' => $this->form_border_width,
|
682 |
-
'BS_S' => $this->form_border_style,
|
683 |
-
'BC_C' => $bc_c,
|
684 |
-
'BG_C' => $bg_c,
|
685 |
-
'style' => array(
|
686 |
-
'font' => $this->mpdf->FontFamily,
|
687 |
-
'fontsize' => $this->mpdf->FontSizePt,
|
688 |
-
'fontcolor' => $this->mpdf->TextColor,
|
689 |
-
)
|
690 |
-
);
|
691 |
-
if (is_array($js) && count($js)>0) { $this->SetFormTextJS( $name, $js); } // mPDF 5.3.25
|
692 |
-
if ($this->mpdf->keep_block_together) { $this->mpdf->ktForms[]= $f; }
|
693 |
-
else if ($this->mpdf->writingHTMLheader || $this->mpdf->writingHTMLfooter) { $this->mpdf->HTMLheaderPageForms[]= $f; }
|
694 |
-
else {
|
695 |
-
if ($this->mpdf->ColActive) {
|
696 |
-
$this->mpdf->columnbuffer[] = array('s' => 'ACROFORM', 'col' => $this->mpdf->CurrCol, 'x' => $this->mpdf->x, 'y' => $this->mpdf->y,
|
697 |
-
'h' => $h);
|
698 |
-
$this->mpdf->columnForms[$this->mpdf->CurrCol][INTVAL($this->mpdf->x)][INTVAL($this->mpdf->y)] = $this->formn;
|
699 |
-
}
|
700 |
-
$this->forms[$this->formn] = $f;
|
701 |
-
}
|
702 |
-
if (!in_array($this->mpdf->FontFamily, $this->form_fonts)) {
|
703 |
-
$this->form_fonts[] = $this->mpdf->FontFamily;
|
704 |
-
$this->mpdf->fonts[$this->mpdf->FontFamily]['used'] = true;
|
705 |
-
}
|
706 |
-
if ( !$hidden ) $this->mpdf->x += $w;
|
707 |
-
|
708 |
-
}
|
709 |
-
|
710 |
-
|
711 |
-
function SetFormChoice( $w, $h, $name, $flags, $array, $align='L', $js = '' ) {
|
712 |
-
$this->formn++;
|
713 |
-
if( $this->mpdf->blk[$this->mpdf->blklvl]['direction'] == 'rtl' ) { $align = '2'; }
|
714 |
-
else { $align = '0'; }
|
715 |
-
if (!preg_match('/^[a-zA-Z0-9_:\-]+$/', $name)) {
|
716 |
-
$this->mpdf->Error("Field [".$name."] must have a name attribute, which can only contain letters, numbers, colon(:), undersore(_) or hyphen(-)");
|
717 |
-
}
|
718 |
-
if ($this->mpdf->onlyCoreFonts) {
|
719 |
-
for($i=0;$i<count($array['VAL']);$i++) {
|
720 |
-
$array['VAL'][$i] = $this->Win1252ToPDFDocEncoding($array['VAL'][$i]);
|
721 |
-
$array['OPT'][$i] = $this->Win1252ToPDFDocEncoding($array['OPT'][$i]);
|
722 |
-
}
|
723 |
-
}
|
724 |
-
else {
|
725 |
-
for($i=0;$i<count($array['VAL']);$i++) {
|
726 |
-
if (isset($this->mpdf->CurrentFont['subset'])) {
|
727 |
-
$this->mpdf->UTF8StringToArray($array['VAL'][$i], true); // Add characters to font subset
|
728 |
-
$this->mpdf->UTF8StringToArray($array['OPT'][$i], true); // Add characters to font subset
|
729 |
-
}
|
730 |
-
if ($array['VAL'][$i] ) $array['VAL'][$i] = $this->mpdf->UTF8ToUTF16BE($array['VAL'][$i], true);
|
731 |
-
if ($array['OPT'][$i] ) $array['OPT'][$i] = $this->mpdf->UTF8ToUTF16BE($array['OPT'][$i], true);
|
732 |
-
}
|
733 |
-
}
|
734 |
-
$f = array( 'n' => $this->formn,
|
735 |
-
'typ' => 'Ch',
|
736 |
-
'page' => $this->mpdf->page,
|
737 |
-
'x' => $this->mpdf->x,
|
738 |
-
'y' => $this->mpdf->y,
|
739 |
-
'w' => $w,
|
740 |
-
'h' => $h,
|
741 |
-
'T' => $name,
|
742 |
-
'OPT' => $array,
|
743 |
-
'FF' => $flags,
|
744 |
-
'Q' => $align,
|
745 |
-
'BS_W' => $this->form_border_width,
|
746 |
-
'BS_S' => $this->form_border_style,
|
747 |
-
'BC_C' => $this->form_border_color,
|
748 |
-
'BG_C' => $this->form_background_color,
|
749 |
-
'style' => array(
|
750 |
-
'font' => $this->mpdf->FontFamily,
|
751 |
-
'fontsize' => $this->mpdf->FontSizePt,
|
752 |
-
'fontcolor' => $this->mpdf->TextColor,
|
753 |
-
)
|
754 |
-
);
|
755 |
-
if ($js) { $this->SetFormChoiceJS( $name, $js ); }
|
756 |
-
if ($this->mpdf->keep_block_together) { $this->mpdf->ktForms[]= $f; }
|
757 |
-
else if ($this->mpdf->writingHTMLheader || $this->mpdf->writingHTMLfooter) { $this->mpdf->HTMLheaderPageForms[]= $f; }
|
758 |
-
else {
|
759 |
-
if ($this->mpdf->ColActive) {
|
760 |
-
$this->mpdf->columnbuffer[] = array('s' => 'ACROFORM', 'col' => $this->mpdf->CurrCol, 'x' => $this->mpdf->x, 'y' => $this->mpdf->y,
|
761 |
-
'h' => $h);
|
762 |
-
$this->mpdf->columnForms[$this->mpdf->CurrCol][INTVAL($this->mpdf->x)][INTVAL($this->mpdf->y)] = $this->formn;
|
763 |
-
}
|
764 |
-
$this->forms[$this->formn] = $f;
|
765 |
-
}
|
766 |
-
if (!in_array($this->mpdf->FontFamily, $this->form_fonts)) {
|
767 |
-
$this->form_fonts[] = $this->mpdf->FontFamily;
|
768 |
-
$this->mpdf->fonts[$this->mpdf->FontFamily]['used'] = true;
|
769 |
-
}
|
770 |
-
$this->mpdf->x += $w;
|
771 |
-
}
|
772 |
-
|
773 |
-
// CHECKBOX
|
774 |
-
function SetCheckBox( $w, $h, $name, $value, $title = '', $checked = false, $flags = array(), $disabled=false ) {
|
775 |
-
$this->SetFormButton( $w, $h, $name, $value, 'checkbox', $title, $flags, $checked, $disabled );
|
776 |
-
$this->mpdf->x += $w;
|
777 |
-
}
|
778 |
-
|
779 |
-
|
780 |
-
// RADIO
|
781 |
-
function SetRadio( $w, $h, $name, $value, $title = '', $checked = false, $flags = array(), $disabled=false ) {
|
782 |
-
$this->SetFormButton( $w, $h, $name, $value, 'radio', $title, $flags, $checked, $disabled );
|
783 |
-
$this->mpdf->x += $w;
|
784 |
-
}
|
785 |
-
|
786 |
-
|
787 |
-
function SetFormReset( $w, $h, $name, $value = 'Reset', $title = '', $flags = array(), $background_col=false, $border_col=false, $noprint=false ) {
|
788 |
-
if (!$name) { $name = 'Reset'; }
|
789 |
-
$this->SetFormButton( $w, $h, $name, $value, 'reset', $title, $flags, false, false, $background_col, $border_col, $noprint);
|
790 |
-
$this->mpdf->x += $w;
|
791 |
-
}
|
792 |
-
|
793 |
-
|
794 |
-
function SetJSButton( $w, $h, $name, $value, $js, $image_id = 0, $title = '', $flags = array(), $indexed=false , $background_col=false, $border_col=false, $noprint=false ) {
|
795 |
-
$this->SetFormButton( $w, $h, $name, $value, 'js_button', $title, $flags, false, false, $background_col, $border_col, $noprint);
|
796 |
-
// pos => 1 = no caption, icon only; 0 = caption only
|
797 |
-
if ($image_id) {
|
798 |
-
$this->form_button_icon[$this->mpdf->_escape($name)] = array(
|
799 |
-
'pos' => 1,
|
800 |
-
'image_id' => $image_id,
|
801 |
-
'Indexed' => $indexed,
|
802 |
-
);
|
803 |
-
}
|
804 |
-
if ($js) { $this->SetFormButtonJS( $name, $js ); }
|
805 |
-
$this->mpdf->x += $w;
|
806 |
-
}
|
807 |
-
|
808 |
-
|
809 |
-
function SetFormSubmit( $w, $h, $name, $value = 'Submit', $url, $title = '', $typ = 'html', $method = 'POST', $flags = array(), $background_col=false, $border_col=false, $noprint=false) {
|
810 |
-
if (!$name) { $name = 'Submit'; }
|
811 |
-
$this->SetFormButton( $w, $h, $name, $value, 'submit', $title, $flags, false, false, $background_col, $border_col, $noprint);
|
812 |
-
$this->forms[$this->formn]['URL'] = $url;
|
813 |
-
$this->forms[$this->formn]['method'] = $method;
|
814 |
-
$this->forms[$this->formn]['exporttype'] = $typ;
|
815 |
-
$this->mpdf->x += $w;
|
816 |
-
}
|
817 |
-
|
818 |
-
|
819 |
-
function SetFormButtonText( $ca, $rc = '', $ac = '' ) {
|
820 |
-
if ($this->mpdf->onlyCoreFonts) {
|
821 |
-
$ca = $this->Win1252ToPDFDocEncoding($ca);
|
822 |
-
if ($rc) $rc = $this->Win1252ToPDFDocEncoding($rc);
|
823 |
-
if ($ac) $ac = $this->Win1252ToPDFDocEncoding($ac);
|
824 |
-
}
|
825 |
-
else {
|
826 |
-
if (isset($this->mpdf->CurrentFont['subset'])) {
|
827 |
-
$this->mpdf->UTF8StringToArray($ca, true); // Add characters to font subset
|
828 |
-
}
|
829 |
-
$ca = $this->mpdf->UTF8ToUTF16BE($ca, true);
|
830 |
-
if ($rc) {
|
831 |
-
if (isset($this->mpdf->CurrentFont['subset'])) { $this->mpdf->UTF8StringToArray($rc, true); }
|
832 |
-
$rc = $this->mpdf->UTF8ToUTF16BE($rc, true);
|
833 |
-
}
|
834 |
-
if ($ac) {
|
835 |
-
if (isset($this->mpdf->CurrentFont['subset'])) { $this->mpdf->UTF8StringToArray($ac, true); }
|
836 |
-
$ac = $this->mpdf->UTF8ToUTF16BE($ac, true);
|
837 |
-
}
|
838 |
-
}
|
839 |
-
$this->form_button_text = $ca;
|
840 |
-
$this->form_button_text_over = $rc ? $rc : $ca;
|
841 |
-
$this->form_button_text_click = $ac ? $ac : $ca;
|
842 |
-
}
|
843 |
-
|
844 |
-
|
845 |
-
function SetFormButton( $bb, $hh, $name, $value, $type, $title = '', $flags = array(), $checked=false, $disabled=false, $background_col=false, $border_col=false, $noprint=false ) {
|
846 |
-
$this->formn++;
|
847 |
-
if (!preg_match('/^[a-zA-Z0-9_:\-]+$/', $name)) {
|
848 |
-
$this->mpdf->Error("Field [".$name."] must have a name attribute, which can only contain letters, numbers, colon(:), undersore(_) or hyphen(-)");
|
849 |
-
}
|
850 |
-
if (!$this->mpdf->onlyCoreFonts) {
|
851 |
-
if (isset($this->mpdf->CurrentFont['subset'])) {
|
852 |
-
$this->mpdf->UTF8StringToArray($title, true); // Add characters to font subset
|
853 |
-
$this->mpdf->UTF8StringToArray($value, true); // Add characters to font subset
|
854 |
-
}
|
855 |
-
$title = $this->mpdf->UTF8ToUTF16BE($title, true);
|
856 |
-
if ($type == 'checkbox') {
|
857 |
-
$uvalue = $this->mpdf->UTF8ToUTF16BE($value, true);
|
858 |
-
}
|
859 |
-
else if ($type == 'radio') {
|
860 |
-
$uvalue = $this->mpdf->UTF8ToUTF16BE($value, true);
|
861 |
-
$value = mb_convert_encoding($value, 'Windows-1252', 'UTF-8');
|
862 |
-
}
|
863 |
-
else {
|
864 |
-
$value = $this->mpdf->UTF8ToUTF16BE($value, true);
|
865 |
-
$uvalue = $value;
|
866 |
-
}
|
867 |
-
}
|
868 |
-
else {
|
869 |
-
$title = $this->Win1252ToPDFDocEncoding($title);
|
870 |
-
$value = $this->Win1252ToPDFDocEncoding($value); //// ??? not needed
|
871 |
-
$uvalue = mb_convert_encoding($value, 'UTF-8', 'Windows-1252');
|
872 |
-
$uvalue = $this->mpdf->UTF8ToUTF16BE($uvalue, true);
|
873 |
-
}
|
874 |
-
if ($type == 'radio' || $type == 'checkbox') {
|
875 |
-
if (!preg_match('/^[a-zA-Z0-9_:\-\.]+$/', $value)) {
|
876 |
-
$this->mpdf->Error("Field '".$name."' must have a value, which can only contain letters, numbers, colon(:), undersore(_), hyphen(-) or period(.)");
|
877 |
-
}
|
878 |
-
}
|
879 |
-
if ($type == 'radio') {
|
880 |
-
if (!isset($this->form_radio_groups[$name])) {
|
881 |
-
$this->form_radio_groups[$name] = array(
|
882 |
-
'page' => $this->mpdf->page,
|
883 |
-
'kids' => array(),
|
884 |
-
);
|
885 |
-
}
|
886 |
-
$this->form_radio_groups[$name]['kids'][] = array(
|
887 |
-
'n' => $this->formn, 'V'=> $value, 'OPT'=>$uvalue, 'disabled'=>$disabled
|
888 |
-
);
|
889 |
-
if ( $checked ) { $this->form_radio_groups[$name]['on'] = $value; }
|
890 |
-
// Disable the whole radio group if one is disabled, because of inconsistency in PDF readers
|
891 |
-
if ( $disabled ) { $this->form_radio_groups[$name]['disabled'] = true; }
|
892 |
-
}
|
893 |
-
if ($type == 'checkbox') {
|
894 |
-
$this->form_checkboxes = true;
|
895 |
-
}
|
896 |
-
if ( $checked ) { $activ = 1; }
|
897 |
-
else { $activ = 0; }
|
898 |
-
if ($background_col) { $bg_c = $this->mpdf->SetColor($background_col, 'CodeOnly'); }
|
899 |
-
else { $bg_c = $this->form_button_background_color; }
|
900 |
-
if ($border_col) { $bc_c = $this->mpdf->SetColor($border_col, 'CodeOnly'); }
|
901 |
-
else { $bc_c = $this->form_button_border_color; }
|
902 |
-
$f = array( 'n' => $this->formn,
|
903 |
-
'typ' => 'Bt',
|
904 |
-
'page' => $this->mpdf->page,
|
905 |
-
'subtype' => $type,
|
906 |
-
'x' => $this->mpdf->x,
|
907 |
-
'y' => $this->mpdf->y,
|
908 |
-
'w' => $bb,
|
909 |
-
'h' => $hh,
|
910 |
-
'T' => $name,
|
911 |
-
'V' => $value,
|
912 |
-
'OPT' => $uvalue,
|
913 |
-
'TU' => $title,
|
914 |
-
'FF' => $flags,
|
915 |
-
'CA' => $this->form_button_text,
|
916 |
-
'RC' => $this->form_button_text_over,
|
917 |
-
'AC' => $this->form_button_text_click,
|
918 |
-
'BS_W' => $this->form_button_border_width,
|
919 |
-
'BS_S' => $this->form_button_border_style,
|
920 |
-
'BC_C' => $bc_c,
|
921 |
-
'BG_C' => $bg_c,
|
922 |
-
'activ' => $activ,
|
923 |
-
'disabled' => $disabled,
|
924 |
-
'noprint' => $noprint,
|
925 |
-
'style' => array(
|
926 |
-
'font' => $this->mpdf->FontFamily,
|
927 |
-
'fontsize' => $this->mpdf->FontSizePt,
|
928 |
-
'fontcolor' => $this->mpdf->TextColor,
|
929 |
-
)
|
930 |
-
);
|
931 |
-
if ($this->mpdf->keep_block_together) { $this->mpdf->ktForms[]= $f; }
|
932 |
-
else if ($this->mpdf->writingHTMLheader || $this->mpdf->writingHTMLfooter) { $this->mpdf->HTMLheaderPageForms[]= $f; }
|
933 |
-
else {
|
934 |
-
if ($this->mpdf->ColActive) {
|
935 |
-
$this->mpdf->columnbuffer[] = array('s' => 'ACROFORM', 'col' => $this->mpdf->CurrCol, 'x' => $this->mpdf->x, 'y' => $this->mpdf->y,
|
936 |
-
'h' => $hh);
|
937 |
-
$this->mpdf->columnForms[$this->mpdf->CurrCol][INTVAL($this->mpdf->x)][INTVAL($this->mpdf->y)] = $this->formn;
|
938 |
-
}
|
939 |
-
$this->forms[$this->formn] = $f;
|
940 |
-
}
|
941 |
-
if (!in_array($this->mpdf->FontFamily, $this->form_fonts)) {
|
942 |
-
$this->form_fonts[] = $this->mpdf->FontFamily;
|
943 |
-
$this->mpdf->fonts[$this->mpdf->FontFamily]['used'] = true;
|
944 |
-
}
|
945 |
-
|
946 |
-
$this->form_button_text = NULL;
|
947 |
-
$this->form_button_text_over = NULL;
|
948 |
-
$this->form_button_text_click = NULL;
|
949 |
-
}
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
function SetFormBorderWidth ( $string ) {
|
954 |
-
switch( $string ) {
|
955 |
-
case 'S': $this->form_border_width = '1';
|
956 |
-
break;
|
957 |
-
case 'M': $this->form_border_width = '2';
|
958 |
-
break;
|
959 |
-
case 'B': $this->form_border_width = '3';
|
960 |
-
break;
|
961 |
-
case '0': $this->form_border_width = '0';
|
962 |
-
break;
|
963 |
-
default: $this->form_border_width = '0';
|
964 |
-
break;
|
965 |
-
}
|
966 |
-
}
|
967 |
-
|
968 |
-
|
969 |
-
function SetFormBorderStyle ( $string ) {
|
970 |
-
switch( $string ) {
|
971 |
-
case 'S': $this->form_border_style = 'S';
|
972 |
-
break;
|
973 |
-
case 'D': $this->form_border_style = 'D /D [3]';
|
974 |
-
break;
|
975 |
-
case 'B': $this->form_border_style = 'B';
|
976 |
-
break;
|
977 |
-
case 'I': $this->form_border_style = 'I';
|
978 |
-
break;
|
979 |
-
case 'U': $this->form_border_style = 'U';
|
980 |
-
break;
|
981 |
-
default: $this->form_border_style = 'B';
|
982 |
-
break;
|
983 |
-
}
|
984 |
-
}
|
985 |
-
|
986 |
-
function SetFormBorderColor ( $r, $g=-1, $b=-1 ) {
|
987 |
-
if ( ($r==0 and $g==0 and $b==0) || $g==-1 )
|
988 |
-
$this->form_border_color = sprintf('%.3F', $r/255);
|
989 |
-
else
|
990 |
-
$this->form_border_color = sprintf('%.3F %.3F %.3F', $r/255, $g/255, $b/255);
|
991 |
-
}
|
992 |
-
|
993 |
-
function SetFormBackgroundColor ( $r, $g=-1, $b=-1 ) {
|
994 |
-
if ( ($r==0 and $g==0 and $b==0) || $g==-1 )
|
995 |
-
$this->form_background_color = sprintf('%.3F', $r/255);
|
996 |
-
else
|
997 |
-
$this->form_background_color = sprintf('%.3F %.3F %.3F', $r/255, $g/255, $b/255);
|
998 |
-
}
|
999 |
-
|
1000 |
-
function SetFormD ( $W, $S, $BC, $BG ) {
|
1001 |
-
$this->SetFormBorderWidth ( $W );
|
1002 |
-
$this->SetFormBorderStyle ( $S );
|
1003 |
-
$this->SetFormBorderColor ( $BC );
|
1004 |
-
$this->SetFormBackgroundColor ( $BG );
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
function _setflag( $array ) {
|
1008 |
-
$flag = 0;
|
1009 |
-
foreach($array as $val) { $flag += 1 << ($val-1); }
|
1010 |
-
return $flag;
|
1011 |
-
}
|
1012 |
-
|
1013 |
-
function _form_rect( $x, $y, $w, $h, $hPt ) {
|
1014 |
-
$x = $x * _MPDFK;
|
1015 |
-
$y = $hPt - ($y * _MPDFK);
|
1016 |
-
$x2 = $x + ($w * _MPDFK);
|
1017 |
-
$y2 = $y - ($h * _MPDFK);
|
1018 |
-
$rect = sprintf('%.3F %.3F %.3F %.3F', $x, $y2, $x2, $y );
|
1019 |
-
return $rect;
|
1020 |
-
}
|
1021 |
-
|
1022 |
-
|
1023 |
-
function _put_button_icon( $array , $w, $h ) {
|
1024 |
-
if (isset($array['image_id'])) {
|
1025 |
-
$info = false;
|
1026 |
-
foreach($this->mpdf->images AS $iid=>$img) {
|
1027 |
-
if ($img['i'] == $array['image_id']) {
|
1028 |
-
$info = $this->mpdf->images[$iid];
|
1029 |
-
break;
|
1030 |
-
}
|
1031 |
-
}
|
1032 |
-
}
|
1033 |
-
if (!$info) { die("Cannot find Button image"); }
|
1034 |
-
$this->mpdf->_newobj();
|
1035 |
-
$this->mpdf->_out('<<');
|
1036 |
-
$this->mpdf->_out('/Type /XObject');
|
1037 |
-
$this->mpdf->_out('/Subtype /Image');
|
1038 |
-
$this->mpdf->_out('/BBox [0 0 1 1]');
|
1039 |
-
$this->mpdf->_out('/Length '.strlen($info['data']));
|
1040 |
-
$this->mpdf->_out('/BitsPerComponent '.$info['bpc']);
|
1041 |
-
if ($info['cs']=='Indexed') {
|
1042 |
-
$this->mpdf->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->mpdf->n+1).' 0 R]');
|
1043 |
-
}
|
1044 |
-
else {
|
1045 |
-
$this->mpdf->_out('/ColorSpace /'.$info['cs']);
|
1046 |
-
if ($info['cs']=='DeviceCMYK')
|
1047 |
-
if($info['type']=='jpg') { $this->mpdf->_out('/Decode [1 0 1 0 1 0 1 0]'); }
|
1048 |
-
}
|
1049 |
-
if ( isset($info['f']) )
|
1050 |
-
$this->mpdf->_out('/Filter /'.$info['f']);
|
1051 |
-
if ( isset($info['parms']) )
|
1052 |
-
$this->mpdf->_out($info['parms']);
|
1053 |
-
$this->mpdf->_out('/Width '.$info['w']);
|
1054 |
-
$this->mpdf->_out('/Height '.$info['h']);
|
1055 |
-
$this->mpdf->_out('>>');
|
1056 |
-
$this->mpdf->_putstream($info['data']);
|
1057 |
-
$this->mpdf->_out('endobj');
|
1058 |
-
unset($array);
|
1059 |
-
//Palette
|
1060 |
-
if($info['cs']=='Indexed') {
|
1061 |
-
$filter=($this->mpdf->compress) ? '/Filter /FlateDecode ' : '';
|
1062 |
-
$this->mpdf->_newobj();
|
1063 |
-
$pal=($this->mpdf->compress) ? gzcompress($info['pal']) : $info['pal'];
|
1064 |
-
$this->mpdf->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
|
1065 |
-
$this->mpdf->_putstream($pal);
|
1066 |
-
$this->mpdf->_out('endobj');
|
1067 |
-
}
|
1068 |
-
|
1069 |
-
}
|
1070 |
-
|
1071 |
-
|
1072 |
-
function _putform_bt( $form, $hPt ) {
|
1073 |
-
$cc = 0;
|
1074 |
-
$put_xobject = 0;
|
1075 |
-
$put_js = 0;
|
1076 |
-
$put_icon = 0;
|
1077 |
-
$this->mpdf->_newobj();
|
1078 |
-
$n = $this->mpdf->n;
|
1079 |
-
if ($form['subtype'] != 'radio') $this->pdf_acro_array .= $n.' 0 R '; // Add to /Field element
|
1080 |
-
$this->forms[ $form['n'] ]['obj'] = $n;
|
1081 |
-
$this->mpdf->_out('<<');
|
1082 |
-
$this->mpdf->_out('/Type /Annot ');
|
1083 |
-
$this->mpdf->_out('/Subtype /Widget');
|
1084 |
-
$this->mpdf->_out('/NM '.$this->mpdf->_textstring(sprintf('%04u-%04u', $n, (7000 + $form['n']))));
|
1085 |
-
$this->mpdf->_out('/M '.$this->mpdf->_textstring('D:'.date('YmdHis')));
|
1086 |
-
$this->mpdf->_out('/Rect [ '.$this->_form_rect($form['x'],$form['y'],$form['w'],$form['h'], $hPt).' ]');
|
1087 |
-
$form['noprint'] ? $this->mpdf->_out('/F 0 ') : $this->mpdf->_out('/F 4 ');
|
1088 |
-
$this->mpdf->_out('/FT /Btn ');
|
1089 |
-
$this->mpdf->_out('/H /P ');
|
1090 |
-
if ( $form['subtype'] != 'radio' ) // mPDF 5.3.23
|
1091 |
-
$this->mpdf->_out('/T '.$this->mpdf->_textstring($form['T']) );
|
1092 |
-
$this->mpdf->_out('/TU '.$this->mpdf->_textstring($form['TU']) );
|
1093 |
-
if ( isset( $this->form_button_icon[ $form['T'] ] ) ) { $form['BS_W'] = 0; }
|
1094 |
-
if ($form['BS_W'] == 0) { $form['BC_C'] = $form['BG_C']; }
|
1095 |
-
$bstemp = '';
|
1096 |
-
$bstemp .= '/W '.$form['BS_W'].' ';
|
1097 |
-
$bstemp .= '/S /'.$form['BS_S'].' ';
|
1098 |
-
$temp = '';
|
1099 |
-
$temp .= '/BC [ '.$form['BC_C']." ] ";
|
1100 |
-
$temp .= '/BG [ '.$form['BG_C']." ] ";
|
1101 |
-
if ( $form['subtype'] == 'checkbox' ) {
|
1102 |
-
if ($form['disabled']) {
|
1103 |
-
$radio_color = '0.5 0.5 0.5';
|
1104 |
-
$radio_background_color = '0.9 0.9 0.9';
|
1105 |
-
}
|
1106 |
-
else {
|
1107 |
-
$radio_color = $this->form_radio_color;
|
1108 |
-
$radio_background_color = $this->form_radio_background_color;
|
1109 |
-
}
|
1110 |
-
$temp = '';
|
1111 |
-
$temp .= '/BC [ '.$radio_color." ] ";
|
1112 |
-
$temp .= '/BG [ '.$radio_background_color." ] ";
|
1113 |
-
$this->mpdf->_out("/BS << /W 1 /S /S >>");
|
1114 |
-
$this->mpdf->_out("/MK << $temp >>");
|
1115 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($form['FF']) );
|
1116 |
-
if ( $form['activ'] ) {
|
1117 |
-
$this->mpdf->_out('/V /'.$this->mpdf->_escape($form['V']).' ');
|
1118 |
-
$this->mpdf->_out('/DV /'.$this->mpdf->_escape($form['V']).' ');
|
1119 |
-
$this->mpdf->_out('/AS /'.$this->mpdf->_escape($form['V']).' ');
|
1120 |
-
} else {
|
1121 |
-
$this->mpdf->_out('/AS /Off ');
|
1122 |
-
}
|
1123 |
-
if ($this->formUseZapD) {
|
1124 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts['czapfdingbats']['i'].' 0 Tf '.$radio_color.' rg)');
|
1125 |
-
$this->mpdf->_out("/AP << /N << /".$this->mpdf->_escape($form['V'])." ".($this->mpdf->n+1)." 0 R /Off /Off >> >>");
|
1126 |
-
}
|
1127 |
-
else {
|
1128 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts[$this->mpdf->CurrentFont['fontkey']]['i'].' 0 Tf '.$radio_color.' rg)');
|
1129 |
-
$this->mpdf->_out("/AP << /N << /".$this->mpdf->_escape($form['V'])." ".($this->mpdf->n+1)." 0 R /Off ".($this->mpdf->n+2)." 0 R >> >>");
|
1130 |
-
}
|
1131 |
-
$this->mpdf->_out('/Opt [ '.$this->mpdf->_textstring($form['OPT']).' '.$this->mpdf->_textstring($form['OPT']).' ]');
|
1132 |
-
}
|
1133 |
-
|
1134 |
-
|
1135 |
-
if ( $form['subtype'] == 'radio' ) {
|
1136 |
-
if ($form['disabled'] || $this->form_radio_groups[$form['T']]['disabled']) {
|
1137 |
-
$radio_color = '0.5 0.5 0.5';
|
1138 |
-
$radio_background_color = '0.9 0.9 0.9';
|
1139 |
-
}
|
1140 |
-
else {
|
1141 |
-
$radio_color = $this->form_radio_color;
|
1142 |
-
$radio_background_color = $this->form_radio_background_color;
|
1143 |
-
}
|
1144 |
-
$this->mpdf->_out('/Parent '.$this->form_radio_groups[$form['T']]['obj_id'].' 0 R ');
|
1145 |
-
$temp = '';
|
1146 |
-
$temp .= '/BC [ '.$radio_color." ] ";
|
1147 |
-
$temp .= '/BG [ '.$radio_background_color." ] ";
|
1148 |
-
$this->mpdf->_out("/BS << /W 1 /S /S >>");
|
1149 |
-
$this->mpdf->_out('/MK << '.$temp.' >> ');
|
1150 |
-
$form['FF'][] = 16; // Radiobutton
|
1151 |
-
$form['FF'][] = 15; // NoToggleOff - must be same as radio button group setting?
|
1152 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($form['FF']) );
|
1153 |
-
if ($this->formUseZapD)
|
1154 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts['czapfdingbats']['i'].' 0 Tf '.$radio_color.' rg)');
|
1155 |
-
else
|
1156 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts[$this->mpdf->CurrentFont['fontkey']]['i'].' 0 Tf '.$radio_color.' rg)');
|
1157 |
-
$this->mpdf->_out("/AP << /N << /".$this->mpdf->_escape($form['V'])." ".($this->mpdf->n+1)." 0 R /Off ".($this->mpdf->n+2)." 0 R >> >>");
|
1158 |
-
if ( $form['activ'] ) {
|
1159 |
-
$this->mpdf->_out('/V /'.$this->mpdf->_escape($form['V']).' ');
|
1160 |
-
$this->mpdf->_out('/DV /'.$this->mpdf->_escape($form['V']).' ');
|
1161 |
-
$this->mpdf->_out('/AS /'.$this->mpdf->_escape($form['V']).' ');
|
1162 |
-
}
|
1163 |
-
else {
|
1164 |
-
$this->mpdf->_out('/AS /Off ');
|
1165 |
-
}
|
1166 |
-
$this->mpdf->_out("/AP << /N << /".$this->mpdf->_escape($form['V'])." ".($this->mpdf->n+1)." 0 R /Off ".($this->mpdf->n+2)." 0 R >> >>");
|
1167 |
-
// $this->mpdf->_out('/Opt [ '.$this->mpdf->_textstring($form['OPT']).' '.$this->mpdf->_textstring($form['OPT']).' ]');
|
1168 |
-
}
|
1169 |
-
|
1170 |
-
if ( $form['subtype'] == 'reset' ) {
|
1171 |
-
$temp .= $form['CA'] ? '/CA '.$this->mpdf->_textstring($form['CA']).' ' : '/CA '.$this->mpdf->_textstring($form['T']).' ';
|
1172 |
-
$temp .= $form['RC'] ? '/RC '.$this->mpdf->_textstring($form['RC']).' ' : '/RC '.$this->mpdf->_textstring($form['T']).' ';
|
1173 |
-
$temp .= $form['AC'] ? '/AC '.$this->mpdf->_textstring($form['AC']).' ' : '/AC '.$this->mpdf->_textstring($form['T']).' ';
|
1174 |
-
$this->mpdf->_out("/BS << $bstemp >>");
|
1175 |
-
$this->mpdf->_out('/MK << '.$temp.' >>');
|
1176 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts[$form['style']['font']]['i'].' '.$form['style']['fontsize'].' Tf '.$form['style']['fontcolor'].')');
|
1177 |
-
$this->mpdf->_out('/AA << /D << /S /ResetForm /Flags 1 >> >>');
|
1178 |
-
$form['FF'][] = 17;
|
1179 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($form['FF']) );
|
1180 |
-
}
|
1181 |
-
|
1182 |
-
|
1183 |
-
if ( $form['subtype'] == 'submit' ) {
|
1184 |
-
$temp .= $form['CA'] ? '/CA '.$this->mpdf->_textstring($form['CA']).' ' : '/CA '.$this->mpdf->_textstring($form['T']).' ';
|
1185 |
-
$temp .= $form['RC'] ? '/RC '.$this->mpdf->_textstring($form['RC']).' ' : '/RC '.$this->mpdf->_textstring($form['T']).' ';
|
1186 |
-
$temp .= $form['AC'] ? '/AC '.$this->mpdf->_textstring($form['AC']).' ' : '/AC '.$this->mpdf->_textstring($form['T']).' ';
|
1187 |
-
$this->mpdf->_out("/BS << $bstemp >>");
|
1188 |
-
$this->mpdf->_out("/MK << $temp >>");
|
1189 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts[$form['style']['font']]['i'].' '.$form['style']['fontsize'].' Tf '.$form['style']['fontcolor'].')');
|
1190 |
-
// Bit 4 (8) = useGETmethod else use POST
|
1191 |
-
// Bit 3 (4) = HTML export format (charset chosen by Adobe)--- OR ---
|
1192 |
-
// Bit 6 (32) = XFDF export format (form of XML in UTF-8)
|
1193 |
-
if ($form['exporttype'] == 'xfdf') { $flag = 32; } // 'xfdf' or 'html'
|
1194 |
-
else {
|
1195 |
-
if ($form['method'] == 'GET') { $flag = 12; }
|
1196 |
-
else { $flag = 4; }
|
1197 |
-
}
|
1198 |
-
// Bit 2 (2) = IncludeNoValueFields
|
1199 |
-
if ($this->formSubmitNoValueFields) $flag += 2;
|
1200 |
-
// To submit a value, needs to be in /AP dictionary, AND this object must contain a /Fields entry
|
1201 |
-
// listing all fields to output
|
1202 |
-
$this->mpdf->_out('/AA << /D << /S /SubmitForm /F ('.$form['URL'].') /Flags '.$flag.' >> >>');
|
1203 |
-
$form['FF'][] = 17;
|
1204 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($form['FF']) );
|
1205 |
-
}
|
1206 |
-
|
1207 |
-
if ( $form['subtype'] == 'js_button' ) {
|
1208 |
-
// Icon / image
|
1209 |
-
if ( isset( $this->form_button_icon[ $form['T'] ] ) ) {
|
1210 |
-
$cc++;
|
1211 |
-
$temp .= '/TP '.$this->form_button_icon[$form['T']]['pos'].' ';
|
1212 |
-
$temp .= '/I '.($cc + $this->mpdf->n).' 0 R '; // Normal icon
|
1213 |
-
$temp .= '/RI '.($cc + $this->mpdf->n).' 0 R '; // onMouseOver
|
1214 |
-
$temp .= '/IX '.($cc + $this->mpdf->n).' 0 R '; // onClick / onMouseDown
|
1215 |
-
$temp .= '/IF << /SW /A /S /A /A [0.0 0.0] >> '; // Icon fit dictionary
|
1216 |
-
if ($this->form_button_icon[ $form['T'] ]['Indexed']) { $cc++; }
|
1217 |
-
$put_icon = 1;
|
1218 |
-
}
|
1219 |
-
$temp .= $form['CA'] ? '/CA '.$this->mpdf->_textstring($form['CA']).' ' : '/CA '.$this->mpdf->_textstring($form['T']).' ';
|
1220 |
-
$temp .= $form['RC'] ? '/RC '.$this->mpdf->_textstring($form['RC']).' ' : '/RC '.$this->mpdf->_textstring($form['T']).' ';
|
1221 |
-
$temp .= $form['AC'] ? '/AC '.$this->mpdf->_textstring($form['AC']).' ' : '/AC '.$this->mpdf->_textstring($form['T']).' ';
|
1222 |
-
$this->mpdf->_out("/BS << $bstemp >>");
|
1223 |
-
$this->mpdf->_out("/MK << $temp >>");
|
1224 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts[$form['style']['font']]['i'].' '.$form['style']['fontsize'].' Tf '.$form['style']['fontcolor'].')');
|
1225 |
-
$form['FF'][] = 17;
|
1226 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($form['FF']) );
|
1227 |
-
// Javascript
|
1228 |
-
if ( isset($this->array_form_button_js[$form['T']]) ) {
|
1229 |
-
$cc++;
|
1230 |
-
$this->mpdf->_out("/AA << /D ".($cc + $this->mpdf->n)." 0 R >>");
|
1231 |
-
$put_js = 1;
|
1232 |
-
}
|
1233 |
-
}
|
1234 |
-
|
1235 |
-
$this->mpdf->_out('>>');
|
1236 |
-
$this->mpdf->_out('endobj');
|
1237 |
-
|
1238 |
-
// additional objects
|
1239 |
-
// obj icon
|
1240 |
-
if ( $put_icon == 1 ) {
|
1241 |
-
$this->_put_button_icon( $this->form_button_icon[ $form['T'] ], $form['w'], $form['h'] );
|
1242 |
-
$put_icon = NULL;
|
1243 |
-
}
|
1244 |
-
// obj + 1
|
1245 |
-
if ( $put_js == 1 ) {
|
1246 |
-
$this->mpdf->_set_object_javascript( $this->array_form_button_js[$form['T']]['js'] );
|
1247 |
-
unset( $this->array_form_button_js[$form['T']] );
|
1248 |
-
$put_js = NULL;
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
// RADIO and CHECK BOX appearance streams
|
1252 |
-
$filter=($this->mpdf->compress) ? '/Filter /FlateDecode ' : '';
|
1253 |
-
if ( $form['subtype'] == 'radio' ) {
|
1254 |
-
// output 2 appearance streams for radio buttons on/off
|
1255 |
-
if ($this->formUseZapD) {
|
1256 |
-
$fs = sprintf('%.3F', $form['style']['fontsize']*1.25);
|
1257 |
-
$fi = 'czapfdingbats';
|
1258 |
-
$r_on = 'q '.$radio_color .' rg BT /F'.$this->mpdf->fonts[$fi]['i'].' '.$fs.' Tf 0 0 Td (4) Tj ET Q';
|
1259 |
-
$r_off = 'q '.$radio_color .' rg BT /F'.$this->mpdf->fonts[$fi]['i'].' '.$fs.' Tf 0 0 Td (8) Tj ET Q';
|
1260 |
-
}
|
1261 |
-
else {
|
1262 |
-
$matrix = sprintf('%.3F 0 0 %.3F 0 %.3F', $form['style']['fontsize']*1.33/10, $form['style']['fontsize']*1.25/10, $form['style']['fontsize']);
|
1263 |
-
$fill = $radio_background_color.' rg 3.778 -7.410 m 2.800 -7.410 1.947 -7.047 1.225 -6.322 c 0.500 -5.600 0.138 -4.747 0.138 -3.769 c 0.138 -2.788 0.500 -1.938 1.225 -1.213 c 1.947 -0.491 2.800 -0.128 3.778 -0.128 c 4.757 -0.128 5.610 -0.491 6.334 -1.213 c 7.056 -1.938 7.419 -2.788 7.419 -3.769 c 7.419 -4.747 7.056 -5.600 6.334 -6.322 c 5.610 -7.047 4.757 -7.410 3.778 -7.410 c h f ';
|
1264 |
-
$circle = '3.778 -6.963 m 4.631 -6.963 5.375 -6.641 6.013 -6.004 c 6.653 -5.366 6.972 -4.619 6.972 -3.769 c 6.972 -2.916 6.653 -2.172 6.013 -1.532 c 5.375 -0.894 4.631 -0.576 3.778 -0.576 c 2.928 -0.576 2.182 -0.894 1.544 -1.532 c 0.904 -2.172 0.585 -2.916 0.585 -3.769 c 0.585 -4.619 0.904 -5.366 1.544 -6.004 c 2.182 -6.641 2.928 -6.963 3.778 -6.963 c h 3.778 -7.410 m 2.800 -7.410 1.947 -7.047 1.225 -6.322 c 0.500 -5.600 0.138 -4.747 0.138 -3.769 c 0.138 -2.788 0.500 -1.938 1.225 -1.213 c 1.947 -0.491 2.800 -0.128 3.778 -0.128 c 4.757 -0.128 5.610 -0.491 6.334 -1.213 c 7.056 -1.938 7.419 -2.788 7.419 -3.769 c 7.419 -4.747 7.056 -5.600 6.334 -6.322 c 5.610 -7.047 4.757 -7.410 3.778 -7.410 c h f ';
|
1265 |
-
$r_on = 'q '.$matrix.' cm '.$fill .$radio_color.' rg '.$circle.' '.$radio_color.' rg
|
1266 |
-
5.184 -5.110 m 4.800 -5.494 4.354 -5.685 3.841 -5.685 c 3.331 -5.685 2.885 -5.494 2.501 -5.110 c 2.119 -4.725 1.925 -4.279 1.925 -3.769 c 1.925 -3.257 2.119 -2.810 2.501 -2.429 c 2.885 -2.044 3.331 -1.853 3.841 -1.853 c 4.354 -1.853 4.800 -2.044 5.184 -2.429 c 5.566 -2.810 5.760 -3.257 5.760 -3.769 c 5.760 -4.279 5.566 -4.725 5.184 -5.110 c h
|
1267 |
-
f Q ';
|
1268 |
-
$r_off = 'q '.$matrix.' cm '.$fill .$radio_color.' rg '.$circle.' Q ';
|
1269 |
-
}
|
1270 |
-
|
1271 |
-
$this->mpdf->_newobj();
|
1272 |
-
$p=($this->mpdf->compress) ? gzcompress($r_on) : $r_on;
|
1273 |
-
$this->mpdf->_out('<<'.$filter.'/Length '.strlen($p).' /Resources 2 0 R>>');
|
1274 |
-
$this->mpdf->_putstream($p);
|
1275 |
-
$this->mpdf->_out('endobj');
|
1276 |
-
|
1277 |
-
$this->mpdf->_newobj();
|
1278 |
-
$p=($this->mpdf->compress) ? gzcompress($r_off) : $r_off;
|
1279 |
-
$this->mpdf->_out('<<'.$filter.'/Length '.strlen($p).' /Resources 2 0 R>>');
|
1280 |
-
$this->mpdf->_putstream($p);
|
1281 |
-
$this->mpdf->_out('endobj');
|
1282 |
-
}
|
1283 |
-
if ( $form['subtype'] == 'checkbox' ) {
|
1284 |
-
// First output appearance stream for check box on
|
1285 |
-
if ($this->formUseZapD) {
|
1286 |
-
$fs = sprintf('%.3F', $form['style']['fontsize']*1.25);
|
1287 |
-
$fi = 'czapfdingbats';
|
1288 |
-
$cb_on = 'q '.$radio_color .' rg BT /F'.$this->mpdf->fonts[$fi]['i'].' '.$fs.' Tf 0 0 Td (4) Tj ET Q';
|
1289 |
-
$cb_off = 'q '.$radio_color .' rg BT /F'.$this->mpdf->fonts[$fi]['i'].' '.$fs.' Tf 0 0 Td (8) Tj ET Q';
|
1290 |
-
}
|
1291 |
-
else {
|
1292 |
-
$matrix = sprintf('%.3F 0 0 %.3F 0 %.3F', $form['style']['fontsize']*1.33/10, $form['style']['fontsize']*1.25/10, $form['style']['fontsize']);
|
1293 |
-
$fill = $radio_background_color.' rg 7.395 -0.070 m 7.395 -7.344 l 0.121 -7.344 l 0.121 -0.070 l 7.395 -0.070 l h f ';
|
1294 |
-
$square = '0.508 -6.880 m 6.969 -6.880 l 6.969 -0.534 l 0.508 -0.534 l 0.508 -6.880 l h 7.395 -0.070 m 7.395 -7.344 l 0.121 -7.344 l 0.121 -0.070 l 7.395 -0.070 l h ';
|
1295 |
-
$cb_on = 'q '.$matrix.' cm '.$fill. $radio_color.' rg '.$square.' f '.$radio_color.' rg
|
1296 |
-
6.321 -1.352 m 5.669 -2.075 5.070 -2.801 4.525 -3.532 c 3.979 -4.262 3.508 -4.967 3.112 -5.649 c 3.080 -5.706 3.039 -5.779 2.993 -5.868 c 2.858 -6.118 2.638 -6.243 2.334 -6.243 c 2.194 -6.243 2.100 -6.231 2.052 -6.205 c 2.003 -6.180 1.954 -6.118 1.904 -6.020 c 1.787 -5.788 1.688 -5.523 1.604 -5.226 c 1.521 -4.930 1.480 -4.721 1.480 -4.600 c 1.480 -4.535 1.491 -4.484 1.512 -4.447 c 1.535 -4.410 1.579 -4.367 1.647 -4.319 c 1.733 -4.259 1.828 -4.210 1.935 -4.172 c 2.040 -4.134 2.131 -4.115 2.205 -4.115 c 2.267 -4.115 2.341 -4.232 2.429 -4.469 c 2.437 -4.494 2.444 -4.511 2.448 -4.522 c 2.451 -4.531 2.456 -4.546 2.465 -4.568 c 2.546 -4.795 2.614 -4.910 2.668 -4.910 c 2.714 -4.910 2.898 -4.652 3.219 -4.136 c 3.539 -3.620 3.866 -3.136 4.197 -2.683 c 4.426 -2.367 4.633 -2.103 4.816 -1.889 c 4.998 -1.676 5.131 -1.544 5.211 -1.493 c 5.329 -1.426 5.483 -1.368 5.670 -1.319 c 5.856 -1.271 6.066 -1.238 6.296 -1.217 c 6.321 -1.352 l h f Q ';
|
1297 |
-
$cb_off = 'q '.$matrix.' cm '.$fill. $radio_color.' rg '.$square.' f Q ';
|
1298 |
-
|
1299 |
-
}
|
1300 |
-
$this->mpdf->_newobj();
|
1301 |
-
$p=($this->mpdf->compress) ? gzcompress($cb_on) : $cb_on;
|
1302 |
-
$this->mpdf->_out('<<'.$filter.'/Length '.strlen($p).' /Resources 2 0 R>>');
|
1303 |
-
$this->mpdf->_putstream($p);
|
1304 |
-
$this->mpdf->_out('endobj');
|
1305 |
-
|
1306 |
-
// output appearance stream for check box off (only if not using ZapfDingbats)
|
1307 |
-
if (!$this->formUseZapD) {
|
1308 |
-
$this->mpdf->_newobj();
|
1309 |
-
$p=($this->mpdf->compress) ? gzcompress($cb_off) : $cb_off;
|
1310 |
-
$this->mpdf->_out('<<'.$filter.'/Length '.strlen($p).' /Resources 2 0 R>>');
|
1311 |
-
$this->mpdf->_putstream($p);
|
1312 |
-
$this->mpdf->_out('endobj');
|
1313 |
-
}
|
1314 |
-
|
1315 |
-
}
|
1316 |
-
return $n;
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
|
1320 |
-
function _putform_ch( $form, $hPt ) {
|
1321 |
-
$put_js = 0;
|
1322 |
-
$this->mpdf->_newobj();
|
1323 |
-
$n = $this->mpdf->n;
|
1324 |
-
$this->pdf_acro_array .= $n.' 0 R ';
|
1325 |
-
$this->forms[ $form['n'] ]['obj'] = $n;
|
1326 |
-
|
1327 |
-
$this->mpdf->_out('<<');
|
1328 |
-
$this->mpdf->_out('/Type /Annot ');
|
1329 |
-
$this->mpdf->_out('/Subtype /Widget');
|
1330 |
-
$this->mpdf->_out('/Rect [ '.$this->_form_rect($form['x'],$form['y'],$form['w'],$form['h'], $hPt).' ]');
|
1331 |
-
$this->mpdf->_out('/F 4');
|
1332 |
-
$this->mpdf->_out('/FT /Ch');
|
1333 |
-
if ($form['Q']) $this->mpdf->_out('/Q '.$form['Q'].'');
|
1334 |
-
$temp = '';
|
1335 |
-
$temp .= '/W '.$form['BS_W'].' ';
|
1336 |
-
$temp .= '/S /'.$form['BS_S'].' ';
|
1337 |
-
$this->mpdf->_out("/BS << $temp >>");
|
1338 |
-
|
1339 |
-
$temp = '';
|
1340 |
-
$temp .= '/BC [ '.$form['BC_C']." ] ";
|
1341 |
-
$temp .= '/BG [ '.$form['BG_C']." ] ";
|
1342 |
-
$this->mpdf->_out('/MK << '.$temp.' >>');
|
1343 |
-
|
1344 |
-
$this->mpdf->_out('/NM '.$this->mpdf->_textstring(sprintf('%04u-%04u', $n, (6000 + $form['n']))));
|
1345 |
-
$this->mpdf->_out('/M '.$this->mpdf->_textstring('D:'.date('YmdHis')));
|
1346 |
-
|
1347 |
-
$this->mpdf->_out('/T '.$this->mpdf->_textstring($form['T']) );
|
1348 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts[$form['style']['font']]['i'].' '.$form['style']['fontsize'].' Tf '.$form['style']['fontcolor'].')');
|
1349 |
-
|
1350 |
-
$opt = '';
|
1351 |
-
for( $i = 0; $i < count($form['OPT']['VAL']) ; $i++ ) {
|
1352 |
-
$opt .= '[ '.$this->mpdf->_textstring($form['OPT']['VAL'][$i]).' '.$this->mpdf->_textstring($form['OPT']['OPT'][$i]).' ] ';
|
1353 |
-
}
|
1354 |
-
$this->mpdf->_out('/Opt [ '.$opt.']');
|
1355 |
-
|
1356 |
-
// selected
|
1357 |
-
$selectItem = false;
|
1358 |
-
$selectIndex = false;
|
1359 |
-
foreach ( $form['OPT']['SEL'] as $selectKey => $selectVal ) {
|
1360 |
-
$selectName = $this->mpdf->_textstring($form['OPT']['VAL'][$selectVal]);
|
1361 |
-
$selectItem .= ' '.$selectName.' ';
|
1362 |
-
$selectIndex .= ' '.$selectVal.' ';
|
1363 |
-
}
|
1364 |
-
if ( $selectItem ) {
|
1365 |
-
if (count($form['OPT']['SEL']) < 2) {
|
1366 |
-
$this->mpdf->_out('/V '.$selectItem.' ');
|
1367 |
-
$this->mpdf->_out('/DV '.$selectItem.' ');
|
1368 |
-
}
|
1369 |
-
else {
|
1370 |
-
$this->mpdf->_out('/V ['.$selectItem.'] ');
|
1371 |
-
$this->mpdf->_out('/DV ['.$selectItem.'] ');
|
1372 |
-
}
|
1373 |
-
$this->mpdf->_out('/I ['.$selectIndex.'] ');
|
1374 |
-
}
|
1375 |
-
|
1376 |
-
if ( is_array($form['FF']) && count($form['FF'])>0 ) {
|
1377 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($form['FF']).' ');
|
1378 |
-
}
|
1379 |
-
// Javascript
|
1380 |
-
if ( isset($this->array_form_choice_js[$form['T']]) ) {
|
1381 |
-
$this->mpdf->_out("/AA << /V ".($this->mpdf->n+1)." 0 R >>");
|
1382 |
-
$put_js = 1;
|
1383 |
-
}
|
1384 |
-
|
1385 |
-
$this->mpdf->_out('>>');
|
1386 |
-
$this->mpdf->_out('endobj');
|
1387 |
-
// obj + 1
|
1388 |
-
if ( $put_js == 1 ) {
|
1389 |
-
$this->mpdf->_set_object_javascript( $this->array_form_choice_js[$form['T']]['js'] );
|
1390 |
-
unset( $this->array_form_choice_js[$form['T']] );
|
1391 |
-
$put_js = NULL;
|
1392 |
-
}
|
1393 |
-
|
1394 |
-
return $n;
|
1395 |
-
}
|
1396 |
-
|
1397 |
-
|
1398 |
-
function _putform_tx( $form, $hPt ) {
|
1399 |
-
$put_js = 0;
|
1400 |
-
$this->mpdf->_newobj();
|
1401 |
-
$n = $this->mpdf->n;
|
1402 |
-
$this->pdf_acro_array .= $n.' 0 R ';
|
1403 |
-
$this->forms[ $form['n'] ]['obj'] = $n;
|
1404 |
-
|
1405 |
-
$this->mpdf->_out('<<');
|
1406 |
-
$this->mpdf->_out('/Type /Annot ');
|
1407 |
-
$this->mpdf->_out('/Subtype /Widget ');
|
1408 |
-
|
1409 |
-
$this->mpdf->_out('/Rect [ '.$this->_form_rect($form['x'],$form['y'],$form['w'],$form['h'], $hPt).' ] ');
|
1410 |
-
$form['hidden'] ? $this->mpdf->_out('/F 2 ') : $this->mpdf->_out('/F 4 ');
|
1411 |
-
$this->mpdf->_out('/FT /Tx ');
|
1412 |
-
|
1413 |
-
$this->mpdf->_out('/H /N ');
|
1414 |
-
$this->mpdf->_out('/R 0 ');
|
1415 |
-
|
1416 |
-
if ( is_array($form['FF']) && count($form['FF'])>0 ) {
|
1417 |
-
$this->mpdf->_out('/Ff '.$this->_setflag($form['FF']).' ');
|
1418 |
-
}
|
1419 |
-
if ( isset($form['maxlen']) && $form['maxlen']>0 ) {
|
1420 |
-
$this->mpdf->_out('/MaxLen '.$form['maxlen']);
|
1421 |
-
}
|
1422 |
-
|
1423 |
-
$temp = '';
|
1424 |
-
$temp .= '/W '.$form['BS_W'].' ';
|
1425 |
-
$temp .= '/S /'.$form['BS_S'].' ';
|
1426 |
-
$this->mpdf->_out("/BS << $temp >>");
|
1427 |
-
|
1428 |
-
$temp = '';
|
1429 |
-
$temp .= '/BC [ '.$form['BC_C']." ] ";
|
1430 |
-
$temp .= '/BG [ '.$form['BG_C']." ] ";
|
1431 |
-
$this->mpdf->_out('/MK <<'.$temp.' >>');
|
1432 |
-
|
1433 |
-
$this->mpdf->_out('/T '.$this->mpdf->_textstring($form['T']) );
|
1434 |
-
$this->mpdf->_out('/TU '.$this->mpdf->_textstring($form['TU']) );
|
1435 |
-
if ($form['V'] || $form['V']==='0')
|
1436 |
-
$this->mpdf->_out('/V '.$this->mpdf->_textstring($form['V']) );
|
1437 |
-
$this->mpdf->_out('/DV '.$this->mpdf->_textstring($form['DV']) );
|
1438 |
-
$this->mpdf->_out('/DA (/F'.$this->mpdf->fonts[$form['style']['font']]['i'].' '.$form['style']['fontsize'].' Tf '.$form['style']['fontcolor'].')');
|
1439 |
-
if ( $form['Q'] ) $this->mpdf->_out('/Q '.$form['Q'].'');
|
1440 |
-
|
1441 |
-
$this->mpdf->_out('/NM '.$this->mpdf->_textstring(sprintf('%04u-%04u', $n, (5000 + $form['n']))));
|
1442 |
-
$this->mpdf->_out('/M '.$this->mpdf->_textstring('D:'.date('YmdHis')));
|
1443 |
-
|
1444 |
-
|
1445 |
-
if ( isset($this->array_form_text_js[$form['T']]) ) {
|
1446 |
-
$put_js = 1;
|
1447 |
-
$cc = 0;
|
1448 |
-
$js_str = '';
|
1449 |
-
|
1450 |
-
if ( isset($this->array_form_text_js[$form['T']]['F']) ) {
|
1451 |
-
$cc++;
|
1452 |
-
$js_str .= '/F '.($cc + $this->mpdf->n).' 0 R ';
|
1453 |
-
}
|
1454 |
-
if ( isset($this->array_form_text_js[$form['T']]['K']) ) {
|
1455 |
-
$cc++;
|
1456 |
-
$js_str .= '/K '.($cc + $this->mpdf->n).' 0 R ';
|
1457 |
-
}
|
1458 |
-
if ( isset($this->array_form_text_js[$form['T']]['V']) ) {
|
1459 |
-
$cc++;
|
1460 |
-
$js_str .= '/V '.($cc + $this->mpdf->n).' 0 R ';
|
1461 |
-
}
|
1462 |
-
if ( isset($this->array_form_text_js[$form['T']]['C']) ) {
|
1463 |
-
$cc++;
|
1464 |
-
$js_str .= '/C '.($cc + $this->mpdf->n).' 0 R ';
|
1465 |
-
$this->pdf_array_co .= $this->mpdf->n.' 0 R ';
|
1466 |
-
}
|
1467 |
-
$this->mpdf->_out('/AA << '.$js_str.' >>');
|
1468 |
-
}
|
1469 |
-
|
1470 |
-
$this->mpdf->_out('>>');
|
1471 |
-
$this->mpdf->_out('endobj');
|
1472 |
-
|
1473 |
-
if ( $put_js == 1 ) {
|
1474 |
-
if ( isset($this->array_form_text_js[$form['T']]['F']) ) {
|
1475 |
-
$this->mpdf->_set_object_javascript( $this->array_form_text_js[$form['T']]['F']['js'] );
|
1476 |
-
unset( $this->array_form_text_js[$form['T']]['F'] );
|
1477 |
-
}
|
1478 |
-
if ( isset($this->array_form_text_js[$form['T']]['K']) ) {
|
1479 |
-
$this->mpdf->_set_object_javascript( $this->array_form_text_js[$form['T']]['K']['js'] );
|
1480 |
-
unset( $this->array_form_text_js[$form['T']]['K'] );
|
1481 |
-
}
|
1482 |
-
if ( isset($this->array_form_text_js[$form['T']]['V']) ) {
|
1483 |
-
$this->mpdf->_set_object_javascript( $this->array_form_text_js[$form['T']]['V']['js'] );
|
1484 |
-
unset( $this->array_form_text_js[$form['T']]['V'] );
|
1485 |
-
}
|
1486 |
-
if ( isset($this->array_form_text_js[$form['T']]['C']) ) {
|
1487 |
-
$this->mpdf->_set_object_javascript( $this->array_form_text_js[$form['T']]['C']['js'] );
|
1488 |
-
unset( $this->array_form_text_js[$form['T']]['C'] );
|
1489 |
-
}
|
1490 |
-
}
|
1491 |
-
return $n;
|
1492 |
-
}
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
}
|
1497 |
-
|
1498 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/gif.php
DELETED
@@ -1,700 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
3 |
-
// 2009-12-22 Adapted for mPDF 4.2
|
4 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
5 |
-
// GIF Util - (C) 2003 Yamasoft (S/C)
|
6 |
-
// http://www.yamasoft.com
|
7 |
-
// All Rights Reserved
|
8 |
-
// This file can be freely copied, distributed, modified, updated by anyone under the only
|
9 |
-
// condition to leave the original address (Yamasoft, http://www.yamasoft.com) and this header.
|
10 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
// 2009-12-22 Adapted INB
|
13 |
-
// Functions calling functionname($x, $len = 0) were not working on PHP5.1.5 as pass by reference
|
14 |
-
// All edited to $len = 0; then call function.
|
15 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
16 |
-
|
17 |
-
|
18 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
-
|
20 |
-
class CGIFLZW
|
21 |
-
{
|
22 |
-
var $MAX_LZW_BITS;
|
23 |
-
var $Fresh, $CodeSize, $SetCodeSize, $MaxCode, $MaxCodeSize, $FirstCode, $OldCode;
|
24 |
-
var $ClearCode, $EndCode, $Next, $Vals, $Stack, $sp, $Buf, $CurBit, $LastBit, $Done, $LastByte;
|
25 |
-
|
26 |
-
///////////////////////////////////////////////////////////////////////////
|
27 |
-
|
28 |
-
// CONSTRUCTOR
|
29 |
-
function CGIFLZW()
|
30 |
-
{
|
31 |
-
$this->MAX_LZW_BITS = 12;
|
32 |
-
unSet($this->Next);
|
33 |
-
unSet($this->Vals);
|
34 |
-
unSet($this->Stack);
|
35 |
-
unSet($this->Buf);
|
36 |
-
|
37 |
-
$this->Next = range(0, (1 << $this->MAX_LZW_BITS) - 1);
|
38 |
-
$this->Vals = range(0, (1 << $this->MAX_LZW_BITS) - 1);
|
39 |
-
$this->Stack = range(0, (1 << ($this->MAX_LZW_BITS + 1)) - 1);
|
40 |
-
$this->Buf = range(0, 279);
|
41 |
-
}
|
42 |
-
|
43 |
-
///////////////////////////////////////////////////////////////////////////
|
44 |
-
|
45 |
-
function deCompress($data, &$datLen)
|
46 |
-
{
|
47 |
-
$stLen = strlen($data);
|
48 |
-
$datLen = 0;
|
49 |
-
$ret = "";
|
50 |
-
$dp = 0; // data pointer
|
51 |
-
|
52 |
-
// INITIALIZATION
|
53 |
-
$this->LZWCommandInit($data, $dp);
|
54 |
-
|
55 |
-
while(($iIndex = $this->LZWCommand($data, $dp)) >= 0) {
|
56 |
-
$ret .= chr($iIndex);
|
57 |
-
}
|
58 |
-
|
59 |
-
$datLen = $dp;
|
60 |
-
|
61 |
-
if($iIndex != -2) {
|
62 |
-
return false;
|
63 |
-
}
|
64 |
-
|
65 |
-
return $ret;
|
66 |
-
}
|
67 |
-
|
68 |
-
///////////////////////////////////////////////////////////////////////////
|
69 |
-
function LZWCommandInit(&$data, &$dp)
|
70 |
-
{
|
71 |
-
$this->SetCodeSize = ord($data[0]);
|
72 |
-
$dp += 1;
|
73 |
-
|
74 |
-
$this->CodeSize = $this->SetCodeSize + 1;
|
75 |
-
$this->ClearCode = 1 << $this->SetCodeSize;
|
76 |
-
$this->EndCode = $this->ClearCode + 1;
|
77 |
-
$this->MaxCode = $this->ClearCode + 2;
|
78 |
-
$this->MaxCodeSize = $this->ClearCode << 1;
|
79 |
-
|
80 |
-
$this->GetCodeInit($data, $dp);
|
81 |
-
|
82 |
-
$this->Fresh = 1;
|
83 |
-
for($i = 0; $i < $this->ClearCode; $i++) {
|
84 |
-
$this->Next[$i] = 0;
|
85 |
-
$this->Vals[$i] = $i;
|
86 |
-
}
|
87 |
-
|
88 |
-
for(; $i < (1 << $this->MAX_LZW_BITS); $i++) {
|
89 |
-
$this->Next[$i] = 0;
|
90 |
-
$this->Vals[$i] = 0;
|
91 |
-
}
|
92 |
-
|
93 |
-
$this->sp = 0;
|
94 |
-
return 1;
|
95 |
-
}
|
96 |
-
|
97 |
-
function LZWCommand(&$data, &$dp)
|
98 |
-
{
|
99 |
-
if($this->Fresh) {
|
100 |
-
$this->Fresh = 0;
|
101 |
-
do {
|
102 |
-
$this->FirstCode = $this->GetCode($data, $dp);
|
103 |
-
$this->OldCode = $this->FirstCode;
|
104 |
-
}
|
105 |
-
while($this->FirstCode == $this->ClearCode);
|
106 |
-
|
107 |
-
return $this->FirstCode;
|
108 |
-
}
|
109 |
-
|
110 |
-
if($this->sp > 0) {
|
111 |
-
$this->sp--;
|
112 |
-
return $this->Stack[$this->sp];
|
113 |
-
}
|
114 |
-
|
115 |
-
while(($Code = $this->GetCode($data, $dp)) >= 0) {
|
116 |
-
if($Code == $this->ClearCode) {
|
117 |
-
for($i = 0; $i < $this->ClearCode; $i++) {
|
118 |
-
$this->Next[$i] = 0;
|
119 |
-
$this->Vals[$i] = $i;
|
120 |
-
}
|
121 |
-
|
122 |
-
for(; $i < (1 << $this->MAX_LZW_BITS); $i++) {
|
123 |
-
$this->Next[$i] = 0;
|
124 |
-
$this->Vals[$i] = 0;
|
125 |
-
}
|
126 |
-
|
127 |
-
$this->CodeSize = $this->SetCodeSize + 1;
|
128 |
-
$this->MaxCodeSize = $this->ClearCode << 1;
|
129 |
-
$this->MaxCode = $this->ClearCode + 2;
|
130 |
-
$this->sp = 0;
|
131 |
-
$this->FirstCode = $this->GetCode($data, $dp);
|
132 |
-
$this->OldCode = $this->FirstCode;
|
133 |
-
|
134 |
-
return $this->FirstCode;
|
135 |
-
}
|
136 |
-
|
137 |
-
if($Code == $this->EndCode) {
|
138 |
-
return -2;
|
139 |
-
}
|
140 |
-
|
141 |
-
$InCode = $Code;
|
142 |
-
if($Code >= $this->MaxCode) {
|
143 |
-
$this->Stack[$this->sp++] = $this->FirstCode;
|
144 |
-
$Code = $this->OldCode;
|
145 |
-
}
|
146 |
-
|
147 |
-
while($Code >= $this->ClearCode) {
|
148 |
-
$this->Stack[$this->sp++] = $this->Vals[$Code];
|
149 |
-
|
150 |
-
if($Code == $this->Next[$Code]) // Circular table entry, big GIF Error!
|
151 |
-
return -1;
|
152 |
-
|
153 |
-
$Code = $this->Next[$Code];
|
154 |
-
}
|
155 |
-
|
156 |
-
$this->FirstCode = $this->Vals[$Code];
|
157 |
-
$this->Stack[$this->sp++] = $this->FirstCode;
|
158 |
-
|
159 |
-
if(($Code = $this->MaxCode) < (1 << $this->MAX_LZW_BITS)) {
|
160 |
-
$this->Next[$Code] = $this->OldCode;
|
161 |
-
$this->Vals[$Code] = $this->FirstCode;
|
162 |
-
$this->MaxCode++;
|
163 |
-
|
164 |
-
if(($this->MaxCode >= $this->MaxCodeSize) && ($this->MaxCodeSize < (1 << $this->MAX_LZW_BITS))) {
|
165 |
-
$this->MaxCodeSize *= 2;
|
166 |
-
$this->CodeSize++;
|
167 |
-
}
|
168 |
-
}
|
169 |
-
|
170 |
-
$this->OldCode = $InCode;
|
171 |
-
if($this->sp > 0) {
|
172 |
-
$this->sp--;
|
173 |
-
return $this->Stack[$this->sp];
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
return $Code;
|
178 |
-
}
|
179 |
-
|
180 |
-
///////////////////////////////////////////////////////////////////////////
|
181 |
-
|
182 |
-
function GetCodeInit(&$data, &$dp)
|
183 |
-
{
|
184 |
-
$this->CurBit = 0;
|
185 |
-
$this->LastBit = 0;
|
186 |
-
$this->Done = 0;
|
187 |
-
$this->LastByte = 2;
|
188 |
-
return 1;
|
189 |
-
}
|
190 |
-
|
191 |
-
function GetCode(&$data, &$dp)
|
192 |
-
{
|
193 |
-
if(($this->CurBit + $this->CodeSize) >= $this->LastBit) {
|
194 |
-
if($this->Done) {
|
195 |
-
if($this->CurBit >= $this->LastBit) {
|
196 |
-
// Ran off the end of my bits
|
197 |
-
return 0;
|
198 |
-
}
|
199 |
-
return -1;
|
200 |
-
}
|
201 |
-
|
202 |
-
$this->Buf[0] = $this->Buf[$this->LastByte - 2];
|
203 |
-
$this->Buf[1] = $this->Buf[$this->LastByte - 1];
|
204 |
-
|
205 |
-
$Count = ord($data[$dp]);
|
206 |
-
$dp += 1;
|
207 |
-
|
208 |
-
if($Count) {
|
209 |
-
for($i = 0; $i < $Count; $i++) {
|
210 |
-
$this->Buf[2 + $i] = ord($data[$dp+$i]);
|
211 |
-
}
|
212 |
-
$dp += $Count;
|
213 |
-
}
|
214 |
-
else {
|
215 |
-
$this->Done = 1;
|
216 |
-
}
|
217 |
-
|
218 |
-
$this->LastByte = 2 + $Count;
|
219 |
-
$this->CurBit = ($this->CurBit - $this->LastBit) + 16;
|
220 |
-
$this->LastBit = (2 + $Count) << 3;
|
221 |
-
}
|
222 |
-
|
223 |
-
$iRet = 0;
|
224 |
-
for($i = $this->CurBit, $j = 0; $j < $this->CodeSize; $i++, $j++) {
|
225 |
-
$iRet |= (($this->Buf[intval($i / 8)] & (1 << ($i % 8))) != 0) << $j;
|
226 |
-
}
|
227 |
-
|
228 |
-
$this->CurBit += $this->CodeSize;
|
229 |
-
return $iRet;
|
230 |
-
}
|
231 |
-
}
|
232 |
-
|
233 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
234 |
-
|
235 |
-
class CGIFCOLORTABLE
|
236 |
-
{
|
237 |
-
var $m_nColors;
|
238 |
-
var $m_arColors;
|
239 |
-
|
240 |
-
///////////////////////////////////////////////////////////////////////////
|
241 |
-
|
242 |
-
// CONSTRUCTOR
|
243 |
-
function CGIFCOLORTABLE()
|
244 |
-
{
|
245 |
-
unSet($this->m_nColors);
|
246 |
-
unSet($this->m_arColors);
|
247 |
-
}
|
248 |
-
|
249 |
-
///////////////////////////////////////////////////////////////////////////
|
250 |
-
|
251 |
-
function load($lpData, $num)
|
252 |
-
{
|
253 |
-
$this->m_nColors = 0;
|
254 |
-
$this->m_arColors = array();
|
255 |
-
|
256 |
-
for($i = 0; $i < $num; $i++) {
|
257 |
-
$rgb = substr($lpData, $i * 3, 3);
|
258 |
-
if(strlen($rgb) < 3) {
|
259 |
-
return false;
|
260 |
-
}
|
261 |
-
|
262 |
-
$this->m_arColors[] = (ord($rgb[2]) << 16) + (ord($rgb[1]) << 8) + ord($rgb[0]);
|
263 |
-
$this->m_nColors++;
|
264 |
-
}
|
265 |
-
|
266 |
-
return true;
|
267 |
-
}
|
268 |
-
|
269 |
-
///////////////////////////////////////////////////////////////////////////
|
270 |
-
|
271 |
-
function toString()
|
272 |
-
{
|
273 |
-
$ret = "";
|
274 |
-
|
275 |
-
for($i = 0; $i < $this->m_nColors; $i++) {
|
276 |
-
$ret .=
|
277 |
-
chr(($this->m_arColors[$i] & 0x000000FF)) . // R
|
278 |
-
chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G
|
279 |
-
chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B
|
280 |
-
}
|
281 |
-
|
282 |
-
return $ret;
|
283 |
-
}
|
284 |
-
|
285 |
-
|
286 |
-
///////////////////////////////////////////////////////////////////////////
|
287 |
-
|
288 |
-
function colorIndex($rgb)
|
289 |
-
{
|
290 |
-
$rgb = intval($rgb) & 0xFFFFFF;
|
291 |
-
$r1 = ($rgb & 0x0000FF);
|
292 |
-
$g1 = ($rgb & 0x00FF00) >> 8;
|
293 |
-
$b1 = ($rgb & 0xFF0000) >> 16;
|
294 |
-
$idx = -1;
|
295 |
-
|
296 |
-
for($i = 0; $i < $this->m_nColors; $i++) {
|
297 |
-
$r2 = ($this->m_arColors[$i] & 0x000000FF);
|
298 |
-
$g2 = ($this->m_arColors[$i] & 0x0000FF00) >> 8;
|
299 |
-
$b2 = ($this->m_arColors[$i] & 0x00FF0000) >> 16;
|
300 |
-
$d = abs($r2 - $r1) + abs($g2 - $g1) + abs($b2 - $b1);
|
301 |
-
|
302 |
-
if(($idx == -1) || ($d < $dif)) {
|
303 |
-
$idx = $i;
|
304 |
-
$dif = $d;
|
305 |
-
}
|
306 |
-
}
|
307 |
-
|
308 |
-
return $idx;
|
309 |
-
}
|
310 |
-
}
|
311 |
-
|
312 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
313 |
-
|
314 |
-
class CGIFFILEHEADER
|
315 |
-
{
|
316 |
-
var $m_lpVer;
|
317 |
-
var $m_nWidth;
|
318 |
-
var $m_nHeight;
|
319 |
-
var $m_bGlobalClr;
|
320 |
-
var $m_nColorRes;
|
321 |
-
var $m_bSorted;
|
322 |
-
var $m_nTableSize;
|
323 |
-
var $m_nBgColor;
|
324 |
-
var $m_nPixelRatio;
|
325 |
-
var $m_colorTable;
|
326 |
-
|
327 |
-
///////////////////////////////////////////////////////////////////////////
|
328 |
-
|
329 |
-
// CONSTRUCTOR
|
330 |
-
function CGIFFILEHEADER()
|
331 |
-
{
|
332 |
-
unSet($this->m_lpVer);
|
333 |
-
unSet($this->m_nWidth);
|
334 |
-
unSet($this->m_nHeight);
|
335 |
-
unSet($this->m_bGlobalClr);
|
336 |
-
unSet($this->m_nColorRes);
|
337 |
-
unSet($this->m_bSorted);
|
338 |
-
unSet($this->m_nTableSize);
|
339 |
-
unSet($this->m_nBgColor);
|
340 |
-
unSet($this->m_nPixelRatio);
|
341 |
-
unSet($this->m_colorTable);
|
342 |
-
}
|
343 |
-
|
344 |
-
///////////////////////////////////////////////////////////////////////////
|
345 |
-
|
346 |
-
function load($lpData, &$hdrLen)
|
347 |
-
{
|
348 |
-
$hdrLen = 0;
|
349 |
-
|
350 |
-
$this->m_lpVer = substr($lpData, 0, 6);
|
351 |
-
if(($this->m_lpVer <> "GIF87a") && ($this->m_lpVer <> "GIF89a")) {
|
352 |
-
return false;
|
353 |
-
}
|
354 |
-
|
355 |
-
$this->m_nWidth = $this->w2i(substr($lpData, 6, 2));
|
356 |
-
$this->m_nHeight = $this->w2i(substr($lpData, 8, 2));
|
357 |
-
if(!$this->m_nWidth || !$this->m_nHeight) {
|
358 |
-
return false;
|
359 |
-
}
|
360 |
-
|
361 |
-
$b = ord(substr($lpData, 10, 1));
|
362 |
-
$this->m_bGlobalClr = ($b & 0x80) ? true : false;
|
363 |
-
$this->m_nColorRes = ($b & 0x70) >> 4;
|
364 |
-
$this->m_bSorted = ($b & 0x08) ? true : false;
|
365 |
-
$this->m_nTableSize = 2 << ($b & 0x07);
|
366 |
-
$this->m_nBgColor = ord(substr($lpData, 11, 1));
|
367 |
-
$this->m_nPixelRatio = ord(substr($lpData, 12, 1));
|
368 |
-
$hdrLen = 13;
|
369 |
-
|
370 |
-
if($this->m_bGlobalClr) {
|
371 |
-
$this->m_colorTable = new CGIFCOLORTABLE();
|
372 |
-
if(!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
|
373 |
-
return false;
|
374 |
-
}
|
375 |
-
$hdrLen += 3 * $this->m_nTableSize;
|
376 |
-
}
|
377 |
-
|
378 |
-
return true;
|
379 |
-
}
|
380 |
-
|
381 |
-
///////////////////////////////////////////////////////////////////////////
|
382 |
-
|
383 |
-
function w2i($str)
|
384 |
-
{
|
385 |
-
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
|
386 |
-
}
|
387 |
-
}
|
388 |
-
|
389 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
390 |
-
|
391 |
-
class CGIFIMAGEHEADER
|
392 |
-
{
|
393 |
-
var $m_nLeft;
|
394 |
-
var $m_nTop;
|
395 |
-
var $m_nWidth;
|
396 |
-
var $m_nHeight;
|
397 |
-
var $m_bLocalClr;
|
398 |
-
var $m_bInterlace;
|
399 |
-
var $m_bSorted;
|
400 |
-
var $m_nTableSize;
|
401 |
-
var $m_colorTable;
|
402 |
-
|
403 |
-
///////////////////////////////////////////////////////////////////////////
|
404 |
-
|
405 |
-
// CONSTRUCTOR
|
406 |
-
function CGIFIMAGEHEADER()
|
407 |
-
{
|
408 |
-
unSet($this->m_nLeft);
|
409 |
-
unSet($this->m_nTop);
|
410 |
-
unSet($this->m_nWidth);
|
411 |
-
unSet($this->m_nHeight);
|
412 |
-
unSet($this->m_bLocalClr);
|
413 |
-
unSet($this->m_bInterlace);
|
414 |
-
unSet($this->m_bSorted);
|
415 |
-
unSet($this->m_nTableSize);
|
416 |
-
unSet($this->m_colorTable);
|
417 |
-
}
|
418 |
-
|
419 |
-
///////////////////////////////////////////////////////////////////////////
|
420 |
-
|
421 |
-
function load($lpData, &$hdrLen)
|
422 |
-
{
|
423 |
-
$hdrLen = 0;
|
424 |
-
|
425 |
-
$this->m_nLeft = $this->w2i(substr($lpData, 0, 2));
|
426 |
-
$this->m_nTop = $this->w2i(substr($lpData, 2, 2));
|
427 |
-
$this->m_nWidth = $this->w2i(substr($lpData, 4, 2));
|
428 |
-
$this->m_nHeight = $this->w2i(substr($lpData, 6, 2));
|
429 |
-
|
430 |
-
if(!$this->m_nWidth || !$this->m_nHeight) {
|
431 |
-
return false;
|
432 |
-
}
|
433 |
-
|
434 |
-
$b = ord($lpData{8});
|
435 |
-
$this->m_bLocalClr = ($b & 0x80) ? true : false;
|
436 |
-
$this->m_bInterlace = ($b & 0x40) ? true : false;
|
437 |
-
$this->m_bSorted = ($b & 0x20) ? true : false;
|
438 |
-
$this->m_nTableSize = 2 << ($b & 0x07);
|
439 |
-
$hdrLen = 9;
|
440 |
-
|
441 |
-
if($this->m_bLocalClr) {
|
442 |
-
$this->m_colorTable = new CGIFCOLORTABLE();
|
443 |
-
if(!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
|
444 |
-
return false;
|
445 |
-
}
|
446 |
-
$hdrLen += 3 * $this->m_nTableSize;
|
447 |
-
}
|
448 |
-
|
449 |
-
return true;
|
450 |
-
}
|
451 |
-
|
452 |
-
///////////////////////////////////////////////////////////////////////////
|
453 |
-
|
454 |
-
function w2i($str)
|
455 |
-
{
|
456 |
-
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
|
457 |
-
}
|
458 |
-
}
|
459 |
-
|
460 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
461 |
-
|
462 |
-
class CGIFIMAGE
|
463 |
-
{
|
464 |
-
var $m_disp;
|
465 |
-
var $m_bUser;
|
466 |
-
var $m_bTrans;
|
467 |
-
var $m_nDelay;
|
468 |
-
var $m_nTrans;
|
469 |
-
var $m_lpComm;
|
470 |
-
var $m_gih;
|
471 |
-
var $m_data;
|
472 |
-
var $m_lzw;
|
473 |
-
|
474 |
-
///////////////////////////////////////////////////////////////////////////
|
475 |
-
|
476 |
-
function CGIFIMAGE()
|
477 |
-
{
|
478 |
-
unSet($this->m_disp);
|
479 |
-
unSet($this->m_bUser);
|
480 |
-
unSet($this->m_bTrans);
|
481 |
-
unSet($this->m_nDelay);
|
482 |
-
unSet($this->m_nTrans);
|
483 |
-
unSet($this->m_lpComm);
|
484 |
-
unSet($this->m_data);
|
485 |
-
$this->m_gih = new CGIFIMAGEHEADER();
|
486 |
-
$this->m_lzw = new CGIFLZW();
|
487 |
-
}
|
488 |
-
|
489 |
-
///////////////////////////////////////////////////////////////////////////
|
490 |
-
|
491 |
-
function load($data, &$datLen)
|
492 |
-
{
|
493 |
-
$datLen = 0;
|
494 |
-
|
495 |
-
while(true) {
|
496 |
-
$b = ord($data[0]);
|
497 |
-
$data = substr($data, 1);
|
498 |
-
$datLen++;
|
499 |
-
|
500 |
-
switch($b) {
|
501 |
-
case 0x21: // Extension
|
502 |
-
$len = 0;
|
503 |
-
if(!$this->skipExt($data, $len)) {
|
504 |
-
return false;
|
505 |
-
}
|
506 |
-
$datLen += $len;
|
507 |
-
break;
|
508 |
-
|
509 |
-
case 0x2C: // Image
|
510 |
-
// LOAD HEADER & COLOR TABLE
|
511 |
-
$len = 0;
|
512 |
-
if(!$this->m_gih->load($data, $len)) {
|
513 |
-
return false;
|
514 |
-
}
|
515 |
-
$data = substr($data, $len);
|
516 |
-
$datLen += $len;
|
517 |
-
|
518 |
-
// ALLOC BUFFER
|
519 |
-
$len = 0;
|
520 |
-
|
521 |
-
if(!($this->m_data = $this->m_lzw->deCompress($data, $len))) {
|
522 |
-
return false;
|
523 |
-
}
|
524 |
-
|
525 |
-
$data = substr($data, $len);
|
526 |
-
$datLen += $len;
|
527 |
-
|
528 |
-
if($this->m_gih->m_bInterlace) {
|
529 |
-
$this->deInterlace();
|
530 |
-
}
|
531 |
-
|
532 |
-
return true;
|
533 |
-
|
534 |
-
case 0x3B: // EOF
|
535 |
-
default:
|
536 |
-
return false;
|
537 |
-
}
|
538 |
-
}
|
539 |
-
return false;
|
540 |
-
}
|
541 |
-
|
542 |
-
///////////////////////////////////////////////////////////////////////////
|
543 |
-
|
544 |
-
function skipExt(&$data, &$extLen)
|
545 |
-
{
|
546 |
-
$extLen = 0;
|
547 |
-
|
548 |
-
$b = ord($data[0]);
|
549 |
-
$data = substr($data, 1);
|
550 |
-
$extLen++;
|
551 |
-
|
552 |
-
switch($b) {
|
553 |
-
case 0xF9: // Graphic Control
|
554 |
-
$b = ord($data[1]);
|
555 |
-
$this->m_disp = ($b & 0x1C) >> 2;
|
556 |
-
$this->m_bUser = ($b & 0x02) ? true : false;
|
557 |
-
$this->m_bTrans = ($b & 0x01) ? true : false;
|
558 |
-
$this->m_nDelay = $this->w2i(substr($data, 2, 2));
|
559 |
-
$this->m_nTrans = ord($data[4]);
|
560 |
-
break;
|
561 |
-
|
562 |
-
case 0xFE: // Comment
|
563 |
-
$this->m_lpComm = substr($data, 1, ord($data[0]));
|
564 |
-
break;
|
565 |
-
|
566 |
-
case 0x01: // Plain text
|
567 |
-
break;
|
568 |
-
|
569 |
-
case 0xFF: // Application
|
570 |
-
break;
|
571 |
-
}
|
572 |
-
|
573 |
-
// SKIP DEFAULT AS DEFS MAY CHANGE
|
574 |
-
$b = ord($data[0]);
|
575 |
-
$data = substr($data, 1);
|
576 |
-
$extLen++;
|
577 |
-
while($b > 0) {
|
578 |
-
$data = substr($data, $b);
|
579 |
-
$extLen += $b;
|
580 |
-
$b = ord($data[0]);
|
581 |
-
$data = substr($data, 1);
|
582 |
-
$extLen++;
|
583 |
-
}
|
584 |
-
return true;
|
585 |
-
}
|
586 |
-
|
587 |
-
///////////////////////////////////////////////////////////////////////////
|
588 |
-
|
589 |
-
function w2i($str)
|
590 |
-
{
|
591 |
-
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
|
592 |
-
}
|
593 |
-
|
594 |
-
///////////////////////////////////////////////////////////////////////////
|
595 |
-
|
596 |
-
function deInterlace()
|
597 |
-
{
|
598 |
-
$data = $this->m_data;
|
599 |
-
|
600 |
-
for($i = 0; $i < 4; $i++) {
|
601 |
-
switch($i) {
|
602 |
-
case 0:
|
603 |
-
$s = 8;
|
604 |
-
$y = 0;
|
605 |
-
break;
|
606 |
-
|
607 |
-
case 1:
|
608 |
-
$s = 8;
|
609 |
-
$y = 4;
|
610 |
-
break;
|
611 |
-
|
612 |
-
case 2:
|
613 |
-
$s = 4;
|
614 |
-
$y = 2;
|
615 |
-
break;
|
616 |
-
|
617 |
-
case 3:
|
618 |
-
$s = 2;
|
619 |
-
$y = 1;
|
620 |
-
break;
|
621 |
-
}
|
622 |
-
|
623 |
-
for(; $y < $this->m_gih->m_nHeight; $y += $s) {
|
624 |
-
$lne = substr($this->m_data, 0, $this->m_gih->m_nWidth);
|
625 |
-
$this->m_data = substr($this->m_data, $this->m_gih->m_nWidth);
|
626 |
-
|
627 |
-
$data =
|
628 |
-
substr($data, 0, $y * $this->m_gih->m_nWidth) .
|
629 |
-
$lne .
|
630 |
-
substr($data, ($y + 1) * $this->m_gih->m_nWidth);
|
631 |
-
}
|
632 |
-
}
|
633 |
-
|
634 |
-
$this->m_data = $data;
|
635 |
-
}
|
636 |
-
}
|
637 |
-
|
638 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
639 |
-
|
640 |
-
class CGIF
|
641 |
-
{
|
642 |
-
var $m_gfh;
|
643 |
-
var $m_lpData;
|
644 |
-
var $m_img;
|
645 |
-
var $m_bLoaded;
|
646 |
-
|
647 |
-
///////////////////////////////////////////////////////////////////////////
|
648 |
-
|
649 |
-
// CONSTRUCTOR
|
650 |
-
function CGIF()
|
651 |
-
{
|
652 |
-
$this->m_gfh = new CGIFFILEHEADER();
|
653 |
-
$this->m_img = new CGIFIMAGE();
|
654 |
-
$this->m_lpData = "";
|
655 |
-
$this->m_bLoaded = false;
|
656 |
-
}
|
657 |
-
|
658 |
-
///////////////////////////////////////////////////////////////////////////
|
659 |
-
function ClearData() {
|
660 |
-
$this->m_lpData = '';
|
661 |
-
unSet($this->m_img->m_data);
|
662 |
-
unSet($this->m_img->m_lzw->Next);
|
663 |
-
unSet($this->m_img->m_lzw->Vals);
|
664 |
-
unSet($this->m_img->m_lzw->Stack);
|
665 |
-
unSet($this->m_img->m_lzw->Buf);
|
666 |
-
}
|
667 |
-
|
668 |
-
function loadFile(&$data, $iIndex)
|
669 |
-
{
|
670 |
-
if($iIndex < 0) {
|
671 |
-
return false;
|
672 |
-
}
|
673 |
-
$this->m_lpData = $data;
|
674 |
-
|
675 |
-
// GET FILE HEADER
|
676 |
-
$len = 0;
|
677 |
-
if(!$this->m_gfh->load($this->m_lpData, $len)) {
|
678 |
-
return false;
|
679 |
-
}
|
680 |
-
|
681 |
-
$this->m_lpData = substr($this->m_lpData, $len);
|
682 |
-
|
683 |
-
do {
|
684 |
-
$imgLen = 0;
|
685 |
-
if(!$this->m_img->load($this->m_lpData, $imgLen)) {
|
686 |
-
return false;
|
687 |
-
}
|
688 |
-
$this->m_lpData = substr($this->m_lpData, $imgLen);
|
689 |
-
}
|
690 |
-
while($iIndex-- > 0);
|
691 |
-
|
692 |
-
$this->m_bLoaded = true;
|
693 |
-
return true;
|
694 |
-
}
|
695 |
-
|
696 |
-
}
|
697 |
-
|
698 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
699 |
-
|
700 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/grad.php
DELETED
@@ -1,723 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class grad {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
|
7 |
-
function grad(&$mpdf) {
|
8 |
-
$this->mpdf = $mpdf;
|
9 |
-
}
|
10 |
-
|
11 |
-
// mPDF 5.3.A1
|
12 |
-
function CoonsPatchMesh($x, $y, $w, $h, $patch_array=array(), $x_min=0, $x_max=1, $y_min=0, $y_max=1, $colspace='RGB', $return=false){
|
13 |
-
$s=' q ';
|
14 |
-
$s.=sprintf(' %.3F %.3F %.3F %.3F re W n ', $x*_MPDFK, ($this->mpdf->h-$y)*_MPDFK, $w*_MPDFK, -$h*_MPDFK);
|
15 |
-
$s.=sprintf(' %.3F 0 0 %.3F %.3F %.3F cm ', $w*_MPDFK, $h*_MPDFK, $x*_MPDFK, ($this->mpdf->h-($y+$h))*_MPDFK);
|
16 |
-
$n = count($this->mpdf->gradients)+1;
|
17 |
-
$this->mpdf->gradients[$n]['type'] = 6; //coons patch mesh
|
18 |
-
$this->mpdf->gradients[$n]['colorspace'] = $colspace; //coons patch mesh
|
19 |
-
$bpcd=65535; //16 BitsPerCoordinate
|
20 |
-
$trans = false;
|
21 |
-
$this->mpdf->gradients[$n]['stream']='';
|
22 |
-
for($i=0;$i<count($patch_array);$i++){
|
23 |
-
$this->mpdf->gradients[$n]['stream'].=chr($patch_array[$i]['f']); //start with the edge flag as 8 bit
|
24 |
-
for($j=0;$j<count($patch_array[$i]['points']);$j++){
|
25 |
-
//each point as 16 bit
|
26 |
-
if (($j % 2) == 1) { // Y coordinate (adjusted as input is From top left)
|
27 |
-
$patch_array[$i]['points'][$j]=(($patch_array[$i]['points'][$j]-$y_min)/($y_max-$y_min))*$bpcd;
|
28 |
-
$patch_array[$i]['points'][$j]=$bpcd-$patch_array[$i]['points'][$j];
|
29 |
-
}
|
30 |
-
else {
|
31 |
-
$patch_array[$i]['points'][$j]=(($patch_array[$i]['points'][$j]-$x_min)/($x_max-$x_min))*$bpcd;
|
32 |
-
}
|
33 |
-
if($patch_array[$i]['points'][$j]<0) $patch_array[$i]['points'][$j]=0;
|
34 |
-
if($patch_array[$i]['points'][$j]>$bpcd) $patch_array[$i]['points'][$j]=$bpcd;
|
35 |
-
$this->mpdf->gradients[$n]['stream'].=chr(floor($patch_array[$i]['points'][$j]/256));
|
36 |
-
$this->mpdf->gradients[$n]['stream'].=chr(floor($patch_array[$i]['points'][$j]%256));
|
37 |
-
}
|
38 |
-
for($j=0;$j<count($patch_array[$i]['colors']);$j++){
|
39 |
-
//each color component as 8 bit
|
40 |
-
if ($colspace=='RGB') {
|
41 |
-
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][1]);
|
42 |
-
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][2]);
|
43 |
-
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][3]);
|
44 |
-
if (isset($patch_array[$i]['colors'][$j][4]) && ord($patch_array[$i]['colors'][$j][4])<100) { $trans = true; }
|
45 |
-
}
|
46 |
-
else if ($colspace=='CMYK') {
|
47 |
-
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][1])*2.55);
|
48 |
-
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][2])*2.55);
|
49 |
-
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][3])*2.55);
|
50 |
-
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][4])*2.55);
|
51 |
-
if (isset($patch_array[$i]['colors'][$j][5]) && ord($patch_array[$i]['colors'][$j][5])<100) { $trans = true; }
|
52 |
-
}
|
53 |
-
else if ($colspace=='Gray') {
|
54 |
-
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][1]);
|
55 |
-
if ($patch_array[$i]['colors'][$j][2]==1) { $trans = true; } // transparency converted from rgba or cmyka()
|
56 |
-
}
|
57 |
-
}
|
58 |
-
}
|
59 |
-
// TRANSPARENCY
|
60 |
-
if ($trans) {
|
61 |
-
$this->mpdf->gradients[$n]['stream_trans']='';
|
62 |
-
for($i=0;$i<count($patch_array);$i++){
|
63 |
-
$this->mpdf->gradients[$n]['stream_trans'].=chr($patch_array[$i]['f']);
|
64 |
-
for($j=0;$j<count($patch_array[$i]['points']);$j++){
|
65 |
-
//each point as 16 bit
|
66 |
-
$this->mpdf->gradients[$n]['stream_trans'].=chr(floor($patch_array[$i]['points'][$j]/256));
|
67 |
-
$this->mpdf->gradients[$n]['stream_trans'].=chr(floor($patch_array[$i]['points'][$j]%256));
|
68 |
-
}
|
69 |
-
for($j=0;$j<count($patch_array[$i]['colors']);$j++){
|
70 |
-
//each color component as 8 bit // OPACITY
|
71 |
-
if ($colspace=='RGB') {
|
72 |
-
$this->mpdf->gradients[$n]['stream_trans'].=chr(intval(ord($patch_array[$i]['colors'][$j][4])*2.55));
|
73 |
-
}
|
74 |
-
else if ($colspace=='CMYK') {
|
75 |
-
$this->mpdf->gradients[$n]['stream_trans'].=chr(intval(ord($patch_array[$i]['colors'][$j][5])*2.55));
|
76 |
-
}
|
77 |
-
else if ($colspace=='Gray') {
|
78 |
-
$this->mpdf->gradients[$n]['stream_trans'].=chr(intval(ord($patch_array[$i]['colors'][$j][3])*2.55));
|
79 |
-
}
|
80 |
-
}
|
81 |
-
}
|
82 |
-
$this->mpdf->gradients[$n]['trans'] = true;
|
83 |
-
$s .= ' /TGS'.$n.' gs ';
|
84 |
-
}
|
85 |
-
//paint the gradient
|
86 |
-
$s .= '/Sh'.$n.' sh'."\n";
|
87 |
-
//restore previous Graphic State
|
88 |
-
$s .= 'Q'."\n";
|
89 |
-
if ($return) { return $s; }
|
90 |
-
else { $this->mpdf->_out($s); }
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
// type = linear:2; radial: 3;
|
95 |
-
// Linear: $coords - array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg).
|
96 |
-
// The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
|
97 |
-
// Radial: $coords - array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1,
|
98 |
-
// (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg).
|
99 |
-
// (fx, fy) should be inside the circle, otherwise some areas will not be defined
|
100 |
-
// $col = array(R,G,B/255); or array(G/255); or array(C,M,Y,K/100)
|
101 |
-
// $stops = array('col'=>$col [, 'opacity'=>0-1] [, 'offset'=>0-1])
|
102 |
-
function Gradient($x, $y, $w, $h, $type, $stops=array(), $colorspace='RGB', $coords='', $extend='', $return=false, $is_mask=false) {
|
103 |
-
if (strtoupper(substr($type,0,1)) == 'L') { $type = 2; } // linear
|
104 |
-
else if (strtoupper(substr($type,0,1)) == 'R') { $type = 3; } // radial
|
105 |
-
if ($colorspace != 'CMYK' && $colorspace != 'Gray') {
|
106 |
-
$colorspace = 'RGB';
|
107 |
-
}
|
108 |
-
$bboxw = $w;
|
109 |
-
$bboxh = $h;
|
110 |
-
$usex = $x;
|
111 |
-
$usey = $y;
|
112 |
-
$usew = $bboxw;
|
113 |
-
$useh = $bboxh;
|
114 |
-
if ($type < 1) { $type = 2; }
|
115 |
-
if ($coords[0]!==false && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$coords[0],$m)) {
|
116 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
117 |
-
if ($tmp) { $coords[0] = $tmp/$w; }
|
118 |
-
}
|
119 |
-
if ($coords[1]!==false && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$coords[1],$m)) {
|
120 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
121 |
-
if ($tmp) { $coords[1] = 1-($tmp/$h); }
|
122 |
-
}
|
123 |
-
// LINEAR
|
124 |
-
if ($type == 2) {
|
125 |
-
$angle = $coords[4];
|
126 |
-
$repeat = $coords[5];
|
127 |
-
// ALL POINTS SET (default for custom mPDF linear gradient) - no -moz
|
128 |
-
if ($coords[0]!==false && $coords[1]!==false && $coords[2]!==false && $coords[3]!==false) {
|
129 |
-
// do nothing - coords used as they are
|
130 |
-
}
|
131 |
-
|
132 |
-
// If both a <point> and <angle> are defined, the gradient axis starts from the point and runs along the angle. The end point is
|
133 |
-
// defined as before - in this case start points may not be in corners, and axis may not correctly fall in the right quadrant.
|
134 |
-
// NO end points (Angle defined & Start points)
|
135 |
-
else if ($angle!==false && $coords[0]!==false && $coords[1]!==false && $coords[2]===false && $coords[3]===false) {
|
136 |
-
if ($angle==0 || $angle==360) { $coords[3]=$coords[1]; if ($coords[0]==1) $coords[2]=2; else $coords[2]=1; }
|
137 |
-
else if ($angle==90) { $coords[2]=$coords[0]; $coords[3]=1; if ($coords[1]==1) $coords[3]=2; else $coords[3]=1; }
|
138 |
-
else if ($angle==180) { if ($coords[4]==0) $coords[2]=-1; else $coords[2]=0; $coords[3]=$coords[1]; }
|
139 |
-
else if ($angle==270) { $coords[2]=$coords[0]; if ($coords[1]==0) $coords[3]=-1; else $coords[3]=0; }
|
140 |
-
else {
|
141 |
-
$endx=1; $endy=1;
|
142 |
-
if ($angle <=90) {
|
143 |
-
if ($angle <=45) { $endy=tan(deg2rad($angle)); }
|
144 |
-
else { $endx=tan(deg2rad(90-$angle)); }
|
145 |
-
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
|
146 |
-
$ny = 1 - $coords[1] - (tan($b) * (1-$coords[0]));
|
147 |
-
$tx = sin($b) * cos($b) * $ny;
|
148 |
-
$ty = cos($b) * cos($b) * $ny;
|
149 |
-
$coords[2] = 1+$tx; $coords[3] = 1-$ty;
|
150 |
-
}
|
151 |
-
else if ($angle <=180) {
|
152 |
-
if ($angle <=135) { $endx=tan(deg2rad($angle-90)); }
|
153 |
-
else { $endy=tan(deg2rad(180-$angle)); }
|
154 |
-
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
|
155 |
-
$ny = 1 - $coords[1] - (tan($b) * ($coords[0]));
|
156 |
-
$tx = sin($b) * cos($b) * $ny;
|
157 |
-
$ty = cos($b) * cos($b) * $ny;
|
158 |
-
$coords[2] = -$tx; $coords[3] = 1-$ty;
|
159 |
-
}
|
160 |
-
else if ($angle <=270) {
|
161 |
-
if ($angle <=225) { $endy=tan(deg2rad($angle-180)); }
|
162 |
-
else { $endx=tan(deg2rad(270-$angle)); }
|
163 |
-
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
|
164 |
-
$ny = $coords[1] - (tan($b) * ($coords[0]));
|
165 |
-
$tx = sin($b) * cos($b) * $ny;
|
166 |
-
$ty = cos($b) * cos($b) * $ny;
|
167 |
-
$coords[2] = -$tx; $coords[3] = $ty;
|
168 |
-
}
|
169 |
-
else {
|
170 |
-
if ($angle <=315) { $endx=tan(deg2rad($angle-270)); }
|
171 |
-
else { $endy=tan(deg2rad(360-$angle)); }
|
172 |
-
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
|
173 |
-
$ny = $coords[1] - (tan($b) * (1-$coords[0]));
|
174 |
-
$tx = sin($b) * cos($b) * $ny;
|
175 |
-
$ty = cos($b) * cos($b) * $ny;
|
176 |
-
$coords[2] = 1+$tx; $coords[3] = $ty;
|
177 |
-
|
178 |
-
}
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
// -moz If the first parameter is only an <angle>, the gradient axis starts from the box's corner that would ensure the
|
183 |
-
// axis goes through the box. The axis runs along the specified angle. The end point of the axis is defined such that the
|
184 |
-
// farthest corner of the box from the starting point is perpendicular to the gradient axis at that point.
|
185 |
-
// NO end points or Start points (Angle defined)
|
186 |
-
else if ($angle!==false && $coords[0]===false && $coords[1]===false) {
|
187 |
-
if ($angle==0 || $angle==360) { $coords[0]=0; $coords[1]=0; $coords[2]=1; $coords[3]=0; }
|
188 |
-
else if ($angle==90) { $coords[0]=0; $coords[1]=0; $coords[2]=0; $coords[3]=1; }
|
189 |
-
else if ($angle==180) { $coords[0]=1; $coords[1]=0; $coords[2]=0; $coords[3]=0; }
|
190 |
-
else if ($angle==270) { $coords[0]=0; $coords[1]=1; $coords[2]=0; $coords[3]=0; }
|
191 |
-
else {
|
192 |
-
if ($angle <=90) {
|
193 |
-
$coords[0]=0; $coords[1]=0;
|
194 |
-
if ($angle <=45) { $endx=1; $endy=tan(deg2rad($angle)); }
|
195 |
-
else { $endx=tan(deg2rad(90-$angle)); $endy=1; }
|
196 |
-
}
|
197 |
-
else if ($angle <=180) {
|
198 |
-
$coords[0]=1; $coords[1]=0;
|
199 |
-
if ($angle <=135) { $endx=tan(deg2rad($angle-90)); $endy=1; }
|
200 |
-
else { $endx=1; $endy=tan(deg2rad(180-$angle)); }
|
201 |
-
}
|
202 |
-
else if ($angle <=270) {
|
203 |
-
$coords[0]=1; $coords[1]=1;
|
204 |
-
if ($angle <=225) { $endx=1; $endy=tan(deg2rad($angle-180)); }
|
205 |
-
else { $endx=tan(deg2rad(270-$angle)); $endy=1; }
|
206 |
-
}
|
207 |
-
else {
|
208 |
-
$coords[0]=0; $coords[1]=1;
|
209 |
-
if ($angle <=315) { $endx=tan(deg2rad($angle-270)); $endy=1; }
|
210 |
-
else { $endx=1; $endy=tan(deg2rad(360-$angle)); }
|
211 |
-
}
|
212 |
-
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
|
213 |
-
$h2 = $bboxh - ($bboxh * tan($b));
|
214 |
-
$px = $bboxh + ($h2 * sin($b) * cos($b));
|
215 |
-
$py = ($bboxh * tan($b)) + ($h2 * sin($b) * sin($b));
|
216 |
-
$x1 = $px / $bboxh;
|
217 |
-
$y1 = $py / $bboxh;
|
218 |
-
if ($angle <=90) { $coords[2] = $x1; $coords[3] = $y1; }
|
219 |
-
else if ($angle <=180) { $coords[2] = 1-$x1; $coords[3] = $y1; }
|
220 |
-
else if ($angle <=270) { $coords[2] = 1-$x1; $coords[3] = 1-$y1; }
|
221 |
-
else { $coords[2] = $x1; $coords[3] = 1-$y1; }
|
222 |
-
}
|
223 |
-
}
|
224 |
-
// -moz If the first parameter to the gradient function is only a <point>, the gradient axis starts from the specified point,
|
225 |
-
// and ends at the point you would get if you rotated the starting point by 180 degrees about the center of the box that the
|
226 |
-
// gradient is to be applied to.
|
227 |
-
// NO angle and NO end points (Start points defined)
|
228 |
-
else if ((!isset($angle) || $angle===false) && $coords[0]!==false && $coords[1]!==false) { // should have start and end defined
|
229 |
-
$coords[2] = 1-$coords[0]; $coords[3] = 1-$coords[1];
|
230 |
-
$angle = rad2deg(atan2($coords[3]-$coords[1],$coords[2]-$coords[0]));
|
231 |
-
if ($angle < 0) { $angle += 360; }
|
232 |
-
else if ($angle > 360) { $angle -= 360; }
|
233 |
-
if ($angle!=0 && $angle!=360 && $angle!=90 && $angle!=180 && $angle!=270) {
|
234 |
-
if ($w >= $h) {
|
235 |
-
$coords[1] *= $h/$w ;
|
236 |
-
$coords[3] *= $h/$w ;
|
237 |
-
$usew = $useh = $bboxw;
|
238 |
-
$usey -= ($w-$h);
|
239 |
-
}
|
240 |
-
else {
|
241 |
-
$coords[0] *= $w/$h ;
|
242 |
-
$coords[2] *= $w/$h ;
|
243 |
-
$usew = $useh = $bboxh;
|
244 |
-
}
|
245 |
-
}
|
246 |
-
}
|
247 |
-
|
248 |
-
// -moz If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient
|
249 |
-
// axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
|
250 |
-
else { // default values T2B
|
251 |
-
// All values are set in parseMozGradient - so won't appear here
|
252 |
-
$coords = array(0,0,1,0); // default for original linear gradient (L2R)
|
253 |
-
}
|
254 |
-
$s = ' q';
|
255 |
-
$s .= sprintf(' %.3F %.3F %.3F %.3F re W n', $x*_MPDFK, ($this->mpdf->h-$y)*_MPDFK, $w*_MPDFK, -$h*_MPDFK)."\n";
|
256 |
-
$s .= sprintf(' %.3F 0 0 %.3F %.3F %.3F cm', $usew*_MPDFK, $useh*_MPDFK, $usex*_MPDFK, ($this->mpdf->h-($usey+$useh))*_MPDFK)."\n";
|
257 |
-
}
|
258 |
-
|
259 |
-
// RADIAL
|
260 |
-
else if ($type == 3) {
|
261 |
-
$radius = $coords[4];
|
262 |
-
$angle = $coords[5]; // ?? no effect
|
263 |
-
$shape = $coords[6];
|
264 |
-
$size = $coords[7];
|
265 |
-
$repeat = $coords[8];
|
266 |
-
// ALL POINTS AND RADIUS SET (default for custom mPDF radial gradient) - no -moz
|
267 |
-
if ($coords[0]!==false && $coords[1]!==false && $coords[2]!==false && $coords[3]!==false && $coords[4]!==false) {
|
268 |
-
// do nothing - coords used as they are
|
269 |
-
}
|
270 |
-
// If a <point> is defined
|
271 |
-
else if ($shape!==false && $size!==false) {
|
272 |
-
if ($coords[2]==false) { $coords[2] = $coords[0]; }
|
273 |
-
if ($coords[3]==false) { $coords[3] = $coords[1]; }
|
274 |
-
// ELLIPSE
|
275 |
-
if ($shape=='ellipse') {
|
276 |
-
$corner1 = sqrt(pow($coords[0],2) + pow($coords[1],2));
|
277 |
-
$corner2 = sqrt(pow($coords[0],2) + pow((1-$coords[1]),2));
|
278 |
-
$corner3 = sqrt(pow((1-$coords[0]),2) + pow($coords[1],2));
|
279 |
-
$corner4 = sqrt(pow((1-$coords[0]),2) + pow((1-$coords[1]),2));
|
280 |
-
if ($size=='closest-side') { $radius = min($coords[0], $coords[1], (1-$coords[0]), (1-$coords[1])); }
|
281 |
-
else if ($size=='closest-corner') { $radius = min($corner1, $corner2, $corner3, $corner4); }
|
282 |
-
else if ($size=='farthest-side') { $radius = max($coords[0], $coords[1], (1-$coords[0]), (1-$coords[1])); }
|
283 |
-
else { $radius = max($corner1, $corner2, $corner3, $corner4); } // farthest corner (default)
|
284 |
-
}
|
285 |
-
// CIRCLE
|
286 |
-
else if ($shape=='circle') {
|
287 |
-
if ($w >= $h) {
|
288 |
-
$coords[1] = $coords[3] = ($coords[1] * $h/$w) ;
|
289 |
-
$corner1 = sqrt(pow($coords[0],2) + pow($coords[1],2));
|
290 |
-
$corner2 = sqrt(pow($coords[0],2) + pow((($h/$w)-$coords[1]),2));
|
291 |
-
$corner3 = sqrt(pow((1-$coords[0]),2) + pow($coords[1],2));
|
292 |
-
$corner4 = sqrt(pow((1-$coords[0]),2) + pow((($h/$w)-$coords[1]),2));
|
293 |
-
if ($size=='closest-side') { $radius = min($coords[0], $coords[1], (1-$coords[0]), (($h/$w)-$coords[1])); }
|
294 |
-
else if ($size=='closest-corner') { $radius = min($corner1, $corner2, $corner3, $corner4); }
|
295 |
-
else if ($size=='farthest-side') { $radius = max($coords[0], $coords[1], (1-$coords[0]), (($h/$w)-$coords[1])); }
|
296 |
-
else if ($size=='farthest-corner') { $radius = max($corner1, $corner2, $corner3, $corner4); } // farthest corner (default)
|
297 |
-
$usew = $useh = $bboxw;
|
298 |
-
$usey -= ($w-$h);
|
299 |
-
}
|
300 |
-
else {
|
301 |
-
$coords[0] = $coords[2] = ($coords[0] * $w/$h) ;
|
302 |
-
$corner1 = sqrt(pow($coords[0],2) + pow($coords[1],2));
|
303 |
-
$corner2 = sqrt(pow($coords[0],2) + pow((1-$coords[1]),2));
|
304 |
-
$corner3 = sqrt(pow((($w/$h)-$coords[0]),2) + pow($coords[1],2));
|
305 |
-
$corner4 = sqrt(pow((($w/$h)-$coords[0]),2) + pow((1-$coords[1]),2));
|
306 |
-
if ($size=='closest-side') { $radius = min($coords[0], $coords[1], (($w/$h)-$coords[0]), (1-$coords[1])); }
|
307 |
-
else if ($size=='closest-corner') { $radius = min($corner1, $corner2, $corner3, $corner4); }
|
308 |
-
else if ($size=='farthest-side') { $radius = max($coords[0], $coords[1], (($w/$h)-$coords[0]), (1-$coords[1])); }
|
309 |
-
else if ($size=='farthest-corner') { $radius = max($corner1, $corner2, $corner3, $corner4); } // farthest corner (default)
|
310 |
-
$usew = $useh = $bboxh;
|
311 |
-
}
|
312 |
-
}
|
313 |
-
if ($radius==0) { $radius=0.001; } // to prevent error
|
314 |
-
$coords[4] = $radius;
|
315 |
-
}
|
316 |
-
|
317 |
-
// -moz If entire function consists of only <stop> values
|
318 |
-
else { // default values
|
319 |
-
// All values are set in parseMozGradient - so won't appear here
|
320 |
-
$coords = array(0.5,0.5,0.5,0.5); // default for radial gradient (centred)
|
321 |
-
}
|
322 |
-
$s = ' q';
|
323 |
-
$s .= sprintf(' %.3F %.3F %.3F %.3F re W n', $x*_MPDFK, ($this->mpdf->h-$y)*_MPDFK, $w*_MPDFK, -$h*_MPDFK)."\n";
|
324 |
-
$s .= sprintf(' %.3F 0 0 %.3F %.3F %.3F cm', $usew*_MPDFK, $useh*_MPDFK, $usex*_MPDFK, ($this->mpdf->h-($usey+$useh))*_MPDFK)."\n";
|
325 |
-
}
|
326 |
-
|
327 |
-
$n = count($this->mpdf->gradients) + 1;
|
328 |
-
$this->mpdf->gradients[$n]['type'] = $type;
|
329 |
-
$this->mpdf->gradients[$n]['colorspace'] = $colorspace;
|
330 |
-
$trans = false;
|
331 |
-
$this->mpdf->gradients[$n]['is_mask'] = $is_mask;
|
332 |
-
if ($is_mask) { $trans = true; }
|
333 |
-
if (count($stops) == 1) { $stops[1] = $stops[0]; }
|
334 |
-
if (!isset($stops[0]['offset'])) { $stops[0]['offset'] = 0; }
|
335 |
-
if (!isset($stops[(count($stops)-1)]['offset'])) { $stops[(count($stops)-1)]['offset'] = 1; }
|
336 |
-
|
337 |
-
// Fix stop-offsets set as absolute lengths
|
338 |
-
if ($type==2) {
|
339 |
-
$axisx = ($coords[2]-$coords[0])*$usew;
|
340 |
-
$axisy = ($coords[3]-$coords[1])*$useh;
|
341 |
-
$axis_length = sqrt(pow($axisx,2) + pow($axisy,2));
|
342 |
-
}
|
343 |
-
else { $axis_length = $coords[4]*$usew; } // Absolute lengths are meaningless for an ellipse - Firefox uses Width as reference
|
344 |
-
|
345 |
-
for($i=0;$i<count($stops);$i++) {
|
346 |
-
if (isset($stops[$i]['offset']) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$stops[$i]['offset'],$m)) {
|
347 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
348 |
-
$stops[$i]['offset'] = $tmp/$axis_length;
|
349 |
-
}
|
350 |
-
}
|
351 |
-
|
352 |
-
|
353 |
-
if (isset($stops[0]['offset']) && $stops[0]['offset']>0) {
|
354 |
-
$firststop = $stops[0];
|
355 |
-
$firststop['offset'] = 0;
|
356 |
-
array_unshift($stops, $firststop);
|
357 |
-
}
|
358 |
-
if (!$repeat && isset($stops[(count($stops)-1)]['offset']) && $stops[(count($stops)-1)]['offset']<1) {
|
359 |
-
$endstop = $stops[(count($stops)-1)];
|
360 |
-
$endstop['offset'] = 1;
|
361 |
-
$stops[] = $endstop;
|
362 |
-
}
|
363 |
-
if ($stops[0]['offset'] > $stops[(count($stops)-1)]['offset']) {
|
364 |
-
$stops[0]['offset'] = 0;
|
365 |
-
$stops[(count($stops)-1)]['offset'] = 1;
|
366 |
-
}
|
367 |
-
|
368 |
-
for($i=0;$i<count($stops);$i++) {
|
369 |
-
// mPDF 5.3.74
|
370 |
-
if ($colorspace == 'CMYK') {
|
371 |
-
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F %.3F %.3F %.3F', (ord($stops[$i]['col']{1})/100), (ord($stops[$i]['col']{2})/100), (ord($stops[$i]['col']{3})/100), (ord($stops[$i]['col']{4})/100));
|
372 |
-
}
|
373 |
-
else if ($colorspace == 'Gray') {
|
374 |
-
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F', (ord($stops[$i]['col']{1})/255));
|
375 |
-
}
|
376 |
-
else {
|
377 |
-
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F %.3F %.3F', (ord($stops[$i]['col']{1})/255), (ord($stops[$i]['col']{2})/255), (ord($stops[$i]['col']{3})/255));
|
378 |
-
}
|
379 |
-
if (!isset($stops[$i]['opacity'])) { $stops[$i]['opacity'] = 1; }
|
380 |
-
else if ($stops[$i]['opacity'] > 1 || $stops[$i]['opacity'] < 0) { $stops[$i]['opacity'] = 1; }
|
381 |
-
else if ($stops[$i]['opacity'] < 1) {
|
382 |
-
$trans = true;
|
383 |
-
}
|
384 |
-
$this->mpdf->gradients[$n]['stops'][$i]['opacity'] = $stops[$i]['opacity'];
|
385 |
-
// OFFSET
|
386 |
-
if ($i>0 && $i<(count($stops)-1)) {
|
387 |
-
if (!isset($stops[$i]['offset']) || (isset($stops[$i+1]['offset']) && $stops[$i]['offset']>$stops[$i+1]['offset']) || $stops[$i]['offset']<$stops[$i-1]['offset']) {
|
388 |
-
if (isset($stops[$i-1]['offset']) && isset($stops[$i+1]['offset'])) {
|
389 |
-
$stops[$i]['offset'] = ($stops[$i-1]['offset']+$stops[$i+1]['offset'])/2;
|
390 |
-
}
|
391 |
-
else {
|
392 |
-
for($j=($i+1);$j<count($stops);$j++) {
|
393 |
-
if(isset($stops[$j]['offset'])) { break; }
|
394 |
-
}
|
395 |
-
$int = ($stops[$j]['offset'] - $stops[($i-1)]['offset'])/($j-$i+1);
|
396 |
-
for($f=0;$f<($j-$i-1);$f++) {
|
397 |
-
$stops[($i+$f)]['offset'] = $stops[($i+$f-1)]['offset'] + ($int);
|
398 |
-
}
|
399 |
-
}
|
400 |
-
}
|
401 |
-
}
|
402 |
-
$this->mpdf->gradients[$n]['stops'][$i]['offset'] = $stops[$i]['offset'];
|
403 |
-
$this->mpdf->gradients[$n]['stops'][$i]['offset'] = $stops[$i]['offset'];
|
404 |
-
}
|
405 |
-
|
406 |
-
if ($repeat) {
|
407 |
-
$ns = count($this->mpdf->gradients[$n]['stops']);
|
408 |
-
$offs = array();
|
409 |
-
for($i=0;$i<$ns;$i++) {
|
410 |
-
$offs[$i] = $this->mpdf->gradients[$n]['stops'][$i]['offset'];
|
411 |
-
}
|
412 |
-
$gp = 0;
|
413 |
-
$inside=true;
|
414 |
-
while($inside) {
|
415 |
-
$gp++;
|
416 |
-
for($i=0;$i<$ns;$i++) {
|
417 |
-
$this->mpdf->gradients[$n]['stops'][(($ns*$gp)+$i)] = $this->mpdf->gradients[$n]['stops'][(($ns*($gp-1))+$i)];
|
418 |
-
$tmp = $this->mpdf->gradients[$n]['stops'][(($ns*($gp-1))+($ns-1))]['offset']+$offs[$i] ;
|
419 |
-
if ($tmp < 1) { $this->mpdf->gradients[$n]['stops'][(($ns*$gp)+$i)]['offset'] = $tmp; }
|
420 |
-
else {
|
421 |
-
$this->mpdf->gradients[$n]['stops'][(($ns*$gp)+$i)]['offset'] = 1;
|
422 |
-
$inside = false;
|
423 |
-
break(2);
|
424 |
-
}
|
425 |
-
}
|
426 |
-
}
|
427 |
-
}
|
428 |
-
|
429 |
-
if ($trans) {
|
430 |
-
$this->mpdf->gradients[$n]['trans'] = true;
|
431 |
-
$s .= ' /TGS'.$n.' gs ';
|
432 |
-
}
|
433 |
-
if (!is_array($extend) || count($extend) <1) {
|
434 |
-
$extend=array('true', 'true'); // These are supposed to be quoted - appear in PDF file as text
|
435 |
-
}
|
436 |
-
$this->mpdf->gradients[$n]['coords'] = $coords;
|
437 |
-
$this->mpdf->gradients[$n]['extend'] = $extend;
|
438 |
-
//paint the gradient
|
439 |
-
$s .= '/Sh'.$n.' sh '."\n";
|
440 |
-
//restore previous Graphic State
|
441 |
-
$s .= ' Q '."\n";
|
442 |
-
if ($return) { return $s; }
|
443 |
-
else { $this->mpdf->_out($s); }
|
444 |
-
}
|
445 |
-
|
446 |
-
|
447 |
-
function parseMozGradient($bg) {
|
448 |
-
// background[-image]: -moz-linear-gradient(left, #c7Fdde 20%, #FF0000 );
|
449 |
-
// background[-image]: linear-gradient(left, #c7Fdde 20%, #FF0000 ); // CSS3
|
450 |
-
if (preg_match('/repeating-/',$bg)) { $repeat = true; }
|
451 |
-
else { $repeat = false; }
|
452 |
-
if (preg_match('/linear-gradient\((.*)\)/',$bg,$m)) {
|
453 |
-
$g = array();
|
454 |
-
$g['type'] = 2;
|
455 |
-
$g['colorspace'] = 'RGB';
|
456 |
-
$g['extend'] = array('true','true');
|
457 |
-
$v = trim($m[1]);
|
458 |
-
// Change commas inside e.g. rgb(x,x,x)
|
459 |
-
while(preg_match('/(\([^\)]*?),/',$v)) { $v = preg_replace('/(\([^\)]*?),/','\\1@',$v); }
|
460 |
-
// Remove spaces inside e.g. rgb(x, x, x)
|
461 |
-
while(preg_match('/(\([^\)]*?)[ ]/',$v)) { $v = preg_replace('/(\([^\)]*?)[ ]/','\\1',$v); }
|
462 |
-
$bgr = preg_split('/\s*,\s*/',$v);
|
463 |
-
for($i=0;$i<count($bgr);$i++) { $bgr[$i] = preg_replace('/@/', ',', $bgr[$i]); }
|
464 |
-
// Is first part $bgr[0] a valid point/angle?
|
465 |
-
$first = preg_split('/\s+/',trim($bgr[0]));
|
466 |
-
if (preg_match('/(left|center|right|bottom|top|deg|grad|rad)/i',$bgr[0]) && !preg_match('/(<#|rgb|rgba|hsl|hsla)/i',$bgr[0])) {
|
467 |
-
$startStops = 1;
|
468 |
-
}
|
469 |
-
else if (trim($first[(count($first)-1)]) === "0") {
|
470 |
-
$startStops = 1;
|
471 |
-
}
|
472 |
-
else {
|
473 |
-
$check = $this->mpdf->ConvertColor($first[0]);
|
474 |
-
if ($check) $startStops = 0;
|
475 |
-
else $startStops = 1;
|
476 |
-
}
|
477 |
-
// first part a valid point/angle?
|
478 |
-
if ($startStops == 1) { // default values
|
479 |
-
// [<point> || <angle>,] = [<% em px left center right bottom top> || <deg grad rad 0>,]
|
480 |
-
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i',$bgr[0],$m)) {
|
481 |
-
$angle = $m[1] + 0;
|
482 |
-
if (strtolower($m[2])=='deg') { $angle = $angle; }
|
483 |
-
else if (strtolower($m[2])=='grad') { $angle *= (360/400); }
|
484 |
-
else if (strtolower($m[2])=='rad') { $angle = rad2deg($angle); }
|
485 |
-
while($angle < 0) { $angle += 360; }
|
486 |
-
$angle = ($angle % 360);
|
487 |
-
}
|
488 |
-
else if (trim($first[(count($first)-1)]) === "0") { $angle = 0; }
|
489 |
-
if (preg_match('/left/i',$bgr[0])) { $startx = 0; }
|
490 |
-
else if (preg_match('/right/i',$bgr[0])) { $startx = 1; }
|
491 |
-
if (preg_match('/top/i',$bgr[0])) { $starty = 1; }
|
492 |
-
else if (preg_match('/bottom/i',$bgr[0])) { $starty = 0; }
|
493 |
-
// Check for %? ?% or %%
|
494 |
-
if (preg_match('/(\d+)[%]/i',$first[0],$m)) { $startx = $m[1]/100; }
|
495 |
-
else if (!isset($startx) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$first[0],$m)) {
|
496 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
497 |
-
if ($tmp) { $startx = $m[1]; }
|
498 |
-
}
|
499 |
-
if (isset($first[1]) && preg_match('/(\d+)[%]/i',$first[1],$m)) { $starty = 1 - ($m[1]/100); }
|
500 |
-
else if (!isset($starty) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$first[1],$m)) {
|
501 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
502 |
-
if ($tmp) { $starty = $m[1]; }
|
503 |
-
}
|
504 |
-
if (isset($startx) && !isset($starty)) { $starty = 0.5; }
|
505 |
-
if (!isset($startx) && isset($starty)) { $startx = 0.5; }
|
506 |
-
|
507 |
-
}
|
508 |
-
// If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
|
509 |
-
else { // default values T2B
|
510 |
-
$starty = 1; $startx = 0.5;
|
511 |
-
$endy = 0; $endx = 0.5;
|
512 |
-
}
|
513 |
-
$coords = array();
|
514 |
-
if (!isset($startx)) { $startx = false; }
|
515 |
-
if (!isset($starty)) { $starty = false; }
|
516 |
-
if (!isset($endx)) { $endx = false; }
|
517 |
-
if (!isset($endy)) { $endy = false; }
|
518 |
-
if (!isset($angle)) { $angle = false; }
|
519 |
-
$g['coords'] = array($startx ,$starty ,$endx ,$endy, $angle, $repeat );
|
520 |
-
$g['stops'] = array();
|
521 |
-
for($i=$startStops;$i<count($bgr);$i++) {
|
522 |
-
$stop = array();
|
523 |
-
// parse stops
|
524 |
-
$el = preg_split('/\s+/',trim($bgr[$i]));
|
525 |
-
// mPDF 5.3.74
|
526 |
-
$col = $this->mpdf->ConvertColor($el[0]);
|
527 |
-
if ($col) { $stop['col'] = $col; }
|
528 |
-
else { $stop['col'] = $col = $this->mpdf->ConvertColor(255); }
|
529 |
-
if ($col{0}==1) $g['colorspace'] = 'Gray';
|
530 |
-
else if ($col{0}==4 || $col{0}==6) $g['colorspace'] = 'CMYK';
|
531 |
-
if ($col{0}==5) { $stop['opacity'] = ord($col{4})/100; } // transparency from rgba()
|
532 |
-
else if ($col{0}==6) { $stop['opacity'] = ord($col{5})/100; } // transparency from cmyka()
|
533 |
-
else if ($col{0}==1 && $col{2}==1) { $stop['opacity'] = ord($col{3})/100; } // transparency converted from rgba or cmyka()
|
534 |
-
|
535 |
-
if (isset($el[1]) && preg_match('/(\d+)[%]/',$el[1],$m)) {
|
536 |
-
$stop['offset'] = $m[1]/100;
|
537 |
-
if ($stop['offset']>1) { unset($stop['offset']); }
|
538 |
-
}
|
539 |
-
else if (isset($el[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$el[1],$m)) {
|
540 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
541 |
-
if ($tmp) { $stop['offset'] = $m[1]; }
|
542 |
-
}
|
543 |
-
$g['stops'][] = $stop;
|
544 |
-
}
|
545 |
-
if (count($g['stops'] )) { return $g; }
|
546 |
-
}
|
547 |
-
else if (preg_match('/radial-gradient\((.*)\)/',$bg,$m)) {
|
548 |
-
$g = array();
|
549 |
-
$g['type'] = 3;
|
550 |
-
$g['colorspace'] = 'RGB';
|
551 |
-
$g['extend'] = array('true','true');
|
552 |
-
$v = trim($m[1]);
|
553 |
-
// Change commas inside e.g. rgb(x,x,x)
|
554 |
-
while(preg_match('/(\([^\)]*?),/',$v)) { $v = preg_replace('/(\([^\)]*?),/','\\1@',$v); }
|
555 |
-
// Remove spaces inside e.g. rgb(x, x, x)
|
556 |
-
while(preg_match('/(\([^\)]*?)[ ]/',$v)) { $v = preg_replace('/(\([^\)]*?)[ ]/','\\1',$v); }
|
557 |
-
$bgr = preg_split('/\s*,\s*/',$v);
|
558 |
-
for($i=0;$i<count($bgr);$i++) { $bgr[$i] = preg_replace('/@/', ',', $bgr[$i]); }
|
559 |
-
|
560 |
-
// Is first part $bgr[0] a valid point/angle?
|
561 |
-
$startStops = 0;
|
562 |
-
$pos_angle = false;
|
563 |
-
$shape_size = false;
|
564 |
-
$first = preg_split('/\s+/',trim($bgr[0]));
|
565 |
-
$checkCol = $this->mpdf->ConvertColor($first[0]);
|
566 |
-
if (preg_match('/(left|center|right|bottom|top|deg|grad|rad)/i',$bgr[0]) && !preg_match('/(<#|rgb|rgba|hsl|hsla)/i',$bgr[0])) {
|
567 |
-
$startStops=1;
|
568 |
-
$pos_angle = $bgr[0];
|
569 |
-
}
|
570 |
-
else if (trim($first[(count($first)-1)]) === "0") {
|
571 |
-
$startStops=1;
|
572 |
-
$pos_angle = $bgr[0];
|
573 |
-
}
|
574 |
-
else if (preg_match('/(circle|ellipse|closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i',$bgr[0])) {
|
575 |
-
$startStops=1;
|
576 |
-
$shape_size = $bgr[0];
|
577 |
-
}
|
578 |
-
else if (!$checkCol) {
|
579 |
-
$startStops=1;
|
580 |
-
$pos_angle = $bgr[0];
|
581 |
-
}
|
582 |
-
if (preg_match('/(circle|ellipse|closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i',$bgr[1])) {
|
583 |
-
$startStops=2;
|
584 |
-
$shape_size = $bgr[1];
|
585 |
-
}
|
586 |
-
|
587 |
-
// If valid point/angle?
|
588 |
-
if ($pos_angle) { // default values
|
589 |
-
// [<point> || <angle>,] = [<% em px left center right bottom top> || <deg grad rad 0>,]
|
590 |
-
if (preg_match('/left/i',$pos_angle)) { $startx = 0; }
|
591 |
-
else if (preg_match('/right/i',$pos_angle)) { $startx = 1; }
|
592 |
-
if (preg_match('/top/i',$pos_angle)) { $starty = 1; }
|
593 |
-
else if (preg_match('/bottom/i',$pos_angle)) { $starty = 0; }
|
594 |
-
// Check for %? ?% or %%
|
595 |
-
if (preg_match('/(\d+)[%]/i',$first[0],$m)) { $startx = $m[1]/100; }
|
596 |
-
else if (!isset($startx) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$first[0],$m)) {
|
597 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
598 |
-
if ($tmp) { $startx = $m[1]; }
|
599 |
-
}
|
600 |
-
if (isset($first[1]) && preg_match('/(\d+)[%]/i',$first[1],$m)) { $starty = 1 - ($m[1]/100); }
|
601 |
-
else if (!isset($starty) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$first[1],$m)) {
|
602 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
603 |
-
if ($tmp) { $starty = $m[1]; }
|
604 |
-
}
|
605 |
-
|
606 |
-
/*
|
607 |
-
// ?? Angle has no effect in radial gradient (does not exist in CSS3 spec.)
|
608 |
-
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i',$pos_angle,$m)) {
|
609 |
-
$angle = $m[1] + 0;
|
610 |
-
if (strtolower($m[2])=='deg') { $angle = $angle; }
|
611 |
-
else if (strtolower($m[2])=='grad') { $angle *= (360/400); }
|
612 |
-
else if (strtolower($m[2])=='rad') { $angle = rad2deg($angle); }
|
613 |
-
while($angle < 0) { $angle += 360; }
|
614 |
-
$angle = ($angle % 360);
|
615 |
-
}
|
616 |
-
*/
|
617 |
-
if (!isset($starty)) { $starty = 0.5; }
|
618 |
-
if (!isset($startx)) { $startx = 0.5; }
|
619 |
-
|
620 |
-
}
|
621 |
-
// If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
|
622 |
-
else { // default values Center
|
623 |
-
$starty = 0.5; $startx = 0.5;
|
624 |
-
$endy = 0.5; $endx = 0.5;
|
625 |
-
}
|
626 |
-
|
627 |
-
// If valid shape/size?
|
628 |
-
$shape = 'ellipse'; // default
|
629 |
-
$size = 'farthest-corner'; // default
|
630 |
-
if ($shape_size) { // default values
|
631 |
-
if (preg_match('/(circle|ellipse)/i',$shape_size, $m)) {
|
632 |
-
$shape = $m[1];
|
633 |
-
}
|
634 |
-
if (preg_match('/(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i',$shape_size, $m)) {
|
635 |
-
$size = $m[1];
|
636 |
-
if ($size=='contain') { $size = 'closest-side'; }
|
637 |
-
else if ($size=='cover') { $size = 'farthest-corner'; }
|
638 |
-
}
|
639 |
-
}
|
640 |
-
|
641 |
-
$coords = array();
|
642 |
-
if (!isset($startx)) { $startx = false; }
|
643 |
-
if (!isset($starty)) { $starty = false; }
|
644 |
-
if (!isset($endx)) { $endx = false; }
|
645 |
-
if (!isset($endy)) { $endy = false; }
|
646 |
-
if (!isset($radius)) { $radius = false; }
|
647 |
-
if (!isset($angle)) { $angle = 0; }
|
648 |
-
$g['coords'] = array($startx ,$starty ,$endx ,$endy, $radius, $angle, $shape, $size, $repeat );
|
649 |
-
|
650 |
-
$g['stops'] = array();
|
651 |
-
for($i=$startStops;$i<count($bgr);$i++) {
|
652 |
-
$stop = array();
|
653 |
-
// parse stops
|
654 |
-
$el = preg_split('/\s+/',trim($bgr[$i]));
|
655 |
-
// mPDF 5.3.74
|
656 |
-
$col = $this->mpdf->ConvertColor($el[0]);
|
657 |
-
if ($col) { $stop['col'] = $col; }
|
658 |
-
else { $stop['col'] = $col = $this->mpdf->ConvertColor(255); }
|
659 |
-
if ($col{0}==1) $g['colorspace'] = 'Gray';
|
660 |
-
else if ($col{0}==4 || $col{0}==6) $g['colorspace'] = 'CMYK';
|
661 |
-
if ($col{0}==5) { $stop['opacity'] = ord($col{4})/100; } // transparency from rgba()
|
662 |
-
else if ($col{0}==6) { $stop['opacity'] = ord($col{5})/100; } // transparency from cmyka()
|
663 |
-
else if ($col{0}==1 && $col{2}==1) { $stop['opacity'] = ord($col{3})/100; } // transparency converted from rgba or cmyka()
|
664 |
-
|
665 |
-
if (isset($el[1]) && preg_match('/(\d+)[%]/',$el[1],$m)) {
|
666 |
-
$stop['offset'] = $m[1]/100;
|
667 |
-
if ($stop['offset']>1) { unset($stop['offset']); }
|
668 |
-
}
|
669 |
-
else if (isset($el[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i',$el[1],$m)) {
|
670 |
-
$tmp = $this->mpdf->ConvertSize($m[1],$this->mpdf->w,$this->mpdf->FontSize,false);
|
671 |
-
$stop['offset'] = $el[1];
|
672 |
-
}
|
673 |
-
$g['stops'][] = $stop;
|
674 |
-
}
|
675 |
-
if (count($g['stops'] )) { return $g; }
|
676 |
-
}
|
677 |
-
return array();
|
678 |
-
}
|
679 |
-
|
680 |
-
function parseBackgroundGradient($bg) {
|
681 |
-
// background-gradient: linear #00FFFF #FFFF00 0 0.5 1 0.5; or
|
682 |
-
// background-gradient: radial #00FFFF #FFFF00 0.5 0.5 1 1 1.2;
|
683 |
-
|
684 |
-
$v = trim($bg);
|
685 |
-
$bgr = preg_split('/\s+/',$v);
|
686 |
-
$g = array();
|
687 |
-
if (count($bgr)> 6) {
|
688 |
-
if (strtoupper(substr($bgr[0],0,1)) == 'L' && count($bgr)==7) { // linear
|
689 |
-
$g['type'] = 2;
|
690 |
-
//$coords = array(0,0,1,1 ); // 0 0 1 0 or 0 1 1 1 is L 2 R; 1,1,0,1 is R2L; 1,1,1,0 is T2B; 1,0,1,1 is B2T
|
691 |
-
// Linear: $coords - array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg).
|
692 |
-
// The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
|
693 |
-
$g['coords'] = array($bgr[3], $bgr[4], $bgr[5], $bgr[6]);
|
694 |
-
}
|
695 |
-
else if (count($bgr)==8) { // radial
|
696 |
-
$g['type'] = 3;
|
697 |
-
// Radial: $coords - array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1,
|
698 |
-
// (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg).
|
699 |
-
// (fx, fy) should be inside the circle, otherwise some areas will not be defined
|
700 |
-
$g['coords'] = array($bgr[3], $bgr[4], $bgr[5], $bgr[6], $bgr[7]);
|
701 |
-
}
|
702 |
-
$g['colorspace'] = 'RGB';
|
703 |
-
// mPDF 5.3.74
|
704 |
-
$cor = $this->mpdf->ConvertColor($bgr[1]);
|
705 |
-
if ($cor{0}==1) $g['colorspace'] = 'Gray';
|
706 |
-
else if ($cor{0}==4 || $cor{0}==6) $g['colorspace'] = 'CMYK';
|
707 |
-
if ($cor) { $g['col'] = $cor; }
|
708 |
-
else { $g['col'] = $this->mpdf->ConvertColor(255); }
|
709 |
-
$cor = $this->mpdf->ConvertColor($bgr[2]);
|
710 |
-
if ($cor) { $g['col2'] = $cor; }
|
711 |
-
else { $g['col2'] = $this->mpdf->ConvertColor(255); }
|
712 |
-
$g['extend'] = array('true','true');
|
713 |
-
$g['stops'] = array(array('col'=>$g['col'], 'opacity'=>1, 'offset'=>0), array('col'=>$g['col2'], 'opacity'=>1, 'offset'=>1));
|
714 |
-
return $g;
|
715 |
-
}
|
716 |
-
return false;
|
717 |
-
}
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
}
|
722 |
-
|
723 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/indic.php
DELETED
@@ -1,433 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class indic {
|
4 |
-
|
5 |
-
function indic() {
|
6 |
-
|
7 |
-
}
|
8 |
-
|
9 |
-
|
10 |
-
function substituteIndic($earr, $lang, $font) {
|
11 |
-
global $voltdata;
|
12 |
-
|
13 |
-
if (!isset($voltdata[$font])) {
|
14 |
-
include_once(_MPDF_PATH.'includes/'.$font.'.volt.php');
|
15 |
-
$voltdata[$font] = $volt;
|
16 |
-
}
|
17 |
-
|
18 |
-
foreach($earr as $eid=>$char) {
|
19 |
-
$earr[$eid] = sprintf("%04s", strtoupper(dechex($char)));
|
20 |
-
}
|
21 |
-
$vstr = "0020 ".implode(" ",$earr)." 0020";
|
22 |
-
//============================
|
23 |
-
// Common Indic Punctuation marks
|
24 |
-
// If NOT devanagari
|
25 |
-
if ($lang!='hi') {
|
26 |
-
$vstr = str_replace('0964','007C', $vstr); // U+0964 replace with "|"
|
27 |
-
$vstr = str_replace('0965','007C 007C', $vstr); // U+0964 replace with "|"
|
28 |
-
}
|
29 |
-
//============================
|
30 |
-
// Tamil numeral for Zero missing Added mPDF 4.2
|
31 |
-
if ($lang=='ta') {
|
32 |
-
$vstr = str_replace('0BE6','0030', $vstr); // U+0BEB replace with "0"
|
33 |
-
}
|
34 |
-
|
35 |
-
//============================
|
36 |
-
// Re-order vowels
|
37 |
-
|
38 |
-
// DEVANAGARI vowel sign matraI[093F] before consonant
|
39 |
-
if ($lang=='hi') {
|
40 |
-
$prebasedvowels = "(093F)";
|
41 |
-
$nukta = "093C";
|
42 |
-
$halant = "094D";
|
43 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/','\\2 \\1', $vstr); // vowel sign pre-based shift left
|
44 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/','\\2 \\1 '.$nukta, $vstr); // before NUKTA
|
45 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/','\\2 \\1 '.$halant, $vstr); // before CHAR HALANT == VIRAMA
|
46 |
-
}
|
47 |
-
|
48 |
-
// BENGALI vowels [09BF 09C7 09C8]
|
49 |
-
else if ($lang=='bn') {
|
50 |
-
|
51 |
-
// Khanda Ta 09CE not in font -> replace with 09A4|09CD
|
52 |
-
$vstr = preg_replace('/09CE/','09A4 09CD 200D', $vstr); // mPDF 5.3.09
|
53 |
-
|
54 |
-
// BENGALI double-part vowels [09CB 09C7 09BE][09CC 09C7 09D7]
|
55 |
-
$vstr = str_replace('09CB','09C7 09BE', $vstr); // convert to 2 parts
|
56 |
-
$vstr = str_replace('09CC','09C7 09D7', $vstr); // 09C7 pre-based is then shifted below
|
57 |
-
$prebasedvowels = "(09BF|09C7|09C8)";
|
58 |
-
$nukta = "09BC";
|
59 |
-
$halant = "09CD";
|
60 |
-
// mPDF 5.0.044
|
61 |
-
$bnfullcons = "0995|0996|0997|0998|0999|099A|099B|099C|099D|099F|09A0|09A1|09A2|09A3|09A4|09A5|09A6|09A7|09A8|09AA|09AB|09AC|09AD|09AE|09AF|09B0|09B2|09B6|09B7|09B8|09B9|09DC|09DD|09DF";
|
62 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/','\\2 \\1', $vstr); // vowel sign pre-based shift left
|
63 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/','\\2 \\1 '.$nukta, $vstr); // before NUKTA
|
64 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/','\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
|
65 |
-
// mPDF 5.0.044
|
66 |
-
// .. and shifting left-based vowel further to the left in case 3 consonants together.
|
67 |
-
$vstr = preg_replace('/('.$bnfullcons.') '.$halant.' '.$prebasedvowels.'/','\\2 \\1 '.$halant, $vstr);
|
68 |
-
|
69 |
-
// mPDF 5.0.044
|
70 |
-
// If left-based vowel has now been shifted to left of RA/Halant (09B0/09CD)
|
71 |
-
// Convert here to above-line form (E068) as it would get missed later
|
72 |
-
// e.g. 09B0 09CD 09AD 09C7 would be changed above =>
|
73 |
-
// e.g. 09C7 09B0 09CD 09AD. The 09B0 09CD should => E068
|
74 |
-
// ??? need to add 09BF as well (09BF|09C7|09C8)
|
75 |
-
$vstr = preg_replace('/(09C7|09C8) 09B0 09CD/', '\\1 E068', $vstr);
|
76 |
-
|
77 |
-
}
|
78 |
-
|
79 |
-
// GUJARATI pre-based vowel [0ABF]
|
80 |
-
else if ($lang=='gu') {
|
81 |
-
$prebasedvowels = "(0ABF)";
|
82 |
-
$nukta = "0ABC";
|
83 |
-
$halant = "0ACD";
|
84 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/','\\2 \\1', $vstr); // vowel sign pre-based shift left
|
85 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/','\\2 \\1 '.$nukta, $vstr); // before NUKTA
|
86 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/','\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
|
87 |
-
}
|
88 |
-
|
89 |
-
// GURMUKHI/PUNJABI pre-based vowel [0ABF]
|
90 |
-
else if ($lang=='pa') {
|
91 |
-
$prebasedvowels = "(0A3F)";
|
92 |
-
$nukta = "0A3C";
|
93 |
-
$halant = "0A4D";
|
94 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/','\\2 \\1', $vstr); // vowel sign pre-based shift left
|
95 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/','\\2 \\1 '.$nukta, $vstr); // before NUKTA
|
96 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/','\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
|
97 |
-
}
|
98 |
-
|
99 |
-
// TAMIL pre-based vowel [0ABF]
|
100 |
-
else if ($lang=='ta') {
|
101 |
-
// Shrii (Shree)
|
102 |
-
$vstr = preg_replace('/0BB6 0BCD 0BB0 0BC0/','E04B', $vstr);
|
103 |
-
|
104 |
-
// TAMIL double-part vowels [0BCA 0BC6 0BBE][0BCB 0BC7 0BBE][0BCC 0BC6 0BD7]
|
105 |
-
$vstr = preg_replace('/0BCA/','0BC6 0BBE', $vstr); // convert to 2 parts
|
106 |
-
$vstr = preg_replace('/0BCB/','0BC7 0BBE', $vstr); // pre-based is then shifted below
|
107 |
-
$vstr = preg_replace('/0BCC/','0BC6 0BD7', $vstr);
|
108 |
-
$prebasedvowels = "(0BC6|0BC7|0BC8)";
|
109 |
-
// No nukta
|
110 |
-
$halant = "0BCD"; // Doesn't seem to move most in front of halanted consonants
|
111 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/','\\2 \\1', $vstr); // vowel sign pre-based shift left
|
112 |
-
// ? Only for special case KSS (already moved to left of 0BB7)
|
113 |
-
$vstr = preg_replace('/0B95 '.$halant.' '.$prebasedvowels.' 0BB7/','\\1 0B95 '.$halant.' 0BB7', $vstr);
|
114 |
-
}
|
115 |
-
|
116 |
-
// ORIYA
|
117 |
-
else if ($lang=='or') {
|
118 |
-
// ORIYA double-part vowels []
|
119 |
-
$vstr = str_replace('0B48','0B47 0B56', $vstr); // 2-part Vowel
|
120 |
-
$vstr = str_replace('0B4B','0B47 0B3E', $vstr); // 2-part Vowel
|
121 |
-
$vstr = str_replace('0B4C','0B47 0B57', $vstr); // 2-part Vowel
|
122 |
-
$orprebasedvowels = "(0B47)";
|
123 |
-
// No nukta
|
124 |
-
$halant = "0B4D";
|
125 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$orprebasedvowels.'/','\\2 \\1', $vstr); // vowel sign pre-based shift left
|
126 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$orprebasedvowels.'/','\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
|
127 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$orprebasedvowels.'/','\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
|
128 |
-
}
|
129 |
-
|
130 |
-
// MALAYALAM
|
131 |
-
else if ($lang=='ml') {
|
132 |
-
// Chillus - old forms - remove ZWNJ after
|
133 |
-
// This font Volt rules recognises e.g. "Na Halant(Virama)" as ChilluN
|
134 |
-
$vstr = preg_replace('/(0D23 0D4D|0D28 0D4D|0D30 0D4D|0D32 0D4D|0D33 0D4D) 200D/','\\1', $vstr);
|
135 |
-
// See Chillus in Unicode [http://en.wikipedia.org/wiki/Malayalam_script]
|
136 |
-
$vstr = str_replace('0D7A','0D23 0D4D', $vstr); // [mlymChilluNn]
|
137 |
-
$vstr = str_replace('0D7B','0D28 0D4D', $vstr); // [mlymChilluN]
|
138 |
-
$vstr = str_replace('0D7C','0D30 0D4D', $vstr); // [mlymChilluR]
|
139 |
-
$vstr = str_replace('0D7D','0D32 0D4D', $vstr); // [mlymChilluL]
|
140 |
-
$vstr = str_replace('0D7E','0D33 0D4D', $vstr); // [mlymChilluLl]
|
141 |
-
/*
|
142 |
-
// Chillus - 0D7A-0D7E not in font directly, but as E005-E009
|
143 |
-
$vstr = preg_replace('/0D23 0D4D 200D/','0D7A', $vstr);
|
144 |
-
$vstr = preg_replace('/0D28 0D4D 200D/','0D7B', $vstr);
|
145 |
-
$vstr = preg_replace('/0D30 0D4D 200D/','0D7C', $vstr);
|
146 |
-
$vstr = preg_replace('/0D32 0D4D 200D/','0D7D', $vstr);
|
147 |
-
$vstr = preg_replace('/0D33 0D4D 200D/','0D7E', $vstr);
|
148 |
-
|
149 |
-
$vstr = preg_replace('/0D7F/','E004', $vstr); // [mlymChilluK]
|
150 |
-
$vstr = preg_replace('/0D7A/','E005', $vstr); // [mlymChilluNn]
|
151 |
-
$vstr = preg_replace('/0D7B/','E006', $vstr); // [mlymChilluN]
|
152 |
-
$vstr = preg_replace('/0D7C/','E007', $vstr); // [mlymChilluR]
|
153 |
-
$vstr = preg_replace('/0D7D/','E008', $vstr); // [mlymChilluL]
|
154 |
-
$vstr = preg_replace('/0D7E/','E009', $vstr); // [mlymChilluLl]
|
155 |
-
*/
|
156 |
-
|
157 |
-
// MALAYALAM double-part vowels []
|
158 |
-
$vstr = str_replace('0D4A','0D46 0D3E', $vstr); // 2-part Vowel
|
159 |
-
$vstr = str_replace('0D4B','0D47 0D3E', $vstr); // 2-part Vowel
|
160 |
-
$vstr = str_replace('0D4C','0D46 0D57', $vstr); // 2-part Vowel
|
161 |
-
$mlprebasedvowels = "(0D46|0D47|0D48)";
|
162 |
-
// No nukta
|
163 |
-
$halant = "0D4D";
|
164 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$mlprebasedvowels.'/','\\2 \\1', $vstr); // vowel sign pre-based shift left
|
165 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$mlprebasedvowels.'/','\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
|
166 |
-
}
|
167 |
-
|
168 |
-
// TELUGU
|
169 |
-
else if ($lang=='te') {
|
170 |
-
// TELUGU double-part vowels [0C48 -> 0C46 0C56]
|
171 |
-
$vstr = str_replace('0C48','0C46 0C56', $vstr); // 2-part Vowel
|
172 |
-
$prebasedvowels = "(0C46)";
|
173 |
-
$abvvowels = "(0C3E|0C3F|0C40|0C46|0C47|0C4A|0C4B|0C4C|0C55)";
|
174 |
-
// No nukta
|
175 |
-
$halant = "0C4D";
|
176 |
-
$tefullforms = "0C15|0C17|0C18|0C1A|0C1B|0C1C|0C1D|0C20|0C21|0C22|0C24|0C25|0C26|0C27|0C28|0C2A|0C2B|0C2D|0C2E|0C2F|0C30|0C33|0C35|0C36|0C37|0C38|0C39|E028|E029|E02A|E02B|E078|E07A|E07B";
|
177 |
-
$vstr = preg_replace('/('.$tefullforms .') '.$halant.' ('.$tefullforms .') '.$abvvowels .'/','\\1 \\3 '.$halant.' \\2', $vstr); // before HALANT
|
178 |
-
}
|
179 |
-
|
180 |
-
|
181 |
-
// KANNADA
|
182 |
-
else if ($lang=='kn') {
|
183 |
-
// KANNADA double-part vowels [0CC8 -> 0CC6 0CD6]
|
184 |
-
$vstr = str_replace('0CC0','0CBF 0CD5', $vstr); // 2-part Vowel
|
185 |
-
$vstr = str_replace('0CC7','0CC6 0CD5', $vstr); // 2-part Vowel
|
186 |
-
$vstr = str_replace('0CC8','0CC6 0CD6', $vstr); // 2-part Vowel AI - no glyph for single
|
187 |
-
$vstr = str_replace('0CCA','0CC6 0CC2', $vstr); // 2-part Vowel
|
188 |
-
$vstr = str_replace('0CCB','0CC6 0CC2 0CD5', $vstr); // 2-part Vowel
|
189 |
-
$prebasedvowels = "(0CBF|0CC6)";
|
190 |
-
$halant = "0CCD";
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
//============================
|
195 |
-
|
196 |
-
// SPECIALS
|
197 |
-
|
198 |
-
// DEVANAGARI Ra Halant Ra
|
199 |
-
if ($lang=='hi') {
|
200 |
-
$vstr = str_replace('0930 094D 0930','E05D 0930', $vstr); // Ra Halant Ra => halfRa FullRa
|
201 |
-
}
|
202 |
-
|
203 |
-
// GUJARATI
|
204 |
-
if ($lang=='gu') {
|
205 |
-
$vstr = str_replace('0AB0 0AC2','E02E', $vstr); // Ra VowelUu => SpecialForm RaUu
|
206 |
-
}
|
207 |
-
|
208 |
-
// TELUGU Ra Halant <Consonant> Halant => halfRa Halant<Consonant> Halant
|
209 |
-
if ($lang=='te') {
|
210 |
-
$vstr = preg_replace('/0C30 0C4D ([A-F0-9]{4}) 0C4D/','E021 0C4D \\1 0C4D', $vstr);
|
211 |
-
}
|
212 |
-
|
213 |
-
// KANNADA
|
214 |
-
// Reph at end of word becomes E0CC instead of E00B
|
215 |
-
if ($lang=='kn') {
|
216 |
-
$vstr = str_replace('0CB0 0CCD 0020','E0CC 0020', $vstr); // mPDF 5.3.87
|
217 |
-
}
|
218 |
-
|
219 |
-
|
220 |
-
//============================
|
221 |
-
// MAIN BIT FROM VOLT RULES
|
222 |
-
foreach($voltdata[$font] AS $rid=>$reps) {
|
223 |
-
//echo $rid . ': ' . $vstr.'<br />';
|
224 |
-
$vstr = preg_replace('/'.$reps['match'].'/',$reps['replace'], $vstr);
|
225 |
-
}
|
226 |
-
//echo $vstr.'<br />'; exit;
|
227 |
-
|
228 |
-
|
229 |
-
//============================
|
230 |
-
|
231 |
-
// SPECIALS
|
232 |
-
|
233 |
-
// KANNADA
|
234 |
-
// <Base> <BelowBase1> [<BelowBase2> ] MatraI -> <Base/MatraI ligature> <Belowbase1> etc
|
235 |
-
if ($lang=='kn') {
|
236 |
-
$matraI = "0CBF";
|
237 |
-
$knbase = preg_split('/\|/', "0C95|0C96|0C97|0C98|0C9A|0C9B|0C9C|0C9D|0CA0|0CA1|0CA2|0CA3|0CA4|0CA5|0CA6|0CA7|0CA8|0CAA|0CAB|0CAC|0CAD|0CAE|0CAF|0CB0|0CB2|0CB3|0CB5|0CB6|0CB7|0CB8|0CB9|E0A3|E07D|E07E");
|
238 |
-
$knmatraIligature = preg_split('/\|/', "E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A4|E0A1|E0A2");
|
239 |
-
$belowbase1 = "E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037|E038|E039|E03A|E03B|E03C|E03D|E03E|E03F|E040|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E081";
|
240 |
-
$belowbase2 = "E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E081";
|
241 |
-
for ($i=0; $i<count($knbase);$i++) {
|
242 |
-
$vstr = preg_replace('/'.$knbase[$i].' ('.$belowbase1.') ('.$belowbase2.') '.$matraI.'/', $knmatraIligature[$i].' \\1 \\2', $vstr);
|
243 |
-
$vstr = preg_replace('/'.$knbase[$i].' ('.$belowbase1.') '.$matraI.'/', $knmatraIligature[$i].' \\1', $vstr);
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
// KANNADA
|
248 |
-
// [KanTtaFull] [matraI] => [KanTtaPartial] [matraI]
|
249 |
-
if ($lang=='kn') {
|
250 |
-
$vstr = preg_replace('/0C9F '.$matraI.'/', 'E015 '.$matraI, $vstr);
|
251 |
-
}
|
252 |
-
|
253 |
-
// ORIYA
|
254 |
-
if ($lang=='or') {
|
255 |
-
// SpecialCase Ra[0B30] Halant still left before [oryaFullNnNna] => E00F
|
256 |
-
$vstr = preg_replace('/0B30 '.$halant.' E00F/','E00F E069', $vstr); // convert to Reph
|
257 |
-
}
|
258 |
-
|
259 |
-
//============================
|
260 |
-
// SHIFT REPH
|
261 |
-
|
262 |
-
// DEVANAGARI Shift Reph [E015]
|
263 |
-
if ($lang=='hi') {
|
264 |
-
// FIRSTLY - halfRa = E05D - Change this to Reph [E015]
|
265 |
-
$himatchhalfforms = "E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D|E07E|E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E0D3|E0D4|E0D5|E0D6|E0D7|E0D8|E0D9|E0DA|E0DB|E0DC|E0DD|E0DE|E0DF|E0E0|E0E1|E0E2|E0E3|E0E4|E0E5|E0E6|E0E7|E0E8|E0E9|E0EA|E0EB|E0EC|E0ED|E0EE|E0EF|E0F0|E0F1|E0F2|E0F3|E0F4|E0F5|E0F6|E0F7|E0F8|E0F9|E0FA|E0FB|E0FC|E0FD|E0FE|E0FF|E100|E101|E102|E103|E104|E105|E106|E107|E108|E109|E10A|E10B|E10C|E10D|E10E|E10F|E110|E111|E112|E113|E114|E115|E116|E117|E118|E119|E11A|E13D|E13E|E13F|E140|E141|E142|E143|E144|E145";
|
266 |
-
$himatchfullforms = "0915|0916|0917|0918|0919|091A|091B|091C|091D|091E|091F|0920|0921|0922|0923|0924|0925|0926|0927|0928|092A|092B|092C|092D|092E|092F|0930|0932|0933|0935|0936|0937|0938|0939|E028|E029|0958|0959|095A|E02A|E02B|E02C|E02D|095B|E02E|E02F|E030|E031|095C|095D|E032|E033|E034|E035|E036|0929|E037|095E|E038|E039|E03A|095F|0931|E03B|0934|E03C|E03D|E03E|E03F|E040|E041|E042|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF|E0B0|E0B1|E0B2|E0B3|E0B4|E0B5|E0B6|E0B7|E0B8|E0B9|E0BA|E0BB|E0BC|E0BD|E0BE|E0BF|E0C0|E0C1|E0C2|E0C3|E0C4|E0C5|E0C6|E0C7|E0C8|E0C9|E0CA|E0CB|E0CC|E0CD|E0CE|E0CF|E0D0|E0D1|E0D2|E11E|E11F|E120|E121|E122|E123|E124|E125|E126|E127|E128|E129|E12A|E12B|E12C|E12D|E12E|E12F|E130|E131|E132|E133";
|
267 |
-
$vstr = preg_replace('/E05D ('.$himatchhalfforms.'|'.$himatchfullforms.')/', 'E015 \\1', $vstr);
|
268 |
-
|
269 |
-
// Reph = E015 - Shift Right to just after end of syllable
|
270 |
-
// FullAllForms + HalfAllForms + 093E matraA
|
271 |
-
while(preg_match('/E015 ('.$himatchhalfforms.')/', $vstr)) {
|
272 |
-
$vstr = preg_replace('/E015 ('.$himatchhalfforms.')/', '\\1 E015', $vstr);
|
273 |
-
}
|
274 |
-
$vstr = preg_replace('/E015 ('.$himatchfullforms.')/', '\\1 E015', $vstr);
|
275 |
-
|
276 |
-
// Now shift it beyond post-based vowels // ??? Need to add others e.g. 0949,094A,094B,094C + presentation forms like E198
|
277 |
-
$vstr = str_replace('E015 093E', '093E E015', $vstr);
|
278 |
-
$vstr = preg_replace('/E015 (0940|E194|E195|E196|E197|E198)/', '\\1 E014', $vstr); // (Small) reph [E014] to Right of matraI
|
279 |
-
$vstr = str_replace('E015 0947', '0947 E014', $vstr); // (Small) reph [E014] to Right of matraI
|
280 |
-
}
|
281 |
-
|
282 |
-
// BENGALI Shift Reph [E068]
|
283 |
-
else if ($lang=='bn') {
|
284 |
-
$bnfullconjuncts = "E002|E003|E004|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D|E07E|E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF|E0B0|E0B1|E0B2|E0B3|E0B4|E0B5|E0B6|E0B7|E0B8|E0B9|E0BA|E0BB|E0BC|E0BD|E0BE|E0BF|E0C0|E0C1|E0C2|E0C3|E0C4|E0C5|E0C6|E0C7|E0C8|E0C9|E0CA|E0CB|E0CC|E0CD|E0CE|E0CF|E0D0|E0D1|E0D2|E0D3|E0D4|E0D5|E0D6|E0D7|E0D8|E0D9|E0DA|E0DB|E0DC|E0DD|E0DE|E0DF|E0E0|E0E1|E0E2|E0E3|E0E4|E0E5|E0E6|E0E7|E0E8|E0E9|E0EA|E0EB|E0EC|E0ED|E0EE|E0EF|E0F0|E0F1|E0F2|E0F3|E0F4|E0F5|E0F6|E0F7|E0F8|E0F9|E0FA|E0FB|E0FC|E0FD|E0FE|E0FF|E100|E101|E102|E103|E104|E105|E106|E107|E108|E109|E10A|E10B|E10C|E10D|E10E|E10F|E110|E111|E112|E113|E114|E115|E116|E117|E118|E119|E11A|E11B|E11C|E11D|E11E|E11F|E120|E121|E122|E123|E124|E125|E126|E127|E128|E129|E12A|E12B|E12C|E12D|E12E|E12F|E130|E131|E132|E133|E134|E135|E136|E137|E138|E139|E13A|E13B|E13C|E13D|E13E|E13F|E140|E141|E142|E143|E144|E145|E146|E147|E148|E149|E14A|E14B|E14C|E14D|E14E|E14F|E150|E151|E152|E153|E154|E155|E156|E157|E158|E159|E15A|E15B|E15C|E15D|E15E|E15F|E160|E161|E162|E163|E164|E165|E166|E167|E168|E169|E16A|E16B|E16C|E16D|E16E|E16F|E170|E171|E172|E173|E174|E175|E176|E177|E178|E179|E17A|E17B|E17C|E17D|E17E|E17F|E180|E181|E182|E183|E184|E185|E186|E187|E188|E189|E18A|E18B|E18C|E18D|E18E|E18F|E190|E191|E192|E193|E194|E195|E196|E197|E198|E199|E19A";
|
285 |
-
// $bnfullcons - set above;
|
286 |
-
$vstr = preg_replace('/E068 ('.$bnfullconjuncts.'|'.$bnfullcons.')/', '\\1 E068', $vstr);
|
287 |
-
// ? Need to shift it beyond post-base vowels 09BE, 09C0, 09D7 haven't found so can't test??
|
288 |
-
$vstr = preg_replace('/E068 (09BE|09C0|09D7)/', '\\1 E068', $vstr);
|
289 |
-
}
|
290 |
-
|
291 |
-
// GUJARATI Shift Reph [E032]
|
292 |
-
else if ($lang=='gu') {
|
293 |
-
$gufullforms = "0A95|0A96|0A97|0A98|0A99|0A9A|0A9B|0A9C|0A9D|0A9E|0A9F|0AA0|0AA1|0AA2|0AA3|0AA4|0AA5|0AA6|0AA7|0AA8|0AAA|0AAB|0AAC|0AAD|0AAE|0AAF|0AB0|0AB2|0AB3|0AB5|0AB6|0AB7|0AB8|0AB9|E002|E003|E004|E005|E006|E007|E008|E009|E00A|E00B|E00C|E00D|E00E|E00F|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D|E07E|E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5";
|
294 |
-
$vstr = preg_replace('/E032 ('.$gufullforms.')/', '\\1 E032', $vstr);
|
295 |
-
// Now shift it beyond post-based vowels // ??? Need to add others e.g. 0949,094A,094B,094C + presentation forms like E198
|
296 |
-
// ? Need to shift it beyond post-base vowels 0ABE, 0AC0 haven't found so can't test??
|
297 |
-
$vstr = preg_replace('/E032 (0ABE|0AC0)/', '\\1 E032', $vstr);
|
298 |
-
}
|
299 |
-
|
300 |
-
|
301 |
-
// TELUGU Shift Reph to LEFT [E046|E069|E077] [TelRaSmallOne] => E046 [TelRaSmallTwo] => E069 [TelRaSmallThree] => E077
|
302 |
-
else if ($lang=='te') {
|
303 |
-
// tefullforms defined earlier
|
304 |
-
$tepartialforms = "E00D|E00E|E00F|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E07C|E07D|E07E";
|
305 |
-
$matraligs = "E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF";
|
306 |
-
$tevowels = "0C3E|0C3F|0C40|0C46|0C47|0C56|0C4A|0C4B|0C4C"
|
307 |
-
."|0C41|0C42|0C43|0C44"; // post matras
|
308 |
-
$vstr = preg_replace('/('.$tevowels.') (E046|E069|E077)/', '\\2 \\1', $vstr);
|
309 |
-
while(preg_match('/('.$tepartialforms.') (E046|E069|E077)/', $vstr)) {
|
310 |
-
$vstr = preg_replace('/('.$tepartialforms.') (E046|E069|E077)/', '\\2 \\1', $vstr);
|
311 |
-
}
|
312 |
-
$vstr = preg_replace('/('.$tefullforms .'|'.$matraligs.') (E046|E069|E077)/', '\\2 \\1', $vstr);
|
313 |
-
}
|
314 |
-
|
315 |
-
|
316 |
-
// KANNADA Shift Reph to RIGHT [E00B]
|
317 |
-
else if ($lang=='kn') {
|
318 |
-
$knfullforms = "0C95|0C96|0C97|0C98|0C99|0C9A|0C9B|0C9C|0C9D|0C9E|0C9F|0CA0|0CA1|0CA2|0CA3|0CA4|0CA5|0CA6|0CA7|0CA8|0CAA|0CAB|0CAC|0CAD|0CAE|0CAF|0CB0|0CB1|0CB2|0CB3|0CB5|0CB6|0CB7|0CB8|0CB9|E07D|E07E|E0A3";
|
319 |
-
$knpartialforms = "E00C|E00D|E00E|E00F|E010|E011|E012|E013|E014|0C9E|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E028|E029|E02A|E02B|E02C|E02D|E07F";
|
320 |
-
while(preg_match('/E00B ('.$knpartialforms.')/', $vstr)) {
|
321 |
-
$vstr = preg_replace('/E00B ('.$knpartialforms.')/', '\\1 E00B', $vstr);
|
322 |
-
}
|
323 |
-
// mPDF 5.3.47 Also move Reph to right of matraIligatures
|
324 |
-
$knfullforms .= "|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A4|E0A1|E0A2";
|
325 |
-
$vstr = preg_replace('/E00B ('.$knfullforms.')/', '\\1 E00B', $vstr);
|
326 |
-
|
327 |
-
// ? Need to shift it beyond base or below-base forms - haven't found so can't test??
|
328 |
-
// mPDF 5.3.87
|
329 |
-
// E004 added to list (which is a transformed version of 0CBE)
|
330 |
-
$knvowels = "0CBE|0CC0|0CC1|0CC2|0CC3|0CC4|0CC7|0CC8|0CCA|0CCB|0CD5|0CD6|E004";
|
331 |
-
$vstr = preg_replace('/E00B ('.$knvowels.')/', '\\1 E00B', $vstr);
|
332 |
-
}
|
333 |
-
|
334 |
-
|
335 |
-
// ORIYA Shift Reph to RIGHT [E069|E06A|E06B|E06C]
|
336 |
-
else if ($lang=='or') {
|
337 |
-
$orrephs = "E069|E06A|E06B|E06C";
|
338 |
-
$orfullforms = "0B15|0B16|0B17|0B18|0B19|0B1A|0B1B|0B1C|0B1D|0B1E|0B1F|0B20|0B21|0B22|0B23|0B24|0B25|0B26|0B27|0B28|0B29|0B2A|0B2B|0B2C|0B2D|0B2E|0B2F|0B30|0B31|0B32|0B33|0B34|0B35|0B36|0B37|0B38|E003|E004|E005|E006|E007|E008|E009|E00A|E00B|E00C|E00D|E00E|E00F|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E028|E029|E02A|E02B|E02C|E02D|E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037";
|
339 |
-
// E123 - E147 FullHalant forms ? add to FullForms
|
340 |
-
$orpartialforms = "E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF|E0B0|E0B1|E0B2|E0B3|E0B4|E0B5|E0B6|E0B7|E0B8|E0B9|E0BA|E0BB|E0BC|E0BD|E0BE|E0BF|E0C0|E0C1|E0C2|E0C3|E0C4|E0C5|E0C6|E0C7|E0C8|E0C9|E0CA|E0CB|E0CC|E0CD|E0CE|E0CF|E0D0|E0D1|E0D2|E0D3|E0D4|E0D5|E0D6|E0D7|E0D8|E0D9|E0DA|E0DB|E0DC|E0DD|E0DE|E0DF|E0E0|E0E1|E0E2|E0E3|E0E4|E0E5|E0E6|E0E7|E0E8|E0E9|E0EA|E0EB|E0EC|E0ED|E0EE|E0EF|E0F0|E0F1|E0F2|E0F3|E0F4|E0F5";
|
341 |
-
|
342 |
-
// Combined MatraIReph[E06D] split [0B3F & E069] to allow reph to be shifted forwards
|
343 |
-
$vstr = preg_replace('/('.$orfullforms.') E06D ('.$orfullforms.') 0B3E/', '\\1 0B3F E069 \\2 0B3E', $vstr);
|
344 |
-
|
345 |
-
|
346 |
-
while(preg_match('/('.$orrephs.') ('.$orpartialforms.')/', $vstr)) {
|
347 |
-
$vstr = preg_replace('/('.$orrephs.') ('.$orpartialforms.')/', '\\2 \\1', $vstr);
|
348 |
-
}
|
349 |
-
$vstr = preg_replace('/('.$orrephs.') ('.$orfullforms.')/', '\\2 \\1', $vstr);
|
350 |
-
|
351 |
-
|
352 |
-
// Combine Reph and MatraI
|
353 |
-
$vstr = str_replace('E069 0B3F', 'E06D', $vstr); // Reph and MatraI -> MatraIReph
|
354 |
-
$vstr = str_replace('E06A 0B3F', 'E06E', $vstr); // Reph and MatraI -> MatraIReph
|
355 |
-
$vstr = str_replace('E06B 0B3F', 'E06F', $vstr); // Reph and MatraI -> MatraIReph
|
356 |
-
}
|
357 |
-
|
358 |
-
|
359 |
-
// MALAYALAM Shift Reph to LEFT [E00E] (mlylmRaVattu)
|
360 |
-
else if ($lang=='ml') {
|
361 |
-
$halant = "0D4D";
|
362 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' 0D30/','E00E \\1', $vstr); // 0D30 = Ra
|
363 |
-
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$mlprebasedvowels .' 0D30/','\\2 E00E \\1', $vstr); // 0D30 = Ra
|
364 |
-
|
365 |
-
$mlfullforms = "0D15|0D16|0D17|0D18|0D19|0D1A|0D1B|0D1C|0D1D|0D1E|0D1F|0D20|0D21|0D22|0D23|0D24|0D25|0D26|0D27|0D28|0D2A|0D2B|0D2C|0D2D|0D2E|0D2F|0D30|0D31|0D32|0D33|0D34|0D35|0D36|0D37|0D38|0D39"
|
366 |
-
."|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E028|E029|E02A|E02B|E02C|E02D|E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037|E038|E039|E03A|E03B|E03C|E03D|E03E|E03F|E040|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D";
|
367 |
-
// = FullConsonants + FullConjuncts
|
368 |
-
|
369 |
-
// = Add Chillu characters // mPDF 5.0.024
|
370 |
-
$mlfullforms .= "|E004|E005|E006|E007|E008|E009";
|
371 |
-
while(preg_match('/('.$mlfullforms.') E00E/', $vstr))
|
372 |
-
$vstr = preg_replace('/('.$mlfullforms.') E00E/', 'E00E \\1', $vstr);
|
373 |
-
}
|
374 |
-
|
375 |
-
//============================
|
376 |
-
|
377 |
-
// SHIFT post-based vowels to Left of SmallForms (NOT to left of full forms)
|
378 |
-
|
379 |
-
// TELUGU Shift
|
380 |
-
if ($lang=='te') {
|
381 |
-
// NB $tevowels defined above
|
382 |
-
// NB $tefullforms defined above
|
383 |
-
$tebelowbase1 = "E02C|E02D|E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037|E038|E039|E03A|E03B|E03C|E03D|E03E|E03F|E040|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E"; //'Small1KaToHa'
|
384 |
-
$tebelowbase2 = "E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071"; // 'Small2KaToHa'
|
385 |
-
$vstr = preg_replace('/('.$tebelowbase2.') ('.$tevowels.')/', '\\2 \\1', $vstr);
|
386 |
-
$vstr = preg_replace('/('.$tebelowbase1.') ('.$tevowels.')/', '\\2 \\1', $vstr);
|
387 |
-
}
|
388 |
-
|
389 |
-
|
390 |
-
// KANNADA Shift
|
391 |
-
else if ($lang=='kn') {
|
392 |
-
$knvowels = "0CBE|0CC0|0CC1|0CC2|0CC3|0CC4|0CC7|0CC8|0CCA|0CCB|0CD5|0CD6"
|
393 |
-
// mPDF 5.3.87 Shouldn't swop E082 and E047 (belowbase1) below
|
394 |
-
// E082 is a matraIligature
|
395 |
-
// ."|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB"
|
396 |
-
."|E004|E007|E008|E009|E00A";
|
397 |
-
|
398 |
-
|
399 |
-
// NB $knvowels defined above
|
400 |
-
// NB $fullforms defined above
|
401 |
-
// $belowbase1/2 defined above
|
402 |
-
$vstr = preg_replace('/('.$belowbase2.') ('.$knvowels.')/', '\\2 \\1', $vstr);
|
403 |
-
// mPDF 5.3.87
|
404 |
-
$vstr = preg_replace('/('.$belowbase1.') ('.$knvowels.')/', '\\2 \\1', $vstr);
|
405 |
-
|
406 |
-
//$vstr = preg_replace('/('.$fullforms.') ('.$knvowels.')/', '\\2 \\1', $vstr);
|
407 |
-
}
|
408 |
-
|
409 |
-
//============================
|
410 |
-
// Clear unwanted ZWJ, ZWNJ
|
411 |
-
// MALAYALAM
|
412 |
-
if ($lang=='ml') {
|
413 |
-
$vstr = preg_replace('/(200C|200D) /','', $vstr);
|
414 |
-
}
|
415 |
-
|
416 |
-
//============================
|
417 |
-
// END & PUT IT BACK TOGETHER
|
418 |
-
$vstr = preg_replace('/^0020 (.*) 0020$/', '\\1', $vstr);
|
419 |
-
|
420 |
-
$varr = explode(" ",$vstr);
|
421 |
-
$e = '';
|
422 |
-
foreach($varr AS $v) {
|
423 |
-
$e.=code2utf(hexdec($v));
|
424 |
-
}
|
425 |
-
//============================
|
426 |
-
|
427 |
-
return $e;
|
428 |
-
}
|
429 |
-
|
430 |
-
|
431 |
-
}
|
432 |
-
|
433 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/meter.php
DELETED
@@ -1,224 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class meter {
|
4 |
-
|
5 |
-
|
6 |
-
function __construct() {
|
7 |
-
|
8 |
-
}
|
9 |
-
|
10 |
-
function makeSVG($tag, $type, $value, $max, $min, $optimum, $low, $high) {
|
11 |
-
$svg = '';
|
12 |
-
if ($tag == 'meter') {
|
13 |
-
|
14 |
-
if ($type=='2') {
|
15 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
16 |
-
///////// CUSTOM <meter type="2">
|
17 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
18 |
-
$h = 10;
|
19 |
-
$w = 160;
|
20 |
-
$border_radius = 0.143; // Factor of Height
|
21 |
-
|
22 |
-
$svg = '<?xml version="1.0" encoding="UTF-8"?>
|
23 |
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
24 |
-
<svg width="'.$w.'px" height="'.$h.'px" viewBox="0 0 '.$w.' '.$h.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
|
25 |
-
|
26 |
-
|
27 |
-
<defs>
|
28 |
-
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
29 |
-
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
|
30 |
-
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
|
31 |
-
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
|
32 |
-
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
|
33 |
-
</linearGradient>
|
34 |
-
|
35 |
-
</defs>
|
36 |
-
';
|
37 |
-
$svg .= '<rect x="0" y="0" width="'.$w.'" height="'.$h.'" fill="#f4f4f4" stroke="none" />';
|
38 |
-
|
39 |
-
// LOW to HIGH region
|
40 |
-
//if ($low && $high && ($low != $min || $high != $max)) {
|
41 |
-
if ($low && $high) {
|
42 |
-
$barx = (($low-$min) / ($max-$min) ) * $w;
|
43 |
-
$barw = (($high-$low) / ($max-$min) ) * $w;
|
44 |
-
$svg .= '<rect x="'.$barx.'" y="0" width="'.$barw.'" height="'.$h.'" fill="url(#GrGRAY)" stroke="#888888" stroke-width="0.5px" />';
|
45 |
-
}
|
46 |
-
|
47 |
-
// OPTIMUM Marker (? AVERAGE)
|
48 |
-
if ($optimum) {
|
49 |
-
$barx = (($optimum-$min) / ($max-$min) ) * $w;
|
50 |
-
$barw = $h/2;
|
51 |
-
$barcol = '#888888';
|
52 |
-
$svg .= '<rect x="'.$barx.'" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="'.$barcol.'" stroke="none" />';
|
53 |
-
}
|
54 |
-
|
55 |
-
// VALUE Marker
|
56 |
-
if ($value) {
|
57 |
-
if ($min != $low && $value < $low) { $col = 'orange'; }
|
58 |
-
else if ($max != $high && $value > $high) { $col = 'orange'; }
|
59 |
-
else { $col = '#008800'; }
|
60 |
-
$cx = (($value-$min) / ($max-$min) ) * $w;
|
61 |
-
$cy = $h/2;
|
62 |
-
$rx = $h/3.5;
|
63 |
-
$ry = $h/2.2;
|
64 |
-
$svg .= '<ellipse fill="'.$col.'" stroke="#000000" stroke-width="0.5px" cx="'.$cx.'" cy="'.$cy.'" rx="'.$rx.'" ry="'.$ry.'"/>';
|
65 |
-
}
|
66 |
-
|
67 |
-
// BoRDER
|
68 |
-
$svg .= '<rect x="0" y="0" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
69 |
-
|
70 |
-
$svg .= '</g></svg>';
|
71 |
-
}
|
72 |
-
else {
|
73 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
74 |
-
///////// DEFAULT <meter>
|
75 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
76 |
-
$h = 10;
|
77 |
-
$w = 50;
|
78 |
-
$border_radius = 0.143; // Factor of Height
|
79 |
-
|
80 |
-
$svg = '<?xml version="1.0" encoding="UTF-8"?>
|
81 |
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
82 |
-
<svg width="'.$w.'px" height="'.$h.'px" viewBox="0 0 '.$w.' '.$h.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
|
83 |
-
|
84 |
-
<defs>
|
85 |
-
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
86 |
-
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
|
87 |
-
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
|
88 |
-
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
|
89 |
-
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
|
90 |
-
</linearGradient>
|
91 |
-
|
92 |
-
<linearGradient id="GrRED" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
93 |
-
<stop offset="0%" stop-color="rgb(255, 162, 162)" />
|
94 |
-
<stop offset="20%" stop-color="rgb(255, 218, 218)" />
|
95 |
-
<stop offset="25%" stop-color="rgb(255, 218, 218)" />
|
96 |
-
<stop offset="100%" stop-color="rgb(255, 0, 0)" />
|
97 |
-
</linearGradient>
|
98 |
-
|
99 |
-
<linearGradient id="GrGREEN" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
100 |
-
<stop offset="0%" stop-color="rgb(102, 230, 102)" />
|
101 |
-
<stop offset="20%" stop-color="rgb(218, 255, 218)" />
|
102 |
-
<stop offset="25%" stop-color="rgb(218, 255, 218)" />
|
103 |
-
<stop offset="100%" stop-color="rgb(0, 148, 0)" />
|
104 |
-
</linearGradient>
|
105 |
-
|
106 |
-
<linearGradient id="GrBLUE" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
107 |
-
<stop offset="0%" stop-color="rgb(102, 102, 230)" />
|
108 |
-
<stop offset="20%" stop-color="rgb(238, 238, 238)" />
|
109 |
-
<stop offset="25%" stop-color="rgb(238, 238, 238)" />
|
110 |
-
<stop offset="100%" stop-color="rgb(0, 0, 128)" />
|
111 |
-
</linearGradient>
|
112 |
-
|
113 |
-
<linearGradient id="GrORANGE" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
114 |
-
<stop offset="0%" stop-color="rgb(255, 186, 0)" />
|
115 |
-
<stop offset="20%" stop-color="rgb(255, 238, 168)" />
|
116 |
-
<stop offset="25%" stop-color="rgb(255, 238, 168)" />
|
117 |
-
<stop offset="100%" stop-color="rgb(255, 155, 0)" />
|
118 |
-
</linearGradient>
|
119 |
-
</defs>
|
120 |
-
|
121 |
-
<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="url(#GrGRAY)" stroke="none" />
|
122 |
-
';
|
123 |
-
|
124 |
-
if ($value) {
|
125 |
-
$barw = (($value-$min) / ($max-$min) ) * $w;
|
126 |
-
if ($optimum < $low) {
|
127 |
-
if ($value < $low) { $barcol = 'url(#GrGREEN)'; }
|
128 |
-
else if ($value > $high) { $barcol = 'url(#GrRED)'; }
|
129 |
-
else { $barcol = 'url(#GrORANGE)'; }
|
130 |
-
}
|
131 |
-
else if ($optimum > $high) {
|
132 |
-
if ($value < $low) { $barcol = 'url(#GrRED)'; }
|
133 |
-
else if ($value > $high) { $barcol = 'url(#GrGREEN)'; }
|
134 |
-
else { $barcol = 'url(#GrORANGE)'; }
|
135 |
-
}
|
136 |
-
else {
|
137 |
-
if ($value < $low) { $barcol = 'url(#GrORANGE)'; }
|
138 |
-
else if ($value > $high) { $barcol = 'url(#GrORANGE)'; }
|
139 |
-
else { $barcol = 'url(#GrGREEN)'; }
|
140 |
-
}
|
141 |
-
$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="'.$barcol.'" stroke="none" />';
|
142 |
-
}
|
143 |
-
|
144 |
-
|
145 |
-
// Borders
|
146 |
-
//$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
147 |
-
if ($value) {
|
148 |
-
// $svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
149 |
-
}
|
150 |
-
|
151 |
-
|
152 |
-
$svg .= '</g></svg>';
|
153 |
-
}
|
154 |
-
}
|
155 |
-
else { // $tag == 'progress'
|
156 |
-
|
157 |
-
if ($type=='2') {
|
158 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
159 |
-
///////// CUSTOM <progress type="2">
|
160 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
161 |
-
}
|
162 |
-
else {
|
163 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
164 |
-
///////// DEFAULT <progress>
|
165 |
-
/////////////////////////////////////////////////////////////////////////////////////
|
166 |
-
$h = 10;
|
167 |
-
$w = 100;
|
168 |
-
$border_radius = 0.143; // Factor of Height
|
169 |
-
|
170 |
-
if ($value or $value==='0') {
|
171 |
-
$fill = 'url(#GrGRAY)';
|
172 |
-
}
|
173 |
-
else {
|
174 |
-
$fill = '#f8f8f8';
|
175 |
-
}
|
176 |
-
|
177 |
-
$svg = '<svg width="'.$w.'px" height="'.$h.'px" viewBox="0 0 '.$w.' '.$h.'"><g>
|
178 |
-
|
179 |
-
<defs>
|
180 |
-
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
181 |
-
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
|
182 |
-
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
|
183 |
-
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
|
184 |
-
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
|
185 |
-
</linearGradient>
|
186 |
-
|
187 |
-
<linearGradient id="GrGREEN" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
188 |
-
<stop offset="0%" stop-color="rgb(102, 230, 102)" />
|
189 |
-
<stop offset="20%" stop-color="rgb(218, 255, 218)" />
|
190 |
-
<stop offset="25%" stop-color="rgb(218, 255, 218)" />
|
191 |
-
<stop offset="100%" stop-color="rgb(0, 148, 0)" />
|
192 |
-
</linearGradient>
|
193 |
-
|
194 |
-
</defs>
|
195 |
-
|
196 |
-
<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="'.$fill.'" stroke="none" />
|
197 |
-
';
|
198 |
-
|
199 |
-
if ($value) {
|
200 |
-
$barw = (($value-$min) / ($max-$min) ) * $w;
|
201 |
-
$barcol = 'url(#GrGREEN)';
|
202 |
-
$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="'.$barcol.'" stroke="none" />';
|
203 |
-
}
|
204 |
-
|
205 |
-
|
206 |
-
// Borders
|
207 |
-
$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
208 |
-
if ($value) {
|
209 |
-
// $svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
210 |
-
}
|
211 |
-
|
212 |
-
|
213 |
-
$svg .= '</g></svg>';
|
214 |
-
|
215 |
-
}
|
216 |
-
}
|
217 |
-
|
218 |
-
return $svg;
|
219 |
-
}
|
220 |
-
|
221 |
-
|
222 |
-
} // end of class
|
223 |
-
|
224 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/svg.php
DELETED
@@ -1,2600 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// svg class modified for mPDF version 4.4.003 by Ian Back: based on -
|
3 |
-
// svg2pdf fpdf class
|
4 |
-
// sylvain briand (syb@godisaduck.com), modified by rick trevino (rtrevino1@yahoo.com)
|
5 |
-
// http://www.godisaduck.com/svg2pdf_with_fpdf
|
6 |
-
// http://rhodopsin.blogspot.com
|
7 |
-
//
|
8 |
-
// cette class etendue est open source, toute modification devra cependant etre repertori�e~
|
9 |
-
|
10 |
-
|
11 |
-
// NB UNITS - Works in pixels as main units - converting to PDF units when outputing to PDF string
|
12 |
-
// and on returning size
|
13 |
-
|
14 |
-
class SVG {
|
15 |
-
|
16 |
-
var $svg_gradient; // array - contient les infos sur les gradient fill du svg class� par id du svg
|
17 |
-
var $svg_shadinglist; // array - contient les ids des objet shading
|
18 |
-
var $svg_info; // array contenant les infos du svg voulue par l'utilisateur
|
19 |
-
var $svg_attribs; // array - holds all attributes of root <svg> tag
|
20 |
-
var $svg_style; // array contenant les style de groupes du svg
|
21 |
-
var $svg_string; // String contenant le tracage du svg en lui m�me.
|
22 |
-
var $txt_data; // array - holds string info to write txt to image
|
23 |
-
var $txt_style; // array - current text style
|
24 |
-
var $mpdf_ref;
|
25 |
-
var $xbase; // mPDF 4.4.003
|
26 |
-
var $ybase; // mPDF 4.4.003
|
27 |
-
var $svg_error; // mPDF 4.4.003
|
28 |
-
var $subPathInit; // mPDF 4.4.003
|
29 |
-
var $spxstart; // mPDF 4.4.003
|
30 |
-
var $spystart; // mPDF 4.4.003
|
31 |
-
var $kp; // mPDF 4.4.003 convert pixels to PDF units
|
32 |
-
var $pathBBox; // mPDF 5.0.039
|
33 |
-
|
34 |
-
function SVG(&$mpdf){
|
35 |
-
$this->svg_gradient = array();
|
36 |
-
$this->svg_shadinglist = array();
|
37 |
-
$this->txt_data = array();
|
38 |
-
$this->svg_string = '';
|
39 |
-
$this->svg_info = array();
|
40 |
-
$this->svg_attribs = array();
|
41 |
-
$this->xbase = 0;
|
42 |
-
$this->ybase = 0;
|
43 |
-
$this->svg_error = false;
|
44 |
-
$this->subPathInit = false; // mPDF 4.4.003
|
45 |
-
$this->dashesUsed = false; // mPDF 5.0
|
46 |
-
$this->mpdf_ref =& $mpdf;
|
47 |
-
|
48 |
-
$this->kp = 72 / $mpdf->img_dpi; // mPDF 4.4.003 constant To convert pixels to pts/PDF units
|
49 |
-
$this->kf = 1; // mPDF 5.0.039 constant To convert font size if re-mapped
|
50 |
-
$this->pathBBox = array(); // mPDF 5.0.039
|
51 |
-
|
52 |
-
$this->svg_style = array(
|
53 |
-
array(
|
54 |
-
'fill' => 'black', // mPDF 4.4.008
|
55 |
-
'fill-opacity' => 1, // remplissage opaque par defaut
|
56 |
-
'fill-rule' => 'nonzero', // mode de remplissage par defaut
|
57 |
-
'stroke' => 'none', // pas de trait par defaut
|
58 |
-
'stroke-linecap' => 'butt', // style de langle par defaut
|
59 |
-
'stroke-linejoin' => 'miter', //
|
60 |
-
'stroke-miterlimit' => 4, // limite de langle par defaut
|
61 |
-
'stroke-opacity' => 1, // trait opaque par defaut
|
62 |
-
'stroke-width' => 1, // mPDF 4.4.011
|
63 |
-
'stroke-dasharray' => 0, // mPDF 4.4.003
|
64 |
-
'stroke-dashoffset' => 0, // mPDF 4.4.003
|
65 |
-
'color' => '' // mPDF 4.4.005
|
66 |
-
)
|
67 |
-
);
|
68 |
-
|
69 |
-
$this->txt_style = array(
|
70 |
-
array(
|
71 |
-
'fill' => 'black', // pas de remplissage par defaut
|
72 |
-
'font-family' => $mpdf->default_font,
|
73 |
-
'font-size' => $mpdf->default_font_size, // ****** this is pts
|
74 |
-
'font-weight' => 'normal', // normal | bold
|
75 |
-
'font-style' => 'normal', // italic | normal
|
76 |
-
'text-anchor' => 'start', // alignment: start, middle, end
|
77 |
-
/* mPDF 5.0.041 */
|
78 |
-
'fill-opacity' => 1, // remplissage opaque par defaut
|
79 |
-
'fill-rule' => 'nonzero', // mode de remplissage par defaut
|
80 |
-
'stroke' => 'none', // pas de trait par defaut
|
81 |
-
'stroke-opacity' => 1, // trait opaque par defaut
|
82 |
-
'stroke-width' => 1, // mPDF 4.4.011
|
83 |
-
'color' => '' // mPDF 4.4.005
|
84 |
-
)
|
85 |
-
);
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
}
|
90 |
-
|
91 |
-
function svgGradient($gradient_info, $attribs, $element){
|
92 |
-
$n = count($this->mpdf_ref->gradients)+1;
|
93 |
-
|
94 |
-
// Get bounding dimensions of element
|
95 |
-
$w = 100;
|
96 |
-
$h = 100;
|
97 |
-
$x_offset = 0;
|
98 |
-
$y_offset = 0;
|
99 |
-
if ($element=='rect') {
|
100 |
-
$w = $attribs['width'];
|
101 |
-
$h = $attribs['height'];
|
102 |
-
$x_offset = $attribs['x'];
|
103 |
-
$y_offset = $attribs['y'];
|
104 |
-
}
|
105 |
-
else if ($element=='ellipse') {
|
106 |
-
$w = $attribs['rx']*2;
|
107 |
-
$h = $attribs['ry']*2;
|
108 |
-
$x_offset = $attribs['cx']-$attribs['rx'];
|
109 |
-
$y_offset = $attribs['cy']-$attribs['ry'];
|
110 |
-
}
|
111 |
-
else if ($element=='circle') {
|
112 |
-
$w = $attribs['r']*2;
|
113 |
-
$h = $attribs['r']*2;
|
114 |
-
$x_offset = $attribs['cx']-$attribs['r'];
|
115 |
-
$y_offset = $attribs['cy']-$attribs['r'];
|
116 |
-
}
|
117 |
-
else if ($element=='polygon') {
|
118 |
-
$pts = preg_split('/[ ,]+/', trim($attribs['points']));
|
119 |
-
$maxr=$maxb=0;
|
120 |
-
$minl=$mint=999999;
|
121 |
-
for ($i=0;$i<count($pts); $i++) {
|
122 |
-
if ($i % 2 == 0) { // x values
|
123 |
-
$minl = min($minl,$pts[$i]);
|
124 |
-
$maxr = max($maxr,$pts[$i]);
|
125 |
-
}
|
126 |
-
else { // y values
|
127 |
-
$mint = min($mint,$pts[$i]);
|
128 |
-
$maxb = max($maxb,$pts[$i]);
|
129 |
-
}
|
130 |
-
}
|
131 |
-
$w = $maxr-$minl;
|
132 |
-
$h = $maxb-$mint;
|
133 |
-
$x_offset = $minl;
|
134 |
-
$y_offset = $mint;
|
135 |
-
}
|
136 |
-
else if ($element=='path') {
|
137 |
-
// mPDF 5.0.039
|
138 |
-
if (is_array($this->pathBBox) && $this->pathBBox[2]>0) {
|
139 |
-
$w = $this->pathBBox[2];
|
140 |
-
$h = $this->pathBBox[3];
|
141 |
-
$x_offset = $this->pathBBox[0];
|
142 |
-
$y_offset = $this->pathBBox[1];
|
143 |
-
}
|
144 |
-
else {
|
145 |
-
preg_match_all('/([a-z]|[A-Z])([ ,\-.\d]+)*/', $attribs['d'], $commands, PREG_SET_ORDER);
|
146 |
-
$maxr=$maxb=0;
|
147 |
-
$minl=$mint=999999;
|
148 |
-
foreach($commands as $c){
|
149 |
-
if(count($c)==3){
|
150 |
-
list($tmp, $cmd, $arg) = $c;
|
151 |
-
if ($cmd=='M' || $cmd=='L' || $cmd=='C' || $cmd=='S' || $cmd=='Q' || $cmd=='T') {
|
152 |
-
$pts = preg_split('/[ ,]+/', trim($arg));
|
153 |
-
for ($i=0;$i<count($pts); $i++) {
|
154 |
-
if ($i % 2 == 0) { // x values
|
155 |
-
$minl = min($minl,$pts[$i]);
|
156 |
-
$maxr = max($maxr,$pts[$i]);
|
157 |
-
}
|
158 |
-
else { // y values
|
159 |
-
$mint = min($mint,$pts[$i]);
|
160 |
-
$maxb = max($maxb,$pts[$i]);
|
161 |
-
}
|
162 |
-
}
|
163 |
-
}
|
164 |
-
if ($cmd=='H') { // sets new x
|
165 |
-
$minl = min($minl,$arg);
|
166 |
-
$maxr = max($maxr,$arg);
|
167 |
-
}
|
168 |
-
if ($cmd=='V') { // sets new y
|
169 |
-
$mint = min($mint,$arg);
|
170 |
-
$maxb = max($maxb,$arg);
|
171 |
-
}
|
172 |
-
}
|
173 |
-
}
|
174 |
-
$w = $maxr-$minl;
|
175 |
-
$h = $maxb-$mint;
|
176 |
-
$x_offset = $minl;
|
177 |
-
$y_offset = $mint;
|
178 |
-
}
|
179 |
-
}
|
180 |
-
if (!$w || $w==-999999) { $w = 100; }
|
181 |
-
if (!$h || $h==-999999) { $h = 100; }
|
182 |
-
if ($x_offset==999999) { $x_offset = 0; }
|
183 |
-
if ($y_offset==999999) { $y_offset = 0; }
|
184 |
-
|
185 |
-
// mPDF 4.5.010
|
186 |
-
// TRANSFORMATIONS
|
187 |
-
$transformations = '';
|
188 |
-
if (isset($gradient_info['transform'])){
|
189 |
-
preg_match_all('/(matrix|translate|scale|rotate|skewX|skewY)\((.*?)\)/is',$gradient_info['transform'],$m);
|
190 |
-
if (count($m[0])) {
|
191 |
-
for($i=0; $i<count($m[0]); $i++) {
|
192 |
-
$c = strtolower($m[1][$i]);
|
193 |
-
$v = trim($m[2][$i]);
|
194 |
-
$vv = preg_split('/[ ,]+/',$v);
|
195 |
-
if ($c=='matrix' && count($vv)==6) {
|
196 |
-
// mPDF 5.0.039
|
197 |
-
// Note angle of rotation is reversed (from SVG to PDF), so vv[1] and vv[2] are negated
|
198 |
-
// cf svgDefineStyle()
|
199 |
-
$transformations .= sprintf(' %.3F %.3F %.3F %.3F %.3F %.3F cm ', $vv[0], -$vv[1], -$vv[2], $vv[3], $vv[4]*$this->kp, -$vv[5]*$this->kp);
|
200 |
-
}
|
201 |
-
else if ($c=='translate' && count($vv)) {
|
202 |
-
$tm[4] = $vv[0];
|
203 |
-
if (count($vv)==2) { $t_y = -$vv[1]; }
|
204 |
-
else { $t_y = 0; }
|
205 |
-
$tm[5] = $t_y;
|
206 |
-
$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $tm[4]*$this->kp, $tm[5]*$this->kp);
|
207 |
-
}
|
208 |
-
else if ($c=='scale' && count($vv)) {
|
209 |
-
if (count($vv)==2) { $s_y = $vv[1]; }
|
210 |
-
else { $s_y = $vv[0]; }
|
211 |
-
$tm[0] = $vv[0];
|
212 |
-
$tm[3] = $s_y;
|
213 |
-
$transformations .= sprintf(' %.3F 0 0 %.3F 0 0 cm ', $tm[0], $tm[3]);
|
214 |
-
}
|
215 |
-
else if ($c=='rotate' && count($vv)) {
|
216 |
-
$tm[0] = cos(deg2rad(-$vv[0]));
|
217 |
-
$tm[1] = sin(deg2rad(-$vv[0]));
|
218 |
-
$tm[2] = -$tm[1];
|
219 |
-
$tm[3] = $tm[0];
|
220 |
-
if (count($vv)==3) {
|
221 |
-
$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $vv[1]*$this->kp, -$vv[2]*$this->kp);
|
222 |
-
}
|
223 |
-
$transformations .= sprintf(' %.3F %.3F %.3F %.3F 0 0 cm ', $tm[0], $tm[1], $tm[2], $tm[3]);
|
224 |
-
if (count($vv)==3) {
|
225 |
-
$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', -$vv[1]*$this->kp, $vv[2]*$this->kp);
|
226 |
-
}
|
227 |
-
}
|
228 |
-
else if ($c=='skewx' && count($vv)) {
|
229 |
-
$tm[2] = tan(deg2rad(-$vv[0]));
|
230 |
-
$transformations .= sprintf(' 1 0 %.3F 1 0 0 cm ', $tm[2]);
|
231 |
-
}
|
232 |
-
else if ($c=='skewy' && count($vv)) {
|
233 |
-
$tm[1] = tan(deg2rad(-$vv[0]));
|
234 |
-
$transformations .= sprintf(' 1 %.3F 0 1 0 0 cm ', $tm[1]);
|
235 |
-
}
|
236 |
-
|
237 |
-
}
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
-
|
242 |
-
$return = "";
|
243 |
-
|
244 |
-
// mPDF 5.0.039
|
245 |
-
if (isset($gradient_info['units']) && strtolower($gradient_info['units'])=='userspaceonuse') {
|
246 |
-
if ($transformations) { $return .= $transformations; }
|
247 |
-
}
|
248 |
-
// mPDF 5.0.040
|
249 |
-
$spread = 'P'; // pad
|
250 |
-
if (isset($gradient_info['spread'])) {
|
251 |
-
if (strtolower($gradient_info['spread'])=='reflect') { $spread = 'F'; } // reflect
|
252 |
-
else if (strtolower($gradient_info['spread'])=='repeat') { $spread = 'R'; } // repeat
|
253 |
-
}
|
254 |
-
|
255 |
-
|
256 |
-
for ($i=0; $i<(count($gradient_info['color'])); $i++) {
|
257 |
-
if (stristr($gradient_info['color'][$i]['offset'], '%')!== false) { $gradient_info['color'][$i]['offset'] = ($gradient_info['color'][$i]['offset']+0)/100; }
|
258 |
-
if (stristr($gradient_info['color'][($i+1)]['offset'], '%')!== false) { $gradient_info['color'][($i+1)]['offset'] = ($gradient_info['color'][($i+1)]['offset']+0)/100; }
|
259 |
-
if ($gradient_info['color'][$i]['offset']<0) { $gradient_info['color'][$i]['offset'] = 0; }
|
260 |
-
if ($gradient_info['color'][$i]['offset']>1) { $gradient_info['color'][$i]['offset'] = 1; }
|
261 |
-
if ($i>0) {
|
262 |
-
if ($gradient_info['color'][$i]['offset']<$gradient_info['color'][($i-1)]['offset']) {
|
263 |
-
$gradient_info['color'][$i]['offset']=$gradient_info['color'][($i-1)]['offset'];
|
264 |
-
}
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
if ($gradient_info['color'][0]['offset']>0) {
|
269 |
-
array_unshift($gradient_info['color'], $gradient_info['color'][0]);
|
270 |
-
$gradient_info['color'][0]['offset'] = 0;
|
271 |
-
}
|
272 |
-
$ns = count($gradient_info['color']);
|
273 |
-
if ($gradient_info['color'][($ns-1)]['offset']<1) {
|
274 |
-
$gradient_info['color'][] = $gradient_info['color'][($ns-1)];
|
275 |
-
$gradient_info['color'][($ns)]['offset'] = 1;
|
276 |
-
}
|
277 |
-
$ns = count($gradient_info['color']);
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
if ($gradient_info['type'] == 'linear'){
|
283 |
-
// mPDF 4.4.003
|
284 |
-
if (isset($gradient_info['units']) && strtolower($gradient_info['units'])=='userspaceonuse') {
|
285 |
-
if (isset($gradient_info['info']['x1'])) { $gradient_info['info']['x1'] = ($gradient_info['info']['x1']-$x_offset) / $w; }
|
286 |
-
if (isset($gradient_info['info']['y1'])) { $gradient_info['info']['y1'] = ($gradient_info['info']['y1']-$y_offset) / $h; }
|
287 |
-
if (isset($gradient_info['info']['x2'])) { $gradient_info['info']['x2'] = ($gradient_info['info']['x2']-$x_offset) / $w; }
|
288 |
-
if (isset($gradient_info['info']['y2'])) { $gradient_info['info']['y2'] = ($gradient_info['info']['y2']-$y_offset) / $h; }
|
289 |
-
}
|
290 |
-
if (isset($gradient_info['info']['x1'])) { $x1 = $gradient_info['info']['x1']; }
|
291 |
-
else { $x1 = 0; }
|
292 |
-
if (isset($gradient_info['info']['y1'])) { $y1 = $gradient_info['info']['y1']; }
|
293 |
-
else { $y1 = 0; }
|
294 |
-
if (isset($gradient_info['info']['x2'])) { $x2 = $gradient_info['info']['x2']; }
|
295 |
-
else { $x2 = 1; }
|
296 |
-
if (isset($gradient_info['info']['y2'])) { $y2 = $gradient_info['info']['y2']; }
|
297 |
-
else { $y2 = 0; }
|
298 |
-
|
299 |
-
if (stristr($x1, '%')!== false) { $x1 = ($x1+0)/100; }
|
300 |
-
if (stristr($x2, '%')!== false) { $x2 = ($x2+0)/100; }
|
301 |
-
if (stristr($y1, '%')!== false) { $y1 = ($y1+0)/100; }
|
302 |
-
if (stristr($y2, '%')!== false) { $y2 = ($y2+0)/100; }
|
303 |
-
|
304 |
-
// mPDF 5.0.042
|
305 |
-
$bboxw = $w;
|
306 |
-
$bboxh = $h;
|
307 |
-
$usex = $x_offset;
|
308 |
-
$usey = $y_offset;
|
309 |
-
$usew = $bboxw;
|
310 |
-
$useh = $bboxh;
|
311 |
-
if (isset($gradient_info['units']) && strtolower($gradient_info['units'])=='userspaceonuse') {
|
312 |
-
$angle = rad2deg(atan2(($gradient_info['info']['y2']-$gradient_info['info']['y1']), ($gradient_info['info']['x2']-$gradient_info['info']['x1'])));
|
313 |
-
if ($angle < 0) { $angle += 360; }
|
314 |
-
else if ($angle > 360) { $angle -= 360; }
|
315 |
-
if ($angle!=0 && $angle!=360 && $angle!=90 && $angle!=180 && $angle!=270) {
|
316 |
-
if ($w >= $h) {
|
317 |
-
$y1 *= $h/$w ;
|
318 |
-
$y2 *= $h/$w ;
|
319 |
-
$usew = $useh = $bboxw;
|
320 |
-
}
|
321 |
-
else {
|
322 |
-
$x1 *= $w/$h ;
|
323 |
-
$x2 *= $w/$h ;
|
324 |
-
$usew = $useh = $bboxh;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
}
|
328 |
-
$a = $usew; // width
|
329 |
-
$d = -$useh; // height
|
330 |
-
$e = $usex; // x- offset
|
331 |
-
$f = -$usey; // -y-offset
|
332 |
-
|
333 |
-
$return .= sprintf('%.3F 0 0 %.3F %.3F %.3F cm ', $a*$this->kp, $d*$this->kp, $e*$this->kp, $f*$this->kp);
|
334 |
-
|
335 |
-
// mPDF 5.0.039
|
336 |
-
if (isset($gradient_info['units']) && strtolower($gradient_info['units'])=='objectboundingbox') {
|
337 |
-
if ($transformations) { $return .= $transformations; }
|
338 |
-
}
|
339 |
-
|
340 |
-
// mPDF 5.0.020
|
341 |
-
$trans = false;
|
342 |
-
|
343 |
-
// mPDF 5.0.040
|
344 |
-
if ($spread=='R' || $spread=='F') { // Repeat / Reflect
|
345 |
-
$offs = array();
|
346 |
-
for($i=0;$i<$ns;$i++) {
|
347 |
-
$offs[$i] = $gradient_info['color'][$i]['offset'];
|
348 |
-
}
|
349 |
-
$gp = 0;
|
350 |
-
$inside=true;
|
351 |
-
while($inside) {
|
352 |
-
$gp++;
|
353 |
-
for($i=0;$i<$ns;$i++) {
|
354 |
-
if ($spread=='F' && ($gp % 2) == 1) { // Reflect
|
355 |
-
$gradient_info['color'][(($ns*$gp)+$i)] = $gradient_info['color'][(($ns*($gp-1))+($ns-$i-1))];
|
356 |
-
$tmp = $gp+(1-$offs[($ns-$i-1)]) ;
|
357 |
-
$gradient_info['color'][(($ns*$gp)+$i)]['offset'] = $tmp;
|
358 |
-
}
|
359 |
-
else { // Reflect
|
360 |
-
$gradient_info['color'][(($ns*$gp)+$i)] = $gradient_info['color'][$i];
|
361 |
-
$tmp = $gp+$offs[$i] ;
|
362 |
-
$gradient_info['color'][(($ns*$gp)+$i)]['offset'] = $tmp;
|
363 |
-
}
|
364 |
-
// IF STILL INSIDE BOX OR STILL VALID
|
365 |
-
// Point on axis to test
|
366 |
-
$px1 = $x1 + ($x2-$x1)*$tmp;
|
367 |
-
$py1 = $y1 + ($y2-$y1)*$tmp;
|
368 |
-
// Get perpendicular axis
|
369 |
-
$alpha = atan2($y2-$y1, $x2-$x1);
|
370 |
-
$alpha += M_PI/2; // rotate 90 degrees
|
371 |
-
// Get arbitrary point to define line perpendicular to axis
|
372 |
-
$px2 = $px1+cos($alpha);
|
373 |
-
$py2 = $py1+sin($alpha);
|
374 |
-
|
375 |
-
$res1 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 0, 1); // $x=0 vert axis
|
376 |
-
$res2 = _testIntersect($px1, $py1, $px2, $py2, 1, 0, 1, 1); // $x=1 vert axis
|
377 |
-
$res3 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 1, 0); // $y=0 horiz axis
|
378 |
-
$res4 = _testIntersect($px1, $py1, $px2, $py2, 0, 1, 1, 1); // $y=1 horiz axis
|
379 |
-
if (!$res1 && !$res2 && !$res3 && !$res4) { $inside = false; }
|
380 |
-
}
|
381 |
-
}
|
382 |
-
|
383 |
-
$inside=true;
|
384 |
-
$gp = 0;
|
385 |
-
while($inside) {
|
386 |
-
$gp++;
|
387 |
-
$newarr = array();
|
388 |
-
for($i=0;$i<$ns;$i++) {
|
389 |
-
if ($spread=='F') { // Reflect
|
390 |
-
$newarr[$i] = $gradient_info['color'][($ns-$i-1)];
|
391 |
-
if (($gp % 2) == 1) {
|
392 |
-
$tmp = -$gp+(1-$offs[($ns-$i-1)]);
|
393 |
-
$newarr[$i]['offset'] = $tmp;
|
394 |
-
}
|
395 |
-
else {
|
396 |
-
$tmp = -$gp+$offs[$i];
|
397 |
-
$newarr[$i]['offset'] = $tmp;
|
398 |
-
}
|
399 |
-
}
|
400 |
-
else { // Reflect
|
401 |
-
$newarr[$i] = $gradient_info['color'][$i];
|
402 |
-
$tmp = -$gp+$offs[$i];
|
403 |
-
$newarr[$i]['offset'] = $tmp;
|
404 |
-
}
|
405 |
-
|
406 |
-
// IF STILL INSIDE BOX OR STILL VALID
|
407 |
-
// Point on axis to test
|
408 |
-
$px1 = $x1 + ($x2-$x1)*$tmp;
|
409 |
-
$py1 = $y1 + ($y2-$y1)*$tmp;
|
410 |
-
// Get perpendicular axis
|
411 |
-
$alpha = atan2($y2-$y1, $x2-$x1);
|
412 |
-
$alpha += M_PI/2; // rotate 90 degrees
|
413 |
-
// Get arbitrary point to define line perpendicular to axis
|
414 |
-
$px2 = $px1+cos($alpha);
|
415 |
-
$py2 = $py1+sin($alpha);
|
416 |
-
|
417 |
-
$res1 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 0, 1); // $x=0 vert axis
|
418 |
-
$res2 = _testIntersect($px1, $py1, $px2, $py2, 1, 0, 1, 1); // $x=1 vert axis
|
419 |
-
$res3 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 1, 0); // $y=0 horiz axis
|
420 |
-
$res4 = _testIntersect($px1, $py1, $px2, $py2, 0, 1, 1, 1); // $y=1 horiz axis
|
421 |
-
if (!$res1 && !$res2 && !$res3 && !$res4) { $inside = false; }
|
422 |
-
}
|
423 |
-
for($i=($ns-1);$i>=0;$i--) {
|
424 |
-
if (isset($newarr[$i]['offset'])) array_unshift($gradient_info['color'], $newarr[$i]);
|
425 |
-
}
|
426 |
-
}
|
427 |
-
}
|
428 |
-
|
429 |
-
// mPDF 4.4.007 Gradient STOPs
|
430 |
-
$stops = count($gradient_info['color']);
|
431 |
-
if ($stops < 2) { return ''; }
|
432 |
-
|
433 |
-
// mPDF 5.0.042
|
434 |
-
$range = $gradient_info['color'][count($gradient_info['color'])-1]['offset']-$gradient_info['color'][0]['offset'];
|
435 |
-
$min = $gradient_info['color'][0]['offset'];
|
436 |
-
|
437 |
-
for ($i=0; $i<($stops); $i++) {
|
438 |
-
// mPDF 5.0.051
|
439 |
-
if (!$gradient_info['color'][$i]['color']) {
|
440 |
-
if ($gradient_info['colorspace']=='RGB') $gradient_info['color'][$i]['color'] = '0 0 0';
|
441 |
-
else if ($gradient_info['colorspace']=='Gray') $gradient_info['color'][$i]['color'] = '0';
|
442 |
-
else if ($gradient_info['colorspace']=='CMYK') $gradient_info['color'][$i]['color'] = '1 1 1 1';
|
443 |
-
}
|
444 |
-
$offset = ($gradient_info['color'][$i]['offset'] - $min)/$range;
|
445 |
-
$this->mpdf_ref->gradients[$n]['stops'][] = array(
|
446 |
-
'col' => $gradient_info['color'][$i]['color'],
|
447 |
-
'opacity' => $gradient_info['color'][$i]['opacity'],
|
448 |
-
'offset' => $offset);
|
449 |
-
if ($gradient_info['color'][$i]['opacity']<1) { $trans = true; }
|
450 |
-
}
|
451 |
-
$grx1 = $x1 + ($x2-$x1)*$gradient_info['color'][0]['offset'];
|
452 |
-
$gry1 = $y1 + ($y2-$y1)*$gradient_info['color'][0]['offset'];
|
453 |
-
$grx2 = $x1 + ($x2-$x1)*$gradient_info['color'][count($gradient_info['color'])-1]['offset'];
|
454 |
-
$gry2 = $y1 + ($y2-$y1)*$gradient_info['color'][count($gradient_info['color'])-1]['offset'];
|
455 |
-
|
456 |
-
$this->mpdf_ref->gradients[$n]['coords']=array($grx1, $gry1, $grx2, $gry2);
|
457 |
-
|
458 |
-
$this->mpdf_ref->gradients[$n]['colorspace'] = $gradient_info['colorspace']; // mPDF 5.0.051
|
459 |
-
|
460 |
-
$this->mpdf_ref->gradients[$n]['type'] = 2;
|
461 |
-
$this->mpdf_ref->gradients[$n]['fo'] = true;
|
462 |
-
|
463 |
-
$this->mpdf_ref->gradients[$n]['extend']=array('true','true');
|
464 |
-
if ($trans) {
|
465 |
-
$this->mpdf_ref->gradients[$n]['trans'] = true;
|
466 |
-
$return .= ' /TGS'.($n).' gs ';
|
467 |
-
}
|
468 |
-
$return .= ' /Sh'.($n).' sh ';
|
469 |
-
$return .= " Q\n";
|
470 |
-
}
|
471 |
-
else if ($gradient_info['type'] == 'radial'){
|
472 |
-
// mPDF 4.4.003
|
473 |
-
if (isset($gradient_info['units']) && strtolower($gradient_info['units'])=='userspaceonuse') {
|
474 |
-
if ($w > $h) { $h = $w; }
|
475 |
-
else { $w = $h; }
|
476 |
-
if (isset($gradient_info['info']['x0'])) { $gradient_info['info']['x0'] = ($gradient_info['info']['x0']-$x_offset) / $w; }
|
477 |
-
if (isset($gradient_info['info']['y0'])) { $gradient_info['info']['y0'] = ($gradient_info['info']['y0']-$y_offset) / $h; }
|
478 |
-
if (isset($gradient_info['info']['x1'])) { $gradient_info['info']['x1'] = ($gradient_info['info']['x1']-$x_offset) / $w; }
|
479 |
-
if (isset($gradient_info['info']['y1'])) { $gradient_info['info']['y1'] = ($gradient_info['info']['y1']-$y_offset) / $h; }
|
480 |
-
if (isset($gradient_info['info']['r'])) { $gradient_info['info']['rx'] = $gradient_info['info']['r'] / $w; }
|
481 |
-
if (isset($gradient_info['info']['r'])) { $gradient_info['info']['ry'] = $gradient_info['info']['r'] / $h; }
|
482 |
-
}
|
483 |
-
|
484 |
-
if ($gradient_info['info']['x0'] || $gradient_info['info']['x0']===0) { $x0 = $gradient_info['info']['x0']; }
|
485 |
-
else { $x0 = 0.5; }
|
486 |
-
if ($gradient_info['info']['y0'] || $gradient_info['info']['y0']===0) { $y0 = $gradient_info['info']['y0']; }
|
487 |
-
else { $y0 = 0.5; }
|
488 |
-
if ($gradient_info['info']['rx'] || $gradient_info['info']['rx']===0) { $rx = $gradient_info['info']['rx']; }
|
489 |
-
else if ($gradient_info['info']['r'] || $gradient_info['info']['r']===0) { $rx = $gradient_info['info']['r']; }
|
490 |
-
else { $rx = 0.5; }
|
491 |
-
if ($gradient_info['info']['ry'] || $gradient_info['info']['ry']===0) { $ry = $gradient_info['info']['ry']; }
|
492 |
-
else if ($gradient_info['info']['r'] || $gradient_info['info']['r']===0) { $ry = $gradient_info['info']['r']; }
|
493 |
-
else { $ry = 0.5; }
|
494 |
-
if ($gradient_info['info']['x1'] || $gradient_info['info']['x1']===0) { $x1 = $gradient_info['info']['x1']; }
|
495 |
-
else { $x1 = $x0; }
|
496 |
-
if ($gradient_info['info']['y1'] || $gradient_info['info']['y1']===0) { $y1 = $gradient_info['info']['y1']; }
|
497 |
-
else { $y1 = $y0; }
|
498 |
-
|
499 |
-
if (stristr($x1, '%')!== false) { $x1 = ($x1+0)/100; }
|
500 |
-
if (stristr($x0, '%')!== false) { $x0 = ($x0+0)/100; }
|
501 |
-
if (stristr($y1, '%')!== false) { $y1 = ($y1+0)/100; }
|
502 |
-
if (stristr($y0, '%')!== false) { $y0 = ($y0+0)/100; }
|
503 |
-
if (stristr($rx, '%')!== false) { $rx = ($rx+0)/100; }
|
504 |
-
if (stristr($ry, '%')!== false) { $ry = ($ry+0)/100; }
|
505 |
-
|
506 |
-
// mPDF 5.0.043
|
507 |
-
$bboxw = $w;
|
508 |
-
$bboxh = $h;
|
509 |
-
$usex = $x_offset;
|
510 |
-
$usey = $y_offset;
|
511 |
-
$usew = $bboxw;
|
512 |
-
$useh = $bboxh;
|
513 |
-
if (isset($gradient_info['units']) && strtolower($gradient_info['units'])=='userspaceonuse') {
|
514 |
-
$angle = rad2deg(atan2(($gradient_info['info']['y0']-$gradient_info['info']['y1']), ($gradient_info['info']['x0']-$gradient_info['info']['x1'])));
|
515 |
-
if ($angle < 0) { $angle += 360; }
|
516 |
-
else if ($angle > 360) { $angle -= 360; }
|
517 |
-
if ($angle!=0 && $angle!=360 && $angle!=90 && $angle!=180 && $angle!=270) {
|
518 |
-
if ($w >= $h) {
|
519 |
-
$y1 *= $h/$w ;
|
520 |
-
$y0 *= $h/$w ;
|
521 |
-
$rx *= $h/$w ;
|
522 |
-
$ry *= $h/$w ;
|
523 |
-
$usew = $useh = $bboxw;
|
524 |
-
}
|
525 |
-
else {
|
526 |
-
$x1 *= $w/$h ;
|
527 |
-
$x0 *= $w/$h ;
|
528 |
-
$rx *= $w/$h ;
|
529 |
-
$ry *= $w/$h ;
|
530 |
-
$usew = $useh = $bboxh;
|
531 |
-
}
|
532 |
-
}
|
533 |
-
}
|
534 |
-
$a = $usew; // width
|
535 |
-
$d = -$useh; // height
|
536 |
-
$e = $usex; // x- offset
|
537 |
-
$f = -$usey; // -y-offset
|
538 |
-
|
539 |
-
$r = $rx;
|
540 |
-
|
541 |
-
|
542 |
-
$return .= sprintf('%.3F 0 0 %.3F %.3F %.3F cm ', $a*$this->kp, $d*$this->kp, $e*$this->kp, $f*$this->kp);
|
543 |
-
|
544 |
-
// mPDF 5.0.039
|
545 |
-
if (isset($gradient_info['units']) && strtolower($gradient_info['units'])=='objectboundingbox') {
|
546 |
-
if ($transformations) { $return .= $transformations; }
|
547 |
-
}
|
548 |
-
|
549 |
-
// x1 and y1 (fx, fy) should be inside the circle defined by x0 y0 and r else error in mPDF
|
550 |
-
while (pow(($x1-$x0),2) + pow(($y1 - $y0),2) >= pow($r,2)) { $r += 0.05; }
|
551 |
-
|
552 |
-
// mPDF 5.0.040
|
553 |
-
if ($spread=='R' || $spread=='F') { // Repeat / Reflect
|
554 |
-
$offs = array();
|
555 |
-
for($i=0;$i<$ns;$i++) {
|
556 |
-
$offs[$i] = $gradient_info['color'][$i]['offset'];
|
557 |
-
}
|
558 |
-
$gp = 0;
|
559 |
-
$inside=true;
|
560 |
-
while($inside) {
|
561 |
-
$gp++;
|
562 |
-
for($i=0;$i<$ns;$i++) {
|
563 |
-
if ($spread=='F' && ($gp % 2) == 1) { // Reflect
|
564 |
-
$gradient_info['color'][(($ns*$gp)+$i)] = $gradient_info['color'][(($ns*($gp-1))+($ns-$i-1))];
|
565 |
-
$tmp = $gp+(1-$offs[($ns-$i-1)]) ;
|
566 |
-
$gradient_info['color'][(($ns*$gp)+$i)]['offset'] = $tmp;
|
567 |
-
}
|
568 |
-
else { // Reflect
|
569 |
-
$gradient_info['color'][(($ns*$gp)+$i)] = $gradient_info['color'][$i];
|
570 |
-
$tmp = $gp+$offs[$i] ;
|
571 |
-
$gradient_info['color'][(($ns*$gp)+$i)]['offset'] = $tmp;
|
572 |
-
}
|
573 |
-
// IF STILL INSIDE BOX OR STILL VALID
|
574 |
-
// TEST IF circle (perimeter) intersects with
|
575 |
-
// or is enclosed
|
576 |
-
// Point on axis to test
|
577 |
-
$px = $x1 + ($x0-$x1)*$tmp;
|
578 |
-
$py = $y1 + ($y0-$y1)*$tmp;
|
579 |
-
$pr = $r*$tmp;
|
580 |
-
$res = _testIntersectCircle($px, $py, $pr);
|
581 |
-
if (!$res) { $inside = false; }
|
582 |
-
}
|
583 |
-
}
|
584 |
-
}
|
585 |
-
|
586 |
-
// mPDF 4.4.007 Gradient STOPs
|
587 |
-
$stops = count($gradient_info['color']);
|
588 |
-
if ($stops < 2) { return ''; }
|
589 |
-
|
590 |
-
// mPDF 5.0.043
|
591 |
-
$range = $gradient_info['color'][count($gradient_info['color'])-1]['offset']-$gradient_info['color'][0]['offset'];
|
592 |
-
$min = $gradient_info['color'][0]['offset'];
|
593 |
-
|
594 |
-
for ($i=0; $i<($stops); $i++) {
|
595 |
-
// mPDF 5.0.051
|
596 |
-
if (!$gradient_info['color'][$i]['color']) {
|
597 |
-
if ($gradient_info['colorspace']=='RGB') $gradient_info['color'][$i]['color'] = '0 0 0';
|
598 |
-
else if ($gradient_info['colorspace']=='Gray') $gradient_info['color'][$i]['color'] = '0';
|
599 |
-
else if ($gradient_info['colorspace']=='CMYK') $gradient_info['color'][$i]['color'] = '1 1 1 1';
|
600 |
-
}
|
601 |
-
$offset = ($gradient_info['color'][$i]['offset'] - $min)/$range;
|
602 |
-
$this->mpdf_ref->gradients[$n]['stops'][] = array(
|
603 |
-
'col' => $gradient_info['color'][$i]['color'],
|
604 |
-
'opacity' => $gradient_info['color'][$i]['opacity'],
|
605 |
-
'offset' => $offset);
|
606 |
-
if ($gradient_info['color'][$i]['opacity']<1) { $trans = true; }
|
607 |
-
}
|
608 |
-
$grx1 = $x1 + ($x0-$x1)*$gradient_info['color'][0]['offset'];
|
609 |
-
$gry1 = $y1 + ($y0-$y1)*$gradient_info['color'][0]['offset'];
|
610 |
-
$grx2 = $x1 + ($x0-$x1)*$gradient_info['color'][count($gradient_info['color'])-1]['offset'];
|
611 |
-
$gry2 = $y1 + ($y0-$y1)*$gradient_info['color'][count($gradient_info['color'])-1]['offset'];
|
612 |
-
$grir = $r*$gradient_info['color'][0]['offset'];
|
613 |
-
$grr = $r*$gradient_info['color'][count($gradient_info['color'])-1]['offset'];
|
614 |
-
|
615 |
-
$this->mpdf_ref->gradients[$n]['coords']=array($grx1, $gry1, $grx2, $gry2, abs($grr), abs($grir) );
|
616 |
-
|
617 |
-
$grx1 = $x1 + ($x0-$x1)*$first_stop;
|
618 |
-
$gry1 = $y1 + ($y0-$y1)*$first_stop;
|
619 |
-
$grx2 = $x1 + ($x0-$x1)*$last_stop;
|
620 |
-
$gry2 = $y1 + ($y0-$y1)*$last_stop;
|
621 |
-
$grir = $r*$first_stop;
|
622 |
-
$grr = $r*$last_stop;
|
623 |
-
$this->mpdf_ref->gradients[$n]['colorspace'] = $gradient_info['colorspace']; // mPDF 5.0.051
|
624 |
-
|
625 |
-
$this->mpdf_ref->gradients[$n]['type'] = 3;
|
626 |
-
$this->mpdf_ref->gradients[$n]['fo'] = true;
|
627 |
-
|
628 |
-
$this->mpdf_ref->gradients[$n]['extend']=array('true','true');
|
629 |
-
if ($trans) {
|
630 |
-
$this->mpdf_ref->gradients[$n]['trans'] = true;
|
631 |
-
$return .= ' /TGS'.($n).' gs ';
|
632 |
-
}
|
633 |
-
$return .= ' /Sh'.($n).' sh ';
|
634 |
-
$return .= " Q\n";
|
635 |
-
|
636 |
-
|
637 |
-
}
|
638 |
-
|
639 |
-
return $return;
|
640 |
-
}
|
641 |
-
|
642 |
-
|
643 |
-
function svgOffset ($attribs){
|
644 |
-
// save all <svg> tag attributes
|
645 |
-
$this->svg_attribs = $attribs;
|
646 |
-
if(isset($this->svg_attribs['viewBox'])) {
|
647 |
-
$vb = preg_split('/\s+/is', trim($this->svg_attribs['viewBox']));
|
648 |
-
if (count($vb)==4) {
|
649 |
-
$this->svg_info['x'] = $vb[0];
|
650 |
-
$this->svg_info['y'] = $vb[1];
|
651 |
-
$this->svg_info['w'] = $vb[2];
|
652 |
-
$this->svg_info['h'] = $vb[3];
|
653 |
-
// return; // mPDF 5.0.005
|
654 |
-
}
|
655 |
-
}
|
656 |
-
|
657 |
-
$svg_w = $this->mpdf_ref->ConvertSize($attribs['width']); // mm (interprets numbers as pixels)
|
658 |
-
$svg_h = $this->mpdf_ref->ConvertSize($attribs['height']); // mm
|
659 |
-
|
660 |
-
///*
|
661 |
-
// mPDF 5.0.005
|
662 |
-
if ($this->svg_info['w']) { // if 'w' set by viewBox
|
663 |
-
if ($svg_w) { // if width also set, use these values to determine to set size of "pixel"
|
664 |
-
$this->kp *= ($svg_w/0.2645) / $this->svg_info['w'];
|
665 |
-
$this->kf = ($svg_w/0.2645) / $this->svg_info['w']; // mPDF 5.0.039
|
666 |
-
}
|
667 |
-
else if ($svg_h) {
|
668 |
-
$this->kp *= ($svg_h/0.2645) / $this->svg_info['h'];
|
669 |
-
$this->kf = ($svg_h/0.2645) / $this->svg_info['h']; // mPDF 5.0.039
|
670 |
-
}
|
671 |
-
return;
|
672 |
-
}
|
673 |
-
//*/
|
674 |
-
|
675 |
-
// Added to handle file without height or width specified
|
676 |
-
if (!$svg_w && !$svg_h) { $svg_w = $svg_h = $this->mpdf_ref->blk[$this->mpdf_ref->blklvl]['inner_width'] ; } // DEFAULT
|
677 |
-
if (!$svg_w) { $svg_w = $svg_h; }
|
678 |
-
if (!$svg_h) { $svg_h = $svg_w; }
|
679 |
-
|
680 |
-
$this->svg_info['x'] = 0;
|
681 |
-
$this->svg_info['y'] = 0;
|
682 |
-
$this->svg_info['w'] = $svg_w/0.2645; // mm->pixels
|
683 |
-
$this->svg_info['h'] = $svg_h/0.2645; // mm->pixels
|
684 |
-
|
685 |
-
}
|
686 |
-
|
687 |
-
|
688 |
-
//
|
689 |
-
// check if points are within svg, if not, set to max
|
690 |
-
function svg_overflow($x,$y)
|
691 |
-
{
|
692 |
-
$x2 = $x;
|
693 |
-
$y2 = $y;
|
694 |
-
if(isset($this->svg_attribs['overflow']))
|
695 |
-
{
|
696 |
-
if($this->svg_attribs['overflow'] == 'hidden')
|
697 |
-
{
|
698 |
-
// Not sure if this is supposed to strip off units, but since I dont use any I will omlt this step
|
699 |
-
$svg_w = preg_replace("/([0-9\.]*)(.*)/i","$1",$this->svg_attribs['width']);
|
700 |
-
$svg_h = preg_replace("/([0-9\.]*)(.*)/i","$1",$this->svg_attribs['height']);
|
701 |
-
|
702 |
-
// $xmax = floor($this->svg_attribs['width']);
|
703 |
-
$xmax = floor($svg_w);
|
704 |
-
$xmin = 0;
|
705 |
-
// $ymax = floor(($this->svg_attribs['height'] * -1));
|
706 |
-
$ymax = floor(($svg_h * -1));
|
707 |
-
$ymin = 0;
|
708 |
-
|
709 |
-
if($x > $xmax) $x2 = $xmax; // right edge
|
710 |
-
if($x < $xmin) $x2 = $xmin; // left edge
|
711 |
-
if($y < $ymax) $y2 = $ymax; // bottom
|
712 |
-
if($y > $ymin) $y2 = $ymin; // top
|
713 |
-
|
714 |
-
}
|
715 |
-
}
|
716 |
-
|
717 |
-
|
718 |
-
return array( 'x' => $x2, 'y' => $y2);
|
719 |
-
}
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
function svgDefineStyle($critere_style){
|
724 |
-
|
725 |
-
$tmp = count($this->svg_style)-1;
|
726 |
-
$current_style = $this->svg_style[$tmp];
|
727 |
-
|
728 |
-
unset($current_style['transformations']);
|
729 |
-
|
730 |
-
// TRANSFORM SCALE
|
731 |
-
$transformations = '';
|
732 |
-
if (isset($critere_style['transform'])){
|
733 |
-
preg_match_all('/(matrix|translate|scale|rotate|skewX|skewY)\((.*?)\)/is',$critere_style['transform'],$m);
|
734 |
-
if (count($m[0])) {
|
735 |
-
for($i=0; $i<count($m[0]); $i++) {
|
736 |
-
$c = strtolower($m[1][$i]);
|
737 |
-
$v = trim($m[2][$i]);
|
738 |
-
$vv = preg_split('/[ ,]+/',$v);
|
739 |
-
if ($c=='matrix' && count($vv)==6) {
|
740 |
-
// mPDF 5.0.039
|
741 |
-
// Note angle of rotation is reversed (from SVG to PDF), so vv[1] and vv[2] are negated
|
742 |
-
$transformations .= sprintf(' %.3F %.3F %.3F %.3F %.3F %.3F cm ', $vv[0], -$vv[1], -$vv[2], $vv[3], $vv[4]*$this->kp, -$vv[5]*$this->kp);
|
743 |
-
|
744 |
-
/*
|
745 |
-
// The long way of doing this??
|
746 |
-
// need to reverse angle of rotation from SVG to PDF
|
747 |
-
$sx=sqrt(pow($vv[0],2)+pow($vv[2],2));
|
748 |
-
if ($vv[0] < 0) { $sx *= -1; } // change sign
|
749 |
-
$sy=sqrt(pow($vv[1],2)+pow($vv[3],2));
|
750 |
-
if ($vv[3] < 0) { $sy *= -1; } // change sign
|
751 |
-
|
752 |
-
// rotation angle is
|
753 |
-
$t=atan2($vv[1],$vv[3]);
|
754 |
-
$t=atan2(-$vv[2],$vv[0]); // Should be the same value or skew has been applied
|
755 |
-
|
756 |
-
// Reverse angle
|
757 |
-
$t *= -1;
|
758 |
-
|
759 |
-
// Rebuild matrix
|
760 |
-
$ma = $sx * cos($t);
|
761 |
-
$mb = $sy * sin($t);
|
762 |
-
$mc = -$sx * sin($t);
|
763 |
-
$md = $sy * cos($t);
|
764 |
-
|
765 |
-
// $transformations .= sprintf(' %.3F %.3F %.3F %.3F %.3F %.3F cm ', $ma, $mb, $mc, $md, $vv[4]*$this->kp, -$vv[5]*$this->kp);
|
766 |
-
*/
|
767 |
-
|
768 |
-
}
|
769 |
-
else if ($c=='translate' && count($vv)) {
|
770 |
-
$tm[4] = $vv[0];
|
771 |
-
if (count($vv)==2) { $t_y = -$vv[1]; }
|
772 |
-
else { $t_y = 0; }
|
773 |
-
$tm[5] = $t_y;
|
774 |
-
$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $tm[4]*$this->kp, $tm[5]*$this->kp);
|
775 |
-
}
|
776 |
-
else if ($c=='scale' && count($vv)) {
|
777 |
-
if (count($vv)==2) { $s_y = $vv[1]; }
|
778 |
-
else { $s_y = $vv[0]; }
|
779 |
-
$tm[0] = $vv[0];
|
780 |
-
$tm[3] = $s_y;
|
781 |
-
$transformations .= sprintf(' %.3F 0 0 %.3F 0 0 cm ', $tm[0], $tm[3]);
|
782 |
-
}
|
783 |
-
else if ($c=='rotate' && count($vv)) {
|
784 |
-
$tm[0] = cos(deg2rad(-$vv[0]));
|
785 |
-
$tm[1] = sin(deg2rad(-$vv[0]));
|
786 |
-
$tm[2] = -$tm[1];
|
787 |
-
$tm[3] = $tm[0];
|
788 |
-
if (count($vv)==3) {
|
789 |
-
$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $vv[1]*$this->kp, -$vv[2]*$this->kp);
|
790 |
-
}
|
791 |
-
$transformations .= sprintf(' %.3F %.3F %.3F %.3F 0 0 cm ', $tm[0], $tm[1], $tm[2], $tm[3]);
|
792 |
-
if (count($vv)==3) {
|
793 |
-
$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', -$vv[1]*$this->kp, $vv[2]*$this->kp);
|
794 |
-
}
|
795 |
-
}
|
796 |
-
else if ($c=='skewx' && count($vv)) {
|
797 |
-
$tm[2] = tan(deg2rad(-$vv[0]));
|
798 |
-
$transformations .= sprintf(' 1 0 %.3F 1 0 0 cm ', $tm[2]);
|
799 |
-
}
|
800 |
-
else if ($c=='skewy' && count($vv)) {
|
801 |
-
$tm[1] = tan(deg2rad(-$vv[0]));
|
802 |
-
$transformations .= sprintf(' 1 %.3F 0 1 0 0 cm ', $tm[1]);
|
803 |
-
}
|
804 |
-
|
805 |
-
}
|
806 |
-
}
|
807 |
-
$current_style['transformations'] = $transformations;
|
808 |
-
}
|
809 |
-
|
810 |
-
if (isset($critere_style['style'])){
|
811 |
-
if (preg_match('/fill:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/',$critere_style['style'], $m)) {
|
812 |
-
$current_style['fill'] = '#'.str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
|
813 |
-
}
|
814 |
-
else { $tmp = preg_replace("/(.*)fill:\s*([a-z0-9#_()]*|none)(.*)/i","$2",$critere_style['style']); // mPDF 4.4.003
|
815 |
-
if ($tmp != $critere_style['style']){ $current_style['fill'] = $tmp; }
|
816 |
-
}
|
817 |
-
|
818 |
-
$tmp = preg_replace("/(.*)fill-opacity:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
819 |
-
if ($tmp != $critere_style['style']){ $current_style['fill-opacity'] = $tmp;}
|
820 |
-
|
821 |
-
$tmp = preg_replace("/(.*)fill-rule:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
822 |
-
if ($tmp != $critere_style['style']){ $current_style['fill-rule'] = $tmp;}
|
823 |
-
|
824 |
-
if (preg_match('/stroke:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/',$critere_style['style'], $m)) {
|
825 |
-
$current_style['stroke'] = '#'.str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
|
826 |
-
}
|
827 |
-
else { $tmp = preg_replace("/(.*)stroke:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
828 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke'] = $tmp; }
|
829 |
-
}
|
830 |
-
|
831 |
-
$tmp = preg_replace("/(.*)stroke-linecap:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
832 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-linecap'] = $tmp;}
|
833 |
-
|
834 |
-
$tmp = preg_replace("/(.*)stroke-linejoin:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
835 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-linejoin'] = $tmp;}
|
836 |
-
|
837 |
-
$tmp = preg_replace("/(.*)stroke-miterlimit:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
838 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-miterlimit'] = $tmp;}
|
839 |
-
|
840 |
-
$tmp = preg_replace("/(.*)stroke-opacity:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
841 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-opacity'] = $tmp; }
|
842 |
-
|
843 |
-
$tmp = preg_replace("/(.*)stroke-width:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
844 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-width'] = $tmp;}
|
845 |
-
|
846 |
-
// mPDF 4.4.003
|
847 |
-
$tmp = preg_replace("/(.*)stroke-dasharray:\s*([a-z0-9., ]*|none)(.*)/i","$2",$critere_style['style']);
|
848 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-dasharray'] = $tmp;}
|
849 |
-
|
850 |
-
// mPDF 4.4.003
|
851 |
-
$tmp = preg_replace("/(.*)stroke-dashoffset:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
852 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-dashoffset'] = $tmp;}
|
853 |
-
|
854 |
-
}
|
855 |
-
if(isset($critere_style['fill'])){
|
856 |
-
$current_style['fill'] = $critere_style['fill'];
|
857 |
-
}
|
858 |
-
|
859 |
-
if(isset($critere_style['fill-opacity'])){
|
860 |
-
$current_style['fill-opacity'] = $critere_style['fill-opacity'];
|
861 |
-
}
|
862 |
-
|
863 |
-
if(isset($critere_style['fill-rule'])){
|
864 |
-
$current_style['fill-rule'] = $critere_style['fill-rule'];
|
865 |
-
}
|
866 |
-
|
867 |
-
if(isset($critere_style['stroke'])){
|
868 |
-
$current_style['stroke'] = $critere_style['stroke'];
|
869 |
-
}
|
870 |
-
|
871 |
-
if(isset($critere_style['stroke-linecap'])){
|
872 |
-
$current_style['stroke-linecap'] = $critere_style['stroke-linecap'];
|
873 |
-
}
|
874 |
-
|
875 |
-
if(isset($critere_style['stroke-linejoin'])){
|
876 |
-
$current_style['stroke-linejoin'] = $critere_style['stroke-linejoin'];
|
877 |
-
}
|
878 |
-
|
879 |
-
if(isset($critere_style['stroke-miterlimit'])){
|
880 |
-
$current_style['stroke-miterlimit'] = $critere_style['stroke-miterlimit'];
|
881 |
-
}
|
882 |
-
|
883 |
-
if(isset($critere_style['stroke-opacity'])){
|
884 |
-
$current_style['stroke-opacity'] = $critere_style['stroke-opacity'];
|
885 |
-
}
|
886 |
-
|
887 |
-
if(isset($critere_style['stroke-width'])){
|
888 |
-
$current_style['stroke-width'] = $critere_style['stroke-width'];
|
889 |
-
}
|
890 |
-
|
891 |
-
// mPDF 4.4.003
|
892 |
-
if(isset($critere_style['stroke-dasharray'])){
|
893 |
-
$current_style['stroke-dasharray'] = $critere_style['stroke-dasharray'];
|
894 |
-
}
|
895 |
-
if(isset($critere_style['stroke-dashoffset'])){
|
896 |
-
$current_style['stroke-dashoffset'] = $critere_style['stroke-dashoffset'];
|
897 |
-
}
|
898 |
-
|
899 |
-
// mPDF 4.4.005 Used as indirect setting for currentColor
|
900 |
-
if(isset($critere_style['color']) && $critere_style['color'] != 'inherit'){
|
901 |
-
$current_style['color'] = $critere_style['color'];
|
902 |
-
}
|
903 |
-
|
904 |
-
return $current_style;
|
905 |
-
|
906 |
-
}
|
907 |
-
|
908 |
-
//
|
909 |
-
// Cette fonction ecrit le style dans le stream svg.
|
910 |
-
function svgStyle($critere_style, $attribs, $element){
|
911 |
-
$path_style = '';
|
912 |
-
if (substr_count($critere_style['fill'],'url')>0){
|
913 |
-
//
|
914 |
-
// couleur degrad�
|
915 |
-
$id_gradient = preg_replace("/url\(#([\w_]*)\)/i","$1",$critere_style['fill']);
|
916 |
-
if ($id_gradient != $critere_style['fill']) {
|
917 |
-
if (isset($this->svg_gradient[$id_gradient])) {
|
918 |
-
$fill_gradient = $this->svgGradient($this->svg_gradient[$id_gradient], $attribs, $element);
|
919 |
-
if ($fill_gradient) { // mPDF 4.4.003
|
920 |
-
$path_style = "q ";
|
921 |
-
$w = "W";
|
922 |
-
$style .= 'N';
|
923 |
-
}
|
924 |
-
}
|
925 |
-
}
|
926 |
-
|
927 |
-
}
|
928 |
-
// mPDF 4.4.005 Used as indirect setting for currentColor
|
929 |
-
else if (strtolower($critere_style['fill']) == 'currentcolor'){
|
930 |
-
$col = $this->mpdf_ref->ConvertColor($critere_style['color']);
|
931 |
-
if ($col) {
|
932 |
-
// mPDF 5.0.051
|
933 |
-
// mPDF 5.3.74
|
934 |
-
if ($col{0}==5) { $critere_style['fill-opacity'] = ord($col{4}/100); } // RGBa
|
935 |
-
if ($col{0}==6) { $critere_style['fill-opacity'] = ord($col{5}/100); } // CMYKa
|
936 |
-
$path_style .= $this->mpdf_ref->SetFColor($col, true).' '; // mPDF 5.0.051
|
937 |
-
$style .= 'F';
|
938 |
-
}
|
939 |
-
}
|
940 |
-
else if ($critere_style['fill'] != 'none'){
|
941 |
-
$col = $this->mpdf_ref->ConvertColor($critere_style['fill']);
|
942 |
-
if ($col) {
|
943 |
-
// mPDF 5.0.051
|
944 |
-
// mPDF 5.3.74
|
945 |
-
if ($col{0}==5) { $critere_style['fill-opacity'] = ord($col{4}/100); } // RGBa
|
946 |
-
if ($col{0}==6) { $critere_style['fill-opacity'] = ord($col{5}/100); } // CMYKa
|
947 |
-
$path_style .= $this->mpdf_ref->SetFColor($col, true).' '; // mPDF 5.0.051
|
948 |
-
$style .= 'F';
|
949 |
-
}
|
950 |
-
}
|
951 |
-
|
952 |
-
// mPDF 5.0.040
|
953 |
-
if (substr_count($critere_style['stroke'],'url')>0){
|
954 |
-
/*
|
955 |
-
// Cannot put a gradient on a "stroke" in PDF?
|
956 |
-
$id_gradient = preg_replace("/url\(#([\w_]*)\)/i","$1",$critere_style['stroke']);
|
957 |
-
if ($id_gradient != $critere_style['stroke']) {
|
958 |
-
if (isset($this->svg_gradient[$id_gradient])) {
|
959 |
-
$fill_gradient = $this->svgGradient($this->svg_gradient[$id_gradient], $attribs, $element);
|
960 |
-
if ($fill_gradient) {
|
961 |
-
$path_style = "q ";
|
962 |
-
$w = "W";
|
963 |
-
$style .= 'D';
|
964 |
-
}
|
965 |
-
}
|
966 |
-
}
|
967 |
-
*/
|
968 |
-
}
|
969 |
-
// mPDF 4.4.005 Used as indirect setting for currentColor
|
970 |
-
else if (strtolower($critere_style['stroke']) == 'currentcolor'){
|
971 |
-
$col = $this->mpdf_ref->ConvertColor($critere_style['color']);
|
972 |
-
if ($col) {
|
973 |
-
// mPDF 5.0.051
|
974 |
-
// mPDF 5.3.74
|
975 |
-
if ($col{0}==5) { $critere_style['stroke-opacity'] = ord($col{4}/100); } // RGBa
|
976 |
-
if ($col{0}==6) { $critere_style['stroke-opacity'] = ord($col{5}/100); } // CMYKa
|
977 |
-
$path_style .= $this->mpdf_ref->SetDColor($col, true).' '; // mPDF 5.0.051
|
978 |
-
$style .= 'D';
|
979 |
-
$lw = $this->ConvertSVGSizePixels($critere_style['stroke-width']);
|
980 |
-
$path_style .= sprintf('%.3F w ',$lw*$this->kp);
|
981 |
-
}
|
982 |
-
}
|
983 |
-
else if ($critere_style['stroke'] != 'none'){
|
984 |
-
$col = $this->mpdf_ref->ConvertColor($critere_style['stroke']);
|
985 |
-
if ($col) {
|
986 |
-
// mPDF 5.0.051
|
987 |
-
// mPDF 5.3.74
|
988 |
-
if ($col{0}==5) { $critere_style['stroke-opacity'] = ord($col{4}/100); } // RGBa
|
989 |
-
if ($col{0}==6) { $critere_style['stroke-opacity'] = ord($col{5}/100); } // CMYKa
|
990 |
-
$path_style .= $this->mpdf_ref->SetDColor($col, true).' '; // mPDF 5.0.051
|
991 |
-
$style .= 'D';
|
992 |
-
$lw = $this->ConvertSVGSizePixels($critere_style['stroke-width']); // mPDF 4.4.003
|
993 |
-
$path_style .= sprintf('%.3F w ',$lw*$this->kp);
|
994 |
-
}
|
995 |
-
}
|
996 |
-
|
997 |
-
|
998 |
-
if ($critere_style['stroke'] != 'none'){
|
999 |
-
if ($critere_style['stroke-linejoin'] == 'miter'){
|
1000 |
-
$path_style .= ' 0 j ';
|
1001 |
-
}
|
1002 |
-
else if ($critere_style['stroke-linejoin'] == 'round'){
|
1003 |
-
$path_style .= ' 1 j ';
|
1004 |
-
}
|
1005 |
-
else if ($critere_style['stroke-linejoin'] == 'bevel'){
|
1006 |
-
$path_style .= ' 2 j ';
|
1007 |
-
}
|
1008 |
-
|
1009 |
-
if ($critere_style['stroke-linecap'] == 'butt'){
|
1010 |
-
$path_style .= ' 0 J ';
|
1011 |
-
}
|
1012 |
-
else if ($critere_style['stroke-linecap'] == 'round'){
|
1013 |
-
$path_style .= ' 1 J ';
|
1014 |
-
}
|
1015 |
-
else if ($critere_style['stroke-linecap'] == 'square'){
|
1016 |
-
$path_style .= ' 2 J ';
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
if (isset($critere_style['stroke-miterlimit'])){
|
1020 |
-
if ($critere_style['stroke-miterlimit'] == 'none'){
|
1021 |
-
}
|
1022 |
-
else if (preg_match('/^[\d.]+$/',$critere_style['stroke-miterlimit'])) {
|
1023 |
-
$path_style .= sprintf('%.2F M ',$critere_style['stroke-miterlimit']);
|
1024 |
-
}
|
1025 |
-
}
|
1026 |
-
// mPDF 4.4.003
|
1027 |
-
if (isset($critere_style['stroke-dasharray'])){
|
1028 |
-
$off = 0;
|
1029 |
-
$d = preg_split('/[ ,]/',$critere_style['stroke-dasharray']);
|
1030 |
-
if (count($d) == 1 && $d[0]==0) {
|
1031 |
-
$path_style .= '[] 0 d ';
|
1032 |
-
}
|
1033 |
-
else {
|
1034 |
-
if (count($d) % 2 == 1) { $d = array_merge($d, $d); } // 5, 3, 1 => 5,3,1,5,3,1 OR 3 => 3,3
|
1035 |
-
$arr = '';
|
1036 |
-
for($i=0; $i<count($d); $i+=2) {
|
1037 |
-
$arr .= sprintf('%.3F %.3F ', $d[$i]*$this->kp, $d[$i+1]*$this->kp);
|
1038 |
-
}
|
1039 |
-
if (isset($critere_style['stroke-dashoffset'])){ $off = $critere_style['stroke-dashoffset'] + 0; }
|
1040 |
-
$path_style .= sprintf('[%s] %.3F d ', $arr, $off*$this->kp);
|
1041 |
-
}
|
1042 |
-
}
|
1043 |
-
}
|
1044 |
-
|
1045 |
-
// mPDF 4.4.003
|
1046 |
-
if ($critere_style['fill-rule']=='evenodd') { $fr = '*'; }
|
1047 |
-
else { $fr = ''; }
|
1048 |
-
|
1049 |
-
// mPDF 4.4.003
|
1050 |
-
if (isset($critere_style['fill-opacity'])) {
|
1051 |
-
$opacity = 1;
|
1052 |
-
if ($critere_style['fill-opacity'] == 0) { $opacity = 0; }
|
1053 |
-
else if ($critere_style['fill-opacity'] > 1) { $opacity = 1; }
|
1054 |
-
else if ($critere_style['fill-opacity'] > 0) { $opacity = $critere_style['fill-opacity']; }
|
1055 |
-
else if ($critere_style['fill-opacity'] < 0) { $opacity = 0; }
|
1056 |
-
$gs = $this->mpdf_ref->AddExtGState(array('ca'=>$opacity, 'BM'=>'/Normal'));
|
1057 |
-
$this->mpdf_ref->extgstates[$gs]['fo'] = true; // mPDF 5.0.039
|
1058 |
-
$path_style .= sprintf(' /GS%d gs ', $gs);
|
1059 |
-
}
|
1060 |
-
|
1061 |
-
// mPDF 4.4.003
|
1062 |
-
if (isset($critere_style['stroke-opacity'])) {
|
1063 |
-
$opacity = 1;
|
1064 |
-
if ($critere_style['stroke-opacity'] == 0) { $opacity = 0; }
|
1065 |
-
else if ($critere_style['stroke-opacity'] > 1) { $opacity = 1; }
|
1066 |
-
else if ($critere_style['stroke-opacity'] > 0) { $opacity = $critere_style['stroke-opacity']; }
|
1067 |
-
else if ($critere_style['stroke-opacity'] < 0) { $opacity = 0; }
|
1068 |
-
$gs = $this->mpdf_ref->AddExtGState(array('CA'=>$opacity, 'BM'=>'/Normal'));
|
1069 |
-
$this->mpdf_ref->extgstates[$gs]['fo'] = true; // mPDF 5.0.039
|
1070 |
-
$path_style .= sprintf(' /GS%d gs ', $gs);
|
1071 |
-
}
|
1072 |
-
|
1073 |
-
switch ($style){
|
1074 |
-
case 'F':
|
1075 |
-
$op = 'f';
|
1076 |
-
break;
|
1077 |
-
case 'FD':
|
1078 |
-
$op = 'B';
|
1079 |
-
break;
|
1080 |
-
case 'ND':
|
1081 |
-
$op = 'S';
|
1082 |
-
break;
|
1083 |
-
case 'D':
|
1084 |
-
$op = 'S';
|
1085 |
-
break;
|
1086 |
-
default:
|
1087 |
-
$op = 'n';
|
1088 |
-
}
|
1089 |
-
|
1090 |
-
// mPDF 5.0
|
1091 |
-
$prestyle = $path_style.' ';
|
1092 |
-
$poststyle = $w.' '. $op.$fr.' '.$fill_gradient."\n";
|
1093 |
-
return array($prestyle,$poststyle);
|
1094 |
-
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
//
|
1098 |
-
// fonction retracant les <path />
|
1099 |
-
function svgPath($command, $arguments){
|
1100 |
-
$path_cmd = '';
|
1101 |
-
$newsubpath = false; // mPDF 4.4.003
|
1102 |
-
// mPDF 5.0.039
|
1103 |
-
$minl = $this->pathBBox[0];
|
1104 |
-
$mint = $this->pathBBox[1];
|
1105 |
-
$maxr = $this->pathBBox[2]+$this->pathBBox[0];
|
1106 |
-
$maxb = $this->pathBBox[3]+$this->pathBBox[1];
|
1107 |
-
// mPDF 5.0.040
|
1108 |
-
$start = array($this->xbase, -$this->ybase);
|
1109 |
-
|
1110 |
-
// mPDF 4.4.003
|
1111 |
-
preg_match_all('/[\-^]?[\d.]+(e[\-]?[\d]+){0,1}/i', $arguments, $a, PREG_SET_ORDER);
|
1112 |
-
|
1113 |
-
// if the command is a capital letter, the coords go absolute, otherwise relative
|
1114 |
-
if(strtolower($command) == $command) $relative = true;
|
1115 |
-
else $relative = false;
|
1116 |
-
|
1117 |
-
|
1118 |
-
$ile_argumentow = count($a);
|
1119 |
-
|
1120 |
-
// each command may have different needs for arguments [1 to 8]
|
1121 |
-
|
1122 |
-
switch(strtolower($command)){
|
1123 |
-
case 'm': // move
|
1124 |
-
for($i = 0; $i<$ile_argumentow; $i+=2){
|
1125 |
-
$x = $a[$i][0];
|
1126 |
-
$y = $a[$i+1][0];
|
1127 |
-
if($relative){
|
1128 |
-
$pdfx = ($this->xbase + $x);
|
1129 |
-
$pdfy = ($this->ybase - $y);
|
1130 |
-
$this->xbase += $x;
|
1131 |
-
$this->ybase += -$y;
|
1132 |
-
}
|
1133 |
-
else{
|
1134 |
-
$pdfx = $x;
|
1135 |
-
$pdfy = -$y ;
|
1136 |
-
$this->xbase = $x;
|
1137 |
-
$this->ybase = -$y;
|
1138 |
-
}
|
1139 |
-
$pdf_pt = $this->svg_overflow($pdfx,$pdfy);
|
1140 |
-
// mPDF 5.0.039
|
1141 |
-
$minl = min($minl,$pdf_pt['x']);
|
1142 |
-
$maxr = max($maxr,$pdf_pt['x']);
|
1143 |
-
$mint = min($mint,-$pdf_pt['y']);
|
1144 |
-
$maxb = max($maxb,-$pdf_pt['y']);
|
1145 |
-
if($i == 0) $path_cmd .= sprintf('%.3F %.3F m ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1146 |
-
else $path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1147 |
-
// mPDF 4.4.003 Save start points of subpath
|
1148 |
-
if ($this->subPathInit) {
|
1149 |
-
$this->spxstart = $this->xbase;
|
1150 |
-
$this->spystart = $this->ybase;
|
1151 |
-
$this->subPathInit = false;
|
1152 |
-
}
|
1153 |
-
}
|
1154 |
-
break;
|
1155 |
-
case 'l': // a simple line
|
1156 |
-
for($i = 0; $i<$ile_argumentow; $i+=2){
|
1157 |
-
$x = ($a[$i][0]);
|
1158 |
-
$y = ($a[$i+1][0]);
|
1159 |
-
if($relative){
|
1160 |
-
$pdfx = ($this->xbase + $x);
|
1161 |
-
$pdfy = ($this->ybase - $y);
|
1162 |
-
$this->xbase += $x;
|
1163 |
-
$this->ybase += -$y;
|
1164 |
-
}
|
1165 |
-
else{
|
1166 |
-
$pdfx = $x ;
|
1167 |
-
$pdfy = -$y ;
|
1168 |
-
$this->xbase = $x;
|
1169 |
-
$this->ybase = -$y;
|
1170 |
-
}
|
1171 |
-
$pdf_pt = $this->svg_overflow($pdfx,$pdfy);
|
1172 |
-
// mPDF 5.0.039
|
1173 |
-
$minl = min($minl,$pdf_pt['x']);
|
1174 |
-
$maxr = max($maxr,$pdf_pt['x']);
|
1175 |
-
$mint = min($mint,-$pdf_pt['y']);
|
1176 |
-
$maxb = max($maxb,-$pdf_pt['y']);
|
1177 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1178 |
-
}
|
1179 |
-
break;
|
1180 |
-
case 'h': // a very simple horizontal line
|
1181 |
-
for($i = 0; $i<$ile_argumentow; $i++){
|
1182 |
-
$x = ($a[$i][0]);
|
1183 |
-
if($relative){
|
1184 |
-
$y = 0;
|
1185 |
-
$pdfx = ($this->xbase + $x) ;
|
1186 |
-
$pdfy = ($this->ybase - $y) ;
|
1187 |
-
$this->xbase += $x;
|
1188 |
-
$this->ybase += -$y;
|
1189 |
-
}
|
1190 |
-
else{
|
1191 |
-
$y = -$this->ybase;
|
1192 |
-
$pdfx = $x;
|
1193 |
-
$pdfy = -$y;
|
1194 |
-
$this->xbase = $x;
|
1195 |
-
$this->ybase = -$y;
|
1196 |
-
}
|
1197 |
-
$pdf_pt = $this->svg_overflow($pdfx,$pdfy);
|
1198 |
-
// mPDF 5.0.039
|
1199 |
-
$minl = min($minl,$pdf_pt['x']);
|
1200 |
-
$maxr = max($maxr,$pdf_pt['x']);
|
1201 |
-
$mint = min($mint,-$pdf_pt['y']);
|
1202 |
-
$maxb = max($maxb,-$pdf_pt['y']);
|
1203 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1204 |
-
}
|
1205 |
-
break;
|
1206 |
-
case 'v': // the simplest line, vertical
|
1207 |
-
for($i = 0; $i<$ile_argumentow; $i++){
|
1208 |
-
$y = ($a[$i][0]);
|
1209 |
-
if($relative){
|
1210 |
-
$x = 0;
|
1211 |
-
$pdfx = ($this->xbase + $x);
|
1212 |
-
$pdfy = ($this->ybase - $y);
|
1213 |
-
$this->xbase += $x;
|
1214 |
-
$this->ybase += -$y;
|
1215 |
-
}
|
1216 |
-
else{
|
1217 |
-
$x = $this->xbase;
|
1218 |
-
$pdfx = $x;
|
1219 |
-
$pdfy = -$y;
|
1220 |
-
$this->xbase = $x;
|
1221 |
-
$this->ybase = -$y;
|
1222 |
-
}
|
1223 |
-
$pdf_pt = $this->svg_overflow($pdfx,$pdfy);
|
1224 |
-
// mPDF 5.0.039
|
1225 |
-
$minl = min($minl,$pdf_pt['x']);
|
1226 |
-
$maxr = max($maxr,$pdf_pt['x']);
|
1227 |
-
$mint = min($mint,-$pdf_pt['y']);
|
1228 |
-
$maxb = max($maxb,-$pdf_pt['y']);
|
1229 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1230 |
-
}
|
1231 |
-
break;
|
1232 |
-
case 's': // bezier with first vertex equal first control
|
1233 |
-
// mPDF 4.4.003
|
1234 |
-
if (!($this->lastcommand == 'C' || $this->lastcommand == 'c' || $this->lastcommand == 'S' || $this->lastcommand == 's')) {
|
1235 |
-
$this->lastcontrolpoints = array(0,0);
|
1236 |
-
}
|
1237 |
-
for($i = 0; $i<$ile_argumentow; $i += 4){
|
1238 |
-
$x1 = $this->lastcontrolpoints[0];
|
1239 |
-
$y1 = $this->lastcontrolpoints[1];
|
1240 |
-
$x2 = ($a[$i][0]);
|
1241 |
-
$y2 = ($a[$i+1][0]);
|
1242 |
-
$x = ($a[$i+2][0]);
|
1243 |
-
$y = ($a[$i+3][0]);
|
1244 |
-
if($relative){
|
1245 |
-
$pdfx1 = ($this->xbase + $x1);
|
1246 |
-
$pdfy1 = ($this->ybase - $y1);
|
1247 |
-
$pdfx2 = ($this->xbase + $x2);
|
1248 |
-
$pdfy2 = ($this->ybase - $y2);
|
1249 |
-
$pdfx = ($this->xbase + $x);
|
1250 |
-
$pdfy = ($this->ybase - $y);
|
1251 |
-
$this->xbase += $x;
|
1252 |
-
$this->ybase += -$y;
|
1253 |
-
}
|
1254 |
-
else{
|
1255 |
-
$pdfx1 = $this->xbase + $x1;
|
1256 |
-
$pdfy1 = $this->ybase -$y1;
|
1257 |
-
$pdfx2 = $x2;
|
1258 |
-
$pdfy2 = -$y2;
|
1259 |
-
$pdfx = $x;
|
1260 |
-
$pdfy = -$y;
|
1261 |
-
$this->xbase = $x;
|
1262 |
-
$this->ybase = -$y;
|
1263 |
-
}
|
1264 |
-
$this->lastcontrolpoints = array(($pdfx-$pdfx2),-($pdfy-$pdfy2)); // mPDF 4.4.003 always relative
|
1265 |
-
|
1266 |
-
$pdf_pt = $this->svg_overflow($pdfx,$pdfy);
|
1267 |
-
|
1268 |
-
// mPDF 5.0.040
|
1269 |
-
$curves = array($pdfx1,-$pdfy1,$pdfx2,-$pdfy2,$pdfx,-$pdfy);
|
1270 |
-
$bx = calc_bezier_bbox($start, $curves);
|
1271 |
-
$minl = min($minl,$bx[0]);
|
1272 |
-
$maxr = max($maxr,$bx[2]);
|
1273 |
-
$mint = min($mint,$bx[1]);
|
1274 |
-
$maxb = max($maxb,$bx[3]);
|
1275 |
-
|
1276 |
-
if( ($pdf_pt['x'] != $pdfx) || ($pdf_pt['y'] != $pdfy) )
|
1277 |
-
{
|
1278 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1279 |
-
}
|
1280 |
-
else
|
1281 |
-
{
|
1282 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1*$this->kp, $pdfy1*$this->kp, $pdfx2*$this->kp, $pdfy2*$this->kp, $pdfx*$this->kp, $pdfy*$this->kp);
|
1283 |
-
}
|
1284 |
-
|
1285 |
-
}
|
1286 |
-
break;
|
1287 |
-
case 'c': // bezier with second vertex equal second control
|
1288 |
-
for($i = 0; $i<$ile_argumentow; $i += 6){
|
1289 |
-
$x1 = ($a[$i][0]);
|
1290 |
-
$y1 = ($a[$i+1][0]);
|
1291 |
-
$x2 = ($a[$i+2][0]);
|
1292 |
-
$y2 = ($a[$i+3][0]);
|
1293 |
-
$x = ($a[$i+4][0]);
|
1294 |
-
$y = ($a[$i+5][0]);
|
1295 |
-
|
1296 |
-
|
1297 |
-
if($relative){
|
1298 |
-
$pdfx1 = ($this->xbase + $x1);
|
1299 |
-
$pdfy1 = ($this->ybase - $y1);
|
1300 |
-
$pdfx2 = ($this->xbase + $x2);
|
1301 |
-
$pdfy2 = ($this->ybase - $y2);
|
1302 |
-
$pdfx = ($this->xbase + $x);
|
1303 |
-
$pdfy = ($this->ybase - $y);
|
1304 |
-
$this->xbase += $x;
|
1305 |
-
$this->ybase += -$y;
|
1306 |
-
}
|
1307 |
-
else{
|
1308 |
-
$pdfx1 = $x1;
|
1309 |
-
$pdfy1 = -$y1;
|
1310 |
-
$pdfx2 = $x2;
|
1311 |
-
$pdfy2 = -$y2;
|
1312 |
-
$pdfx = $x;
|
1313 |
-
$pdfy = -$y;
|
1314 |
-
$this->xbase = $x;
|
1315 |
-
$this->ybase = -$y;
|
1316 |
-
}
|
1317 |
-
$this->lastcontrolpoints = array(($pdfx-$pdfx2),-($pdfy-$pdfy2)); // mPDF 4.4.003 always relative
|
1318 |
-
// $pdf_pt2 = $this->svg_overflow($pdfx2,$pdfy2);
|
1319 |
-
// $pdf_pt1 = $this->svg_overflow($pdfx1,$pdfy1);
|
1320 |
-
$pdf_pt = $this->svg_overflow($pdfx,$pdfy);
|
1321 |
-
|
1322 |
-
// mPDF 5.0.040
|
1323 |
-
$curves = array($pdfx1,-$pdfy1,$pdfx2,-$pdfy2,$pdfx,-$pdfy);
|
1324 |
-
$bx = calc_bezier_bbox($start, $curves);
|
1325 |
-
$minl = min($minl,$bx[0]);
|
1326 |
-
$maxr = max($maxr,$bx[2]);
|
1327 |
-
$mint = min($mint,$bx[1]);
|
1328 |
-
$maxb = max($maxb,$bx[3]);
|
1329 |
-
|
1330 |
-
if( ($pdf_pt['x'] != $pdfx) || ($pdf_pt['y'] != $pdfy) )
|
1331 |
-
{
|
1332 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1333 |
-
}
|
1334 |
-
else
|
1335 |
-
{
|
1336 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1*$this->kp, $pdfy1*$this->kp, $pdfx2*$this->kp, $pdfy2*$this->kp, $pdfx*$this->kp, $pdfy*$this->kp);
|
1337 |
-
}
|
1338 |
-
|
1339 |
-
}
|
1340 |
-
break;
|
1341 |
-
|
1342 |
-
case 'q': // bezier quadratic avec point de control
|
1343 |
-
for($i = 0; $i<$ile_argumentow; $i += 4){
|
1344 |
-
$x1 = ($a[$i][0]);
|
1345 |
-
$y1 = ($a[$i+1][0]);
|
1346 |
-
$x = ($a[$i+2][0]);
|
1347 |
-
$y = ($a[$i+3][0]);
|
1348 |
-
if($relative){
|
1349 |
-
$pdfx = ($this->xbase + $x);
|
1350 |
-
$pdfy = ($this->ybase - $y);
|
1351 |
-
|
1352 |
-
$pdfx1 = ($this->xbase + ($x1*2/3));
|
1353 |
-
$pdfy1 = ($this->ybase - ($y1*2/3));
|
1354 |
-
// mPDF 4.4.003
|
1355 |
-
$pdfx2 = $pdfx1 + 1/3 *($x);
|
1356 |
-
$pdfy2 = $pdfy1 + 1/3 *(-$y) ;
|
1357 |
-
|
1358 |
-
$this->xbase += $x;
|
1359 |
-
$this->ybase += -$y;
|
1360 |
-
}
|
1361 |
-
else{
|
1362 |
-
$pdfx = $x;
|
1363 |
-
$pdfy = -$y;
|
1364 |
-
|
1365 |
-
$pdfx1 = ($this->xbase+(($x1-$this->xbase)*2/3));
|
1366 |
-
$pdfy1 = ($this->ybase-(($y1+$this->ybase)*2/3));
|
1367 |
-
|
1368 |
-
$pdfx2 = ($x+(($x1-$x)*2/3));
|
1369 |
-
$pdfy2 = (-$y-(($y1-$y)*2/3));
|
1370 |
-
|
1371 |
-
// mPDF 4.4.003
|
1372 |
-
$pdfx2 = $pdfx1 + 1/3 *($x - $this->xbase);
|
1373 |
-
$pdfy2 = $pdfy1 + 1/3 *(-$y - $this->ybase) ;
|
1374 |
-
|
1375 |
-
$this->xbase = $x;
|
1376 |
-
$this->ybase = -$y;
|
1377 |
-
}
|
1378 |
-
$this->lastcontrolpoints = array(($pdfx-$pdfx2),-($pdfy-$pdfy2)); // mPDF 4.4.003 always relative
|
1379 |
-
|
1380 |
-
$pdf_pt = $this->svg_overflow($pdfx,$pdfy);
|
1381 |
-
|
1382 |
-
// mPDF 5.0.040
|
1383 |
-
$curves = array($pdfx1,-$pdfy1,$pdfx2,-$pdfy2,$pdfx,-$pdfy);
|
1384 |
-
$bx = calc_bezier_bbox($start, $curves);
|
1385 |
-
$minl = min($minl,$bx[0]);
|
1386 |
-
$maxr = max($maxr,$bx[2]);
|
1387 |
-
$mint = min($mint,$bx[1]);
|
1388 |
-
$maxb = max($maxb,$bx[3]);
|
1389 |
-
|
1390 |
-
if( ($pdf_pt['x'] != $pdfx) || ($pdf_pt['y'] != $pdfy) )
|
1391 |
-
{
|
1392 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x']*$this->kp, $pdf_pt['y']*$this->kp);
|
1393 |
-
}
|
1394 |
-
else
|
1395 |
-
{
|
1396 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1*$this->kp, $pdfy1*$this->kp, $pdfx2*$this->kp, $pdfy2*$this->kp, $pdfx*$this->kp, $pdfy*$this->kp);
|
1397 |
-
}
|
1398 |
-
}
|
1399 |
-
break;
|
1400 |
-
case 't': // bezier quadratic avec point de control simetrique a lancien point de control
|
1401 |
-
// mPDF 4.4.003
|
1402 |
-
if (!($this->lastcommand == 'Q' || $this->lastcommand == 'q' || $this->lastcommand == 'T' || $this->lastcommand == 't')) {
|
1403 |
-
$this->lastcontrolpoints = array(0,0);
|
1404 |
-
}
|
1405 |
-
for($i = 0; $i<$ile_argumentow; $i += 2){
|
1406 |
-
$x = ($a[$i][0]);
|
1407 |
-
$y = ($a[$i+1][0]);
|
1408 |
-
|
1409 |
-
$x1 = $this->lastcontrolpoints[0];
|
1410 |
-
$y1 = $this->lastcontrolpoints[1];
|
1411 |
-
|
1412 |
-
if($relative){
|
1413 |
-
$pdfx = ($this->xbase + $x);
|
1414 |
-
$pdfy = ($this->ybase - $y);
|
1415 |
-
|
1416 |
-
$pdfx1 = ($this->xbase + ($x1)); // mPDF 4.4.003
|
1417 |
-
$pdfy1 = ($this->ybase - ($y1)); // mPDF 4.4.003
|
1418 |
-
// mPDF 4.4.003
|
1419 |
-
$pdfx2 = $pdfx1 + 1/3 *($x);
|
1420 |
-
$pdfy2 = $pdfy1 + 1/3 *(-$y) ;
|
1421 |
-
|
1422 |
-
$this->xbase += $x;
|
1423 |
-
$this->ybase += -$y;
|
1424 |
-
}
|
1425 |
-
else{
|
1426 |
-
$pdfx = $x;
|
1427 |
-
$pdfy = -$y;
|
1428 |
-
|
1429 |
-
$pdfx1 = ($this->xbase + ($x1)); // mPDF 4.4.003
|
1430 |
-
$pdfy1 = ($this->ybase - ($y1)); // mPDF 4.4.003
|
1431 |
-
// mPDF 4.4.003
|
1432 |
-
$pdfx2 = $pdfx1 + 1/3 *($x - $this->xbase);
|
1433 |
-
$pdfy2 = $pdfy1 + 1/3 *(-$y - $this->ybase) ;
|
1434 |
-
|
1435 |
-
$this->xbase = $x;
|
1436 |
-
$this->ybase = -$y;
|
1437 |
-
}
|
1438 |
-
|
1439 |
-
$this->lastcontrolpoints = array(($pdfx-$pdfx2),-($pdfy-$pdfy2)); // mPDF 4.4.003 always relative
|
1440 |
-
|
1441 |
-
// mPDF 5.0.040
|
1442 |
-
$curves = array($pdfx1,-$pdfy1,$pdfx2,-$pdfy2,$pdfx,-$pdfy);
|
1443 |
-
$bx = calc_bezier_bbox($start, $curves);
|
1444 |
-
$minl = min($minl,$bx[0]);
|
1445 |
-
$maxr = max($maxr,$bx[2]);
|
1446 |
-
$mint = min($mint,$bx[1]);
|
1447 |
-
$maxb = max($maxb,$bx[3]);
|
1448 |
-
|
1449 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1*$this->kp, $pdfy1*$this->kp, $pdfx2*$this->kp, $pdfy2*$this->kp, $pdfx*$this->kp, $pdfy*$this->kp);
|
1450 |
-
}
|
1451 |
-
|
1452 |
-
break;
|
1453 |
-
case 'a': // Elliptical arc
|
1454 |
-
for($i = 0; $i<$ile_argumentow; $i += 7){
|
1455 |
-
$rx = ($a[$i][0]);
|
1456 |
-
$ry = ($a[$i+1][0]);
|
1457 |
-
$angle = ($a[$i+2][0]); //x-axis-rotation
|
1458 |
-
$largeArcFlag = ($a[$i+3][0]);
|
1459 |
-
$sweepFlag = ($a[$i+4][0]);
|
1460 |
-
$x2 = ($a[$i+5][0]);
|
1461 |
-
$y2 = ($a[$i+6][0]);
|
1462 |
-
$x1 = $this->xbase;
|
1463 |
-
$y1 = -$this->ybase;
|
1464 |
-
if($relative){
|
1465 |
-
$x2 = $this->xbase + $x2;
|
1466 |
-
$y2 = -$this->ybase + $y2;
|
1467 |
-
$this->xbase += ($a[$i+5][0]);
|
1468 |
-
$this->ybase += -($a[$i+6][0]);
|
1469 |
-
}
|
1470 |
-
else{
|
1471 |
-
$this->xbase = $x2;
|
1472 |
-
$this->ybase = -$y2;
|
1473 |
-
}
|
1474 |
-
// mPDF 5.0.039 // mPDF 5.0.040
|
1475 |
-
list($pcmd, $bounds) = $this->Arcto($x1, $y1, $x2, $y2, $rx, $ry, $angle, $largeArcFlag, $sweepFlag);
|
1476 |
-
$minl = min($minl,$x2,min($bounds[0]));
|
1477 |
-
$maxr = max($maxr,$x2,max($bounds[0]));
|
1478 |
-
$mint = min($mint,$y2,min($bounds[1]));
|
1479 |
-
$maxb = max($maxb,$y2,max($bounds[1]));
|
1480 |
-
$path_cmd .= $pcmd;
|
1481 |
-
|
1482 |
-
}
|
1483 |
-
break;
|
1484 |
-
case'z':
|
1485 |
-
$path_cmd .= 'h ';
|
1486 |
-
// mPDF 4.4.003
|
1487 |
-
$this->subPathInit = true;
|
1488 |
-
$newsubpath = true;
|
1489 |
-
$this->xbase = $this->spxstart;
|
1490 |
-
$this->ybase = $this->spystart;
|
1491 |
-
break;
|
1492 |
-
default:
|
1493 |
-
break;
|
1494 |
-
}
|
1495 |
-
|
1496 |
-
if (!$newsubpath) { $this->subPathInit = false; } // mPDF 4.4.003
|
1497 |
-
$this->lastcommand = $command;
|
1498 |
-
// mPDF 5.0.039
|
1499 |
-
$this->pathBBox[0] = $minl;
|
1500 |
-
$this->pathBBox[1] = $mint;
|
1501 |
-
$this->pathBBox[2] = $maxr - $this->pathBBox[0];
|
1502 |
-
$this->pathBBox[3] = $maxb - $this->pathBBox[1];
|
1503 |
-
return $path_cmd;
|
1504 |
-
|
1505 |
-
}
|
1506 |
-
|
1507 |
-
function Arcto($x1, $y1, $x2, $y2, $rx, $ry, $angle, $largeArcFlag, $sweepFlag) {
|
1508 |
-
|
1509 |
-
// mPDF 5.0.040
|
1510 |
-
$bounds = array(0=>array($x1,$x2),1=>array($y1,$y2));
|
1511 |
-
// 1. Treat out-of-range parameters as described in
|
1512 |
-
// http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
|
1513 |
-
// If the endpoints (x1, y1) and (x2, y2) are identical, then this
|
1514 |
-
// is equivalent to omitting the elliptical arc segment entirely
|
1515 |
-
if ($x1 == $x2 && $y1 == $y2) return array('', $bounds); // mPD 5.0.040
|
1516 |
-
|
1517 |
-
// If rX = 0 or rY = 0 then this arc is treated as a straight line
|
1518 |
-
// segment (a "lineto") joining the endpoints.
|
1519 |
-
if ($rx == 0.0 || $ry == 0.0) {
|
1520 |
-
// return array(Lineto(x2, y2), $bounds); // mPD 5.0.040
|
1521 |
-
}
|
1522 |
-
|
1523 |
-
// If rX or rY have negative signs, these are dropped; the absolute
|
1524 |
-
// value is used instead.
|
1525 |
-
if ($rx<0.0) $rx = -$rx;
|
1526 |
-
if ($ry<0.0) $ry = -$ry;
|
1527 |
-
|
1528 |
-
// 2. convert to center parameterization as shown in
|
1529 |
-
// http://www.w3.org/TR/SVG/implnote.html
|
1530 |
-
$sinPhi = sin(deg2rad($angle));
|
1531 |
-
$cosPhi = cos(deg2rad($angle));
|
1532 |
-
|
1533 |
-
$x1dash = $cosPhi * ($x1-$x2)/2.0 + $sinPhi * ($y1-$y2)/2.0;
|
1534 |
-
$y1dash = -$sinPhi * ($x1-$x2)/2.0 + $cosPhi * ($y1-$y2)/2.0;
|
1535 |
-
|
1536 |
-
|
1537 |
-
$numerator = $rx*$rx*$ry*$ry - $rx*$rx*$y1dash*$y1dash - $ry*$ry*$x1dash*$x1dash;
|
1538 |
-
|
1539 |
-
if ($numerator < 0.0) {
|
1540 |
-
// If rX , rY and are such that there is no solution (basically,
|
1541 |
-
// the ellipse is not big enough to reach from (x1, y1) to (x2,
|
1542 |
-
// y2)) then the ellipse is scaled up uniformly until there is
|
1543 |
-
// exactly one solution (until the ellipse is just big enough).
|
1544 |
-
|
1545 |
-
// -> find factor s, such that numerator' with rx'=s*rx and
|
1546 |
-
// ry'=s*ry becomes 0 :
|
1547 |
-
$s = sqrt(1.0 - $numerator/($rx*$rx*$ry*$ry));
|
1548 |
-
|
1549 |
-
$rx *= $s;
|
1550 |
-
$ry *= $s;
|
1551 |
-
$root = 0.0;
|
1552 |
-
|
1553 |
-
}
|
1554 |
-
else {
|
1555 |
-
$root = ($largeArcFlag == $sweepFlag ? -1.0 : 1.0) * sqrt( $numerator/($rx*$rx*$y1dash*$y1dash+$ry*$ry*$x1dash*$x1dash) );
|
1556 |
-
}
|
1557 |
-
|
1558 |
-
$cxdash = $root*$rx*$y1dash/$ry;
|
1559 |
-
$cydash = -$root*$ry*$x1dash/$rx;
|
1560 |
-
|
1561 |
-
$cx = $cosPhi * $cxdash - $sinPhi * $cydash + ($x1+$x2)/2.0;
|
1562 |
-
$cy = $sinPhi * $cxdash + $cosPhi * $cydash + ($y1+$y2)/2.0;
|
1563 |
-
|
1564 |
-
|
1565 |
-
$theta1 = $this->CalcVectorAngle(1.0, 0.0, ($x1dash-$cxdash)/$rx, ($y1dash-$cydash)/$ry);
|
1566 |
-
$dtheta = $this->CalcVectorAngle(($x1dash-$cxdash)/$rx, ($y1dash-$cydash)/$ry, (-$x1dash-$cxdash)/$rx, (-$y1dash-$cydash)/$ry);
|
1567 |
-
if (!$sweepFlag && $dtheta>0)
|
1568 |
-
$dtheta -= 2.0*M_PI;
|
1569 |
-
else if ($sweepFlag && $dtheta<0)
|
1570 |
-
$dtheta += 2.0*M_PI;
|
1571 |
-
|
1572 |
-
// 3. convert into cubic bezier segments <= 90deg
|
1573 |
-
$segments = ceil(abs($dtheta/(M_PI/2.0)));
|
1574 |
-
$delta = $dtheta/$segments;
|
1575 |
-
$t = 8.0/3.0 * sin($delta/4.0) * sin($delta/4.0) / sin($delta/2.0);
|
1576 |
-
$coords = array();
|
1577 |
-
for ($i = 0; $i < $segments; $i++) {
|
1578 |
-
$cosTheta1 = cos($theta1);
|
1579 |
-
$sinTheta1 = sin($theta1);
|
1580 |
-
$theta2 = $theta1 + $delta;
|
1581 |
-
$cosTheta2 = cos($theta2);
|
1582 |
-
$sinTheta2 = sin($theta2);
|
1583 |
-
|
1584 |
-
// a) calculate endpoint of the segment:
|
1585 |
-
$xe = $cosPhi * $rx*$cosTheta2 - $sinPhi * $ry*$sinTheta2 + $cx;
|
1586 |
-
$ye = $sinPhi * $rx*$cosTheta2 + $cosPhi * $ry*$sinTheta2 + $cy;
|
1587 |
-
|
1588 |
-
// b) calculate gradients at start/end points of segment:
|
1589 |
-
$dx1 = $t * ( - $cosPhi * $rx*$sinTheta1 - $sinPhi * $ry*$cosTheta1);
|
1590 |
-
$dy1 = $t * ( - $sinPhi * $rx*$sinTheta1 + $cosPhi * $ry*$cosTheta1);
|
1591 |
-
|
1592 |
-
$dxe = $t * ( $cosPhi * $rx*$sinTheta2 + $sinPhi * $ry*$cosTheta2);
|
1593 |
-
$dye = $t * ( $sinPhi * $rx*$sinTheta2 - $cosPhi * $ry*$cosTheta2);
|
1594 |
-
|
1595 |
-
// c) draw the cubic bezier:
|
1596 |
-
$coords[$i] = array(($x1+$dx1), ($y1+$dy1), ($xe+$dxe), ($ye+$dye), $xe, $ye);
|
1597 |
-
|
1598 |
-
// do next segment
|
1599 |
-
$theta1 = $theta2;
|
1600 |
-
$x1 = $xe;
|
1601 |
-
$y1 = $ye;
|
1602 |
-
}
|
1603 |
-
$path = ' ';
|
1604 |
-
foreach($coords AS $c) {
|
1605 |
-
$cpx1 = $c[0];
|
1606 |
-
$cpy1 = $c[1];
|
1607 |
-
$cpx2 = $c[2];
|
1608 |
-
$cpy2 = $c[3];
|
1609 |
-
$x2 = $c[4];
|
1610 |
-
$y2 = $c[5];
|
1611 |
-
$path .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $cpx1*$this->kp, -$cpy1*$this->kp, $cpx2*$this->kp, -$cpy2*$this->kp, $x2*$this->kp, -$y2*$this->kp) ."\n";
|
1612 |
-
|
1613 |
-
// mPDF 5.0.040
|
1614 |
-
$bounds[0][] = $c[4];
|
1615 |
-
$bounds[1][] = $c[5];
|
1616 |
-
}
|
1617 |
-
return array($path, $bounds); // mPD 5.0.040
|
1618 |
-
}
|
1619 |
-
|
1620 |
-
|
1621 |
-
function CalcVectorAngle($ux, $uy, $vx, $vy) {
|
1622 |
-
$ta = atan2($uy, $ux);
|
1623 |
-
$tb = atan2($vy, $vx);
|
1624 |
-
if ($tb >= $ta)
|
1625 |
-
return ($tb-$ta);
|
1626 |
-
return (6.28318530718 - ($ta-$tb));
|
1627 |
-
}
|
1628 |
-
|
1629 |
-
|
1630 |
-
// mPDF 4.4.003
|
1631 |
-
function ConvertSVGSizePixels($size=5,$maxsize='x'){
|
1632 |
-
// maxsize in pixels (user units) or 'y' or 'x'
|
1633 |
-
// e.g. $w = $this->ConvertSVGSizePixels($arguments['w'],$this->svg_info['w']*(25.4/$this->mpdf_ref->dpi));
|
1634 |
-
// usefontsize - setfalse for e.g. margins - will ignore fontsize for % values
|
1635 |
-
// Depends of maxsize value to make % work properly. Usually maxsize == pagewidth
|
1636 |
-
// For text $maxsize = Fontsize
|
1637 |
-
// Setting e.g. margin % will use maxsize (pagewidth) and em will use fontsize
|
1638 |
-
|
1639 |
-
if ($maxsize == 'y') { $maxsize = $this->svg_info['h']; }
|
1640 |
-
else if ($maxsize == 'x') { $maxsize = $this->svg_info['w']; }
|
1641 |
-
$maxsize *= (25.4/$this->mpdf_ref->dpi); // convert pixels to mm
|
1642 |
-
$fontsize=$this->mpdf_ref->FontSize;
|
1643 |
-
//Return as pixels
|
1644 |
-
$size = $this->mpdf_ref->ConvertSize($size,$maxsize,$fontsize,false) * 1/(25.4/$this->mpdf_ref->dpi);
|
1645 |
-
return $size;
|
1646 |
-
}
|
1647 |
-
|
1648 |
-
// mPDF 4.4.003
|
1649 |
-
function ConvertSVGSizePts($size=5){
|
1650 |
-
// usefontsize - setfalse for e.g. margins - will ignore fontsize for % values
|
1651 |
-
// Depends of maxsize value to make % work properly. Usually maxsize == pagewidth
|
1652 |
-
// For text $maxsize = Fontsize
|
1653 |
-
// Setting e.g. margin % will use maxsize (pagewidth) and em will use fontsize
|
1654 |
-
$maxsize=$this->mpdf_ref->FontSize;
|
1655 |
-
//Return as pts
|
1656 |
-
$size = $this->mpdf_ref->ConvertSize($size,$maxsize,false,true) * 72/25.4;
|
1657 |
-
return $size;
|
1658 |
-
}
|
1659 |
-
|
1660 |
-
|
1661 |
-
//
|
1662 |
-
// fonction retracant les <rect />
|
1663 |
-
function svgRect($arguments){
|
1664 |
-
|
1665 |
-
if ($arguments['h']==0 || $arguments['w']==0) { return ''; } // mPDF 4.4.003
|
1666 |
-
|
1667 |
-
$x = $this->ConvertSVGSizePixels($arguments['x'],'x'); // mPDF 4.4.003
|
1668 |
-
$y = $this->ConvertSVGSizePixels($arguments['y'],'y'); // mPDF 4.4.003
|
1669 |
-
$h = $this->ConvertSVGSizePixels($arguments['h'],'y'); // mPDF 4.4.003
|
1670 |
-
$w = $this->ConvertSVGSizePixels($arguments['w'],'x'); // mPDF 4.4.003
|
1671 |
-
$rx = $this->ConvertSVGSizePixels($arguments['rx'],'x'); // mPDF 4.4.003
|
1672 |
-
$ry = $this->ConvertSVGSizePixels($arguments['ry'],'y'); // mPDF 4.4.003
|
1673 |
-
|
1674 |
-
if ($rx > $w/2) { $rx = $w/2; } // mPDF 4.4.003
|
1675 |
-
if ($ry > $h/2) { $ry = $h/2; } // mPDF 4.4.003
|
1676 |
-
|
1677 |
-
if ($rx>0 and $ry == 0){$ry = $rx;}
|
1678 |
-
if ($ry>0 and $rx == 0){$rx = $ry;}
|
1679 |
-
|
1680 |
-
if ($rx == 0 and $ry == 0){
|
1681 |
-
// trace un rectangle sans angle arrondit
|
1682 |
-
$path_cmd = sprintf('%.3F %.3F m ', ($x*$this->kp), -($y*$this->kp));
|
1683 |
-
$path_cmd .= sprintf('%.3F %.3F l ', (($x+$w)*$this->kp), -($y*$this->kp));
|
1684 |
-
$path_cmd .= sprintf('%.3F %.3F l ', (($x+$w)*$this->kp), -(($y+$h)*$this->kp));
|
1685 |
-
$path_cmd .= sprintf('%.3F %.3F l ', ($x)*$this->kp, -(($y+$h)*$this->kp));
|
1686 |
-
$path_cmd .= sprintf('%.3F %.3F l h ', ($x*$this->kp), -($y*$this->kp));
|
1687 |
-
|
1688 |
-
|
1689 |
-
}
|
1690 |
-
else {
|
1691 |
-
// trace un rectangle avec les arrondit
|
1692 |
-
// les points de controle du bezier sont deduis grace a la constante kappa
|
1693 |
-
$kappa = 4*(sqrt(2)-1)/3;
|
1694 |
-
|
1695 |
-
$kx = $kappa*$rx;
|
1696 |
-
$ky = $kappa*$ry;
|
1697 |
-
|
1698 |
-
$path_cmd = sprintf('%.3F %.3F m ', ($x+$rx)*$this->kp, -$y*$this->kp);
|
1699 |
-
$path_cmd .= sprintf('%.3F %.3F l ', ($x+($w-$rx))*$this->kp, -$y*$this->kp);
|
1700 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x+($w-$rx+$kx))*$this->kp, -$y*$this->kp, ($x+$w)*$this->kp, (-$y+(-$ry+$ky))*$this->kp, ($x+$w)*$this->kp, (-$y+(-$ry))*$this->kp );
|
1701 |
-
$path_cmd .= sprintf('%.3F %.3F l ', ($x+$w)*$this->kp, (-$y+(-$h+$ry))*$this->kp);
|
1702 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x+$w)*$this->kp, (-$y+(-$h-$ky+$ry))*$this->kp, ($x+($w-$rx+$kx))*$this->kp, (-$y+(-$h))*$this->kp, ($x+($w-$rx))*$this->kp, (-$y+(-$h))*$this->kp );
|
1703 |
-
|
1704 |
-
$path_cmd .= sprintf('%.3F %.3F l ', ($x+$rx)*$this->kp, (-$y+(-$h))*$this->kp);
|
1705 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x+($rx-$kx))*$this->kp, (-$y+(-$h))*$this->kp, $x*$this->kp, (-$y+(-$h-$ky+$ry))*$this->kp, $x*$this->kp, (-$y+(-$h+$ry))*$this->kp );
|
1706 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $x*$this->kp, (-$y+(-$ry))*$this->kp);
|
1707 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c h ', $x*$this->kp, (-$y+(-$ry+$ky))*$this->kp, ($x+($rx-$kx))*$this->kp, -$y*$this->kp, ($x+$rx)*$this->kp, -$y*$this->kp );
|
1708 |
-
|
1709 |
-
|
1710 |
-
}
|
1711 |
-
return $path_cmd;
|
1712 |
-
}
|
1713 |
-
|
1714 |
-
//
|
1715 |
-
// fonction retracant les <ellipse /> et <circle />
|
1716 |
-
// le cercle est trac� grave a 4 bezier cubic, les poitn de controles
|
1717 |
-
// sont deduis grace a la constante kappa * rayon
|
1718 |
-
function svgEllipse($arguments){
|
1719 |
-
if ($arguments['rx']==0 || $arguments['ry']==0) { return ''; } // mPDF 4.4.003
|
1720 |
-
|
1721 |
-
$kappa = 4*(sqrt(2)-1)/3;
|
1722 |
-
|
1723 |
-
$cx = $this->ConvertSVGSizePixels($arguments['cx'],'x'); // mPDF 4.4.003
|
1724 |
-
$cy = $this->ConvertSVGSizePixels($arguments['cy'],'y'); // mPDF 4.4.003
|
1725 |
-
$rx = $this->ConvertSVGSizePixels($arguments['rx'],'x'); // mPDF 4.4.003
|
1726 |
-
$ry = $this->ConvertSVGSizePixels($arguments['ry'],'y'); // mPDF 4.4.003
|
1727 |
-
|
1728 |
-
$x1 = $cx;
|
1729 |
-
$y1 = -$cy+$ry;
|
1730 |
-
|
1731 |
-
$x2 = $cx+$rx;
|
1732 |
-
$y2 = -$cy;
|
1733 |
-
|
1734 |
-
$x3 = $cx;
|
1735 |
-
$y3 = -$cy-$ry;
|
1736 |
-
|
1737 |
-
$x4 = $cx-$rx;
|
1738 |
-
$y4 = -$cy;
|
1739 |
-
|
1740 |
-
$path_cmd = sprintf('%.3F %.3F m ', $x1*$this->kp, $y1*$this->kp);
|
1741 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x1+($rx*$kappa))*$this->kp, $y1*$this->kp, $x2*$this->kp, ($y2+($ry*$kappa))*$this->kp, $x2*$this->kp, $y2*$this->kp);
|
1742 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $x2*$this->kp, ($y2-($ry*$kappa))*$this->kp, ($x3+($rx*$kappa))*$this->kp, $y3*$this->kp, $x3*$this->kp, $y3*$this->kp);
|
1743 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x3-($rx*$kappa))*$this->kp, $y3*$this->kp, $x4*$this->kp, ($y4-($ry*$kappa))*$this->kp, $x4*$this->kp, $y4*$this->kp);
|
1744 |
-
$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $x4*$this->kp, ($y4+($ry*$kappa))*$this->kp, ($x1-($rx*$kappa))*$this->kp, $y1*$this->kp, $x1*$this->kp, $y1*$this->kp);
|
1745 |
-
$path_cmd .= 'h ';
|
1746 |
-
|
1747 |
-
return $path_cmd;
|
1748 |
-
|
1749 |
-
}
|
1750 |
-
|
1751 |
-
//
|
1752 |
-
// fonction retracant les <polyline /> et les <line />
|
1753 |
-
function svgPolyline($arguments,$ispolyline=true){
|
1754 |
-
if ($ispolyline) {
|
1755 |
-
$xbase = $arguments[0] ;
|
1756 |
-
$ybase = - $arguments[1] ;
|
1757 |
-
}
|
1758 |
-
else {
|
1759 |
-
if ($arguments[0]==$arguments[2] && $arguments[1]==$arguments[3]) { return ''; } // mPDF 4.4.003 Zero length line
|
1760 |
-
$xbase = $this->ConvertSVGSizePixels($arguments[0],'x'); // mPDF 4.4.003
|
1761 |
-
$ybase = - $this->ConvertSVGSizePixels($arguments[1],'y'); // mPDF 4.4.003
|
1762 |
-
}
|
1763 |
-
$path_cmd = sprintf('%.3F %.3F m ', $xbase*$this->kp, $ybase*$this->kp);
|
1764 |
-
for ($i = 2; $i<count($arguments);$i += 2) {
|
1765 |
-
if ($ispolyline) {
|
1766 |
-
$tmp_x = $arguments[$i] ;
|
1767 |
-
$tmp_y = - $arguments[($i+1)] ;
|
1768 |
-
}
|
1769 |
-
else {
|
1770 |
-
$tmp_x = $this->ConvertSVGSizePixels($arguments[$i],'x') ; // mPDF 4.4.003
|
1771 |
-
$tmp_y = - $this->ConvertSVGSizePixels($arguments[($i+1)],'y') ; // mPDF 4.4.003
|
1772 |
-
}
|
1773 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $tmp_x*$this->kp, $tmp_y*$this->kp);
|
1774 |
-
}
|
1775 |
-
|
1776 |
-
// $path_cmd .= 'h '; // ?? In error - don't close subpath here
|
1777 |
-
return $path_cmd;
|
1778 |
-
|
1779 |
-
}
|
1780 |
-
|
1781 |
-
//
|
1782 |
-
// fonction retracant les <polygone />
|
1783 |
-
function svgPolygon($arguments){
|
1784 |
-
$xbase = $arguments[0] ;
|
1785 |
-
$ybase = - $arguments[1] ;
|
1786 |
-
$path_cmd = sprintf('%.3F %.3F m ', $xbase*$this->kp, $ybase*$this->kp);
|
1787 |
-
for ($i = 2; $i<count($arguments);$i += 2) {
|
1788 |
-
$tmp_x = $arguments[$i] ;
|
1789 |
-
$tmp_y = - $arguments[($i+1)] ;
|
1790 |
-
|
1791 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $tmp_x*$this->kp, $tmp_y*$this->kp);
|
1792 |
-
|
1793 |
-
}
|
1794 |
-
$path_cmd .= sprintf('%.3F %.3F l ', $xbase*$this->kp, $ybase*$this->kp);
|
1795 |
-
$path_cmd .= 'h ';
|
1796 |
-
return $path_cmd;
|
1797 |
-
|
1798 |
-
}
|
1799 |
-
|
1800 |
-
//
|
1801 |
-
// write string to image
|
1802 |
-
function svgText() {
|
1803 |
-
// $tmp = count($this->txt_style)-1;
|
1804 |
-
$current_style = array_pop($this->txt_style);
|
1805 |
-
$style = '';
|
1806 |
-
$render = -1;
|
1807 |
-
if(isset($this->txt_data[2]))
|
1808 |
-
{
|
1809 |
-
// select font
|
1810 |
-
$style .= ($current_style['font-weight'] == 'bold')?'B':'';
|
1811 |
-
$style .= ($current_style['font-style'] == 'italic')?'I':'';
|
1812 |
-
$size = $current_style['font-size']*$this->kf; // mPDF 5.0.039
|
1813 |
-
|
1814 |
-
// mPDF 5.0
|
1815 |
-
$current_style['font-family'] = $this->mpdf_ref->SetFont($current_style['font-family'],$style,$size,false);
|
1816 |
-
$this->mpdf_ref->CurrentFont['fo'] = true; // mPDF 5.0.039
|
1817 |
-
|
1818 |
-
|
1819 |
-
// mPDF 5.0.041
|
1820 |
-
$opacitystr = '';
|
1821 |
-
$opacity = 1;
|
1822 |
-
if (isset($current_style['fill-opacity'])) {
|
1823 |
-
if ($current_style['fill-opacity'] == 0) { $opacity = 0; }
|
1824 |
-
else if ($current_style['fill-opacity'] > 1) { $opacity = 1; }
|
1825 |
-
else if ($current_style['fill-opacity'] > 0) { $opacity = $current_style['fill-opacity']; }
|
1826 |
-
else if ($current_style['fill-opacity'] < 0) { $opacity = 0; }
|
1827 |
-
}
|
1828 |
-
$gs = $this->mpdf_ref->AddExtGState(array('ca'=>$opacity, 'BM'=>'/Normal'));
|
1829 |
-
$this->mpdf_ref->extgstates[$gs]['fo'] = true; // mPDF 5.0.039
|
1830 |
-
$opacitystr = sprintf(' /GS%d gs ', $gs);
|
1831 |
-
|
1832 |
-
// mPDF 5.0.051
|
1833 |
-
$fillstr = '';
|
1834 |
-
if (isset($current_style['fill']) && $current_style['fill']!='none') {
|
1835 |
-
$col = $this->mpdf_ref->ConvertColor($current_style['fill']);
|
1836 |
-
// mPDF 5.0.051
|
1837 |
-
$fillstr = $this->mpdf_ref->SetFColor($col, true);
|
1838 |
-
$render = "0"; // Fill (only)
|
1839 |
-
}
|
1840 |
-
$strokestr = '';
|
1841 |
-
if (isset($current_style['stroke-width']) && $current_style['stroke-width']>0 && $current_style['stroke']!='none') {
|
1842 |
-
$scol = $this->mpdf_ref->ConvertColor($current_style['stroke']);
|
1843 |
-
if ($scol) {
|
1844 |
-
$strokestr .= $this->mpdf_ref->SetDColor($scol, true).' '; // mPDF 5.0.051
|
1845 |
-
}
|
1846 |
-
$linewidth = $this->ConvertSVGSizePixels($current_style['stroke-width']);
|
1847 |
-
if ($linewidth > 0) {
|
1848 |
-
$strokestr .= sprintf('%.3F w 1 J 1 j ',$linewidth*$this->kp);
|
1849 |
-
if ($render == -1) { $render = "1"; } // stroke only
|
1850 |
-
else { $render = "2"; } // fill and stroke
|
1851 |
-
}
|
1852 |
-
}
|
1853 |
-
if ($render == -1) { return ''; }
|
1854 |
-
|
1855 |
-
$x = $this->ConvertSVGSizePixels($this->txt_data[0],'x'); // mPDF 4.4.003
|
1856 |
-
$y = $this->ConvertSVGSizePixels($this->txt_data[1],'y'); // mPDF 4.4.003
|
1857 |
-
$txt = $this->txt_data[2];
|
1858 |
-
|
1859 |
-
// mPDF 4.4.003
|
1860 |
-
$txt = preg_replace('/\f/','',$txt);
|
1861 |
-
$txt = preg_replace('/\r/','',$txt);
|
1862 |
-
$txt = preg_replace('/\n/',' ',$txt);
|
1863 |
-
$txt = preg_replace('/\t/',' ',$txt);
|
1864 |
-
$txt = preg_replace("/[ ]+/u",' ',$txt);
|
1865 |
-
|
1866 |
-
$txt = trim($txt);
|
1867 |
-
|
1868 |
-
$txt = $this->mpdf_ref->purify_utf8_text($txt);
|
1869 |
-
if ($this->mpdf_ref->text_input_as_HTML) {
|
1870 |
-
$txt = $this->mpdf_ref->all_entities_to_utf8($txt);
|
1871 |
-
}
|
1872 |
-
|
1873 |
-
// mPDF 5.0
|
1874 |
-
if ($this->mpdf_ref->usingCoreFont) { $txt = mb_convert_encoding($txt,$this->mpdf_ref->mb_enc,'UTF-8'); }
|
1875 |
-
if (preg_match("/([".$this->mpdf_ref->pregRTLchars."])/u", $txt)) { $this->mpdf_ref->biDirectional = true; } // mPDF 4.4.003
|
1876 |
-
|
1877 |
-
$this->mpdf_ref->magic_reverse_dir($txt, true, 'ltr'); // mPDF 5.0.054
|
1878 |
-
$this->mpdf_ref->ConvertIndic($txt);
|
1879 |
-
|
1880 |
-
|
1881 |
-
if ($current_style['text-anchor']=='middle') {
|
1882 |
-
$tw = $this->mpdf_ref->GetStringWidth($txt)*_MPDFK/2; // mPDF 4.4.003 // mPDF 5.4.09
|
1883 |
-
}
|
1884 |
-
else if ($current_style['text-anchor']=='end') {
|
1885 |
-
$tw = $this->mpdf_ref->GetStringWidth($txt)*_MPDFK; // mPDF 4.4.003 // mPDF 5.4.09
|
1886 |
-
}
|
1887 |
-
else $tw = 0;
|
1888 |
-
|
1889 |
-
if (!$this->mpdf_ref->usingCoreFont) {
|
1890 |
-
$this->mpdf_ref->UTF8StringToArray($txt); // mPDF 5.0 adds chars to subset list
|
1891 |
-
$txt= $this->mpdf_ref->UTF8ToUTF16BE($txt, false);
|
1892 |
-
}
|
1893 |
-
$txt='('.$this->mpdf_ref->_escape($txt).')';
|
1894 |
-
$this->mpdf_ref->CurrentFont['used']= true;
|
1895 |
-
|
1896 |
-
$pdfx = $x - $tw/$this->kp; // mPDF 4.4.009
|
1897 |
-
$pdfy = -$y ;
|
1898 |
-
$xbase = $x;
|
1899 |
-
$ybase = -$y;
|
1900 |
-
|
1901 |
-
// mPDF 5.0.041
|
1902 |
-
// mPDF 5.0.051
|
1903 |
-
$path_cmd = sprintf('q BT /F%d %s %.3F Tf %.3F %.3F Td %s Tr %s %s %s Tj ET Q ',$this->mpdf_ref->CurrentFont['i'],$opacitystr, $this->mpdf_ref->FontSizePt,$pdfx*$this->kp,$pdfy*$this->kp,$render,$fillstr,$strokestr,$txt)."\n";
|
1904 |
-
unset($this->txt_data[0], $this->txt_data[1],$this->txt_data[2]);
|
1905 |
-
|
1906 |
-
// mPDF 5.4.12
|
1907 |
-
if (isset($current_style['font-size-parent'])) {
|
1908 |
-
$this->mpdf_ref->SetFontSize($current_style['font-size-parent']);
|
1909 |
-
}
|
1910 |
-
}
|
1911 |
-
else
|
1912 |
-
{
|
1913 |
-
return ' ';
|
1914 |
-
}
|
1915 |
-
// $path_cmd .= 'h '; // mPDF 5.0
|
1916 |
-
return $path_cmd;
|
1917 |
-
}
|
1918 |
-
|
1919 |
-
|
1920 |
-
function svgDefineTxtStyle($critere_style)
|
1921 |
-
{
|
1922 |
-
// get copy of current/default txt style, and modify it with supplied attributes
|
1923 |
-
$tmp = count($this->txt_style)-1;
|
1924 |
-
$current_style = $this->txt_style[$tmp];
|
1925 |
-
if (isset($critere_style['style'])){
|
1926 |
-
if (preg_match('/fill:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/',$critere_style['style'], $m)) {
|
1927 |
-
$current_style['fill'] = '#'.str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
|
1928 |
-
}
|
1929 |
-
else { $tmp = preg_replace("/(.*)fill:\s*([a-z0-9#_()]*|none)(.*)/i","$2",$critere_style['style']);
|
1930 |
-
if ($tmp != $critere_style['style']){ $current_style['fill'] = $tmp; }
|
1931 |
-
}
|
1932 |
-
|
1933 |
-
$tmp = preg_replace("/(.*)fill-opacity:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1934 |
-
if ($tmp != $critere_style['style']){ $current_style['fill-opacity'] = $tmp;}
|
1935 |
-
|
1936 |
-
$tmp = preg_replace("/(.*)fill-rule:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
1937 |
-
if ($tmp != $critere_style['style']){ $current_style['fill-rule'] = $tmp;}
|
1938 |
-
|
1939 |
-
if (preg_match('/stroke:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/',$critere_style['style'], $m)) {
|
1940 |
-
$current_style['stroke'] = '#'.str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
|
1941 |
-
}
|
1942 |
-
else { $tmp = preg_replace("/(.*)stroke:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
1943 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke'] = $tmp; }
|
1944 |
-
}
|
1945 |
-
|
1946 |
-
$tmp = preg_replace("/(.*)stroke-linecap:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
1947 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-linecap'] = $tmp;}
|
1948 |
-
|
1949 |
-
$tmp = preg_replace("/(.*)stroke-linejoin:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
1950 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-linejoin'] = $tmp;}
|
1951 |
-
|
1952 |
-
$tmp = preg_replace("/(.*)stroke-miterlimit:\s*([a-z0-9#]*|none)(.*)/i","$2",$critere_style['style']);
|
1953 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-miterlimit'] = $tmp;}
|
1954 |
-
|
1955 |
-
$tmp = preg_replace("/(.*)stroke-opacity:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1956 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-opacity'] = $tmp; }
|
1957 |
-
|
1958 |
-
$tmp = preg_replace("/(.*)stroke-width:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1959 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-width'] = $tmp;}
|
1960 |
-
|
1961 |
-
$tmp = preg_replace("/(.*)stroke-dasharray:\s*([a-z0-9., ]*|none)(.*)/i","$2",$critere_style['style']);
|
1962 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-dasharray'] = $tmp;}
|
1963 |
-
|
1964 |
-
$tmp = preg_replace("/(.*)stroke-dashoffset:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1965 |
-
if ($tmp != $critere_style['style']){ $current_style['stroke-dashoffset'] = $tmp;}
|
1966 |
-
|
1967 |
-
// mPDF 5.0.039
|
1968 |
-
$tmp = preg_replace("/(.*)font-family:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1969 |
-
if ($tmp != $critere_style['style']){ $critere_style['font-family'] = $tmp;}
|
1970 |
-
|
1971 |
-
$tmp = preg_replace("/(.*)font-size:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1972 |
-
if ($tmp != $critere_style['style']){ $critere_style['font-size'] = $tmp;}
|
1973 |
-
|
1974 |
-
$tmp = preg_replace("/(.*)font-weight:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1975 |
-
if ($tmp != $critere_style['style']){ $critere_style['font-weight'] = $tmp;}
|
1976 |
-
|
1977 |
-
$tmp = preg_replace("/(.*)font-style:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
1978 |
-
if ($tmp != $critere_style['style']){ $critere_style['font-style'] = $tmp;}
|
1979 |
-
|
1980 |
-
}
|
1981 |
-
|
1982 |
-
if (isset($critere_style['font'])){
|
1983 |
-
|
1984 |
-
// [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]?<'font-size'> [ / <'line-height'> ]? <'font-family'> ]
|
1985 |
-
|
1986 |
-
$tmp = preg_replace("/(.*)(italic|oblique)(.*)/i","$2",$critere_style['font']);
|
1987 |
-
if ($tmp != $critere_style['font']){
|
1988 |
-
if($tmp == 'oblique'){
|
1989 |
-
$tmp = 'italic';
|
1990 |
-
}
|
1991 |
-
$current_style['font-style'] = $tmp;
|
1992 |
-
}
|
1993 |
-
$tmp = preg_replace("/(.*)(bold|bolder)(.*)/i","$2",$critere_style['font']);
|
1994 |
-
if ($tmp != $critere_style['font']){
|
1995 |
-
if($tmp == 'bolder'){
|
1996 |
-
$tmp = 'bold';
|
1997 |
-
}
|
1998 |
-
$current_style['font-weight'] = $tmp;
|
1999 |
-
}
|
2000 |
-
|
2001 |
-
// select digits not followed by percent sign nor preceeded by forward slash
|
2002 |
-
$tmp = preg_replace("/(.*)\b(\d+)[\b|\/](.*)/i","$2",$critere_style['font']);
|
2003 |
-
if ($tmp != $critere_style['font']){
|
2004 |
-
$current_style['font-size'] = $this->ConvertSVGSizePts($tmp);
|
2005 |
-
$this->mpdf_ref->SetFont('','',$current_style['font-size'],false);
|
2006 |
-
}
|
2007 |
-
|
2008 |
-
}
|
2009 |
-
|
2010 |
-
if(isset($critere_style['fill'])){
|
2011 |
-
$current_style['fill'] = $critere_style['fill'];
|
2012 |
-
}
|
2013 |
-
if(isset($critere_style['stroke'])){
|
2014 |
-
$current_style['stroke'] = $critere_style['stroke'];
|
2015 |
-
}
|
2016 |
-
if(isset($critere_style['stroke-width'])){
|
2017 |
-
$current_style['stroke-width'] = $critere_style['stroke-width'];
|
2018 |
-
}
|
2019 |
-
|
2020 |
-
if(isset($critere_style['font-style'])){
|
2021 |
-
if(strtolower($critere_style['font-style']) == 'oblique')
|
2022 |
-
{
|
2023 |
-
$critere_style['font-style'] = 'italic';
|
2024 |
-
}
|
2025 |
-
$current_style['font-style'] = $critere_style['font-style'];
|
2026 |
-
}
|
2027 |
-
|
2028 |
-
if(isset($critere_style['font-weight'])){
|
2029 |
-
if(strtolower($critere_style['font-weight']) == 'bolder')
|
2030 |
-
{
|
2031 |
-
$critere_style['font-weight'] = 'bold';
|
2032 |
-
}
|
2033 |
-
$current_style['font-weight'] = $critere_style['font-weight'];
|
2034 |
-
}
|
2035 |
-
|
2036 |
-
if(isset($critere_style['font-size'])){
|
2037 |
-
// mPDF 5.4.12
|
2038 |
-
if (strpos($critere_style['font-size'], '%')!==false) {
|
2039 |
-
$current_style['font-size-parent'] = $current_style['font-size'];
|
2040 |
-
}
|
2041 |
-
$current_style['font-size'] = $this->ConvertSVGSizePts($critere_style['font-size']);
|
2042 |
-
$this->mpdf_ref->SetFont('','',$current_style['font-size'],false);
|
2043 |
-
}
|
2044 |
-
|
2045 |
-
if(isset($critere_style['font-family'])){
|
2046 |
-
$v = $critere_style['font-family'];
|
2047 |
-
$aux_fontlist = explode(",",$v);
|
2048 |
-
$found = 0;
|
2049 |
-
foreach($aux_fontlist AS $f) {
|
2050 |
-
$fonttype = trim($f);
|
2051 |
-
$fonttype = preg_replace('/["\']*(.*?)["\']*/','\\1',$fonttype);
|
2052 |
-
$fonttype = preg_replace('/ /','',$fonttype);
|
2053 |
-
$v = strtolower(trim($fonttype));
|
2054 |
-
if (isset($this->mpdf_ref->fonttrans[$v]) && $this->mpdf_ref->fonttrans[$v]) { $v = $this->mpdf_ref->fonttrans[$v]; }
|
2055 |
-
if ((!$this->mpdf_ref->usingCoreFont && in_array($v,$this->mpdf_ref->available_unifonts)) ||
|
2056 |
-
($this->mpdf_ref->usingCoreFont && in_array($v,array('courier','times','helvetica','arial'))) ||
|
2057 |
-
in_array($v, array('sjis','uhc','big5','gb'))) {
|
2058 |
-
$current_style['font-family'] = $v;
|
2059 |
-
$found = 1;
|
2060 |
-
break;
|
2061 |
-
}
|
2062 |
-
}
|
2063 |
-
if (!$found) {
|
2064 |
-
foreach($aux_fontlist AS $f) {
|
2065 |
-
$fonttype = trim($f);
|
2066 |
-
$fonttype = preg_replace('/["\']*(.*?)["\']*/','\\1',$fonttype);
|
2067 |
-
$fonttype = preg_replace('/ /','',$fonttype);
|
2068 |
-
$v = strtolower(trim($fonttype));
|
2069 |
-
if (isset($this->mpdf_ref->fonttrans[$v]) && $this->mpdf_ref->fonttrans[$v]) { $v = $this->mpdf_ref->fonttrans[$v]; }
|
2070 |
-
if (in_array($v,$this->mpdf_ref->sans_fonts) || in_array($v,$this->mpdf_ref->serif_fonts) || in_array($v,$this->mpdf_ref->mono_fonts) ) {
|
2071 |
-
$current_style['font-family'] = $v;
|
2072 |
-
break;
|
2073 |
-
}
|
2074 |
-
}
|
2075 |
-
}
|
2076 |
-
}
|
2077 |
-
|
2078 |
-
if(isset($critere_style['text-anchor'])){
|
2079 |
-
$current_style['text-anchor'] = $critere_style['text-anchor'];
|
2080 |
-
}
|
2081 |
-
|
2082 |
-
// add current style to text style array (will remove it later after writing text to svg_string)
|
2083 |
-
array_push($this->txt_style,$current_style);
|
2084 |
-
}
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
//
|
2089 |
-
// fonction ajoutant un gradient
|
2090 |
-
function svgAddGradient($id,$array_gradient){
|
2091 |
-
|
2092 |
-
$this->svg_gradient[$id] = $array_gradient;
|
2093 |
-
|
2094 |
-
}
|
2095 |
-
//
|
2096 |
-
// Ajoute une couleur dans le gradient correspondant
|
2097 |
-
|
2098 |
-
//
|
2099 |
-
// function ecrivant dans le svgstring
|
2100 |
-
function svgWriteString($content){
|
2101 |
-
|
2102 |
-
$this->svg_string .= $content;
|
2103 |
-
|
2104 |
-
}
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
// analise le svg et renvoie aux fonctions precedente our le traitement
|
2109 |
-
function ImageSVG($data){
|
2110 |
-
$this->svg_info = array();
|
2111 |
-
|
2112 |
-
// mPDF 4.4.006
|
2113 |
-
if (preg_match('/<!ENTITY/si',$data)) {
|
2114 |
-
// Get User-defined entities
|
2115 |
-
preg_match_all('/<!ENTITY\s+([a-z]+)\s+\"(.*?)\">/si',$data, $ent);
|
2116 |
-
// Replace entities
|
2117 |
-
for ($i=0; $i<count($ent[0]); $i++) {
|
2118 |
-
$data = preg_replace('/&'.preg_quote($ent[1][$i],'/').';/is', $ent[2][$i], $data);
|
2119 |
-
}
|
2120 |
-
}
|
2121 |
-
|
2122 |
-
|
2123 |
-
// mPDF 4.4.003
|
2124 |
-
if (preg_match('/xlink:href=/si',$data)) {
|
2125 |
-
// Get links
|
2126 |
-
preg_match_all('/(<(linearGradient|radialgradient)[^>]*)xlink:href=["\']#(.*?)["\'](.*?)\/>/si',$data, $links);
|
2127 |
-
if (count($links[0])) { $links[5] = array(); } // mPDF 4.5.010
|
2128 |
-
// Delete links from data - keeping in $links
|
2129 |
-
for ($i=0; $i<count($links[0]); $i++) {
|
2130 |
-
$links[5][$i] = 'tmpLink'.RAND(100000,9999999); // mPDF 4.5.010
|
2131 |
-
$data = preg_replace('/'.preg_quote($links[0][$i],'/').'/is', '<MYLINKS'.$links[5][$i].'>' , $data); // mPDF 4.5.010
|
2132 |
-
}
|
2133 |
-
// Get targets
|
2134 |
-
preg_match_all('/<(linearGradient|radialgradient)([^>]*)id=["\'](.*?)["\'](.*?)>(.*?)<\/(linearGradient|radialgradient)>/si',$data, $m);
|
2135 |
-
$targets = array();
|
2136 |
-
$stops = array();
|
2137 |
-
// keeping in $targets
|
2138 |
-
for ($i=0; $i<count($m[0]); $i++) {
|
2139 |
-
$stops[$m[3][$i]] = $m[5][$i];
|
2140 |
-
}
|
2141 |
-
// Add back links this time as targets (gradients)
|
2142 |
-
for ($i=0; $i<count($links[0]); $i++) {
|
2143 |
-
$def = $links[1][$i] .' '.$links[4][$i].'>'. $stops[$links[3][$i]].'</'.$links[2][$i] .'>' ; // mPDF 4.5.010
|
2144 |
-
$data = preg_replace('/<MYLINKS'.$links[5][$i].'>/is', $def , $data); // mPDF 4.5.010
|
2145 |
-
}
|
2146 |
-
}
|
2147 |
-
// mPDF 4.4.003 - Removes <pattern>
|
2148 |
-
$data = preg_replace('/<pattern.*?<\/pattern>/is', '', $data);
|
2149 |
-
// mPDF 4.4.003 - Removes <marker>
|
2150 |
-
$data = preg_replace('/<marker.*?<\/marker>/is', '', $data);
|
2151 |
-
|
2152 |
-
$this->svg_info['data'] = $data;
|
2153 |
-
|
2154 |
-
$this->svg_string = '';
|
2155 |
-
|
2156 |
-
//
|
2157 |
-
// chargement unique des fonctions
|
2158 |
-
if(!function_exists("xml_svg2pdf_start")){ // mPDF 5.3.76
|
2159 |
-
|
2160 |
-
function xml_svg2pdf_start($parser, $name, $attribs){
|
2161 |
-
//
|
2162 |
-
// definition
|
2163 |
-
global $svg_class, $last_gradid;
|
2164 |
-
|
2165 |
-
// mPDF 4.4.003
|
2166 |
-
$svg_class->xbase = 0;
|
2167 |
-
$svg_class->ybase = 0;
|
2168 |
-
switch (strtolower($name)){
|
2169 |
-
|
2170 |
-
// mPDF 5.0.039 - Don't output stuff inside <defs>
|
2171 |
-
case 'defs':
|
2172 |
-
$svg_class->inDefs = true;
|
2173 |
-
return;
|
2174 |
-
|
2175 |
-
case 'svg':
|
2176 |
-
$svg_class->svgOffset($attribs);
|
2177 |
-
break;
|
2178 |
-
|
2179 |
-
case 'path':
|
2180 |
-
$path = $attribs['d'];
|
2181 |
-
// mPDF 5.6.65
|
2182 |
-
preg_match_all('/([MZLHVCSQTAmzlhvcsqta])([eE ,\-.\d]+)*/', $path, $commands, PREG_SET_ORDER);
|
2183 |
-
$path_cmd = '';
|
2184 |
-
$svg_class->subPathInit = true;
|
2185 |
-
// mPDF 5.0.039
|
2186 |
-
$svg_class->pathBBox = array(999999,999999,-999999,-999999);
|
2187 |
-
foreach($commands as $c){
|
2188 |
-
if(count($c)==3 || $c[2]==''){
|
2189 |
-
list($tmp, $command, $arguments) = $c;
|
2190 |
-
}
|
2191 |
-
else{
|
2192 |
-
list($tmp, $command) = $c;
|
2193 |
-
$arguments = '';
|
2194 |
-
}
|
2195 |
-
|
2196 |
-
$path_cmd .= $svg_class->svgPath($command, $arguments);
|
2197 |
-
}
|
2198 |
-
// mPDF 5.0.039
|
2199 |
-
if ($svg_class->pathBBox[2]==-1999998) { $svg_class->pathBBox[2] = 100; }
|
2200 |
-
if ($svg_class->pathBBox[3]==-1999998) { $svg_class->pathBBox[3] = 100; }
|
2201 |
-
if ($svg_class->pathBBox[0]==999999) { $svg_class->pathBBox[0] = 0; }
|
2202 |
-
if ($svg_class->pathBBox[1]==999999) { $svg_class->pathBBox[1] = 0; }
|
2203 |
-
$critere_style = $attribs;
|
2204 |
-
unset($critere_style['d']);
|
2205 |
-
$path_style = $svg_class->svgDefineStyle($critere_style);
|
2206 |
-
break;
|
2207 |
-
|
2208 |
-
case 'rect':
|
2209 |
-
if (!isset($attribs['x'])) {$attribs['x'] = 0;}
|
2210 |
-
if (!isset($attribs['y'])) {$attribs['y'] = 0;}
|
2211 |
-
if (!isset($attribs['rx'])) {$attribs['rx'] = 0;}
|
2212 |
-
if (!isset($attribs['ry'])) {$attribs['ry'] = 0;}
|
2213 |
-
$arguments = array(
|
2214 |
-
'x' => $attribs['x'],
|
2215 |
-
'y' => $attribs['y'],
|
2216 |
-
'w' => $attribs['width'],
|
2217 |
-
'h' => $attribs['height'],
|
2218 |
-
'rx' => $attribs['rx'],
|
2219 |
-
'ry' => $attribs['ry']
|
2220 |
-
);
|
2221 |
-
$path_cmd = $svg_class->svgRect($arguments);
|
2222 |
-
$critere_style = $attribs;
|
2223 |
-
unset($critere_style['x'],$critere_style['y'],$critere_style['rx'],$critere_style['ry'],$critere_style['height'],$critere_style['width']);
|
2224 |
-
$path_style = $svg_class->svgDefineStyle($critere_style);
|
2225 |
-
break;
|
2226 |
-
|
2227 |
-
case 'circle':
|
2228 |
-
if (!isset($attribs['cx'])) {$attribs['cx'] = 0;}
|
2229 |
-
if (!isset($attribs['cy'])) {$attribs['cy'] = 0;}
|
2230 |
-
$arguments = array(
|
2231 |
-
'cx' => $attribs['cx'],
|
2232 |
-
'cy' => $attribs['cy'],
|
2233 |
-
'rx' => $attribs['r'],
|
2234 |
-
'ry' => $attribs['r']
|
2235 |
-
);
|
2236 |
-
$path_cmd = $svg_class->svgEllipse($arguments);
|
2237 |
-
$critere_style = $attribs;
|
2238 |
-
unset($critere_style['cx'],$critere_style['cy'],$critere_style['r']);
|
2239 |
-
$path_style = $svg_class->svgDefineStyle($critere_style);
|
2240 |
-
break;
|
2241 |
-
|
2242 |
-
case 'ellipse':
|
2243 |
-
if (!isset($attribs['cx'])) {$attribs['cx'] = 0;}
|
2244 |
-
if (!isset($attribs['cy'])) {$attribs['cy'] = 0;}
|
2245 |
-
$arguments = array(
|
2246 |
-
'cx' => $attribs['cx'],
|
2247 |
-
'cy' => $attribs['cy'],
|
2248 |
-
'rx' => $attribs['rx'],
|
2249 |
-
'ry' => $attribs['ry']
|
2250 |
-
);
|
2251 |
-
$path_cmd = $svg_class->svgEllipse($arguments);
|
2252 |
-
$critere_style = $attribs;
|
2253 |
-
unset($critere_style['cx'],$critere_style['cy'],$critere_style['rx'],$critere_style['ry']);
|
2254 |
-
$path_style = $svg_class->svgDefineStyle($critere_style);
|
2255 |
-
break;
|
2256 |
-
|
2257 |
-
case 'line':
|
2258 |
-
$arguments = array($attribs['x1'],$attribs['y1'],$attribs['x2'],$attribs['y2']);
|
2259 |
-
$path_cmd = $svg_class->svgPolyline($arguments,false); // mPDF 4.4.003
|
2260 |
-
$critere_style = $attribs;
|
2261 |
-
unset($critere_style['x1'],$critere_style['y1'],$critere_style['x2'],$critere_style['y2']);
|
2262 |
-
$path_style = $svg_class->svgDefineStyle($critere_style);
|
2263 |
-
break;
|
2264 |
-
|
2265 |
-
case 'polyline':
|
2266 |
-
$path = $attribs['points'];
|
2267 |
-
preg_match_all('/[0-9\-\.]*/',$path, $tmp, PREG_SET_ORDER);
|
2268 |
-
$arguments = array();
|
2269 |
-
for ($i=0;$i<count($tmp);$i++){
|
2270 |
-
if ($tmp[$i][0] !=''){
|
2271 |
-
array_push($arguments, $tmp[$i][0]);
|
2272 |
-
}
|
2273 |
-
}
|
2274 |
-
$path_cmd = $svg_class->svgPolyline($arguments);
|
2275 |
-
$critere_style = $attribs;
|
2276 |
-
unset($critere_style['points']);
|
2277 |
-
$path_style = $svg_class->svgDefineStyle($critere_style);
|
2278 |
-
break;
|
2279 |
-
|
2280 |
-
case 'polygon':
|
2281 |
-
$path = $attribs['points'];
|
2282 |
-
preg_match_all('/([\-]*[0-9\.]+)/',$path, $tmp);
|
2283 |
-
$arguments = array();
|
2284 |
-
for ($i=0;$i<count($tmp[0]);$i++){
|
2285 |
-
if ($tmp[0][$i] !=''){
|
2286 |
-
array_push($arguments, $tmp[0][$i]);
|
2287 |
-
}
|
2288 |
-
}
|
2289 |
-
$path_cmd = $svg_class->svgPolygon($arguments);
|
2290 |
-
// definition du style de la forme:
|
2291 |
-
$critere_style = $attribs;
|
2292 |
-
unset($critere_style['points']);
|
2293 |
-
$path_style = $svg_class->svgDefineStyle($critere_style);
|
2294 |
-
break;
|
2295 |
-
|
2296 |
-
case 'lineargradient':
|
2297 |
-
$tmp_gradient = array(
|
2298 |
-
'type' => 'linear',
|
2299 |
-
'info' => array(
|
2300 |
-
'x1' => $attribs['x1'],
|
2301 |
-
'y1' => $attribs['y1'],
|
2302 |
-
'x2' => $attribs['x2'],
|
2303 |
-
'y2' => $attribs['y2']
|
2304 |
-
),
|
2305 |
-
'transform' => $attribs['gradientTransform'],
|
2306 |
-
'units' => $attribs['gradientUnits'], /* mPDF 4.4.003 */
|
2307 |
-
'spread' => $attribs['spreadMethod'], /* mPDF 5.0.040 */
|
2308 |
-
'color' => array()
|
2309 |
-
);
|
2310 |
-
|
2311 |
-
$last_gradid = $attribs['id'];
|
2312 |
-
$svg_class->svgAddGradient($attribs['id'],$tmp_gradient);
|
2313 |
-
break;
|
2314 |
-
|
2315 |
-
case 'radialgradient':
|
2316 |
-
$tmp_gradient = array(
|
2317 |
-
'type' => 'radial',
|
2318 |
-
'info' => array(
|
2319 |
-
'x0' => $attribs['cx'],
|
2320 |
-
'y0' => $attribs['cy'],
|
2321 |
-
'x1' => $attribs['fx'],
|
2322 |
-
'y1' => $attribs['fy'],
|
2323 |
-
'r' => $attribs['r']
|
2324 |
-
),
|
2325 |
-
'transform' => $attribs['gradientTransform'],
|
2326 |
-
'units' => $attribs['gradientUnits'], /* mPDF 4.4.003 */
|
2327 |
-
'spread' => $attribs['spreadMethod'], /* mPDF 5.0.040 */
|
2328 |
-
'color' => array()
|
2329 |
-
);
|
2330 |
-
|
2331 |
-
$last_gradid = $attribs['id'];
|
2332 |
-
|
2333 |
-
$svg_class->svgAddGradient($attribs['id'],$tmp_gradient);
|
2334 |
-
|
2335 |
-
break;
|
2336 |
-
|
2337 |
-
case 'stop':
|
2338 |
-
if (!$last_gradid) break;
|
2339 |
-
// mPDF 4.4.003 // mPDF 5.0.040
|
2340 |
-
if (isset($attribs['style']) AND preg_match('/stop-color:\s*([^;]*)/i',$attribs['style'],$m)) {
|
2341 |
-
$color = trim($m[1]);
|
2342 |
-
} else if (isset($attribs['stop-color'])) {
|
2343 |
-
$color = $attribs['stop-color'];
|
2344 |
-
}
|
2345 |
-
$col = $svg_class->mpdf_ref->ConvertColor($color);
|
2346 |
-
|
2347 |
-
// mPDF 5.0.051
|
2348 |
-
// mPDF 5.3.74
|
2349 |
-
if ($col{0}==3 || $col{0}==5) { // RGB
|
2350 |
-
$color_final = sprintf('%.3F %.3F %.3F',ord($col{1})/255,ord($col{2})/255,ord($col{3})/255);
|
2351 |
-
$svg_class->svg_gradient[$last_gradid]['colorspace']='RGB';
|
2352 |
-
}
|
2353 |
-
else if ($col{0}==4 || $col{0}==6) { // CMYK
|
2354 |
-
$color_final = sprintf('%.3F %.3F %.3F %.3F',ord($col{1})/100,ord($col{2})/100,ord($col{3})/100,ord($col{4})/100);
|
2355 |
-
$svg_class->svg_gradient[$last_gradid]['colorspace']='CMYK';
|
2356 |
-
}
|
2357 |
-
else if ($col{0}==1) { // Grayscale
|
2358 |
-
$color_final = sprintf('%.3F',ord($col{1})/255);
|
2359 |
-
$svg_class->svg_gradient[$last_gradid]['colorspace']='Gray';
|
2360 |
-
}
|
2361 |
-
|
2362 |
-
|
2363 |
-
// mPDF 5.0.020
|
2364 |
-
$stop_opacity = 1;
|
2365 |
-
// mPDF 4.4.003
|
2366 |
-
if (isset($attribs['style']) AND preg_match('/stop-opacity:\s*([0-9.]*)/i',$attribs['style'],$m)) {
|
2367 |
-
$stop_opacity = $m[1];
|
2368 |
-
} else if (isset($attribs['stop-opacity'])) {
|
2369 |
-
$stop_opacity = $attribs['stop-opacity'];
|
2370 |
-
}
|
2371 |
-
// mPDF 5.0.051
|
2372 |
-
// mPDF 5.3.74
|
2373 |
-
else if ($col{0}==5) { // RGBa
|
2374 |
-
$stop_opacity = ord($col{4}/100);
|
2375 |
-
}
|
2376 |
-
else if ($col{0}==6) { // CMYKa
|
2377 |
-
$stop_opacity = ord($col{5}/100);
|
2378 |
-
}
|
2379 |
-
|
2380 |
-
$tmp_color = array(
|
2381 |
-
'color' => $color_final,
|
2382 |
-
'offset' => $attribs['offset'],
|
2383 |
-
'opacity' => $stop_opacity
|
2384 |
-
);
|
2385 |
-
array_push($svg_class->svg_gradient[$last_gradid]['color'],$tmp_color);
|
2386 |
-
break;
|
2387 |
-
|
2388 |
-
|
2389 |
-
case 'a':
|
2390 |
-
if (isset($attribs['xlink:href'])) {
|
2391 |
-
unset($attribs['xlink:href']); // this should be a hyperlink
|
2392 |
-
// not handled like a xlink:href in other elements
|
2393 |
-
} // then continue like a <g>
|
2394 |
-
case 'g':
|
2395 |
-
$array_style = $svg_class->svgDefineStyle($attribs);
|
2396 |
-
if ($array_style['transformations']) {
|
2397 |
-
$svg_class->svgWriteString(' q '.$array_style['transformations']);
|
2398 |
-
}
|
2399 |
-
array_push($svg_class->svg_style,$array_style);
|
2400 |
-
|
2401 |
-
$svg_class->svgDefineTxtStyle($attribs); // mPDF 4.4.003
|
2402 |
-
|
2403 |
-
break;
|
2404 |
-
|
2405 |
-
case 'text':
|
2406 |
-
// mPDF 4.4.003
|
2407 |
-
$array_style = $svg_class->svgDefineStyle($attribs);
|
2408 |
-
if ($array_style['transformations']) {
|
2409 |
-
$svg_class->svgWriteString(' q '.$array_style['transformations']);
|
2410 |
-
}
|
2411 |
-
array_push($svg_class->svg_style,$array_style);
|
2412 |
-
|
2413 |
-
$svg_class->txt_data = array();
|
2414 |
-
$svg_class->txt_data[0] = $attribs['x'];
|
2415 |
-
$svg_class->txt_data[1] = $attribs['y'];
|
2416 |
-
$critere_style = $attribs;
|
2417 |
-
unset($critere_style['x'], $critere_style['y']);
|
2418 |
-
$svg_class->svgDefineTxtStyle($critere_style);
|
2419 |
-
break;
|
2420 |
-
}
|
2421 |
-
|
2422 |
-
//
|
2423 |
-
//insertion des path et du style dans le flux de donn� general.
|
2424 |
-
if (isset($path_cmd) && $path_cmd) { // mPDF 4.4.003
|
2425 |
-
// mPDF 5.0
|
2426 |
-
list($prestyle,$poststyle) = $svg_class->svgStyle($path_style, $attribs, strtolower($name));
|
2427 |
-
if ($path_style['transformations']) { // transformation on an element
|
2428 |
-
$svg_class->svgWriteString(" q ".$path_style['transformations']. " $prestyle $path_cmd $poststyle" . " Q\n");
|
2429 |
-
}
|
2430 |
-
else {
|
2431 |
-
$svg_class->svgWriteString("$prestyle $path_cmd $poststyle\n");
|
2432 |
-
}
|
2433 |
-
}
|
2434 |
-
}
|
2435 |
-
|
2436 |
-
function characterData($parser, $data)
|
2437 |
-
{
|
2438 |
-
global $svg_class;
|
2439 |
-
if(isset($svg_class->txt_data[2])) {
|
2440 |
-
$svg_class->txt_data[2] .= $data;
|
2441 |
-
}
|
2442 |
-
else {
|
2443 |
-
$svg_class->txt_data[2] = $data;
|
2444 |
-
}
|
2445 |
-
}
|
2446 |
-
|
2447 |
-
|
2448 |
-
function xml_svg2pdf_end($parser, $name){
|
2449 |
-
global $svg_class;
|
2450 |
-
switch($name){
|
2451 |
-
|
2452 |
-
case "g":
|
2453 |
-
case "a":
|
2454 |
-
$tmp = count($svg_class->svg_style)-1;
|
2455 |
-
$current_style = $svg_class->svg_style[$tmp];
|
2456 |
-
if ($current_style['transformations']) {
|
2457 |
-
$svg_class->svgWriteString(" Q\n");
|
2458 |
-
}
|
2459 |
-
array_pop($svg_class->svg_style);
|
2460 |
-
|
2461 |
-
array_pop($svg_class->txt_style); // mPDF 4.4.003
|
2462 |
-
|
2463 |
-
break;
|
2464 |
-
case 'radialgradient':
|
2465 |
-
case 'lineargradient':
|
2466 |
-
$last_gradid = '';
|
2467 |
-
break;
|
2468 |
-
case "text":
|
2469 |
-
$path_cmd = $svg_class->svgText();
|
2470 |
-
// echo 'path >> '.$path_cmd."<br><br>";
|
2471 |
-
// echo "style >> ".$get_style[1]."<br><br>";
|
2472 |
-
$svg_class->svgWriteString($path_cmd);
|
2473 |
-
// mPDF 4.4.003
|
2474 |
-
$tmp = count($svg_class->svg_style)-1;
|
2475 |
-
$current_style = $svg_class->svg_style[$tmp];
|
2476 |
-
if ($current_style['transformations']) {
|
2477 |
-
$svg_class->svgWriteString(" Q\n");
|
2478 |
-
}
|
2479 |
-
array_pop($svg_class->svg_style);
|
2480 |
-
|
2481 |
-
break;
|
2482 |
-
}
|
2483 |
-
// mPDF 5.0.039 - Don't output stuff inside <defs>
|
2484 |
-
if ($name == 'defs') {
|
2485 |
-
$svg_class->inDefs = false;
|
2486 |
-
}
|
2487 |
-
|
2488 |
-
}
|
2489 |
-
|
2490 |
-
}
|
2491 |
-
|
2492 |
-
$svg2pdf_xml='';
|
2493 |
-
global $svg_class;
|
2494 |
-
$svg_class = $this;
|
2495 |
-
// mPDF 5.0.039 - Don't output stuff inside <defs>
|
2496 |
-
$svg_class->inDefs = false;
|
2497 |
-
$svg2pdf_xml_parser = xml_parser_create("utf-8");
|
2498 |
-
xml_parser_set_option($svg2pdf_xml_parser, XML_OPTION_CASE_FOLDING, false);
|
2499 |
-
xml_set_element_handler($svg2pdf_xml_parser, "xml_svg2pdf_start", "xml_svg2pdf_end");
|
2500 |
-
xml_set_character_data_handler($svg2pdf_xml_parser, "characterData");
|
2501 |
-
xml_parse($svg2pdf_xml_parser, $data);
|
2502 |
-
// mPDF 4.4.003
|
2503 |
-
if ($this->svg_error) { return false; }
|
2504 |
-
else {
|
2505 |
-
return array('x'=>$this->svg_info['x']*$this->kp,'y'=>-$this->svg_info['y']*$this->kp,'w'=>$this->svg_info['w']*$this->kp,'h'=>-$this->svg_info['h']*$this->kp,'data'=>$svg_class->svg_string);
|
2506 |
-
}
|
2507 |
-
|
2508 |
-
}
|
2509 |
-
|
2510 |
-
}
|
2511 |
-
|
2512 |
-
// END OF CLASS
|
2513 |
-
|
2514 |
-
|
2515 |
-
// mPDF 5.0.040
|
2516 |
-
function calc_bezier_bbox($start, $c) {
|
2517 |
-
$P0 = array($start[0],$start[1]);
|
2518 |
-
$P1 = array($c[0],$c[1]);
|
2519 |
-
$P2 = array($c[2],$c[3]);
|
2520 |
-
$P3 = array($c[4],$c[5]);
|
2521 |
-
$bounds = array();
|
2522 |
-
$bounds[0][] = $P0[0];
|
2523 |
-
$bounds[1][] = $P0[1];
|
2524 |
-
$bounds[0][] = $P3[0];
|
2525 |
-
$bounds[1][] = $P3[1];
|
2526 |
-
for ($i=0;$i<=1;$i++) {
|
2527 |
-
$b = 6 * $P0[$i] - 12 * $P1[$i] + 6 * $P2[$i];
|
2528 |
-
$a = -3 * $P0[$i] + 9 * $P1[$i] - 9 * $P2[$i] + 3 * $P3[$i];
|
2529 |
-
$c = 3 * $P1[$i] - 3 * $P0[$i];
|
2530 |
-
if ($a == 0) {
|
2531 |
-
if ($b == 0) { continue; }
|
2532 |
-
$t = -$c / $b;
|
2533 |
-
if ($t>0 && $t<1) {
|
2534 |
-
$bounds[$i][] = (pow((1-$t),3) * $P0[$i] + 3 * pow((1-$t),2) * $t * $P1[$i] + 3 * (1-$t) * pow($t,2) * $P2[$i] + pow($t,3) * $P3[$i]);
|
2535 |
-
}
|
2536 |
-
continue;
|
2537 |
-
}
|
2538 |
-
$b2ac = pow($b, 2) - 4 * $c * $a;
|
2539 |
-
if ($b2ac < 0) { continue; }
|
2540 |
-
$t1 = (-$b + sqrt($b2ac))/(2 * $a);
|
2541 |
-
if ($t1>0 && $t1<1) {
|
2542 |
-
$bounds[$i][] = (pow((1-$t1),3) * $P0[$i] + 3 * pow((1-$t1),2) * $t1 * $P1[$i] + 3 * (1-$t1) * pow($t1,2) * $P2[$i] + pow($t1,3) * $P3[$i]);
|
2543 |
-
}
|
2544 |
-
$t2 = (-$b - sqrt($b2ac))/(2 * $a);
|
2545 |
-
if ($t2>0 && $t2<1) {
|
2546 |
-
$bounds[$i][] = (pow((1-$t2),3) * $P0[$i] + 3 * pow((1-$t2),2) * $t2 * $P1[$i] + 3 * (1-$t2) * pow($t2,2) * $P2[$i] + pow($t2,3) * $P3[$i]);
|
2547 |
-
}
|
2548 |
-
}
|
2549 |
-
$x = min($bounds[0]);
|
2550 |
-
$x2 = max($bounds[0]);
|
2551 |
-
$y = min($bounds[1]);
|
2552 |
-
$y2 = max($bounds[1]);
|
2553 |
-
return array($x, $y, $x2, $y2);
|
2554 |
-
}
|
2555 |
-
|
2556 |
-
// mPDF 5.0.040
|
2557 |
-
function _testIntersectCircle($cx, $cy, $cr) {
|
2558 |
-
// Tests whether a circle fully encloses a rectangle 0,0,1,1
|
2559 |
-
// to see if any further radial gradients need adding (SVG)
|
2560 |
-
// If centre of circle is inside 0,0,1,1 square
|
2561 |
-
if ($cx >= 0 && $cx <= 1 && $cy >= 0 && $cy <= 1) {
|
2562 |
-
$maxd = 1.5;
|
2563 |
-
}
|
2564 |
-
// distance to four corners
|
2565 |
-
else {
|
2566 |
-
$d1 = sqrt(pow(($cy-0),2) + pow(($cx-0),2));
|
2567 |
-
$d2 = sqrt(pow(($cy-1),2) + pow(($cx-0),2));
|
2568 |
-
$d3 = sqrt(pow(($cy-0),2) + pow(($cx-1),2));
|
2569 |
-
$d4 = sqrt(pow(($cy-1),2) + pow(($cx-1),2));
|
2570 |
-
$maxd = max($d1,$d2,$d3,$d4);
|
2571 |
-
}
|
2572 |
-
if ($cr < $maxd) { return true; }
|
2573 |
-
else { return false; }
|
2574 |
-
}
|
2575 |
-
|
2576 |
-
// mPDF 5.0.040
|
2577 |
-
function _testIntersect($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4) {
|
2578 |
-
// Tests whether line (x1, y1) and (x2, y2) [a gradient axis (perpendicular)]
|
2579 |
-
// intersects with a specific line segment (x3, y3) and (x4, y4)
|
2580 |
-
$a1 = $y2-$y1;
|
2581 |
-
$b1 = $x1-$x2;
|
2582 |
-
$c1 = $a1*$x1+$b1*$y1;
|
2583 |
-
$a2 = $y4-$y3;
|
2584 |
-
$b2 = $x3-$x4;
|
2585 |
-
$c2 = $a2*$x3+$b2*$y3;
|
2586 |
-
$det = $a1*$b2 - $a2*$b1;
|
2587 |
-
if($det == 0){ //Lines are parallel
|
2588 |
-
return false;
|
2589 |
-
}
|
2590 |
-
else{
|
2591 |
-
$x = ($b2*$c1 - $b1*$c2)/$det;
|
2592 |
-
$y = ($a1*$c2 - $a2*$c1)/$det;
|
2593 |
-
if ($x >= $x3 && $x <= $x4 && $y >= $y3 && $y <= $y4) { return true; }
|
2594 |
-
}
|
2595 |
-
return false;
|
2596 |
-
}
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/tocontents.php
DELETED
@@ -1,468 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class tocontents {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
var $_toc;
|
7 |
-
var $TOCmark;
|
8 |
-
var $TOCoutdent; // mPDF 5.6.31
|
9 |
-
var $TOCpreHTML;
|
10 |
-
var $TOCpostHTML;
|
11 |
-
var $TOCbookmarkText;
|
12 |
-
var $TOCusePaging;
|
13 |
-
var $TOCuseLinking;
|
14 |
-
var $TOCorientation;
|
15 |
-
var $TOC_margin_left;
|
16 |
-
var $TOC_margin_right;
|
17 |
-
var $TOC_margin_top;
|
18 |
-
var $TOC_margin_bottom;
|
19 |
-
var $TOC_margin_header;
|
20 |
-
var $TOC_margin_footer;
|
21 |
-
var $TOC_odd_header_name;
|
22 |
-
var $TOC_even_header_name;
|
23 |
-
var $TOC_odd_footer_name;
|
24 |
-
var $TOC_even_footer_name;
|
25 |
-
var $TOC_odd_header_value;
|
26 |
-
var $TOC_even_header_value;
|
27 |
-
var $TOC_odd_footer_value;
|
28 |
-
var $TOC_even_footer_value;
|
29 |
-
var $TOC_page_selector;
|
30 |
-
var $m_TOC;
|
31 |
-
|
32 |
-
function tocontents(&$mpdf) {
|
33 |
-
$this->mpdf = $mpdf;
|
34 |
-
$this->_toc=array();
|
35 |
-
$this->TOCmark = 0;
|
36 |
-
$this->m_TOC=array();
|
37 |
-
}
|
38 |
-
|
39 |
-
function TOCpagebreak($tocfont='', $tocfontsize='', $tocindent='', $TOCusePaging=true, $TOCuseLinking='', $toc_orientation='', $toc_mgl='',$toc_mgr='',$toc_mgt='',$toc_mgb='',$toc_mgh='',$toc_mgf='',$toc_ohname='',$toc_ehname='',$toc_ofname='',$toc_efname='',$toc_ohvalue=0,$toc_ehvalue=0,$toc_ofvalue=0, $toc_efvalue=0, $toc_preHTML='', $toc_postHTML='', $toc_bookmarkText='', $resetpagenum='', $pagenumstyle='', $suppress='', $orientation='', $mgl='',$mgr='',$mgt='',$mgb='',$mgh='',$mgf='',$ohname='',$ehname='',$ofname='',$efname='',$ohvalue=0,$ehvalue=0,$ofvalue=0,$efvalue=0, $toc_id=0, $pagesel='', $toc_pagesel='', $sheetsize='', $toc_sheetsize='', $tocoutdent='') { // mPDF 5.6.19
|
40 |
-
if (strtoupper($toc_id)=='ALL') { $toc_id = '_mpdf_all'; }
|
41 |
-
else if (!$toc_id) { $toc_id = 0; }
|
42 |
-
else { $toc_id = strtolower($toc_id); }
|
43 |
-
|
44 |
-
if ($TOCusePaging === false || strtolower($TOCusePaging) == "off" || $TOCusePaging === 0 || $TOCusePaging === "0" || $TOCusePaging === "") { $TOCusePaging = false; }
|
45 |
-
else { $TOCusePaging = true; }
|
46 |
-
if (!$TOCuseLinking) { $TOCuseLinking = false; }
|
47 |
-
if ($toc_id) {
|
48 |
-
$this->m_TOC[$toc_id]['TOCmark'] = $this->mpdf->page;
|
49 |
-
$this->m_TOC[$toc_id]['TOCoutdent'] = $tocoutdent;
|
50 |
-
$this->m_TOC[$toc_id]['TOCorientation'] = $toc_orientation;
|
51 |
-
$this->m_TOC[$toc_id]['TOCuseLinking'] = $TOCuseLinking;
|
52 |
-
$this->m_TOC[$toc_id]['TOCusePaging'] = $TOCusePaging;
|
53 |
-
|
54 |
-
if ($toc_preHTML) { $this->m_TOC[$toc_id]['TOCpreHTML'] = $toc_preHTML; }
|
55 |
-
if ($toc_postHTML) { $this->m_TOC[$toc_id]['TOCpostHTML'] = $toc_postHTML; }
|
56 |
-
if ($toc_bookmarkText) { $this->m_TOC[$toc_id]['TOCbookmarkText'] = $toc_bookmarkText; }
|
57 |
-
|
58 |
-
$this->m_TOC[$toc_id]['TOC_margin_left'] = $toc_mgl;
|
59 |
-
$this->m_TOC[$toc_id]['TOC_margin_right'] = $toc_mgr;
|
60 |
-
$this->m_TOC[$toc_id]['TOC_margin_top'] = $toc_mgt;
|
61 |
-
$this->m_TOC[$toc_id]['TOC_margin_bottom'] = $toc_mgb;
|
62 |
-
$this->m_TOC[$toc_id]['TOC_margin_header'] = $toc_mgh;
|
63 |
-
$this->m_TOC[$toc_id]['TOC_margin_footer'] = $toc_mgf;
|
64 |
-
$this->m_TOC[$toc_id]['TOC_odd_header_name'] = $toc_ohname;
|
65 |
-
$this->m_TOC[$toc_id]['TOC_even_header_name'] = $toc_ehname;
|
66 |
-
$this->m_TOC[$toc_id]['TOC_odd_footer_name'] = $toc_ofname;
|
67 |
-
$this->m_TOC[$toc_id]['TOC_even_footer_name'] = $toc_efname;
|
68 |
-
$this->m_TOC[$toc_id]['TOC_odd_header_value'] = $toc_ohvalue;
|
69 |
-
$this->m_TOC[$toc_id]['TOC_even_header_value'] = $toc_ehvalue;
|
70 |
-
$this->m_TOC[$toc_id]['TOC_odd_footer_value'] = $toc_ofvalue;
|
71 |
-
$this->m_TOC[$toc_id]['TOC_even_footer_value'] = $toc_efvalue;
|
72 |
-
$this->m_TOC[$toc_id]['TOC_page_selector'] = $toc_pagesel;
|
73 |
-
$this->m_TOC[$toc_id]['TOCsheetsize'] = $toc_sheetsize;
|
74 |
-
}
|
75 |
-
else {
|
76 |
-
$this->TOCmark = $this->mpdf->page;
|
77 |
-
$this->TOCoutdent = $tocoutdent;
|
78 |
-
$this->TOCorientation = $toc_orientation;
|
79 |
-
$this->TOCuseLinking = $TOCuseLinking;
|
80 |
-
$this->TOCusePaging = $TOCusePaging;
|
81 |
-
|
82 |
-
if ($toc_preHTML) { $this->TOCpreHTML = $toc_preHTML; }
|
83 |
-
if ($toc_postHTML) { $this->TOCpostHTML = $toc_postHTML; }
|
84 |
-
if ($toc_bookmarkText) { $this->TOCbookmarkText = $toc_bookmarkText; }
|
85 |
-
|
86 |
-
$this->TOC_margin_left = $toc_mgl;
|
87 |
-
$this->TOC_margin_right = $toc_mgr;
|
88 |
-
$this->TOC_margin_top = $toc_mgt;
|
89 |
-
$this->TOC_margin_bottom = $toc_mgb;
|
90 |
-
$this->TOC_margin_header = $toc_mgh;
|
91 |
-
$this->TOC_margin_footer = $toc_mgf;
|
92 |
-
$this->TOC_odd_header_name = $toc_ohname;
|
93 |
-
$this->TOC_even_header_name = $toc_ehname;
|
94 |
-
$this->TOC_odd_footer_name = $toc_ofname;
|
95 |
-
$this->TOC_even_footer_name = $toc_efname;
|
96 |
-
$this->TOC_odd_header_value = $toc_ohvalue;
|
97 |
-
$this->TOC_even_header_value = $toc_ehvalue;
|
98 |
-
$this->TOC_odd_footer_value = $toc_ofvalue;
|
99 |
-
$this->TOC_even_footer_value = $toc_efvalue;
|
100 |
-
$this->TOC_page_selector = $toc_pagesel;
|
101 |
-
$this->TOCsheetsize = $toc_sheetsize;
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
// Initiate, and Mark a place for the Table of Contents to be inserted
|
106 |
-
function TOC($tocfont='', $tocfontsize=0, $tocindent=0, $resetpagenum='', $pagenumstyle='', $suppress='', $toc_orientation='', $TOCusePaging=true, $TOCuseLinking=false, $toc_id=0, $tocoutdent='') { // mPDF 5.6.19) {
|
107 |
-
if (strtoupper($toc_id)=='ALL') { $toc_id = '_mpdf_all'; }
|
108 |
-
else if (!$toc_id) { $toc_id = 0; }
|
109 |
-
else { $toc_id = strtolower($toc_id); }
|
110 |
-
// To use odd and even pages
|
111 |
-
// Cannot start table of contents on an even page
|
112 |
-
if (($this->mpdf->mirrorMargins) && (($this->mpdf->page)%2==0)) { // EVEN
|
113 |
-
if ($this->mpdf->ColActive) {
|
114 |
-
if (count($this->mpdf->columnbuffer)) { $this->mpdf->printcolumnbuffer(); }
|
115 |
-
}
|
116 |
-
$this->mpdf->AddPage($this->mpdf->CurOrientation,'',$resetpagenum, $pagenumstyle, $suppress);
|
117 |
-
}
|
118 |
-
else {
|
119 |
-
$this->mpdf->PageNumSubstitutions[] = array('from'=>$this->mpdf->page, 'reset'=> $resetpagenum, 'type'=>$pagenumstyle, 'suppress'=>$suppress);
|
120 |
-
}
|
121 |
-
if ($toc_id) {
|
122 |
-
$this->m_TOC[$toc_id]['TOCmark'] = $this->mpdf->page;
|
123 |
-
$this->m_TOC[$toc_id]['TOCoutdent'] = $tocoutdent;
|
124 |
-
$this->m_TOC[$toc_id]['TOCorientation'] = $toc_orientation;
|
125 |
-
$this->m_TOC[$toc_id]['TOCuseLinking'] = $TOCuseLinking;
|
126 |
-
$this->m_TOC[$toc_id]['TOCusePaging'] = $TOCusePaging;
|
127 |
-
}
|
128 |
-
else {
|
129 |
-
$this->TOCmark = $this->mpdf->page;
|
130 |
-
$this->TOCoutdent = $tocoutdent;
|
131 |
-
$this->TOCorientation = $toc_orientation;
|
132 |
-
$this->TOCuseLinking = $TOCuseLinking;
|
133 |
-
$this->TOCusePaging = $TOCusePaging;
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
|
138 |
-
function insertTOC() {
|
139 |
-
$notocs = 0;
|
140 |
-
if ($this->TOCmark) { $notocs = 1; }
|
141 |
-
$notocs += count($this->m_TOC);
|
142 |
-
|
143 |
-
if ($notocs==0) { return; }
|
144 |
-
|
145 |
-
if (count($this->m_TOC)) { reset($this->m_TOC); }
|
146 |
-
$added_toc_pages = 0;
|
147 |
-
|
148 |
-
if ($this->mpdf->ColActive) { $this->mpdf->SetColumns(0); }
|
149 |
-
if (($this->mpdf->mirrorMargins) && (($this->mpdf->page)%2==1)) { // ODD
|
150 |
-
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
151 |
-
$extrapage = true;
|
152 |
-
}
|
153 |
-
else { $extrapage = false; }
|
154 |
-
|
155 |
-
for ($toci = 0; $toci<$notocs; $toci++) {
|
156 |
-
if ($toci==0 && $this->TOCmark) {
|
157 |
-
$toc_id = 0;
|
158 |
-
$toc_page = $this->TOCmark;
|
159 |
-
$tocoutdent = $this->TOCoutdent;
|
160 |
-
$toc_orientation = $this->TOCorientation;
|
161 |
-
$TOCuseLinking = $this->TOCuseLinking;
|
162 |
-
$TOCusePaging = $this->TOCusePaging;
|
163 |
-
$toc_preHTML = $this->TOCpreHTML;
|
164 |
-
$toc_postHTML = $this->TOCpostHTML;
|
165 |
-
$toc_bookmarkText = $this->TOCbookmarkText;
|
166 |
-
$toc_mgl = $this->TOC_margin_left;
|
167 |
-
$toc_mgr = $this->TOC_margin_right;
|
168 |
-
$toc_mgt = $this->TOC_margin_top;
|
169 |
-
$toc_mgb = $this->TOC_margin_bottom;
|
170 |
-
$toc_mgh = $this->TOC_margin_header;
|
171 |
-
$toc_mgf = $this->TOC_margin_footer;
|
172 |
-
$toc_ohname = $this->TOC_odd_header_name;
|
173 |
-
$toc_ehname = $this->TOC_even_header_name;
|
174 |
-
$toc_ofname = $this->TOC_odd_footer_name;
|
175 |
-
$toc_efname = $this->TOC_even_footer_name;
|
176 |
-
$toc_ohvalue = $this->TOC_odd_header_value;
|
177 |
-
$toc_ehvalue = $this->TOC_even_header_value;
|
178 |
-
$toc_ofvalue = $this->TOC_odd_footer_value;
|
179 |
-
$toc_efvalue = $this->TOC_even_footer_value;
|
180 |
-
$toc_page_selector = $this->TOC_page_selector;
|
181 |
-
$toc_sheet_size = $this->TOCsheetsize;
|
182 |
-
}
|
183 |
-
else {
|
184 |
-
$arr = current($this->m_TOC);
|
185 |
-
|
186 |
-
$toc_id = key($this->m_TOC);
|
187 |
-
$toc_page = $this->m_TOC[$toc_id]['TOCmark'];
|
188 |
-
$tocoutdent = $this->m_TOC[$toc_id]['TOCoutdent'];
|
189 |
-
$toc_orientation = $this->m_TOC[$toc_id]['TOCorientation'];
|
190 |
-
$TOCuseLinking = $this->m_TOC[$toc_id]['TOCuseLinking'];
|
191 |
-
$TOCusePaging = $this->m_TOC[$toc_id]['TOCusePaging'];
|
192 |
-
if (isset($this->m_TOC[$toc_id]['TOCpreHTML'])) { $toc_preHTML = $this->m_TOC[$toc_id]['TOCpreHTML']; }
|
193 |
-
else { $toc_preHTML = ''; }
|
194 |
-
if (isset($this->m_TOC[$toc_id]['TOCpostHTML'])) { $toc_postHTML = $this->m_TOC[$toc_id]['TOCpostHTML']; }
|
195 |
-
else { $toc_postHTML = ''; }
|
196 |
-
if (isset($this->m_TOC[$toc_id]['TOCbookmarkText'])) { $toc_bookmarkText = $this->m_TOC[$toc_id]['TOCbookmarkText']; }
|
197 |
-
else { $toc_bookmarkText = ''; } // *BOOKMARKS*
|
198 |
-
$toc_mgl = $this->m_TOC[$toc_id]['TOC_margin_left'];
|
199 |
-
$toc_mgr = $this->m_TOC[$toc_id]['TOC_margin_right'];
|
200 |
-
$toc_mgt = $this->m_TOC[$toc_id]['TOC_margin_top'];
|
201 |
-
$toc_mgb = $this->m_TOC[$toc_id]['TOC_margin_bottom'];
|
202 |
-
$toc_mgh = $this->m_TOC[$toc_id]['TOC_margin_header'];
|
203 |
-
$toc_mgf = $this->m_TOC[$toc_id]['TOC_margin_footer'];
|
204 |
-
$toc_ohname = $this->m_TOC[$toc_id]['TOC_odd_header_name'];
|
205 |
-
$toc_ehname = $this->m_TOC[$toc_id]['TOC_even_header_name'];
|
206 |
-
$toc_ofname = $this->m_TOC[$toc_id]['TOC_odd_footer_name'];
|
207 |
-
$toc_efname = $this->m_TOC[$toc_id]['TOC_even_footer_name'];
|
208 |
-
$toc_ohvalue = $this->m_TOC[$toc_id]['TOC_odd_header_value'];
|
209 |
-
$toc_ehvalue = $this->m_TOC[$toc_id]['TOC_even_header_value'];
|
210 |
-
$toc_ofvalue = $this->m_TOC[$toc_id]['TOC_odd_footer_value'];
|
211 |
-
$toc_efvalue = $this->m_TOC[$toc_id]['TOC_even_footer_value'];
|
212 |
-
$toc_page_selector = $this->m_TOC[$toc_id]['TOC_page_selector'];
|
213 |
-
$toc_sheet_size = $this->m_TOC[$toc_id]['TOCsheetsize'];
|
214 |
-
next($this->m_TOC);
|
215 |
-
}
|
216 |
-
|
217 |
-
// mPDF 5.6.31
|
218 |
-
|
219 |
-
if (!$toc_orientation) { $toc_orientation= $this->mpdf->DefOrientation; }
|
220 |
-
$this->mpdf->AddPage($toc_orientation, '', '', '', "on", $toc_mgl, $toc_mgr, $toc_mgt, $toc_mgb, $toc_mgh, $toc_mgf, $toc_ohname, $toc_ehname, $toc_ofname, $toc_efname, $toc_ohvalue, $toc_ehvalue, $toc_ofvalue, $toc_efvalue, $toc_page_selector, $toc_sheet_size );
|
221 |
-
|
222 |
-
$this->mpdf->writingToC = true; // mPDF 5.6.38
|
223 |
-
// mPDF 5.6.31
|
224 |
-
$tocstart=count($this->mpdf->pages);
|
225 |
-
if ($toc_preHTML) { $this->mpdf->WriteHTML($toc_preHTML); }
|
226 |
-
|
227 |
-
|
228 |
-
// mPDF 5.6.19
|
229 |
-
$html ='<div class="mpdf_toc" id="mpdf_toc_'.$toc_id.'">';
|
230 |
-
foreach($this->_toc as $t) {
|
231 |
-
if ($t['toc_id']==='_mpdf_all' || $t['toc_id']===$toc_id ) {
|
232 |
-
$html .= '<div class="mpdf_toc_level_'.$t['l'].'">';
|
233 |
-
if ($TOCuseLinking) { $html .= '<a class="mpdf_toc_a" href="#__mpdfinternallink_'.$t['link'].'">'; }
|
234 |
-
$html .= '<span class="mpdf_toc_t_level_'.$t['l'].'">'.$t['t'].'</span>';
|
235 |
-
if ($TOCuseLinking) { $html .= '</a>'; }
|
236 |
-
if (!$tocoutdent) { $tocoutdent = '0'; }
|
237 |
-
if ($TOCusePaging) { $html .= ' <dottab outdent="'.$tocoutdent.'" /> ';
|
238 |
-
if ($TOCuseLinking) { $html .= '<a class="mpdf_toc_a" href="#__mpdfinternallink_'.$t['link'].'">'; }
|
239 |
-
$html .= '<span class="mpdf_toc_p_level_'.$t['l'].'">'.$this->mpdf->docPageNum($t['p']).'</span>';
|
240 |
-
if ($TOCuseLinking) { $html .= '</a>'; }
|
241 |
-
}
|
242 |
-
$html .= '</div>';
|
243 |
-
}
|
244 |
-
}
|
245 |
-
$html .= '</div>';
|
246 |
-
$this->mpdf->WriteHTML($html);
|
247 |
-
|
248 |
-
if ($toc_postHTML) { $this->mpdf->WriteHTML($toc_postHTML); }
|
249 |
-
$this->mpdf->writingToC = false; // mPDF 5.6.38
|
250 |
-
$this->mpdf->AddPage($toc_orientation,'E');
|
251 |
-
|
252 |
-
$n_toc = $this->mpdf->page - $tocstart + 1;
|
253 |
-
|
254 |
-
if ($toci==0 && $this->TOCmark) {
|
255 |
-
$TOC_start = $tocstart ;
|
256 |
-
$TOC_end = $this->mpdf->page;
|
257 |
-
$TOC_npages = $n_toc;
|
258 |
-
}
|
259 |
-
else {
|
260 |
-
$this->m_TOC[$toc_id]['start'] = $tocstart ;
|
261 |
-
$this->m_TOC[$toc_id]['end'] = $this->mpdf->page;
|
262 |
-
$this->m_TOC[$toc_id]['npages'] = $n_toc;
|
263 |
-
}
|
264 |
-
}
|
265 |
-
|
266 |
-
$s = '';
|
267 |
-
|
268 |
-
$s .= $this->mpdf->PrintBodyBackgrounds();
|
269 |
-
|
270 |
-
$s .= $this->mpdf->PrintPageBackgrounds();
|
271 |
-
$this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS'.date('jY').')/', "\n".$s."\n".'\\1', $this->mpdf->pages[$this->mpdf->page]);
|
272 |
-
$this->mpdf->pageBackgrounds = array();
|
273 |
-
|
274 |
-
//Page footer
|
275 |
-
$this->mpdf->InFooter=true;
|
276 |
-
$this->mpdf->Footer();
|
277 |
-
$this->mpdf->InFooter=false;
|
278 |
-
|
279 |
-
// 2nd time through to move pages etc.
|
280 |
-
$added_toc_pages = 0;
|
281 |
-
if (count($this->m_TOC)) { reset($this->m_TOC); }
|
282 |
-
|
283 |
-
for ($toci = 0; $toci<$notocs; $toci++) {
|
284 |
-
if ($toci==0 && $this->TOCmark) {
|
285 |
-
$toc_id = 0;
|
286 |
-
$toc_page = $this->TOCmark + $added_toc_pages;
|
287 |
-
$toc_orientation = $this->TOCorientation;
|
288 |
-
$TOCuseLinking = $this->TOCuseLinking;
|
289 |
-
$TOCusePaging = $this->TOCusePaging;
|
290 |
-
$toc_bookmarkText = $this->TOCbookmarkText; // *BOOKMARKS*
|
291 |
-
|
292 |
-
$tocstart = $TOC_start ;
|
293 |
-
$tocend = $n = $TOC_end;
|
294 |
-
$n_toc = $TOC_npages;
|
295 |
-
}
|
296 |
-
else {
|
297 |
-
$arr = current($this->m_TOC);
|
298 |
-
|
299 |
-
$toc_id = key($this->m_TOC);
|
300 |
-
$toc_page = $this->m_TOC[$toc_id]['TOCmark'] + $added_toc_pages;
|
301 |
-
$toc_orientation = $this->m_TOC[$toc_id]['TOCorientation'];
|
302 |
-
$TOCuseLinking = $this->m_TOC[$toc_id]['TOCuseLinking'];
|
303 |
-
$TOCusePaging = $this->m_TOC[$toc_id]['TOCusePaging'];
|
304 |
-
$toc_bookmarkText = $this->m_TOC[$toc_id]['TOCbookmarkText']; // *BOOKMARKS*
|
305 |
-
|
306 |
-
$tocstart = $this->m_TOC[$toc_id]['start'] ;
|
307 |
-
$tocend = $n = $this->m_TOC[$toc_id]['end'] ;
|
308 |
-
$n_toc = $this->m_TOC[$toc_id]['npages'] ;
|
309 |
-
|
310 |
-
next($this->m_TOC);
|
311 |
-
}
|
312 |
-
|
313 |
-
// Now pages moved
|
314 |
-
$added_toc_pages += $n_toc;
|
315 |
-
|
316 |
-
$this->mpdf->MovePages($toc_page, $tocstart, $tocend) ;
|
317 |
-
$this->mpdf->pgsIns[$toc_page] = $tocend - $tocstart + 1;
|
318 |
-
|
319 |
-
/*-- BOOKMARKS --*/
|
320 |
-
// Insert new Bookmark for Bookmark
|
321 |
-
if ($toc_bookmarkText) {
|
322 |
-
$insert = -1;
|
323 |
-
foreach($this->mpdf->BMoutlines as $i=>$o) {
|
324 |
-
if($o['p']<$toc_page) { // i.e. before point of insertion
|
325 |
-
$insert = $i;
|
326 |
-
}
|
327 |
-
}
|
328 |
-
$txt = $this->mpdf->purify_utf8_text($toc_bookmarkText);
|
329 |
-
if ($this->mpdf->text_input_as_HTML) {
|
330 |
-
$txt = $this->mpdf->all_entities_to_utf8($txt);
|
331 |
-
}
|
332 |
-
$newBookmark[0] = array('t'=>$txt,'l'=>0,'y'=>0,'p'=>$toc_page );
|
333 |
-
array_splice($this->mpdf->BMoutlines,($insert+1),0,$newBookmark);
|
334 |
-
}
|
335 |
-
/*-- END BOOKMARKS --*/
|
336 |
-
|
337 |
-
}
|
338 |
-
|
339 |
-
// Delete empty page that was inserted earlier
|
340 |
-
if ($extrapage) {
|
341 |
-
unset($this->mpdf->pages[count($this->mpdf->pages)]);
|
342 |
-
$this->mpdf->page--; // Reset page pointer
|
343 |
-
}
|
344 |
-
|
345 |
-
|
346 |
-
}
|
347 |
-
|
348 |
-
|
349 |
-
function openTagTOC($attr) {
|
350 |
-
if (isset($attr['OUTDENT']) && $attr['OUTDENT']) { $tocoutdent = $attr['OUTDENT']; } else { $tocoutdent = ''; } // mPDF 5.6.19
|
351 |
-
if (isset($attr['RESETPAGENUM']) && $attr['RESETPAGENUM']) { $resetpagenum = $attr['RESETPAGENUM']; } else { $resetpagenum = ''; }
|
352 |
-
if (isset($attr['PAGENUMSTYLE']) && $attr['PAGENUMSTYLE']) { $pagenumstyle = $attr['PAGENUMSTYLE']; } else { $pagenumstyle= ''; }
|
353 |
-
if (isset($attr['SUPPRESS']) && $attr['SUPPRESS']) { $suppress = $attr['SUPPRESS']; } else { $suppress = ''; }
|
354 |
-
if (isset($attr['TOC-ORIENTATION']) && $attr['TOC-ORIENTATION']) { $toc_orientation = $attr['TOC-ORIENTATION']; } else { $toc_orientation = ''; }
|
355 |
-
if (isset($attr['PAGING']) && (strtoupper($attr['PAGING'])=='OFF' || $attr['PAGING']==='0')) { $paging = false; }
|
356 |
-
else { $paging = true; }
|
357 |
-
if (isset($attr['LINKS']) && (strtoupper($attr['LINKS'])=='ON' || $attr['LINKS']==1)) { $links = true; }
|
358 |
-
else { $links = false; }
|
359 |
-
if (isset($attr['NAME']) && $attr['NAME']) { $toc_id = strtolower($attr['NAME']); } else { $toc_id = 0; }
|
360 |
-
$this->TOC('',0,0,$resetpagenum, $pagenumstyle, $suppress, $toc_orientation, $paging, $links, $toc_id, $tocoutdent); // mPDF 5.6.19 5.6.31
|
361 |
-
}
|
362 |
-
|
363 |
-
|
364 |
-
function openTagTOCPAGEBREAK($attr) {
|
365 |
-
if (isset($attr['NAME']) && $attr['NAME']) { $toc_id = strtolower($attr['NAME']); } else { $toc_id = 0; }
|
366 |
-
if ($toc_id) {
|
367 |
-
if (isset($attr['OUTDENT']) && $attr['OUTDENT']) { $this->m_TOC[$toc_id]['TOCoutdent'] = $attr['OUTDENT']; } else { $this->m_TOC[$toc_id]['TOCoutdent'] = ''; } // mPDF 5.6.19
|
368 |
-
if (isset($attr['TOC-ORIENTATION']) && $attr['TOC-ORIENTATION']) { $this->m_TOC[$toc_id]['TOCorientation'] = $attr['TOC-ORIENTATION']; } else { $this->m_TOC[$toc_id]['TOCorientation'] = ''; }
|
369 |
-
if (isset($attr['PAGING']) && (strtoupper($attr['PAGING'])=='OFF' || $attr['PAGING']==='0')) { $this->m_TOC[$toc_id]['TOCusePaging'] = false; }
|
370 |
-
else { $this->m_TOC[$toc_id]['TOCusePaging'] = true; }
|
371 |
-
if (isset($attr['LINKS']) && (strtoupper($attr['LINKS'])=='ON' || $attr['LINKS']==1)) { $this->m_TOC[$toc_id]['TOCuseLinking'] = true; }
|
372 |
-
else { $this->m_TOC[$toc_id]['TOCuseLinking'] = false; }
|
373 |
-
|
374 |
-
$this->m_TOC[$toc_id]['TOC_margin_left'] = $this->m_TOC[$toc_id]['TOC_margin_right'] = $this->m_TOC[$toc_id]['TOC_margin_top'] = $this->m_TOC[$toc_id]['TOC_margin_bottom'] = $this->m_TOC[$toc_id]['TOC_margin_header'] = $this->m_TOC[$toc_id]['TOC_margin_footer'] = '';
|
375 |
-
if (isset($attr['TOC-MARGIN-RIGHT'])) { $this->m_TOC[$toc_id]['TOC_margin_right'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-RIGHT'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
376 |
-
if (isset($attr['TOC-MARGIN-LEFT'])) { $this->m_TOC[$toc_id]['TOC_margin_left'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-LEFT'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
377 |
-
if (isset($attr['TOC-MARGIN-TOP'])) { $this->m_TOC[$toc_id]['TOC_margin_top'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-TOP'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
378 |
-
if (isset($attr['TOC-MARGIN-BOTTOM'])) { $this->m_TOC[$toc_id]['TOC_margin_bottom'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-BOTTOM'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
379 |
-
if (isset($attr['TOC-MARGIN-HEADER'])) { $this->m_TOC[$toc_id]['TOC_margin_header'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-HEADER'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
380 |
-
if (isset($attr['TOC-MARGIN-FOOTER'])) { $this->m_TOC[$toc_id]['TOC_margin_footer'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-FOOTER'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
381 |
-
$this->m_TOC[$toc_id]['TOC_odd_header_name'] = $this->m_TOC[$toc_id]['TOC_even_header_name'] = $this->m_TOC[$toc_id]['TOC_odd_footer_name'] = $this->m_TOC[$toc_id]['TOC_even_footer_name'] = '';
|
382 |
-
if (isset($attr['TOC-ODD-HEADER-NAME']) && $attr['TOC-ODD-HEADER-NAME']) { $this->m_TOC[$toc_id]['TOC_odd_header_name'] = $attr['TOC-ODD-HEADER-NAME']; }
|
383 |
-
if (isset($attr['TOC-EVEN-HEADER-NAME']) && $attr['TOC-EVEN-HEADER-NAME']) { $this->m_TOC[$toc_id]['TOC_even_header_name'] = $attr['TOC-EVEN-HEADER-NAME']; }
|
384 |
-
if (isset($attr['TOC-ODD-FOOTER-NAME']) && $attr['TOC-ODD-FOOTER-NAME']) { $this->m_TOC[$toc_id]['TOC_odd_footer_name'] = $attr['TOC-ODD-FOOTER-NAME']; }
|
385 |
-
if (isset($attr['TOC-EVEN-FOOTER-NAME']) && $attr['TOC-EVEN-FOOTER-NAME']) { $this->m_TOC[$toc_id]['TOC_even_footer_name'] = $attr['TOC-EVEN-FOOTER-NAME']; }
|
386 |
-
$this->m_TOC[$toc_id]['TOC_odd_header_value'] = $this->m_TOC[$toc_id]['TOC_even_header_value'] = $this->m_TOC[$toc_id]['TOC_odd_footer_value'] = $this->m_TOC[$toc_id]['TOC_even_footer_value'] = 0;
|
387 |
-
if (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='ON')) { $this->m_TOC[$toc_id]['TOC_odd_header_value'] = 1; }
|
388 |
-
else if (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='OFF')) { $this->m_TOC[$toc_id]['TOC_odd_header_value'] = -1; }
|
389 |
-
if (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='ON')) { $this->m_TOC[$toc_id]['TOC_even_header_value'] = 1; }
|
390 |
-
else if (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='OFF')) { $this->m_TOC[$toc_id]['TOC_even_header_value'] = -1; }
|
391 |
-
if (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='ON')) { $this->m_TOC[$toc_id]['TOC_odd_footer_value'] = 1; }
|
392 |
-
else if (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='OFF')) { $this->m_TOC[$toc_id]['TOC_odd_footer_value'] = -1; }
|
393 |
-
if (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='ON')) { $this->m_TOC[$toc_id]['TOC_even_footer_value'] = 1; }
|
394 |
-
else if (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='OFF')) { $this->m_TOC[$toc_id]['TOC_even_footer_value'] = -1; }
|
395 |
-
if (isset($attr['TOC-PAGE-SELECTOR']) && $attr['TOC-PAGE-SELECTOR']) { $this->m_TOC[$toc_id]['TOC_page_selector'] = $attr['TOC-PAGE-SELECTOR']; }
|
396 |
-
else { $this->m_TOC[$toc_id]['TOC_page_selector'] = ''; }
|
397 |
-
if (isset($attr['TOC-SHEET-SIZE']) && $attr['TOC-SHEET-SIZE']) { $this->m_TOC[$toc_id]['TOCsheetsize'] = $attr['TOC-SHEET-SIZE']; } else { $this->m_TOC[$toc_id]['TOCsheetsize'] = ''; }
|
398 |
-
|
399 |
-
|
400 |
-
if (isset($attr['TOC-PREHTML']) && $attr['TOC-PREHTML']) { $this->m_TOC[$toc_id]['TOCpreHTML'] = htmlspecialchars_decode($attr['TOC-PREHTML'],ENT_QUOTES); }
|
401 |
-
if (isset($attr['TOC-POSTHTML']) && $attr['TOC-POSTHTML']) { $this->m_TOC[$toc_id]['TOCpostHTML'] = htmlspecialchars_decode($attr['TOC-POSTHTML'],ENT_QUOTES); }
|
402 |
-
|
403 |
-
if (isset($attr['TOC-BOOKMARKTEXT']) && $attr['TOC-BOOKMARKTEXT']) { $this->m_TOC[$toc_id]['TOCbookmarkText'] = htmlspecialchars_decode($attr['TOC-BOOKMARKTEXT'],ENT_QUOTES); } // *BOOKMARKS*
|
404 |
-
}
|
405 |
-
else {
|
406 |
-
if (isset($attr['OUTDENT']) && $attr['OUTDENT']) { $this->TOCoutdent = $attr['OUTDENT']; } else { $this->TOCoutdent = ''; } // mPDF 5.6.19
|
407 |
-
if (isset($attr['TOC-ORIENTATION']) && $attr['TOC-ORIENTATION']) { $this->TOCorientation = $attr['TOC-ORIENTATION']; } else { $this->TOCorientation = ''; }
|
408 |
-
if (isset($attr['PAGING']) && (strtoupper($attr['PAGING'])=='OFF' || $attr['PAGING']==='0')) { $this->TOCusePaging = false; }
|
409 |
-
else { $this->TOCusePaging = true; }
|
410 |
-
if (isset($attr['LINKS']) && (strtoupper($attr['LINKS'])=='ON' || $attr['LINKS']==1)) { $this->TOCuseLinking = true; }
|
411 |
-
else { $this->TOCuseLinking = false; }
|
412 |
-
|
413 |
-
$this->TOC_margin_left = $this->TOC_margin_right = $this->TOC_margin_top = $this->TOC_margin_bottom = $this->TOC_margin_header = $this->TOC_margin_footer = '';
|
414 |
-
if (isset($attr['TOC-MARGIN-RIGHT'])) { $this->TOC_margin_right = $this->mpdf->ConvertSize($attr['TOC-MARGIN-RIGHT'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
415 |
-
if (isset($attr['TOC-MARGIN-LEFT'])) { $this->TOC_margin_left = $this->mpdf->ConvertSize($attr['TOC-MARGIN-LEFT'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
416 |
-
if (isset($attr['TOC-MARGIN-TOP'])) { $this->TOC_margin_top = $this->mpdf->ConvertSize($attr['TOC-MARGIN-TOP'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
417 |
-
if (isset($attr['TOC-MARGIN-BOTTOM'])) { $this->TOC_margin_bottom = $this->mpdf->ConvertSize($attr['TOC-MARGIN-BOTTOM'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
418 |
-
if (isset($attr['TOC-MARGIN-HEADER'])) { $this->TOC_margin_header = $this->mpdf->ConvertSize($attr['TOC-MARGIN-HEADER'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
419 |
-
if (isset($attr['TOC-MARGIN-FOOTER'])) { $this->TOC_margin_footer = $this->mpdf->ConvertSize($attr['TOC-MARGIN-FOOTER'],$this->mpdf->w,$this->mpdf->FontSize,false); }
|
420 |
-
$this->TOC_odd_header_name = $this->TOC_even_header_name = $this->TOC_odd_footer_name = $this->TOC_even_footer_name = '';
|
421 |
-
if (isset($attr['TOC-ODD-HEADER-NAME']) && $attr['TOC-ODD-HEADER-NAME']) { $this->TOC_odd_header_name = $attr['TOC-ODD-HEADER-NAME']; }
|
422 |
-
if (isset($attr['TOC-EVEN-HEADER-NAME']) && $attr['TOC-EVEN-HEADER-NAME']) { $this->TOC_even_header_name = $attr['TOC-EVEN-HEADER-NAME']; }
|
423 |
-
if (isset($attr['TOC-ODD-FOOTER-NAME']) && $attr['TOC-ODD-FOOTER-NAME']) { $this->TOC_odd_footer_name = $attr['TOC-ODD-FOOTER-NAME']; }
|
424 |
-
if (isset($attr['TOC-EVEN-FOOTER-NAME']) && $attr['TOC-EVEN-FOOTER-NAME']) { $this->TOC_even_footer_name = $attr['TOC-EVEN-FOOTER-NAME']; }
|
425 |
-
$this->TOC_odd_header_value = $this->TOC_even_header_value = $this->TOC_odd_footer_value = $this->TOC_even_footer_value = 0;
|
426 |
-
if (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='ON')) { $this->TOC_odd_header_value = 1; }
|
427 |
-
else if (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='OFF')) { $this->TOC_odd_header_value = -1; }
|
428 |
-
if (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='ON')) { $this->TOC_even_header_value = 1; }
|
429 |
-
else if (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='OFF')) { $this->TOC_even_header_value = -1; }
|
430 |
-
|
431 |
-
if (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='ON')) { $this->TOC_odd_footer_value = 1; }
|
432 |
-
else if (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='OFF')) { $this->TOC_odd_footer_value = -1; }
|
433 |
-
if (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='ON')) { $this->TOC_even_footer_value = 1; }
|
434 |
-
else if (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='OFF')) { $this->TOC_even_footer_value = -1; }
|
435 |
-
if (isset($attr['TOC-PAGE-SELECTOR']) && $attr['TOC-PAGE-SELECTOR']) { $this->TOC_page_selector = $attr['TOC-PAGE-SELECTOR']; }
|
436 |
-
else { $this->TOC_page_selector = ''; }
|
437 |
-
if (isset($attr['TOC-SHEET-SIZE']) && $attr['TOC-SHEET-SIZE']) { $this->TOCsheetsize = $attr['TOC-SHEET-SIZE']; } else { $this->TOCsheetsize = ''; }
|
438 |
-
|
439 |
-
if (isset($attr['TOC-PREHTML']) && $attr['TOC-PREHTML']) { $this->TOCpreHTML = htmlspecialchars_decode($attr['TOC-PREHTML'],ENT_QUOTES); }
|
440 |
-
if (isset($attr['TOC-POSTHTML']) && $attr['TOC-POSTHTML']) { $this->TOCpostHTML = htmlspecialchars_decode($attr['TOC-POSTHTML'],ENT_QUOTES); }
|
441 |
-
if (isset($attr['TOC-BOOKMARKTEXT']) && $attr['TOC-BOOKMARKTEXT']) { $this->TOCbookmarkText = htmlspecialchars_decode($attr['TOC-BOOKMARKTEXT'],ENT_QUOTES); }
|
442 |
-
}
|
443 |
-
|
444 |
-
if ($this->mpdf->y == $this->mpdf->tMargin && (!$this->mpdf->mirrorMargins ||($this->mpdf->mirrorMargins && $this->mpdf->page % 2==1))) {
|
445 |
-
if ($toc_id) { $this->m_TOC[$toc_id]['TOCmark'] = $this->mpdf->page; }
|
446 |
-
else { $this->TOCmark = $this->mpdf->page; }
|
447 |
-
// Don't add a page
|
448 |
-
if ($this->mpdf->page==1 && count($this->mpdf->PageNumSubstitutions)==0) {
|
449 |
-
$resetpagenum = '';
|
450 |
-
$pagenumstyle = '';
|
451 |
-
$suppress = '';
|
452 |
-
if (isset($attr['RESETPAGENUM'])) { $resetpagenum = $attr['RESETPAGENUM']; }
|
453 |
-
if (isset($attr['PAGENUMSTYLE'])) { $pagenumstyle = $attr['PAGENUMSTYLE']; }
|
454 |
-
if (isset($attr['SUPPRESS'])) { $suppress = $attr['SUPPRESS']; }
|
455 |
-
if (!$suppress) { $suppress = 'off'; }
|
456 |
-
if (!$resetpagenum) { $resetpagenum= 1; }
|
457 |
-
$this->mpdf->PageNumSubstitutions[] = array('from'=>1, 'reset'=> $resetpagenum, 'type'=>$pagenumstyle, 'suppress'=> $suppress);
|
458 |
-
}
|
459 |
-
return array(true, $toc_id);
|
460 |
-
}
|
461 |
-
// No break - continues as PAGEBREAK...
|
462 |
-
return array(false, $toc_id);
|
463 |
-
}
|
464 |
-
|
465 |
-
|
466 |
-
}
|
467 |
-
|
468 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/ttfontsuni.php
DELETED
@@ -1,2066 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*******************************************************************************
|
4 |
-
* TTFontFile class *
|
5 |
-
* *
|
6 |
-
* Version: 2.01 *
|
7 |
-
* Date: 2012-02-25 *
|
8 |
-
* Author: Ian Back <ianb@bpm1.com> *
|
9 |
-
* License: LGPL *
|
10 |
-
* Copyright (c) Ian Back, 2010 *
|
11 |
-
* This class is based on The ReportLab Open Source PDF library *
|
12 |
-
* written in Python - http://www.reportlab.com/software/opensource/ *
|
13 |
-
* together with ideas from the OpenOffice source code and others. *
|
14 |
-
* This header must be retained in any redistribution or *
|
15 |
-
* modification of the file. *
|
16 |
-
* *
|
17 |
-
*******************************************************************************/
|
18 |
-
|
19 |
-
// Define the value used in the "head" table of a created TTF file
|
20 |
-
// 0x74727565 "true" for Mac
|
21 |
-
// 0x00010000 for Windows
|
22 |
-
// Either seems to work for a font embedded in a PDF file
|
23 |
-
// when read by Adobe Reader on a Windows PC(!)
|
24 |
-
if (!defined('_TTF_MAC_HEADER')) define("_TTF_MAC_HEADER", false);
|
25 |
-
|
26 |
-
// Recalculate correct metadata/profiles when making subset fonts (not SIP/SMP)
|
27 |
-
// e.g. xMin, xMax, maxNContours
|
28 |
-
if (!defined('_RECALC_PROFILE')) define("_RECALC_PROFILE", false);
|
29 |
-
|
30 |
-
// TrueType Font Glyph operators
|
31 |
-
define("GF_WORDS",(1 << 0));
|
32 |
-
define("GF_SCALE",(1 << 3));
|
33 |
-
define("GF_MORE",(1 << 5));
|
34 |
-
define("GF_XYSCALE",(1 << 6));
|
35 |
-
define("GF_TWOBYTWO",(1 << 7));
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
class TTFontFile {
|
40 |
-
|
41 |
-
var $unAGlyphs; // mPDF 5.4.05
|
42 |
-
var $panose;
|
43 |
-
var $maxUni;
|
44 |
-
var $sFamilyClass;
|
45 |
-
var $sFamilySubClass;
|
46 |
-
var $sipset;
|
47 |
-
var $smpset;
|
48 |
-
var $_pos;
|
49 |
-
var $numTables;
|
50 |
-
var $searchRange;
|
51 |
-
var $entrySelector;
|
52 |
-
var $rangeShift;
|
53 |
-
var $tables;
|
54 |
-
var $otables;
|
55 |
-
var $filename;
|
56 |
-
var $fh;
|
57 |
-
var $glyphPos;
|
58 |
-
var $charToGlyph;
|
59 |
-
var $ascent;
|
60 |
-
var $descent;
|
61 |
-
var $name;
|
62 |
-
var $familyName;
|
63 |
-
var $styleName;
|
64 |
-
var $fullName;
|
65 |
-
var $uniqueFontID;
|
66 |
-
var $unitsPerEm;
|
67 |
-
var $bbox;
|
68 |
-
var $capHeight;
|
69 |
-
var $stemV;
|
70 |
-
var $italicAngle;
|
71 |
-
var $flags;
|
72 |
-
var $underlinePosition;
|
73 |
-
var $underlineThickness;
|
74 |
-
var $charWidths;
|
75 |
-
var $defaultWidth;
|
76 |
-
var $maxStrLenRead;
|
77 |
-
var $numTTCFonts;
|
78 |
-
var $TTCFonts;
|
79 |
-
var $maxUniChar;
|
80 |
-
var $kerninfo;
|
81 |
-
|
82 |
-
function TTFontFile() {
|
83 |
-
$this->maxStrLenRead = 200000; // Maximum size of glyf table to read in as string (otherwise reads each glyph from file)
|
84 |
-
}
|
85 |
-
|
86 |
-
|
87 |
-
function getMetrics($file, $TTCfontID=0, $debug=false, $BMPonly=false, $kerninfo=false, $unAGlyphs=false) { // mPDF 5.4.05
|
88 |
-
$this->unAGlyphs = $unAGlyphs; // mPDF 5.4.05
|
89 |
-
$this->filename = $file;
|
90 |
-
$this->fh = fopen($file,'rb') or die('Can\'t open file ' . $file);
|
91 |
-
$this->_pos = 0;
|
92 |
-
$this->charWidths = '';
|
93 |
-
$this->glyphPos = array();
|
94 |
-
$this->charToGlyph = array();
|
95 |
-
$this->tables = array();
|
96 |
-
$this->otables = array();
|
97 |
-
$this->kerninfo = array();
|
98 |
-
$this->ascent = 0;
|
99 |
-
$this->descent = 0;
|
100 |
-
$this->numTTCFonts = 0;
|
101 |
-
$this->TTCFonts = array();
|
102 |
-
$this->version = $version = $this->read_ulong();
|
103 |
-
$this->panose = array();
|
104 |
-
if ($version==0x4F54544F)
|
105 |
-
die("Postscript outlines are not supported");
|
106 |
-
if ($version==0x74746366 && !$TTCfontID)
|
107 |
-
die("ERROR - You must define the TTCfontID for a TrueType Collection in config_fonts.php (". $file.")");
|
108 |
-
if (!in_array($version, array(0x00010000,0x74727565)) && !$TTCfontID)
|
109 |
-
die("Not a TrueType font: version=".$version);
|
110 |
-
if ($TTCfontID > 0) {
|
111 |
-
$this->version = $version = $this->read_ulong(); // TTC Header version now
|
112 |
-
if (!in_array($version, array(0x00010000,0x00020000)))
|
113 |
-
die("ERROR - Error parsing TrueType Collection: version=".$version." - " . $file);
|
114 |
-
$this->numTTCFonts = $this->read_ulong();
|
115 |
-
for ($i=1; $i<=$this->numTTCFonts; $i++) {
|
116 |
-
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
|
117 |
-
}
|
118 |
-
$this->seek($this->TTCFonts[$TTCfontID]['offset']);
|
119 |
-
$this->version = $version = $this->read_ulong(); // TTFont version again now
|
120 |
-
}
|
121 |
-
$this->readTableDirectory($debug);
|
122 |
-
$this->extractInfo($debug, $BMPonly, $kerninfo);
|
123 |
-
fclose($this->fh);
|
124 |
-
}
|
125 |
-
|
126 |
-
|
127 |
-
function readTableDirectory($debug=false) {
|
128 |
-
$this->numTables = $this->read_ushort();
|
129 |
-
$this->searchRange = $this->read_ushort();
|
130 |
-
$this->entrySelector = $this->read_ushort();
|
131 |
-
$this->rangeShift = $this->read_ushort();
|
132 |
-
$this->tables = array();
|
133 |
-
for ($i=0;$i<$this->numTables;$i++) {
|
134 |
-
$record = array();
|
135 |
-
$record['tag'] = $this->read_tag();
|
136 |
-
$record['checksum'] = array($this->read_ushort(),$this->read_ushort());
|
137 |
-
$record['offset'] = $this->read_ulong();
|
138 |
-
$record['length'] = $this->read_ulong();
|
139 |
-
$this->tables[$record['tag']] = $record;
|
140 |
-
}
|
141 |
-
//if ($debug) $this->checksumTables();
|
142 |
-
}
|
143 |
-
|
144 |
-
function checksumTables() {
|
145 |
-
// Check the checksums for all tables
|
146 |
-
foreach($this->tables AS $t) {
|
147 |
-
if ($t['length'] > 0 && $t['length'] < $this->maxStrLenRead) { // 1.02
|
148 |
-
$table = $this->get_chunk($t['offset'], $t['length']);
|
149 |
-
$checksum = $this->calcChecksum($table);
|
150 |
-
if ($t['tag'] == 'head') {
|
151 |
-
$up = unpack('n*', substr($table,8,4));
|
152 |
-
$adjustment[0] = $up[1];
|
153 |
-
$adjustment[1] = $up[2];
|
154 |
-
$checksum = $this->sub32($checksum, $adjustment);
|
155 |
-
}
|
156 |
-
$xchecksum = $t['checksum'];
|
157 |
-
|
158 |
-
if ($xchecksum != $checksum)
|
159 |
-
die(sprintf('TTF file "%s": invalid checksum %s table: %s (expected %s)', $this->filename,dechex($checksum[0]).dechex($checksum[1]),$t['tag'],dechex($xchecksum[0]).dechex($xchecksum[1])));
|
160 |
-
}
|
161 |
-
}
|
162 |
-
}
|
163 |
-
|
164 |
-
function sub32($x, $y) {
|
165 |
-
$xlo = $x[1];
|
166 |
-
$xhi = $x[0];
|
167 |
-
$ylo = $y[1];
|
168 |
-
$yhi = $y[0];
|
169 |
-
if ($ylo > $xlo) { $xlo += 1 << 16; $yhi += 1; }
|
170 |
-
$reslo = $xlo-$ylo;
|
171 |
-
if ($yhi > $xhi) { $xhi += 1 << 16; }
|
172 |
-
$reshi = $xhi-$yhi;
|
173 |
-
$reshi = $reshi & 0xFFFF;
|
174 |
-
return array($reshi, $reslo);
|
175 |
-
}
|
176 |
-
|
177 |
-
function calcChecksum($data) {
|
178 |
-
if (strlen($data) % 4) { $data .= str_repeat("\0",(4-(strlen($data) % 4))); }
|
179 |
-
$len = strlen($data);
|
180 |
-
$hi=0x0000;
|
181 |
-
$lo=0x0000;
|
182 |
-
for($i=0;$i<$len;$i+=4) {
|
183 |
-
$hi += (ord($data[$i])<<8) + ord($data[$i+1]);
|
184 |
-
$lo += (ord($data[$i+2])<<8) + ord($data[$i+3]);
|
185 |
-
$hi += ($lo >> 16) & 0xFFFF;
|
186 |
-
$lo = $lo & 0xFFFF;
|
187 |
-
}
|
188 |
-
return array($hi, $lo);
|
189 |
-
}
|
190 |
-
|
191 |
-
function get_table_pos($tag) {
|
192 |
-
$offset = $this->tables[$tag]['offset'];
|
193 |
-
$length = $this->tables[$tag]['length'];
|
194 |
-
return array($offset, $length);
|
195 |
-
}
|
196 |
-
|
197 |
-
function seek($pos) {
|
198 |
-
$this->_pos = $pos;
|
199 |
-
fseek($this->fh,$this->_pos);
|
200 |
-
}
|
201 |
-
|
202 |
-
function skip($delta) {
|
203 |
-
$this->_pos = $this->_pos + $delta;
|
204 |
-
fseek($this->fh,$delta,SEEK_CUR);
|
205 |
-
}
|
206 |
-
|
207 |
-
function seek_table($tag, $offset_in_table = 0) {
|
208 |
-
$tpos = $this->get_table_pos($tag);
|
209 |
-
$this->_pos = $tpos[0] + $offset_in_table;
|
210 |
-
fseek($this->fh, $this->_pos);
|
211 |
-
return $this->_pos;
|
212 |
-
}
|
213 |
-
|
214 |
-
function read_tag() {
|
215 |
-
$this->_pos += 4;
|
216 |
-
return fread($this->fh,4);
|
217 |
-
}
|
218 |
-
|
219 |
-
function read_short() {
|
220 |
-
$this->_pos += 2;
|
221 |
-
$s = fread($this->fh,2);
|
222 |
-
$a = (ord($s[0])<<8) + ord($s[1]);
|
223 |
-
if ($a & (1 << 15) ) {
|
224 |
-
$a = ($a - (1 << 16));
|
225 |
-
}
|
226 |
-
return $a;
|
227 |
-
}
|
228 |
-
|
229 |
-
function unpack_short($s) {
|
230 |
-
$a = (ord($s[0])<<8) + ord($s[1]);
|
231 |
-
if ($a & (1 << 15) ) {
|
232 |
-
$a = ($a - (1 << 16));
|
233 |
-
}
|
234 |
-
return $a;
|
235 |
-
}
|
236 |
-
|
237 |
-
function read_ushort() {
|
238 |
-
$this->_pos += 2;
|
239 |
-
$s = fread($this->fh,2);
|
240 |
-
return (ord($s[0])<<8) + ord($s[1]);
|
241 |
-
}
|
242 |
-
|
243 |
-
function read_ulong() {
|
244 |
-
$this->_pos += 4;
|
245 |
-
$s = fread($this->fh,4);
|
246 |
-
// if large uInt32 as an integer, PHP converts it to -ve
|
247 |
-
return (ord($s[0])*16777216) + (ord($s[1])<<16) + (ord($s[2])<<8) + ord($s[3]); // 16777216 = 1<<24
|
248 |
-
}
|
249 |
-
|
250 |
-
function get_ushort($pos) {
|
251 |
-
fseek($this->fh,$pos);
|
252 |
-
$s = fread($this->fh,2);
|
253 |
-
return (ord($s[0])<<8) + ord($s[1]);
|
254 |
-
}
|
255 |
-
|
256 |
-
function get_ulong($pos) {
|
257 |
-
fseek($this->fh,$pos);
|
258 |
-
$s = fread($this->fh,4);
|
259 |
-
// iF large uInt32 as an integer, PHP converts it to -ve
|
260 |
-
return (ord($s[0])*16777216) + (ord($s[1])<<16) + (ord($s[2])<<8) + ord($s[3]); // 16777216 = 1<<24
|
261 |
-
}
|
262 |
-
|
263 |
-
function pack_short($val) {
|
264 |
-
if ($val<0) {
|
265 |
-
$val = abs($val);
|
266 |
-
$val = ~$val;
|
267 |
-
$val += 1;
|
268 |
-
}
|
269 |
-
return pack("n",$val);
|
270 |
-
}
|
271 |
-
|
272 |
-
function splice($stream, $offset, $value) {
|
273 |
-
return substr($stream,0,$offset) . $value . substr($stream,$offset+strlen($value));
|
274 |
-
}
|
275 |
-
|
276 |
-
function _set_ushort($stream, $offset, $value) {
|
277 |
-
$up = pack("n", $value);
|
278 |
-
return $this->splice($stream, $offset, $up);
|
279 |
-
}
|
280 |
-
|
281 |
-
function _set_short($stream, $offset, $val) {
|
282 |
-
if ($val<0) {
|
283 |
-
$val = abs($val);
|
284 |
-
$val = ~$val;
|
285 |
-
$val += 1;
|
286 |
-
}
|
287 |
-
$up = pack("n",$val);
|
288 |
-
return $this->splice($stream, $offset, $up);
|
289 |
-
}
|
290 |
-
|
291 |
-
function get_chunk($pos, $length) {
|
292 |
-
fseek($this->fh,$pos);
|
293 |
-
if ($length <1) { return ''; }
|
294 |
-
return (fread($this->fh,$length));
|
295 |
-
}
|
296 |
-
|
297 |
-
function get_table($tag) {
|
298 |
-
list($pos, $length) = $this->get_table_pos($tag);
|
299 |
-
if ($length == 0) { return ''; }
|
300 |
-
fseek($this->fh,$pos);
|
301 |
-
return (fread($this->fh,$length));
|
302 |
-
}
|
303 |
-
|
304 |
-
function add($tag, $data) {
|
305 |
-
if ($tag == 'head') {
|
306 |
-
$data = $this->splice($data, 8, "\0\0\0\0");
|
307 |
-
}
|
308 |
-
$this->otables[$tag] = $data;
|
309 |
-
}
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
/////////////////////////////////////////////////////////////////////////////////////////
|
314 |
-
function getCTG($file, $TTCfontID=0, $debug=false, $unAGlyphs=false) { // mPDF 5.4.05
|
315 |
-
$this->unAGlyphs = $unAGlyphs; // mPDF 5.4.05
|
316 |
-
$this->filename = $file;
|
317 |
-
$this->fh = fopen($file,'rb') or die('Can\'t open file ' . $file);
|
318 |
-
$this->_pos = 0;
|
319 |
-
$this->charWidths = '';
|
320 |
-
$this->glyphPos = array();
|
321 |
-
$this->charToGlyph = array();
|
322 |
-
$this->tables = array();
|
323 |
-
$this->numTTCFonts = 0;
|
324 |
-
$this->TTCFonts = array();
|
325 |
-
$this->skip(4);
|
326 |
-
if ($TTCfontID > 0) {
|
327 |
-
$this->version = $version = $this->read_ulong(); // TTC Header version now
|
328 |
-
if (!in_array($version, array(0x00010000,0x00020000)))
|
329 |
-
die("ERROR - Error parsing TrueType Collection: version=".$version." - " . $file);
|
330 |
-
$this->numTTCFonts = $this->read_ulong();
|
331 |
-
for ($i=1; $i<=$this->numTTCFonts; $i++) {
|
332 |
-
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
|
333 |
-
}
|
334 |
-
$this->seek($this->TTCFonts[$TTCfontID]['offset']);
|
335 |
-
$this->version = $version = $this->read_ulong(); // TTFont version again now
|
336 |
-
}
|
337 |
-
|
338 |
-
$this->readTableDirectory($debug);
|
339 |
-
|
340 |
-
// cmap - Character to glyph index mapping table
|
341 |
-
$cmap_offset = $this->seek_table("cmap");
|
342 |
-
$this->skip(2);
|
343 |
-
$cmapTableCount = $this->read_ushort();
|
344 |
-
$unicode_cmap_offset = 0;
|
345 |
-
for ($i=0;$i<$cmapTableCount;$i++) {
|
346 |
-
$platformID = $this->read_ushort();
|
347 |
-
$encodingID = $this->read_ushort();
|
348 |
-
$offset = $this->read_ulong();
|
349 |
-
$save_pos = $this->_pos;
|
350 |
-
if ($platformID == 3 && $encodingID == 1) { // Microsoft, Unicode
|
351 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
352 |
-
if ($format == 4) {
|
353 |
-
$unicode_cmap_offset = $cmap_offset + $offset;
|
354 |
-
break;
|
355 |
-
}
|
356 |
-
}
|
357 |
-
else if ($platformID == 0) { // Unicode -- assume all encodings are compatible
|
358 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
359 |
-
if ($format == 4) {
|
360 |
-
$unicode_cmap_offset = $cmap_offset + $offset;
|
361 |
-
break;
|
362 |
-
}
|
363 |
-
}
|
364 |
-
$this->seek($save_pos );
|
365 |
-
}
|
366 |
-
|
367 |
-
$glyphToChar = array();
|
368 |
-
$charToGlyph = array();
|
369 |
-
$this->getCMAP4($unicode_cmap_offset, $glyphToChar, $charToGlyph );
|
370 |
-
|
371 |
-
fclose($this->fh);
|
372 |
-
return ($charToGlyph);
|
373 |
-
}
|
374 |
-
|
375 |
-
/////////////////////////////////////////////////////////////////////////////////////////
|
376 |
-
function getTTCFonts($file) {
|
377 |
-
$this->filename = $file;
|
378 |
-
$this->fh = fopen($file,'rb');
|
379 |
-
if (!$this->fh) { return ('ERROR - Can\'t open file ' . $file); }
|
380 |
-
$this->numTTCFonts = 0;
|
381 |
-
$this->TTCFonts = array();
|
382 |
-
$this->version = $version = $this->read_ulong();
|
383 |
-
if ($version==0x74746366) {
|
384 |
-
$this->version = $version = $this->read_ulong(); // TTC Header version now
|
385 |
-
if (!in_array($version, array(0x00010000,0x00020000)))
|
386 |
-
return("ERROR - Error parsing TrueType Collection: version=".$version." - " . $file);
|
387 |
-
}
|
388 |
-
else {
|
389 |
-
return("ERROR - Not a TrueType Collection: version=".$version." - " . $file);
|
390 |
-
}
|
391 |
-
$this->numTTCFonts = $this->read_ulong();
|
392 |
-
for ($i=1; $i<=$this->numTTCFonts; $i++) {
|
393 |
-
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
/////////////////////////////////////////////////////////////////////////////////////////
|
400 |
-
|
401 |
-
/////////////////////////////////////////////////////////////////////////////////////////
|
402 |
-
|
403 |
-
function extractInfo($debug=false, $BMPonly=false, $kerninfo=false) {
|
404 |
-
$this->panose = array();
|
405 |
-
$this->sFamilyClass = 0;
|
406 |
-
$this->sFamilySubClass = 0;
|
407 |
-
///////////////////////////////////
|
408 |
-
// name - Naming table
|
409 |
-
///////////////////////////////////
|
410 |
-
$name_offset = $this->seek_table("name");
|
411 |
-
$format = $this->read_ushort();
|
412 |
-
if ($format != 0 && $format != 1)
|
413 |
-
die("Unknown name table format ".$format);
|
414 |
-
$numRecords = $this->read_ushort();
|
415 |
-
$string_data_offset = $name_offset + $this->read_ushort();
|
416 |
-
$names = array(1=>'',2=>'',3=>'',4=>'',6=>'');
|
417 |
-
$K = array_keys($names);
|
418 |
-
$nameCount = count($names);
|
419 |
-
for ($i=0;$i<$numRecords; $i++) {
|
420 |
-
$platformId = $this->read_ushort();
|
421 |
-
$encodingId = $this->read_ushort();
|
422 |
-
$languageId = $this->read_ushort();
|
423 |
-
$nameId = $this->read_ushort();
|
424 |
-
$length = $this->read_ushort();
|
425 |
-
$offset = $this->read_ushort();
|
426 |
-
if (!in_array($nameId,$K)) continue;
|
427 |
-
$N = '';
|
428 |
-
if ($platformId == 3 && $encodingId == 1 && $languageId == 0x409) { // Microsoft, Unicode, US English, PS Name
|
429 |
-
$opos = $this->_pos;
|
430 |
-
$this->seek($string_data_offset + $offset);
|
431 |
-
if ($length % 2 != 0)
|
432 |
-
die("PostScript name is UTF-16BE string of odd length");
|
433 |
-
$length /= 2;
|
434 |
-
$N = '';
|
435 |
-
while ($length > 0) {
|
436 |
-
$char = $this->read_ushort();
|
437 |
-
$N .= (chr($char));
|
438 |
-
$length -= 1;
|
439 |
-
}
|
440 |
-
$this->_pos = $opos;
|
441 |
-
$this->seek($opos);
|
442 |
-
}
|
443 |
-
else if ($platformId == 1 && $encodingId == 0 && $languageId == 0) { // Macintosh, Roman, English, PS Name
|
444 |
-
$opos = $this->_pos;
|
445 |
-
$N = $this->get_chunk($string_data_offset + $offset, $length);
|
446 |
-
$this->_pos = $opos;
|
447 |
-
$this->seek($opos);
|
448 |
-
}
|
449 |
-
if ($N && $names[$nameId]=='') {
|
450 |
-
$names[$nameId] = $N;
|
451 |
-
$nameCount -= 1;
|
452 |
-
if ($nameCount==0) break;
|
453 |
-
}
|
454 |
-
}
|
455 |
-
if ($names[6])
|
456 |
-
$psName = $names[6];
|
457 |
-
else if ($names[4])
|
458 |
-
$psName = preg_replace('/ /','-',$names[4]);
|
459 |
-
else if ($names[1])
|
460 |
-
$psName = preg_replace('/ /','-',$names[1]);
|
461 |
-
else
|
462 |
-
$psName = '';
|
463 |
-
if (!$psName)
|
464 |
-
die("Could not find PostScript font name: ".$this->filename);
|
465 |
-
if ($debug) {
|
466 |
-
for ($i=0;$i<count($psName);$i++) {
|
467 |
-
$c = $psName[$i];
|
468 |
-
$oc = ord($c);
|
469 |
-
if ($oc>126 || strpos(' [](){}<>/%',$c)!==false)
|
470 |
-
die("psName=".$psName." contains invalid character ".$c." ie U+".ord(c));
|
471 |
-
}
|
472 |
-
}
|
473 |
-
$this->name = $psName;
|
474 |
-
if ($names[1]) { $this->familyName = $names[1]; } else { $this->familyName = $psName; }
|
475 |
-
if ($names[2]) { $this->styleName = $names[2]; } else { $this->styleName = 'Regular'; }
|
476 |
-
if ($names[4]) { $this->fullName = $names[4]; } else { $this->fullName = $psName; }
|
477 |
-
if ($names[3]) { $this->uniqueFontID = $names[3]; } else { $this->uniqueFontID = $psName; }
|
478 |
-
|
479 |
-
if ($names[6]) { $this->fullName = $names[6]; }
|
480 |
-
|
481 |
-
///////////////////////////////////
|
482 |
-
// head - Font header table
|
483 |
-
///////////////////////////////////
|
484 |
-
$this->seek_table("head");
|
485 |
-
if ($debug) {
|
486 |
-
$ver_maj = $this->read_ushort();
|
487 |
-
$ver_min = $this->read_ushort();
|
488 |
-
if ($ver_maj != 1)
|
489 |
-
die('Unknown head table version '. $ver_maj .'.'. $ver_min);
|
490 |
-
$this->fontRevision = $this->read_ushort() . $this->read_ushort();
|
491 |
-
|
492 |
-
$this->skip(4);
|
493 |
-
$magic = $this->read_ulong();
|
494 |
-
if ($magic != 0x5F0F3CF5)
|
495 |
-
die('Invalid head table magic ' .$magic);
|
496 |
-
$this->skip(2);
|
497 |
-
}
|
498 |
-
else {
|
499 |
-
$this->skip(18);
|
500 |
-
}
|
501 |
-
$this->unitsPerEm = $unitsPerEm = $this->read_ushort();
|
502 |
-
$scale = 1000 / $unitsPerEm;
|
503 |
-
$this->skip(16);
|
504 |
-
$xMin = $this->read_short();
|
505 |
-
$yMin = $this->read_short();
|
506 |
-
$xMax = $this->read_short();
|
507 |
-
$yMax = $this->read_short();
|
508 |
-
$this->bbox = array(($xMin*$scale), ($yMin*$scale), ($xMax*$scale), ($yMax*$scale));
|
509 |
-
$this->skip(3*2);
|
510 |
-
$indexToLocFormat = $this->read_ushort();
|
511 |
-
$glyphDataFormat = $this->read_ushort();
|
512 |
-
if ($glyphDataFormat != 0)
|
513 |
-
die('Unknown glyph data format '.$glyphDataFormat);
|
514 |
-
|
515 |
-
///////////////////////////////////
|
516 |
-
// hhea metrics table
|
517 |
-
///////////////////////////////////
|
518 |
-
// ttf2t1 seems to use this value rather than the one in OS/2 - so put in for compatibility
|
519 |
-
if (isset($this->tables["hhea"])) {
|
520 |
-
$this->seek_table("hhea");
|
521 |
-
$this->skip(4);
|
522 |
-
$hheaAscender = $this->read_short();
|
523 |
-
$hheaDescender = $this->read_short();
|
524 |
-
$this->ascent = ($hheaAscender *$scale);
|
525 |
-
$this->descent = ($hheaDescender *$scale);
|
526 |
-
}
|
527 |
-
|
528 |
-
///////////////////////////////////
|
529 |
-
// OS/2 - OS/2 and Windows metrics table
|
530 |
-
///////////////////////////////////
|
531 |
-
if (isset($this->tables["OS/2"])) {
|
532 |
-
$this->seek_table("OS/2");
|
533 |
-
$version = $this->read_ushort();
|
534 |
-
$this->skip(2);
|
535 |
-
$usWeightClass = $this->read_ushort();
|
536 |
-
$this->skip(2);
|
537 |
-
$fsType = $this->read_ushort();
|
538 |
-
if ($fsType == 0x0002 || ($fsType & 0x0300) != 0) {
|
539 |
-
global $overrideTTFFontRestriction;
|
540 |
-
if (!$overrideTTFFontRestriction) die('ERROR - Font file '.$this->filename.' cannot be embedded due to copyright restrictions.');
|
541 |
-
$this->restrictedUse = true;
|
542 |
-
}
|
543 |
-
$this->skip(20);
|
544 |
-
$sF = $this->read_short();
|
545 |
-
$this->sFamilyClass = ($sF >> 8);
|
546 |
-
$this->sFamilySubClass = ($sF & 0xFF);
|
547 |
-
$this->_pos += 10; //PANOSE = 10 byte length
|
548 |
-
$panose = fread($this->fh,10);
|
549 |
-
$this->panose = array();
|
550 |
-
for ($p=0;$p<strlen($panose);$p++) { $this->panose[] = ord($panose[$p]); }
|
551 |
-
$this->skip(26);
|
552 |
-
$sTypoAscender = $this->read_short();
|
553 |
-
$sTypoDescender = $this->read_short();
|
554 |
-
if (!$this->ascent) $this->ascent = ($sTypoAscender*$scale);
|
555 |
-
if (!$this->descent) $this->descent = ($sTypoDescender*$scale);
|
556 |
-
if ($version > 1) {
|
557 |
-
$this->skip(16);
|
558 |
-
$sCapHeight = $this->read_short();
|
559 |
-
$this->capHeight = ($sCapHeight*$scale);
|
560 |
-
}
|
561 |
-
else {
|
562 |
-
$this->capHeight = $this->ascent;
|
563 |
-
}
|
564 |
-
}
|
565 |
-
else {
|
566 |
-
$usWeightClass = 500;
|
567 |
-
if (!$this->ascent) $this->ascent = ($yMax*$scale);
|
568 |
-
if (!$this->descent) $this->descent = ($yMin*$scale);
|
569 |
-
$this->capHeight = $this->ascent;
|
570 |
-
}
|
571 |
-
$this->stemV = 50 + intval(pow(($usWeightClass / 65.0),2));
|
572 |
-
|
573 |
-
///////////////////////////////////
|
574 |
-
// post - PostScript table
|
575 |
-
///////////////////////////////////
|
576 |
-
$this->seek_table("post");
|
577 |
-
if ($debug) {
|
578 |
-
$ver_maj = $this->read_ushort();
|
579 |
-
$ver_min = $this->read_ushort();
|
580 |
-
if ($ver_maj <1 || $ver_maj >4)
|
581 |
-
die('Unknown post table version '.$ver_maj);
|
582 |
-
}
|
583 |
-
else {
|
584 |
-
$this->skip(4);
|
585 |
-
}
|
586 |
-
$this->italicAngle = $this->read_short() + $this->read_ushort() / 65536.0;
|
587 |
-
$this->underlinePosition = $this->read_short() * $scale;
|
588 |
-
$this->underlineThickness = $this->read_short() * $scale;
|
589 |
-
$isFixedPitch = $this->read_ulong();
|
590 |
-
|
591 |
-
$this->flags = 4;
|
592 |
-
|
593 |
-
if ($this->italicAngle!= 0)
|
594 |
-
$this->flags = $this->flags | 64;
|
595 |
-
if ($usWeightClass >= 600)
|
596 |
-
$this->flags = $this->flags | 262144;
|
597 |
-
if ($isFixedPitch)
|
598 |
-
$this->flags = $this->flags | 1;
|
599 |
-
|
600 |
-
///////////////////////////////////
|
601 |
-
// hhea - Horizontal header table
|
602 |
-
///////////////////////////////////
|
603 |
-
$this->seek_table("hhea");
|
604 |
-
if ($debug) {
|
605 |
-
$ver_maj = $this->read_ushort();
|
606 |
-
$ver_min = $this->read_ushort();
|
607 |
-
if ($ver_maj != 1)
|
608 |
-
die('Unknown hhea table version '.$ver_maj);
|
609 |
-
$this->skip(28);
|
610 |
-
}
|
611 |
-
else {
|
612 |
-
$this->skip(32);
|
613 |
-
}
|
614 |
-
$metricDataFormat = $this->read_ushort();
|
615 |
-
if ($metricDataFormat != 0)
|
616 |
-
die('Unknown horizontal metric data format '.$metricDataFormat);
|
617 |
-
$numberOfHMetrics = $this->read_ushort();
|
618 |
-
if ($numberOfHMetrics == 0)
|
619 |
-
die('Number of horizontal metrics is 0');
|
620 |
-
|
621 |
-
///////////////////////////////////
|
622 |
-
// maxp - Maximum profile table
|
623 |
-
///////////////////////////////////
|
624 |
-
$this->seek_table("maxp");
|
625 |
-
if ($debug) {
|
626 |
-
$ver_maj = $this->read_ushort();
|
627 |
-
$ver_min = $this->read_ushort();
|
628 |
-
if ($ver_maj != 1)
|
629 |
-
die('Unknown maxp table version '.$ver_maj);
|
630 |
-
}
|
631 |
-
else {
|
632 |
-
$this->skip(4);
|
633 |
-
}
|
634 |
-
$numGlyphs = $this->read_ushort();
|
635 |
-
|
636 |
-
|
637 |
-
///////////////////////////////////
|
638 |
-
// cmap - Character to glyph index mapping table
|
639 |
-
///////////////////////////////////
|
640 |
-
$cmap_offset = $this->seek_table("cmap");
|
641 |
-
$this->skip(2);
|
642 |
-
$cmapTableCount = $this->read_ushort();
|
643 |
-
$unicode_cmap_offset = 0;
|
644 |
-
for ($i=0;$i<$cmapTableCount;$i++) {
|
645 |
-
$platformID = $this->read_ushort();
|
646 |
-
$encodingID = $this->read_ushort();
|
647 |
-
$offset = $this->read_ulong();
|
648 |
-
$save_pos = $this->_pos;
|
649 |
-
if (($platformID == 3 && $encodingID == 1) || $platformID == 0) { // Microsoft, Unicode
|
650 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
651 |
-
if ($format == 4) {
|
652 |
-
if (!$unicode_cmap_offset) $unicode_cmap_offset = $cmap_offset + $offset;
|
653 |
-
if ($BMPonly) break;
|
654 |
-
}
|
655 |
-
}
|
656 |
-
// Microsoft, Unicode Format 12 table HKCS
|
657 |
-
else if ((($platformID == 3 && $encodingID == 10) || $platformID == 0) && !$BMPonly) {
|
658 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
659 |
-
if ($format == 12) {
|
660 |
-
$unicode_cmap_offset = $cmap_offset + $offset;
|
661 |
-
break;
|
662 |
-
}
|
663 |
-
}
|
664 |
-
$this->seek($save_pos );
|
665 |
-
}
|
666 |
-
if (!$unicode_cmap_offset)
|
667 |
-
die('Font ('.$this->filename .') does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
|
668 |
-
|
669 |
-
|
670 |
-
$sipset = false;
|
671 |
-
$smpset = false;
|
672 |
-
// Format 12 CMAP does characters above Unicode BMP i.e. some HKCS characters U+20000 and above
|
673 |
-
if ($format == 12 && !$BMPonly) {
|
674 |
-
$this->maxUniChar = 0;
|
675 |
-
$this->seek($unicode_cmap_offset + 4);
|
676 |
-
$length = $this->read_ulong();
|
677 |
-
$limit = $unicode_cmap_offset + $length;
|
678 |
-
$this->skip(4);
|
679 |
-
|
680 |
-
$nGroups = $this->read_ulong();
|
681 |
-
|
682 |
-
$glyphToChar = array();
|
683 |
-
$charToGlyph = array();
|
684 |
-
for($i=0; $i<$nGroups ; $i++) {
|
685 |
-
$startCharCode = $this->read_ulong();
|
686 |
-
$endCharCode = $this->read_ulong();
|
687 |
-
$startGlyphCode = $this->read_ulong();
|
688 |
-
if (($endCharCode > 0x20000 && $endCharCode < 0x2A6DF) || ($endCharCode > 0x2F800 && $endCharCode < 0x2FA1F)) {
|
689 |
-
$sipset = true;
|
690 |
-
}
|
691 |
-
else if ($endCharCode > 0x10000 && $endCharCode < 0x1FFFF) {
|
692 |
-
$smpset = true;
|
693 |
-
}
|
694 |
-
$offset = 0;
|
695 |
-
for ($unichar=$startCharCode;$unichar<=$endCharCode;$unichar++) {
|
696 |
-
$glyph = $startGlyphCode + $offset ;
|
697 |
-
$offset++;
|
698 |
-
$charToGlyph[$unichar] = $glyph;
|
699 |
-
if ($unichar < 196608) { $this->maxUniChar = max($unichar,$this->maxUniChar); }
|
700 |
-
$glyphToChar[$glyph][] = $unichar;
|
701 |
-
}
|
702 |
-
}
|
703 |
-
}
|
704 |
-
else {
|
705 |
-
|
706 |
-
$glyphToChar = array();
|
707 |
-
$charToGlyph = array();
|
708 |
-
$this->getCMAP4($unicode_cmap_offset, $glyphToChar, $charToGlyph );
|
709 |
-
|
710 |
-
}
|
711 |
-
$this->sipset = $sipset ;
|
712 |
-
$this->smpset = $smpset ;
|
713 |
-
|
714 |
-
///////////////////////////////////
|
715 |
-
// hmtx - Horizontal metrics table
|
716 |
-
///////////////////////////////////
|
717 |
-
$this->getHMTX($numberOfHMetrics, $numGlyphs, $glyphToChar, $scale);
|
718 |
-
|
719 |
-
///////////////////////////////////
|
720 |
-
// kern - Kerning pair table
|
721 |
-
///////////////////////////////////
|
722 |
-
if ($kerninfo) {
|
723 |
-
// Recognises old form of Kerning table - as required by Windows - Format 0 only
|
724 |
-
$kern_offset = $this->seek_table("kern");
|
725 |
-
$version = $this->read_ushort();
|
726 |
-
$nTables = $this->read_ushort();
|
727 |
-
// subtable header
|
728 |
-
$sversion = $this->read_ushort();
|
729 |
-
$slength = $this->read_ushort();
|
730 |
-
$scoverage = $this->read_ushort();
|
731 |
-
$format = $scoverage >> 8;
|
732 |
-
if ($kern_offset && $version==0 && $format==0) {
|
733 |
-
// Format 0
|
734 |
-
$nPairs = $this->read_ushort();
|
735 |
-
$this->skip(6);
|
736 |
-
for ($i=0; $i<$nPairs; $i++) {
|
737 |
-
$left = $this->read_ushort();
|
738 |
-
$right = $this->read_ushort();
|
739 |
-
$val = $this->read_short();
|
740 |
-
if (count($glyphToChar[$left])==1 && count($glyphToChar[$right])==1) {
|
741 |
-
if ($left != 32 && $right != 32) {
|
742 |
-
$this->kerninfo[$glyphToChar[$left][0]][$glyphToChar[$right][0]] = intval($val*$scale);
|
743 |
-
}
|
744 |
-
}
|
745 |
-
}
|
746 |
-
}
|
747 |
-
}
|
748 |
-
}
|
749 |
-
|
750 |
-
|
751 |
-
/////////////////////////////////////////////////////////////////////////////////////////
|
752 |
-
|
753 |
-
|
754 |
-
function makeSubset($file, &$subset, $TTCfontID=0, $debug=false, $unAGlyphs=false) { // mPDF 5.4.05
|
755 |
-
$this->unAGlyphs = $unAGlyphs; // mPDF 5.4.05
|
756 |
-
$this->filename = $file;
|
757 |
-
$this->fh = fopen($file ,'rb') or die('Can\'t open file ' . $file);
|
758 |
-
$this->_pos = 0;
|
759 |
-
$this->charWidths = '';
|
760 |
-
$this->glyphPos = array();
|
761 |
-
$this->charToGlyph = array();
|
762 |
-
$this->tables = array();
|
763 |
-
$this->otables = array();
|
764 |
-
$this->ascent = 0;
|
765 |
-
$this->descent = 0;
|
766 |
-
$this->numTTCFonts = 0;
|
767 |
-
$this->TTCFonts = array();
|
768 |
-
$this->skip(4);
|
769 |
-
$this->maxUni = 0;
|
770 |
-
if ($TTCfontID > 0) {
|
771 |
-
$this->version = $version = $this->read_ulong(); // TTC Header version now
|
772 |
-
if (!in_array($version, array(0x00010000,0x00020000)))
|
773 |
-
die("ERROR - Error parsing TrueType Collection: version=".$version." - " . $file);
|
774 |
-
$this->numTTCFonts = $this->read_ulong();
|
775 |
-
for ($i=1; $i<=$this->numTTCFonts; $i++) {
|
776 |
-
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
|
777 |
-
}
|
778 |
-
$this->seek($this->TTCFonts[$TTCfontID]['offset']);
|
779 |
-
$this->version = $version = $this->read_ulong(); // TTFont version again now
|
780 |
-
}
|
781 |
-
$this->readTableDirectory($debug);
|
782 |
-
|
783 |
-
///////////////////////////////////
|
784 |
-
// head - Font header table
|
785 |
-
///////////////////////////////////
|
786 |
-
$this->seek_table("head");
|
787 |
-
$this->skip(50);
|
788 |
-
$indexToLocFormat = $this->read_ushort();
|
789 |
-
$glyphDataFormat = $this->read_ushort();
|
790 |
-
|
791 |
-
///////////////////////////////////
|
792 |
-
// hhea - Horizontal header table
|
793 |
-
///////////////////////////////////
|
794 |
-
$this->seek_table("hhea");
|
795 |
-
$this->skip(32);
|
796 |
-
$metricDataFormat = $this->read_ushort();
|
797 |
-
$orignHmetrics = $numberOfHMetrics = $this->read_ushort();
|
798 |
-
|
799 |
-
///////////////////////////////////
|
800 |
-
// maxp - Maximum profile table
|
801 |
-
///////////////////////////////////
|
802 |
-
$this->seek_table("maxp");
|
803 |
-
$this->skip(4);
|
804 |
-
$numGlyphs = $this->read_ushort();
|
805 |
-
|
806 |
-
|
807 |
-
///////////////////////////////////
|
808 |
-
// cmap - Character to glyph index mapping table
|
809 |
-
///////////////////////////////////
|
810 |
-
$cmap_offset = $this->seek_table("cmap");
|
811 |
-
$this->skip(2);
|
812 |
-
$cmapTableCount = $this->read_ushort();
|
813 |
-
$unicode_cmap_offset = 0;
|
814 |
-
for ($i=0;$i<$cmapTableCount;$i++) {
|
815 |
-
$platformID = $this->read_ushort();
|
816 |
-
$encodingID = $this->read_ushort();
|
817 |
-
$offset = $this->read_ulong();
|
818 |
-
$save_pos = $this->_pos;
|
819 |
-
if (($platformID == 3 && $encodingID == 1) || $platformID == 0) { // Microsoft, Unicode
|
820 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
821 |
-
if ($format == 4) {
|
822 |
-
$unicode_cmap_offset = $cmap_offset + $offset;
|
823 |
-
break;
|
824 |
-
}
|
825 |
-
}
|
826 |
-
$this->seek($save_pos );
|
827 |
-
}
|
828 |
-
|
829 |
-
if (!$unicode_cmap_offset)
|
830 |
-
die('Font ('.$this->filename .') does not have Unicode cmap (platform 3, encoding 1, format 4, or platform 0 [any encoding] format 4)');
|
831 |
-
|
832 |
-
|
833 |
-
$glyphToChar = array();
|
834 |
-
$charToGlyph = array();
|
835 |
-
$this->getCMAP4($unicode_cmap_offset, $glyphToChar, $charToGlyph );
|
836 |
-
|
837 |
-
$this->charToGlyph = $charToGlyph;
|
838 |
-
|
839 |
-
|
840 |
-
///////////////////////////////////
|
841 |
-
// hmtx - Horizontal metrics table
|
842 |
-
///////////////////////////////////
|
843 |
-
$scale = 1; // not used
|
844 |
-
$this->getHMTX($numberOfHMetrics, $numGlyphs, $glyphToChar, $scale);
|
845 |
-
|
846 |
-
///////////////////////////////////
|
847 |
-
// loca - Index to location
|
848 |
-
///////////////////////////////////
|
849 |
-
$this->getLOCA($indexToLocFormat, $numGlyphs);
|
850 |
-
|
851 |
-
$subsetglyphs = array(0=>0, 1=>1, 2=>2);
|
852 |
-
$subsetCharToGlyph = array();
|
853 |
-
foreach($subset AS $code) {
|
854 |
-
if (isset($this->charToGlyph[$code])) {
|
855 |
-
$subsetglyphs[$this->charToGlyph[$code]] = $code; // Old Glyph ID => Unicode
|
856 |
-
$subsetCharToGlyph[$code] = $this->charToGlyph[$code]; // Unicode to old GlyphID
|
857 |
-
|
858 |
-
}
|
859 |
-
$this->maxUni = max($this->maxUni, $code);
|
860 |
-
}
|
861 |
-
|
862 |
-
list($start,$dummy) = $this->get_table_pos('glyf');
|
863 |
-
|
864 |
-
$glyphSet = array();
|
865 |
-
ksort($subsetglyphs);
|
866 |
-
$n = 0;
|
867 |
-
$fsLastCharIndex = 0; // maximum Unicode index (character code) in this font, according to the cmap subtable for platform ID 3 and platform- specific encoding ID 0 or 1.
|
868 |
-
foreach($subsetglyphs AS $originalGlyphIdx => $uni) {
|
869 |
-
$fsLastCharIndex = max($fsLastCharIndex , $uni);
|
870 |
-
$glyphSet[$originalGlyphIdx] = $n; // old glyphID to new glyphID
|
871 |
-
$n++;
|
872 |
-
}
|
873 |
-
|
874 |
-
ksort($subsetCharToGlyph);
|
875 |
-
foreach($subsetCharToGlyph AS $uni => $originalGlyphIdx) {
|
876 |
-
$codeToGlyph[$uni] = $glyphSet[$originalGlyphIdx] ;
|
877 |
-
}
|
878 |
-
$this->codeToGlyph = $codeToGlyph;
|
879 |
-
|
880 |
-
ksort($subsetglyphs);
|
881 |
-
foreach($subsetglyphs AS $originalGlyphIdx => $uni) {
|
882 |
-
$this->getGlyphs($originalGlyphIdx, $start, $glyphSet, $subsetglyphs);
|
883 |
-
}
|
884 |
-
|
885 |
-
$numGlyphs = $numberOfHMetrics = count($subsetglyphs );
|
886 |
-
|
887 |
-
///////////////////////////////////
|
888 |
-
// name - table copied from the original
|
889 |
-
///////////////////////////////////
|
890 |
-
$this->add('name', $this->get_table('name'));
|
891 |
-
|
892 |
-
///////////////////////////////////
|
893 |
-
//tables copied from the original
|
894 |
-
///////////////////////////////////
|
895 |
-
$tags = array ('cvt ', 'fpgm', 'prep', 'gasp');
|
896 |
-
foreach($tags AS $tag) {
|
897 |
-
if (isset($this->tables[$tag])) { $this->add($tag, $this->get_table($tag)); }
|
898 |
-
}
|
899 |
-
|
900 |
-
///////////////////////////////////
|
901 |
-
// post - PostScript
|
902 |
-
///////////////////////////////////
|
903 |
-
if (isset($this->tables['post'])) {
|
904 |
-
$opost = $this->get_table('post');
|
905 |
-
$post = "\x00\x03\x00\x00" . substr($opost,4,12) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
906 |
-
$this->add('post', $post);
|
907 |
-
}
|
908 |
-
|
909 |
-
///////////////////////////////////
|
910 |
-
// Sort CID2GID map into segments of contiguous codes
|
911 |
-
///////////////////////////////////
|
912 |
-
ksort($codeToGlyph);
|
913 |
-
unset($codeToGlyph[0]);
|
914 |
-
//unset($codeToGlyph[65535]);
|
915 |
-
$rangeid = 0;
|
916 |
-
$range = array();
|
917 |
-
$prevcid = -2;
|
918 |
-
$prevglidx = -1;
|
919 |
-
// for each character
|
920 |
-
foreach ($codeToGlyph as $cid => $glidx) {
|
921 |
-
if ($cid == ($prevcid + 1) && $glidx == ($prevglidx + 1)) {
|
922 |
-
$range[$rangeid][] = $glidx;
|
923 |
-
} else {
|
924 |
-
// new range
|
925 |
-
$rangeid = $cid;
|
926 |
-
$range[$rangeid] = array();
|
927 |
-
$range[$rangeid][] = $glidx;
|
928 |
-
}
|
929 |
-
$prevcid = $cid;
|
930 |
-
$prevglidx = $glidx;
|
931 |
-
}
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
///////////////////////////////////
|
936 |
-
// CMap table
|
937 |
-
///////////////////////////////////
|
938 |
-
// cmap - Character to glyph mapping
|
939 |
-
$segCount = count($range) + 1; // + 1 Last segment has missing character 0xFFFF
|
940 |
-
$searchRange = 1;
|
941 |
-
$entrySelector = 0;
|
942 |
-
while ($searchRange * 2 <= $segCount ) {
|
943 |
-
$searchRange = $searchRange * 2;
|
944 |
-
$entrySelector = $entrySelector + 1;
|
945 |
-
}
|
946 |
-
$searchRange = $searchRange * 2;
|
947 |
-
$rangeShift = $segCount * 2 - $searchRange;
|
948 |
-
$length = 16 + (8*$segCount ) + ($numGlyphs+1);
|
949 |
-
$cmap = array(0, 3, // Index : version, number of encoding subtables
|
950 |
-
0, 0, // Encoding Subtable : platform (UNI=0), encoding 0
|
951 |
-
0, 28, // Encoding Subtable : offset (hi,lo)
|
952 |
-
0, 3, // Encoding Subtable : platform (UNI=0), encoding 3
|
953 |
-
0, 28, // Encoding Subtable : offset (hi,lo)
|
954 |
-
3, 1, // Encoding Subtable : platform (MS=3), encoding 1
|
955 |
-
0, 28, // Encoding Subtable : offset (hi,lo)
|
956 |
-
4, $length, 0, // Format 4 Mapping subtable: format, length, language
|
957 |
-
$segCount*2,
|
958 |
-
$searchRange,
|
959 |
-
$entrySelector,
|
960 |
-
$rangeShift);
|
961 |
-
|
962 |
-
// endCode(s)
|
963 |
-
foreach($range AS $start=>$subrange) {
|
964 |
-
$endCode = $start + (count($subrange)-1);
|
965 |
-
$cmap[] = $endCode; // endCode(s)
|
966 |
-
}
|
967 |
-
$cmap[] = 0xFFFF; // endCode of last Segment
|
968 |
-
$cmap[] = 0; // reservedPad
|
969 |
-
|
970 |
-
// startCode(s)
|
971 |
-
foreach($range AS $start=>$subrange) {
|
972 |
-
$cmap[] = $start; // startCode(s)
|
973 |
-
}
|
974 |
-
$cmap[] = 0xFFFF; // startCode of last Segment
|
975 |
-
// idDelta(s)
|
976 |
-
foreach($range AS $start=>$subrange) {
|
977 |
-
$idDelta = -($start-$subrange[0]);
|
978 |
-
$n += count($subrange);
|
979 |
-
$cmap[] = $idDelta; // idDelta(s)
|
980 |
-
}
|
981 |
-
$cmap[] = 1; // idDelta of last Segment
|
982 |
-
// idRangeOffset(s)
|
983 |
-
foreach($range AS $subrange) {
|
984 |
-
$cmap[] = 0; // idRangeOffset[segCount] Offset in bytes to glyph indexArray, or 0
|
985 |
-
|
986 |
-
}
|
987 |
-
$cmap[] = 0; // idRangeOffset of last Segment
|
988 |
-
foreach($range AS $subrange) {
|
989 |
-
foreach($subrange AS $glidx) {
|
990 |
-
$cmap[] = $glidx;
|
991 |
-
}
|
992 |
-
}
|
993 |
-
$cmap[] = 0; // Mapping for last character
|
994 |
-
$cmapstr = '';
|
995 |
-
foreach($cmap AS $cm) { $cmapstr .= pack("n",$cm); }
|
996 |
-
$this->add('cmap', $cmapstr);
|
997 |
-
|
998 |
-
|
999 |
-
///////////////////////////////////
|
1000 |
-
// glyf - Glyph data
|
1001 |
-
///////////////////////////////////
|
1002 |
-
list($glyfOffset,$glyfLength) = $this->get_table_pos('glyf');
|
1003 |
-
if ($glyfLength < $this->maxStrLenRead) {
|
1004 |
-
$glyphData = $this->get_table('glyf');
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
$offsets = array();
|
1008 |
-
$glyf = '';
|
1009 |
-
$pos = 0;
|
1010 |
-
$hmtxstr = '';
|
1011 |
-
$xMinT = 0;
|
1012 |
-
$yMinT = 0;
|
1013 |
-
$xMaxT = 0;
|
1014 |
-
$yMaxT = 0;
|
1015 |
-
$advanceWidthMax = 0;
|
1016 |
-
$minLeftSideBearing = 0;
|
1017 |
-
$minRightSideBearing = 0;
|
1018 |
-
$xMaxExtent = 0;
|
1019 |
-
$maxPoints = 0; // points in non-compound glyph
|
1020 |
-
$maxContours = 0; // contours in non-compound glyph
|
1021 |
-
$maxComponentPoints = 0; // points in compound glyph
|
1022 |
-
$maxComponentContours = 0; // contours in compound glyph
|
1023 |
-
$maxComponentElements = 0; // number of glyphs referenced at top level
|
1024 |
-
$maxComponentDepth = 0; // levels of recursion, set to 0 if font has only simple glyphs
|
1025 |
-
$this->glyphdata = array();
|
1026 |
-
|
1027 |
-
foreach($subsetglyphs AS $originalGlyphIdx => $uni) {
|
1028 |
-
// hmtx - Horizontal Metrics
|
1029 |
-
$hm = $this->getHMetric($orignHmetrics, $originalGlyphIdx);
|
1030 |
-
$hmtxstr .= $hm;
|
1031 |
-
|
1032 |
-
$offsets[] = $pos;
|
1033 |
-
$glyphPos = $this->glyphPos[$originalGlyphIdx];
|
1034 |
-
$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
|
1035 |
-
if ($glyfLength < $this->maxStrLenRead) {
|
1036 |
-
$data = substr($glyphData,$glyphPos,$glyphLen);
|
1037 |
-
}
|
1038 |
-
else {
|
1039 |
-
if ($glyphLen > 0) $data = $this->get_chunk($glyfOffset+$glyphPos,$glyphLen);
|
1040 |
-
else $data = '';
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
if ($glyphLen > 0) {
|
1044 |
-
if (_RECALC_PROFILE) {
|
1045 |
-
$xMin = $this->unpack_short(substr($data,2,2));
|
1046 |
-
$yMin = $this->unpack_short(substr($data,4,2));
|
1047 |
-
$xMax = $this->unpack_short(substr($data,6,2));
|
1048 |
-
$yMax = $this->unpack_short(substr($data,8,2));
|
1049 |
-
$xMinT = min($xMinT,$xMin);
|
1050 |
-
$yMinT = min($yMinT,$yMin);
|
1051 |
-
$xMaxT = max($xMaxT,$xMax);
|
1052 |
-
$yMaxT = max($yMaxT,$yMax);
|
1053 |
-
$aw = $this->unpack_short(substr($hm,0,2));
|
1054 |
-
$lsb = $this->unpack_short(substr($hm,2,2));
|
1055 |
-
$advanceWidthMax = max($advanceWidthMax,$aw);
|
1056 |
-
$minLeftSideBearing = min($minLeftSideBearing,$lsb);
|
1057 |
-
$minRightSideBearing = min($minRightSideBearing,($aw - $lsb - ($xMax - $xMin)));
|
1058 |
-
$xMaxExtent = max($xMaxExtent,($lsb + ($xMax - $xMin)));
|
1059 |
-
}
|
1060 |
-
$up = unpack("n", substr($data,0,2));
|
1061 |
-
}
|
1062 |
-
if ($glyphLen > 2 && ($up[1] & (1 << 15)) ) { // If number of contours <= -1 i.e. composiste glyph
|
1063 |
-
$pos_in_glyph = 10;
|
1064 |
-
$flags = GF_MORE;
|
1065 |
-
$nComponentElements = 0;
|
1066 |
-
while ($flags & GF_MORE) {
|
1067 |
-
$nComponentElements += 1; // number of glyphs referenced at top level
|
1068 |
-
$up = unpack("n", substr($data,$pos_in_glyph,2));
|
1069 |
-
$flags = $up[1];
|
1070 |
-
$up = unpack("n", substr($data,$pos_in_glyph+2,2));
|
1071 |
-
$glyphIdx = $up[1];
|
1072 |
-
$this->glyphdata[$originalGlyphIdx]['compGlyphs'][] = $glyphIdx;
|
1073 |
-
$data = $this->_set_ushort($data, $pos_in_glyph + 2, $glyphSet[$glyphIdx]);
|
1074 |
-
$pos_in_glyph += 4;
|
1075 |
-
if ($flags & GF_WORDS) { $pos_in_glyph += 4; }
|
1076 |
-
else { $pos_in_glyph += 2; }
|
1077 |
-
if ($flags & GF_SCALE) { $pos_in_glyph += 2; }
|
1078 |
-
else if ($flags & GF_XYSCALE) { $pos_in_glyph += 4; }
|
1079 |
-
else if ($flags & GF_TWOBYTWO) { $pos_in_glyph += 8; }
|
1080 |
-
}
|
1081 |
-
$maxComponentElements = max($maxComponentElements, $nComponentElements);
|
1082 |
-
}
|
1083 |
-
// Simple Glyph
|
1084 |
-
else if (_RECALC_PROFILE && $glyphLen > 2 && $up[1] < (1 << 15) && $up[1] > 0) { // Number of contours > 0 simple glyph
|
1085 |
-
$nContours = $up[1];
|
1086 |
-
$this->glyphdata[$originalGlyphIdx]['nContours'] = $nContours;
|
1087 |
-
$maxContours = max($maxContours, $nContours);
|
1088 |
-
|
1089 |
-
// Count number of points in simple glyph
|
1090 |
-
$pos_in_glyph = 10 + ($nContours * 2) - 2; // Last endContourPoint
|
1091 |
-
$up = unpack("n", substr($data,$pos_in_glyph,2));
|
1092 |
-
$points = $up[1]+1;
|
1093 |
-
$this->glyphdata[$originalGlyphIdx]['nPoints'] = $points;
|
1094 |
-
$maxPoints = max($maxPoints, $points);
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
$glyf .= $data;
|
1098 |
-
$pos += $glyphLen;
|
1099 |
-
if ($pos % 4 != 0) {
|
1100 |
-
$padding = 4 - ($pos % 4);
|
1101 |
-
$glyf .= str_repeat("\0",$padding);
|
1102 |
-
$pos += $padding;
|
1103 |
-
}
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
if (_RECALC_PROFILE) {
|
1107 |
-
foreach($this->glyphdata AS $originalGlyphIdx => $val) {
|
1108 |
-
$maxdepth = $depth = -1;
|
1109 |
-
$points = 0;
|
1110 |
-
$contours = 0;
|
1111 |
-
$this->getGlyphData($originalGlyphIdx, $maxdepth, $depth, $points, $contours) ;
|
1112 |
-
$maxComponentDepth = max($maxComponentDepth , $maxdepth);
|
1113 |
-
$maxComponentPoints = max($maxComponentPoints , $points);
|
1114 |
-
$maxComponentContours = max($maxComponentContours , $contours);
|
1115 |
-
}
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
|
1119 |
-
$offsets[] = $pos;
|
1120 |
-
$this->add('glyf', $glyf);
|
1121 |
-
|
1122 |
-
///////////////////////////////////
|
1123 |
-
// hmtx - Horizontal Metrics
|
1124 |
-
///////////////////////////////////
|
1125 |
-
$this->add('hmtx', $hmtxstr);
|
1126 |
-
|
1127 |
-
|
1128 |
-
///////////////////////////////////
|
1129 |
-
// loca - Index to location
|
1130 |
-
///////////////////////////////////
|
1131 |
-
$locastr = '';
|
1132 |
-
if ((($pos + 1) >> 1) > 0xFFFF) {
|
1133 |
-
$indexToLocFormat = 1; // long format
|
1134 |
-
foreach($offsets AS $offset) { $locastr .= pack("N",$offset); }
|
1135 |
-
}
|
1136 |
-
else {
|
1137 |
-
$indexToLocFormat = 0; // short format
|
1138 |
-
foreach($offsets AS $offset) { $locastr .= pack("n",($offset/2)); }
|
1139 |
-
}
|
1140 |
-
$this->add('loca', $locastr);
|
1141 |
-
|
1142 |
-
///////////////////////////////////
|
1143 |
-
// head - Font header
|
1144 |
-
///////////////////////////////////
|
1145 |
-
$head = $this->get_table('head');
|
1146 |
-
$head = $this->_set_ushort($head, 50, $indexToLocFormat);
|
1147 |
-
if (_RECALC_PROFILE) {
|
1148 |
-
$head = $this->_set_short($head, 36, $xMinT); // for all glyph bounding boxes
|
1149 |
-
$head = $this->_set_short($head, 38, $yMinT); // for all glyph bounding boxes
|
1150 |
-
$head = $this->_set_short($head, 40, $xMaxT); // for all glyph bounding boxes
|
1151 |
-
$head = $this->_set_short($head, 42, $yMaxT); // for all glyph bounding boxes
|
1152 |
-
$head[17] = chr($head[17] & ~(1 << 4)); // Unset Bit 4 (as hdmx/LTSH tables not included)
|
1153 |
-
}
|
1154 |
-
$this->add('head', $head);
|
1155 |
-
|
1156 |
-
|
1157 |
-
///////////////////////////////////
|
1158 |
-
// hhea - Horizontal Header
|
1159 |
-
///////////////////////////////////
|
1160 |
-
$hhea = $this->get_table('hhea');
|
1161 |
-
$hhea = $this->_set_ushort($hhea, 34, $numberOfHMetrics);
|
1162 |
-
if (_RECALC_PROFILE) {
|
1163 |
-
$hhea = $this->_set_ushort($hhea, 10, $advanceWidthMax);
|
1164 |
-
$hhea = $this->_set_short($hhea, 12, $minLeftSideBearing);
|
1165 |
-
$hhea = $this->_set_short($hhea, 14, $minRightSideBearing);
|
1166 |
-
$hhea = $this->_set_short($hhea, 16, $xMaxExtent);
|
1167 |
-
}
|
1168 |
-
$this->add('hhea', $hhea);
|
1169 |
-
|
1170 |
-
///////////////////////////////////
|
1171 |
-
// maxp - Maximum Profile
|
1172 |
-
///////////////////////////////////
|
1173 |
-
$maxp = $this->get_table('maxp');
|
1174 |
-
$maxp = $this->_set_ushort($maxp, 4, $numGlyphs);
|
1175 |
-
if (_RECALC_PROFILE) {
|
1176 |
-
$maxp = $this->_set_ushort($maxp, 6, $maxPoints); // points in non-compound glyph
|
1177 |
-
$maxp = $this->_set_ushort($maxp, 8, $maxContours); // contours in non-compound glyph
|
1178 |
-
$maxp = $this->_set_ushort($maxp, 10, $maxComponentPoints); // points in compound glyph
|
1179 |
-
$maxp = $this->_set_ushort($maxp, 12, $maxComponentContours); // contours in compound glyph
|
1180 |
-
$maxp = $this->_set_ushort($maxp, 28, $maxComponentElements); // number of glyphs referenced at top level
|
1181 |
-
$maxp = $this->_set_ushort($maxp, 30, $maxComponentDepth); // levels of recursion, set to 0 if font has only simple glyphs
|
1182 |
-
}
|
1183 |
-
$this->add('maxp', $maxp);
|
1184 |
-
|
1185 |
-
|
1186 |
-
///////////////////////////////////
|
1187 |
-
// OS/2 - OS/2
|
1188 |
-
///////////////////////////////////
|
1189 |
-
if (isset($this->tables['OS/2'])) {
|
1190 |
-
$os2_offset = $this->seek_table("OS/2");
|
1191 |
-
if (_RECALC_PROFILE) {
|
1192 |
-
$fsSelection = $this->get_ushort($os2_offset+62);
|
1193 |
-
$fsSelection = ($fsSelection & ~(1 << 6)); // 2-byte bit field containing information concerning the nature of the font patterns
|
1194 |
-
// bit#0 = Italic; bit#5=Bold
|
1195 |
-
// Match name table's font subfamily string
|
1196 |
-
// Clear bit#6 used for 'Regular' and optional
|
1197 |
-
}
|
1198 |
-
|
1199 |
-
// NB Currently this method never subsets characters above BMP
|
1200 |
-
// Could set nonBMP bit according to $this->maxUni
|
1201 |
-
$nonBMP = $this->get_ushort($os2_offset+46);
|
1202 |
-
$nonBMP = ($nonBMP & ~(1 << 9)); // Unset Bit 57 (indicates non-BMP) - for interactive forms
|
1203 |
-
|
1204 |
-
$os2 = $this->get_table('OS/2');
|
1205 |
-
if (_RECALC_PROFILE) {
|
1206 |
-
$os2 = $this->_set_ushort($os2, 62, $fsSelection);
|
1207 |
-
$os2 = $this->_set_ushort($os2, 66, $fsLastCharIndex);
|
1208 |
-
$os2 = $this->_set_ushort($os2, 42, 0x0000); // ulCharRange (ulUnicodeRange) bits 24-31 | 16-23
|
1209 |
-
$os2 = $this->_set_ushort($os2, 44, 0x0000); // ulCharRange (Unicode ranges) bits 8-15 | 0-7
|
1210 |
-
$os2 = $this->_set_ushort($os2, 46, $nonBMP); // ulCharRange (Unicode ranges) bits 56-63 | 48-55
|
1211 |
-
$os2 = $this->_set_ushort($os2, 48, 0x0000); // ulCharRange (Unicode ranges) bits 40-47 | 32-39
|
1212 |
-
$os2 = $this->_set_ushort($os2, 50, 0x0000); // ulCharRange (Unicode ranges) bits 88-95 | 80-87
|
1213 |
-
$os2 = $this->_set_ushort($os2, 52, 0x0000); // ulCharRange (Unicode ranges) bits 72-79 | 64-71
|
1214 |
-
$os2 = $this->_set_ushort($os2, 54, 0x0000); // ulCharRange (Unicode ranges) bits 120-127 | 112-119
|
1215 |
-
$os2 = $this->_set_ushort($os2, 56, 0x0000); // ulCharRange (Unicode ranges) bits 104-111 | 96-103
|
1216 |
-
}
|
1217 |
-
$os2 = $this->_set_ushort($os2, 46, $nonBMP); // Unset Bit 57 (indicates non-BMP) - for interactive forms
|
1218 |
-
|
1219 |
-
$this->add('OS/2', $os2 );
|
1220 |
-
}
|
1221 |
-
|
1222 |
-
fclose($this->fh);
|
1223 |
-
// Put the TTF file together
|
1224 |
-
$stm = '';
|
1225 |
-
$this->endTTFile($stm);
|
1226 |
-
//file_put_contents('testfont.ttf', $stm); exit;
|
1227 |
-
return $stm ;
|
1228 |
-
}
|
1229 |
-
|
1230 |
-
//================================================================================
|
1231 |
-
|
1232 |
-
// Also does SMP
|
1233 |
-
function makeSubsetSIP($file, &$subset, $TTCfontID=0, $debug=false) {
|
1234 |
-
$this->fh = fopen($file ,'rb') or die('Can\'t open file ' . $file);
|
1235 |
-
$this->filename = $file;
|
1236 |
-
$this->_pos = 0;
|
1237 |
-
$this->unAGlyphs = false; // mPDF 5.4.05
|
1238 |
-
$this->charWidths = '';
|
1239 |
-
$this->glyphPos = array();
|
1240 |
-
$this->charToGlyph = array();
|
1241 |
-
$this->tables = array();
|
1242 |
-
$this->otables = array();
|
1243 |
-
$this->ascent = 0;
|
1244 |
-
$this->descent = 0;
|
1245 |
-
$this->numTTCFonts = 0;
|
1246 |
-
$this->TTCFonts = array();
|
1247 |
-
$this->skip(4);
|
1248 |
-
if ($TTCfontID > 0) {
|
1249 |
-
$this->version = $version = $this->read_ulong(); // TTC Header version now
|
1250 |
-
if (!in_array($version, array(0x00010000,0x00020000)))
|
1251 |
-
die("ERROR - Error parsing TrueType Collection: version=".$version." - " . $file);
|
1252 |
-
$this->numTTCFonts = $this->read_ulong();
|
1253 |
-
for ($i=1; $i<=$this->numTTCFonts; $i++) {
|
1254 |
-
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
|
1255 |
-
}
|
1256 |
-
$this->seek($this->TTCFonts[$TTCfontID]['offset']);
|
1257 |
-
$this->version = $version = $this->read_ulong(); // TTFont version again now
|
1258 |
-
}
|
1259 |
-
$this->readTableDirectory($debug);
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
///////////////////////////////////
|
1264 |
-
// head - Font header table
|
1265 |
-
///////////////////////////////////
|
1266 |
-
$this->seek_table("head");
|
1267 |
-
$this->skip(50);
|
1268 |
-
$indexToLocFormat = $this->read_ushort();
|
1269 |
-
$glyphDataFormat = $this->read_ushort();
|
1270 |
-
|
1271 |
-
///////////////////////////////////
|
1272 |
-
// hhea - Horizontal header table
|
1273 |
-
///////////////////////////////////
|
1274 |
-
$this->seek_table("hhea");
|
1275 |
-
$this->skip(32);
|
1276 |
-
$metricDataFormat = $this->read_ushort();
|
1277 |
-
$orignHmetrics = $numberOfHMetrics = $this->read_ushort();
|
1278 |
-
|
1279 |
-
///////////////////////////////////
|
1280 |
-
// maxp - Maximum profile table
|
1281 |
-
///////////////////////////////////
|
1282 |
-
$this->seek_table("maxp");
|
1283 |
-
$this->skip(4);
|
1284 |
-
$numGlyphs = $this->read_ushort();
|
1285 |
-
|
1286 |
-
|
1287 |
-
///////////////////////////////////
|
1288 |
-
// cmap - Character to glyph index mapping table
|
1289 |
-
///////////////////////////////////
|
1290 |
-
|
1291 |
-
$cmap_offset = $this->seek_table("cmap");
|
1292 |
-
$this->skip(2);
|
1293 |
-
$cmapTableCount = $this->read_ushort();
|
1294 |
-
$unicode_cmap_offset = 0;
|
1295 |
-
for ($i=0;$i<$cmapTableCount;$i++) {
|
1296 |
-
$platformID = $this->read_ushort();
|
1297 |
-
$encodingID = $this->read_ushort();
|
1298 |
-
$offset = $this->read_ulong();
|
1299 |
-
$save_pos = $this->_pos;
|
1300 |
-
if (($platformID == 3 && $encodingID == 10) || $platformID == 0) { // Microsoft, Unicode Format 12 table HKCS
|
1301 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
1302 |
-
if ($format == 12) {
|
1303 |
-
$unicode_cmap_offset = $cmap_offset + $offset;
|
1304 |
-
break;
|
1305 |
-
}
|
1306 |
-
}
|
1307 |
-
$this->seek($save_pos );
|
1308 |
-
}
|
1309 |
-
|
1310 |
-
if (!$unicode_cmap_offset)
|
1311 |
-
die('Font does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
|
1312 |
-
// Format 12 CMAP does characters above Unicode BMP i.e. some HKCS characters U+20000 and above
|
1313 |
-
if ($format == 12) {
|
1314 |
-
$this->maxUniChar = 0;
|
1315 |
-
$this->seek($unicode_cmap_offset + 4);
|
1316 |
-
$length = $this->read_ulong();
|
1317 |
-
$limit = $unicode_cmap_offset + $length;
|
1318 |
-
$this->skip(4);
|
1319 |
-
|
1320 |
-
$nGroups = $this->read_ulong();
|
1321 |
-
|
1322 |
-
$glyphToChar = array();
|
1323 |
-
$charToGlyph = array();
|
1324 |
-
for($i=0; $i<$nGroups ; $i++) {
|
1325 |
-
$startCharCode = $this->read_ulong();
|
1326 |
-
$endCharCode = $this->read_ulong();
|
1327 |
-
$startGlyphCode = $this->read_ulong();
|
1328 |
-
$offset = 0;
|
1329 |
-
for ($unichar=$startCharCode;$unichar<=$endCharCode;$unichar++) {
|
1330 |
-
$glyph = $startGlyphCode + $offset ;
|
1331 |
-
$offset++;
|
1332 |
-
$charToGlyph[$unichar] = $glyph;
|
1333 |
-
if ($unichar < 196608) { $this->maxUniChar = max($unichar,$this->maxUniChar); }
|
1334 |
-
$glyphToChar[$glyph][] = $unichar;
|
1335 |
-
}
|
1336 |
-
}
|
1337 |
-
}
|
1338 |
-
else
|
1339 |
-
die('Font does not have cmap for Unicode (format 12)');
|
1340 |
-
|
1341 |
-
|
1342 |
-
///////////////////////////////////
|
1343 |
-
// hmtx - Horizontal metrics table
|
1344 |
-
///////////////////////////////////
|
1345 |
-
$scale = 1; // not used here
|
1346 |
-
$this->getHMTX($numberOfHMetrics, $numGlyphs, $glyphToChar, $scale);
|
1347 |
-
|
1348 |
-
///////////////////////////////////
|
1349 |
-
// loca - Index to location
|
1350 |
-
///////////////////////////////////
|
1351 |
-
$this->getLOCA($indexToLocFormat, $numGlyphs);
|
1352 |
-
|
1353 |
-
///////////////////////////////////////////////////////////////////
|
1354 |
-
|
1355 |
-
$glyphMap = array(0=>0);
|
1356 |
-
$glyphSet = array(0=>0);
|
1357 |
-
$codeToGlyph = array();
|
1358 |
-
// Set a substitute if ASCII characters do not have glyphs
|
1359 |
-
if (isset($charToGlyph[0x3F])) { $subs = $charToGlyph[0x3F]; } // Question mark
|
1360 |
-
else { $subs = $charToGlyph[32]; }
|
1361 |
-
foreach($subset AS $code) {
|
1362 |
-
if (isset($charToGlyph[$code]))
|
1363 |
-
$originalGlyphIdx = $charToGlyph[$code];
|
1364 |
-
else if ($code<128) {
|
1365 |
-
$originalGlyphIdx = $subs;
|
1366 |
-
}
|
1367 |
-
else { $originalGlyphIdx = 0; }
|
1368 |
-
if (!isset($glyphSet[$originalGlyphIdx])) {
|
1369 |
-
$glyphSet[$originalGlyphIdx] = count($glyphMap);
|
1370 |
-
$glyphMap[] = $originalGlyphIdx;
|
1371 |
-
}
|
1372 |
-
$codeToGlyph[$code] = $glyphSet[$originalGlyphIdx];
|
1373 |
-
}
|
1374 |
-
|
1375 |
-
list($start,$dummy) = $this->get_table_pos('glyf');
|
1376 |
-
|
1377 |
-
$n = 0;
|
1378 |
-
while ($n < count($glyphMap)) {
|
1379 |
-
$originalGlyphIdx = $glyphMap[$n];
|
1380 |
-
$glyphPos = $this->glyphPos[$originalGlyphIdx];
|
1381 |
-
$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
|
1382 |
-
$n += 1;
|
1383 |
-
if (!$glyphLen) continue;
|
1384 |
-
$this->seek($start + $glyphPos);
|
1385 |
-
$numberOfContours = $this->read_short();
|
1386 |
-
if ($numberOfContours < 0) {
|
1387 |
-
$this->skip(8);
|
1388 |
-
$flags = GF_MORE;
|
1389 |
-
while ($flags & GF_MORE) {
|
1390 |
-
$flags = $this->read_ushort();
|
1391 |
-
$glyphIdx = $this->read_ushort();
|
1392 |
-
if (!isset($glyphSet[$glyphIdx])) {
|
1393 |
-
$glyphSet[$glyphIdx] = count($glyphMap);
|
1394 |
-
$glyphMap[] = $glyphIdx;
|
1395 |
-
}
|
1396 |
-
if ($flags & GF_WORDS)
|
1397 |
-
$this->skip(4);
|
1398 |
-
else
|
1399 |
-
$this->skip(2);
|
1400 |
-
if ($flags & GF_SCALE)
|
1401 |
-
$this->skip(2);
|
1402 |
-
else if ($flags & GF_XYSCALE)
|
1403 |
-
$this->skip(4);
|
1404 |
-
else if ($flags & GF_TWOBYTWO)
|
1405 |
-
$this->skip(8);
|
1406 |
-
}
|
1407 |
-
}
|
1408 |
-
}
|
1409 |
-
|
1410 |
-
$numGlyphs = $n = count($glyphMap);
|
1411 |
-
$numberOfHMetrics = $n;
|
1412 |
-
|
1413 |
-
///////////////////////////////////
|
1414 |
-
// name
|
1415 |
-
///////////////////////////////////
|
1416 |
-
// Needs to have a name entry in 3,0 (e.g. symbol) - original font will be 3,1 (i.e. Unicode)
|
1417 |
-
$name = $this->get_table('name');
|
1418 |
-
$name_offset = $this->seek_table("name");
|
1419 |
-
$format = $this->read_ushort();
|
1420 |
-
$numRecords = $this->read_ushort();
|
1421 |
-
$string_data_offset = $name_offset + $this->read_ushort();
|
1422 |
-
for ($i=0;$i<$numRecords; $i++) {
|
1423 |
-
$platformId = $this->read_ushort();
|
1424 |
-
$encodingId = $this->read_ushort();
|
1425 |
-
if ($platformId == 3 && $encodingId == 1) {
|
1426 |
-
$pos = 6 + ($i * 12) + 2;
|
1427 |
-
$name = $this->_set_ushort($name, $pos, 0x00); // Change encoding to 3,0 rather than 3,1
|
1428 |
-
}
|
1429 |
-
$this->skip(8);
|
1430 |
-
}
|
1431 |
-
$this->add('name', $name);
|
1432 |
-
|
1433 |
-
///////////////////////////////////
|
1434 |
-
// OS/2
|
1435 |
-
///////////////////////////////////
|
1436 |
-
if (isset($this->tables['OS/2'])) {
|
1437 |
-
$os2 = $this->get_table('OS/2');
|
1438 |
-
$os2 = $this->_set_ushort($os2, 42, 0x00); // ulCharRange (Unicode ranges)
|
1439 |
-
$os2 = $this->_set_ushort($os2, 44, 0x00); // ulCharRange (Unicode ranges)
|
1440 |
-
$os2 = $this->_set_ushort($os2, 46, 0x00); // ulCharRange (Unicode ranges)
|
1441 |
-
$os2 = $this->_set_ushort($os2, 48, 0x00); // ulCharRange (Unicode ranges)
|
1442 |
-
|
1443 |
-
$os2 = $this->_set_ushort($os2, 50, 0x00); // ulCharRange (Unicode ranges)
|
1444 |
-
$os2 = $this->_set_ushort($os2, 52, 0x00); // ulCharRange (Unicode ranges)
|
1445 |
-
$os2 = $this->_set_ushort($os2, 54, 0x00); // ulCharRange (Unicode ranges)
|
1446 |
-
$os2 = $this->_set_ushort($os2, 56, 0x00); // ulCharRange (Unicode ranges)
|
1447 |
-
// Set Symbol character only in ulCodePageRange
|
1448 |
-
$os2 = $this->_set_ushort($os2, 78, 0x8000); // ulCodePageRange = Bit #31 Symbol **** 78 = Bit 16-31
|
1449 |
-
$os2 = $this->_set_ushort($os2, 80, 0x0000); // ulCodePageRange = Bit #31 Symbol **** 80 = Bit 0-15
|
1450 |
-
$os2 = $this->_set_ushort($os2, 82, 0x0000); // ulCodePageRange = Bit #32- Symbol **** 82 = Bits 48-63
|
1451 |
-
$os2 = $this->_set_ushort($os2, 84, 0x0000); // ulCodePageRange = Bit #32- Symbol **** 84 = Bits 32-47
|
1452 |
-
|
1453 |
-
$os2 = $this->_set_ushort($os2, 64, 0x01); // FirstCharIndex
|
1454 |
-
$os2 = $this->_set_ushort($os2, 66, count($subset)); // LastCharIndex
|
1455 |
-
// Set PANOSE first bit to 5 for Symbol
|
1456 |
-
$os2 = $this->splice($os2, 32, chr(5).chr(0).chr(1).chr(0).chr(1).chr(0).chr(0).chr(0).chr(0).chr(0));
|
1457 |
-
$this->add('OS/2', $os2 );
|
1458 |
-
}
|
1459 |
-
|
1460 |
-
|
1461 |
-
///////////////////////////////////
|
1462 |
-
//tables copied from the original
|
1463 |
-
///////////////////////////////////
|
1464 |
-
$tags = array ('cvt ', 'fpgm', 'prep', 'gasp');
|
1465 |
-
foreach($tags AS $tag) { // 1.02
|
1466 |
-
if (isset($this->tables[$tag])) { $this->add($tag, $this->get_table($tag)); }
|
1467 |
-
}
|
1468 |
-
|
1469 |
-
///////////////////////////////////
|
1470 |
-
// post - PostScript
|
1471 |
-
///////////////////////////////////
|
1472 |
-
if (isset($this->tables['post'])) {
|
1473 |
-
$opost = $this->get_table('post');
|
1474 |
-
$post = "\x00\x03\x00\x00" . substr($opost,4,12) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
1475 |
-
}
|
1476 |
-
$this->add('post', $post);
|
1477 |
-
|
1478 |
-
///////////////////////////////////
|
1479 |
-
// hhea - Horizontal Header
|
1480 |
-
///////////////////////////////////
|
1481 |
-
$hhea = $this->get_table('hhea');
|
1482 |
-
$hhea = $this->_set_ushort($hhea, 34, $numberOfHMetrics);
|
1483 |
-
$this->add('hhea', $hhea);
|
1484 |
-
|
1485 |
-
///////////////////////////////////
|
1486 |
-
// maxp - Maximum Profile
|
1487 |
-
///////////////////////////////////
|
1488 |
-
$maxp = $this->get_table('maxp');
|
1489 |
-
$maxp = $this->_set_ushort($maxp, 4, $numGlyphs);
|
1490 |
-
$this->add('maxp', $maxp);
|
1491 |
-
|
1492 |
-
|
1493 |
-
///////////////////////////////////
|
1494 |
-
// CMap table Formats [1,0,]6 and [3,0,]4
|
1495 |
-
///////////////////////////////////
|
1496 |
-
///////////////////////////////////
|
1497 |
-
// Sort CID2GID map into segments of contiguous codes
|
1498 |
-
///////////////////////////////////
|
1499 |
-
$rangeid = 0;
|
1500 |
-
$range = array();
|
1501 |
-
$prevcid = -2;
|
1502 |
-
$prevglidx = -1;
|
1503 |
-
// for each character
|
1504 |
-
foreach ($subset as $cid => $code) {
|
1505 |
-
$glidx = $codeToGlyph[$code];
|
1506 |
-
if ($cid == ($prevcid + 1) && $glidx == ($prevglidx + 1)) {
|
1507 |
-
$range[$rangeid][] = $glidx;
|
1508 |
-
} else {
|
1509 |
-
// new range
|
1510 |
-
$rangeid = $cid;
|
1511 |
-
$range[$rangeid] = array();
|
1512 |
-
$range[$rangeid][] = $glidx;
|
1513 |
-
}
|
1514 |
-
$prevcid = $cid;
|
1515 |
-
$prevglidx = $glidx;
|
1516 |
-
}
|
1517 |
-
// cmap - Character to glyph mapping
|
1518 |
-
$segCount = count($range) + 1; // + 1 Last segment has missing character 0xFFFF
|
1519 |
-
$searchRange = 1;
|
1520 |
-
$entrySelector = 0;
|
1521 |
-
while ($searchRange * 2 <= $segCount ) {
|
1522 |
-
$searchRange = $searchRange * 2;
|
1523 |
-
$entrySelector = $entrySelector + 1;
|
1524 |
-
}
|
1525 |
-
$searchRange = $searchRange * 2;
|
1526 |
-
$rangeShift = $segCount * 2 - $searchRange;
|
1527 |
-
$length = 16 + (8*$segCount ) + ($numGlyphs+1);
|
1528 |
-
$cmap = array(
|
1529 |
-
4, $length, 0, // Format 4 Mapping subtable: format, length, language
|
1530 |
-
$segCount*2,
|
1531 |
-
$searchRange,
|
1532 |
-
$entrySelector,
|
1533 |
-
$rangeShift);
|
1534 |
-
|
1535 |
-
// endCode(s)
|
1536 |
-
foreach($range AS $start=>$subrange) {
|
1537 |
-
$endCode = $start + (count($subrange)-1);
|
1538 |
-
$cmap[] = $endCode; // endCode(s)
|
1539 |
-
}
|
1540 |
-
$cmap[] = 0xFFFF; // endCode of last Segment
|
1541 |
-
$cmap[] = 0; // reservedPad
|
1542 |
-
|
1543 |
-
// startCode(s)
|
1544 |
-
foreach($range AS $start=>$subrange) {
|
1545 |
-
$cmap[] = $start; // startCode(s)
|
1546 |
-
}
|
1547 |
-
$cmap[] = 0xFFFF; // startCode of last Segment
|
1548 |
-
// idDelta(s)
|
1549 |
-
foreach($range AS $start=>$subrange) {
|
1550 |
-
$idDelta = -($start-$subrange[0]);
|
1551 |
-
$n += count($subrange);
|
1552 |
-
$cmap[] = $idDelta; // idDelta(s)
|
1553 |
-
}
|
1554 |
-
$cmap[] = 1; // idDelta of last Segment
|
1555 |
-
// idRangeOffset(s)
|
1556 |
-
foreach($range AS $subrange) {
|
1557 |
-
$cmap[] = 0; // idRangeOffset[segCount] Offset in bytes to glyph indexArray, or 0
|
1558 |
-
|
1559 |
-
}
|
1560 |
-
$cmap[] = 0; // idRangeOffset of last Segment
|
1561 |
-
foreach($range AS $subrange) {
|
1562 |
-
foreach($subrange AS $glidx) {
|
1563 |
-
$cmap[] = $glidx;
|
1564 |
-
}
|
1565 |
-
}
|
1566 |
-
$cmap[] = 0; // Mapping for last character
|
1567 |
-
$cmapstr4 = '';
|
1568 |
-
foreach($cmap AS $cm) { $cmapstr4 .= pack("n",$cm); }
|
1569 |
-
|
1570 |
-
///////////////////////////////////
|
1571 |
-
// cmap - Character to glyph mapping
|
1572 |
-
///////////////////////////////////
|
1573 |
-
$entryCount = count($subset);
|
1574 |
-
$length = 10 + $entryCount * 2;
|
1575 |
-
|
1576 |
-
$off = 20 + $length;
|
1577 |
-
$hoff = $off >> 16;
|
1578 |
-
$loff = $off & 0xFFFF;
|
1579 |
-
|
1580 |
-
$cmap = array(0, 2, // Index : version, number of subtables
|
1581 |
-
1, 0, // Subtable : platform, encoding
|
1582 |
-
0, 20, // offset (hi,lo)
|
1583 |
-
3, 0, // Subtable : platform, encoding
|
1584 |
-
$hoff, $loff, // offset (hi,lo)
|
1585 |
-
6, $length, // Format 6 Mapping table: format, length
|
1586 |
-
0, 1, // language, First char code
|
1587 |
-
$entryCount
|
1588 |
-
);
|
1589 |
-
$cmapstr = '';
|
1590 |
-
foreach($subset AS $code) { $cmap[] = $codeToGlyph[$code]; }
|
1591 |
-
foreach($cmap AS $cm) { $cmapstr .= pack("n",$cm); }
|
1592 |
-
$cmapstr .= $cmapstr4;
|
1593 |
-
$this->add('cmap', $cmapstr);
|
1594 |
-
|
1595 |
-
///////////////////////////////////
|
1596 |
-
// hmtx - Horizontal Metrics
|
1597 |
-
///////////////////////////////////
|
1598 |
-
$hmtxstr = '';
|
1599 |
-
for($n=0;$n<$numGlyphs;$n++) {
|
1600 |
-
$originalGlyphIdx = $glyphMap[$n];
|
1601 |
-
$hm = $this->getHMetric($orignHmetrics, $originalGlyphIdx);
|
1602 |
-
$hmtxstr .= $hm;
|
1603 |
-
}
|
1604 |
-
$this->add('hmtx', $hmtxstr);
|
1605 |
-
|
1606 |
-
///////////////////////////////////
|
1607 |
-
// glyf - Glyph data
|
1608 |
-
///////////////////////////////////
|
1609 |
-
list($glyfOffset,$glyfLength) = $this->get_table_pos('glyf');
|
1610 |
-
if ($glyfLength < $this->maxStrLenRead) {
|
1611 |
-
$glyphData = $this->get_table('glyf');
|
1612 |
-
}
|
1613 |
-
|
1614 |
-
$offsets = array();
|
1615 |
-
$glyf = '';
|
1616 |
-
$pos = 0;
|
1617 |
-
for ($n=0;$n<$numGlyphs;$n++) {
|
1618 |
-
$offsets[] = $pos;
|
1619 |
-
$originalGlyphIdx = $glyphMap[$n];
|
1620 |
-
$glyphPos = $this->glyphPos[$originalGlyphIdx];
|
1621 |
-
$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
|
1622 |
-
if ($glyfLength < $this->maxStrLenRead) {
|
1623 |
-
$data = substr($glyphData,$glyphPos,$glyphLen);
|
1624 |
-
}
|
1625 |
-
else {
|
1626 |
-
if ($glyphLen > 0) $data = $this->get_chunk($glyfOffset+$glyphPos,$glyphLen);
|
1627 |
-
else $data = '';
|
1628 |
-
}
|
1629 |
-
if ($glyphLen > 0) $up = unpack("n", substr($data,0,2));
|
1630 |
-
if ($glyphLen > 2 && ($up[1] & (1 << 15)) ) {
|
1631 |
-
$pos_in_glyph = 10;
|
1632 |
-
$flags = GF_MORE;
|
1633 |
-
while ($flags & GF_MORE) {
|
1634 |
-
$up = unpack("n", substr($data,$pos_in_glyph,2));
|
1635 |
-
$flags = $up[1];
|
1636 |
-
$up = unpack("n", substr($data,$pos_in_glyph+2,2));
|
1637 |
-
$glyphIdx = $up[1];
|
1638 |
-
$data = $this->_set_ushort($data, $pos_in_glyph + 2, $glyphSet[$glyphIdx]);
|
1639 |
-
$pos_in_glyph += 4;
|
1640 |
-
if ($flags & GF_WORDS) { $pos_in_glyph += 4; }
|
1641 |
-
else { $pos_in_glyph += 2; }
|
1642 |
-
if ($flags & GF_SCALE) { $pos_in_glyph += 2; }
|
1643 |
-
else if ($flags & GF_XYSCALE) { $pos_in_glyph += 4; }
|
1644 |
-
else if ($flags & GF_TWOBYTWO) { $pos_in_glyph += 8; }
|
1645 |
-
}
|
1646 |
-
}
|
1647 |
-
$glyf .= $data;
|
1648 |
-
$pos += $glyphLen;
|
1649 |
-
if ($pos % 4 != 0) {
|
1650 |
-
$padding = 4 - ($pos % 4);
|
1651 |
-
$glyf .= str_repeat("\0",$padding);
|
1652 |
-
$pos += $padding;
|
1653 |
-
}
|
1654 |
-
}
|
1655 |
-
$offsets[] = $pos;
|
1656 |
-
$this->add('glyf', $glyf);
|
1657 |
-
|
1658 |
-
///////////////////////////////////
|
1659 |
-
// loca - Index to location
|
1660 |
-
///////////////////////////////////
|
1661 |
-
$locastr = '';
|
1662 |
-
if ((($pos + 1) >> 1) > 0xFFFF) {
|
1663 |
-
$indexToLocFormat = 1; // long format
|
1664 |
-
foreach($offsets AS $offset) { $locastr .= pack("N",$offset); }
|
1665 |
-
}
|
1666 |
-
else {
|
1667 |
-
$indexToLocFormat = 0; // short format
|
1668 |
-
foreach($offsets AS $offset) { $locastr .= pack("n",($offset/2)); }
|
1669 |
-
}
|
1670 |
-
$this->add('loca', $locastr);
|
1671 |
-
|
1672 |
-
///////////////////////////////////
|
1673 |
-
// head - Font header
|
1674 |
-
///////////////////////////////////
|
1675 |
-
$head = $this->get_table('head');
|
1676 |
-
$head = $this->_set_ushort($head, 50, $indexToLocFormat);
|
1677 |
-
$this->add('head', $head);
|
1678 |
-
|
1679 |
-
fclose($this->fh);
|
1680 |
-
|
1681 |
-
// Put the TTF file together
|
1682 |
-
$stm = '';
|
1683 |
-
$this->endTTFile($stm);
|
1684 |
-
//file_put_contents('testfont.ttf', $stm); exit;
|
1685 |
-
return $stm ;
|
1686 |
-
}
|
1687 |
-
|
1688 |
-
//////////////////////////////////////////////////////////////////////////////////
|
1689 |
-
// Recursively get composite glyph data
|
1690 |
-
function getGlyphData($originalGlyphIdx, &$maxdepth, &$depth, &$points, &$contours) {
|
1691 |
-
$depth++;
|
1692 |
-
$maxdepth = max($maxdepth, $depth);
|
1693 |
-
if (count($this->glyphdata[$originalGlyphIdx]['compGlyphs'])) {
|
1694 |
-
foreach($this->glyphdata[$originalGlyphIdx]['compGlyphs'] AS $glyphIdx) {
|
1695 |
-
$this->getGlyphData($glyphIdx, $maxdepth, $depth, $points, $contours);
|
1696 |
-
}
|
1697 |
-
}
|
1698 |
-
else if (($this->glyphdata[$originalGlyphIdx]['nContours'] > 0) && $depth > 0) { // simple
|
1699 |
-
$contours += $this->glyphdata[$originalGlyphIdx]['nContours'];
|
1700 |
-
$points += $this->glyphdata[$originalGlyphIdx]['nPoints'];
|
1701 |
-
}
|
1702 |
-
$depth--;
|
1703 |
-
}
|
1704 |
-
|
1705 |
-
|
1706 |
-
//////////////////////////////////////////////////////////////////////////////////
|
1707 |
-
// Recursively get composite glyphs
|
1708 |
-
function getGlyphs($originalGlyphIdx, &$start, &$glyphSet, &$subsetglyphs) {
|
1709 |
-
$glyphPos = $this->glyphPos[$originalGlyphIdx];
|
1710 |
-
$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
|
1711 |
-
if (!$glyphLen) {
|
1712 |
-
return;
|
1713 |
-
}
|
1714 |
-
$this->seek($start + $glyphPos);
|
1715 |
-
$numberOfContours = $this->read_short();
|
1716 |
-
if ($numberOfContours < 0) {
|
1717 |
-
$this->skip(8);
|
1718 |
-
$flags = GF_MORE;
|
1719 |
-
while ($flags & GF_MORE) {
|
1720 |
-
$flags = $this->read_ushort();
|
1721 |
-
$glyphIdx = $this->read_ushort();
|
1722 |
-
if (!isset($glyphSet[$glyphIdx])) {
|
1723 |
-
$glyphSet[$glyphIdx] = count($subsetglyphs); // old glyphID to new glyphID
|
1724 |
-
$subsetglyphs[$glyphIdx] = true;
|
1725 |
-
}
|
1726 |
-
$savepos = ftell($this->fh);
|
1727 |
-
$this->getGlyphs($glyphIdx, $start, $glyphSet, $subsetglyphs);
|
1728 |
-
$this->seek($savepos);
|
1729 |
-
if ($flags & GF_WORDS)
|
1730 |
-
$this->skip(4);
|
1731 |
-
else
|
1732 |
-
$this->skip(2);
|
1733 |
-
if ($flags & GF_SCALE)
|
1734 |
-
$this->skip(2);
|
1735 |
-
else if ($flags & GF_XYSCALE)
|
1736 |
-
$this->skip(4);
|
1737 |
-
else if ($flags & GF_TWOBYTWO)
|
1738 |
-
$this->skip(8);
|
1739 |
-
}
|
1740 |
-
}
|
1741 |
-
}
|
1742 |
-
|
1743 |
-
//////////////////////////////////////////////////////////////////////////////////
|
1744 |
-
|
1745 |
-
function getHMTX($numberOfHMetrics, $numGlyphs, &$glyphToChar, $scale) {
|
1746 |
-
$start = $this->seek_table("hmtx");
|
1747 |
-
$aw = 0;
|
1748 |
-
$this->charWidths = str_pad('', 256*256*2, "\x00");
|
1749 |
-
if ($this->maxUniChar > 65536) { $this->charWidths .= str_pad('', 256*256*2, "\x00"); } // Plane 1 SMP
|
1750 |
-
if ($this->maxUniChar > 131072) { $this->charWidths .= str_pad('', 256*256*2, "\x00"); } // Plane 2 SMP
|
1751 |
-
$nCharWidths = 0;
|
1752 |
-
if (($numberOfHMetrics*4) < $this->maxStrLenRead) {
|
1753 |
-
$data = $this->get_chunk($start,($numberOfHMetrics*4));
|
1754 |
-
$arr = unpack("n*", $data);
|
1755 |
-
}
|
1756 |
-
else { $this->seek($start); }
|
1757 |
-
for( $glyph=0; $glyph<$numberOfHMetrics; $glyph++) {
|
1758 |
-
if (($numberOfHMetrics*4) < $this->maxStrLenRead) {
|
1759 |
-
$aw = $arr[($glyph*2)+1];
|
1760 |
-
}
|
1761 |
-
else {
|
1762 |
-
$aw = $this->read_ushort();
|
1763 |
-
$lsb = $this->read_ushort();
|
1764 |
-
}
|
1765 |
-
if (isset($glyphToChar[$glyph]) || $glyph == 0) {
|
1766 |
-
|
1767 |
-
if ($aw >= (1 << 15) ) { $aw = 0; } // 1.03 Some (arabic) fonts have -ve values for width
|
1768 |
-
// although should be unsigned value - comes out as e.g. 65108 (intended -50)
|
1769 |
-
if ($glyph == 0) {
|
1770 |
-
$this->defaultWidth = $scale*$aw;
|
1771 |
-
continue;
|
1772 |
-
}
|
1773 |
-
foreach($glyphToChar[$glyph] AS $char) {
|
1774 |
-
//$this->charWidths[$char] = intval(round($scale*$aw));
|
1775 |
-
if ($char != 0 && $char != 65535) {
|
1776 |
-
$w = intval(round($scale*$aw));
|
1777 |
-
if ($w == 0) { $w = 65535; }
|
1778 |
-
if ($char < 196608) {
|
1779 |
-
$this->charWidths[$char*2] = chr($w >> 8);
|
1780 |
-
$this->charWidths[$char*2 + 1] = chr($w & 0xFF);
|
1781 |
-
$nCharWidths++;
|
1782 |
-
}
|
1783 |
-
}
|
1784 |
-
}
|
1785 |
-
}
|
1786 |
-
}
|
1787 |
-
$data = $this->get_chunk(($start+$numberOfHMetrics*4),($numGlyphs*2));
|
1788 |
-
$arr = unpack("n*", $data);
|
1789 |
-
$diff = $numGlyphs-$numberOfHMetrics;
|
1790 |
-
$w = intval(round($scale*$aw));
|
1791 |
-
if ($w == 0) { $w = 65535; }
|
1792 |
-
for( $pos=0; $pos<$diff; $pos++) {
|
1793 |
-
$glyph = $pos + $numberOfHMetrics;
|
1794 |
-
if (isset($glyphToChar[$glyph])) {
|
1795 |
-
foreach($glyphToChar[$glyph] AS $char) {
|
1796 |
-
if ($char != 0 && $char != 65535) {
|
1797 |
-
if ($char < 196608) {
|
1798 |
-
$this->charWidths[$char*2] = chr($w >> 8);
|
1799 |
-
$this->charWidths[$char*2 + 1] = chr($w & 0xFF);
|
1800 |
-
$nCharWidths++;
|
1801 |
-
}
|
1802 |
-
}
|
1803 |
-
}
|
1804 |
-
}
|
1805 |
-
}
|
1806 |
-
// NB 65535 is a set width of 0
|
1807 |
-
// First bytes define number of chars in font
|
1808 |
-
$this->charWidths[0] = chr($nCharWidths >> 8);
|
1809 |
-
$this->charWidths[1] = chr($nCharWidths & 0xFF);
|
1810 |
-
}
|
1811 |
-
|
1812 |
-
function getHMetric($numberOfHMetrics, $gid) {
|
1813 |
-
$start = $this->seek_table("hmtx");
|
1814 |
-
if ($gid < $numberOfHMetrics) {
|
1815 |
-
$this->seek($start+($gid*4));
|
1816 |
-
$hm = fread($this->fh,4);
|
1817 |
-
}
|
1818 |
-
else {
|
1819 |
-
$this->seek($start+(($numberOfHMetrics-1)*4));
|
1820 |
-
$hm = fread($this->fh,2);
|
1821 |
-
$this->seek($start+($numberOfHMetrics*2)+($gid*2));
|
1822 |
-
$hm .= fread($this->fh,2);
|
1823 |
-
}
|
1824 |
-
return $hm;
|
1825 |
-
}
|
1826 |
-
|
1827 |
-
function getLOCA($indexToLocFormat, $numGlyphs) {
|
1828 |
-
$start = $this->seek_table('loca');
|
1829 |
-
$this->glyphPos = array();
|
1830 |
-
if ($indexToLocFormat == 0) {
|
1831 |
-
$data = $this->get_chunk($start,($numGlyphs*2)+2);
|
1832 |
-
$arr = unpack("n*", $data);
|
1833 |
-
for ($n=0; $n<=$numGlyphs; $n++) {
|
1834 |
-
$this->glyphPos[] = ($arr[$n+1] * 2);
|
1835 |
-
}
|
1836 |
-
}
|
1837 |
-
else if ($indexToLocFormat == 1) {
|
1838 |
-
$data = $this->get_chunk($start,($numGlyphs*4)+4);
|
1839 |
-
$arr = unpack("N*", $data);
|
1840 |
-
for ($n=0; $n<=$numGlyphs; $n++) {
|
1841 |
-
$this->glyphPos[] = ($arr[$n+1]);
|
1842 |
-
}
|
1843 |
-
}
|
1844 |
-
else
|
1845 |
-
die('Unknown location table format '.$indexToLocFormat);
|
1846 |
-
}
|
1847 |
-
|
1848 |
-
|
1849 |
-
// CMAP Format 4
|
1850 |
-
function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph ) {
|
1851 |
-
$this->maxUniChar = 0;
|
1852 |
-
$this->seek($unicode_cmap_offset + 2);
|
1853 |
-
$length = $this->read_ushort();
|
1854 |
-
$limit = $unicode_cmap_offset + $length;
|
1855 |
-
$this->skip(2);
|
1856 |
-
|
1857 |
-
$segCount = $this->read_ushort() / 2;
|
1858 |
-
$this->skip(6);
|
1859 |
-
$endCount = array();
|
1860 |
-
for($i=0; $i<$segCount; $i++) { $endCount[] = $this->read_ushort(); }
|
1861 |
-
$this->skip(2);
|
1862 |
-
$startCount = array();
|
1863 |
-
for($i=0; $i<$segCount; $i++) { $startCount[] = $this->read_ushort(); }
|
1864 |
-
$idDelta = array();
|
1865 |
-
for($i=0; $i<$segCount; $i++) { $idDelta[] = $this->read_short(); } // ???? was unsigned short
|
1866 |
-
$idRangeOffset_start = $this->_pos;
|
1867 |
-
$idRangeOffset = array();
|
1868 |
-
for($i=0; $i<$segCount; $i++) { $idRangeOffset[] = $this->read_ushort(); }
|
1869 |
-
|
1870 |
-
for ($n=0;$n<$segCount;$n++) {
|
1871 |
-
$endpoint = ($endCount[$n] + 1);
|
1872 |
-
for ($unichar=$startCount[$n];$unichar<$endpoint;$unichar++) {
|
1873 |
-
if ($idRangeOffset[$n] == 0)
|
1874 |
-
$glyph = ($unichar + $idDelta[$n]) & 0xFFFF;
|
1875 |
-
else {
|
1876 |
-
$offset = ($unichar - $startCount[$n]) * 2 + $idRangeOffset[$n];
|
1877 |
-
$offset = $idRangeOffset_start + 2 * $n + $offset;
|
1878 |
-
if ($offset >= $limit)
|
1879 |
-
$glyph = 0;
|
1880 |
-
else {
|
1881 |
-
$glyph = $this->get_ushort($offset);
|
1882 |
-
if ($glyph != 0)
|
1883 |
-
$glyph = ($glyph + $idDelta[$n]) & 0xFFFF;
|
1884 |
-
}
|
1885 |
-
}
|
1886 |
-
$charToGlyph[$unichar] = $glyph;
|
1887 |
-
if ($unichar < 196608) { $this->maxUniChar = max($unichar,$this->maxUniChar); }
|
1888 |
-
$glyphToChar[$glyph][] = $unichar;
|
1889 |
-
}
|
1890 |
-
}
|
1891 |
-
|
1892 |
-
// mPDF 5.4.05
|
1893 |
-
if ($this->unAGlyphs) {
|
1894 |
-
if (isset($this->tables['post'])) {
|
1895 |
-
$this->seek_table("post");
|
1896 |
-
$formata = $this->read_ushort();
|
1897 |
-
$formatb = $this->read_ushort();
|
1898 |
-
// Only works on Format 2.0
|
1899 |
-
if ($formata != 2 || $formatb != 0) { die("Cannot set unAGlyphs for this font (".$file."). POST table must be in Format 2."); }
|
1900 |
-
$this->skip(28);
|
1901 |
-
$nGlyfs = $this->read_ushort();
|
1902 |
-
$glyphNameIndex = array();
|
1903 |
-
for ($i=0; $i<$nGlyfs; $i++) {
|
1904 |
-
$glyphNameIndex[($this->read_ushort())] = $i;
|
1905 |
-
}
|
1906 |
-
|
1907 |
-
$opost = $this->get_table('post');
|
1908 |
-
$ptr = 34+($nGlyfs*2);
|
1909 |
-
for ($i=0; $i<$nGlyfs; $i++) {
|
1910 |
-
$len = ord(substr($opost,$ptr,1));
|
1911 |
-
$ptr++;
|
1912 |
-
$name = substr($opost,$ptr,$len);
|
1913 |
-
$gid = $glyphNameIndex[$i+258];
|
1914 |
-
// Select uni0600.xxx(x) - uni06FF.xxx(x)
|
1915 |
-
if (preg_match('/^uni(06[0-9a-f]{2})\.(fina|medi|init|fin|med|ini)$/i',$name,$m)) {
|
1916 |
-
if (!isset($glyphToChar[$gid]) || (isset($glyphToChar[$gid]) && is_array($glyphToChar[$gid]) && count($glyphToChar[$gid])==1 && $glyphToChar[$gid][0]>57343 && $glyphToChar[$gid][0]<63489)) { // if set in PUA private use area E000-F8FF, or NOT Unicode mapped
|
1917 |
-
$uni = hexdec($m[1]);
|
1918 |
-
$form = strtoupper(substr($m[2],0,1));
|
1919 |
-
// Assign new PUA Unicode between F500 - F7FF
|
1920 |
-
$bit = $uni & 0xFF;
|
1921 |
-
if ($form == 'I') { $bit += 0xF600; }
|
1922 |
-
else if ($form == 'M') { $bit += 0xF700; }
|
1923 |
-
else { $bit += 0xF500; }
|
1924 |
-
// ADD TO CMAP
|
1925 |
-
$glyphToChar[$gid][] = $bit;
|
1926 |
-
$charToGlyph[$bit] = $gid;
|
1927 |
-
}
|
1928 |
-
}
|
1929 |
-
// LAM with ALEF ligatures (Mandatory ligatures)
|
1930 |
-
else if (preg_match('/^uni064406(22|23|25|27)(\.fina|\.fin){0,1}$/i',$name,$m)) {
|
1931 |
-
if ($m[1]=='22') {
|
1932 |
-
if ($m[2]) { $uni = hexdec('FEF6'); } else { $uni = hexdec('FEF5'); }
|
1933 |
-
}
|
1934 |
-
else if ($m[1]=='23') {
|
1935 |
-
if ($m[2]) { $uni = hexdec('FEF8'); } else { $uni = hexdec('FEF7'); }
|
1936 |
-
}
|
1937 |
-
else if ($m[1]=='25') {
|
1938 |
-
if ($m[2]) { $uni = hexdec('FEFA'); } else { $uni = hexdec('FEF9'); }
|
1939 |
-
}
|
1940 |
-
else if ($m[1]=='27') {
|
1941 |
-
if ($m[2]) { $uni = hexdec('FEFC'); } else { $uni = hexdec('FEFB'); }
|
1942 |
-
}
|
1943 |
-
if (!isset($glyphToChar[$gid]) || (isset($glyphToChar[$gid]) && is_array($glyphToChar[$gid]) && count($glyphToChar[$gid])==1 && $glyphToChar[$gid][0]>57343 && $glyphToChar[$gid][0]<63489)) { // if set in PUA private use area E000-F8FF, or NOT Unicode mapped
|
1944 |
-
// ADD TO CMAP
|
1945 |
-
$glyphToChar[$gid][] = $uni;
|
1946 |
-
$charToGlyph[$uni] = $gid;
|
1947 |
-
}
|
1948 |
-
}
|
1949 |
-
$ptr += $len;
|
1950 |
-
}
|
1951 |
-
}
|
1952 |
-
}
|
1953 |
-
|
1954 |
-
}
|
1955 |
-
|
1956 |
-
|
1957 |
-
// Put the TTF file together
|
1958 |
-
function endTTFile(&$stm) {
|
1959 |
-
$stm = '';
|
1960 |
-
$numTables = count($this->otables);
|
1961 |
-
$searchRange = 1;
|
1962 |
-
$entrySelector = 0;
|
1963 |
-
while ($searchRange * 2 <= $numTables) {
|
1964 |
-
$searchRange = $searchRange * 2;
|
1965 |
-
$entrySelector = $entrySelector + 1;
|
1966 |
-
}
|
1967 |
-
$searchRange = $searchRange * 16;
|
1968 |
-
$rangeShift = $numTables * 16 - $searchRange;
|
1969 |
-
|
1970 |
-
// Header
|
1971 |
-
if (_TTF_MAC_HEADER) {
|
1972 |
-
$stm .= (pack("Nnnnn", 0x74727565, $numTables, $searchRange, $entrySelector, $rangeShift)); // Mac
|
1973 |
-
}
|
1974 |
-
else {
|
1975 |
-
$stm .= (pack("Nnnnn", 0x00010000 , $numTables, $searchRange, $entrySelector, $rangeShift)); // Windows
|
1976 |
-
}
|
1977 |
-
|
1978 |
-
// Table directory
|
1979 |
-
$tables = $this->otables;
|
1980 |
-
ksort ($tables);
|
1981 |
-
$offset = 12 + $numTables * 16;
|
1982 |
-
foreach ($tables AS $tag=>$data) {
|
1983 |
-
if ($tag == 'head') { $head_start = $offset; }
|
1984 |
-
$stm .= $tag;
|
1985 |
-
$checksum = $this->calcChecksum($data);
|
1986 |
-
$stm .= pack("nn", $checksum[0],$checksum[1]);
|
1987 |
-
$stm .= pack("NN", $offset, strlen($data));
|
1988 |
-
$paddedLength = (strlen($data)+3)&~3;
|
1989 |
-
$offset = $offset + $paddedLength;
|
1990 |
-
}
|
1991 |
-
|
1992 |
-
// Table data
|
1993 |
-
foreach ($tables AS $tag=>$data) {
|
1994 |
-
$data .= "\0\0\0";
|
1995 |
-
$stm .= substr($data,0,(strlen($data)&~3));
|
1996 |
-
}
|
1997 |
-
|
1998 |
-
$checksum = $this->calcChecksum($stm);
|
1999 |
-
$checksum = $this->sub32(array(0xB1B0,0xAFBA), $checksum);
|
2000 |
-
$chk = pack("nn", $checksum[0],$checksum[1]);
|
2001 |
-
$stm = $this->splice($stm,($head_start + 8),$chk);
|
2002 |
-
return $stm ;
|
2003 |
-
}
|
2004 |
-
|
2005 |
-
|
2006 |
-
function repackageTTF($file, $TTCfontID=0, $debug=false, $unAGlyphs=false) { // mPDF 5.4.05
|
2007 |
-
$this->unAGlyphs = $unAGlyphs; // mPDF 5.4.05
|
2008 |
-
$this->filename = $file;
|
2009 |
-
$this->fh = fopen($file ,'rb') or die('Can\'t open file ' . $file);
|
2010 |
-
$this->_pos = 0;
|
2011 |
-
$this->charWidths = '';
|
2012 |
-
$this->glyphPos = array();
|
2013 |
-
$this->charToGlyph = array();
|
2014 |
-
$this->tables = array();
|
2015 |
-
$this->otables = array();
|
2016 |
-
$this->ascent = 0;
|
2017 |
-
$this->descent = 0;
|
2018 |
-
$this->numTTCFonts = 0;
|
2019 |
-
$this->TTCFonts = array();
|
2020 |
-
$this->skip(4);
|
2021 |
-
$this->maxUni = 0;
|
2022 |
-
if ($TTCfontID > 0) {
|
2023 |
-
$this->version = $version = $this->read_ulong(); // TTC Header version now
|
2024 |
-
if (!in_array($version, array(0x00010000,0x00020000)))
|
2025 |
-
die("ERROR - Error parsing TrueType Collection: version=".$version." - " . $file);
|
2026 |
-
$this->numTTCFonts = $this->read_ulong();
|
2027 |
-
for ($i=1; $i<=$this->numTTCFonts; $i++) {
|
2028 |
-
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
|
2029 |
-
}
|
2030 |
-
$this->seek($this->TTCFonts[$TTCfontID]['offset']);
|
2031 |
-
$this->version = $version = $this->read_ulong(); // TTFont version again now
|
2032 |
-
}
|
2033 |
-
$this->readTableDirectory($debug);
|
2034 |
-
$tags = array ('OS/2', 'cmap', 'glyf', 'head', 'hhea', 'hmtx', 'loca', 'maxp', 'name', 'post', 'cvt ', 'fpgm', 'gasp', 'prep');
|
2035 |
-
/*
|
2036 |
-
Tables which require glyphIndex
|
2037 |
-
hdmx
|
2038 |
-
kern
|
2039 |
-
LTSH
|
2040 |
-
|
2041 |
-
Tables which do NOT require glyphIndex
|
2042 |
-
VDMX
|
2043 |
-
|
2044 |
-
GDEF
|
2045 |
-
GPOS
|
2046 |
-
GSUB
|
2047 |
-
JSTF
|
2048 |
-
|
2049 |
-
DSIG
|
2050 |
-
PCLT - not recommended
|
2051 |
-
*/
|
2052 |
-
|
2053 |
-
foreach($tags AS $tag) {
|
2054 |
-
if (isset($this->tables[$tag])) { $this->add($tag, $this->get_table($tag)); }
|
2055 |
-
}
|
2056 |
-
fclose($this->fh);
|
2057 |
-
$stm = '';
|
2058 |
-
$this->endTTFile($stm);
|
2059 |
-
return $stm ;
|
2060 |
-
}
|
2061 |
-
|
2062 |
-
|
2063 |
-
}
|
2064 |
-
|
2065 |
-
|
2066 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/ttfontsuni_analysis.php
DELETED
@@ -1,463 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once(_MPDF_PATH.'classes/ttfontsuni.php');
|
4 |
-
|
5 |
-
class TTFontFile_Analysis EXTENDS TTFontFile {
|
6 |
-
|
7 |
-
// Used to get font information from files in directory
|
8 |
-
function extractCoreInfo($file, $TTCfontID=0) {
|
9 |
-
$this->filename = $file;
|
10 |
-
$this->fh = fopen($file,'rb');
|
11 |
-
if (!$this->fh) { return ('ERROR - Can\'t open file ' . $file); }
|
12 |
-
$this->_pos = 0;
|
13 |
-
$this->charWidths = '';
|
14 |
-
$this->glyphPos = array();
|
15 |
-
$this->charToGlyph = array();
|
16 |
-
$this->tables = array();
|
17 |
-
$this->otables = array();
|
18 |
-
$this->ascent = 0;
|
19 |
-
$this->descent = 0;
|
20 |
-
$this->numTTCFonts = 0;
|
21 |
-
$this->TTCFonts = array();
|
22 |
-
$this->version = $version = $this->read_ulong();
|
23 |
-
$this->panose = array(); // mPDF 5.0
|
24 |
-
if ($version==0x4F54544F)
|
25 |
-
return("ERROR - NOT ADDED as Postscript outlines are not supported - " . $file);
|
26 |
-
if ($version==0x74746366) {
|
27 |
-
if ($TTCfontID > 0) {
|
28 |
-
$this->version = $version = $this->read_ulong(); // TTC Header version now
|
29 |
-
if (!in_array($version, array(0x00010000,0x00020000)))
|
30 |
-
return("ERROR - NOT ADDED as Error parsing TrueType Collection: version=".$version." - " . $file);
|
31 |
-
}
|
32 |
-
else return("ERROR - Error parsing TrueType Collection - " . $file);
|
33 |
-
$this->numTTCFonts = $this->read_ulong();
|
34 |
-
for ($i=1; $i<=$this->numTTCFonts; $i++) {
|
35 |
-
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
|
36 |
-
}
|
37 |
-
$this->seek($this->TTCFonts[$TTCfontID]['offset']);
|
38 |
-
$this->version = $version = $this->read_ulong(); // TTFont version again now
|
39 |
-
$this->readTableDirectory(false);
|
40 |
-
}
|
41 |
-
else {
|
42 |
-
if (!in_array($version, array(0x00010000,0x74727565)))
|
43 |
-
return("ERROR - NOT ADDED as Not a TrueType font: version=".$version." - " . $file);
|
44 |
-
$this->readTableDirectory(false);
|
45 |
-
}
|
46 |
-
|
47 |
-
/* Included for testing...
|
48 |
-
$cmap_offset = $this->seek_table("cmap");
|
49 |
-
$this->skip(2);
|
50 |
-
$cmapTableCount = $this->read_ushort();
|
51 |
-
$unicode_cmap_offset = 0;
|
52 |
-
for ($i=0;$i<$cmapTableCount;$i++) {
|
53 |
-
$x[$i]['platformId'] = $this->read_ushort();
|
54 |
-
$x[$i]['encodingId'] = $this->read_ushort();
|
55 |
-
$x[$i]['offset'] = $this->read_ulong();
|
56 |
-
$save_pos = $this->_pos;
|
57 |
-
$x[$i]['format'] = $this->get_ushort($cmap_offset + $x[$i]['offset'] );
|
58 |
-
$this->seek($save_pos );
|
59 |
-
}
|
60 |
-
print_r($x); exit;
|
61 |
-
*/
|
62 |
-
///////////////////////////////////
|
63 |
-
// name - Naming table
|
64 |
-
///////////////////////////////////
|
65 |
-
|
66 |
-
/* Test purposes - displays table of names
|
67 |
-
$name_offset = $this->seek_table("name");
|
68 |
-
$format = $this->read_ushort();
|
69 |
-
if ($format != 0 && $format != 1) // mPDF 5.3.73
|
70 |
-
die("Unknown name table format ".$format);
|
71 |
-
$numRecords = $this->read_ushort();
|
72 |
-
$string_data_offset = $name_offset + $this->read_ushort();
|
73 |
-
for ($i=0;$i<$numRecords; $i++) {
|
74 |
-
$x[$i]['platformId'] = $this->read_ushort();
|
75 |
-
$x[$i]['encodingId'] = $this->read_ushort();
|
76 |
-
$x[$i]['languageId'] = $this->read_ushort();
|
77 |
-
$x[$i]['nameId'] = $this->read_ushort();
|
78 |
-
$x[$i]['length'] = $this->read_ushort();
|
79 |
-
$x[$i]['offset'] = $this->read_ushort();
|
80 |
-
|
81 |
-
$N = '';
|
82 |
-
if ($x[$i]['platformId'] == 1 && $x[$i]['encodingId'] == 0 && $x[$i]['languageId'] == 0) { // Roman
|
83 |
-
$opos = $this->_pos;
|
84 |
-
$N = $this->get_chunk($string_data_offset + $x[$i]['offset'] , $x[$i]['length'] );
|
85 |
-
$this->_pos = $opos;
|
86 |
-
$this->seek($opos);
|
87 |
-
}
|
88 |
-
else { // Unicode
|
89 |
-
$opos = $this->_pos;
|
90 |
-
$this->seek($string_data_offset + $x[$i]['offset'] );
|
91 |
-
$length = $x[$i]['length'] ;
|
92 |
-
if ($length % 2 != 0)
|
93 |
-
$length -= 1;
|
94 |
-
// die("PostScript name is UTF-16BE string of odd length");
|
95 |
-
$length /= 2;
|
96 |
-
$N = '';
|
97 |
-
while ($length > 0) {
|
98 |
-
$char = $this->read_ushort();
|
99 |
-
$N .= (chr($char));
|
100 |
-
$length -= 1;
|
101 |
-
}
|
102 |
-
$this->_pos = $opos;
|
103 |
-
$this->seek($opos);
|
104 |
-
}
|
105 |
-
$x[$i]['names'][$nameId] = $N;
|
106 |
-
}
|
107 |
-
print_r($x); exit;
|
108 |
-
*/
|
109 |
-
|
110 |
-
$name_offset = $this->seek_table("name");
|
111 |
-
$format = $this->read_ushort();
|
112 |
-
if ($format != 0 && $format != 1) // mPDF 5.3.73
|
113 |
-
return("ERROR - NOT ADDED as Unknown name table format ".$format." - " . $file);
|
114 |
-
$numRecords = $this->read_ushort();
|
115 |
-
$string_data_offset = $name_offset + $this->read_ushort();
|
116 |
-
$names = array(1=>'',2=>'',3=>'',4=>'',6=>'');
|
117 |
-
$K = array_keys($names);
|
118 |
-
$nameCount = count($names);
|
119 |
-
for ($i=0;$i<$numRecords; $i++) {
|
120 |
-
$platformId = $this->read_ushort();
|
121 |
-
$encodingId = $this->read_ushort();
|
122 |
-
$languageId = $this->read_ushort();
|
123 |
-
$nameId = $this->read_ushort();
|
124 |
-
$length = $this->read_ushort();
|
125 |
-
$offset = $this->read_ushort();
|
126 |
-
if (!in_array($nameId,$K)) continue;
|
127 |
-
$N = '';
|
128 |
-
if ($platformId == 3 && $encodingId == 1 && $languageId == 0x409) { // Microsoft, Unicode, US English, PS Name
|
129 |
-
$opos = $this->_pos;
|
130 |
-
$this->seek($string_data_offset + $offset);
|
131 |
-
if ($length % 2 != 0)
|
132 |
-
$length += 1;
|
133 |
-
$length /= 2;
|
134 |
-
$N = '';
|
135 |
-
while ($length > 0) {
|
136 |
-
$char = $this->read_ushort();
|
137 |
-
$N .= (chr($char));
|
138 |
-
$length -= 1;
|
139 |
-
}
|
140 |
-
$this->_pos = $opos;
|
141 |
-
$this->seek($opos);
|
142 |
-
}
|
143 |
-
else if ($platformId == 1 && $encodingId == 0 && $languageId == 0) { // Macintosh, Roman, English, PS Name
|
144 |
-
$opos = $this->_pos;
|
145 |
-
$N = $this->get_chunk($string_data_offset + $offset, $length);
|
146 |
-
$this->_pos = $opos;
|
147 |
-
$this->seek($opos);
|
148 |
-
}
|
149 |
-
if ($N && $names[$nameId]=='') {
|
150 |
-
$names[$nameId] = $N;
|
151 |
-
$nameCount -= 1;
|
152 |
-
if ($nameCount==0) break;
|
153 |
-
}
|
154 |
-
}
|
155 |
-
if ($names[6])
|
156 |
-
$psName = preg_replace('/ /','-',$names[6]);
|
157 |
-
else if ($names[4])
|
158 |
-
$psName = preg_replace('/ /','-',$names[4]);
|
159 |
-
else if ($names[1])
|
160 |
-
$psName = preg_replace('/ /','-',$names[1]);
|
161 |
-
else
|
162 |
-
$psName = '';
|
163 |
-
if (!$names[1] && !$psName)
|
164 |
-
return("ERROR - NOT ADDED as Could not find valid font name - " . $file);
|
165 |
-
$this->name = $psName;
|
166 |
-
if ($names[1]) { $this->familyName = $names[1]; } else { $this->familyName = $psName; }
|
167 |
-
if ($names[2]) { $this->styleName = $names[2]; } else { $this->styleName = 'Regular'; }
|
168 |
-
|
169 |
-
///////////////////////////////////
|
170 |
-
// head - Font header table
|
171 |
-
///////////////////////////////////
|
172 |
-
$this->seek_table("head");
|
173 |
-
$ver_maj = $this->read_ushort();
|
174 |
-
$ver_min = $this->read_ushort();
|
175 |
-
if ($ver_maj != 1)
|
176 |
-
return('ERROR - NOT ADDED as Unknown head table version '. $ver_maj .'.'. $ver_min." - " . $file);
|
177 |
-
$this->fontRevision = $this->read_ushort() . $this->read_ushort();
|
178 |
-
$this->skip(4);
|
179 |
-
$magic = $this->read_ulong();
|
180 |
-
if ($magic != 0x5F0F3CF5)
|
181 |
-
return('ERROR - NOT ADDED as Invalid head table magic ' .$magic." - " . $file);
|
182 |
-
$this->skip(2);
|
183 |
-
$this->unitsPerEm = $unitsPerEm = $this->read_ushort();
|
184 |
-
$scale = 1000 / $unitsPerEm;
|
185 |
-
$this->skip(24);
|
186 |
-
$macStyle = $this->read_short();
|
187 |
-
$this->skip(4);
|
188 |
-
$indexLocFormat = $this->read_short();
|
189 |
-
|
190 |
-
///////////////////////////////////
|
191 |
-
// OS/2 - OS/2 and Windows metrics table
|
192 |
-
///////////////////////////////////
|
193 |
-
$sFamily = '';
|
194 |
-
$panose = '';
|
195 |
-
$fsSelection = '';
|
196 |
-
if (isset($this->tables["OS/2"])) {
|
197 |
-
$this->seek_table("OS/2");
|
198 |
-
$this->skip(30);
|
199 |
-
$sF = $this->read_short();
|
200 |
-
$sFamily = ($sF >> 8);
|
201 |
-
$this->_pos += 10; //PANOSE = 10 byte length
|
202 |
-
$panose = fread($this->fh,10);
|
203 |
-
$this->panose = array();
|
204 |
-
for ($p=0;$p<strlen($panose);$p++) { $this->panose[] = ord($panose[$p]); }
|
205 |
-
$this->skip(20);
|
206 |
-
$fsSelection = $this->read_short();
|
207 |
-
}
|
208 |
-
|
209 |
-
///////////////////////////////////
|
210 |
-
// post - PostScript table
|
211 |
-
///////////////////////////////////
|
212 |
-
$this->seek_table("post");
|
213 |
-
$this->skip(4);
|
214 |
-
$this->italicAngle = $this->read_short() + $this->read_ushort() / 65536.0;
|
215 |
-
$this->skip(4);
|
216 |
-
$isFixedPitch = $this->read_ulong();
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
///////////////////////////////////
|
221 |
-
// cmap - Character to glyph index mapping table
|
222 |
-
///////////////////////////////////
|
223 |
-
$cmap_offset = $this->seek_table("cmap");
|
224 |
-
$this->skip(2);
|
225 |
-
$cmapTableCount = $this->read_ushort();
|
226 |
-
$unicode_cmap_offset = 0;
|
227 |
-
for ($i=0;$i<$cmapTableCount;$i++) {
|
228 |
-
$platformID = $this->read_ushort();
|
229 |
-
$encodingID = $this->read_ushort();
|
230 |
-
$offset = $this->read_ulong();
|
231 |
-
$save_pos = $this->_pos;
|
232 |
-
if (($platformID == 3 && $encodingID == 1) || $platformID == 0) { // Microsoft, Unicode
|
233 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
234 |
-
if ($format == 4) {
|
235 |
-
if (!$unicode_cmap_offset) $unicode_cmap_offset = $cmap_offset + $offset;
|
236 |
-
}
|
237 |
-
}
|
238 |
-
else if ((($platformID == 3 && $encodingID == 10) || $platformID == 0)) { // Microsoft, Unicode Format 12 table HKCS
|
239 |
-
$format = $this->get_ushort($cmap_offset + $offset);
|
240 |
-
if ($format == 12) {
|
241 |
-
$unicode_cmap_offset = $cmap_offset + $offset;
|
242 |
-
break;
|
243 |
-
}
|
244 |
-
}
|
245 |
-
$this->seek($save_pos );
|
246 |
-
}
|
247 |
-
|
248 |
-
if (!$unicode_cmap_offset)
|
249 |
-
return('ERROR - Font ('.$this->filename .') NOT ADDED as it is not Unicode encoded, and cannot be used by mPDF');
|
250 |
-
|
251 |
-
$rtl = false;
|
252 |
-
$indic = false;
|
253 |
-
$cjk = false;
|
254 |
-
$sip = false;
|
255 |
-
$smp = false;
|
256 |
-
$pua = false;
|
257 |
-
$puaag = false;
|
258 |
-
$glyphToChar = array();
|
259 |
-
$unAGlyphs = '';
|
260 |
-
// Format 12 CMAP does characters above Unicode BMP i.e. some HKCS characters U+20000 and above
|
261 |
-
if ($format == 12) {
|
262 |
-
$this->seek($unicode_cmap_offset + 4);
|
263 |
-
$length = $this->read_ulong();
|
264 |
-
$limit = $unicode_cmap_offset + $length;
|
265 |
-
$this->skip(4);
|
266 |
-
$nGroups = $this->read_ulong();
|
267 |
-
for($i=0; $i<$nGroups ; $i++) {
|
268 |
-
$startCharCode = $this->read_ulong();
|
269 |
-
$endCharCode = $this->read_ulong();
|
270 |
-
$startGlyphCode = $this->read_ulong();
|
271 |
-
if (($endCharCode > 0x20000 && $endCharCode < 0x2A6DF) || ($endCharCode > 0x2F800 && $endCharCode < 0x2FA1F)) {
|
272 |
-
$sip = true;
|
273 |
-
}
|
274 |
-
if ($endCharCode > 0x10000 && $endCharCode < 0x1FFFF) {
|
275 |
-
$smp = true;
|
276 |
-
}
|
277 |
-
if (($endCharCode > 0x0590 && $endCharCode < 0x077F) || ($endCharCode > 0xFE70 && $endCharCode < 0xFEFF) || ($endCharCode > 0xFB50 && $endCharCode < 0xFDFF)) {
|
278 |
-
$rtl = true;
|
279 |
-
}
|
280 |
-
if ($endCharCode > 0x0900 && $endCharCode < 0x0DFF) {
|
281 |
-
$indic = true;
|
282 |
-
}
|
283 |
-
if ($endCharCode > 0xE000 && $endCharCode < 0xF8FF) {
|
284 |
-
$pua = true;
|
285 |
-
if ($endCharCode > 0xF500 && $endCharCode < 0xF7FF) {
|
286 |
-
$puaag = true;
|
287 |
-
}
|
288 |
-
}
|
289 |
-
if (($endCharCode > 0x2E80 && $endCharCode < 0x4DC0) || ($endCharCode > 0x4E00 && $endCharCode < 0xA4CF) || ($endCharCode > 0xAC00 && $endCharCode < 0xD7AF) || ($endCharCode > 0xF900 && $endCharCode < 0xFAFF) || ($endCharCode > 0xFE30 && $endCharCode < 0xFE4F)) {
|
290 |
-
$cjk = true;
|
291 |
-
}
|
292 |
-
|
293 |
-
$offset = 0;
|
294 |
-
// Get each glyphToChar - only point if going to analyse un-mapped Arabic Glyphs
|
295 |
-
if (isset($this->tables['post'])) {
|
296 |
-
for ($unichar=$startCharCode;$unichar<=$endCharCode;$unichar++) {
|
297 |
-
$glyph = $startGlyphCode + $offset ;
|
298 |
-
$offset++;
|
299 |
-
$glyphToChar[$glyph][] = $unichar;
|
300 |
-
}
|
301 |
-
}
|
302 |
-
|
303 |
-
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
else { // Format 4 CMap
|
308 |
-
$this->seek($unicode_cmap_offset + 2);
|
309 |
-
$length = $this->read_ushort();
|
310 |
-
$limit = $unicode_cmap_offset + $length;
|
311 |
-
$this->skip(2);
|
312 |
-
|
313 |
-
$segCount = $this->read_ushort() / 2;
|
314 |
-
$this->skip(6);
|
315 |
-
$endCount = array();
|
316 |
-
for($i=0; $i<$segCount; $i++) { $endCount[] = $this->read_ushort(); }
|
317 |
-
$this->skip(2);
|
318 |
-
$startCount = array();
|
319 |
-
for($i=0; $i<$segCount; $i++) { $startCount[] = $this->read_ushort(); }
|
320 |
-
$idDelta = array();
|
321 |
-
for($i=0; $i<$segCount; $i++) { $idDelta[] = $this->read_short(); }
|
322 |
-
$idRangeOffset_start = $this->_pos;
|
323 |
-
$idRangeOffset = array();
|
324 |
-
for($i=0; $i<$segCount; $i++) { $idRangeOffset[] = $this->read_ushort(); }
|
325 |
-
|
326 |
-
for ($n=0;$n<$segCount;$n++) {
|
327 |
-
if (($endCount[$n] > 0x0590 && $endCount[$n] < 0x077F) || ($endCount[$n] > 0xFE70 && $endCount[$n] < 0xFEFF) || ($endCount[$n] > 0xFB50 && $endCount[$n] < 0xFDFF)) {
|
328 |
-
$rtl = true;
|
329 |
-
}
|
330 |
-
if ($endCount[$n] > 0x0900 && $endCount[$n] < 0x0DFF) {
|
331 |
-
$indic = true;
|
332 |
-
}
|
333 |
-
if (($endCount[$n] > 0x2E80 && $endCount[$n] < 0x4DC0) || ($endCount[$n] > 0x4E00 && $endCount[$n] < 0xA4CF) || ($endCount[$n] > 0xAC00 && $endCount[$n] < 0xD7AF) || ($endCount[$n] > 0xF900 && $endCount[$n] < 0xFAFF) || ($endCount[$n] > 0xFE30 && $endCount[$n] < 0xFE4F)) {
|
334 |
-
$cjk = true;
|
335 |
-
}
|
336 |
-
if ($endCount[$n] > 0xE000 && $endCount[$n] < 0xF8FF) {
|
337 |
-
$pua = true;
|
338 |
-
if ($endCount[$n] > 0xF500 && $endCount[$n] < 0xF7FF) {
|
339 |
-
$puaag = true;
|
340 |
-
}
|
341 |
-
}
|
342 |
-
// Get each glyphToChar - only point if going to analyse un-mapped Arabic Glyphs
|
343 |
-
if (isset($this->tables['post'])) {
|
344 |
-
$endpoint = ($endCount[$n] + 1);
|
345 |
-
for ($unichar=$startCount[$n];$unichar<$endpoint;$unichar++) {
|
346 |
-
if ($idRangeOffset[$n] == 0)
|
347 |
-
$glyph = ($unichar + $idDelta[$n]) & 0xFFFF;
|
348 |
-
else {
|
349 |
-
$offset = ($unichar - $startCount[$n]) * 2 + $idRangeOffset[$n];
|
350 |
-
$offset = $idRangeOffset_start + 2 * $n + $offset;
|
351 |
-
if ($offset >= $limit)
|
352 |
-
$glyph = 0;
|
353 |
-
else {
|
354 |
-
$glyph = $this->get_ushort($offset);
|
355 |
-
if ($glyph != 0)
|
356 |
-
$glyph = ($glyph + $idDelta[$n]) & 0xFFFF;
|
357 |
-
}
|
358 |
-
}
|
359 |
-
$glyphToChar[$glyph][] = $unichar;
|
360 |
-
}
|
361 |
-
}
|
362 |
-
|
363 |
-
}
|
364 |
-
}
|
365 |
-
// 'POST' table for un-mapped arabic glyphs
|
366 |
-
if (isset($this->tables['post'])) {
|
367 |
-
$this->seek_table("post");
|
368 |
-
// Only works on Format 2.0
|
369 |
-
$formata = $this->read_ushort();
|
370 |
-
$formatb = $this->read_ushort();
|
371 |
-
if ($formata == 2 && $formatb == 0) {
|
372 |
-
$this->skip(28);
|
373 |
-
$nGlyfs = $this->read_ushort();
|
374 |
-
$glyphNameIndex = array();
|
375 |
-
for ($i=0; $i<$nGlyfs; $i++) {
|
376 |
-
$glyphNameIndex[($this->read_ushort())] = $i;
|
377 |
-
}
|
378 |
-
|
379 |
-
$opost = $this->get_table('post');
|
380 |
-
$ptr = 34+($nGlyfs*2);
|
381 |
-
for ($i=0; $i<$nGlyfs; $i++) {
|
382 |
-
$len = ord(substr($opost,$ptr,1));
|
383 |
-
$ptr++;
|
384 |
-
$name = substr($opost,$ptr,$len);
|
385 |
-
$gid = $glyphNameIndex[$i+258];
|
386 |
-
// Select uni0600.xxx(x) - uni06FF.xxx(x)
|
387 |
-
if (preg_match('/^uni(06[0-9a-f]{2})\.(fina|medi|init|fin|med|ini)$/i',$name,$m)) {
|
388 |
-
if (!isset($glyphToChar[$gid]) || (isset($glyphToChar[$gid]) && is_array($glyphToChar[$gid]) && count($glyphToChar[$gid])==1 && $glyphToChar[$gid][0]>57343 && $glyphToChar[$gid][0]<63489)) { // if set in PUA private use area E000-F8FF, or NOT Unicode mapped
|
389 |
-
$uni = hexdec($m[1]);
|
390 |
-
$form = strtoupper(substr($m[2],0,1));
|
391 |
-
// Assign new PUA Unicode between F500 - F7FF
|
392 |
-
$bit = $uni & 0xFF;
|
393 |
-
if ($form == 'I') { $bit += 0xF600; }
|
394 |
-
else if ($form == 'M') { $bit += 0xF700; }
|
395 |
-
else { $bit += 0xF500; }
|
396 |
-
$unAGlyphs .= $gid;
|
397 |
-
$name = 'uni'.strtoupper($m[1]).'.'.strtolower($m[2]);
|
398 |
-
$unAGlyphs .= ' : '.$name;
|
399 |
-
$unihexstr = $m[1];
|
400 |
-
$unAGlyphs .= ' : '.$unihexstr;
|
401 |
-
$unAGlyphs .= ' : '.$uni;
|
402 |
-
$unAGlyphs .= ' : '.$form;
|
403 |
-
// if already set in PUA private use area E000-F8FF
|
404 |
-
if (isset($glyphToChar[$gid]) && $glyphToChar[$gid][0]>57343 && $glyphToChar[$gid][0]<63489) {
|
405 |
-
$unAGlyphs .= ' : '.$glyphToChar[$gid][0].' {'.dechex($glyphToChar[$gid][0]).'}';
|
406 |
-
}
|
407 |
-
//else $unAGlyphs .= ':';
|
408 |
-
$unAGlyphs .= ' : '.strtoupper(dechex($bit));
|
409 |
-
$unAGlyphs .= '<br />';
|
410 |
-
}
|
411 |
-
}
|
412 |
-
$ptr += $len;
|
413 |
-
}
|
414 |
-
if ($unAGlyphs) {
|
415 |
-
$unAGlyphs = 'GID:Name:Unicode base Hex:Dec:Form:PUA Unicode<br />'.$unAGlyphs ;
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
$bold = false;
|
423 |
-
$italic = false;
|
424 |
-
$ftype = '';
|
425 |
-
if ($macStyle & (1 << 0)) { $bold = true; } // bit 0 bold
|
426 |
-
else if ($fsSelection & (1 << 5)) { $bold = true; } // 5 BOLD Characters are emboldened
|
427 |
-
|
428 |
-
if ($macStyle & (1 << 1)) { $italic = true; } // bit 1 italic
|
429 |
-
else if ($fsSelection & (1 << 0)) { $italic = true; } // 0 ITALIC Font contains Italic characters, otherwise they are upright
|
430 |
-
else if ($this->italicAngle <> 0) { $italic = true; }
|
431 |
-
|
432 |
-
if ($isFixedPitch ) { $ftype = 'mono'; }
|
433 |
-
else if ($sFamily >0 && $sFamily <8) { $ftype = 'serif'; }
|
434 |
-
else if ($sFamily ==8) { $ftype = 'sans'; }
|
435 |
-
else if ($sFamily ==10) { $ftype = 'cursive'; }
|
436 |
-
// Use PANOSE
|
437 |
-
if ($panose) {
|
438 |
-
$bFamilyType=ord($panose[0]);
|
439 |
-
if ($bFamilyType==2) {
|
440 |
-
$bSerifStyle=ord($panose[1]);
|
441 |
-
if (!$ftype) {
|
442 |
-
if ($bSerifStyle>1 && $bSerifStyle<11) { $ftype = 'serif'; }
|
443 |
-
else if ($bSerifStyle>10) { $ftype = 'sans'; }
|
444 |
-
}
|
445 |
-
$bProportion=ord($panose[3]);
|
446 |
-
if ($bProportion==9 || $bProportion==1) { $ftype = 'mono'; } // ==1 i.e. No Fit needed for OCR-a and -b
|
447 |
-
}
|
448 |
-
else if ($bFamilyType==3) {
|
449 |
-
$ftype = 'cursive';
|
450 |
-
}
|
451 |
-
}
|
452 |
-
|
453 |
-
fclose($this->fh);
|
454 |
-
return array($this->familyName, $bold, $italic, $ftype, $TTCfontID, $rtl, $indic, $cjk, $sip, $smp, $puaag, $pua, $unAGlyphs);
|
455 |
-
}
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
}
|
461 |
-
|
462 |
-
|
463 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/classes/wmf.php
DELETED
@@ -1,236 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class wmf {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
var $gdiObjectArray;
|
7 |
-
|
8 |
-
function wmf(&$mpdf) {
|
9 |
-
$this->mpdf = $mpdf;
|
10 |
-
}
|
11 |
-
|
12 |
-
|
13 |
-
function _getWMFimage($data) {
|
14 |
-
$k = _MPDFK;
|
15 |
-
|
16 |
-
$this->gdiObjectArray = array();
|
17 |
-
$a=unpack('stest',"\1\0");
|
18 |
-
if ($a['test']!=1)
|
19 |
-
return array(0, 'Error parsing WMF image - Big-endian architecture not supported');
|
20 |
-
// check for Aldus placeable metafile header
|
21 |
-
$key = unpack('Lmagic', substr($data, 0, 4));
|
22 |
-
$p = 18; // WMF header
|
23 |
-
if ($key['magic'] == (int)0x9AC6CDD7) { $p +=22; } // Aldus header
|
24 |
-
// define some state variables
|
25 |
-
$wo=null; // window origin
|
26 |
-
$we=null; // window extent
|
27 |
-
$polyFillMode = 0;
|
28 |
-
$nullPen = false;
|
29 |
-
$nullBrush = false;
|
30 |
-
$endRecord = false;
|
31 |
-
$wmfdata = '';
|
32 |
-
while ($p < strlen($data) && !$endRecord) {
|
33 |
-
$recordInfo = unpack('Lsize/Sfunc', substr($data, $p, 6)); $p += 6;
|
34 |
-
// size of record given in WORDs (= 2 bytes)
|
35 |
-
$size = $recordInfo['size'];
|
36 |
-
// func is number of GDI function
|
37 |
-
$func = $recordInfo['func'];
|
38 |
-
if ($size > 3) {
|
39 |
-
$parms = substr($data, $p, 2*($size-3)); $p += 2*($size-3);
|
40 |
-
}
|
41 |
-
switch ($func) {
|
42 |
-
case 0x020b: // SetWindowOrg
|
43 |
-
// do not allow window origin to be changed
|
44 |
-
// after drawing has begun
|
45 |
-
if (!$wmfdata)
|
46 |
-
$wo = array_reverse(unpack('s2', $parms));
|
47 |
-
break;
|
48 |
-
case 0x020c: // SetWindowExt
|
49 |
-
// do not allow window extent to be changed
|
50 |
-
// after drawing has begun
|
51 |
-
if (!$wmfdata)
|
52 |
-
$we = array_reverse(unpack('s2', $parms));
|
53 |
-
break;
|
54 |
-
case 0x02fc: // CreateBrushIndirect
|
55 |
-
$brush = unpack('sstyle/Cr/Cg/Cb/Ca/Shatch', $parms);
|
56 |
-
$brush['type'] = 'B';
|
57 |
-
$this->_AddGDIObject($brush);
|
58 |
-
break;
|
59 |
-
case 0x02fa: // CreatePenIndirect
|
60 |
-
$pen = unpack('Sstyle/swidth/sdummy/Cr/Cg/Cb/Ca', $parms);
|
61 |
-
// convert width from twips to user unit
|
62 |
-
$pen['width'] /= (20 * $k);
|
63 |
-
$pen['type'] = 'P';
|
64 |
-
$this->_AddGDIObject($pen);
|
65 |
-
break;
|
66 |
-
|
67 |
-
// MUST create other GDI objects even if we don't handle them
|
68 |
-
case 0x06fe: // CreateBitmap
|
69 |
-
case 0x02fd: // CreateBitmapIndirect
|
70 |
-
case 0x00f8: // CreateBrush
|
71 |
-
case 0x02fb: // CreateFontIndirect
|
72 |
-
case 0x00f7: // CreatePalette
|
73 |
-
case 0x01f9: // CreatePatternBrush
|
74 |
-
case 0x06ff: // CreateRegion
|
75 |
-
case 0x0142: // DibCreatePatternBrush
|
76 |
-
$dummyObject = array('type'=>'D');
|
77 |
-
$this->_AddGDIObject($dummyObject);
|
78 |
-
break;
|
79 |
-
case 0x0106: // SetPolyFillMode
|
80 |
-
$polyFillMode = unpack('smode', $parms);
|
81 |
-
$polyFillMode = $polyFillMode['mode'];
|
82 |
-
break;
|
83 |
-
case 0x01f0: // DeleteObject
|
84 |
-
$idx = unpack('Sidx', $parms);
|
85 |
-
$idx = $idx['idx'];
|
86 |
-
$this->_DeleteGDIObject($idx);
|
87 |
-
break;
|
88 |
-
case 0x012d: // SelectObject
|
89 |
-
$idx = unpack('Sidx', $parms);
|
90 |
-
$idx = $idx['idx'];
|
91 |
-
$obj = $this->_GetGDIObject($idx);
|
92 |
-
switch ($obj['type']) {
|
93 |
-
case 'B':
|
94 |
-
$nullBrush = false;
|
95 |
-
if ($obj['style'] == 1) { $nullBrush = true; }
|
96 |
-
else {
|
97 |
-
$wmfdata .= $this->mpdf->SetFColor($this->mpdf->ConvertColor('rgb('.$obj['r'].','.$obj['g'].','.$obj['b'].')'), true)."\n";
|
98 |
-
}
|
99 |
-
break;
|
100 |
-
case 'P':
|
101 |
-
$nullPen = false;
|
102 |
-
$dashArray = array();
|
103 |
-
// dash parameters are custom
|
104 |
-
switch ($obj['style']) {
|
105 |
-
case 0: // PS_SOLID
|
106 |
-
break;
|
107 |
-
case 1: // PS_DASH
|
108 |
-
$dashArray = array(3,1);
|
109 |
-
break;
|
110 |
-
case 2: // PS_DOT
|
111 |
-
$dashArray = array(0.5,0.5);
|
112 |
-
break;
|
113 |
-
case 3: // PS_DASHDOT
|
114 |
-
$dashArray = array(2,1,0.5,1);
|
115 |
-
break;
|
116 |
-
case 4: // PS_DASHDOTDOT
|
117 |
-
$dashArray = array(2,1,0.5,1,0.5,1);
|
118 |
-
break;
|
119 |
-
case 5: // PS_NULL
|
120 |
-
$nullPen = true;
|
121 |
-
break;
|
122 |
-
}
|
123 |
-
if (!$nullPen) {
|
124 |
-
$wmfdata .= $this->mpdf->SetDColor($this->mpdf->ConvertColor('rgb('.$obj['r'].','.$obj['g'].','.$obj['b'].')'), true)."\n";
|
125 |
-
$wmfdata .= sprintf("%.3F w\n",$obj['width']*$k);
|
126 |
-
}
|
127 |
-
if (!empty($dashArray)) {
|
128 |
-
$s = '[';
|
129 |
-
for ($i=0; $i<count($dashArray);$i++) {
|
130 |
-
$s .= $dashArray[$i] * $k;
|
131 |
-
if ($i != count($dashArray)-1) { $s .= ' '; }
|
132 |
-
}
|
133 |
-
$s .= '] 0 d';
|
134 |
-
$wmfdata .= $s."\n";
|
135 |
-
}
|
136 |
-
break;
|
137 |
-
}
|
138 |
-
break;
|
139 |
-
case 0x0325: // Polyline
|
140 |
-
case 0x0324: // Polygon
|
141 |
-
$coords = unpack('s'.($size-3), $parms);
|
142 |
-
$numpoints = $coords[1];
|
143 |
-
for ($i = $numpoints; $i > 0; $i--) {
|
144 |
-
$px = $coords[2*$i];
|
145 |
-
$py = $coords[2*$i+1];
|
146 |
-
|
147 |
-
if ($i < $numpoints) { $wmfdata .= $this->_LineTo($px, $py); }
|
148 |
-
else { $wmfdata .= $this->_MoveTo($px, $py); }
|
149 |
-
}
|
150 |
-
if ($func == 0x0325) { $op = 's'; }
|
151 |
-
else if ($func == 0x0324) {
|
152 |
-
if ($nullPen) {
|
153 |
-
if ($nullBrush) { $op = 'n'; } // no op
|
154 |
-
else { $op = 'f'; } // fill
|
155 |
-
}
|
156 |
-
else {
|
157 |
-
if ($nullBrush) { $op = 's'; } // stroke
|
158 |
-
else { $op = 'b'; } // stroke and fill
|
159 |
-
}
|
160 |
-
if ($polyFillMode==1 && ($op=='b' || $op=='f')) { $op .= '*'; } // use even-odd fill rule
|
161 |
-
}
|
162 |
-
$wmfdata .= $op."\n";
|
163 |
-
break;
|
164 |
-
case 0x0538: // PolyPolygon
|
165 |
-
$coords = unpack('s'.($size-3), $parms);
|
166 |
-
$numpolygons = $coords[1];
|
167 |
-
$adjustment = $numpolygons;
|
168 |
-
for ($j = 1; $j <= $numpolygons; $j++) {
|
169 |
-
$numpoints = $coords[$j + 1];
|
170 |
-
for ($i = $numpoints; $i > 0; $i--) {
|
171 |
-
$px = $coords[2*$i + $adjustment];
|
172 |
-
$py = $coords[2*$i+1 + $adjustment];
|
173 |
-
if ($i == $numpoints) { $wmfdata .= $this->_MoveTo($px, $py); }
|
174 |
-
else { $wmfdata .= $this->_LineTo($px, $py); }
|
175 |
-
}
|
176 |
-
$adjustment += $numpoints * 2;
|
177 |
-
}
|
178 |
-
|
179 |
-
if ($nullPen) {
|
180 |
-
if ($nullBrush) { $op = 'n'; } // no op
|
181 |
-
else { $op = 'f'; } // fill
|
182 |
-
}
|
183 |
-
else {
|
184 |
-
if ($nullBrush) { $op = 's'; } // stroke
|
185 |
-
else { $op = 'b'; } // stroke and fill
|
186 |
-
}
|
187 |
-
if ($polyFillMode==1 && ($op=='b' || $op=='f')) { $op .= '*'; } // use even-odd fill rule
|
188 |
-
$wmfdata .= $op."\n";
|
189 |
-
break;
|
190 |
-
case 0x0000:
|
191 |
-
$endRecord = true;
|
192 |
-
break;
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
|
197 |
-
return array(1,$wmfdata,$wo,$we);
|
198 |
-
}
|
199 |
-
|
200 |
-
|
201 |
-
function _MoveTo($x, $y) {
|
202 |
-
return "$x $y m\n";
|
203 |
-
}
|
204 |
-
|
205 |
-
// a line must have been started using _MoveTo() first
|
206 |
-
function _LineTo($x, $y) {
|
207 |
-
return "$x $y l\n";
|
208 |
-
}
|
209 |
-
|
210 |
-
function _AddGDIObject($obj) {
|
211 |
-
// find next available slot
|
212 |
-
$idx = 0;
|
213 |
-
if (!empty($this->gdiObjectArray)) {
|
214 |
-
$empty = false;
|
215 |
-
$i = 0;
|
216 |
-
while (!$empty) {
|
217 |
-
$empty = !isset($this->gdiObjectArray[$i]);
|
218 |
-
$i++;
|
219 |
-
}
|
220 |
-
$idx = $i-1;
|
221 |
-
}
|
222 |
-
$this->gdiObjectArray[$idx] = $obj;
|
223 |
-
}
|
224 |
-
|
225 |
-
function _GetGDIObject($idx) {
|
226 |
-
return $this->gdiObjectArray[$idx];
|
227 |
-
}
|
228 |
-
|
229 |
-
function _DeleteGDIObject($idx) {
|
230 |
-
unset($this->gdiObjectArray[$idx]);
|
231 |
-
}
|
232 |
-
|
233 |
-
|
234 |
-
}
|
235 |
-
|
236 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/compress.php
DELETED
@@ -1,172 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$excl = array( 'HTML-CSS', 'DIRECTW', 'TABLES', 'LISTS', 'IMAGES-CORE',
|
4 |
-
'IMAGES-BMP', 'IMAGES-WMF', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'COLUMNS', 'TOC', 'INDEX', 'BOOKMARKS', 'BARCODES', 'FORMS', 'WATERMARK', 'CJK-FONTS', 'RTL', 'INDIC', 'ANNOTATIONS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS', 'HYPHENATION', 'ENCRYPTION', 'IMPORTS', 'PROGRESS-BAR');
|
5 |
-
|
6 |
-
|
7 |
-
// *DIRECTW* = Write, WriteText, WriteCell, Text, Shaded_box, AutosizeText
|
8 |
-
// IMAGES-CORE = [PNG, GIF, and JPG] NB background-images and watermark images
|
9 |
-
|
10 |
-
// Excluding 'HTML-CSS' will also exclude: 'TABLES', 'LISTS', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'FORMS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS'
|
11 |
-
|
12 |
-
// Text is marked in mpdf_source.php with e.g. :
|
13 |
-
/*-- TABLES-ADVANCED-BORDERS --*/
|
14 |
-
/*-- END TABLES-ADVANCED-BORDERS --*/
|
15 |
-
// *TABLES-ADVANCED-BORDERS*
|
16 |
-
|
17 |
-
|
18 |
-
if (!isset($_POST['generate']) || $_POST['generate']!='generate') {
|
19 |
-
|
20 |
-
|
21 |
-
if (!file_exists('mpdf_source.php')) {
|
22 |
-
die("ERROR - Could not find mpdf_source.php file in current directory. Please rename mpdf.php as mpdf_source.php");
|
23 |
-
}
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
echo '<html>
|
29 |
-
<head>
|
30 |
-
<script language=javascript>
|
31 |
-
checked=false;
|
32 |
-
function checkedAll (frm1) {
|
33 |
-
var aa= document.getElementById("frm1");
|
34 |
-
if (checked == false)
|
35 |
-
{
|
36 |
-
checked = true
|
37 |
-
}
|
38 |
-
else
|
39 |
-
{
|
40 |
-
checked = false
|
41 |
-
}
|
42 |
-
for (var i =0; i < aa.elements.length; i++)
|
43 |
-
{
|
44 |
-
aa.elements[i].checked = checked;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
</script>
|
48 |
-
</head>
|
49 |
-
<body>
|
50 |
-
<p><span style="color:red; font-weight: bold;">WARNING</span>: This utility will OVERWRITE mpdf.php file in the current directory.</p>
|
51 |
-
<p>Select the functions you wish to INCLUDE in your mpdf.php program. When you click generate, a new mpdf.php file will be written to the current directory.</p>
|
52 |
-
<div><b>Notes</b>
|
53 |
-
<ul>
|
54 |
-
<li>HTML-CSS is required for many of the other functions to work including: Tables, Lists, Backgrounds, Forms, Border-radius and all other CSS</li>
|
55 |
-
<li>DIRECTW includes the functions to Write directly to the PDF file e.g. Write, WriteText, WriteCell, Text, Shaded_box, AutosizeText</li>
|
56 |
-
<li>You must include either HTML-CSS or DIRECTW</li>
|
57 |
-
<li>JPG, PNG and JPG images are supported with IMAGES-CORE</li>
|
58 |
-
<li>For WMF Images, you must include both IMAGES-CORE and IMAGES-WMF</li>
|
59 |
-
<li>IMAGES-CORE are required for BACKGROUNDS (IMAGES) or WATERMARKS to work</li>
|
60 |
-
</ul>
|
61 |
-
</div>
|
62 |
-
<input type="checkbox" name="checkall" onclick="checkedAll(frm1);"> <i>Select/Unselect All</i><br /><br />
|
63 |
-
|
64 |
-
<form id="frm1" action="compress.php" method="POST">
|
65 |
-
';
|
66 |
-
foreach($excl AS $k=>$ex) {
|
67 |
-
echo '<input type="checkbox" value="1" name="inc['.$ex.']"';
|
68 |
-
if ($k==0 || ($k > 1 && $k < 5)) {
|
69 |
-
echo ' checked="checked"';
|
70 |
-
}
|
71 |
-
echo ' /> '.$ex.'<br />';
|
72 |
-
}
|
73 |
-
|
74 |
-
echo '<br />
|
75 |
-
<input type="submit" name="generate" value="generate" />
|
76 |
-
</form>
|
77 |
-
</body>
|
78 |
-
</html>';
|
79 |
-
exit;
|
80 |
-
}
|
81 |
-
|
82 |
-
$inc = $_POST['inc'];
|
83 |
-
if (is_array($inc) && count($inc)>0 ) {
|
84 |
-
foreach($inc AS $i=>$v) {
|
85 |
-
$key = array_search($i, $excl);
|
86 |
-
unset($excl[$key]);
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
if (!defined('PHP_VERSION_ID')) {
|
91 |
-
$version = explode('.', PHP_VERSION);
|
92 |
-
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
|
93 |
-
}
|
94 |
-
if (PHP_VERSION_ID < 50300) { $mqr = @get_magic_quotes_runtime(); }
|
95 |
-
else { $mqr=0; }
|
96 |
-
if ($mqr) { set_magic_quotes_runtime(0); }
|
97 |
-
|
98 |
-
$l = file('mpdf_source.php');
|
99 |
-
if (!count($l)) { die("ERROR - Could not find mpdf_source.php file in current directory"); }
|
100 |
-
$exclflags = array();
|
101 |
-
$x = '';
|
102 |
-
|
103 |
-
// Excluding 'HTML-CSS' will also exclude: 'TABLES', 'LISTS', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'FORMS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS'
|
104 |
-
if ($excl[0]=='HTML-CSS') {
|
105 |
-
$excl[] = 'TABLES';
|
106 |
-
$excl[] = 'LISTS';
|
107 |
-
$excl[] = 'TABLES-ADVANCED-BORDERS';
|
108 |
-
$excl[] = 'HTMLHEADERS-FOOTERS';
|
109 |
-
$excl[] = 'FORMS';
|
110 |
-
$excl[] = 'BACKGROUNDS';
|
111 |
-
$excl[] = 'CSS-FLOAT';
|
112 |
-
$excl[] = 'CSS-IMAGE-FLOAT';
|
113 |
-
$excl[] = 'CSS-POSITION';
|
114 |
-
$excl[] = 'CSS-PAGE';
|
115 |
-
$excl[] = 'BORDER-RADIUS';
|
116 |
-
}
|
117 |
-
$excl = array_unique($excl);
|
118 |
-
|
119 |
-
foreach($l AS $k=>$ln) {
|
120 |
-
$exclude = false;
|
121 |
-
// *XXXXX*
|
122 |
-
preg_match_all("/\/\/ \*([A-Za-z\-]+)\*/", $ln, $m);
|
123 |
-
foreach($m[1] AS $mm) {
|
124 |
-
if (in_array($mm, $excl)) {
|
125 |
-
$exclude = true;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
/*-- XXXXX --*/
|
129 |
-
preg_match_all("/\/\*-- ([A-Za-z\-]+) --\*\//", $ln, $m);
|
130 |
-
foreach($m[1] AS $mm) {
|
131 |
-
if (in_array($mm, $excl)) {
|
132 |
-
$exclflags[$mm] = true;
|
133 |
-
}
|
134 |
-
$exclude = true;
|
135 |
-
}
|
136 |
-
$exclflags = array_unique($exclflags);
|
137 |
-
/*-- END XXXX --*/
|
138 |
-
preg_match_all("/\/\*-- END ([A-Za-z\-]+) --\*\//", $ln, $m);
|
139 |
-
foreach($m[1] AS $mm) {
|
140 |
-
if (in_array($mm, $excl)) {
|
141 |
-
unset($exclflags[$mm]);
|
142 |
-
}
|
143 |
-
$exclude = true;
|
144 |
-
}
|
145 |
-
if (count($exclflags)==0 && !$exclude) {
|
146 |
-
$x .= $ln;
|
147 |
-
}
|
148 |
-
}
|
149 |
-
// mPDF 5.0
|
150 |
-
if (function_exists('file_put_contents')) {
|
151 |
-
$check = file_put_contents('mpdf.php', $x);
|
152 |
-
}
|
153 |
-
else {
|
154 |
-
$f=fopen('mpdf.php', 'w');
|
155 |
-
$check = fwrite($f, $x);
|
156 |
-
fclose($f);
|
157 |
-
}
|
158 |
-
if (!$check) { die("ERROR - Could not write to mpdf.php file. Are permissions correctly set?"); }
|
159 |
-
echo '<p><b>mPDF file generated successfully!</b></p>';
|
160 |
-
echo '<div>mPDF file size '.number_format((strlen($x)/1024)).' kB</div>';
|
161 |
-
|
162 |
-
unset($l);
|
163 |
-
unset($x);
|
164 |
-
|
165 |
-
include('mpdf.php');
|
166 |
-
$mpdf = new mPDF();
|
167 |
-
|
168 |
-
echo '<div>Memory usage on loading mPDF class '.number_format((memory_get_usage(true)/(1024*1024)),2).' MB</div>';
|
169 |
-
|
170 |
-
exit;
|
171 |
-
|
172 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mPDF/config.php
DELETED
@@ -1,592 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// mPDF 5.7
|
4 |
-
// Specify whether to automatically generate bookmarks or ToC entries from h1 - h6 tags
|
5 |
-
$this->h2bookmarks = array();
|
6 |
-
$this->h2toc = array();
|
7 |
-
/* Define arrays with e.g. the tag=>ToC-level
|
8 |
-
Remember bookmark and ToC levels start at 0
|
9 |
-
(does not work inside tables)
|
10 |
-
Only the default ToC will be used if > 1 ToCs are defined for the document
|
11 |
-
H1 - H6 must be uppercase
|
12 |
-
$this->h2toc = array('H1'=>0, 'H2'=>1, 'H3'=>2);
|
13 |
-
$this->h2bookmarks = array('H1'=>0, 'H2'=>1, 'H3'=>2);
|
14 |
-
*/
|
15 |
-
|
16 |
-
// mPDF 5.7
|
17 |
-
// Text-align on decimal marks
|
18 |
-
// Allowed characters for alignment on decimal marks. Additional codes must start with D
|
19 |
-
// Non-ASCII characters should be in utf-8 encoding
|
20 |
-
// DM - middot U+00B7
|
21 |
-
// DA - arabic decimal mark U+066B
|
22 |
-
$this->decimal_align = array('DP'=>'.', 'DC'=>',', 'DM'=>"\xc2\xb7", 'DA'=>"\xd9\xab", 'DD'=>'-');
|
23 |
-
|
24 |
-
// PAGING
|
25 |
-
$this->mirrorMargins = 0;
|
26 |
-
$this->restoreBlockPagebreaks = false;
|
27 |
-
$this->forcePortraitMargins = false;
|
28 |
-
$this->displayDefaultOrientation = false;
|
29 |
-
$this->printers_info = false; // Adds date and page info for printer when using @page and "marks:crop;"
|
30 |
-
$this->bleedMargin = 5;
|
31 |
-
$this->crossMarkMargin = 5; // Distance of cross mark from margin in mm
|
32 |
-
$this->cropMarkMargin = 8; // Distance of crop mark from margin in mm
|
33 |
-
$this->cropMarkLength = 18; // Default length in mm of crop line
|
34 |
-
$this->nonPrintMargin = 8; // Non-printable border at edge of paper sheet in mm
|
35 |
-
// mPDF 5.5
|
36 |
-
// Avoid just the border/background-color of the end of a block being moved on to next page
|
37 |
-
$this->margBuffer = 2; // Allows an (empty) end of block to extend beyond the bottom margin by this amount (mm)
|
38 |
-
|
39 |
-
|
40 |
-
// PAGE NUMBERING
|
41 |
-
$this->pagenumPrefix;
|
42 |
-
$this->pagenumSuffix;
|
43 |
-
$this->nbpgPrefix;
|
44 |
-
$this->nbpgSuffix;
|
45 |
-
|
46 |
-
|
47 |
-
// FONTS, LANGUAGES & CHARACTER SETS
|
48 |
-
// Set maximum size of TTF font file to allow non-subsets - in kB
|
49 |
-
// Used to avoid e.g. Arial Unicode MS (perhaps used for substitutions) to ever be fully embedded
|
50 |
-
// NB Free serif is 1.5MB, most files are <= 600kB (most 200-400KB)
|
51 |
-
$this->maxTTFFilesize = 2000;
|
52 |
-
|
53 |
-
// this value determines whether to subset or not
|
54 |
-
// 0 - 100 = percent characters
|
55 |
-
// i.e. if ==40, mPDF will embed whole font if >40% characters in that font
|
56 |
-
// or embed subset if <40% characters
|
57 |
-
// 0 will force whole file to be embedded (NO subsetting)
|
58 |
-
// 100 will force always to subset
|
59 |
-
// This value is overridden if you set new mPDF('s)
|
60 |
-
// and/or Can set at runtime
|
61 |
-
$this->percentSubset = 60;
|
62 |
-
|
63 |
-
$this->useAdobeCJK = true; // Uses Adobe CJK fonts for CJK languages
|
64 |
-
// default TRUE; only set false if you have defined some available fonts that support CJK
|
65 |
-
// If true this will not stop use of other CJK fonts if specified by font-family:
|
66 |
-
// and vice versa i.e. only dictates behaviour when specified by lang="" incl. AutoFont()
|
67 |
-
|
68 |
-
// When embedding full TTF font files, remakes the font file using only core tables
|
69 |
-
// May improve function with some PostScript printers (GhostScript/GSView)
|
70 |
-
// Does not work with TTC font collections
|
71 |
-
// Slightly smaller file; increased processing time
|
72 |
-
(defined('PDF_REPACK_FONT') && PDF_REPACK_FONT === true) ? $this->repackageTTF = true : $this->repackageTTF = false;
|
73 |
-
|
74 |
-
// Allows automatic character set conversion if "charset=xxx" detected in html header (WriteHTML() )
|
75 |
-
$this->allow_charset_conversion = true;
|
76 |
-
$this->biDirectional=false; // automatically determine BIDI text in LTR page
|
77 |
-
$this->autoFontGroupSize = 2; // 1: individual words are spanned; 2: words+; 3: as big chunks as possible.
|
78 |
-
$this->useLang = true; // Default changed in mPDF 4.0
|
79 |
-
|
80 |
-
$this->useSubstitutions = true; // Substitute missing characters in UTF-8(multibyte) documents - from other fonts
|
81 |
-
$this->falseBoldWeight = 5; // Weight for bold text when using an artificial (outline) bold; value 0 (off) - 10 (rec. max)
|
82 |
-
|
83 |
-
// CONFIGURATION
|
84 |
-
$this->allow_output_buffering = true;
|
85 |
-
|
86 |
-
$this->enableImports = true; // Adding mPDFI functions
|
87 |
-
|
88 |
-
$this->collapseBlockMargins = true; // Allows top and bottom margins to collapse between block elements
|
89 |
-
$this->progressBar = 0; // Shows progress-bars whilst generating file 0 off, 1 simple, 2 advanced
|
90 |
-
$this->progbar_heading = 'mPDF file progress';
|
91 |
-
$this->progbar_altHTML = ''; // Should include <html> and <body> but NOT end tags
|
92 |
-
// Can incude <head> and link to stylesheet etc.
|
93 |
-
// e.g. '<html><body><p><img src="loading.gif" /> Creating PDF file. Please wait...</p>';
|
94 |
-
|
95 |
-
$this->dpi = 96; // To interpret "px" pixel values in HTML/CSS (see img_dpi below)
|
96 |
-
|
97 |
-
// Automatically correct for tags where HTML specifies optional end tags e.g. P,LI,DD,TD
|
98 |
-
// If you are confident input html is valid XHTML, turning this off may make it more reliable(?)
|
99 |
-
$this->allow_html_optional_endtags = true;
|
100 |
-
|
101 |
-
$this->ignore_invalid_utf8 = true;
|
102 |
-
$this->text_input_as_HTML = true; // Converts all entities in Text inputs to UTF-8 before encoding
|
103 |
-
$this->useGraphs = false;
|
104 |
-
|
105 |
-
|
106 |
-
// When writing a block element with position:fixed and overflow:auto, mPDF scales it down to fit in the space
|
107 |
-
// by repeatedly rewriting it and making adjustments. These values give the adjustments used, depending how far out
|
108 |
-
// the previous guess was. The lower the number, the quicker it will finish, but the less accurate the fit may be.
|
109 |
-
// FPR1 is for coarse adjustments, and FPR4 for fine adjustments when it is getting closer.
|
110 |
-
$this->incrementFPR1 = 10; // i.e. will alter by 1/[10]th of width and try again until within closer limits
|
111 |
-
$this->incrementFPR2 = 20;
|
112 |
-
$this->incrementFPR3 = 30;
|
113 |
-
$this->incrementFPR4 = 50; // i.e. will alter by 1/[50]th of width and try again when it nearly fits
|
114 |
-
|
115 |
-
|
116 |
-
// COLORSPACE
|
117 |
-
// 1 - allow GRAYSCALE only [convert CMYK/RGB->gray]
|
118 |
-
// 2 - allow RGB / SPOT COLOR / Grayscale [convert CMYK->RGB]
|
119 |
-
// 3 - allow CMYK / SPOT COLOR / Grayscale [convert RGB->CMYK]
|
120 |
-
$this->restrictColorSpace = 0;
|
121 |
-
|
122 |
-
// PDFX/1-a Compliant files
|
123 |
-
$this->PDFX = false; // true=Forces compliance with PDFX-1a spec
|
124 |
-
// Cannot be used with $this->restrictColorSpace (i.e. no RGB)
|
125 |
-
$this->PDFXauto = false; // Overrides warnings making changes when possible to force PDFX1-a compliance
|
126 |
-
|
127 |
-
|
128 |
-
// PDFA1-b Compliant files
|
129 |
-
$this->PDFA = false; // true=Forces compliance with PDFA-1b spec
|
130 |
-
// Can use with $this->restrictColorSpace=3 (for a CMYK file)
|
131 |
-
// Any other settings, uses RGB profile
|
132 |
-
$this->PDFAauto = false; // Overrides warnings making changes when possible to force PDFA1-b compliance
|
133 |
-
$this->ICCProfile = ''; // Colour profile OutputIntent
|
134 |
-
// sRGB_IEC61966-2-1 (=default if blank and PDFA), or other added .icc profile
|
135 |
-
// Must be CMYK for PDFX, or appropriate type for PDFA(RGB or CMYK)
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
// DEBUGGING & DEVELOPERS
|
140 |
-
if(WP_DEBUG === true)
|
141 |
-
{
|
142 |
-
$this->showStats = true;
|
143 |
-
$this->debug = true;
|
144 |
-
$this->debugfonts = true; // Checks and reports on errors when parsing TTF files - adds significantly to processing time
|
145 |
-
$this->showImageErrors = false;
|
146 |
-
$this->table_error_report = false; /* shows inaccurate error about too small a cell width when enabled */
|
147 |
-
$this->table_error_report_param = ''; // Parameter which can be passed to show in error report i.e. chapter number being processed//
|
148 |
-
}
|
149 |
-
else
|
150 |
-
{
|
151 |
-
$this->showStats = false;
|
152 |
-
$this->debug = false;
|
153 |
-
$this->debugfonts = false; // Checks and reports on errors when parsing TTF files - adds significantly to processing time
|
154 |
-
$this->showImageErrors = false;
|
155 |
-
$this->table_error_report = false; // Die and report error if table is too wide to contain whole words
|
156 |
-
$this->table_error_report_param = ''; // Parameter which can be passed to show in error report i.e. chapter number being processed//
|
157 |
-
}
|
158 |
-
|
159 |
-
|
160 |
-
// ANNOTATIONS
|
161 |
-
$this->title2annots = false;
|
162 |
-
$this->annotSize = 0.5; // default mm for Adobe annotations - nominal
|
163 |
-
$this->annotMargin; // default position for Annotations
|
164 |
-
$this->annotOpacity = 0.5; // default opacity for Annotations
|
165 |
-
|
166 |
-
// BOOKMARKS
|
167 |
-
$this->anchor2Bookmark = 0; // makes <a name=""> into a bookmark as well as internal link target; 1 = just name; 2 = name (p.34)
|
168 |
-
// Set an optional array to specify appearance of Bookmarks (by level)
|
169 |
-
// Default values are Black and normal style
|
170 |
-
/*
|
171 |
-
Example:
|
172 |
-
$this->bookmarkStyles = array(
|
173 |
-
0 => array('color'=> array(0,64,128), 'style'=>'B'),
|
174 |
-
1 => array('color'=> array(128,0,0), 'style'=>''),
|
175 |
-
2 => array('color'=> array(0,128,0), 'style'=>'I'),
|
176 |
-
);
|
177 |
-
*/
|
178 |
-
$this->bookmarkStyles = array();
|
179 |
-
|
180 |
-
|
181 |
-
// CSS & STYLES
|
182 |
-
$this->CSSselectMedia='print'; // screen, print, or any other CSS @media type (not "all")
|
183 |
-
|
184 |
-
|
185 |
-
// PAGE HEADERS & FOOTERS
|
186 |
-
$this->forcePortraitHeaders = false;
|
187 |
-
// Values used if simple FOOTER/HEADER given i.e. not array
|
188 |
-
$this->defaultheaderfontsize = 8; // pt
|
189 |
-
$this->defaultheaderfontstyle = 'BI'; // '', or 'B' or 'I' or 'BI'
|
190 |
-
$this->defaultheaderline = 1; // 1 or 0 - line under the header
|
191 |
-
$this->defaultfooterfontsize = 8; // pt
|
192 |
-
$this->defaultfooterfontstyle = 'BI'; // '', or 'B' or 'I' or 'BI'
|
193 |
-
$this->defaultfooterline = 1; // 1 or 0 - line over the footer
|
194 |
-
$this->header_line_spacing = 0.25; // spacing between bottom of header and line (if present) - function of fontsize
|
195 |
-
$this->footer_line_spacing = 0.25; // spacing between bottom of header and line (if present) - function of fontsize
|
196 |
-
// If 'pad' margin-top sets fixed distance in mm (padding) between bottom of header and top of text.
|
197 |
-
// If 'stretch' margin-top sets a minimum distance in mm between top of page and top of text, which expands if header is too large to fit.
|
198 |
-
$this->setAutoTopMargin = 'stretch';
|
199 |
-
$this->setAutoBottomMargin = 'strech';
|
200 |
-
$this->autoMarginPadding = 2; // distance in mm used as padding if 'stretch' mode is used
|
201 |
-
|
202 |
-
|
203 |
-
// TABLES
|
204 |
-
(defined('PDF_ENABLE_SIMPLE_TABLES') && PDF_ENABLE_SIMPLE_TABLES === true) ? $this->simpleTables = true : $this->simpleTables = false; // Forces all cells to have same border, background etc. Improves performance
|
205 |
-
$this->packTableData = false; // Reduce memory usage processing tables (but with increased processing time)
|
206 |
-
// Using disk to cache table data can reduce memory usage dramatically, but at a cost of increased
|
207 |
-
// executon time and disk access (read and write)
|
208 |
-
global $gfpdfe_data;
|
209 |
-
|
210 |
-
if($gfpdfe_data->can_write_pdf_temp_dir === false)
|
211 |
-
{
|
212 |
-
$this->cacheTables = false;
|
213 |
-
}
|
214 |
-
else
|
215 |
-
{
|
216 |
-
$this->cacheTables = true;
|
217 |
-
}
|
218 |
-
|
219 |
-
$this->ignore_table_percents = false;
|
220 |
-
$this->ignore_table_widths = false;
|
221 |
-
$this->keep_table_proportions = true; // If table width set > page width, force resizing but keep relative sizes
|
222 |
-
// Also forces respect of cell widths set by %
|
223 |
-
$this->shrink_tables_to_fit = 1.4; // automatically reduce fontsize in table if words would have to split ( not in CJK)
|
224 |
-
// 0 or false to disable; value (if set) gives maximum factor to reduce fontsize
|
225 |
-
|
226 |
-
$this->tableMinSizePriority = false; // If page-break-inside:avoid but cannot fit on full page without
|
227 |
-
// exceeding autosize; setting this value to true will force respsect for
|
228 |
-
// autosize, and disable the page-break-inside:avoid
|
229 |
-
|
230 |
-
$this->use_kwt = true; // "Keep-with-table"
|
231 |
-
$this->iterationCounter = false; // Set to TRUE to use table Head iteration counter
|
232 |
-
$this->splitTableBorderWidth = 0; // Use table border (using this width in mm) when table breaks across pages
|
233 |
-
// Recommended to use small value e.g. 0.01
|
234 |
-
|
235 |
-
|
236 |
-
// IMAGES
|
237 |
-
$this->img_dpi = 96; // Default dpi to output images if size not defined
|
238 |
-
// See also above "dpi"
|
239 |
-
|
240 |
-
// TEXT SPACING & JUSTIFICATION
|
241 |
-
$this->useKerning = true; // true to use kernin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|