Version Description
(22 August 2017) = * Fixed conflict with the color picker in Avada theme v5.2.1
Download this release
Release Info
Developer | 123contactform |
Plugin | Forms by CaptainForm – Form Builder for WordPress |
Version | 2.2.6 |
Comparing to | |
See all releases |
Code changes from version 1.7.2.3 to 2.2.6
- LICENSE +0 -674
- LICENSE.txt +339 -0
- admin/class-captainform-admin.php +329 -0
- admin/css/captainform-admin.css +4 -0
- {includes → admin}/css/chosen/chosen-sprite.png +0 -0
- {includes → admin}/css/chosen/chosen-sprite@2x.png +0 -0
- {includes → admin}/css/chosen/chosen.css +59 -37
- {includes → admin}/css/credentials_error.css +0 -0
- admin/css/form_popup.css +85 -0
- {includes → admin}/css/hide_adminbar.css +0 -0
- {includes → admin}/css/iframe_popup.css +26 -14
- admin/css/publish_lightbox_posts.css +293 -0
- {includes → admin}/css/review.css +0 -0
- {includes → admin}/css/widget.css +78 -3
- {includes → admin}/css/wp_captainform_os.css +0 -0
- {includes → admin}/images/black-50.png +0 -0
- {includes → admin}/images/captainform-18.png +0 -0
- {includes → admin}/images/captainform-32.png +0 -0
- {includes → admin}/images/close.svg +0 -0
- {includes → admin}/images/close_hover.svg +0 -0
- {includes → admin}/images/dropdownarrow.png +0 -0
- {includes → admin}/images/icon-alert-close.png +0 -0
- {includes → admin}/images/icon-alert.png +0 -0
- {includes → admin}/images/icon-danger.png +0 -0
- {includes → admin}/images/icon-success.png +0 -0
- admin/images/info_alert.png +0 -0
- {includes → admin}/images/loader_cf.GIF +0 -0
- {includes → admin}/images/ring.svg +0 -0
- admin/index.php +1 -0
- admin/js/captainform-admin.js +32 -0
- admin/js/captainform-form-popup.js +313 -0
- admin/js/captainform-main.js +507 -0
- admin/js/chosen.jquery.js +1269 -0
- {includes → admin}/js/form_popup.js +0 -0
- {includes → admin}/js/iframeResizer.contentWindow.min.js +0 -0
- {includes → admin}/js/iframeResizer.min.js +0 -0
- {includes → admin}/js/jscolor/arrow.gif +0 -0
- {includes → admin}/js/jscolor/cross.gif +0 -0
- {includes → admin}/js/jscolor/hs.png +0 -0
- {includes → admin}/js/jscolor/hv.png +0 -0
- {includes → admin}/js/jscolor/jscolor.js +1 -1
- {includes → admin}/js/main.js +15 -1
- {includes → admin}/js/nolink.js +0 -0
- {includes → admin}/js/review.js +0 -0
- {includes → admin}/js/tinybox/images/close.png +0 -0
- {includes → admin}/js/tinybox/images/preload.gif +0 -0
- {includes → admin}/js/tinybox/tinybox.js +0 -0
- {includes → admin}/js/tinybox/tinyboxstyle.css +0 -0
- {includes → admin}/js/tinybox/tinyboxstyle_ios.css +0 -0
- admin/js/widget.js +452 -0
- admin/js/wp-editor-captainform-media-button.js +73 -0
- admin/partials/captainform-admin-display.php +24 -0
- admin/partials/captainform-admin-plugin-credentials-error.php +32 -0
- admin/partials/captainform-admin-plugin-options.php +48 -0
- admin/partials/captainform-admin-publish-options.php +214 -0
- captainform.php +87 -37
- dialog/editor_plugin.js +0 -90
- includes/CaptainFormWidget.php +0 -206
- includes/admin-page.php +0 -387
- includes/captainform-function-call.php +44 -0
- includes/class-captainform-account.php +169 -0
- includes/class-captainform-activator.php +34 -0
- includes/class-captainform-deactivator.php +34 -0
- includes/class-captainform-i18n.php +47 -0
- includes/class-captainform-loader.php +154 -0
- includes/class-captainform-preview.php +226 -0
- includes/class-captainform-shortcodes.php +106 -0
- includes/class-captainform-utils.php +127 -0
- includes/class-captainform-widget.php +282 -0
- includes/class-captainform.php +478 -0
- includes/css/form_popup.css +0 -106
- includes/css/publish_lightbox_posts.css +0 -150
- includes/display-functions.php +0 -283
- includes/{encryption.php → encryption/class-captainform-encrypt.php} +21 -20
- includes/form-resources/global-vars.php +0 -13
- includes/form-resources/lightbox-auto-embedding.php +0 -8
- includes/form-resources/lightbox-embedding.php +0 -6
- includes/form-resources/tinybox-resources.php +0 -17
- includes/hooks.php +0 -64
- includes/index.php +1 -0
- includes/init.php +0 -36
- includes/integrations/class-captainform-integration-forge-element.php +115 -0
- includes/integrations/{wp-integrations-handler.php → class-captainform-integration-handler.php} +30 -18
- includes/integrations/class-captainform-integration-posts.php +223 -0
- includes/integrations/class-captainform-integration-submissions.php +1 -0
- includes/integrations/class-captainform-integration-users.php +1 -0
- includes/integrations/forge-element.php +0 -89
- includes/integrations/wp-posts.php +0 -204
- includes/integrations/wp-users.php +0 -58
- includes/js/chosen.jquery.js +0 -1317
- includes/js/iframeResizer.map +0 -1
- includes/js/misc_functions.js +0 -36
- includes/js/widget.js +0 -212
- includes/settings.php +0 -94
- includes/shortcodes.php +0 -39
- index.php +1 -0
- languages/captainform.pot +0 -0
- public/class-captainform-public-form-custom-vars.php +150 -0
- public/class-captainform-public-form-embedding.php +302 -0
- public/class-captainform-public-form-resource-loader.php +230 -0
- public/class-captainform-public.php +79 -0
- includes/css/forge_element.css → public/css/captainform-forge-element.css +1 -1
- public/css/captainform-public.css +100 -0
- {includes → public}/images/loader_350.gif +0 -0
- {includes → public}/images/ppform_preloader.gif +0 -0
- {includes → public}/images/publish_lighbox_default_image_v2.png +0 -0
- public/images/ring.svg +1 -0
- public/index.php +1 -0
- public/js/captainform-public.js +32 -0
- public/partials/captainform-public-display.php +16 -0
- public/partials/form-resources/captainform-global-vars.php +45 -0
- public/partials/form-resources/captainform-lightbox-auto-embedding.php +21 -0
- public/partials/form-resources/captainform-lightbox-embedding.php +36 -0
- public/partials/form-resources/captainform-lightbox-window-leave-embedding.php +23 -0
- includes/form-resources/normal-embedding.php → public/partials/form-resources/captainform-normal-embedding.php +9 -10
- readme.txt +670 -216
- uninstall.php +31 -0
- views/credentials_error.php +0 -30
- views/main.php +0 -36
- views/options_page.php +0 -51
- views/publish_lightbox.php +0 -142
LICENSE
DELETED
@@ -1,674 +0,0 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 3, 29 June 2007
|
3 |
-
|
4 |
-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
-
Everyone is permitted to copy and distribute verbatim copies
|
6 |
-
of this license document, but changing it is not allowed.
|
7 |
-
|
8 |
-
Preamble
|
9 |
-
|
10 |
-
The GNU General Public License is a free, copyleft license for
|
11 |
-
software and other kinds of works.
|
12 |
-
|
13 |
-
The licenses for most software and other practical works are designed
|
14 |
-
to take away your freedom to share and change the works. By contrast,
|
15 |
-
the GNU General Public License is intended to guarantee your freedom to
|
16 |
-
share and change all versions of a program--to make sure it remains free
|
17 |
-
software for all its users. We, the Free Software Foundation, use the
|
18 |
-
GNU General Public License for most of our software; it applies also to
|
19 |
-
any other work released this way by its authors. You can apply it to
|
20 |
-
your programs, too.
|
21 |
-
|
22 |
-
When we speak of free software, we are referring to freedom, not
|
23 |
-
price. Our General Public Licenses are designed to make sure that you
|
24 |
-
have the freedom to distribute copies of free software (and charge for
|
25 |
-
them if you wish), that you receive source code or can get it if you
|
26 |
-
want it, that you can change the software or use pieces of it in new
|
27 |
-
free programs, and that you know you can do these things.
|
28 |
-
|
29 |
-
To protect your rights, we need to prevent others from denying you
|
30 |
-
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
-
certain responsibilities if you distribute copies of the software, or if
|
32 |
-
you modify it: responsibilities to respect the freedom of others.
|
33 |
-
|
34 |
-
For example, if you distribute copies of such a program, whether
|
35 |
-
gratis or for a fee, you must pass on to the recipients the same
|
36 |
-
freedoms that you received. You must make sure that they, too, receive
|
37 |
-
or can get the source code. And you must show them these terms so they
|
38 |
-
know their rights.
|
39 |
-
|
40 |
-
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
-
(1) assert copyright on the software, and (2) offer you this License
|
42 |
-
giving you legal permission to copy, distribute and/or modify it.
|
43 |
-
|
44 |
-
For the developers' and authors' protection, the GPL clearly explains
|
45 |
-
that there is no warranty for this free software. For both users' and
|
46 |
-
authors' sake, the GPL requires that modified versions be marked as
|
47 |
-
changed, so that their problems will not be attributed erroneously to
|
48 |
-
authors of previous versions.
|
49 |
-
|
50 |
-
Some devices are designed to deny users access to install or run
|
51 |
-
modified versions of the software inside them, although the manufacturer
|
52 |
-
can do so. This is fundamentally incompatible with the aim of
|
53 |
-
protecting users' freedom to change the software. The systematic
|
54 |
-
pattern of such abuse occurs in the area of products for individuals to
|
55 |
-
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
-
have designed this version of the GPL to prohibit the practice for those
|
57 |
-
products. If such problems arise substantially in other domains, we
|
58 |
-
stand ready to extend this provision to those domains in future versions
|
59 |
-
of the GPL, as needed to protect the freedom of users.
|
60 |
-
|
61 |
-
Finally, every program is threatened constantly by software patents.
|
62 |
-
States should not allow patents to restrict development and use of
|
63 |
-
software on general-purpose computers, but in those that do, we wish to
|
64 |
-
avoid the special danger that patents applied to a free program could
|
65 |
-
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
-
patents cannot be used to render the program non-free.
|
67 |
-
|
68 |
-
The precise terms and conditions for copying, distribution and
|
69 |
-
modification follow.
|
70 |
-
|
71 |
-
TERMS AND CONDITIONS
|
72 |
-
|
73 |
-
0. Definitions.
|
74 |
-
|
75 |
-
"This License" refers to version 3 of the GNU General Public License.
|
76 |
-
|
77 |
-
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
-
works, such as semiconductor masks.
|
79 |
-
|
80 |
-
"The Program" refers to any copyrightable work licensed under this
|
81 |
-
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
-
"recipients" may be individuals or organizations.
|
83 |
-
|
84 |
-
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
-
in a fashion requiring copyright permission, other than the making of an
|
86 |
-
exact copy. The resulting work is called a "modified version" of the
|
87 |
-
earlier work or a work "based on" the earlier work.
|
88 |
-
|
89 |
-
A "covered work" means either the unmodified Program or a work based
|
90 |
-
on the Program.
|
91 |
-
|
92 |
-
To "propagate" a work means to do anything with it that, without
|
93 |
-
permission, would make you directly or secondarily liable for
|
94 |
-
infringement under applicable copyright law, except executing it on a
|
95 |
-
computer or modifying a private copy. Propagation includes copying,
|
96 |
-
distribution (with or without modification), making available to the
|
97 |
-
public, and in some countries other activities as well.
|
98 |
-
|
99 |
-
To "convey" a work means any kind of propagation that enables other
|
100 |
-
parties to make or receive copies. Mere interaction with a user through
|
101 |
-
a computer network, with no transfer of a copy, is not conveying.
|
102 |
-
|
103 |
-
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
-
to the extent that it includes a convenient and prominently visible
|
105 |
-
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
-
tells the user that there is no warranty for the work (except to the
|
107 |
-
extent that warranties are provided), that licensees may convey the
|
108 |
-
work under this License, and how to view a copy of this License. If
|
109 |
-
the interface presents a list of user commands or options, such as a
|
110 |
-
menu, a prominent item in the list meets this criterion.
|
111 |
-
|
112 |
-
1. Source Code.
|
113 |
-
|
114 |
-
The "source code" for a work means the preferred form of the work
|
115 |
-
for making modifications to it. "Object code" means any non-source
|
116 |
-
form of a work.
|
117 |
-
|
118 |
-
A "Standard Interface" means an interface that either is an official
|
119 |
-
standard defined by a recognized standards body, or, in the case of
|
120 |
-
interfaces specified for a particular programming language, one that
|
121 |
-
is widely used among developers working in that language.
|
122 |
-
|
123 |
-
The "System Libraries" of an executable work include anything, other
|
124 |
-
than the work as a whole, that (a) is included in the normal form of
|
125 |
-
packaging a Major Component, but which is not part of that Major
|
126 |
-
Component, and (b) serves only to enable use of the work with that
|
127 |
-
Major Component, or to implement a Standard Interface for which an
|
128 |
-
implementation is available to the public in source code form. A
|
129 |
-
"Major Component", in this context, means a major essential component
|
130 |
-
(kernel, window system, and so on) of the specific operating system
|
131 |
-
(if any) on which the executable work runs, or a compiler used to
|
132 |
-
produce the work, or an object code interpreter used to run it.
|
133 |
-
|
134 |
-
The "Corresponding Source" for a work in object code form means all
|
135 |
-
the source code needed to generate, install, and (for an executable
|
136 |
-
work) run the object code and to modify the work, including scripts to
|
137 |
-
control those activities. However, it does not include the work's
|
138 |
-
System Libraries, or general-purpose tools or generally available free
|
139 |
-
programs which are used unmodified in performing those activities but
|
140 |
-
which are not part of the work. For example, Corresponding Source
|
141 |
-
includes interface definition files associated with source files for
|
142 |
-
the work, and the source code for shared libraries and dynamically
|
143 |
-
linked subprograms that the work is specifically designed to require,
|
144 |
-
such as by intimate data communication or control flow between those
|
145 |
-
subprograms and other parts of the work.
|
146 |
-
|
147 |
-
The Corresponding Source need not include anything that users
|
148 |
-
can regenerate automatically from other parts of the Corresponding
|
149 |
-
Source.
|
150 |
-
|
151 |
-
The Corresponding Source for a work in source code form is that
|
152 |
-
same work.
|
153 |
-
|
154 |
-
2. Basic Permissions.
|
155 |
-
|
156 |
-
All rights granted under this License are granted for the term of
|
157 |
-
copyright on the Program, and are irrevocable provided the stated
|
158 |
-
conditions are met. This License explicitly affirms your unlimited
|
159 |
-
permission to run the unmodified Program. The output from running a
|
160 |
-
covered work is covered by this License only if the output, given its
|
161 |
-
content, constitutes a covered work. This License acknowledges your
|
162 |
-
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
-
|
164 |
-
You may make, run and propagate covered works that you do not
|
165 |
-
convey, without conditions so long as your license otherwise remains
|
166 |
-
in force. You may convey covered works to others for the sole purpose
|
167 |
-
of having them make modifications exclusively for you, or provide you
|
168 |
-
with facilities for running those works, provided that you comply with
|
169 |
-
the terms of this License in conveying all material for which you do
|
170 |
-
not control copyright. Those thus making or running the covered works
|
171 |
-
for you must do so exclusively on your behalf, under your direction
|
172 |
-
and control, on terms that prohibit them from making any copies of
|
173 |
-
your copyrighted material outside their relationship with you.
|
174 |
-
|
175 |
-
Conveying under any other circumstances is permitted solely under
|
176 |
-
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
-
makes it unnecessary.
|
178 |
-
|
179 |
-
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
-
|
181 |
-
No covered work shall be deemed part of an effective technological
|
182 |
-
measure under any applicable law fulfilling obligations under article
|
183 |
-
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
-
similar laws prohibiting or restricting circumvention of such
|
185 |
-
measures.
|
186 |
-
|
187 |
-
When you convey a covered work, you waive any legal power to forbid
|
188 |
-
circumvention of technological measures to the extent such circumvention
|
189 |
-
is effected by exercising rights under this License with respect to
|
190 |
-
the covered work, and you disclaim any intention to limit operation or
|
191 |
-
modification of the work as a means of enforcing, against the work's
|
192 |
-
users, your or third parties' legal rights to forbid circumvention of
|
193 |
-
technological measures.
|
194 |
-
|
195 |
-
4. Conveying Verbatim Copies.
|
196 |
-
|
197 |
-
You may convey verbatim copies of the Program's source code as you
|
198 |
-
receive it, in any medium, provided that you conspicuously and
|
199 |
-
appropriately publish on each copy an appropriate copyright notice;
|
200 |
-
keep intact all notices stating that this License and any
|
201 |
-
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
-
keep intact all notices of the absence of any warranty; and give all
|
203 |
-
recipients a copy of this License along with the Program.
|
204 |
-
|
205 |
-
You may charge any price or no price for each copy that you convey,
|
206 |
-
and you may offer support or warranty protection for a fee.
|
207 |
-
|
208 |
-
5. Conveying Modified Source Versions.
|
209 |
-
|
210 |
-
You may convey a work based on the Program, or the modifications to
|
211 |
-
produce it from the Program, in the form of source code under the
|
212 |
-
terms of section 4, provided that you also meet all of these conditions:
|
213 |
-
|
214 |
-
a) The work must carry prominent notices stating that you modified
|
215 |
-
it, and giving a relevant date.
|
216 |
-
|
217 |
-
b) The work must carry prominent notices stating that it is
|
218 |
-
released under this License and any conditions added under section
|
219 |
-
7. This requirement modifies the requirement in section 4 to
|
220 |
-
"keep intact all notices".
|
221 |
-
|
222 |
-
c) You must license the entire work, as a whole, under this
|
223 |
-
License to anyone who comes into possession of a copy. This
|
224 |
-
License will therefore apply, along with any applicable section 7
|
225 |
-
additional terms, to the whole of the work, and all its parts,
|
226 |
-
regardless of how they are packaged. This License gives no
|
227 |
-
permission to license the work in any other way, but it does not
|
228 |
-
invalidate such permission if you have separately received it.
|
229 |
-
|
230 |
-
d) If the work has interactive user interfaces, each must display
|
231 |
-
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
-
interfaces that do not display Appropriate Legal Notices, your
|
233 |
-
work need not make them do so.
|
234 |
-
|
235 |
-
A compilation of a covered work with other separate and independent
|
236 |
-
works, which are not by their nature extensions of the covered work,
|
237 |
-
and which are not combined with it such as to form a larger program,
|
238 |
-
in or on a volume of a storage or distribution medium, is called an
|
239 |
-
"aggregate" if the compilation and its resulting copyright are not
|
240 |
-
used to limit the access or legal rights of the compilation's users
|
241 |
-
beyond what the individual works permit. Inclusion of a covered work
|
242 |
-
in an aggregate does not cause this License to apply to the other
|
243 |
-
parts of the aggregate.
|
244 |
-
|
245 |
-
6. Conveying Non-Source Forms.
|
246 |
-
|
247 |
-
You may convey a covered work in object code form under the terms
|
248 |
-
of sections 4 and 5, provided that you also convey the
|
249 |
-
machine-readable Corresponding Source under the terms of this License,
|
250 |
-
in one of these ways:
|
251 |
-
|
252 |
-
a) Convey the object code in, or embodied in, a physical product
|
253 |
-
(including a physical distribution medium), accompanied by the
|
254 |
-
Corresponding Source fixed on a durable physical medium
|
255 |
-
customarily used for software interchange.
|
256 |
-
|
257 |
-
b) Convey the object code in, or embodied in, a physical product
|
258 |
-
(including a physical distribution medium), accompanied by a
|
259 |
-
written offer, valid for at least three years and valid for as
|
260 |
-
long as you offer spare parts or customer support for that product
|
261 |
-
model, to give anyone who possesses the object code either (1) a
|
262 |
-
copy of the Corresponding Source for all the software in the
|
263 |
-
product that is covered by this License, on a durable physical
|
264 |
-
medium customarily used for software interchange, for a price no
|
265 |
-
more than your reasonable cost of physically performing this
|
266 |
-
conveying of source, or (2) access to copy the
|
267 |
-
Corresponding Source from a network server at no charge.
|
268 |
-
|
269 |
-
c) Convey individual copies of the object code with a copy of the
|
270 |
-
written offer to provide the Corresponding Source. This
|
271 |
-
alternative is allowed only occasionally and noncommercially, and
|
272 |
-
only if you received the object code with such an offer, in accord
|
273 |
-
with subsection 6b.
|
274 |
-
|
275 |
-
d) Convey the object code by offering access from a designated
|
276 |
-
place (gratis or for a charge), and offer equivalent access to the
|
277 |
-
Corresponding Source in the same way through the same place at no
|
278 |
-
further charge. You need not require recipients to copy the
|
279 |
-
Corresponding Source along with the object code. If the place to
|
280 |
-
copy the object code is a network server, the Corresponding Source
|
281 |
-
may be on a different server (operated by you or a third party)
|
282 |
-
that supports equivalent copying facilities, provided you maintain
|
283 |
-
clear directions next to the object code saying where to find the
|
284 |
-
Corresponding Source. Regardless of what server hosts the
|
285 |
-
Corresponding Source, you remain obligated to ensure that it is
|
286 |
-
available for as long as needed to satisfy these requirements.
|
287 |
-
|
288 |
-
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
-
you inform other peers where the object code and Corresponding
|
290 |
-
Source of the work are being offered to the general public at no
|
291 |
-
charge under subsection 6d.
|
292 |
-
|
293 |
-
A separable portion of the object code, whose source code is excluded
|
294 |
-
from the Corresponding Source as a System Library, need not be
|
295 |
-
included in conveying the object code work.
|
296 |
-
|
297 |
-
A "User Product" is either (1) a "consumer product", which means any
|
298 |
-
tangible personal property which is normally used for personal, family,
|
299 |
-
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
-
into a dwelling. In determining whether a product is a consumer product,
|
301 |
-
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
-
product received by a particular user, "normally used" refers to a
|
303 |
-
typical or common use of that class of product, regardless of the status
|
304 |
-
of the particular user or of the way in which the particular user
|
305 |
-
actually uses, or expects or is expected to use, the product. A product
|
306 |
-
is a consumer product regardless of whether the product has substantial
|
307 |
-
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
-
the only significant mode of use of the product.
|
309 |
-
|
310 |
-
"Installation Information" for a User Product means any methods,
|
311 |
-
procedures, authorization keys, or other information required to install
|
312 |
-
and execute modified versions of a covered work in that User Product from
|
313 |
-
a modified version of its Corresponding Source. The information must
|
314 |
-
suffice to ensure that the continued functioning of the modified object
|
315 |
-
code is in no case prevented or interfered with solely because
|
316 |
-
modification has been made.
|
317 |
-
|
318 |
-
If you convey an object code work under this section in, or with, or
|
319 |
-
specifically for use in, a User Product, and the conveying occurs as
|
320 |
-
part of a transaction in which the right of possession and use of the
|
321 |
-
User Product is transferred to the recipient in perpetuity or for a
|
322 |
-
fixed term (regardless of how the transaction is characterized), the
|
323 |
-
Corresponding Source conveyed under this section must be accompanied
|
324 |
-
by the Installation Information. But this requirement does not apply
|
325 |
-
if neither you nor any third party retains the ability to install
|
326 |
-
modified object code on the User Product (for example, the work has
|
327 |
-
been installed in ROM).
|
328 |
-
|
329 |
-
The requirement to provide Installation Information does not include a
|
330 |
-
requirement to continue to provide support service, warranty, or updates
|
331 |
-
for a work that has been modified or installed by the recipient, or for
|
332 |
-
the User Product in which it has been modified or installed. Access to a
|
333 |
-
network may be denied when the modification itself materially and
|
334 |
-
adversely affects the operation of the network or violates the rules and
|
335 |
-
protocols for communication across the network.
|
336 |
-
|
337 |
-
Corresponding Source conveyed, and Installation Information provided,
|
338 |
-
in accord with this section must be in a format that is publicly
|
339 |
-
documented (and with an implementation available to the public in
|
340 |
-
source code form), and must require no special password or key for
|
341 |
-
unpacking, reading or copying.
|
342 |
-
|
343 |
-
7. Additional Terms.
|
344 |
-
|
345 |
-
"Additional permissions" are terms that supplement the terms of this
|
346 |
-
License by making exceptions from one or more of its conditions.
|
347 |
-
Additional permissions that are applicable to the entire Program shall
|
348 |
-
be treated as though they were included in this License, to the extent
|
349 |
-
that they are valid under applicable law. If additional permissions
|
350 |
-
apply only to part of the Program, that part may be used separately
|
351 |
-
under those permissions, but the entire Program remains governed by
|
352 |
-
this License without regard to the additional permissions.
|
353 |
-
|
354 |
-
When you convey a copy of a covered work, you may at your option
|
355 |
-
remove any additional permissions from that copy, or from any part of
|
356 |
-
it. (Additional permissions may be written to require their own
|
357 |
-
removal in certain cases when you modify the work.) You may place
|
358 |
-
additional permissions on material, added by you to a covered work,
|
359 |
-
for which you have or can give appropriate copyright permission.
|
360 |
-
|
361 |
-
Notwithstanding any other provision of this License, for material you
|
362 |
-
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
-
that material) supplement the terms of this License with terms:
|
364 |
-
|
365 |
-
a) Disclaiming warranty or limiting liability differently from the
|
366 |
-
terms of sections 15 and 16 of this License; or
|
367 |
-
|
368 |
-
b) Requiring preservation of specified reasonable legal notices or
|
369 |
-
author attributions in that material or in the Appropriate Legal
|
370 |
-
Notices displayed by works containing it; or
|
371 |
-
|
372 |
-
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
-
requiring that modified versions of such material be marked in
|
374 |
-
reasonable ways as different from the original version; or
|
375 |
-
|
376 |
-
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
-
authors of the material; or
|
378 |
-
|
379 |
-
e) Declining to grant rights under trademark law for use of some
|
380 |
-
trade names, trademarks, or service marks; or
|
381 |
-
|
382 |
-
f) Requiring indemnification of licensors and authors of that
|
383 |
-
material by anyone who conveys the material (or modified versions of
|
384 |
-
it) with contractual assumptions of liability to the recipient, for
|
385 |
-
any liability that these contractual assumptions directly impose on
|
386 |
-
those licensors and authors.
|
387 |
-
|
388 |
-
All other non-permissive additional terms are considered "further
|
389 |
-
restrictions" within the meaning of section 10. If the Program as you
|
390 |
-
received it, or any part of it, contains a notice stating that it is
|
391 |
-
governed by this License along with a term that is a further
|
392 |
-
restriction, you may remove that term. If a license document contains
|
393 |
-
a further restriction but permits relicensing or conveying under this
|
394 |
-
License, you may add to a covered work material governed by the terms
|
395 |
-
of that license document, provided that the further restriction does
|
396 |
-
not survive such relicensing or conveying.
|
397 |
-
|
398 |
-
If you add terms to a covered work in accord with this section, you
|
399 |
-
must place, in the relevant source files, a statement of the
|
400 |
-
additional terms that apply to those files, or a notice indicating
|
401 |
-
where to find the applicable terms.
|
402 |
-
|
403 |
-
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
-
form of a separately written license, or stated as exceptions;
|
405 |
-
the above requirements apply either way.
|
406 |
-
|
407 |
-
8. Termination.
|
408 |
-
|
409 |
-
You may not propagate or modify a covered work except as expressly
|
410 |
-
provided under this License. Any attempt otherwise to propagate or
|
411 |
-
modify it is void, and will automatically terminate your rights under
|
412 |
-
this License (including any patent licenses granted under the third
|
413 |
-
paragraph of section 11).
|
414 |
-
|
415 |
-
However, if you cease all violation of this License, then your
|
416 |
-
license from a particular copyright holder is reinstated (a)
|
417 |
-
provisionally, unless and until the copyright holder explicitly and
|
418 |
-
finally terminates your license, and (b) permanently, if the copyright
|
419 |
-
holder fails to notify you of the violation by some reasonable means
|
420 |
-
prior to 60 days after the cessation.
|
421 |
-
|
422 |
-
Moreover, your license from a particular copyright holder is
|
423 |
-
reinstated permanently if the copyright holder notifies you of the
|
424 |
-
violation by some reasonable means, this is the first time you have
|
425 |
-
received notice of violation of this License (for any work) from that
|
426 |
-
copyright holder, and you cure the violation prior to 30 days after
|
427 |
-
your receipt of the notice.
|
428 |
-
|
429 |
-
Termination of your rights under this section does not terminate the
|
430 |
-
licenses of parties who have received copies or rights from you under
|
431 |
-
this License. If your rights have been terminated and not permanently
|
432 |
-
reinstated, you do not qualify to receive new licenses for the same
|
433 |
-
material under section 10.
|
434 |
-
|
435 |
-
9. Acceptance Not Required for Having Copies.
|
436 |
-
|
437 |
-
You are not required to accept this License in order to receive or
|
438 |
-
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
-
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
-
to receive a copy likewise does not require acceptance. However,
|
441 |
-
nothing other than this License grants you permission to propagate or
|
442 |
-
modify any covered work. These actions infringe copyright if you do
|
443 |
-
not accept this License. Therefore, by modifying or propagating a
|
444 |
-
covered work, you indicate your acceptance of this License to do so.
|
445 |
-
|
446 |
-
10. Automatic Licensing of Downstream Recipients.
|
447 |
-
|
448 |
-
Each time you convey a covered work, the recipient automatically
|
449 |
-
receives a license from the original licensors, to run, modify and
|
450 |
-
propagate that work, subject to this License. You are not responsible
|
451 |
-
for enforcing compliance by third parties with this License.
|
452 |
-
|
453 |
-
An "entity transaction" is a transaction transferring control of an
|
454 |
-
organization, or substantially all assets of one, or subdividing an
|
455 |
-
organization, or merging organizations. If propagation of a covered
|
456 |
-
work results from an entity transaction, each party to that
|
457 |
-
transaction who receives a copy of the work also receives whatever
|
458 |
-
licenses to the work the party's predecessor in interest had or could
|
459 |
-
give under the previous paragraph, plus a right to possession of the
|
460 |
-
Corresponding Source of the work from the predecessor in interest, if
|
461 |
-
the predecessor has it or can get it with reasonable efforts.
|
462 |
-
|
463 |
-
You may not impose any further restrictions on the exercise of the
|
464 |
-
rights granted or affirmed under this License. For example, you may
|
465 |
-
not impose a license fee, royalty, or other charge for exercise of
|
466 |
-
rights granted under this License, and you may not initiate litigation
|
467 |
-
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
-
any patent claim is infringed by making, using, selling, offering for
|
469 |
-
sale, or importing the Program or any portion of it.
|
470 |
-
|
471 |
-
11. Patents.
|
472 |
-
|
473 |
-
A "contributor" is a copyright holder who authorizes use under this
|
474 |
-
License of the Program or a work on which the Program is based. The
|
475 |
-
work thus licensed is called the contributor's "contributor version".
|
476 |
-
|
477 |
-
A contributor's "essential patent claims" are all patent claims
|
478 |
-
owned or controlled by the contributor, whether already acquired or
|
479 |
-
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
-
by this License, of making, using, or selling its contributor version,
|
481 |
-
but do not include claims that would be infringed only as a
|
482 |
-
consequence of further modification of the contributor version. For
|
483 |
-
purposes of this definition, "control" includes the right to grant
|
484 |
-
patent sublicenses in a manner consistent with the requirements of
|
485 |
-
this License.
|
486 |
-
|
487 |
-
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
-
patent license under the contributor's essential patent claims, to
|
489 |
-
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
-
propagate the contents of its contributor version.
|
491 |
-
|
492 |
-
In the following three paragraphs, a "patent license" is any express
|
493 |
-
agreement or commitment, however denominated, not to enforce a patent
|
494 |
-
(such as an express permission to practice a patent or covenant not to
|
495 |
-
sue for patent infringement). To "grant" such a patent license to a
|
496 |
-
party means to make such an agreement or commitment not to enforce a
|
497 |
-
patent against the party.
|
498 |
-
|
499 |
-
If you convey a covered work, knowingly relying on a patent license,
|
500 |
-
and the Corresponding Source of the work is not available for anyone
|
501 |
-
to copy, free of charge and under the terms of this License, through a
|
502 |
-
publicly available network server or other readily accessible means,
|
503 |
-
then you must either (1) cause the Corresponding Source to be so
|
504 |
-
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
-
patent license for this particular work, or (3) arrange, in a manner
|
506 |
-
consistent with the requirements of this License, to extend the patent
|
507 |
-
license to downstream recipients. "Knowingly relying" means you have
|
508 |
-
actual knowledge that, but for the patent license, your conveying the
|
509 |
-
covered work in a country, or your recipient's use of the covered work
|
510 |
-
in a country, would infringe one or more identifiable patents in that
|
511 |
-
country that you have reason to believe are valid.
|
512 |
-
|
513 |
-
If, pursuant to or in connection with a single transaction or
|
514 |
-
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
-
covered work, and grant a patent license to some of the parties
|
516 |
-
receiving the covered work authorizing them to use, propagate, modify
|
517 |
-
or convey a specific copy of the covered work, then the patent license
|
518 |
-
you grant is automatically extended to all recipients of the covered
|
519 |
-
work and works based on it.
|
520 |
-
|
521 |
-
A patent license is "discriminatory" if it does not include within
|
522 |
-
the scope of its coverage, prohibits the exercise of, or is
|
523 |
-
conditioned on the non-exercise of one or more of the rights that are
|
524 |
-
specifically granted under this License. You may not convey a covered
|
525 |
-
work if you are a party to an arrangement with a third party that is
|
526 |
-
in the business of distributing software, under which you make payment
|
527 |
-
to the third party based on the extent of your activity of conveying
|
528 |
-
the work, and under which the third party grants, to any of the
|
529 |
-
parties who would receive the covered work from you, a discriminatory
|
530 |
-
patent license (a) in connection with copies of the covered work
|
531 |
-
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
-
for and in connection with specific products or compilations that
|
533 |
-
contain the covered work, unless you entered into that arrangement,
|
534 |
-
or that patent license was granted, prior to 28 March 2007.
|
535 |
-
|
536 |
-
Nothing in this License shall be construed as excluding or limiting
|
537 |
-
any implied license or other defenses to infringement that may
|
538 |
-
otherwise be available to you under applicable patent law.
|
539 |
-
|
540 |
-
12. No Surrender of Others' Freedom.
|
541 |
-
|
542 |
-
If conditions are imposed on you (whether by court order, agreement or
|
543 |
-
otherwise) that contradict the conditions of this License, they do not
|
544 |
-
excuse you from the conditions of this License. If you cannot convey a
|
545 |
-
covered work so as to satisfy simultaneously your obligations under this
|
546 |
-
License and any other pertinent obligations, then as a consequence you may
|
547 |
-
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
-
to collect a royalty for further conveying from those to whom you convey
|
549 |
-
the Program, the only way you could satisfy both those terms and this
|
550 |
-
License would be to refrain entirely from conveying the Program.
|
551 |
-
|
552 |
-
13. Use with the GNU Affero General Public License.
|
553 |
-
|
554 |
-
Notwithstanding any other provision of this License, you have
|
555 |
-
permission to link or combine any covered work with a work licensed
|
556 |
-
under version 3 of the GNU Affero General Public License into a single
|
557 |
-
combined work, and to convey the resulting work. The terms of this
|
558 |
-
License will continue to apply to the part which is the covered work,
|
559 |
-
but the special requirements of the GNU Affero General Public License,
|
560 |
-
section 13, concerning interaction through a network will apply to the
|
561 |
-
combination as such.
|
562 |
-
|
563 |
-
14. Revised Versions of this License.
|
564 |
-
|
565 |
-
The Free Software Foundation may publish revised and/or new versions of
|
566 |
-
the GNU General Public License from time to time. Such new versions will
|
567 |
-
be similar in spirit to the present version, but may differ in detail to
|
568 |
-
address new problems or concerns.
|
569 |
-
|
570 |
-
Each version is given a distinguishing version number. If the
|
571 |
-
Program specifies that a certain numbered version of the GNU General
|
572 |
-
Public License "or any later version" applies to it, you have the
|
573 |
-
option of following the terms and conditions either of that numbered
|
574 |
-
version or of any later version published by the Free Software
|
575 |
-
Foundation. If the Program does not specify a version number of the
|
576 |
-
GNU General Public License, you may choose any version ever published
|
577 |
-
by the Free Software Foundation.
|
578 |
-
|
579 |
-
If the Program specifies that a proxy can decide which future
|
580 |
-
versions of the GNU General Public License can be used, that proxy's
|
581 |
-
public statement of acceptance of a version permanently authorizes you
|
582 |
-
to choose that version for the Program.
|
583 |
-
|
584 |
-
Later license versions may give you additional or different
|
585 |
-
permissions. However, no additional obligations are imposed on any
|
586 |
-
author or copyright holder as a result of your choosing to follow a
|
587 |
-
later version.
|
588 |
-
|
589 |
-
15. Disclaimer of Warranty.
|
590 |
-
|
591 |
-
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
-
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
-
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
-
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
-
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
-
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
-
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
-
|
600 |
-
16. Limitation of Liability.
|
601 |
-
|
602 |
-
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
-
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
-
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
-
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
-
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
-
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
-
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
-
SUCH DAMAGES.
|
611 |
-
|
612 |
-
17. Interpretation of Sections 15 and 16.
|
613 |
-
|
614 |
-
If the disclaimer of warranty and limitation of liability provided
|
615 |
-
above cannot be given local legal effect according to their terms,
|
616 |
-
reviewing courts shall apply local law that most closely approximates
|
617 |
-
an absolute waiver of all civil liability in connection with the
|
618 |
-
Program, unless a warranty or assumption of liability accompanies a
|
619 |
-
copy of the Program in return for a fee.
|
620 |
-
|
621 |
-
END OF TERMS AND CONDITIONS
|
622 |
-
|
623 |
-
How to Apply These Terms to Your New Programs
|
624 |
-
|
625 |
-
If you develop a new program, and you want it to be of the greatest
|
626 |
-
possible use to the public, the best way to achieve this is to make it
|
627 |
-
free software which everyone can redistribute and change under these terms.
|
628 |
-
|
629 |
-
To do so, attach the following notices to the program. It is safest
|
630 |
-
to attach them to the start of each source file to most effectively
|
631 |
-
state the exclusion of warranty; and each file should have at least
|
632 |
-
the "copyright" line and a pointer to where the full notice is found.
|
633 |
-
|
634 |
-
<one line to give the program's name and a brief idea of what it does.>
|
635 |
-
Copyright (C) <year> <name of author>
|
636 |
-
|
637 |
-
This program is free software: you can redistribute it and/or modify
|
638 |
-
it under the terms of the GNU General Public License as published by
|
639 |
-
the Free Software Foundation, either version 3 of the License, or
|
640 |
-
(at your option) any later version.
|
641 |
-
|
642 |
-
This program is distributed in the hope that it will be useful,
|
643 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
-
GNU General Public License for more details.
|
646 |
-
|
647 |
-
You should have received a copy of the GNU General Public License
|
648 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
-
|
650 |
-
Also add information on how to contact you by electronic and paper mail.
|
651 |
-
|
652 |
-
If the program does terminal interaction, make it output a short
|
653 |
-
notice like this when it starts in an interactive mode:
|
654 |
-
|
655 |
-
<program> Copyright (C) <year> <name of author>
|
656 |
-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
-
This is free software, and you are welcome to redistribute it
|
658 |
-
under certain conditions; type `show c' for details.
|
659 |
-
|
660 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
-
parts of the General Public License. Of course, your program's commands
|
662 |
-
might be different; for a GUI interface, you would use an "about box".
|
663 |
-
|
664 |
-
You should also get your employer (if you work as a programmer) or school,
|
665 |
-
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
-
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
-
<http://www.gnu.org/licenses/>.
|
668 |
-
|
669 |
-
The GNU General Public License does not permit incorporating your program
|
670 |
-
into proprietary programs. If your program is a subroutine library, you
|
671 |
-
may consider it more useful to permit linking proprietary applications with
|
672 |
-
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
-
Public License instead of this License. But first, please read
|
674 |
-
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
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 |
+
<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 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.
|
admin/class-captainform-admin.php
ADDED
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The admin-specific functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/admin
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The admin-specific functionality of the plugin.
|
15 |
+
*
|
16 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
17 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package Captainform
|
20 |
+
* @subpackage Captainform/admin
|
21 |
+
* @author captainform <team@captainform.com>
|
22 |
+
*/
|
23 |
+
class Captainform_Admin {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The ID of this plugin.
|
27 |
+
*
|
28 |
+
* @since 2.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $plugin_name The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private $plugin_name;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The version of this plugin.
|
36 |
+
*
|
37 |
+
* @since 2.0.0
|
38 |
+
* @access private
|
39 |
+
* @var string $version The current version of this plugin.
|
40 |
+
*/
|
41 |
+
private $version;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Initialize the class and set its properties.
|
45 |
+
*
|
46 |
+
* @since 2.0.0
|
47 |
+
* @param string $plugin_name The name of this plugin.
|
48 |
+
* @param string $version The version of this plugin.
|
49 |
+
*/
|
50 |
+
public function __construct( $plugin_name, $version ) {
|
51 |
+
|
52 |
+
$this->plugin_name = $plugin_name;
|
53 |
+
$this->version = $version;
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
public function add_menu_items() {
|
58 |
+
if (current_user_can('manage_options')) {
|
59 |
+
add_menu_page('CaptainForm', 'CaptainForm', 'manage_options', 'CaptainForm', array($this, 'admin_page_handler'), plugins_url('/images/captainform-18.png', __FILE__), '6.000000000000000000123123123123123123123'
|
60 |
+
);
|
61 |
+
add_submenu_page('CaptainForm', 'CaptainForm', 'My Forms', 'manage_options', 'CaptainForm', array($this, 'admin_page_handler'));
|
62 |
+
add_submenu_page('CaptainForm', 'NewForm', 'New Form', 'manage_options', 'CaptainForm-NewForm', array($this, 'admin_page_handler'));
|
63 |
+
add_submenu_page('CaptainForm', 'MyAccount', 'My Account', 'manage_options', 'CaptainForm-MyAccount', array($this, 'admin_page_handler'));
|
64 |
+
add_submenu_page('CaptainForm', 'ChangePlan', 'Change Plan', 'manage_options', 'CaptainForm-ChangePlan', array($this, 'admin_page_handler'));
|
65 |
+
add_submenu_page('CaptainForm', 'Support', 'Support', 'manage_options', 'CaptainForm-Support', array($this, 'admin_page_handler'));
|
66 |
+
|
67 |
+
add_options_page('CaptainForm Options', 'CaptainForm', 'manage_options', 'CaptainFormOptions', array($this, 'admin_page_handler'));
|
68 |
+
}
|
69 |
+
|
70 |
+
remove_menu_page('edit.php?post_type=' . 'captainform_post');
|
71 |
+
}
|
72 |
+
|
73 |
+
public function admin_page_handler()
|
74 |
+
{
|
75 |
+
$credentials_check = Captainform_Account::check_credentials_error();
|
76 |
+
if (!$credentials_check) return false;
|
77 |
+
|
78 |
+
$installation_id = get_site_option('captainform_installation_id');
|
79 |
+
$installation_key = get_site_option('captainform_installation_key');
|
80 |
+
$site = get_site_option("siteurl");
|
81 |
+
$site_real = get_option("siteurl");
|
82 |
+
|
83 |
+
$current_user = wp_get_current_user();
|
84 |
+
$display_name = $current_user->data->display_name;
|
85 |
+
|
86 |
+
$page_protocol = parse_url(site_url(), 0);
|
87 |
+
$unique_id = current(explode('.', $installation_id));
|
88 |
+
if(!strlen($unique_id))
|
89 |
+
$unique_id = uniqid('unique_') . '_' . md5(uniqid('', true));
|
90 |
+
|
91 |
+
$iframe_domain = strtolower('wp-' . $unique_id . '.app.captainform.com');
|
92 |
+
|
93 |
+
$iframe_url = strtolower($page_protocol) . '://' . $iframe_domain . "/fh-connect.php?" .
|
94 |
+
"inst=" . Captainform_Encrypt::encrypt($installation_id) .
|
95 |
+
"&key=" . Captainform_Encrypt::encrypt($installation_key) .
|
96 |
+
"&site=" . Captainform_Encrypt::encrypt($site) .
|
97 |
+
"&site_real=" . Captainform_Encrypt::encrypt($site_real) .
|
98 |
+
"&display_name=" . Captainform_Encrypt::encrypt($display_name) .
|
99 |
+
"&page=" . $_GET['page'] .
|
100 |
+
"&is_multisite=" . var_export(is_multisite(), true) .
|
101 |
+
"&wp_version=" . Captainform_Encrypt::encrypt($this->version) .
|
102 |
+
"&wp_php=" . Captainform_Encrypt::encrypt(phpversion()) .
|
103 |
+
"&admin_url=" . Captainform_Encrypt::encrypt(get_admin_url()) .
|
104 |
+
$this->get_referer_param();
|
105 |
+
|
106 |
+
if(gettype($credentials_check) == 'string')
|
107 |
+
$iframe_url .= '&wp_url_changed=true';
|
108 |
+
|
109 |
+
switch ($_GET['page']) {
|
110 |
+
case "CaptainForm":
|
111 |
+
case 'CaptainForm-NewForm':
|
112 |
+
case 'CaptainForm-MyAccount':
|
113 |
+
case 'CaptainForm-ChangePlan':
|
114 |
+
case 'CaptainForm-Support':
|
115 |
+
if (isset($_GET['cf_form_id'])) {
|
116 |
+
ob_end_clean();
|
117 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-captainform-preview.php';
|
118 |
+
Captainform_Preview::preview_form();
|
119 |
+
}
|
120 |
+
$this->enqueue_admin_page_styles();
|
121 |
+
$this->enqueue_admin_page_scripts();
|
122 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/captainform-admin-display.php';
|
123 |
+
break;
|
124 |
+
case "Captainform-Preview":
|
125 |
+
break;
|
126 |
+
case "CaptainFormOptions":
|
127 |
+
$this->options_page();
|
128 |
+
break;
|
129 |
+
default:
|
130 |
+
break;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
private function options_page() {
|
135 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/captainform-admin-plugin-options.php';
|
136 |
+
}
|
137 |
+
|
138 |
+
private function get_referer_param() {
|
139 |
+
$plugin_referer = '';
|
140 |
+
$myref = plugin_dir_url( __FILE__ ) . '/referer.php';
|
141 |
+
if (file_exists($myref)) {
|
142 |
+
require_once($myref);
|
143 |
+
$plugin_referer = '&plugin_referer=' . $captainform_referer;
|
144 |
+
}
|
145 |
+
return $plugin_referer;
|
146 |
+
}
|
147 |
+
|
148 |
+
public function enqueue_admin_page_styles(){
|
149 |
+
wp_enqueue_style('captainform_iframe_popup', plugin_dir_url( __FILE__ ) . 'css/iframe_popup.css', false, $this->version);
|
150 |
+
wp_enqueue_style('captainform_form_popup', plugin_dir_url( __FILE__ ) . 'css/form_popup.css', false, $this->version);
|
151 |
+
wp_enqueue_style('captainform_review_css', plugin_dir_url( __FILE__ ) . 'css/review.css', false, $this->version);
|
152 |
+
if (strpos(getenv("HTTP_USER_AGENT"), "Mac") !== FALSE) {
|
153 |
+
wp_enqueue_style('captainform_iframe_popup', plugin_dir_url( __FILE__ ) . 'css/wp_captainform_os.css', false, $this->version);
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
private function enqueue_admin_page_scripts(){
|
158 |
+
wp_enqueue_script('captainform_form_popup', plugin_dir_url( __FILE__ ) . 'js/captainform-form-popup.js', array('jquery'), $this->version, false);
|
159 |
+
wp_enqueue_script('captainform_iframe_resizer', plugin_dir_url( __FILE__ ) . 'js/iframeResizer.min.js', array(), '3.5', false);
|
160 |
+
wp_enqueue_script('captainform_main_js', plugin_dir_url( __FILE__ ) . 'js/captainform-main.js', array(), $this->version, false);
|
161 |
+
wp_enqueue_script('captainform_reviews_js', plugin_dir_url( __FILE__ ) . 'js/review.js', array(), $this->version, false);
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Register the stylesheets for the admin area.
|
166 |
+
*
|
167 |
+
* @since 2.0.0
|
168 |
+
*/
|
169 |
+
public function enqueue_styles() {
|
170 |
+
|
171 |
+
wp_enqueue_style( 'captainform_admin_css', plugin_dir_url( __FILE__ ) . 'css/captainform-admin.css', array(), $this->version, 'all' );
|
172 |
+
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Register the JavaScript for the admin area.
|
177 |
+
*
|
178 |
+
* @since 2.0.0
|
179 |
+
*/
|
180 |
+
public function enqueue_scripts() {
|
181 |
+
|
182 |
+
wp_enqueue_script( 'captainform_admin_js', plugin_dir_url( __FILE__ ) . 'js/captainform-admin.js', array( 'jquery' ), $this->version, false );
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Register the settings for captainform.
|
188 |
+
*
|
189 |
+
* @since 2.0.0
|
190 |
+
*/
|
191 |
+
public function register_settings() {
|
192 |
+
register_setting('cf_wpp_settings_group', 'cf_wpp_settings');
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Register the external plugins needed for tinymce to display the captainform popup
|
197 |
+
*
|
198 |
+
* @since 2.0.0
|
199 |
+
*/
|
200 |
+
public function register_mce_external_plugins($plugin_array) {
|
201 |
+
$plugin_path = plugin_dir_url(plugin_dir_path(__FILE__));
|
202 |
+
|
203 |
+
$plugin_array['captainform_chosen'] = $plugin_path . 'admin/js/chosen.jquery.js';
|
204 |
+
$plugin_array['captainform_jscolor'] = $plugin_path . 'admin/js/jscolor/jscolor.js';
|
205 |
+
$plugin_array['captainform_widget_js'] = $plugin_path . 'admin/js/widget.js';
|
206 |
+
|
207 |
+
return $plugin_array;
|
208 |
+
array_push($buttons, 'separator', 'captainform');
|
209 |
+
return $buttons;
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Register the scripts for the media button
|
214 |
+
*
|
215 |
+
* @since 2.2.1
|
216 |
+
*/
|
217 |
+
public function register_media_scripts() {
|
218 |
+
wp_enqueue_style('cf-widget-css', plugin_dir_url( __FILE__ ) . 'css/widget.css', array(), $this->version);
|
219 |
+
wp_enqueue_style('', plugin_dir_url( __FILE__ ) . 'css/publish_lightbox_posts.css', array(), $this->version);
|
220 |
+
wp_enqueue_style('captainform_admin_css', plugin_dir_url( __FILE__ ) . 'css/chosen/chosen.css', array(), $this->version);
|
221 |
+
wp_enqueue_style('captainform_iframe_popup', plugin_dir_url( __FILE__ ) . 'css/iframe_popup.css', array(), $this->version);
|
222 |
+
|
223 |
+
wp_enqueue_script( 'cf_widget_js', plugin_dir_url( __FILE__ ) . 'js/widget.js', array(), $this->version, false );
|
224 |
+
wp_enqueue_script( 'captainform_admin_js', plugin_dir_url( __FILE__ ) . 'js/wp-editor-captainform-media-button.js', array(), $this->version, false );
|
225 |
+
wp_enqueue_script( 'cf_chosen_js', plugin_dir_url( __FILE__ ) . 'js/chosen.jquery.js', array(), $this->version, false );
|
226 |
+
wp_enqueue_script( 'cf_color_picker_js', plugin_dir_url( __FILE__ ) . 'js/jscolor/jscolor.js', array(), $this->version, false );
|
227 |
+
wp_enqueue_script('thickbox',null,array('jquery'));
|
228 |
+
wp_enqueue_style( 'thickbox' );
|
229 |
+
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Add the media button for the CaptainForm plugin
|
234 |
+
*
|
235 |
+
* @since 2.2.1
|
236 |
+
*/
|
237 |
+
function add_captainform_media_button() {
|
238 |
+
?>
|
239 |
+
<a id="captainform-123" class="button thickbox" onclick="captainformShowThickBox()">
|
240 |
+
<img src="<?=plugin_dir_url(plugin_dir_path(__FILE__))?>admin/images/captainform-18.png"> CaptainForm
|
241 |
+
</a>
|
242 |
+
<?php
|
243 |
+
}
|
244 |
+
|
245 |
+
function mce_insert_dialog() {
|
246 |
+
$response = Captainform_Utils::get_remote_forms('page_or_post');
|
247 |
+
$captainform_forms_controls = isset($response->controls) ? $response->controls : array();
|
248 |
+
$captainform_display_as_lightbox_name = "cf_display_as_lightbox_name";
|
249 |
+
$captainform_use_custom_vars_name = "cf_use_custom_vars_name";
|
250 |
+
$captainform_trigger_option_name = "cf_trigger_option_name";
|
251 |
+
$captainform_selected_trigger = 0;
|
252 |
+
$captainform_trigger_0_name = "cf_trigger_0_name";
|
253 |
+
$captainform_trigger_0_text = "Contact Us";
|
254 |
+
$captainform_trigger_1_name = "cf_trigger_1_name";
|
255 |
+
$captainform_trigger_1_url = plugins_url('/public/images/publish_lighbox_default_image_v2.png', dirname(__FILE__));
|
256 |
+
$captainform_trigger_2_text_name = "cf_trigger_2_text_name";
|
257 |
+
$captainform_trigger_2_text = "Contact us";
|
258 |
+
$captainform_trigger_2_position_name = "cf_trigger_2_position_name";
|
259 |
+
$captainform_trigger_2_position = 1;
|
260 |
+
$captainform_trigger_2_background_name = "cf_trigger_2_background_name";
|
261 |
+
$captainform_trigger_2_background = "FF0000";
|
262 |
+
$captainform_trigger_2_color_name = "cf_trigger_2_color_name";
|
263 |
+
$captainform_trigger_2_color = "FFFFFF";
|
264 |
+
$captainform_trigger_3_after_name = "cf_trigger_3_after_name";
|
265 |
+
$captainform_trigger_3_after = 3;
|
266 |
+
|
267 |
+
$captainform_auto_popup_trigger_option_name = 'captainform_auto_popup_trigger';
|
268 |
+
$captainform_auto_popup_selected_trigger = 1;
|
269 |
+
?>
|
270 |
+
<script type="text/javascript">
|
271 |
+
var pluginUrlPath = '<?=plugin_dir_url(plugin_dir_path(__FILE__))?>';
|
272 |
+
var captainform_forms_controls = <?php echo json_encode($captainform_forms_controls);?>;
|
273 |
+
captainformBindPagePostWidget(pluginUrlPath);
|
274 |
+
</script>
|
275 |
+
<?php
|
276 |
+
if ($response->status == 'ok') {
|
277 |
+
$captainform_publish_code_value = "";
|
278 |
+
?>
|
279 |
+
<div class="captainform_widget_container">
|
280 |
+
<div class="captainform_space">
|
281 |
+
<b>Select the form you want to embed:</b>
|
282 |
+
<br>
|
283 |
+
<select name="captainform_form_toembed"
|
284 |
+
id="captainform_form_toembed"
|
285 |
+
class="captainform_widget_select">
|
286 |
+
<?php
|
287 |
+
$first_form_id = null;
|
288 |
+
foreach ($response->forms as $form) {
|
289 |
+
if ($captainform_publish_code_value == "")
|
290 |
+
$captainform_publish_code_value = '[captainform id="' . $form->f_id . '"]';
|
291 |
+
?>
|
292 |
+
<option value="<?php echo $form->f_id; ?>"><?php echo $form->f_name; ?></option>
|
293 |
+
<?php
|
294 |
+
}
|
295 |
+
?>
|
296 |
+
</select>
|
297 |
+
<div id="captainform_publish_lightbox_main_container">
|
298 |
+
<?php
|
299 |
+
require plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/captainform-admin-publish-options.php';
|
300 |
+
?>
|
301 |
+
<br/>
|
302 |
+
<input type="hidden" id="captainform_publish_code"
|
303 |
+
name="<?php if (isset($captainform_lightbox_publish_code_name)) echo $captainform_lightbox_publish_code_name; ?>"
|
304 |
+
class="cf_generated_code" value='<?php echo $captainform_publish_code_value; ?>'/>
|
305 |
+
<input type="hidden" id="captainform_custom_vars_code" class="captainform_custom_vars_code" value=''/>
|
306 |
+
<div class="clear"></div>
|
307 |
+
</div>
|
308 |
+
</div>
|
309 |
+
</div>
|
310 |
+
<div class="clear"></div>
|
311 |
+
<div class="footer-button">
|
312 |
+
<button id="captainform-button-insert" class="button button-primary captainform-insert" value="Insert form" onclick="captainformInsertShortcode();">Insert form</button>
|
313 |
+
<button id="captainform-button-cancel" class="button" value="Cancel" onclick="captainformRemoveThickBox();">Cancel</button>
|
314 |
+
</div>
|
315 |
+
<?php
|
316 |
+
} else {
|
317 |
+
if ($response->error_message) {
|
318 |
+
if (isset($response->error_code) && $response->error_code == 2) {
|
319 |
+
echo "Create a form and return here to publish it";
|
320 |
+
} elseif (isset($response->error_code) && $response->error_code == 1) {
|
321 |
+
echo "Please activate your account first! Go to the CaptainForm tab and enter your license key or activate your free account. Create a form and return here to publish it.";
|
322 |
+
} else
|
323 |
+
echo $response->error_message;
|
324 |
+
} else
|
325 |
+
echo 'Fatal error - ' . $response->status;
|
326 |
+
}
|
327 |
+
exit();
|
328 |
+
}
|
329 |
+
}
|
admin/css/captainform-admin.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* All of the CSS for your admin-specific functionality should be
|
3 |
+
* included in this file.
|
4 |
+
*/
|
{includes → admin}/css/chosen/chosen-sprite.png
RENAMED
File without changes
|
{includes → admin}/css/chosen/chosen-sprite@2x.png
RENAMED
File without changes
|
{includes → admin}/css/chosen/chosen.css
RENAMED
@@ -1,5 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
/* @group Base */
|
4 |
.chosen-container {
|
5 |
position: relative;
|
@@ -12,6 +10,7 @@
|
|
12 |
-moz-user-select: none;
|
13 |
user-select: none;
|
14 |
}
|
|
|
15 |
.chosen-container .chosen-drop {
|
16 |
position: absolute;
|
17 |
top: 100%;
|
@@ -24,12 +23,12 @@
|
|
24 |
border: 1px solid #aaa;
|
25 |
border-top: 0;
|
26 |
background: #fff;
|
27 |
-
|
28 |
-
/*box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);*/
|
29 |
}
|
|
|
30 |
.chosen-container.chosen-with-drop .chosen-drop {
|
31 |
left: 0;
|
32 |
}
|
|
|
33 |
.chosen-container a {
|
34 |
cursor: pointer;
|
35 |
}
|
@@ -43,24 +42,19 @@
|
|
43 |
padding: 0 0 0 8px;
|
44 |
height: 23px;
|
45 |
border: 1px solid #aaa;
|
46 |
-
/*border-radius: 5px;*/
|
47 |
background-color: #fff;
|
48 |
-
/* background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
|
49 |
-
background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
50 |
-
background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
51 |
-
background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
52 |
-
background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);*/
|
53 |
background-clip: padding-box;
|
54 |
-
/*box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);*/
|
55 |
color: #000000;
|
56 |
text-decoration: none;
|
57 |
white-space: nowrap;
|
58 |
line-height: 24px;
|
59 |
}
|
|
|
60 |
.chosen-container-single .chosen-default {
|
61 |
color: #000000;
|
62 |
color: red;
|
63 |
}
|
|
|
64 |
.chosen-container-single .chosen-single span {
|
65 |
display: block;
|
66 |
overflow: hidden;
|
@@ -68,9 +62,11 @@
|
|
68 |
text-overflow: ellipsis;
|
69 |
white-space: nowrap;
|
70 |
}
|
|
|
71 |
.chosen-container-single .chosen-single-with-deselect span {
|
72 |
margin-right: 38px;
|
73 |
}
|
|
|
74 |
.chosen-container-single .chosen-single abbr {
|
75 |
position: absolute;
|
76 |
top: 6px;
|
@@ -81,22 +77,23 @@
|
|
81 |
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
82 |
font-size: 1px;
|
83 |
}
|
|
|
84 |
.chosen-container-single .chosen-single abbr:hover {
|
85 |
background-position: -42px -10px;
|
86 |
}
|
|
|
87 |
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
88 |
background-position: -42px -10px;
|
89 |
}
|
90 |
|
91 |
/* scos bbarraow*/
|
92 |
|
93 |
-
|
94 |
.chosen-container-single .chosen-single div b {
|
95 |
display: block;
|
96 |
width: 100%;
|
97 |
height: 100%;
|
98 |
-
background: url('chosen-sprite.png') no-repeat 0px 2px;
|
99 |
}
|
|
|
100 |
.chosen-container-single .chosen-search {
|
101 |
position: relative;
|
102 |
z-index: 1010;
|
@@ -104,6 +101,7 @@
|
|
104 |
padding: 3px 4px;
|
105 |
white-space: nowrap;
|
106 |
}
|
|
|
107 |
.chosen-container-single .chosen-search input[type="text"] {
|
108 |
-webkit-box-sizing: border-box;
|
109 |
-moz-box-sizing: border-box;
|
@@ -121,11 +119,12 @@
|
|
121 |
line-height: normal;
|
122 |
border-radius: 0;
|
123 |
}
|
|
|
124 |
.chosen-container-single .chosen-drop {
|
125 |
margin-top: -1px;
|
126 |
-
/*border-radius: 0 0 4px 4px;*/
|
127 |
background-clip: padding-box;
|
128 |
}
|
|
|
129 |
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
130 |
position: absolute;
|
131 |
left: -9999px;
|
@@ -142,6 +141,7 @@
|
|
142 |
max-height: 150px;
|
143 |
-webkit-overflow-scrolling: touch;
|
144 |
}
|
|
|
145 |
.chosen-container .chosen-results li {
|
146 |
display: none;
|
147 |
margin: 0;
|
@@ -150,21 +150,23 @@
|
|
150 |
line-height: 15px;
|
151 |
-webkit-touch-callout: none;
|
152 |
}
|
|
|
153 |
.chosen-container .chosen-results li.active-result {
|
154 |
display: list-item;
|
155 |
cursor: pointer;
|
156 |
}
|
|
|
157 |
.chosen-container .chosen-results li.disabled-result {
|
158 |
display: list-item;
|
159 |
color: #000000;
|
160 |
cursor: default;
|
161 |
-
|
162 |
-
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
163 |
filter: alpha(opacity=50);
|
164 |
-
-moz-opacity:0.5;
|
165 |
-khtml-opacity: 0.5;
|
166 |
opacity: 0.5;
|
167 |
}
|
|
|
168 |
.chosen-container .chosen-results li.highlighted {
|
169 |
background-color: #3875d7;
|
170 |
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
|
@@ -174,18 +176,22 @@
|
|
174 |
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
175 |
color: #fff;
|
176 |
}
|
|
|
177 |
.chosen-container .chosen-results li.no-results {
|
178 |
display: list-item;
|
179 |
background: #f4f4f4;
|
180 |
}
|
|
|
181 |
.chosen-container .chosen-results li.group-result {
|
182 |
display: list-item;
|
183 |
font-weight: bold;
|
184 |
cursor: default;
|
185 |
}
|
|
|
186 |
.chosen-container .chosen-results li.group-option {
|
187 |
padding-left: 15px;
|
188 |
}
|
|
|
189 |
.chosen-container .chosen-results li em {
|
190 |
font-style: normal;
|
191 |
text-decoration: underline;
|
@@ -206,22 +212,20 @@
|
|
206 |
height: 1%;
|
207 |
border: 1px solid #aaa;
|
208 |
background-color: #fff;
|
209 |
-
/* background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
210 |
-
background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
211 |
-
background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
212 |
-
background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
213 |
-
background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);*/
|
214 |
cursor: text;
|
215 |
}
|
|
|
216 |
.chosen-container-multi .chosen-choices li {
|
217 |
float: left;
|
218 |
list-style: none;
|
219 |
}
|
|
|
220 |
.chosen-container-multi .chosen-choices li.search-field {
|
221 |
margin: 0;
|
222 |
padding: 0;
|
223 |
white-space: nowrap;
|
224 |
}
|
|
|
225 |
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
226 |
margin: 1px 0;
|
227 |
padding: 5px;
|
@@ -232,13 +236,14 @@
|
|
232 |
box-shadow: none;
|
233 |
color: #666;
|
234 |
font-size: 100%;
|
235 |
-
/*font-family: sans-serif;*/
|
236 |
line-height: normal;
|
237 |
border-radius: 0;
|
238 |
}
|
|
|
239 |
.chosen-container-multi .chosen-choices li.search-field .default {
|
240 |
color: #999;
|
241 |
}
|
|
|
242 |
.chosen-container-multi .chosen-choices li.search-choice {
|
243 |
position: relative;
|
244 |
margin: 3px 0 3px 5px;
|
@@ -248,11 +253,11 @@
|
|
248 |
background-color: #e4e4e4;
|
249 |
|
250 |
background-clip: padding-box;
|
251 |
-
/*box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);*/
|
252 |
color: #333;
|
253 |
line-height: 13px;
|
254 |
cursor: default;
|
255 |
}
|
|
|
256 |
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
257 |
position: absolute;
|
258 |
top: 4px;
|
@@ -263,30 +268,31 @@
|
|
263 |
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
264 |
font-size: 1px;
|
265 |
}
|
|
|
266 |
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
267 |
background-position: -42px -10px;
|
268 |
}
|
|
|
269 |
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
270 |
padding-right: 5px;
|
271 |
border: 1px solid #ccc;
|
272 |
background-color: #e4e4e4;
|
273 |
-
/* background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
274 |
-
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
275 |
-
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
276 |
-
background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
277 |
-
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);*/
|
278 |
color: #666;
|
279 |
}
|
|
|
280 |
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
281 |
background: #d4d4d4;
|
282 |
}
|
|
|
283 |
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
284 |
background-position: -42px -10px;
|
285 |
}
|
|
|
286 |
.chosen-container-multi .chosen-results {
|
287 |
margin: 0;
|
288 |
padding: 0;
|
289 |
}
|
|
|
290 |
.chosen-container-multi .chosen-drop .result-selected {
|
291 |
display: list-item;
|
292 |
color: #ccc;
|
@@ -297,32 +303,29 @@
|
|
297 |
/* @group Active */
|
298 |
.chosen-container-active .chosen-single {
|
299 |
border: 1px solid #5897fb;
|
300 |
-
/*box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
|
301 |
}
|
|
|
302 |
.chosen-container-active.chosen-with-drop .chosen-single {
|
303 |
border: 1px solid #aaa;
|
304 |
-moz-border-radius-bottomright: 0;
|
305 |
border-bottom-right-radius: 0;
|
306 |
-moz-border-radius-bottomleft: 0;
|
307 |
border-bottom-left-radius: 0;
|
308 |
-
/* background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
|
309 |
-
background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
310 |
-
background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
311 |
-
background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
312 |
-
background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
|
313 |
-
box-shadow: 0 1px 0 #fff inset;*/
|
314 |
}
|
|
|
315 |
.chosen-container-active.chosen-with-drop .chosen-single div {
|
316 |
border-left: none;
|
317 |
background: transparent;
|
318 |
}
|
|
|
319 |
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
320 |
background-position: -18px 2px;
|
321 |
}
|
|
|
322 |
.chosen-container-active .chosen-choices {
|
323 |
border: 1px solid #5897fb;
|
324 |
-
/*box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
|
325 |
}
|
|
|
326 |
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
327 |
color: #111 !important;
|
328 |
}
|
@@ -333,9 +336,11 @@
|
|
333 |
opacity: 0.5 !important;
|
334 |
cursor: default;
|
335 |
}
|
|
|
336 |
.chosen-disabled .chosen-single {
|
337 |
cursor: default;
|
338 |
}
|
|
|
339 |
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
340 |
cursor: default;
|
341 |
}
|
@@ -345,64 +350,80 @@
|
|
345 |
.chosen-rtl {
|
346 |
text-align: right;
|
347 |
}
|
|
|
348 |
.chosen-rtl .chosen-single {
|
349 |
overflow: visible;
|
350 |
padding: 0 8px 0 0;
|
351 |
}
|
|
|
352 |
.chosen-rtl .chosen-single span {
|
353 |
margin-right: 0;
|
354 |
margin-left: 26px;
|
355 |
direction: rtl;
|
356 |
}
|
|
|
357 |
.chosen-rtl .chosen-single-with-deselect span {
|
358 |
margin-left: 38px;
|
359 |
}
|
|
|
360 |
.chosen-rtl .chosen-single div {
|
361 |
right: auto;
|
362 |
left: 3px;
|
363 |
}
|
|
|
364 |
.chosen-rtl .chosen-single abbr {
|
365 |
right: auto;
|
366 |
left: 26px;
|
367 |
}
|
|
|
368 |
.chosen-rtl .chosen-choices li {
|
369 |
float: right;
|
370 |
}
|
|
|
371 |
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
372 |
direction: rtl;
|
373 |
}
|
|
|
374 |
.chosen-rtl .chosen-choices li.search-choice {
|
375 |
margin: 3px 5px 3px 0;
|
376 |
padding: 3px 5px 3px 19px;
|
377 |
}
|
|
|
378 |
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
379 |
right: auto;
|
380 |
left: 4px;
|
381 |
}
|
|
|
382 |
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
|
383 |
.chosen-rtl .chosen-drop {
|
384 |
left: 9999px;
|
385 |
}
|
|
|
386 |
.chosen-rtl.chosen-container-single .chosen-results {
|
387 |
margin: 0 0 4px 4px;
|
388 |
padding: 0 4px 0 0;
|
389 |
}
|
|
|
390 |
.chosen-rtl .chosen-results li.group-option {
|
391 |
padding-right: 15px;
|
392 |
padding-left: 0;
|
393 |
}
|
|
|
394 |
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
395 |
border-right: none;
|
396 |
}
|
|
|
397 |
.chosen-rtl .chosen-search input[type="text"] {
|
398 |
padding: 4px 5px 4px 20px;
|
399 |
background: white url('chosen-sprite.png') no-repeat -30px -20px;
|
400 |
background: url('chosen-sprite.png') no-repeat -30px -20px;
|
401 |
direction: rtl;
|
402 |
}
|
|
|
403 |
.chosen-rtl.chosen-container-single .chosen-single div b {
|
404 |
background-position: 6px 2px;
|
405 |
}
|
|
|
406 |
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
407 |
background-position: -12px 2px;
|
408 |
}
|
@@ -422,4 +443,5 @@
|
|
422 |
background-repeat: no-repeat !important;
|
423 |
}
|
424 |
}
|
|
|
425 |
/* @end */
|
|
|
|
|
1 |
/* @group Base */
|
2 |
.chosen-container {
|
3 |
position: relative;
|
10 |
-moz-user-select: none;
|
11 |
user-select: none;
|
12 |
}
|
13 |
+
|
14 |
.chosen-container .chosen-drop {
|
15 |
position: absolute;
|
16 |
top: 100%;
|
23 |
border: 1px solid #aaa;
|
24 |
border-top: 0;
|
25 |
background: #fff;
|
|
|
|
|
26 |
}
|
27 |
+
|
28 |
.chosen-container.chosen-with-drop .chosen-drop {
|
29 |
left: 0;
|
30 |
}
|
31 |
+
|
32 |
.chosen-container a {
|
33 |
cursor: pointer;
|
34 |
}
|
42 |
padding: 0 0 0 8px;
|
43 |
height: 23px;
|
44 |
border: 1px solid #aaa;
|
|
|
45 |
background-color: #fff;
|
|
|
|
|
|
|
|
|
|
|
46 |
background-clip: padding-box;
|
|
|
47 |
color: #000000;
|
48 |
text-decoration: none;
|
49 |
white-space: nowrap;
|
50 |
line-height: 24px;
|
51 |
}
|
52 |
+
|
53 |
.chosen-container-single .chosen-default {
|
54 |
color: #000000;
|
55 |
color: red;
|
56 |
}
|
57 |
+
|
58 |
.chosen-container-single .chosen-single span {
|
59 |
display: block;
|
60 |
overflow: hidden;
|
62 |
text-overflow: ellipsis;
|
63 |
white-space: nowrap;
|
64 |
}
|
65 |
+
|
66 |
.chosen-container-single .chosen-single-with-deselect span {
|
67 |
margin-right: 38px;
|
68 |
}
|
69 |
+
|
70 |
.chosen-container-single .chosen-single abbr {
|
71 |
position: absolute;
|
72 |
top: 6px;
|
77 |
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
78 |
font-size: 1px;
|
79 |
}
|
80 |
+
|
81 |
.chosen-container-single .chosen-single abbr:hover {
|
82 |
background-position: -42px -10px;
|
83 |
}
|
84 |
+
|
85 |
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
86 |
background-position: -42px -10px;
|
87 |
}
|
88 |
|
89 |
/* scos bbarraow*/
|
90 |
|
|
|
91 |
.chosen-container-single .chosen-single div b {
|
92 |
display: block;
|
93 |
width: 100%;
|
94 |
height: 100%;
|
|
|
95 |
}
|
96 |
+
|
97 |
.chosen-container-single .chosen-search {
|
98 |
position: relative;
|
99 |
z-index: 1010;
|
101 |
padding: 3px 4px;
|
102 |
white-space: nowrap;
|
103 |
}
|
104 |
+
|
105 |
.chosen-container-single .chosen-search input[type="text"] {
|
106 |
-webkit-box-sizing: border-box;
|
107 |
-moz-box-sizing: border-box;
|
119 |
line-height: normal;
|
120 |
border-radius: 0;
|
121 |
}
|
122 |
+
|
123 |
.chosen-container-single .chosen-drop {
|
124 |
margin-top: -1px;
|
|
|
125 |
background-clip: padding-box;
|
126 |
}
|
127 |
+
|
128 |
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
129 |
position: absolute;
|
130 |
left: -9999px;
|
141 |
max-height: 150px;
|
142 |
-webkit-overflow-scrolling: touch;
|
143 |
}
|
144 |
+
|
145 |
.chosen-container .chosen-results li {
|
146 |
display: none;
|
147 |
margin: 0;
|
150 |
line-height: 15px;
|
151 |
-webkit-touch-callout: none;
|
152 |
}
|
153 |
+
|
154 |
.chosen-container .chosen-results li.active-result {
|
155 |
display: list-item;
|
156 |
cursor: pointer;
|
157 |
}
|
158 |
+
|
159 |
.chosen-container .chosen-results li.disabled-result {
|
160 |
display: list-item;
|
161 |
color: #000000;
|
162 |
cursor: default;
|
163 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
|
|
164 |
filter: alpha(opacity=50);
|
165 |
+
-moz-opacity: 0.5;
|
166 |
-khtml-opacity: 0.5;
|
167 |
opacity: 0.5;
|
168 |
}
|
169 |
+
|
170 |
.chosen-container .chosen-results li.highlighted {
|
171 |
background-color: #3875d7;
|
172 |
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
|
176 |
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
177 |
color: #fff;
|
178 |
}
|
179 |
+
|
180 |
.chosen-container .chosen-results li.no-results {
|
181 |
display: list-item;
|
182 |
background: #f4f4f4;
|
183 |
}
|
184 |
+
|
185 |
.chosen-container .chosen-results li.group-result {
|
186 |
display: list-item;
|
187 |
font-weight: bold;
|
188 |
cursor: default;
|
189 |
}
|
190 |
+
|
191 |
.chosen-container .chosen-results li.group-option {
|
192 |
padding-left: 15px;
|
193 |
}
|
194 |
+
|
195 |
.chosen-container .chosen-results li em {
|
196 |
font-style: normal;
|
197 |
text-decoration: underline;
|
212 |
height: 1%;
|
213 |
border: 1px solid #aaa;
|
214 |
background-color: #fff;
|
|
|
|
|
|
|
|
|
|
|
215 |
cursor: text;
|
216 |
}
|
217 |
+
|
218 |
.chosen-container-multi .chosen-choices li {
|
219 |
float: left;
|
220 |
list-style: none;
|
221 |
}
|
222 |
+
|
223 |
.chosen-container-multi .chosen-choices li.search-field {
|
224 |
margin: 0;
|
225 |
padding: 0;
|
226 |
white-space: nowrap;
|
227 |
}
|
228 |
+
|
229 |
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
230 |
margin: 1px 0;
|
231 |
padding: 5px;
|
236 |
box-shadow: none;
|
237 |
color: #666;
|
238 |
font-size: 100%;
|
|
|
239 |
line-height: normal;
|
240 |
border-radius: 0;
|
241 |
}
|
242 |
+
|
243 |
.chosen-container-multi .chosen-choices li.search-field .default {
|
244 |
color: #999;
|
245 |
}
|
246 |
+
|
247 |
.chosen-container-multi .chosen-choices li.search-choice {
|
248 |
position: relative;
|
249 |
margin: 3px 0 3px 5px;
|
253 |
background-color: #e4e4e4;
|
254 |
|
255 |
background-clip: padding-box;
|
|
|
256 |
color: #333;
|
257 |
line-height: 13px;
|
258 |
cursor: default;
|
259 |
}
|
260 |
+
|
261 |
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
262 |
position: absolute;
|
263 |
top: 4px;
|
268 |
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
269 |
font-size: 1px;
|
270 |
}
|
271 |
+
|
272 |
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
273 |
background-position: -42px -10px;
|
274 |
}
|
275 |
+
|
276 |
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
277 |
padding-right: 5px;
|
278 |
border: 1px solid #ccc;
|
279 |
background-color: #e4e4e4;
|
|
|
|
|
|
|
|
|
|
|
280 |
color: #666;
|
281 |
}
|
282 |
+
|
283 |
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
284 |
background: #d4d4d4;
|
285 |
}
|
286 |
+
|
287 |
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
288 |
background-position: -42px -10px;
|
289 |
}
|
290 |
+
|
291 |
.chosen-container-multi .chosen-results {
|
292 |
margin: 0;
|
293 |
padding: 0;
|
294 |
}
|
295 |
+
|
296 |
.chosen-container-multi .chosen-drop .result-selected {
|
297 |
display: list-item;
|
298 |
color: #ccc;
|
303 |
/* @group Active */
|
304 |
.chosen-container-active .chosen-single {
|
305 |
border: 1px solid #5897fb;
|
|
|
306 |
}
|
307 |
+
|
308 |
.chosen-container-active.chosen-with-drop .chosen-single {
|
309 |
border: 1px solid #aaa;
|
310 |
-moz-border-radius-bottomright: 0;
|
311 |
border-bottom-right-radius: 0;
|
312 |
-moz-border-radius-bottomleft: 0;
|
313 |
border-bottom-left-radius: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
}
|
315 |
+
|
316 |
.chosen-container-active.chosen-with-drop .chosen-single div {
|
317 |
border-left: none;
|
318 |
background: transparent;
|
319 |
}
|
320 |
+
|
321 |
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
322 |
background-position: -18px 2px;
|
323 |
}
|
324 |
+
|
325 |
.chosen-container-active .chosen-choices {
|
326 |
border: 1px solid #5897fb;
|
|
|
327 |
}
|
328 |
+
|
329 |
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
330 |
color: #111 !important;
|
331 |
}
|
336 |
opacity: 0.5 !important;
|
337 |
cursor: default;
|
338 |
}
|
339 |
+
|
340 |
.chosen-disabled .chosen-single {
|
341 |
cursor: default;
|
342 |
}
|
343 |
+
|
344 |
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
345 |
cursor: default;
|
346 |
}
|
350 |
.chosen-rtl {
|
351 |
text-align: right;
|
352 |
}
|
353 |
+
|
354 |
.chosen-rtl .chosen-single {
|
355 |
overflow: visible;
|
356 |
padding: 0 8px 0 0;
|
357 |
}
|
358 |
+
|
359 |
.chosen-rtl .chosen-single span {
|
360 |
margin-right: 0;
|
361 |
margin-left: 26px;
|
362 |
direction: rtl;
|
363 |
}
|
364 |
+
|
365 |
.chosen-rtl .chosen-single-with-deselect span {
|
366 |
margin-left: 38px;
|
367 |
}
|
368 |
+
|
369 |
.chosen-rtl .chosen-single div {
|
370 |
right: auto;
|
371 |
left: 3px;
|
372 |
}
|
373 |
+
|
374 |
.chosen-rtl .chosen-single abbr {
|
375 |
right: auto;
|
376 |
left: 26px;
|
377 |
}
|
378 |
+
|
379 |
.chosen-rtl .chosen-choices li {
|
380 |
float: right;
|
381 |
}
|
382 |
+
|
383 |
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
384 |
direction: rtl;
|
385 |
}
|
386 |
+
|
387 |
.chosen-rtl .chosen-choices li.search-choice {
|
388 |
margin: 3px 5px 3px 0;
|
389 |
padding: 3px 5px 3px 19px;
|
390 |
}
|
391 |
+
|
392 |
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
393 |
right: auto;
|
394 |
left: 4px;
|
395 |
}
|
396 |
+
|
397 |
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
|
398 |
.chosen-rtl .chosen-drop {
|
399 |
left: 9999px;
|
400 |
}
|
401 |
+
|
402 |
.chosen-rtl.chosen-container-single .chosen-results {
|
403 |
margin: 0 0 4px 4px;
|
404 |
padding: 0 4px 0 0;
|
405 |
}
|
406 |
+
|
407 |
.chosen-rtl .chosen-results li.group-option {
|
408 |
padding-right: 15px;
|
409 |
padding-left: 0;
|
410 |
}
|
411 |
+
|
412 |
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
413 |
border-right: none;
|
414 |
}
|
415 |
+
|
416 |
.chosen-rtl .chosen-search input[type="text"] {
|
417 |
padding: 4px 5px 4px 20px;
|
418 |
background: white url('chosen-sprite.png') no-repeat -30px -20px;
|
419 |
background: url('chosen-sprite.png') no-repeat -30px -20px;
|
420 |
direction: rtl;
|
421 |
}
|
422 |
+
|
423 |
.chosen-rtl.chosen-container-single .chosen-single div b {
|
424 |
background-position: 6px 2px;
|
425 |
}
|
426 |
+
|
427 |
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
428 |
background-position: -12px 2px;
|
429 |
}
|
443 |
background-repeat: no-repeat !important;
|
444 |
}
|
445 |
}
|
446 |
+
|
447 |
/* @end */
|
{includes → admin}/css/credentials_error.css
RENAMED
File without changes
|
admin/css/form_popup.css
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.captainform_popup_bg_form {
|
2 |
+
display: none;
|
3 |
+
position: fixed;
|
4 |
+
top: 0;
|
5 |
+
left: 0;
|
6 |
+
width: 100%;
|
7 |
+
height: 100%;
|
8 |
+
box-sizing: border-box;
|
9 |
+
z-index: 9999999;
|
10 |
+
background: url(../images/black-50.png);
|
11 |
+
background: rgba(0, 0, 0, .8);
|
12 |
+
outline: none;
|
13 |
+
}
|
14 |
+
|
15 |
+
.captainform_popup_box_form {
|
16 |
+
display: block;
|
17 |
+
position: absolute;
|
18 |
+
width: 500px;
|
19 |
+
height: 250px;
|
20 |
+
max-height: 100%;
|
21 |
+
max-width: 100%;
|
22 |
+
box-sizing: border-box;
|
23 |
+
top: 0;
|
24 |
+
left: 0;
|
25 |
+
bottom: 0;
|
26 |
+
right: 0;
|
27 |
+
font-size: 0;
|
28 |
+
border: none;
|
29 |
+
border-radius: 4px;
|
30 |
+
padding: 8px;
|
31 |
+
margin: auto;
|
32 |
+
}
|
33 |
+
|
34 |
+
.captainform_loader_form {
|
35 |
+
display: block;
|
36 |
+
overflow: hidden;
|
37 |
+
position: absolute;
|
38 |
+
width: 128px;
|
39 |
+
height: 128px;
|
40 |
+
box-sizing: border-box;
|
41 |
+
margin: auto;
|
42 |
+
top: 0;
|
43 |
+
left: 0;
|
44 |
+
bottom: 0;
|
45 |
+
right: 0;
|
46 |
+
background: transparent url('../images/ring.svg') no-repeat center center;
|
47 |
+
}
|
48 |
+
|
49 |
+
.captainform_popup_body_form {
|
50 |
+
display: block;
|
51 |
+
overflow: hidden;
|
52 |
+
box-sizing: border-box;
|
53 |
+
overflow-y: auto;
|
54 |
+
max-height: 1000px;
|
55 |
+
padding: 0 !important;
|
56 |
+
margin: 0 !important;
|
57 |
+
line-height: normal !important;
|
58 |
+
}
|
59 |
+
|
60 |
+
.captainform_popup_close_form {
|
61 |
+
position: absolute;
|
62 |
+
box-sizing: border-box;
|
63 |
+
right: 30px;
|
64 |
+
top: 30px;
|
65 |
+
width: 60px !important;
|
66 |
+
height: 60px !important;
|
67 |
+
/* TODO: Fix IE display problem */
|
68 |
+
cursor: pointer;
|
69 |
+
overflow: hidden;
|
70 |
+
}
|
71 |
+
|
72 |
+
.captainform_popup_close_form:hover .captainform_form_popup_close_button_svg_shape {
|
73 |
+
opacity: .8;
|
74 |
+
}
|
75 |
+
|
76 |
+
.popup_iframe_form {
|
77 |
+
width: 100%;
|
78 |
+
overflow: hidden;
|
79 |
+
border: none;
|
80 |
+
margin: 0 !important;
|
81 |
+
padding: 0 !important;
|
82 |
+
box-sizing: border-box;
|
83 |
+
}
|
84 |
+
|
85 |
+
|
{includes → admin}/css/hide_adminbar.css
RENAMED
File without changes
|
{includes → admin}/css/iframe_popup.css
RENAMED
@@ -143,7 +143,7 @@
|
|
143 |
/*background: #EFEFEF;*/
|
144 |
}
|
145 |
|
146 |
-
.icontent{
|
147 |
display: block;
|
148 |
width: 100%;
|
149 |
padding: 20px 10px 10px 10px;
|
@@ -152,7 +152,7 @@
|
|
152 |
background: transparent;
|
153 |
}
|
154 |
|
155 |
-
.icontent_btn{
|
156 |
display: block;
|
157 |
width: 100%;
|
158 |
height: 70px;
|
@@ -181,7 +181,7 @@ textarea.formal{
|
|
181 |
/*border-color: #33484d;*/
|
182 |
}
|
183 |
|
184 |
-
.label{
|
185 |
display: block;
|
186 |
overflow: hidden;
|
187 |
box-sizing: border-box;
|
@@ -192,7 +192,7 @@ textarea.formal{
|
|
192 |
}
|
193 |
|
194 |
|
195 |
-
.btn{
|
196 |
display: inline-block;
|
197 |
overflow: hidden;
|
198 |
text-align: center;
|
@@ -205,56 +205,64 @@ textarea.formal{
|
|
205 |
margin: 0px 10px 0px 10px;
|
206 |
}
|
207 |
|
208 |
-
.btn_yellow{
|
209 |
color: white;
|
210 |
background-color: #F8B610;
|
211 |
box-shadow: 0px 2px 0px 0.00px #c19f49;
|
212 |
border: solid 1px #f7c548;
|
213 |
}
|
214 |
-
.btn_yellow:hover{
|
215 |
background-color: #EEAD08;
|
216 |
}
|
217 |
|
218 |
-
.btn_blue{
|
219 |
color: white;
|
220 |
background-color: #25a7c1;
|
221 |
box-shadow: 0px 2px 0px 0.00px #005a70;
|
222 |
border: solid 1px #1c93ab;
|
223 |
}
|
224 |
-
.btn_blue:hover{
|
225 |
background-color: #1c93ab;
|
226 |
}
|
227 |
|
228 |
-
.btn_green{
|
229 |
color: white;
|
230 |
background-color: #5EC931;
|
231 |
box-shadow: 0px 2px 0px 0.00px #39791D;
|
232 |
border: solid 1px #4EA628;
|
233 |
}
|
234 |
-
.btn_green:hover{
|
235 |
background-color: #4EA628;
|
236 |
}
|
237 |
|
238 |
-
.btn_red{
|
239 |
color: white;
|
240 |
background-color: #FC6868;
|
241 |
box-shadow: 0px 2px 0px 0.00px #B80606;
|
242 |
border: solid 1px #FA5050;
|
243 |
}
|
244 |
-
.btn_red:hover{
|
245 |
background-color: #FA5050;
|
246 |
}
|
247 |
|
248 |
-
.btn_white{
|
249 |
color: #33484d;
|
250 |
background-color: #ffffff;
|
251 |
box-shadow: 0px 2px 0px 0.00px #c0c0c0;
|
252 |
border: solid 1px #E6E6E6;
|
253 |
}
|
254 |
-
.btn_white:hover{
|
255 |
background-color: #f4f4f4;
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
#cf_settings_save_button{
|
259 |
background: #25A7C1;
|
260 |
box-shadow: 0px 2px 0px 0.00px #005a70;
|
@@ -289,4 +297,8 @@ textarea.formal{
|
|
289 |
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
|
290 |
/* For IE 8*/
|
291 |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";
|
|
|
|
|
|
|
|
|
292 |
}
|
143 |
/*background: #EFEFEF;*/
|
144 |
}
|
145 |
|
146 |
+
#captainform_popup .icontent{
|
147 |
display: block;
|
148 |
width: 100%;
|
149 |
padding: 20px 10px 10px 10px;
|
152 |
background: transparent;
|
153 |
}
|
154 |
|
155 |
+
#captainform_popup .icontent_btn{
|
156 |
display: block;
|
157 |
width: 100%;
|
158 |
height: 70px;
|
181 |
/*border-color: #33484d;*/
|
182 |
}
|
183 |
|
184 |
+
#captainform_popup .label{
|
185 |
display: block;
|
186 |
overflow: hidden;
|
187 |
box-sizing: border-box;
|
192 |
}
|
193 |
|
194 |
|
195 |
+
#captainform_popup .btn{
|
196 |
display: inline-block;
|
197 |
overflow: hidden;
|
198 |
text-align: center;
|
205 |
margin: 0px 10px 0px 10px;
|
206 |
}
|
207 |
|
208 |
+
#captainform_popup .btn_yellow{
|
209 |
color: white;
|
210 |
background-color: #F8B610;
|
211 |
box-shadow: 0px 2px 0px 0.00px #c19f49;
|
212 |
border: solid 1px #f7c548;
|
213 |
}
|
214 |
+
#captainform_popup .btn_yellow:hover{
|
215 |
background-color: #EEAD08;
|
216 |
}
|
217 |
|
218 |
+
#captainform_popup .btn_blue{
|
219 |
color: white;
|
220 |
background-color: #25a7c1;
|
221 |
box-shadow: 0px 2px 0px 0.00px #005a70;
|
222 |
border: solid 1px #1c93ab;
|
223 |
}
|
224 |
+
#captainform_popup .btn_blue:hover{
|
225 |
background-color: #1c93ab;
|
226 |
}
|
227 |
|
228 |
+
#captainform_popup .btn_green{
|
229 |
color: white;
|
230 |
background-color: #5EC931;
|
231 |
box-shadow: 0px 2px 0px 0.00px #39791D;
|
232 |
border: solid 1px #4EA628;
|
233 |
}
|
234 |
+
#captainform_popup .btn_green:hover{
|
235 |
background-color: #4EA628;
|
236 |
}
|
237 |
|
238 |
+
#captainform_popup .btn_red{
|
239 |
color: white;
|
240 |
background-color: #FC6868;
|
241 |
box-shadow: 0px 2px 0px 0.00px #B80606;
|
242 |
border: solid 1px #FA5050;
|
243 |
}
|
244 |
+
#captainform_popup .btn_red:hover{
|
245 |
background-color: #FA5050;
|
246 |
}
|
247 |
|
248 |
+
#captainform_popup .btn_white{
|
249 |
color: #33484d;
|
250 |
background-color: #ffffff;
|
251 |
box-shadow: 0px 2px 0px 0.00px #c0c0c0;
|
252 |
border: solid 1px #E6E6E6;
|
253 |
}
|
254 |
+
#captainform_popup .btn_white:hover{
|
255 |
background-color: #f4f4f4;
|
256 |
}
|
257 |
|
258 |
+
#captainform_popup .btn_disabled{
|
259 |
+
color: #9B9B9B!important;
|
260 |
+
background-color: #f1f2f3!important;
|
261 |
+
box-shadow: none!important;
|
262 |
+
border: solid 1px #EBECE9!important;
|
263 |
+
cursor: default!important;
|
264 |
+
}
|
265 |
+
|
266 |
#cf_settings_save_button{
|
267 |
background: #25A7C1;
|
268 |
box-shadow: 0px 2px 0px 0.00px #005a70;
|
297 |
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
|
298 |
/* For IE 8*/
|
299 |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";
|
300 |
+
}
|
301 |
+
|
302 |
+
#TB_overlay.captainform{
|
303 |
+
z-index: 1055 !important
|
304 |
}
|
admin/css/publish_lightbox_posts.css
ADDED
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* CSS for the CaptainForm popup from Posts and Pages
|
3 |
+
*/
|
4 |
+
.captainform_body_class {
|
5 |
+
overflow: visible;
|
6 |
+
}
|
7 |
+
|
8 |
+
.captainform_spinner {
|
9 |
+
width: 100%;
|
10 |
+
text-align: center;
|
11 |
+
display: inline-block;
|
12 |
+
}
|
13 |
+
|
14 |
+
.captainform_widget_container {
|
15 |
+
font-family: Arial;
|
16 |
+
font-size: 14px;
|
17 |
+
width: 100%;
|
18 |
+
float: left;
|
19 |
+
display: inline-block;
|
20 |
+
margin-top: 2%;
|
21 |
+
}
|
22 |
+
|
23 |
+
#captainform-insert-dialog-body,
|
24 |
+
.captainform_widget_container,
|
25 |
+
.captainform_widget_container b,
|
26 |
+
.captainform_widget_container p,
|
27 |
+
.captainform_widget_container div,
|
28 |
+
.captainform_widget_container span {
|
29 |
+
white-space: normal !important;
|
30 |
+
}
|
31 |
+
|
32 |
+
#captainform_form_toembed,
|
33 |
+
#captainform_form_toembed_chosen {
|
34 |
+
margin-right: 5px;
|
35 |
+
margin-top: 15px;
|
36 |
+
float: left;
|
37 |
+
min-height: 25px;
|
38 |
+
min-width: 100% !important;
|
39 |
+
min-width: initial;
|
40 |
+
}
|
41 |
+
|
42 |
+
#captainform_form_toembed_chosen .chosen-single {
|
43 |
+
background: url('../images/dropdownarrow.png');
|
44 |
+
background-position: right 5px center;
|
45 |
+
background-repeat: no-repeat;
|
46 |
+
background-size: 10px;
|
47 |
+
-webkit-border-radius: 0;
|
48 |
+
-moz-border-radius: 0;
|
49 |
+
border-radius: 0;
|
50 |
+
}
|
51 |
+
|
52 |
+
#captainform_form_toembed_button {
|
53 |
+
margin-top: 15px;
|
54 |
+
height: 25px;
|
55 |
+
background: #25a7c1;
|
56 |
+
color: #fff;
|
57 |
+
font-weight: 600;
|
58 |
+
border-radius: 3px;
|
59 |
+
}
|
60 |
+
|
61 |
+
.captainform_widget_container input[type=text]{
|
62 |
+
border-radius: 3px;
|
63 |
+
border: 1px solid #b6b6b6;
|
64 |
+
color: #303030;
|
65 |
+
font-size: 14px;
|
66 |
+
height: auto;
|
67 |
+
padding: 7px;
|
68 |
+
width: 300px;
|
69 |
+
border-top: 1px solid #b6b6b6;
|
70 |
+
border-left: 1px solid #b6b6b6;
|
71 |
+
border-bottom: 1px solid #dadada;
|
72 |
+
border-right: 1px solid #dadada;
|
73 |
+
outline: 0;
|
74 |
+
}
|
75 |
+
|
76 |
+
.cf_trigger_option {
|
77 |
+
padding: 5px;
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
.cf_trigger_selected_option_container .left {
|
82 |
+
width: 30%;
|
83 |
+
}
|
84 |
+
|
85 |
+
.cf_trigger_selected_option_container .right {
|
86 |
+
width: 70%;
|
87 |
+
}
|
88 |
+
|
89 |
+
.cf_trigger_selected_option_container .right input[type=text] {
|
90 |
+
width: 100%;
|
91 |
+
}
|
92 |
+
|
93 |
+
.cf_trigger_2_time {
|
94 |
+
width: 80px !important;
|
95 |
+
}
|
96 |
+
|
97 |
+
.lightbox_trigger ,
|
98 |
+
.customvars_trigger{
|
99 |
+
padding: 0px;
|
100 |
+
}
|
101 |
+
|
102 |
+
#captainform_form_toembed_button {
|
103 |
+
display: inline-block;
|
104 |
+
float: left;
|
105 |
+
background: #25A7C1 !important;
|
106 |
+
box-shadow: 0px 2px 0px 0px #005a70;
|
107 |
+
cursor: pointer;
|
108 |
+
border-radius: 3px !important;
|
109 |
+
-moz-border-radius: 3px !important;
|
110 |
+
-webkit-border-radius: 3px !important;
|
111 |
+
padding: 0px 15px 0px 15px;
|
112 |
+
color: #FFFFFF;
|
113 |
+
font-weight: bold;
|
114 |
+
font-size: 14px;
|
115 |
+
height: 29px;
|
116 |
+
line-height: 30px;
|
117 |
+
}
|
118 |
+
|
119 |
+
.captainform_seconds {
|
120 |
+
float: left;
|
121 |
+
padding: 6px;
|
122 |
+
}
|
123 |
+
|
124 |
+
.cf_trigger_selected_option.cf_trigger_2_time {
|
125 |
+
position: relative;
|
126 |
+
}
|
127 |
+
|
128 |
+
.chosen-single {
|
129 |
+
height: 29px !important;
|
130 |
+
}
|
131 |
+
|
132 |
+
.chosen-single span:first-child {
|
133 |
+
line-height: 30px !important;
|
134 |
+
}
|
135 |
+
|
136 |
+
#captainform-insert-dialog-body {
|
137 |
+
overflow: hidden;
|
138 |
+
overflow-y: visible;
|
139 |
+
padding: 10px;
|
140 |
+
box-sizing: border-box;
|
141 |
+
}
|
142 |
+
|
143 |
+
#captainform_publish_lightbox_main_container {
|
144 |
+
width: 100%;
|
145 |
+
float: left;
|
146 |
+
margin-top: 10px;
|
147 |
+
padding-bottom: 20px;
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
.cf_trigger_selected_option_title{
|
152 |
+
margin-bottom: 10px;
|
153 |
+
}
|
154 |
+
|
155 |
+
.cf_lightbox_title b{
|
156 |
+
font-weight: 700;
|
157 |
+
color: #444;
|
158 |
+
}
|
159 |
+
|
160 |
+
#captainform_publish_lightbox_main_container {
|
161 |
+
padding-bottom: 45px;
|
162 |
+
}
|
163 |
+
|
164 |
+
.footer-button {
|
165 |
+
position: relative;
|
166 |
+
width: 100%;
|
167 |
+
bottom: 0;
|
168 |
+
left: 0;
|
169 |
+
right: 0;
|
170 |
+
text-align: center;
|
171 |
+
display: block;
|
172 |
+
float: right;
|
173 |
+
margin-bottom: 0px;
|
174 |
+
background: #fff;
|
175 |
+
border-top: 1px solid #ccc;
|
176 |
+
padding-top: 7px;
|
177 |
+
}
|
178 |
+
#TB_ajaxContent .cf_triggers_container, .use_custom_vars_container {
|
179 |
+
padding: 0 5px;
|
180 |
+
display: none;
|
181 |
+
float: left;
|
182 |
+
width: 100%;
|
183 |
+
}
|
184 |
+
|
185 |
+
/*info button from prefil fields*/
|
186 |
+
#captainform-123 img{ margin-top:-3px;}
|
187 |
+
|
188 |
+
#captainform-info-prefil{
|
189 |
+
display: inline;
|
190 |
+
|
191 |
+
top: 4px;
|
192 |
+
left: 1px;
|
193 |
+
position: relative;
|
194 |
+
}
|
195 |
+
.powerTip_prefil {
|
196 |
+
background-color: #fffeeb;
|
197 |
+
border: 1px solid #ffefae;
|
198 |
+
border-radius: 4px;
|
199 |
+
color: #000000;
|
200 |
+
display: none;
|
201 |
+
padding: 1px 10px 1px 10px;
|
202 |
+
position: fixed;
|
203 |
+
margin-left: 25px;
|
204 |
+
top: 350px;
|
205 |
+
width:16%;
|
206 |
+
}
|
207 |
+
.powerTip_prefil p{ padding: 0px !important;}
|
208 |
+
#captainform-info-prefil img{
|
209 |
+
width:16px;
|
210 |
+
height: 16px;
|
211 |
+
}
|
212 |
+
.captainform-info-prefil123:hover +.powerTip_prefil {
|
213 |
+
display: inline;
|
214 |
+
}
|
215 |
+
|
216 |
+
.captainform_widget_container *{
|
217 |
+
box-sizing: border-box !important;
|
218 |
+
}
|
219 |
+
|
220 |
+
|
221 |
+
#TB_ajaxContent.captainform{
|
222 |
+
display: block;
|
223 |
+
max-width: 100%;
|
224 |
+
box-sizing: border-box;
|
225 |
+
background: #FFF;
|
226 |
+
float: left;
|
227 |
+
width: 100% !important;
|
228 |
+
height: 100% !important;
|
229 |
+
position: relative;
|
230 |
+
min-height: 390px;
|
231 |
+
overflow: hidden;
|
232 |
+
padding: 0px 0px 45px 0px;
|
233 |
+
|
234 |
+
}
|
235 |
+
#TB_ajaxContent .captainform_widget_container{
|
236 |
+
|
237 |
+
max-width: 100%;
|
238 |
+
float: left;
|
239 |
+
width: 100%;
|
240 |
+
display: block;
|
241 |
+
margin: 0;
|
242 |
+
min-height: 380px;
|
243 |
+
overflow: auto;
|
244 |
+
height: 100% !important;
|
245 |
+
}
|
246 |
+
#TB_ajaxContent.cf_lightbox_cotainer{
|
247 |
+
width: 100%;
|
248 |
+
float: left;
|
249 |
+
position: relative;
|
250 |
+
|
251 |
+
}
|
252 |
+
#TB_ajaxContent .captainform_space{
|
253 |
+
padding-left: 15px;
|
254 |
+
padding-right:15px;
|
255 |
+
|
256 |
+
}
|
257 |
+
@media all and (max-width: 800px){
|
258 |
+
.powerTip_prefil {
|
259 |
+
position: fixed;
|
260 |
+
top: 180px;
|
261 |
+
width: 20%;
|
262 |
+
}
|
263 |
+
|
264 |
+
#captainform-info-prefil {
|
265 |
+
top: 3px;
|
266 |
+
left: 2px;
|
267 |
+
}
|
268 |
+
|
269 |
+
|
270 |
+
#TB_ajaxContent .captainform_widget_container {
|
271 |
+
min-height: inherit !important;
|
272 |
+
}
|
273 |
+
|
274 |
+
#TB_ajaxContent.captainform{
|
275 |
+
min-height: inherit !important;
|
276 |
+
}
|
277 |
+
|
278 |
+
|
279 |
+
}
|
280 |
+
@media all and (max-height: 768px){
|
281 |
+
.powerTip_prefil {
|
282 |
+
position: fixed;
|
283 |
+
top: 180px;
|
284 |
+
width: 20%;
|
285 |
+
}
|
286 |
+
}
|
287 |
+
@media all and (max-width: 360px) {
|
288 |
+
#captainform-info-prefil {
|
289 |
+
top: 2px;
|
290 |
+
left: 5px;
|
291 |
+
width: 20%;
|
292 |
+
}
|
293 |
+
}
|
{includes → admin}/css/review.css
RENAMED
File without changes
|
{includes → admin}/css/widget.css
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
-
.lightbox_trigger
|
|
|
2 |
width: 100%;
|
3 |
box-sizing: border-box;
|
4 |
padding: 0 5px;
|
@@ -25,7 +26,8 @@
|
|
25 |
overflow: visible;
|
26 |
}
|
27 |
/*this is new */
|
28 |
-
.cf_triggers_container
|
|
|
29 |
padding: 0 5px;
|
30 |
display: none;
|
31 |
}
|
@@ -120,4 +122,77 @@
|
|
120 |
width: 100%;
|
121 |
float: left;
|
122 |
margin: 15px 0px;
|
123 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.lightbox_trigger,
|
2 |
+
.customvars_trigger{
|
3 |
width: 100%;
|
4 |
box-sizing: border-box;
|
5 |
padding: 0 5px;
|
26 |
overflow: visible;
|
27 |
}
|
28 |
/*this is new */
|
29 |
+
.cf_triggers_container,
|
30 |
+
.use_custom_vars_container{
|
31 |
padding: 0 5px;
|
32 |
display: none;
|
33 |
}
|
122 |
width: 100%;
|
123 |
float: left;
|
124 |
margin: 15px 0px;
|
125 |
+
}
|
126 |
+
|
127 |
+
.cf_row{
|
128 |
+
width: 100%;
|
129 |
+
display: block;
|
130 |
+
float:left;
|
131 |
+
}
|
132 |
+
|
133 |
+
.cf_left{
|
134 |
+
margin-top: 5px;
|
135 |
+
}
|
136 |
+
|
137 |
+
.cf_row .cf_right input[type="text"]{
|
138 |
+
height: 28px;
|
139 |
+
}
|
140 |
+
.cf_row .cf_left,
|
141 |
+
.cf_row .cf_center,
|
142 |
+
.cf_row .cf_right{
|
143 |
+
float:left;
|
144 |
+
width: 33.33%;
|
145 |
+
padding: 5px;
|
146 |
+
-webkit-box-sizing: border-box;
|
147 |
+
-moz-box-sizing: border-box;
|
148 |
+
box-sizing: border-box;
|
149 |
+
}
|
150 |
+
|
151 |
+
.cf_row .cf_right input[type=text],
|
152 |
+
.cf_row .cf_center select{
|
153 |
+
width: 100%;
|
154 |
+
-webkit-box-sizing: border-box;
|
155 |
+
-moz-box-sizing: border-box;
|
156 |
+
box-sizing: border-box;
|
157 |
+
}
|
158 |
+
|
159 |
+
.custom_vars_draw{
|
160 |
+
width: 100%;
|
161 |
+
display: block;
|
162 |
+
float: left;
|
163 |
+
}
|
164 |
+
.custom_var_value{
|
165 |
+
display: none;
|
166 |
+
}
|
167 |
+
/*info button from widget prefil fields*/
|
168 |
+
#captainform-123 img{ margin-top:-3px;}
|
169 |
+
|
170 |
+
#captainform-info-prefil{
|
171 |
+
display: inline;
|
172 |
+
|
173 |
+
top: 2px;
|
174 |
+
left: 3px;
|
175 |
+
position: relative;
|
176 |
+
}
|
177 |
+
.powerTip_prefil {
|
178 |
+
background-color: #fffeeb;
|
179 |
+
border: 1px solid #ffefae;
|
180 |
+
border-radius: 4px;
|
181 |
+
color: #000000;
|
182 |
+
display: none;
|
183 |
+
padding: 1px 10px 1px 10px;
|
184 |
+
position: absolute;
|
185 |
+
z-index: 2147483647;
|
186 |
+
margin-left: 25px;
|
187 |
+
top: -20px;
|
188 |
+
width: 110px;
|
189 |
+
}
|
190 |
+
.powerTip_prefil p{ padding: 0px !important;}
|
191 |
+
#captainform-info-prefil img{
|
192 |
+
width:16px;
|
193 |
+
height: 16px;
|
194 |
+
}
|
195 |
+
.captainform-info-prefil123:hover +.powerTip_prefil {
|
196 |
+
display: inline;
|
197 |
+
}
|
198 |
+
|
{includes → admin}/css/wp_captainform_os.css
RENAMED
File without changes
|
{includes → admin}/images/black-50.png
RENAMED
File without changes
|
{includes → admin}/images/captainform-18.png
RENAMED
File without changes
|
{includes → admin}/images/captainform-32.png
RENAMED
File without changes
|
{includes → admin}/images/close.svg
RENAMED
File without changes
|
{includes → admin}/images/close_hover.svg
RENAMED
File without changes
|
{includes → admin}/images/dropdownarrow.png
RENAMED
File without changes
|
{includes → admin}/images/icon-alert-close.png
RENAMED
File without changes
|
{includes → admin}/images/icon-alert.png
RENAMED
File without changes
|
{includes → admin}/images/icon-danger.png
RENAMED
File without changes
|
{includes → admin}/images/icon-success.png
RENAMED
File without changes
|
admin/images/info_alert.png
ADDED
Binary file
|
{includes → admin}/images/loader_cf.GIF
RENAMED
File without changes
|
{includes → admin}/images/ring.svg
RENAMED
File without changes
|
admin/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
admin/js/captainform-admin.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* All of the code for your admin-facing JavaScript source
|
6 |
+
* should reside in this file.
|
7 |
+
*
|
8 |
+
* Note: It has been assumed you will write jQuery code here, so the
|
9 |
+
* $ function reference has been prepared for usage within the scope
|
10 |
+
* of this function.
|
11 |
+
*
|
12 |
+
* This enables you to define handlers, for when the DOM is ready:
|
13 |
+
*
|
14 |
+
* $(function() {
|
15 |
+
*
|
16 |
+
* });
|
17 |
+
*
|
18 |
+
* When the window is loaded:
|
19 |
+
*
|
20 |
+
* $( window ).load(function() {
|
21 |
+
*
|
22 |
+
* });
|
23 |
+
*
|
24 |
+
* ...and/or other possibilities.
|
25 |
+
*
|
26 |
+
* Ideally, it is not considered best practise to attach more than a
|
27 |
+
* single DOM-ready or window-load handler for a particular page.
|
28 |
+
* Although scripts in the WordPress core, Plugins and Themes may be
|
29 |
+
* practising this, we should strive to set a better example in our own work.
|
30 |
+
*/
|
31 |
+
|
32 |
+
})( jQuery );
|
admin/js/captainform-form-popup.js
ADDED
@@ -0,0 +1,313 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var element2;
|
2 |
+
|
3 |
+
var getIOSWindowHeight = function () {
|
4 |
+
var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
|
5 |
+
return window.innerHeight * zoomLevel;
|
6 |
+
};
|
7 |
+
|
8 |
+
function captainformChangePopupStyle(popupSelector, popupStyle){
|
9 |
+
var backgroundColor = popupStyle.backgroundColor;
|
10 |
+
var roundedCorners = popupStyle.roundedCorners;
|
11 |
+
popupSelector.css('background-color', '#' + backgroundColor);
|
12 |
+
// if( ! parseInt(roundedCorners))
|
13 |
+
// popupSelector.css('border-radius', 0);
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
function captainformRemoveOrHidePopup(popupSelector){
|
18 |
+
if(!popupSelector)
|
19 |
+
popupSelector = jQuery('.captainformPopupForm:visible');
|
20 |
+
|
21 |
+
if(!captainformFormPopupIsPreloaded(popupSelector)) {
|
22 |
+
var shouldPreloadAgain = false;
|
23 |
+
try {
|
24 |
+
shouldPreloadAgain = jQuery(popupSelector)[0].hasAttribute('shouldPreloadAgain');
|
25 |
+
} catch(e){}
|
26 |
+
|
27 |
+
var formId = popupSelector.data('form-id');
|
28 |
+
|
29 |
+
popupSelector.remove();
|
30 |
+
|
31 |
+
if(shouldPreloadAgain)
|
32 |
+
captainform_preload_form_popup({formId: formId});
|
33 |
+
}
|
34 |
+
else {
|
35 |
+
popupSelector.css('left', -50000);
|
36 |
+
popupSelector.addClass('popup-hidden');
|
37 |
+
}
|
38 |
+
|
39 |
+
document.documentElement.style.overflow = 'auto'; // firefox, chrome
|
40 |
+
document.body.scroll = "yes"; // ie only
|
41 |
+
if (captainform_is_ios()) {
|
42 |
+
document.ontouchmove = function () {
|
43 |
+
return true;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
function captainformShowPopup(popupSelector){
|
49 |
+
if(jQuery('.captainformPopupForm:not(".popup-hidden"):visible').size())
|
50 |
+
return;
|
51 |
+
|
52 |
+
document.documentElement.style.overflow = 'hidden'; // firefox, chrome
|
53 |
+
document.body.scroll = "no"; // ie only
|
54 |
+
|
55 |
+
popupSelector.show();
|
56 |
+
popupSelector.css('left', '0');
|
57 |
+
popupSelector.removeClass('popup-hidden');
|
58 |
+
}
|
59 |
+
|
60 |
+
function captainformFormPopupIsPreloaded(popupSelector){
|
61 |
+
return popupSelector.hasClass('preloaded');
|
62 |
+
}
|
63 |
+
|
64 |
+
function captainformFormPopupIsVisible(popupSelector){
|
65 |
+
return !popupSelector.hasClass('popup-hidden');
|
66 |
+
}
|
67 |
+
|
68 |
+
function captainformNeedToCreateNewPopup(popupSelector){
|
69 |
+
if(!popupSelector)
|
70 |
+
return true;
|
71 |
+
|
72 |
+
return !captainformFormPopupIsPreloaded(popupSelector);
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
function captainform_preload_form_popup(message){
|
77 |
+
var formId = message.formId;
|
78 |
+
message.preload = true;
|
79 |
+
|
80 |
+
if(!jQuery("[data-form-id='" + formId +"']").size()){
|
81 |
+
captainform_create_form_popup(message);
|
82 |
+
var popupSelector = jQuery('#captainformPopupForm' + formId);
|
83 |
+
captainformRemoveOrHidePopup(popupSelector);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
function captainform_create_form_popup(msg) {
|
88 |
+
var formId = msg.formId;
|
89 |
+
//noinspection JSJQueryEfficiency
|
90 |
+
var popupSelector = jQuery('#captainformPopupForm' + formId);
|
91 |
+
var createNewPopup = captainformNeedToCreateNewPopup(popupSelector);
|
92 |
+
|
93 |
+
if(createNewPopup) {
|
94 |
+
var url = msg.url
|
95 |
+
? msg.url
|
96 |
+
: cfJsHost + captainform_servicedomain + '/form-' + formId + '/?' + captainformCustomVars[formId] + captainformThemeStyle[formId];
|
97 |
+
var width = msg.popup_w || 1000;
|
98 |
+
var preload = msg.preload;
|
99 |
+
|
100 |
+
popupSelector.remove();
|
101 |
+
jQuery('body').append(captainformGetFormPopupHTML(url, formId, preload));
|
102 |
+
|
103 |
+
var popupBoxSelector = jQuery('#popupBox' + formId);
|
104 |
+
var iFrameSelector = jQuery('#popupIframe' + formId);
|
105 |
+
|
106 |
+
popupBoxSelector.width(width);
|
107 |
+
popupBoxSelector.height(0);
|
108 |
+
captainformBindFormPopupEvents(iFrameSelector, popupBoxSelector);
|
109 |
+
}
|
110 |
+
|
111 |
+
//noinspection JSJQueryEfficiency
|
112 |
+
popupSelector = jQuery('#captainformPopupForm' + formId);
|
113 |
+
|
114 |
+
captainformShowPopup(popupSelector);
|
115 |
+
}
|
116 |
+
|
117 |
+
function captainformBindFormPopupEvents(iFrameSelector, popupBoxSelector) {
|
118 |
+
var formId = jQuery(popupBoxSelector).data('form-id');
|
119 |
+
|
120 |
+
iFrameSelector.on("load", function () {
|
121 |
+
jQuery('#popupBox' + formId).show();
|
122 |
+
captainformResizeFormPopupBox(formId);
|
123 |
+
});
|
124 |
+
|
125 |
+
popupBoxSelector.on("click", function (e) {
|
126 |
+
e.preventDefault();
|
127 |
+
return false;
|
128 |
+
});
|
129 |
+
|
130 |
+
element2 = document.getElementById('popupIframe' + formId);
|
131 |
+
|
132 |
+
var isOldIE = (navigator.userAgent.indexOf("MSIE") !== -1); // Detect IE10 and below
|
133 |
+
iFrameResize({
|
134 |
+
log: false,
|
135 |
+
scrolling: false,
|
136 |
+
enablePublicMethods: true,
|
137 |
+
checkOrigin: false,
|
138 |
+
heightCalculationMethod: isOldIE ? 'max' : 'documentElementOffset', // old wy max e obligatoriu pt ie8
|
139 |
+
resizedCallback: function (messageData) {
|
140 |
+
iframe_height = parseInt(messageData.height) || 0;
|
141 |
+
jQuery('#popupBox' + formId).height(iframe_height);
|
142 |
+
captainformResizeFormPopupBox(formId);
|
143 |
+
jQuery('#cfloader').remove();
|
144 |
+
},
|
145 |
+
scrollCallback: function () {},
|
146 |
+
messageCallback: function (messageData) {}
|
147 |
+
}, element2);
|
148 |
+
}
|
149 |
+
|
150 |
+
function captainformGetFormPopupHTML(url, formId, preload) {
|
151 |
+
var iOSStyle = '';
|
152 |
+
var preloadedClass = preload ? 'preloaded' : '';
|
153 |
+
|
154 |
+
if (captainform_is_ios()) {
|
155 |
+
iOSStyle = ' style="-webkit-overflow-scrolling: touch"';
|
156 |
+
}
|
157 |
+
|
158 |
+
var html = '';
|
159 |
+
html += '<div id="captainformPopupForm' + formId + '" data-form-id="' + formId + '" onclick="captainformRemoveOrHidePopup()" class="captainformPopupForm captainform_popup_bg_form ' + preloadedClass + '">';
|
160 |
+
html += '<div id="cfloader" class="captainform_loader_form"></div>';
|
161 |
+
|
162 |
+
html += '<div id="captainformPopupCloseButton' + formId + '" class="captainform_popup_close_form" onclick="captainformRemoveOrHidePopup()">';
|
163 |
+
html += '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 100 100" class="captainform_form_popup_close_button_svg" version="1.1" viewBox="0 0 100 100" xml:space="preserve">';
|
164 |
+
html += '<polygon fill="#fff" class="captainform_form_popup_close_button_svg_shape" points="77.6,21.1 49.6,49.2 21.5,21.1 19.6,23 47.6,51.1 19.6,79.2 21.5,81.1 49.6,53 77.6,81.1 79.6,79.2 51.5,51.1 79.6,23 "/>';
|
165 |
+
html += '</svg>';
|
166 |
+
html += '</div>';
|
167 |
+
|
168 |
+
html += '<div id="popupBox' + formId + '" data-form-id="' + formId + '" class="popupBox captainform_popup_box_form">';
|
169 |
+
html += '<div id="popupBody' + formId + '" class="popupBody captainform_popup_body_form"' + iOSStyle + '>';
|
170 |
+
html += '<iframe id="popupIframe' + formId + '" src="' + url + '" class="popupIframe popup_iframe_form" scrolling="no"></iframe>';
|
171 |
+
html += '</div>';
|
172 |
+
html += '</div>';
|
173 |
+
html += '</div>';
|
174 |
+
|
175 |
+
return html;
|
176 |
+
}
|
177 |
+
|
178 |
+
function captainformResizeFormPopupBox(formId) {
|
179 |
+
var iFrameSelector = jQuery('#popupIframe' + formId);
|
180 |
+
var popupSelector = jQuery('#captainformPopupForm' + formId);
|
181 |
+
var popupBoxSelector = jQuery('#popupBox' + formId);
|
182 |
+
var popupBodySelector = jQuery('#popupBody' + formId);
|
183 |
+
var popupCloseButton = jQuery('#captainformPopupCloseButton' + formId);
|
184 |
+
|
185 |
+
if (iFrameSelector.length == 0) {
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
|
189 |
+
if (captainform_is_ios()) {
|
190 |
+
if(captainformFormPopupIsVisible(popupSelector)){
|
191 |
+
window.scrollTo(0, 0);
|
192 |
+
document.ontouchmove = function (e) {
|
193 |
+
e.preventDefault();
|
194 |
+
};
|
195 |
+
}
|
196 |
+
popupSelector.css('height', getIOSWindowHeight() + 'px');
|
197 |
+
popupSelector.css('top', '0px');
|
198 |
+
}
|
199 |
+
|
200 |
+
var popupMargin = 50;
|
201 |
+
var closeButtonSpace = 120;
|
202 |
+
|
203 |
+
var maxHeight = jQuery(window).height() - popupMargin;
|
204 |
+
popupBoxSelector.css('max-height', maxHeight + 'px');
|
205 |
+
var maxWidth = jQuery(window).width() - popupMargin;
|
206 |
+
popupBoxSelector.css('max-width', maxWidth + 'px');
|
207 |
+
|
208 |
+
var marginTop = parseInt(popupBoxSelector.css('margin-top'));
|
209 |
+
if(marginTop < 0)
|
210 |
+
{
|
211 |
+
var correctMargin = marginTop * 2 - popupMargin;
|
212 |
+
maxHeight = jQuery(window).height() - popupMargin + correctMargin;
|
213 |
+
popupBoxSelector.css('max-height', maxHeight + 'px');
|
214 |
+
maxWidth = jQuery(window).width() - popupMargin;
|
215 |
+
popupBoxSelector.css('max-width', maxWidth + 'px');
|
216 |
+
}
|
217 |
+
|
218 |
+
if(parseInt(popupBoxSelector.width()) + closeButtonSpace * 2 + parseInt(popupBoxSelector.css('padding')) * 2 >= jQuery(window).width()){
|
219 |
+
popupBoxSelector
|
220 |
+
.css('margin-top', 60)
|
221 |
+
.css('max-height', maxHeight - 35);
|
222 |
+
popupCloseButton
|
223 |
+
.css('position', 'relative')
|
224 |
+
.css('float', 'right')
|
225 |
+
.css('right', popupBoxSelector.css('margin-right'))
|
226 |
+
.css('top', 0);
|
227 |
+
}
|
228 |
+
else
|
229 |
+
{
|
230 |
+
popupBoxSelector.css('margin-top', 'auto');
|
231 |
+
popupCloseButton
|
232 |
+
.css('position', 'absolute')
|
233 |
+
.css('float', 'none')
|
234 |
+
.css('right', 30).css('top', 30);
|
235 |
+
}
|
236 |
+
|
237 |
+
popupBodySelector.css('max-height', popupBoxSelector.height() + 'px');
|
238 |
+
|
239 |
+
popupBodySelector.delay(500).queue(function (next) {
|
240 |
+
next();
|
241 |
+
});
|
242 |
+
}
|
243 |
+
|
244 |
+
function captainform_is_ios() {
|
245 |
+
var iDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
|
246 |
+
if (!!navigator.platform) {
|
247 |
+
while (iDevices.length) {
|
248 |
+
if (navigator.platform === iDevices.pop()) {
|
249 |
+
return true;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
+
return false;
|
254 |
+
}
|
255 |
+
|
256 |
+
window.addEventListener('resize', function(){
|
257 |
+
jQuery('.captainformPopupForm').each(function(index, popup){
|
258 |
+
captainformResizeFormPopupBox(jQuery(popup).data('form-id'));
|
259 |
+
});
|
260 |
+
}, true);
|
261 |
+
|
262 |
+
window.addEventListener('message', function (e) {
|
263 |
+
var message = e.data;
|
264 |
+
var formId = message.formId;
|
265 |
+
var iFrameSelector = jQuery('#popupIframe' + formId);
|
266 |
+
var popupBoxSelector = jQuery('#popupBox' + formId);
|
267 |
+
var popupBodySelector = jQuery('#popupBody' + formId);
|
268 |
+
|
269 |
+
if (message.hasOwnProperty('msgpreviewpopup')) {
|
270 |
+
captainform_create_form_popup({
|
271 |
+
url: 'https://app.captainform.com/form-' + message.msgpreviewpopup + '/?style=preview_iframe:1',
|
272 |
+
formId: message.msgpreviewpopup
|
273 |
+
});
|
274 |
+
}
|
275 |
+
|
276 |
+
if(message.hasOwnProperty('messageType')){
|
277 |
+
switch(message.messageType){
|
278 |
+
case 'initFormPopup':
|
279 |
+
if(popupBoxSelector.length) {
|
280 |
+
var widthUnit = message.hasOwnProperty('widthUnit') ? message.widthUnit : '';
|
281 |
+
var width = parseInt(message.fwidth) > 300 && widthUnit != '%' ? parseInt(message.fwidth) : 300;
|
282 |
+
|
283 |
+
popupBoxSelector.css('width', width + 'px');
|
284 |
+
|
285 |
+
popupBodySelector.off('scrollTo').scrollTo(iFrameSelector, 300);
|
286 |
+
|
287 |
+
if(message.hasOwnProperty('popupStyle'))
|
288 |
+
captainformChangePopupStyle(popupBoxSelector, message.popupStyle);
|
289 |
+
}
|
290 |
+
break;
|
291 |
+
case 'captainformSubmitMessage':
|
292 |
+
var popupSelector = jQuery('#captainformPopupForm' + formId);
|
293 |
+
if(message.shouldDestroyPopupObject == true) {
|
294 |
+
popupSelector.removeClass('preloaded');
|
295 |
+
if(message.shouldPreloadAgain == true)
|
296 |
+
popupSelector.attr('shouldPreloadAgain', 'true');
|
297 |
+
}
|
298 |
+
|
299 |
+
if(message.shouldClosePopup == true)
|
300 |
+
captainformRemoveOrHidePopup(popupSelector);
|
301 |
+
break;
|
302 |
+
default:
|
303 |
+
break;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
});
|
307 |
+
|
308 |
+
jQuery.fn.scrollTo = function (elem, speed) {
|
309 |
+
jQuery(this).animate({
|
310 |
+
scrollTop: jQuery(this).scrollTop() - jQuery(this).offset().top + jQuery(elem).offset().top
|
311 |
+
}, speed == undefined ? 500 : speed);
|
312 |
+
return this;
|
313 |
+
};
|
admin/js/captainform-main.js
ADDED
@@ -0,0 +1,507 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var iframe_height = 0;
|
2 |
+
var dialog_message_return = false;
|
3 |
+
function create_popup() {
|
4 |
+
htm = '';
|
5 |
+
htm += '<div id="captainform_popup" class="captainform_popup_bg">';
|
6 |
+
htm += '<div class="captainform_popup_box">';
|
7 |
+
htm += '<div class="captainform_popup_title">';
|
8 |
+
htm += 'Popup title';
|
9 |
+
htm += '<div id="xclose" class="captainform_popup_close" onclick="close_popup()"></div>';
|
10 |
+
htm += '</div>';
|
11 |
+
htm += '<div class="captainform_popup_body"><a></a></div>';
|
12 |
+
htm += '</div>';
|
13 |
+
htm += '</div>';
|
14 |
+
jQuery('#captainform_iframe').after(htm);
|
15 |
+
jQuery('#captainform_popup').show();
|
16 |
+
}
|
17 |
+
|
18 |
+
function close_popup() {
|
19 |
+
if(dialog_message_return){
|
20 |
+
msgdialog = {dialog_response:dialog_message_return};
|
21 |
+
element.contentWindow.postMessage(msgdialog, chostp);
|
22 |
+
dialog_message_return = false;
|
23 |
+
}
|
24 |
+
jQuery('#captainform_popup').remove();
|
25 |
+
}
|
26 |
+
|
27 |
+
function captainform_is_ios_device() {
|
28 |
+
var iDevices = [ 'iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod' ];
|
29 |
+
if (!!navigator.platform) {
|
30 |
+
while (iDevices.length) {
|
31 |
+
if (navigator.platform === iDevices.pop()){ return true; }
|
32 |
+
}
|
33 |
+
}
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
function create_popup_dialog(msg){
|
38 |
+
jQuery('#captainform_popup').remove();
|
39 |
+
title = msg.popup_title;
|
40 |
+
message = msg.popup_message;
|
41 |
+
dialog_type = msg.dialog_type;
|
42 |
+
dialog_message_return = msg.response_on_close;
|
43 |
+
w = msg.popup_w;
|
44 |
+
class_type = '';
|
45 |
+
if(dialog_type=='success'){
|
46 |
+
class_type = 'dialog dialog_success';
|
47 |
+
class_close = 'close_success';
|
48 |
+
}
|
49 |
+
if(dialog_type=='warning'){
|
50 |
+
class_type = 'dialog dialog_warning';
|
51 |
+
class_close = 'close_warning';
|
52 |
+
}
|
53 |
+
if(dialog_type=='error'){
|
54 |
+
class_type = 'dialog dialog_error';
|
55 |
+
class_close = 'close_error';
|
56 |
+
}
|
57 |
+
//class_type='';
|
58 |
+
// calculate buttons
|
59 |
+
buttons_html = '';
|
60 |
+
buttons = msg.buttons_list;
|
61 |
+
buttons_action = msg.buttons_action;
|
62 |
+
if (buttons !== null && typeof buttons === 'object') {
|
63 |
+
buttons_html += '<div id="popup_footer" class="captainform_popup_footer">';
|
64 |
+
Object.getOwnPropertyNames(buttons).forEach(function (val, idx, array) {
|
65 |
+
//btn = val + ' -> ' + buttons[val];
|
66 |
+
btn_title = buttons[val];
|
67 |
+
btn_action = buttons_action[val];
|
68 |
+
btn_action_type = btn_action.action_type;
|
69 |
+
btn_action_name = btn_action.action_name;
|
70 |
+
onclick = '';
|
71 |
+
lockurl = chostp;
|
72 |
+
if (btn_action_type == 'message') {
|
73 |
+
msg_return = btn_action_name;
|
74 |
+
vonclick = " onclick=\"element.contentWindow.postMessage('" + msg_return + "','" + lockurl + "')\"";
|
75 |
+
}
|
76 |
+
if (btn_action_type == 'callback') {
|
77 |
+
msg_return = btn_action_name;
|
78 |
+
vonclick = " onclick=\"" + btn_action_name + "\"";
|
79 |
+
}
|
80 |
+
buttons_html += '<div class="btn ' + val + '"' + vonclick + '>' + btn_title + '</div>';
|
81 |
+
});
|
82 |
+
buttons_html += '</div>';
|
83 |
+
}
|
84 |
+
htm = '';
|
85 |
+
htm += '<div id="captainform_popup" class="captainform_popup_bg">';
|
86 |
+
htm += '<div id="cfloader" class="captainform_loader"></div>';
|
87 |
+
htm += '<div id="popup_box" class="captainform_popup_box">';
|
88 |
+
htm += '<div id="popup_header" class="captainform_popup_title '+class_type+'">';
|
89 |
+
htm += decodeURIComponent(title);
|
90 |
+
htm += '<div id="xclose" class="captainform_popup_close '+class_close+'" onclick="close_popup()"></div>';
|
91 |
+
htm += '</div>';
|
92 |
+
htm += '<div id="popup_body" class="captainform_popup_body">';
|
93 |
+
htm += '<div class="icontent">'+decodeURIComponent(message)+'</div>';
|
94 |
+
htm += '</div>';
|
95 |
+
htm += buttons_html;
|
96 |
+
htm += '</div>';
|
97 |
+
htm += '</div>';
|
98 |
+
//ppi = document.getElementById('ppiframe');
|
99 |
+
jQuery('#captainform_iframe').after(htm);
|
100 |
+
jQuery('#popup_box').width(w);
|
101 |
+
jQuery('#cfloader').remove();
|
102 |
+
jQuery('#captainform_popup').show();
|
103 |
+
popup_box_height = jQuery('#popup_body').height()+95;
|
104 |
+
jQuery('#popup_box').height(popup_box_height);
|
105 |
+
jQuery('#popup_box').css('border','solid 1px #838383');
|
106 |
+
}
|
107 |
+
|
108 |
+
function captform_after_click_button()
|
109 |
+
{
|
110 |
+
jQuery( ".after_click_disable" ).off('click').click(function(event) {
|
111 |
+
jQuery(this).addClass('btn_disabled');
|
112 |
+
jQuery(this).prop('onclick','').off('click');
|
113 |
+
});
|
114 |
+
}
|
115 |
+
|
116 |
+
function create_popup_iframe(msg) {
|
117 |
+
jQuery('#captainform_popup').remove();
|
118 |
+
url = msg.popup_url + msg.popup_url_query;
|
119 |
+
url = url.replace('/app.captainform.com/', '/' + chost + '/');
|
120 |
+
title = msg.popup_title;
|
121 |
+
dialog_message_return = msg.response_on_close;
|
122 |
+
close_btn_action = msg.close_btn_action;
|
123 |
+
if (msg.hasOwnProperty('close_btn_show'))
|
124 |
+
close_btn_show = msg.close_btn_show;
|
125 |
+
else
|
126 |
+
close_btn_show = true;
|
127 |
+
|
128 |
+
w = msg.popup_w;
|
129 |
+
h = msg.popup_h;
|
130 |
+
// calculate buttons
|
131 |
+
buttons_html = '';
|
132 |
+
buttons = msg.buttons_list;
|
133 |
+
buttons_action = msg.buttons_action;
|
134 |
+
if (buttons !== null && typeof buttons === 'object') {
|
135 |
+
buttons_html += '<div id="popup_footer" class="captainform_popup_footer">';
|
136 |
+
Object.getOwnPropertyNames(buttons).forEach(function (val, idx, array) {
|
137 |
+
//btn = val + ' -> ' + buttons[val];
|
138 |
+
btn_title = buttons[val];
|
139 |
+
btn_action = buttons_action[val];
|
140 |
+
btn_action_type = btn_action.action_type;
|
141 |
+
btn_action_name = btn_action.action_name;
|
142 |
+
onclick = '';
|
143 |
+
lockurl = chostp;
|
144 |
+
if (btn_action_type == 'message') {
|
145 |
+
msg_return = btn_action_name;
|
146 |
+
vonclick = " onclick=\"element1.contentWindow.postMessage('" + msg_return + "','" + lockurl + "')\"";
|
147 |
+
}
|
148 |
+
if (btn_action_type == 'callback') {
|
149 |
+
msg_return = btn_action_name;
|
150 |
+
vonclick = " onclick=\"" + btn_action_name + "\"";
|
151 |
+
}
|
152 |
+
addclass = '';
|
153 |
+
if (btn_action.hasOwnProperty('after_click')) {
|
154 |
+
if(btn_action.after_click == 'disabled')
|
155 |
+
addclass = ' after_click_disable';
|
156 |
+
}
|
157 |
+
buttons_html += '<div class="btn ' + val + addclass + '"' + vonclick + '>' + btn_title + '</div>';
|
158 |
+
});
|
159 |
+
buttons_html += '</div>';
|
160 |
+
}
|
161 |
+
htm = '';
|
162 |
+
htm += '<div id="captainform_popup" class="captainform_popup_bg">';
|
163 |
+
htm += '<div id="cfloader" class="captainform_loader"></div>';
|
164 |
+
htm += '<div id="popup_box" class="captainform_popup_box">';
|
165 |
+
htm += '<div id="popup_header" class="captainform_popup_title">';
|
166 |
+
htm += title;
|
167 |
+
if(close_btn_show)
|
168 |
+
{
|
169 |
+
htm += '<div id="xclose" class="captainform_popup_close" onclick="close_popup()"></div>';
|
170 |
+
}
|
171 |
+
htm += '</div>';
|
172 |
+
htm += '<div id="popup_body" class="captainform_popup_body"><iframe id="ppiframe" src="' + url + '" class="popup_iframe" scrolling="no">';
|
173 |
+
htm += '</iframe></div>';
|
174 |
+
htm += buttons_html;
|
175 |
+
htm += '</div>';
|
176 |
+
htm += '</div>';
|
177 |
+
ppi = document.getElementById('ppiframe');
|
178 |
+
jQuery('#captainform_iframe').after(htm);
|
179 |
+
jQuery('#popup_box').width(w);
|
180 |
+
jQuery('#popup_box').height(0);
|
181 |
+
jQuery('#captainform_popup').show();
|
182 |
+
captform_after_click_button();
|
183 |
+
|
184 |
+
|
185 |
+
element1 = document.getElementById('ppiframe');
|
186 |
+
|
187 |
+
var isOldIE = (navigator.userAgent.indexOf("MSIE") !== -1); // Detect IE10 and below
|
188 |
+
|
189 |
+
iFrameResize({
|
190 |
+
log: false,
|
191 |
+
scrolling: false,
|
192 |
+
enablePublicMethods: true,
|
193 |
+
checkOrigin: false,
|
194 |
+
//heightCalculationMethod: isOldIE ? 'max' : 'bodyOffset', // old wy max e obligatoriu pt ie8
|
195 |
+
//heightCalculationMethod: 'max',
|
196 |
+
heightCalculationMethod: isOldIE ? 'max' : 'documentElementOffset', // old wy max e obligatoriu pt ie8
|
197 |
+
resizedCallback: function (messageData) {
|
198 |
+
hh = messageData.height;
|
199 |
+
hhf = parseInt(hh) + 100;
|
200 |
+
iframe_height = hhf;
|
201 |
+
jQuery('#popup_box').height(hhf);
|
202 |
+
jQuery('#popup_box').css('border','solid 1px #838383');
|
203 |
+
resize_popup_iframe();
|
204 |
+
jQuery('#cfloader').remove();
|
205 |
+
},
|
206 |
+
scrollCallback: function () {
|
207 |
+
//console.log('scroll');
|
208 |
+
},
|
209 |
+
messageCallback: function (messageData) { // Callback fn when message is received
|
210 |
+
//console.log(messageData.message)
|
211 |
+
}
|
212 |
+
}, element1);
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Add Settings Save Button and bar in page. It will be displayed when only when "Save" button from settings is not visible.
|
218 |
+
*/
|
219 |
+
function show_settings_save_button()
|
220 |
+
{
|
221 |
+
if (typeof window.is_demo_account != 'undefined' && window.is_demo_account == true)
|
222 |
+
return;
|
223 |
+
html = '<div id="cf_settings_save_button_container">';
|
224 |
+
html += ' <div id="cf_settings_save_button" onclick="settings_click_save()">Save changes</div>';
|
225 |
+
html += '</div>';
|
226 |
+
if (document.getElementById('cf_settings_save_button_container') == null)
|
227 |
+
{
|
228 |
+
jQuery('body').prepend(html);
|
229 |
+
}
|
230 |
+
init_settings_save_menu_bar();
|
231 |
+
}
|
232 |
+
/**
|
233 |
+
* Init position and height of the Settings Save Bar
|
234 |
+
*/
|
235 |
+
function init_settings_save_menu_bar()
|
236 |
+
{
|
237 |
+
if (document.getElementById('adminmenu') !== null && document.getElementById('cf_settings_save_button_container') !== null)
|
238 |
+
{
|
239 |
+
var window_width = jQuery(window).width();
|
240 |
+
var wp_adminmenu_width = 0;
|
241 |
+
if (jQuery('#adminmenu').is(':visible'))
|
242 |
+
wp_adminmenu_width = jQuery('#adminmenu').width();
|
243 |
+
var bar_width = window_width - wp_adminmenu_width;
|
244 |
+
jQuery('#cf_settings_save_button_container').css('width', bar_width).css('right', 0);
|
245 |
+
}
|
246 |
+
var admin_bar_height = 0;
|
247 |
+
var left_menu_z_index = 0;
|
248 |
+
if (document.getElementById('wpadminbar') !== null)
|
249 |
+
{
|
250 |
+
if (jQuery('#wpadminbar').css('position') == 'fixed')
|
251 |
+
admin_bar_height = jQuery('#wpadminbar').height();
|
252 |
+
}
|
253 |
+
jQuery('#cf_settings_save_button_container').css('top', admin_bar_height).show();
|
254 |
+
}
|
255 |
+
/**
|
256 |
+
* Removes the Settings Save Bar from the page.
|
257 |
+
*/
|
258 |
+
function remove_settings_save_button()
|
259 |
+
{
|
260 |
+
if (document.getElementById('cf_settings_save_button_container') != null)
|
261 |
+
{
|
262 |
+
jQuery('#cf_settings_save_button_container').hide().remove();
|
263 |
+
}
|
264 |
+
}
|
265 |
+
/**
|
266 |
+
* Simulate click on the save button inside the child iframe . It's like clicking on the "Save" button.
|
267 |
+
*/
|
268 |
+
function settings_click_save()
|
269 |
+
{
|
270 |
+
var iframe_obj = document.getElementById('captainform_iframe');
|
271 |
+
iframe_obj.contentWindow.postMessage(JSON.stringify({msg_id: 'settings_click_save'}), '*');
|
272 |
+
}
|
273 |
+
function resize_popup_iframe() {
|
274 |
+
if (jQuery('#ppiframe').length == 0) {
|
275 |
+
return false;
|
276 |
+
}
|
277 |
+
|
278 |
+
max_h = jQuery(window).height() - 20;
|
279 |
+
jQuery('#popup_box').css('max-height', max_h + 'px');
|
280 |
+
max_w = jQuery(window).width() - 20;
|
281 |
+
jQuery('#popup_box').css('max-width', max_w + 'px');
|
282 |
+
|
283 |
+
popup_header_h = jQuery('#popup_header').height();
|
284 |
+
popup_footer_h = jQuery('#popup_footer').height() + 10;
|
285 |
+
//popup_body_max_h = jQuery( window ).height() - popup_header_h - popup_footer_h;
|
286 |
+
popup_body_max_h = jQuery('#popup_box').height() - popup_header_h - popup_footer_h;
|
287 |
+
jQuery('#popup_body').css('max-height', popup_body_max_h + 'px');
|
288 |
+
}
|
289 |
+
|
290 |
+
function init_editor_menu_pos()
|
291 |
+
{
|
292 |
+
var top_scroll_pos = jQuery(document).scrollTop();
|
293 |
+
var iframe_obj = document.getElementById('captainform_iframe');
|
294 |
+
var iframe_offset_top = jQuery('#captainform_iframe').offset().top;
|
295 |
+
window.editor_menu_top_pos = iframe_offset_top;
|
296 |
+
if (typeof top_scroll_pos != 'undefined' && typeof iframe_offset_top != 'undefined')
|
297 |
+
iframe_obj.contentWindow.postMessage(JSON.stringify({msg_id: 'scroll_on_parent', msg_val: top_scroll_pos, 'iframe_offset_top': iframe_offset_top}), '*');
|
298 |
+
}
|
299 |
+
|
300 |
+
|
301 |
+
function doerror() {
|
302 |
+
jQuery('.btn_blue').hide();
|
303 |
+
jQuery('#popup_header').addClass('doerror');
|
304 |
+
jQuery('#xclose').addClass('doerrorclose');
|
305 |
+
}
|
306 |
+
|
307 |
+
|
308 |
+
|
309 |
+
jQuery(document).ready(function () {
|
310 |
+
init_editor_menu_pos();
|
311 |
+
|
312 |
+
jQuery(window).resize(function () {
|
313 |
+
resize_popup_iframe();
|
314 |
+
init_editor_menu_pos();
|
315 |
+
init_settings_save_menu_bar();
|
316 |
+
});
|
317 |
+
|
318 |
+
jQuery(window).scroll(function (event) {
|
319 |
+
clearTimeout(jQuery.data(this, 'scrollTimer'));
|
320 |
+
jQuery.data(this, 'scrollTimer', setTimeout(function () {
|
321 |
+
init_editor_menu_pos();
|
322 |
+
}, 250));
|
323 |
+
});
|
324 |
+
});
|
325 |
+
// resizer
|
326 |
+
element = document.getElementById('captainform_iframe');
|
327 |
+
iFrameResize({
|
328 |
+
log: false,
|
329 |
+
scrolling: false,
|
330 |
+
enablePublicMethods: true,
|
331 |
+
checkOrigin: false,
|
332 |
+
resizedCallback: function (messageData) {
|
333 |
+
|
334 |
+
},
|
335 |
+
scrollCallback: function () {
|
336 |
+
},
|
337 |
+
messageCallback: function (messageData) { // Callback fn when message is received
|
338 |
+
msgr = messageData.message;
|
339 |
+
switch (msgr.msg_type)
|
340 |
+
{
|
341 |
+
case 'show_popup_iframe':
|
342 |
+
create_popup_iframe(msgr);
|
343 |
+
break;
|
344 |
+
case 'show_popup_dialog':
|
345 |
+
create_popup_dialog(msgr);
|
346 |
+
break;
|
347 |
+
}
|
348 |
+
|
349 |
+
}
|
350 |
+
}, element);
|
351 |
+
|
352 |
+
|
353 |
+
|
354 |
+
|
355 |
+
// reseponse to parent 2
|
356 |
+
window.onmessage = function (e) {
|
357 |
+
|
358 |
+
msgresponse = e.data;
|
359 |
+
if(!msgresponse.hasOwnProperty('msg_id')){
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
msg_id = msgresponse.msg_id;
|
363 |
+
|
364 |
+
if (msgresponse.hasOwnProperty('msg_action')) {
|
365 |
+
|
366 |
+
msg_action = msgresponse.msg_action;
|
367 |
+
|
368 |
+
if (msg_action == 'response_resend') {
|
369 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
370 |
+
close_popup();
|
371 |
+
}
|
372 |
+
if (msg_action == 'response_reload') {
|
373 |
+
jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
|
374 |
+
close_popup();
|
375 |
+
}
|
376 |
+
|
377 |
+
if (msg_action == 'response_error'){
|
378 |
+
doerror();
|
379 |
+
return;
|
380 |
+
}
|
381 |
+
|
382 |
+
if(msg_action == 'response_alert'){
|
383 |
+
|
384 |
+
create_popup_dialog(msgresponse);
|
385 |
+
return;
|
386 |
+
}
|
387 |
+
|
388 |
+
} else {
|
389 |
+
|
390 |
+
if (msg_id == 'added_new_group') {
|
391 |
+
jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
|
392 |
+
top_scroll_pos = 0;
|
393 |
+
if (typeof msgresponse.last_div_pos != 'undefined')
|
394 |
+
top_scroll_pos = msgresponse.last_div_pos;
|
395 |
+
window.scroll(0, top_scroll_pos);
|
396 |
+
close_popup();
|
397 |
+
}
|
398 |
+
if (msg_id == 'renamed_group') {
|
399 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
400 |
+
close_popup();
|
401 |
+
}
|
402 |
+
if (msg_id == 'deleted_group') {
|
403 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
404 |
+
close_popup();
|
405 |
+
}
|
406 |
+
if (msg_id == 'group_settings_finish') {
|
407 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
408 |
+
close_popup();
|
409 |
+
}
|
410 |
+
if (msg_id == 'duplicated_group') {
|
411 |
+
jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
|
412 |
+
close_popup();
|
413 |
+
}
|
414 |
+
|
415 |
+
if (msg_id == 'renamed_form') {
|
416 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
417 |
+
close_popup();
|
418 |
+
}
|
419 |
+
if (msg_id == 'duplicated_form') {
|
420 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
421 |
+
close_popup();
|
422 |
+
}
|
423 |
+
if (msg_id == 'deleted_form') {
|
424 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
425 |
+
close_popup();
|
426 |
+
}
|
427 |
+
if (msg_id == 'form_activity_finish') {
|
428 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
429 |
+
//jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
|
430 |
+
close_popup();
|
431 |
+
}
|
432 |
+
//multisite_url_submited
|
433 |
+
if (msg_id == 'multisite_url_submited') {
|
434 |
+
jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
|
435 |
+
close_popup();
|
436 |
+
}
|
437 |
+
if (msg_id == 'myaccount_edit_finish') {
|
438 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
439 |
+
//jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
|
440 |
+
close_popup();
|
441 |
+
}
|
442 |
+
if (msg_id == 'force_close_popup') {
|
443 |
+
close_popup();
|
444 |
+
}
|
445 |
+
if (msg_id == "reload_parent123")
|
446 |
+
{
|
447 |
+
window.location.href = window.location.href;
|
448 |
+
}
|
449 |
+
if (msg_id == "scroll_to_top")
|
450 |
+
{
|
451 |
+
window.scrollTo(0, 0);
|
452 |
+
}
|
453 |
+
if (msg_id == 'show_settings_save_button')
|
454 |
+
{
|
455 |
+
var is_demo = msgresponse.is_demo;
|
456 |
+
if (is_demo == false)
|
457 |
+
show_settings_save_button();
|
458 |
+
}
|
459 |
+
if (msg_id == "remove_settings_save_button")
|
460 |
+
{
|
461 |
+
remove_settings_save_button();
|
462 |
+
}
|
463 |
+
if (msg_id == "preview_form")
|
464 |
+
{
|
465 |
+
var preview_tab = "_blank";
|
466 |
+
var form_id = msgresponse.formid;
|
467 |
+
var is_demo = msgresponse.demo;
|
468 |
+
var protocol = window.location.protocol;
|
469 |
+
var host = window.location.hostname;
|
470 |
+
|
471 |
+
if (typeof captainform_plugin_dir != 'undefined')
|
472 |
+
window.open(parent_site_url + "/wp-admin/admin.php?page=CaptainForm&cf_form_id=" + form_id, preview_tab);
|
473 |
+
else //old preview method
|
474 |
+
window.open(chostp + "/form-" + form_id + "/", preview_tab);
|
475 |
+
}
|
476 |
+
if (msg_id == 'evernote_matches_popup_save') {
|
477 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
478 |
+
close_popup();
|
479 |
+
}
|
480 |
+
if (msg_id == 'wordpress_matches_popup_save') {
|
481 |
+
load_err = msgresponse.load_err;
|
482 |
+
if (load_err == 1) {
|
483 |
+
doerror();
|
484 |
+
return;
|
485 |
+
}
|
486 |
+
element.contentWindow.postMessage(msgresponse, chostp);
|
487 |
+
close_popup();
|
488 |
+
}
|
489 |
+
}
|
490 |
+
|
491 |
+
|
492 |
+
};
|
493 |
+
|
494 |
+
window.addEventListener('message', function(event){
|
495 |
+
if(typeof event.data != 'undefined' && event.data != null && typeof event.data == 'string' && event.data.indexOf('iFrameSizer') == -1)
|
496 |
+
{
|
497 |
+
try
|
498 |
+
{
|
499 |
+
msgresponse=JSON.parse(event.data);
|
500 |
+
if(typeof msgresponse.msg_id != 'undefined' && msgresponse.msg_id == 'scroll_on_parent' && typeof msgresponse.msg_val != 'undefined')
|
501 |
+
{
|
502 |
+
global_top_scroll = msgresponse.msg_val;
|
503 |
+
}
|
504 |
+
}
|
505 |
+
catch(error){}
|
506 |
+
}
|
507 |
+
});
|
admin/js/chosen.jquery.js
ADDED
@@ -0,0 +1,1269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.6.2
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011-2016 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/
|
12 |
+
|
13 |
+
(function() {
|
14 |
+
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
15 |
+
__hasProp = {}.hasOwnProperty,
|
16 |
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
17 |
+
|
18 |
+
SelectParser = (function() {
|
19 |
+
function SelectParser() {
|
20 |
+
this.options_index = 0;
|
21 |
+
this.parsed = [];
|
22 |
+
}
|
23 |
+
|
24 |
+
SelectParser.prototype.add_node = function(child) {
|
25 |
+
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
26 |
+
return this.add_group(child);
|
27 |
+
} else {
|
28 |
+
return this.add_option(child);
|
29 |
+
}
|
30 |
+
};
|
31 |
+
|
32 |
+
SelectParser.prototype.add_group = function(group) {
|
33 |
+
var group_position, option, _i, _len, _ref, _results;
|
34 |
+
group_position = this.parsed.length;
|
35 |
+
this.parsed.push({
|
36 |
+
array_index: group_position,
|
37 |
+
group: true,
|
38 |
+
label: this.escapeExpression(group.label),
|
39 |
+
title: group.title ? group.title : void 0,
|
40 |
+
children: 0,
|
41 |
+
disabled: group.disabled,
|
42 |
+
classes: group.className
|
43 |
+
});
|
44 |
+
_ref = group.childNodes;
|
45 |
+
_results = [];
|
46 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
47 |
+
option = _ref[_i];
|
48 |
+
_results.push(this.add_option(option, group_position, group.disabled));
|
49 |
+
}
|
50 |
+
return _results;
|
51 |
+
};
|
52 |
+
|
53 |
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
54 |
+
if (option.nodeName.toUpperCase() === "OPTION") {
|
55 |
+
if (option.text !== "") {
|
56 |
+
if (group_position != null) {
|
57 |
+
this.parsed[group_position].children += 1;
|
58 |
+
}
|
59 |
+
this.parsed.push({
|
60 |
+
array_index: this.parsed.length,
|
61 |
+
options_index: this.options_index,
|
62 |
+
value: option.value,
|
63 |
+
text: option.text,
|
64 |
+
html: option.innerHTML,
|
65 |
+
title: option.title ? option.title : void 0,
|
66 |
+
selected: option.selected,
|
67 |
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
68 |
+
group_array_index: group_position,
|
69 |
+
group_label: group_position != null ? this.parsed[group_position].label : null,
|
70 |
+
classes: option.className,
|
71 |
+
style: option.style.cssText
|
72 |
+
});
|
73 |
+
} else {
|
74 |
+
this.parsed.push({
|
75 |
+
array_index: this.parsed.length,
|
76 |
+
options_index: this.options_index,
|
77 |
+
empty: true
|
78 |
+
});
|
79 |
+
}
|
80 |
+
return this.options_index += 1;
|
81 |
+
}
|
82 |
+
};
|
83 |
+
|
84 |
+
SelectParser.prototype.escapeExpression = function(text) {
|
85 |
+
var map, unsafe_chars;
|
86 |
+
if ((text == null) || text === false) {
|
87 |
+
return "";
|
88 |
+
}
|
89 |
+
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
90 |
+
return text;
|
91 |
+
}
|
92 |
+
map = {
|
93 |
+
"<": "<",
|
94 |
+
">": ">",
|
95 |
+
'"': """,
|
96 |
+
"'": "'",
|
97 |
+
"`": "`"
|
98 |
+
};
|
99 |
+
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
100 |
+
return text.replace(unsafe_chars, function(chr) {
|
101 |
+
return map[chr] || "&";
|
102 |
+
});
|
103 |
+
};
|
104 |
+
|
105 |
+
return SelectParser;
|
106 |
+
|
107 |
+
})();
|
108 |
+
|
109 |
+
SelectParser.select_to_array = function(select) {
|
110 |
+
var child, parser, _i, _len, _ref;
|
111 |
+
parser = new SelectParser();
|
112 |
+
_ref = select.childNodes;
|
113 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
114 |
+
child = _ref[_i];
|
115 |
+
parser.add_node(child);
|
116 |
+
}
|
117 |
+
return parser.parsed;
|
118 |
+
};
|
119 |
+
|
120 |
+
AbstractChosen = (function() {
|
121 |
+
function AbstractChosen(form_field, options) {
|
122 |
+
this.form_field = form_field;
|
123 |
+
this.options = options != null ? options : {};
|
124 |
+
if (!AbstractChosen.browser_is_supported()) {
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
this.is_multiple = this.form_field.multiple;
|
128 |
+
this.set_default_text();
|
129 |
+
this.set_default_values();
|
130 |
+
this.setup();
|
131 |
+
this.set_up_html();
|
132 |
+
this.register_observers();
|
133 |
+
this.on_ready();
|
134 |
+
}
|
135 |
+
|
136 |
+
AbstractChosen.prototype.set_default_values = function() {
|
137 |
+
var _this = this;
|
138 |
+
this.click_test_action = function(evt) {
|
139 |
+
return _this.test_active_click(evt);
|
140 |
+
};
|
141 |
+
this.activate_action = function(evt) {
|
142 |
+
return _this.activate_field(evt);
|
143 |
+
};
|
144 |
+
this.active_field = false;
|
145 |
+
this.mouse_on_container = false;
|
146 |
+
this.results_showing = false;
|
147 |
+
this.result_highlighted = null;
|
148 |
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
149 |
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
150 |
+
this.disable_search = this.options.disable_search || false;
|
151 |
+
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
152 |
+
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
153 |
+
this.search_contains = this.options.search_contains || false;
|
154 |
+
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
155 |
+
this.max_selected_options = this.options.max_selected_options || Infinity;
|
156 |
+
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
157 |
+
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
158 |
+
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
159 |
+
this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
|
160 |
+
this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
|
161 |
+
return this.case_sensitive_search = this.options.case_sensitive_search || false;
|
162 |
+
};
|
163 |
+
|
164 |
+
AbstractChosen.prototype.set_default_text = function() {
|
165 |
+
if (this.form_field.getAttribute("data-placeholder")) {
|
166 |
+
this.default_text = this.form_field.getAttribute("data-placeholder");
|
167 |
+
} else if (this.is_multiple) {
|
168 |
+
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
169 |
+
} else {
|
170 |
+
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
171 |
+
}
|
172 |
+
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
173 |
+
};
|
174 |
+
|
175 |
+
AbstractChosen.prototype.choice_label = function(item) {
|
176 |
+
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
177 |
+
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
178 |
+
} else {
|
179 |
+
return item.html;
|
180 |
+
}
|
181 |
+
};
|
182 |
+
|
183 |
+
AbstractChosen.prototype.mouse_enter = function() {
|
184 |
+
return this.mouse_on_container = true;
|
185 |
+
};
|
186 |
+
|
187 |
+
AbstractChosen.prototype.mouse_leave = function() {
|
188 |
+
return this.mouse_on_container = false;
|
189 |
+
};
|
190 |
+
|
191 |
+
AbstractChosen.prototype.input_focus = function(evt) {
|
192 |
+
var _this = this;
|
193 |
+
if (this.is_multiple) {
|
194 |
+
if (!this.active_field) {
|
195 |
+
return setTimeout((function() {
|
196 |
+
return _this.container_mousedown();
|
197 |
+
}), 50);
|
198 |
+
}
|
199 |
+
} else {
|
200 |
+
if (!this.active_field) {
|
201 |
+
return this.activate_field();
|
202 |
+
}
|
203 |
+
}
|
204 |
+
};
|
205 |
+
|
206 |
+
AbstractChosen.prototype.input_blur = function(evt) {
|
207 |
+
var _this = this;
|
208 |
+
if (!this.mouse_on_container) {
|
209 |
+
this.active_field = false;
|
210 |
+
return setTimeout((function() {
|
211 |
+
return _this.blur_test();
|
212 |
+
}), 100);
|
213 |
+
}
|
214 |
+
};
|
215 |
+
|
216 |
+
AbstractChosen.prototype.results_option_build = function(options) {
|
217 |
+
var content, data, data_content, shown_results, _i, _len, _ref;
|
218 |
+
content = '';
|
219 |
+
shown_results = 0;
|
220 |
+
_ref = this.results_data;
|
221 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
222 |
+
data = _ref[_i];
|
223 |
+
data_content = '';
|
224 |
+
if (data.group) {
|
225 |
+
data_content = this.result_add_group(data);
|
226 |
+
} else {
|
227 |
+
data_content = this.result_add_option(data);
|
228 |
+
}
|
229 |
+
if (data_content !== '') {
|
230 |
+
shown_results++;
|
231 |
+
content += data_content;
|
232 |
+
}
|
233 |
+
if (options != null ? options.first : void 0) {
|
234 |
+
if (data.selected && this.is_multiple) {
|
235 |
+
this.choice_build(data);
|
236 |
+
} else if (data.selected && !this.is_multiple) {
|
237 |
+
this.single_set_selected_text(this.choice_label(data));
|
238 |
+
}
|
239 |
+
}
|
240 |
+
if (shown_results >= this.max_shown_results) {
|
241 |
+
break;
|
242 |
+
}
|
243 |
+
}
|
244 |
+
return content;
|
245 |
+
};
|
246 |
+
|
247 |
+
AbstractChosen.prototype.result_add_option = function(option) {
|
248 |
+
var classes, option_el;
|
249 |
+
if (!option.search_match) {
|
250 |
+
return '';
|
251 |
+
}
|
252 |
+
if (!this.include_option_in_results(option)) {
|
253 |
+
return '';
|
254 |
+
}
|
255 |
+
classes = [];
|
256 |
+
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
257 |
+
classes.push("active-result");
|
258 |
+
}
|
259 |
+
if (option.disabled && !(option.selected && this.is_multiple)) {
|
260 |
+
classes.push("disabled-result");
|
261 |
+
}
|
262 |
+
if (option.selected) {
|
263 |
+
classes.push("result-selected");
|
264 |
+
}
|
265 |
+
if (option.group_array_index != null) {
|
266 |
+
classes.push("group-option");
|
267 |
+
}
|
268 |
+
if (option.classes !== "") {
|
269 |
+
classes.push(option.classes);
|
270 |
+
}
|
271 |
+
option_el = document.createElement("li");
|
272 |
+
option_el.className = classes.join(" ");
|
273 |
+
option_el.style.cssText = option.style;
|
274 |
+
option_el.setAttribute("data-option-array-index", option.array_index);
|
275 |
+
option_el.innerHTML = option.search_text;
|
276 |
+
if (option.title) {
|
277 |
+
option_el.title = option.title;
|
278 |
+
}
|
279 |
+
return this.outerHTML(option_el);
|
280 |
+
};
|
281 |
+
|
282 |
+
AbstractChosen.prototype.result_add_group = function(group) {
|
283 |
+
var classes, group_el;
|
284 |
+
if (!(group.search_match || group.group_match)) {
|
285 |
+
return '';
|
286 |
+
}
|
287 |
+
if (!(group.active_options > 0)) {
|
288 |
+
return '';
|
289 |
+
}
|
290 |
+
classes = [];
|
291 |
+
classes.push("group-result");
|
292 |
+
if (group.classes) {
|
293 |
+
classes.push(group.classes);
|
294 |
+
}
|
295 |
+
group_el = document.createElement("li");
|
296 |
+
group_el.className = classes.join(" ");
|
297 |
+
group_el.innerHTML = group.search_text;
|
298 |
+
if (group.title) {
|
299 |
+
group_el.title = group.title;
|
300 |
+
}
|
301 |
+
return this.outerHTML(group_el);
|
302 |
+
};
|
303 |
+
|
304 |
+
AbstractChosen.prototype.results_update_field = function() {
|
305 |
+
this.set_default_text();
|
306 |
+
if (!this.is_multiple) {
|
307 |
+
this.results_reset_cleanup();
|
308 |
+
}
|
309 |
+
this.result_clear_highlight();
|
310 |
+
this.results_build();
|
311 |
+
if (this.results_showing) {
|
312 |
+
return this.winnow_results();
|
313 |
+
}
|
314 |
+
};
|
315 |
+
|
316 |
+
AbstractChosen.prototype.reset_single_select_options = function() {
|
317 |
+
var result, _i, _len, _ref, _results;
|
318 |
+
_ref = this.results_data;
|
319 |
+
_results = [];
|
320 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
321 |
+
result = _ref[_i];
|
322 |
+
if (result.selected) {
|
323 |
+
_results.push(result.selected = false);
|
324 |
+
} else {
|
325 |
+
_results.push(void 0);
|
326 |
+
}
|
327 |
+
}
|
328 |
+
return _results;
|
329 |
+
};
|
330 |
+
|
331 |
+
AbstractChosen.prototype.results_toggle = function() {
|
332 |
+
if (this.results_showing) {
|
333 |
+
return this.results_hide();
|
334 |
+
} else {
|
335 |
+
return this.results_show();
|
336 |
+
}
|
337 |
+
};
|
338 |
+
|
339 |
+
AbstractChosen.prototype.results_search = function(evt) {
|
340 |
+
if (this.results_showing) {
|
341 |
+
return this.winnow_results();
|
342 |
+
} else {
|
343 |
+
return this.results_show();
|
344 |
+
}
|
345 |
+
};
|
346 |
+
|
347 |
+
AbstractChosen.prototype.winnow_results = function() {
|
348 |
+
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
349 |
+
this.no_results_clear();
|
350 |
+
results = 0;
|
351 |
+
searchText = this.get_search_text();
|
352 |
+
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
353 |
+
zregex = new RegExp(escapedSearchText, 'i');
|
354 |
+
regex = this.get_search_regex(escapedSearchText);
|
355 |
+
_ref = this.results_data;
|
356 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
357 |
+
option = _ref[_i];
|
358 |
+
option.search_match = false;
|
359 |
+
results_group = null;
|
360 |
+
if (this.include_option_in_results(option)) {
|
361 |
+
if (option.group) {
|
362 |
+
option.group_match = false;
|
363 |
+
option.active_options = 0;
|
364 |
+
}
|
365 |
+
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
366 |
+
results_group = this.results_data[option.group_array_index];
|
367 |
+
if (results_group.active_options === 0 && results_group.search_match) {
|
368 |
+
results += 1;
|
369 |
+
}
|
370 |
+
results_group.active_options += 1;
|
371 |
+
}
|
372 |
+
option.search_text = option.group ? option.label : option.html;
|
373 |
+
if (!(option.group && !this.group_search)) {
|
374 |
+
option.search_match = this.search_string_match(option.search_text, regex);
|
375 |
+
if (option.search_match && !option.group) {
|
376 |
+
results += 1;
|
377 |
+
}
|
378 |
+
if (option.search_match) {
|
379 |
+
if (searchText.length) {
|
380 |
+
startpos = option.search_text.search(zregex);
|
381 |
+
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
382 |
+
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
383 |
+
}
|
384 |
+
if (results_group != null) {
|
385 |
+
results_group.group_match = true;
|
386 |
+
}
|
387 |
+
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
388 |
+
option.search_match = true;
|
389 |
+
}
|
390 |
+
}
|
391 |
+
}
|
392 |
+
}
|
393 |
+
this.result_clear_highlight();
|
394 |
+
if (results < 1 && searchText.length) {
|
395 |
+
this.update_results_content("");
|
396 |
+
return this.no_results(searchText);
|
397 |
+
} else {
|
398 |
+
this.update_results_content(this.results_option_build());
|
399 |
+
return this.winnow_results_set_highlight();
|
400 |
+
}
|
401 |
+
};
|
402 |
+
|
403 |
+
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
404 |
+
var regex_anchor, regex_flag;
|
405 |
+
regex_anchor = this.search_contains ? "" : "^";
|
406 |
+
regex_flag = this.case_sensitive_search ? "" : "i";
|
407 |
+
return new RegExp(regex_anchor + escaped_search_string, regex_flag);
|
408 |
+
};
|
409 |
+
|
410 |
+
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
411 |
+
var part, parts, _i, _len;
|
412 |
+
if (regex.test(search_string)) {
|
413 |
+
return true;
|
414 |
+
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
415 |
+
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
416 |
+
if (parts.length) {
|
417 |
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
418 |
+
part = parts[_i];
|
419 |
+
if (regex.test(part)) {
|
420 |
+
return true;
|
421 |
+
}
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
};
|
426 |
+
|
427 |
+
AbstractChosen.prototype.choices_count = function() {
|
428 |
+
var option, _i, _len, _ref;
|
429 |
+
if (this.selected_option_count != null) {
|
430 |
+
return this.selected_option_count;
|
431 |
+
}
|
432 |
+
this.selected_option_count = 0;
|
433 |
+
_ref = this.form_field.options;
|
434 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
435 |
+
option = _ref[_i];
|
436 |
+
if (option.selected) {
|
437 |
+
this.selected_option_count += 1;
|
438 |
+
}
|
439 |
+
}
|
440 |
+
return this.selected_option_count;
|
441 |
+
};
|
442 |
+
|
443 |
+
AbstractChosen.prototype.choices_click = function(evt) {
|
444 |
+
evt.preventDefault();
|
445 |
+
if (!(this.results_showing || this.is_disabled)) {
|
446 |
+
return this.results_show();
|
447 |
+
}
|
448 |
+
};
|
449 |
+
|
450 |
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
451 |
+
var stroke, _ref;
|
452 |
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
453 |
+
this.search_field_scale();
|
454 |
+
switch (stroke) {
|
455 |
+
case 8:
|
456 |
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
457 |
+
return this.keydown_backstroke();
|
458 |
+
} else if (!this.pending_backstroke) {
|
459 |
+
this.result_clear_highlight();
|
460 |
+
return this.results_search();
|
461 |
+
}
|
462 |
+
break;
|
463 |
+
case 13:
|
464 |
+
evt.preventDefault();
|
465 |
+
if (this.results_showing) {
|
466 |
+
return this.result_select(evt);
|
467 |
+
}
|
468 |
+
break;
|
469 |
+
case 27:
|
470 |
+
if (this.results_showing) {
|
471 |
+
this.results_hide();
|
472 |
+
}
|
473 |
+
return true;
|
474 |
+
case 9:
|
475 |
+
case 38:
|
476 |
+
case 40:
|
477 |
+
case 16:
|
478 |
+
case 91:
|
479 |
+
case 17:
|
480 |
+
case 18:
|
481 |
+
break;
|
482 |
+
default:
|
483 |
+
return this.results_search();
|
484 |
+
}
|
485 |
+
};
|
486 |
+
|
487 |
+
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
488 |
+
var _this = this;
|
489 |
+
return setTimeout((function() {
|
490 |
+
return _this.results_search();
|
491 |
+
}), 50);
|
492 |
+
};
|
493 |
+
|
494 |
+
AbstractChosen.prototype.container_width = function() {
|
495 |
+
if (this.options.width != null) {
|
496 |
+
return this.options.width;
|
497 |
+
} else {
|
498 |
+
return "" + this.form_field.offsetWidth + "px";
|
499 |
+
}
|
500 |
+
};
|
501 |
+
|
502 |
+
AbstractChosen.prototype.include_option_in_results = function(option) {
|
503 |
+
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
504 |
+
return false;
|
505 |
+
}
|
506 |
+
if (!this.display_disabled_options && option.disabled) {
|
507 |
+
return false;
|
508 |
+
}
|
509 |
+
if (option.empty) {
|
510 |
+
return false;
|
511 |
+
}
|
512 |
+
return true;
|
513 |
+
};
|
514 |
+
|
515 |
+
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
516 |
+
this.touch_started = true;
|
517 |
+
return this.search_results_mouseover(evt);
|
518 |
+
};
|
519 |
+
|
520 |
+
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
521 |
+
this.touch_started = false;
|
522 |
+
return this.search_results_mouseout(evt);
|
523 |
+
};
|
524 |
+
|
525 |
+
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
526 |
+
if (this.touch_started) {
|
527 |
+
return this.search_results_mouseup(evt);
|
528 |
+
}
|
529 |
+
};
|
530 |
+
|
531 |
+
AbstractChosen.prototype.outerHTML = function(element) {
|
532 |
+
var tmp;
|
533 |
+
if (element.outerHTML) {
|
534 |
+
return element.outerHTML;
|
535 |
+
}
|
536 |
+
tmp = document.createElement("div");
|
537 |
+
tmp.appendChild(element);
|
538 |
+
return tmp.innerHTML;
|
539 |
+
};
|
540 |
+
|
541 |
+
AbstractChosen.browser_is_supported = function() {
|
542 |
+
if ("Microsoft Internet Explorer" === window.navigator.appName) {
|
543 |
+
return document.documentMode >= 8;
|
544 |
+
}
|
545 |
+
if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) {
|
546 |
+
return false;
|
547 |
+
}
|
548 |
+
return true;
|
549 |
+
};
|
550 |
+
|
551 |
+
AbstractChosen.default_multiple_text = "Select Some Options";
|
552 |
+
|
553 |
+
AbstractChosen.default_single_text = "Select an Option";
|
554 |
+
|
555 |
+
AbstractChosen.default_no_result_text = "No results match";
|
556 |
+
|
557 |
+
return AbstractChosen;
|
558 |
+
|
559 |
+
})();
|
560 |
+
|
561 |
+
$ = jQuery;
|
562 |
+
|
563 |
+
$.fn.extend({
|
564 |
+
chosen: function(options) {
|
565 |
+
if (!AbstractChosen.browser_is_supported()) {
|
566 |
+
return this;
|
567 |
+
}
|
568 |
+
return this.each(function(input_field) {
|
569 |
+
var $this, chosen;
|
570 |
+
$this = $(this);
|
571 |
+
chosen = $this.data('chosen');
|
572 |
+
if (options === 'destroy') {
|
573 |
+
if (chosen instanceof Chosen) {
|
574 |
+
chosen.destroy();
|
575 |
+
}
|
576 |
+
return;
|
577 |
+
}
|
578 |
+
if (!(chosen instanceof Chosen)) {
|
579 |
+
$this.data('chosen', new Chosen(this, options));
|
580 |
+
}
|
581 |
+
});
|
582 |
+
}
|
583 |
+
});
|
584 |
+
|
585 |
+
Chosen = (function(_super) {
|
586 |
+
__extends(Chosen, _super);
|
587 |
+
|
588 |
+
function Chosen() {
|
589 |
+
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
590 |
+
return _ref;
|
591 |
+
}
|
592 |
+
|
593 |
+
Chosen.prototype.setup = function() {
|
594 |
+
this.form_field_jq = $(this.form_field);
|
595 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
596 |
+
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
597 |
+
};
|
598 |
+
|
599 |
+
Chosen.prototype.set_up_html = function() {
|
600 |
+
var container_classes, container_props;
|
601 |
+
container_classes = ["chosen-container"];
|
602 |
+
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
603 |
+
if (this.inherit_select_classes && this.form_field.className) {
|
604 |
+
container_classes.push(this.form_field.className);
|
605 |
+
}
|
606 |
+
if (this.is_rtl) {
|
607 |
+
container_classes.push("chosen-rtl");
|
608 |
+
}
|
609 |
+
container_props = {
|
610 |
+
'class': container_classes.join(' '),
|
611 |
+
'style': "width: " + (this.container_width()) + ";",
|
612 |
+
'title': this.form_field.title
|
613 |
+
};
|
614 |
+
if (this.form_field.id.length) {
|
615 |
+
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
616 |
+
}
|
617 |
+
this.container = $("<div />", container_props);
|
618 |
+
if (this.is_multiple) {
|
619 |
+
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
620 |
+
} else {
|
621 |
+
this.container.html('<a class="chosen-single chosen-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
622 |
+
}
|
623 |
+
this.form_field_jq.hide().after(this.container);
|
624 |
+
this.dropdown = this.container.find('div.chosen-drop').first();
|
625 |
+
this.search_field = this.container.find('input').first();
|
626 |
+
this.search_results = this.container.find('ul.chosen-results').first();
|
627 |
+
this.search_field_scale();
|
628 |
+
this.search_no_results = this.container.find('li.no-results').first();
|
629 |
+
if (this.is_multiple) {
|
630 |
+
this.search_choices = this.container.find('ul.chosen-choices').first();
|
631 |
+
this.search_container = this.container.find('li.search-field').first();
|
632 |
+
} else {
|
633 |
+
this.search_container = this.container.find('div.chosen-search').first();
|
634 |
+
this.selected_item = this.container.find('.chosen-single').first();
|
635 |
+
}
|
636 |
+
this.results_build();
|
637 |
+
this.set_tab_index();
|
638 |
+
return this.set_label_behavior();
|
639 |
+
};
|
640 |
+
|
641 |
+
Chosen.prototype.on_ready = function() {
|
642 |
+
return this.form_field_jq.trigger("chosen:ready", {
|
643 |
+
chosen: this
|
644 |
+
});
|
645 |
+
};
|
646 |
+
|
647 |
+
Chosen.prototype.register_observers = function() {
|
648 |
+
var _this = this;
|
649 |
+
this.container.bind('touchstart.chosen', function(evt) {
|
650 |
+
_this.container_mousedown(evt);
|
651 |
+
return evt.preventDefault();
|
652 |
+
});
|
653 |
+
this.container.bind('touchend.chosen', function(evt) {
|
654 |
+
_this.container_mouseup(evt);
|
655 |
+
return evt.preventDefault();
|
656 |
+
});
|
657 |
+
this.container.bind('mousedown.chosen', function(evt) {
|
658 |
+
_this.container_mousedown(evt);
|
659 |
+
});
|
660 |
+
this.container.bind('mouseup.chosen', function(evt) {
|
661 |
+
_this.container_mouseup(evt);
|
662 |
+
});
|
663 |
+
this.container.bind('mouseenter.chosen', function(evt) {
|
664 |
+
_this.mouse_enter(evt);
|
665 |
+
});
|
666 |
+
this.container.bind('mouseleave.chosen', function(evt) {
|
667 |
+
_this.mouse_leave(evt);
|
668 |
+
});
|
669 |
+
this.search_results.bind('mouseup.chosen', function(evt) {
|
670 |
+
_this.search_results_mouseup(evt);
|
671 |
+
});
|
672 |
+
this.search_results.bind('mouseover.chosen', function(evt) {
|
673 |
+
_this.search_results_mouseover(evt);
|
674 |
+
});
|
675 |
+
this.search_results.bind('mouseout.chosen', function(evt) {
|
676 |
+
_this.search_results_mouseout(evt);
|
677 |
+
});
|
678 |
+
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
679 |
+
_this.search_results_mousewheel(evt);
|
680 |
+
});
|
681 |
+
this.search_results.bind('touchstart.chosen', function(evt) {
|
682 |
+
_this.search_results_touchstart(evt);
|
683 |
+
});
|
684 |
+
this.search_results.bind('touchmove.chosen', function(evt) {
|
685 |
+
_this.search_results_touchmove(evt);
|
686 |
+
});
|
687 |
+
this.search_results.bind('touchend.chosen', function(evt) {
|
688 |
+
_this.search_results_touchend(evt);
|
689 |
+
});
|
690 |
+
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
691 |
+
_this.results_update_field(evt);
|
692 |
+
});
|
693 |
+
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
694 |
+
_this.activate_field(evt);
|
695 |
+
});
|
696 |
+
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
697 |
+
_this.container_mousedown(evt);
|
698 |
+
});
|
699 |
+
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
700 |
+
_this.input_blur(evt);
|
701 |
+
});
|
702 |
+
this.search_field.bind('blur.chosen', function(evt) {
|
703 |
+
_this.input_blur(evt);
|
704 |
+
});
|
705 |
+
this.search_field.bind('keyup.chosen', function(evt) {
|
706 |
+
_this.keyup_checker(evt);
|
707 |
+
});
|
708 |
+
this.search_field.bind('keydown.chosen', function(evt) {
|
709 |
+
_this.keydown_checker(evt);
|
710 |
+
});
|
711 |
+
this.search_field.bind('focus.chosen', function(evt) {
|
712 |
+
_this.input_focus(evt);
|
713 |
+
});
|
714 |
+
this.search_field.bind('cut.chosen', function(evt) {
|
715 |
+
_this.clipboard_event_checker(evt);
|
716 |
+
});
|
717 |
+
this.search_field.bind('paste.chosen', function(evt) {
|
718 |
+
_this.clipboard_event_checker(evt);
|
719 |
+
});
|
720 |
+
if (this.is_multiple) {
|
721 |
+
return this.search_choices.bind('click.chosen', function(evt) {
|
722 |
+
_this.choices_click(evt);
|
723 |
+
});
|
724 |
+
} else {
|
725 |
+
return this.container.bind('click.chosen', function(evt) {
|
726 |
+
evt.preventDefault();
|
727 |
+
});
|
728 |
+
}
|
729 |
+
};
|
730 |
+
|
731 |
+
Chosen.prototype.destroy = function() {
|
732 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
733 |
+
if (this.search_field[0].tabIndex) {
|
734 |
+
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
735 |
+
}
|
736 |
+
this.container.remove();
|
737 |
+
this.form_field_jq.removeData('chosen');
|
738 |
+
return this.form_field_jq.show();
|
739 |
+
};
|
740 |
+
|
741 |
+
Chosen.prototype.search_field_disabled = function() {
|
742 |
+
this.is_disabled = this.form_field_jq[0].disabled;
|
743 |
+
if (this.is_disabled) {
|
744 |
+
this.container.addClass('chosen-disabled');
|
745 |
+
this.search_field[0].disabled = true;
|
746 |
+
if (!this.is_multiple) {
|
747 |
+
this.selected_item.unbind("focus.chosen", this.activate_action);
|
748 |
+
}
|
749 |
+
return this.close_field();
|
750 |
+
} else {
|
751 |
+
this.container.removeClass('chosen-disabled');
|
752 |
+
this.search_field[0].disabled = false;
|
753 |
+
if (!this.is_multiple) {
|
754 |
+
return this.selected_item.bind("focus.chosen", this.activate_action);
|
755 |
+
}
|
756 |
+
}
|
757 |
+
};
|
758 |
+
|
759 |
+
Chosen.prototype.container_mousedown = function(evt) {
|
760 |
+
if (!this.is_disabled) {
|
761 |
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
762 |
+
evt.preventDefault();
|
763 |
+
}
|
764 |
+
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
765 |
+
if (!this.active_field) {
|
766 |
+
if (this.is_multiple) {
|
767 |
+
this.search_field.val("");
|
768 |
+
}
|
769 |
+
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
770 |
+
this.results_show();
|
771 |
+
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
772 |
+
evt.preventDefault();
|
773 |
+
this.results_toggle();
|
774 |
+
}
|
775 |
+
return this.activate_field();
|
776 |
+
}
|
777 |
+
}
|
778 |
+
};
|
779 |
+
|
780 |
+
Chosen.prototype.container_mouseup = function(evt) {
|
781 |
+
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
782 |
+
return this.results_reset(evt);
|
783 |
+
}
|
784 |
+
};
|
785 |
+
|
786 |
+
Chosen.prototype.search_results_mousewheel = function(evt) {
|
787 |
+
var delta;
|
788 |
+
if (evt.originalEvent) {
|
789 |
+
delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
790 |
+
}
|
791 |
+
if (delta != null) {
|
792 |
+
evt.preventDefault();
|
793 |
+
if (evt.type === 'DOMMouseScroll') {
|
794 |
+
delta = delta * 40;
|
795 |
+
}
|
796 |
+
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
797 |
+
}
|
798 |
+
};
|
799 |
+
|
800 |
+
Chosen.prototype.blur_test = function(evt) {
|
801 |
+
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
802 |
+
return this.close_field();
|
803 |
+
}
|
804 |
+
};
|
805 |
+
|
806 |
+
Chosen.prototype.close_field = function() {
|
807 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
808 |
+
this.active_field = false;
|
809 |
+
this.results_hide();
|
810 |
+
this.container.removeClass("chosen-container-active");
|
811 |
+
this.clear_backstroke();
|
812 |
+
this.show_search_field_default();
|
813 |
+
return this.search_field_scale();
|
814 |
+
};
|
815 |
+
|
816 |
+
Chosen.prototype.activate_field = function() {
|
817 |
+
this.container.addClass("chosen-container-active");
|
818 |
+
this.active_field = true;
|
819 |
+
this.search_field.val(this.search_field.val());
|
820 |
+
return this.search_field.focus();
|
821 |
+
};
|
822 |
+
|
823 |
+
Chosen.prototype.test_active_click = function(evt) {
|
824 |
+
var active_container;
|
825 |
+
active_container = $(evt.target).closest('.chosen-container');
|
826 |
+
if (active_container.length && this.container[0] === active_container[0]) {
|
827 |
+
return this.active_field = true;
|
828 |
+
} else {
|
829 |
+
return this.close_field();
|
830 |
+
}
|
831 |
+
};
|
832 |
+
|
833 |
+
Chosen.prototype.results_build = function() {
|
834 |
+
this.parsing = true;
|
835 |
+
this.selected_option_count = null;
|
836 |
+
this.results_data = SelectParser.select_to_array(this.form_field);
|
837 |
+
if (this.is_multiple) {
|
838 |
+
this.search_choices.find("li.search-choice").remove();
|
839 |
+
} else if (!this.is_multiple) {
|
840 |
+
this.single_set_selected_text();
|
841 |
+
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
842 |
+
this.search_field[0].readOnly = true;
|
843 |
+
this.container.addClass("chosen-container-single-nosearch");
|
844 |
+
} else {
|
845 |
+
this.search_field[0].readOnly = false;
|
846 |
+
this.container.removeClass("chosen-container-single-nosearch");
|
847 |
+
}
|
848 |
+
}
|
849 |
+
this.update_results_content(this.results_option_build({
|
850 |
+
first: true
|
851 |
+
}));
|
852 |
+
this.search_field_disabled();
|
853 |
+
this.show_search_field_default();
|
854 |
+
this.search_field_scale();
|
855 |
+
return this.parsing = false;
|
856 |
+
};
|
857 |
+
|
858 |
+
Chosen.prototype.result_do_highlight = function(el) {
|
859 |
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
860 |
+
if (el.length) {
|
861 |
+
this.result_clear_highlight();
|
862 |
+
this.result_highlight = el;
|
863 |
+
this.result_highlight.addClass("highlighted");
|
864 |
+
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
865 |
+
visible_top = this.search_results.scrollTop();
|
866 |
+
visible_bottom = maxHeight + visible_top;
|
867 |
+
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
868 |
+
high_bottom = high_top + this.result_highlight.outerHeight();
|
869 |
+
if (high_bottom >= visible_bottom) {
|
870 |
+
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
871 |
+
} else if (high_top < visible_top) {
|
872 |
+
return this.search_results.scrollTop(high_top);
|
873 |
+
}
|
874 |
+
}
|
875 |
+
};
|
876 |
+
|
877 |
+
Chosen.prototype.result_clear_highlight = function() {
|
878 |
+
if (this.result_highlight) {
|
879 |
+
this.result_highlight.removeClass("highlighted");
|
880 |
+
}
|
881 |
+
return this.result_highlight = null;
|
882 |
+
};
|
883 |
+
|
884 |
+
Chosen.prototype.results_show = function() {
|
885 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
886 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
887 |
+
chosen: this
|
888 |
+
});
|
889 |
+
return false;
|
890 |
+
}
|
891 |
+
this.container.addClass("chosen-with-drop");
|
892 |
+
this.results_showing = true;
|
893 |
+
this.search_field.focus();
|
894 |
+
this.search_field.val(this.search_field.val());
|
895 |
+
this.winnow_results();
|
896 |
+
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
897 |
+
chosen: this
|
898 |
+
});
|
899 |
+
};
|
900 |
+
|
901 |
+
Chosen.prototype.update_results_content = function(content) {
|
902 |
+
return this.search_results.html(content);
|
903 |
+
};
|
904 |
+
|
905 |
+
Chosen.prototype.results_hide = function() {
|
906 |
+
if (this.results_showing) {
|
907 |
+
this.result_clear_highlight();
|
908 |
+
this.container.removeClass("chosen-with-drop");
|
909 |
+
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
910 |
+
chosen: this
|
911 |
+
});
|
912 |
+
}
|
913 |
+
return this.results_showing = false;
|
914 |
+
};
|
915 |
+
|
916 |
+
Chosen.prototype.set_tab_index = function(el) {
|
917 |
+
var ti;
|
918 |
+
if (this.form_field.tabIndex) {
|
919 |
+
ti = this.form_field.tabIndex;
|
920 |
+
this.form_field.tabIndex = -1;
|
921 |
+
return this.search_field[0].tabIndex = ti;
|
922 |
+
}
|
923 |
+
};
|
924 |
+
|
925 |
+
Chosen.prototype.set_label_behavior = function() {
|
926 |
+
var _this = this;
|
927 |
+
this.form_field_label = this.form_field_jq.parents("label");
|
928 |
+
if (!this.form_field_label.length && this.form_field.id.length) {
|
929 |
+
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
930 |
+
}
|
931 |
+
if (this.form_field_label.length > 0) {
|
932 |
+
return this.form_field_label.bind('click.chosen', function(evt) {
|
933 |
+
if (_this.is_multiple) {
|
934 |
+
return _this.container_mousedown(evt);
|
935 |
+
} else {
|
936 |
+
return _this.activate_field();
|
937 |
+
}
|
938 |
+
});
|
939 |
+
}
|
940 |
+
};
|
941 |
+
|
942 |
+
Chosen.prototype.show_search_field_default = function() {
|
943 |
+
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
944 |
+
this.search_field.val(this.default_text);
|
945 |
+
return this.search_field.addClass("default");
|
946 |
+
} else {
|
947 |
+
this.search_field.val("");
|
948 |
+
return this.search_field.removeClass("default");
|
949 |
+
}
|
950 |
+
};
|
951 |
+
|
952 |
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
953 |
+
var target;
|
954 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
955 |
+
if (target.length) {
|
956 |
+
this.result_highlight = target;
|
957 |
+
this.result_select(evt);
|
958 |
+
return this.search_field.focus();
|
959 |
+
}
|
960 |
+
};
|
961 |
+
|
962 |
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
963 |
+
var target;
|
964 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
965 |
+
if (target) {
|
966 |
+
return this.result_do_highlight(target);
|
967 |
+
}
|
968 |
+
};
|
969 |
+
|
970 |
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
971 |
+
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
972 |
+
return this.result_clear_highlight();
|
973 |
+
}
|
974 |
+
};
|
975 |
+
|
976 |
+
Chosen.prototype.choice_build = function(item) {
|
977 |
+
var choice, close_link,
|
978 |
+
_this = this;
|
979 |
+
choice = $('<li />', {
|
980 |
+
"class": "search-choice"
|
981 |
+
}).html("<span>" + (this.choice_label(item)) + "</span>");
|
982 |
+
if (item.disabled) {
|
983 |
+
choice.addClass('search-choice-disabled');
|
984 |
+
} else {
|
985 |
+
close_link = $('<a />', {
|
986 |
+
"class": 'search-choice-close',
|
987 |
+
'data-option-array-index': item.array_index
|
988 |
+
});
|
989 |
+
close_link.bind('click.chosen', function(evt) {
|
990 |
+
return _this.choice_destroy_link_click(evt);
|
991 |
+
});
|
992 |
+
choice.append(close_link);
|
993 |
+
}
|
994 |
+
return this.search_container.before(choice);
|
995 |
+
};
|
996 |
+
|
997 |
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
998 |
+
evt.preventDefault();
|
999 |
+
evt.stopPropagation();
|
1000 |
+
if (!this.is_disabled) {
|
1001 |
+
return this.choice_destroy($(evt.target));
|
1002 |
+
}
|
1003 |
+
};
|
1004 |
+
|
1005 |
+
Chosen.prototype.choice_destroy = function(link) {
|
1006 |
+
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
1007 |
+
this.show_search_field_default();
|
1008 |
+
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
1009 |
+
this.results_hide();
|
1010 |
+
}
|
1011 |
+
link.parents('li').first().remove();
|
1012 |
+
return this.search_field_scale();
|
1013 |
+
}
|
1014 |
+
};
|
1015 |
+
|
1016 |
+
Chosen.prototype.results_reset = function() {
|
1017 |
+
this.reset_single_select_options();
|
1018 |
+
this.form_field.options[0].selected = true;
|
1019 |
+
this.single_set_selected_text();
|
1020 |
+
this.show_search_field_default();
|
1021 |
+
this.results_reset_cleanup();
|
1022 |
+
this.form_field_jq.trigger("change");
|
1023 |
+
if (this.active_field) {
|
1024 |
+
return this.results_hide();
|
1025 |
+
}
|
1026 |
+
};
|
1027 |
+
|
1028 |
+
Chosen.prototype.results_reset_cleanup = function() {
|
1029 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1030 |
+
return this.selected_item.find("abbr").remove();
|
1031 |
+
};
|
1032 |
+
|
1033 |
+
Chosen.prototype.result_select = function(evt) {
|
1034 |
+
var high, item;
|
1035 |
+
if (this.result_highlight) {
|
1036 |
+
high = this.result_highlight;
|
1037 |
+
this.result_clear_highlight();
|
1038 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1039 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
1040 |
+
chosen: this
|
1041 |
+
});
|
1042 |
+
return false;
|
1043 |
+
}
|
1044 |
+
if (this.is_multiple) {
|
1045 |
+
high.removeClass("active-result");
|
1046 |
+
} else {
|
1047 |
+
this.reset_single_select_options();
|
1048 |
+
}
|
1049 |
+
high.addClass("result-selected");
|
1050 |
+
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
1051 |
+
item.selected = true;
|
1052 |
+
this.form_field.options[item.options_index].selected = true;
|
1053 |
+
this.selected_option_count = null;
|
1054 |
+
if (this.is_multiple) {
|
1055 |
+
this.choice_build(item);
|
1056 |
+
} else {
|
1057 |
+
this.single_set_selected_text(this.choice_label(item));
|
1058 |
+
}
|
1059 |
+
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1060 |
+
this.results_hide();
|
1061 |
+
}
|
1062 |
+
this.show_search_field_default();
|
1063 |
+
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1064 |
+
this.form_field_jq.trigger("change", {
|
1065 |
+
'selected': this.form_field.options[item.options_index].value
|
1066 |
+
});
|
1067 |
+
}
|
1068 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1069 |
+
evt.preventDefault();
|
1070 |
+
return this.search_field_scale();
|
1071 |
+
}
|
1072 |
+
};
|
1073 |
+
|
1074 |
+
Chosen.prototype.single_set_selected_text = function(text) {
|
1075 |
+
if (text == null) {
|
1076 |
+
text = this.default_text;
|
1077 |
+
}
|
1078 |
+
if (text === this.default_text) {
|
1079 |
+
this.selected_item.addClass("chosen-default");
|
1080 |
+
} else {
|
1081 |
+
this.single_deselect_control_build();
|
1082 |
+
this.selected_item.removeClass("chosen-default");
|
1083 |
+
}
|
1084 |
+
return this.selected_item.find("span").html(text);
|
1085 |
+
};
|
1086 |
+
|
1087 |
+
Chosen.prototype.result_deselect = function(pos) {
|
1088 |
+
var result_data;
|
1089 |
+
result_data = this.results_data[pos];
|
1090 |
+
if (!this.form_field.options[result_data.options_index].disabled) {
|
1091 |
+
result_data.selected = false;
|
1092 |
+
this.form_field.options[result_data.options_index].selected = false;
|
1093 |
+
this.selected_option_count = null;
|
1094 |
+
this.result_clear_highlight();
|
1095 |
+
if (this.results_showing) {
|
1096 |
+
this.winnow_results();
|
1097 |
+
}
|
1098 |
+
this.form_field_jq.trigger("change", {
|
1099 |
+
deselected: this.form_field.options[result_data.options_index].value
|
1100 |
+
});
|
1101 |
+
this.search_field_scale();
|
1102 |
+
return true;
|
1103 |
+
} else {
|
1104 |
+
return false;
|
1105 |
+
}
|
1106 |
+
};
|
1107 |
+
|
1108 |
+
Chosen.prototype.single_deselect_control_build = function() {
|
1109 |
+
if (!this.allow_single_deselect) {
|
1110 |
+
return;
|
1111 |
+
}
|
1112 |
+
if (!this.selected_item.find("abbr").length) {
|
1113 |
+
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1114 |
+
}
|
1115 |
+
return this.selected_item.addClass("chosen-single-with-deselect");
|
1116 |
+
};
|
1117 |
+
|
1118 |
+
Chosen.prototype.get_search_text = function() {
|
1119 |
+
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1120 |
+
};
|
1121 |
+
|
1122 |
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
1123 |
+
var do_high, selected_results;
|
1124 |
+
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1125 |
+
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1126 |
+
if (do_high != null) {
|
1127 |
+
return this.result_do_highlight(do_high);
|
1128 |
+
}
|
1129 |
+
};
|
1130 |
+
|
1131 |
+
Chosen.prototype.no_results = function(terms) {
|
1132 |
+
var no_results_html;
|
1133 |
+
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1134 |
+
no_results_html.find("span").first().html(terms);
|
1135 |
+
this.search_results.append(no_results_html);
|
1136 |
+
return this.form_field_jq.trigger("chosen:no_results", {
|
1137 |
+
chosen: this
|
1138 |
+
});
|
1139 |
+
};
|
1140 |
+
|
1141 |
+
Chosen.prototype.no_results_clear = function() {
|
1142 |
+
return this.search_results.find(".no-results").remove();
|
1143 |
+
};
|
1144 |
+
|
1145 |
+
Chosen.prototype.keydown_arrow = function() {
|
1146 |
+
var next_sib;
|
1147 |
+
if (this.results_showing && this.result_highlight) {
|
1148 |
+
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1149 |
+
if (next_sib) {
|
1150 |
+
return this.result_do_highlight(next_sib);
|
1151 |
+
}
|
1152 |
+
} else {
|
1153 |
+
return this.results_show();
|
1154 |
+
}
|
1155 |
+
};
|
1156 |
+
|
1157 |
+
Chosen.prototype.keyup_arrow = function() {
|
1158 |
+
var prev_sibs;
|
1159 |
+
if (!this.results_showing && !this.is_multiple) {
|
1160 |
+
return this.results_show();
|
1161 |
+
} else if (this.result_highlight) {
|
1162 |
+
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1163 |
+
if (prev_sibs.length) {
|
1164 |
+
return this.result_do_highlight(prev_sibs.first());
|
1165 |
+
} else {
|
1166 |
+
if (this.choices_count() > 0) {
|
1167 |
+
this.results_hide();
|
1168 |
+
}
|
1169 |
+
return this.result_clear_highlight();
|
1170 |
+
}
|
1171 |
+
}
|
1172 |
+
};
|
1173 |
+
|
1174 |
+
Chosen.prototype.keydown_backstroke = function() {
|
1175 |
+
var next_available_destroy;
|
1176 |
+
if (this.pending_backstroke) {
|
1177 |
+
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1178 |
+
return this.clear_backstroke();
|
1179 |
+
} else {
|
1180 |
+
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1181 |
+
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1182 |
+
this.pending_backstroke = next_available_destroy;
|
1183 |
+
if (this.single_backstroke_delete) {
|
1184 |
+
return this.keydown_backstroke();
|
1185 |
+
} else {
|
1186 |
+
return this.pending_backstroke.addClass("search-choice-focus");
|
1187 |
+
}
|
1188 |
+
}
|
1189 |
+
}
|
1190 |
+
};
|
1191 |
+
|
1192 |
+
Chosen.prototype.clear_backstroke = function() {
|
1193 |
+
if (this.pending_backstroke) {
|
1194 |
+
this.pending_backstroke.removeClass("search-choice-focus");
|
1195 |
+
}
|
1196 |
+
return this.pending_backstroke = null;
|
1197 |
+
};
|
1198 |
+
|
1199 |
+
Chosen.prototype.keydown_checker = function(evt) {
|
1200 |
+
var stroke, _ref1;
|
1201 |
+
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1202 |
+
this.search_field_scale();
|
1203 |
+
if (stroke !== 8 && this.pending_backstroke) {
|
1204 |
+
this.clear_backstroke();
|
1205 |
+
}
|
1206 |
+
switch (stroke) {
|
1207 |
+
case 8:
|
1208 |
+
this.backstroke_length = this.search_field.val().length;
|
1209 |
+
break;
|
1210 |
+
case 9:
|
1211 |
+
if (this.results_showing && !this.is_multiple) {
|
1212 |
+
this.result_select(evt);
|
1213 |
+
}
|
1214 |
+
this.mouse_on_container = false;
|
1215 |
+
break;
|
1216 |
+
case 13:
|
1217 |
+
if (this.results_showing) {
|
1218 |
+
evt.preventDefault();
|
1219 |
+
}
|
1220 |
+
break;
|
1221 |
+
case 32:
|
1222 |
+
if (this.disable_search) {
|
1223 |
+
evt.preventDefault();
|
1224 |
+
}
|
1225 |
+
break;
|
1226 |
+
case 38:
|
1227 |
+
evt.preventDefault();
|
1228 |
+
this.keyup_arrow();
|
1229 |
+
break;
|
1230 |
+
case 40:
|
1231 |
+
evt.preventDefault();
|
1232 |
+
this.keydown_arrow();
|
1233 |
+
break;
|
1234 |
+
}
|
1235 |
+
};
|
1236 |
+
|
1237 |
+
Chosen.prototype.search_field_scale = function() {
|
1238 |
+
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1239 |
+
if (this.is_multiple) {
|
1240 |
+
h = 0;
|
1241 |
+
w = 0;
|
1242 |
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1243 |
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1244 |
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1245 |
+
style = styles[_i];
|
1246 |
+
style_block += style + ":" + this.search_field.css(style) + ";";
|
1247 |
+
}
|
1248 |
+
div = $('<div />', {
|
1249 |
+
'style': style_block
|
1250 |
+
});
|
1251 |
+
div.text(this.search_field.val());
|
1252 |
+
$('body').append(div);
|
1253 |
+
w = div.width() + 25;
|
1254 |
+
div.remove();
|
1255 |
+
f_width = this.container.outerWidth();
|
1256 |
+
if (w > f_width - 10) {
|
1257 |
+
w = f_width - 10;
|
1258 |
+
}
|
1259 |
+
return this.search_field.css({
|
1260 |
+
'width': w + 'px'
|
1261 |
+
});
|
1262 |
+
}
|
1263 |
+
};
|
1264 |
+
|
1265 |
+
return Chosen;
|
1266 |
+
|
1267 |
+
})(AbstractChosen);
|
1268 |
+
|
1269 |
+
}).call(this);
|
{includes → admin}/js/form_popup.js
RENAMED
File without changes
|
{includes → admin}/js/iframeResizer.contentWindow.min.js
RENAMED
File without changes
|
{includes → admin}/js/iframeResizer.min.js
RENAMED
File without changes
|
{includes → admin}/js/jscolor/arrow.gif
RENAMED
File without changes
|
{includes → admin}/js/jscolor/cross.gif
RENAMED
File without changes
|
{includes → admin}/js/jscolor/hs.png
RENAMED
File without changes
|
{includes → admin}/js/jscolor/hv.png
RENAMED
File without changes
|
{includes → admin}/js/jscolor/jscolor.js
RENAMED
@@ -14,7 +14,7 @@ var jscolor = {
|
|
14 |
|
15 |
|
16 |
dir : '', // location of jscolor directory (leave empty to autodetect)
|
17 |
-
bindClass : 'color', // class name
|
18 |
binding : true, // automatic binding via <input class="...">
|
19 |
preloading : true, // use image preloading?
|
20 |
|
14 |
|
15 |
|
16 |
dir : '', // location of jscolor directory (leave empty to autodetect)
|
17 |
+
bindClass : 'color-captainform', // class name
|
18 |
binding : true, // automatic binding via <input class="...">
|
19 |
preloading : true, // use image preloading?
|
20 |
|
{includes → admin}/js/main.js
RENAMED
@@ -105,6 +105,14 @@ function create_popup_dialog(msg){
|
|
105 |
jQuery('#popup_box').css('border','solid 1px #838383');
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
function create_popup_iframe(msg) {
|
109 |
jQuery('#captainform_popup').remove();
|
110 |
url = msg.popup_url + msg.popup_url_query;
|
@@ -135,7 +143,12 @@ function create_popup_iframe(msg) {
|
|
135 |
msg_return = btn_action_name;
|
136 |
vonclick = " onclick=\"" + btn_action_name + "\"";
|
137 |
}
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
139 |
});
|
140 |
buttons_html += '</div>';
|
141 |
}
|
@@ -157,6 +170,7 @@ function create_popup_iframe(msg) {
|
|
157 |
jQuery('#popup_box').width(w);
|
158 |
jQuery('#popup_box').height(0);
|
159 |
jQuery('#captainform_popup').show();
|
|
|
160 |
|
161 |
|
162 |
element1 = document.getElementById('ppiframe');
|
105 |
jQuery('#popup_box').css('border','solid 1px #838383');
|
106 |
}
|
107 |
|
108 |
+
function captform_after_click_button()
|
109 |
+
{
|
110 |
+
jQuery( ".after_click_disable" ).off('click').click(function(event) {
|
111 |
+
jQuery(this).addClass('btn_disabled');
|
112 |
+
jQuery(this).prop('onclick','').off('click');
|
113 |
+
});
|
114 |
+
}
|
115 |
+
|
116 |
function create_popup_iframe(msg) {
|
117 |
jQuery('#captainform_popup').remove();
|
118 |
url = msg.popup_url + msg.popup_url_query;
|
143 |
msg_return = btn_action_name;
|
144 |
vonclick = " onclick=\"" + btn_action_name + "\"";
|
145 |
}
|
146 |
+
addclass = '';
|
147 |
+
if (btn_action.hasOwnProperty('after_click')) {
|
148 |
+
if(btn_action.after_click == 'disabled')
|
149 |
+
addclass = ' after_click_disable';
|
150 |
+
}
|
151 |
+
buttons_html += '<div class="btn ' + val + addclass + '"' + vonclick + '>' + btn_title + '</div>';
|
152 |
});
|
153 |
buttons_html += '</div>';
|
154 |
}
|
170 |
jQuery('#popup_box').width(w);
|
171 |
jQuery('#popup_box').height(0);
|
172 |
jQuery('#captainform_popup').show();
|
173 |
+
captform_after_click_button();
|
174 |
|
175 |
|
176 |
element1 = document.getElementById('ppiframe');
|
{includes → admin}/js/nolink.js
RENAMED
File without changes
|
{includes → admin}/js/review.js
RENAMED
File without changes
|
{includes → admin}/js/tinybox/images/close.png
RENAMED
File without changes
|
{includes → admin}/js/tinybox/images/preload.gif
RENAMED
File without changes
|
{includes → admin}/js/tinybox/tinybox.js
RENAMED
File without changes
|
{includes → admin}/js/tinybox/tinyboxstyle.css
RENAMED
File without changes
|
{includes → admin}/js/tinybox/tinyboxstyle_ios.css
RENAMED
File without changes
|
admin/js/widget.js
ADDED
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
window.captainform_is_widget_page = true;
|
2 |
+
jQuery(document).ready(function ($) {
|
3 |
+
captainform_bind_widget();
|
4 |
+
});
|
5 |
+
|
6 |
+
function captainform_bind_widget(widget_id_to_bind)
|
7 |
+
{
|
8 |
+
var prefix = '';
|
9 |
+
if (typeof widget_id_to_bind != 'undefined' && widget_id_to_bind != '' && widget_id_to_bind != null)
|
10 |
+
prefix = "#" + widget_id_to_bind + " ";
|
11 |
+
|
12 |
+
bind_searchable(prefix);
|
13 |
+
bind_lightbox_publish(prefix);
|
14 |
+
if (typeof jscolor != 'undefined')
|
15 |
+
jscolor.init();
|
16 |
+
}
|
17 |
+
|
18 |
+
function bind_lightbox_publish(prefix)
|
19 |
+
{
|
20 |
+
jQuery(prefix + '.cf_lightbox_cotainer').each(function () {
|
21 |
+
if (jQuery(this).find(".cf_display_as_lightbox").is(':checked'))
|
22 |
+
{
|
23 |
+
jQuery(this).find('.cf_triggers_container').show();
|
24 |
+
if (jQuery(this).find('.cf_trigger:checked').val() == 1)
|
25 |
+
{
|
26 |
+
image_obj = jQuery(this).find('.cf_trigger_1_url');
|
27 |
+
captainform_test_valid_image(image_obj.val(), image_obj)
|
28 |
+
}
|
29 |
+
}
|
30 |
+
else if (!jQuery(this).find(".cf_display_as_lightbox").is(':checked'))
|
31 |
+
{
|
32 |
+
jQuery(this).find('.cf_triggers_container').hide();
|
33 |
+
}
|
34 |
+
|
35 |
+
if(jQuery(this).find('.cf_use_custom_vars').is(':checked')){
|
36 |
+
jQuery(this).find('.use_custom_vars_container').show();
|
37 |
+
}
|
38 |
+
else if(!jQuery(this).find('.cf_use_custom_vars').is(':checked')){
|
39 |
+
jQuery(this).find('.use_custom_vars_container').hide();
|
40 |
+
}
|
41 |
+
|
42 |
+
});
|
43 |
+
|
44 |
+
/*Populate values for Prefill form fields*/
|
45 |
+
if(window.captainform_is_widget_page == true){
|
46 |
+
jQuery('.captainform_widget_container').each(function(){
|
47 |
+
var cf_formid= jQuery(this).find('.captainform_widget_select').val();
|
48 |
+
var cf_customvars_code = jQuery(this).find('.captainform_custom_vars_code').val();
|
49 |
+
draw_prefix = '#' + jQuery(this).closest('.widget').attr('id');
|
50 |
+
if(cf_customvars_code != "" && cf_formid != ""){
|
51 |
+
jQuery(this).find('.cf_use_custom_vars').prop('checked',true);
|
52 |
+
jQuery(this).find('.use_custom_vars_container').show();
|
53 |
+
draw_custom_vars(cf_formid, draw_prefix , cf_customvars_code);
|
54 |
+
}
|
55 |
+
else{
|
56 |
+
if((typeof captainform_forms_controls != 'undefined') && (typeof captainform_forms_controls[cf_formid] == 'undefined'))
|
57 |
+
jQuery(draw_prefix + ' .customvars_trigger').hide();
|
58 |
+
}
|
59 |
+
});
|
60 |
+
}
|
61 |
+
|
62 |
+
/*Prefill for form fields checkebox*/
|
63 |
+
jQuery(prefix + '.cf_use_custom_vars').on('click', function () {
|
64 |
+
if (jQuery(this).is(':checked')) {
|
65 |
+
jQuery(this).closest('.cf_lightbox_cotainer').find('.use_custom_vars_container').show();
|
66 |
+
if(window.captainform_is_widget_page == true) {
|
67 |
+
formid = jQuery(this).closest('.captainform_widget_container').find('.captainform_widget_select').val();
|
68 |
+
prefix = '#' + jQuery(this).closest('.widget').attr('id');
|
69 |
+
calculate_shortcode(this);
|
70 |
+
draw_custom_vars(formid, prefix, '');
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
74 |
+
else {
|
75 |
+
jQuery(this).closest('.cf_lightbox_cotainer').find('.use_custom_vars_container').hide();
|
76 |
+
jQuery(this).closest('.captainform_widget_container').find('.captainform_custom_vars_code').val('');
|
77 |
+
}
|
78 |
+
});
|
79 |
+
|
80 |
+
/*Display as a lightbox checkbox*/
|
81 |
+
jQuery(prefix + '.cf_display_as_lightbox').on('click', function () {
|
82 |
+
if (jQuery(this).is(':checked'))
|
83 |
+
jQuery(this).closest('.cf_lightbox_cotainer').find('.cf_triggers_container').show();
|
84 |
+
else
|
85 |
+
jQuery(this).closest('.cf_lightbox_cotainer').find('.cf_triggers_container').hide();
|
86 |
+
});
|
87 |
+
|
88 |
+
jQuery(prefix + '.cf_trigger').on('click', function () {
|
89 |
+
var value = jQuery(this).val();
|
90 |
+
var options_container = jQuery(this).closest('.cf_triggers_container');
|
91 |
+
jQuery(options_container).find('.cf_trigger_selected_option_container').hide();
|
92 |
+
jQuery(options_container).find('.cf_trigger_selected_option_cotainter_' + value).show();
|
93 |
+
|
94 |
+
});
|
95 |
+
|
96 |
+
jQuery(prefix + '.cf_trigger').each(function () {
|
97 |
+
var value = jQuery(this).val();
|
98 |
+
if (jQuery(this).is(':checked'))
|
99 |
+
{
|
100 |
+
var options_container = jQuery(this).closest('.cf_triggers_container');
|
101 |
+
jQuery(options_container).find('.cf_trigger_selected_option_container').hide();
|
102 |
+
jQuery(options_container).find('.cf_trigger_selected_option_cotainter_' + value).show();
|
103 |
+
}
|
104 |
+
});
|
105 |
+
|
106 |
+
jQuery(prefix + '.cf_display_as_lightbox').on('change', function () {
|
107 |
+
if (!jQuery(this).is(':checked'))
|
108 |
+
{
|
109 |
+
var formid = jQuery(this).closest('.captainform_widget_container').find('.captainform_widget_select').val();
|
110 |
+
var code = '[captainform id="' + formid + '"]';
|
111 |
+
jQuery(this).closest('.captainform_widget_container').find('.cf_generated_code').val(code);
|
112 |
+
}
|
113 |
+
});
|
114 |
+
|
115 |
+
jQuery(prefix + '.cf_trigger_1_url').on('change keyup', function () {
|
116 |
+
captainform_test_valid_image(jQuery(this).val(), jQuery(this));
|
117 |
+
});
|
118 |
+
|
119 |
+
jQuery(prefix + '.cf_triggers_container input , ' +
|
120 |
+
prefix + ' .cf_display_as_lightbox, ' +
|
121 |
+
prefix + ' .captainform_widget_select,' +
|
122 |
+
prefix + ' .captainform_form_toembed'
|
123 |
+
).on('change keyup', function () {
|
124 |
+
calculate_shortcode(this);
|
125 |
+
|
126 |
+
});
|
127 |
+
|
128 |
+
jQuery(prefix + ' .cf_use_custom_vars, ' +
|
129 |
+
prefix + ' .custom_var_option, ' +
|
130 |
+
prefix + ' .custom_var_value').on('change ', function () {
|
131 |
+
prepare_draw_custom_vars(prefix);
|
132 |
+
});
|
133 |
+
|
134 |
+
jQuery('.captainform_widget_select').on('change',function(){
|
135 |
+
if(window.captainform_is_widget_page == true){
|
136 |
+
jQuery(this).closest('.captainform_widget_container').find('.captainform_custom_vars_code').val('');
|
137 |
+
formid =jQuery(this).val();
|
138 |
+
prefix = '#' + jQuery(this).closest('.widget').attr('id');
|
139 |
+
cf_custom_vars = '';
|
140 |
+
draw_custom_vars(formid, prefix, cf_custom_vars)
|
141 |
+
}
|
142 |
+
else {
|
143 |
+
jQuery('.captainform_custom_vars_code').val('');
|
144 |
+
prepare_draw_custom_vars(prefix);
|
145 |
+
}
|
146 |
+
});
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Calculate the shortcode for Display as a lightbox
|
151 |
+
* @param thisobj
|
152 |
+
*/
|
153 |
+
function calculate_shortcode(thisobj){
|
154 |
+
if (window.captainform_is_widget_page == true)
|
155 |
+
var formid = jQuery(thisobj).closest('.captainform_widget_container').find('.captainform_widget_select').val();
|
156 |
+
else
|
157 |
+
var formid = document.getElementById('captainform_form_toembed').options[document.getElementById('captainform_form_toembed').selectedIndex].value;
|
158 |
+
|
159 |
+
var display_as_lightbox = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_display_as_lightbox').is(':checked');
|
160 |
+
var code = '[captainform id="' + formid+'"';
|
161 |
+
|
162 |
+
if (display_as_lightbox == true)
|
163 |
+
{
|
164 |
+
code += ' lightbox="1" ';
|
165 |
+
var selected_trigger = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger:checked').val();
|
166 |
+
switch (selected_trigger)
|
167 |
+
{
|
168 |
+
case '0' : /*text*/
|
169 |
+
var text_selected = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger_0_text').val();
|
170 |
+
code += 'text_content="' + encodeURIComponent(text_selected) + '" type="text"';
|
171 |
+
break;
|
172 |
+
case '1': /*image*/
|
173 |
+
var image_obj = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger_1_url');
|
174 |
+
var image_url = image_obj.val();
|
175 |
+
code += 'url="' + encodeURI(image_url) + '" type="image"';
|
176 |
+
break;
|
177 |
+
case '2': /*floating button*/
|
178 |
+
var text = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger_2_text').val();
|
179 |
+
var position = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger_2_position:checked').val();
|
180 |
+
var background_color = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger_2_background_color').val();
|
181 |
+
var text_color = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger_2_color').val();
|
182 |
+
|
183 |
+
code += 'text_content="' + encodeURIComponent(text) + '" ';
|
184 |
+
code += 'bg_color="' + background_color + '" ';
|
185 |
+
code += 'text_color="' + text_color + '" ';
|
186 |
+
|
187 |
+
switch (position)
|
188 |
+
{
|
189 |
+
case '1':
|
190 |
+
code += 'position="left" ';
|
191 |
+
break;
|
192 |
+
case '2':
|
193 |
+
code += 'position="right" ';
|
194 |
+
break;
|
195 |
+
case '3':
|
196 |
+
code += 'position="bottom" ';
|
197 |
+
break;
|
198 |
+
default:
|
199 |
+
code += 'position="left" ';
|
200 |
+
}
|
201 |
+
code += 'type="floating-button"';
|
202 |
+
break;
|
203 |
+
case '3': /*Auto popup*/
|
204 |
+
var autoPopupType = jQuery(thisobj).closest('.captainform_widget_container').find('.captainform_auto_popup_trigger:checked').val();
|
205 |
+
var after = jQuery(thisobj).closest('.captainform_widget_container').find('.cf_trigger_2_time').val() * 1000;
|
206 |
+
|
207 |
+
if(autoPopupType == 1){
|
208 |
+
if(after <= 0)
|
209 |
+
after = 3000;
|
210 |
+
if (after != '')
|
211 |
+
code += 'miliseconds="' + after + '" ';
|
212 |
+
else
|
213 |
+
code += 'miliseconds="' + 3000 + '" ';
|
214 |
+
}
|
215 |
+
code += autoPopupType == 1 ? 'type="auto-popup"' : 'type="window-leave"';
|
216 |
+
break;}
|
217 |
+
}
|
218 |
+
|
219 |
+
code += ']';
|
220 |
+
|
221 |
+
if (window.captainform_is_widget_page == true) {
|
222 |
+
jQuery(thisobj).closest('.captainform_widget_container').find('.cf_generated_code').val(code);
|
223 |
+
}
|
224 |
+
else
|
225 |
+
jQuery('.cf_generated_code').val(code);
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Helper for drawing the Prefill form fields content
|
230 |
+
* @param prefix
|
231 |
+
*/
|
232 |
+
function prepare_draw_custom_vars(prefix){
|
233 |
+
if(window.captainform_is_widget_page) {
|
234 |
+
var formid = jQuery(this).closest('.captainform_widget_container').find('.captainform_widget_select').val();
|
235 |
+
var use_custom_vars = jQuery(this).closest('.captainform_widget_container').find('.cf_use_custom_vars').is(':checked');
|
236 |
+
var custom_vars_code = jQuery(this).closest('.captainform_widget_container').find('.captainform_custom_vars_code').val();
|
237 |
+
prefix = '#' + jQuery(this).closest('.widget').attr('id');
|
238 |
+
}
|
239 |
+
else{
|
240 |
+
var formid = jQuery('.captainform_widget_select').val();
|
241 |
+
var use_custom_vars = jQuery('.cf_use_custom_vars').is(':checked');
|
242 |
+
var custom_vars_code = jQuery('.captainform_custom_vars_code').val();
|
243 |
+
}
|
244 |
+
|
245 |
+
draw_custom_vars(formid, prefix, custom_vars_code);
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Generate association array for Prefill form fields
|
250 |
+
* @param str String with all the prefill associations
|
251 |
+
* @returns {Array}
|
252 |
+
*/
|
253 |
+
function generate_assocs_from_string(str){
|
254 |
+
var regex = /(cf_custom_var[0-9]+[-]?[0-9])="([^"]+)"/g;
|
255 |
+
var return_array = [];
|
256 |
+
while ((match = regex.exec(str)) != null) {
|
257 |
+
if((typeof match[1] != 'undefined') && (typeof match[2] != 'undefined'))
|
258 |
+
return_array[match[1]] = match[2];
|
259 |
+
}
|
260 |
+
return return_array;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Function that draws the content of Prefill form fields
|
265 |
+
* @param formid
|
266 |
+
* @param prefix
|
267 |
+
* @param cf_custom_vars
|
268 |
+
*/
|
269 |
+
function draw_custom_vars(formid, prefix, cf_custom_vars) {
|
270 |
+
var cf_assocs_array = generate_assocs_from_string(cf_custom_vars);
|
271 |
+
|
272 |
+
if (typeof captainform_forms_controls[formid] != 'undefined') {
|
273 |
+
jQuery(prefix + ' .customvars_trigger').show();
|
274 |
+
if(jQuery(prefix + ' .cf_use_custom_vars').is(':checked'))
|
275 |
+
jQuery(prefix + ' .use_custom_vars_container').show();
|
276 |
+
var html = '';
|
277 |
+
var field_text;
|
278 |
+
for (key in captainform_forms_controls[formid]) {
|
279 |
+
var field = captainform_forms_controls[formid][key];
|
280 |
+
var field_id = field['c_id'];
|
281 |
+
field_text = field['c_text'];
|
282 |
+
var render_array = [];
|
283 |
+
if(field['c_type'] == 6 && field['c_object'] == 1){ /*Name*/
|
284 |
+
render_array[0] = {label: field_text + ' - First name', field_id : field_id + '-1'};
|
285 |
+
render_array[1] = {label: field_text + ' - Last name', field_id : field_id + '-2'};
|
286 |
+
}
|
287 |
+
else { /*Any other type of field*/
|
288 |
+
render_array[0] = {label: field_text , field_id : field_id };
|
289 |
+
}
|
290 |
+
|
291 |
+
for(render_key in render_array) {
|
292 |
+
var assoc_value = "";
|
293 |
+
var assoc_index = "";
|
294 |
+
if(typeof cf_custom_vars != 'undefined' && typeof cf_assocs_array['cf_custom_var' + render_array[render_key].field_id] != 'undefined')
|
295 |
+
{
|
296 |
+
assoc_index = 'cf_custom_var' + render_array[render_key].field_id;
|
297 |
+
assoc_value = cf_assocs_array[assoc_index];
|
298 |
+
}
|
299 |
+
|
300 |
+
force_input_visible = false;
|
301 |
+
if(((assoc_value.indexOf('WORDPRESS_') == -1) && (assoc_value.indexOf('CAPTAINFORMREQUEST') == -1) && (assoc_value != '')) || (assoc_value.indexOf('CAPTAINFORMREQUEST')!= -1))
|
302 |
+
force_input_visible = true;
|
303 |
+
html +=
|
304 |
+
'<div class="cf_row">' +
|
305 |
+
'<div class="cf_left">' +
|
306 |
+
render_array[render_key].label+
|
307 |
+
'</div>';
|
308 |
+
html += '<div class="cf_center">' +
|
309 |
+
'<select name="custom_var_option" class="custom_var_option">' +
|
310 |
+
'<option value="0">Do not prefill</option>' +
|
311 |
+
'<option value="TEXT" ' + ((assoc_value.indexOf('WORDPRESS_') == -1) && (assoc_value.indexOf('CAPTAINFORMREQUEST') == -1) && (assoc_value != '') ? 'selected' : '' ) + '>Text Value</option>' +
|
312 |
+
'<option value="WORDPRESS_USERNAME" ' + (assoc_value == "WORDPRESS_USERNAME" ? 'selected' : '' ) + '>WordPress Username</option>' +
|
313 |
+
'<option value="WORDPRESS_EMAIL" ' + (assoc_value == "WORDPRESS_EMAIL" ? 'selected' : '' ) + '>WordPress Email</option>' +
|
314 |
+
'<option value="WORDPRESS_FIRSTNAME" ' + (assoc_value == "WORDPRESS_FIRSTNAME" ? 'selected' : '' ) + '>WordPress First Name</option>' +
|
315 |
+
'<option value="WORDPRESS_LASTNAME" ' + (assoc_value == "WORDPRESS_LASTNAME" ? 'selected' : '' ) + '>Wordpress Last Name</option>' +
|
316 |
+
'<option value="WORDPRESS_DISPLAYNAME" ' + (assoc_value == "WORDPRESS_DISPLAYNAME" ? 'selected' : '' ) + '>Wordpress Display Name</option>' +
|
317 |
+
'<option value="WORDPRESS_URL" ' + (assoc_value == "WORDPRESS_URL" ? 'selected' : '' ) + '>Wordpress URL</option>' +
|
318 |
+
'<option value="WORDPRESS_USERID" ' + (assoc_value == "WORDPRESS_USERID" ? 'selected' : '' ) + '>Wordpress User ID</option>' +
|
319 |
+
'<option value="CAPTAINFORMREQUEST" ' + (assoc_value.indexOf('CAPTAINFORMREQUEST') != -1 ? 'selected' : '' ) + '>Request Variable</option>' +
|
320 |
+
'</select>' +
|
321 |
+
'</div>';
|
322 |
+
if(assoc_value.indexOf('CAPTAINFORMREQUEST_')!= -1)
|
323 |
+
assoc_value = assoc_value.substring("CAPTAINFORMREQUEST_".length);
|
324 |
+
html+= '<div class="cf_right">' +
|
325 |
+
'<input type="text" name="cf_custom_var' + render_array[render_key].field_id + '" class="custom_var_value cf_custom_var' + render_array[render_key].field_id + '" value="' + (force_input_visible ? assoc_value : '' )+ '" ' + (force_input_visible ? ' style="display:block;"' : '') + ' />' +
|
326 |
+
'</div>' +
|
327 |
+
'</div>';
|
328 |
+
assoc_value = '';
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
jQuery(prefix + ' .custom_vars_draw').html(html);
|
333 |
+
bind_change_custom_vars();
|
334 |
+
}
|
335 |
+
else{
|
336 |
+
jQuery(prefix + ' .custom_vars_draw').html('');
|
337 |
+
jQuery(prefix + ' .customvars_trigger').hide();
|
338 |
+
jQuery(prefix + ' .use_custom_vars_container').hide();
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Function that binds all the actions for the change custom variables actions
|
344 |
+
* @since: 2.1.6
|
345 |
+
*/
|
346 |
+
function bind_change_custom_vars(){
|
347 |
+
/*change left select*/
|
348 |
+
jQuery('.custom_var_option').on('change',function(){
|
349 |
+
var select_value = jQuery(this).val();
|
350 |
+
var right_item_selector = jQuery(this).closest('.cf_row').find('.cf_right input');
|
351 |
+
if((select_value == 'TEXT') || (select_value == "CAPTAINFORMREQUEST")) {
|
352 |
+
right_item_selector.show();
|
353 |
+
}
|
354 |
+
else {
|
355 |
+
right_item_selector.hide();
|
356 |
+
}
|
357 |
+
});
|
358 |
+
|
359 |
+
/*calculate the custom vars code on change*/
|
360 |
+
jQuery('.custom_vars_draw input, .custom_vars_draw select').on('change keyup',function(){
|
361 |
+
var custom_vars_code = "" ;
|
362 |
+
jQuery(this).closest('.custom_vars_draw').find('.cf_row').each(function(){
|
363 |
+
selected_val = jQuery(this).find('.custom_var_option').val();
|
364 |
+
if(selected_val != "0") {
|
365 |
+
var input = jQuery(this).find('.cf_right input');
|
366 |
+
var input_name = input.attr('name');
|
367 |
+
var input_val = input.val();
|
368 |
+
|
369 |
+
custom_vars_code += " " + input_name;
|
370 |
+
if(selected_val == "TEXT" )
|
371 |
+
custom_vars_code += '="' + input_val + '" ';
|
372 |
+
else if(selected_val == "CAPTAINFORMREQUEST" )
|
373 |
+
custom_vars_code += '="CAPTAINFORMREQUEST_' + input_val + '" ';
|
374 |
+
else if(selected_val.lastIndexOf('WORDPRESS_') != -1){
|
375 |
+
custom_vars_code += '="' + selected_val + '" ';
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
jQuery(this).closest('.captainform_widget_container').find('.captainform_custom_vars_code').val(custom_vars_code);
|
380 |
+
});
|
381 |
+
});
|
382 |
+
}
|
383 |
+
|
384 |
+
function bind_searchable(prefix)
|
385 |
+
{
|
386 |
+
try {
|
387 |
+
jQuery(prefix + '.captainform_widget_select').chosen({search_contains: true, no_results_text: 'No results match'});
|
388 |
+
jQuery(prefix + '.captainform_widget_container').find('.chosen-container.chosen-container-single').each(function () {
|
389 |
+
if (jQuery(this).parent().find('.chosen-container.chosen-container-single').length > 1)
|
390 |
+
{
|
391 |
+
jQuery(this).parent().find('.chosen-container.chosen-container-single').last().remove();
|
392 |
+
}
|
393 |
+
});
|
394 |
+
}
|
395 |
+
catch (err)
|
396 |
+
{
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
jQuery(document).ajaxComplete(function (event, XMLHttpRequest, ajaxOptions) {
|
401 |
+
var request = {}, pairs, i, split, widget;
|
402 |
+
if(typeof ajaxOptions.data != 'undefined')
|
403 |
+
{
|
404 |
+
pairs = ajaxOptions.data.split('&');
|
405 |
+
for (i in pairs) {
|
406 |
+
split = pairs[i].split('=');
|
407 |
+
request[decodeURIComponent(split[0])] = decodeURIComponent(split[1]);
|
408 |
+
}
|
409 |
+
}
|
410 |
+
if ((request.action && (request.action === 'save-widget') && (typeof request['widget-id'] != 'undefined') && (request['widget-id'].indexOf('captainform_widget') != -1))|| (typeof request.wp_customize != 'undefined' && request.wp_customize == 'on')) {
|
411 |
+
var my_widget_id = request['widget-id'];
|
412 |
+
var widget_div_id = null;
|
413 |
+
var bind_captainform_widgets = false;
|
414 |
+
if(typeof request.wp_customize != 'undefined' && request.wp_customize == 'on'){
|
415 |
+
bind_captainform_widgets = true;
|
416 |
+
}
|
417 |
+
else{
|
418 |
+
jQuery('.widget').each(function () {
|
419 |
+
if (jQuery(this).attr('id').match(new RegExp(my_widget_id))) {
|
420 |
+
widget_div_id = jQuery(this).attr('id');
|
421 |
+
}
|
422 |
+
});
|
423 |
+
if (widget_div_id != null)
|
424 |
+
bind_captainform_widgets =true;
|
425 |
+
}
|
426 |
+
if(bind_captainform_widgets == true)
|
427 |
+
captainform_bind_widget(widget_div_id);
|
428 |
+
}
|
429 |
+
});
|
430 |
+
|
431 |
+
function captainform_test_valid_image(url, object, timeout) {
|
432 |
+
timeout = timeout || 5000;
|
433 |
+
var timedOut = false, timer;
|
434 |
+
var img = new Image();
|
435 |
+
img.onerror = img.onabort = function () {
|
436 |
+
if (!timedOut) {
|
437 |
+
clearTimeout(timer);
|
438 |
+
jQuery(object).addClass('cf_red_border'); /*error*/
|
439 |
+
}
|
440 |
+
};
|
441 |
+
img.onload = function () {
|
442 |
+
if (!timedOut) {
|
443 |
+
clearTimeout(timer);
|
444 |
+
jQuery(object).removeClass('cf_red_border'); /*success*/
|
445 |
+
}
|
446 |
+
};
|
447 |
+
img.src = url;
|
448 |
+
timer = setTimeout(function () {
|
449 |
+
timedOut = true;
|
450 |
+
jQuery(object).addClass('cf_red_border'); /*timeout*/
|
451 |
+
}, timeout);
|
452 |
+
}
|
admin/js/wp-editor-captainform-media-button.js
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function captainformBindPagePostWidget(url_plugin) {
|
2 |
+
window.captainform_is_widget_page = false;
|
3 |
+
if (typeof jscolor != 'undefined') {
|
4 |
+
jscolor.dir = url_plugin + "/admin/js/jscolor/";
|
5 |
+
captainform_bind_widget();
|
6 |
+
}
|
7 |
+
}
|
8 |
+
|
9 |
+
function captainformInsertShortcode() {
|
10 |
+
var publish_code = document.getElementById('captainform_publish_code').value;
|
11 |
+
var custom_vars = document.getElementById('captainform_custom_vars_code').value;
|
12 |
+
var code = publish_code.substring(0, publish_code.length - 1) + custom_vars + ']';
|
13 |
+
window.send_to_editor(code);
|
14 |
+
tb_remove();
|
15 |
+
}
|
16 |
+
|
17 |
+
function captainformShowThickBox() {
|
18 |
+
tb_show('Insert Form', 'admin-ajax.php?action=captainform_insert_dialog');
|
19 |
+
|
20 |
+
captainform_resize_thickbox(1500);
|
21 |
+
|
22 |
+
if (document.getElementById('TB_window') != null) {
|
23 |
+
var cf_tb_show = document.getElementById('TB_window');
|
24 |
+
cf_tb_show.className += " captainform";
|
25 |
+
|
26 |
+
}
|
27 |
+
if (document.getElementById('TB_ajaxContent') != null) {
|
28 |
+
var cf_tb_show2 = document.getElementById('TB_ajaxContent');
|
29 |
+
cf_tb_show2.className += " captainform";
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
if (document.getElementById('TB_overlay') != null) {
|
34 |
+
var tb_overlay = document.getElementById('TB_overlay');
|
35 |
+
tb_overlay.className += " captainform";
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
function captainformRemoveThickBox() {
|
41 |
+
tb_remove();
|
42 |
+
}
|
43 |
+
|
44 |
+
function captainform_resize_thickbox(intervalTime) {
|
45 |
+
setTimeout(function () {
|
46 |
+
var TB_WIDTH = 600;
|
47 |
+
var TB_HEIGHT = 600;
|
48 |
+
var TB_window = jQuery(document).find('#TB_window.captainform');
|
49 |
+
var windowHeight = jQuery(window).height();
|
50 |
+
|
51 |
+
if (parseInt(TB_window.width()) > 600 && TB_window.height() > 600) {
|
52 |
+
TB_window.width(TB_WIDTH).height(TB_HEIGHT);
|
53 |
+
var marginL = (parseInt(TB_window.width())) / 2;
|
54 |
+
TB_window.css('margin-left', -marginL);
|
55 |
+
|
56 |
+
if (windowHeight > TB_window.height()) {
|
57 |
+
var marginT = (windowHeight - TB_window.height()) / 2;
|
58 |
+
TB_window.css('margin-top', marginT).css('top', 0);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
if (parseInt(TB_window.height()) < 768) {
|
62 |
+
var TB_HEIGHT = 432;
|
63 |
+
|
64 |
+
if (windowHeight > TB_window.height()) {
|
65 |
+
var marginT = (windowHeight - TB_window.height()) / 2;
|
66 |
+
TB_window.css('margin-top', marginT).css('top', 0);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
}, intervalTime || 100);
|
71 |
+
}
|
72 |
+
|
73 |
+
jQuery(window).on('resize', captainform_resize_thickbox);
|
admin/partials/captainform-admin-display.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Provide an admin area view for the plugin
|
5 |
+
*
|
6 |
+
* This file is used to markup the admin-facing aspects of the plugin.
|
7 |
+
*
|
8 |
+
* @link http://captainform.com
|
9 |
+
* @since 2.0.0
|
10 |
+
*
|
11 |
+
* @package Captainform
|
12 |
+
* @subpackage Captainform/admin/partials
|
13 |
+
*/
|
14 |
+
?>
|
15 |
+
<script>
|
16 |
+
var version = '<?php echo $this->version; ?>';
|
17 |
+
var chost = '<?php echo $iframe_domain; ?>';
|
18 |
+
var chostp = '<?php echo $page_protocol . '://' . $iframe_domain; ?>';
|
19 |
+
var parent_site_url = '<?php echo site_url(); ?>';
|
20 |
+
var captainform_plugin_dir = '<?php echo plugins_url('', __DIR__); ?>';
|
21 |
+
</script>
|
22 |
+
<iframe id="captainform_iframe" src="<?php print $iframe_url; ?>"
|
23 |
+
style="width:99%; background: transparent; min-height: 700px;" scrolling="no"></iframe>
|
24 |
+
<?php
|
admin/partials/captainform-admin-plugin-credentials-error.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined('ABSPATH') or die('No direct access!');
|
3 |
+
|
4 |
+
wp_enqueue_style('captainform_credentials_error', plugins_url('/css/credentials_error.css', plugin_dir_path(__FILE__)), false, self::$version);
|
5 |
+
$url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
6 |
+
?>
|
7 |
+
<div id='captainform_credentials_error_wrapper'>
|
8 |
+
<div class="captainform_credentials_error_text">
|
9 |
+
<strong><?php echo __('Hey there! Looks like you have duplicated your site or moved its location. Do you plan to use
|
10 |
+
CaptainForm at the old location anymore?') ?></strong>
|
11 |
+
|
12 |
+
<p>
|
13 |
+
<?php echo __('If you choose Yes, this new website will become a new instance of your CaptainForm account.') ?>
|
14 |
+
<br/>
|
15 |
+
<?php echo __('If you choose No, then your old URL will be overwritten by this new one.') ?>
|
16 |
+
</p>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
|
20 |
+
<div>
|
21 |
+
<form action='//<?php echo $url ?>' method='POST'>
|
22 |
+
<input type='hidden' id='captainform_reset_keys' name='captainform_reset_keys' value=2/>
|
23 |
+
<button class="button button-primary" onclick="document.getElementById('captainform_reset_keys').value=1;">
|
24 |
+
Yes
|
25 |
+
</button>
|
26 |
+
<button class="button button-white"
|
27 |
+
onclick="document.getElementById('captainform_reset_keys').value=0; if (!confirm('Attention! If you are moving your primary website (the one where you first activated a paid license key) or a duplicate of it, CaptainForm will not work at the primary website URL anymore. The website you are currently on will become your new primary website.')) return false;">
|
28 |
+
No
|
29 |
+
</button>
|
30 |
+
</form>
|
31 |
+
</div>
|
32 |
+
</div>
|
admin/partials/captainform-admin-plugin-options.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined('ABSPATH') or die('No direct access!');
|
3 |
+
if (isset($_GET['reset']) && $_GET['reset'] == 'true') {
|
4 |
+
Captainform_Account::generate_new_credentials();
|
5 |
+
?>
|
6 |
+
<script>window.location.href = 'options-general.php?page=CaptainFormOptions'</script>
|
7 |
+
<?php
|
8 |
+
}
|
9 |
+
$installation_id = get_site_option('captainform_installation_id');
|
10 |
+
$installation_key = get_site_option('captainform_installation_key');
|
11 |
+
$site_url = get_site_option('captainform_site_url');
|
12 |
+
ob_start();
|
13 |
+
?>
|
14 |
+
<div class="wrap">
|
15 |
+
<h1><?php echo __('CaptainForm Settings') ?></h1>
|
16 |
+
<h2><?php echo __('Disconnect Account') ?></h2>
|
17 |
+
<div>
|
18 |
+
<div>
|
19 |
+
<p><?php echo __('If you disconnect your CaptainForm account, your website will no longer be associated with it and you will need to activate a new CaptainForm account.', 'capatinform')?></p>
|
20 |
+
<p><?php echo __('Normally, you should not need to disconnect your account. Please do this only when our Support team asks you to do so.')?></p>
|
21 |
+
</div>
|
22 |
+
<table class="form-table">
|
23 |
+
<tr valign="top">
|
24 |
+
<td><?php echo __('Support Key')?></td>
|
25 |
+
<td><code><?php echo $installation_id ?></code></td>
|
26 |
+
</tr>
|
27 |
+
<tr valign="top">
|
28 |
+
<td><?php echo __('Installation ID') ?></td>
|
29 |
+
<td><code><?php echo $installation_key ?></code></td>
|
30 |
+
</tr>
|
31 |
+
<tr valign="top">
|
32 |
+
<td><?php echo __('Site URL') ?></td>
|
33 |
+
<td><code><?php echo $site_url ?></code></td>
|
34 |
+
</tr>
|
35 |
+
<tr valign="top">
|
36 |
+
<td></td>
|
37 |
+
<td>
|
38 |
+
<a onclick="if(!confirm('Are you sure you want to do this? Please hit OK only after talking with our Support team (support@captainform.com).')) return false;"
|
39 |
+
href="options-general.php?page=CaptainFormOptions&reset=true">
|
40 |
+
<button class="button button-primary"><?php echo __('Disconnect Account') ?></button>
|
41 |
+
</a>
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
</table>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
<?php
|
48 |
+
echo ob_get_clean();
|
admin/partials/captainform-admin-publish-options.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="cf_lightbox_cotainer">
|
2 |
+
<label class="lightbox_trigger">
|
3 |
+
<input type="checkbox" name="<?php echo $captainform_display_as_lightbox_name; ?>"
|
4 |
+
class="cf_display_as_lightbox"
|
5 |
+
value="1" <?php if (isset($display_as_lightbox) && ($display_as_lightbox == 1)): ?> checked="checked"<?php endif; ?>/>
|
6 |
+
<span class="lightbox_trigger_text">
|
7 |
+
<?php echo __('Display as a popup', 'captainform'); ?>
|
8 |
+
</span>
|
9 |
+
</label>
|
10 |
+
<label class="customvars_trigger">
|
11 |
+
<input type="checkbox" name="<?php echo $captainform_use_custom_vars_name; ?>"
|
12 |
+
class="cf_use_custom_vars"
|
13 |
+
value="1" <?php if (isset($use_custom_vars) && ($use_custom_vars == 1)): ?> checked="checked"<?php endif; ?>/>
|
14 |
+
<span class="customvars_trigger_text">
|
15 |
+
<?php echo __('Prefill form fields', 'captainform'); ?>
|
16 |
+
|
17 |
+
</span>
|
18 |
+
<div id="captainform-info-prefil" >
|
19 |
+
<img class="captainform-info-prefil123" src="<?=plugin_dir_url(plugin_dir_path(__FILE__))?>/images/info_alert.png">
|
20 |
+
|
21 |
+
<div class="powerTip_prefil">
|
22 |
+
<p>Prefilled form fields do not work yet with forms published in popups.</p>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
</label>
|
26 |
+
|
27 |
+
<div class="cf_triggers_container">
|
28 |
+
<div class="cf_lightbox_title">
|
29 |
+
<b><?php echo __('Popup trigger', 'captainform'); ?></b>
|
30 |
+
</div>
|
31 |
+
<div class="row">
|
32 |
+
<div class="cf_trigger_option">
|
33 |
+
<label>
|
34 |
+
<input type="radio"
|
35 |
+
name="<?php echo $captainform_trigger_option_name; ?>" <?php if ($captainform_selected_trigger == 0): ?> checked="checked" <?php endif; ?>
|
36 |
+
class="cf_trigger" value="0"/>
|
37 |
+
<?php echo __('Text', 'captainform'); ?>
|
38 |
+
</label>
|
39 |
+
</div>
|
40 |
+
<div class="cf_trigger_option">
|
41 |
+
<label>
|
42 |
+
<input type="radio" name="<?php echo $captainform_trigger_option_name; ?>"
|
43 |
+
class="cf_trigger" <?php if ($captainform_selected_trigger == 1): ?> checked="checked" <?php endif; ?>
|
44 |
+
value="1"/>
|
45 |
+
<?php echo __('Click on image', 'captainform'); ?>
|
46 |
+
</label>
|
47 |
+
</div>
|
48 |
+
<div class="cf_trigger_option">
|
49 |
+
<label>
|
50 |
+
<input type="radio" name="<?php echo $captainform_trigger_option_name; ?>"
|
51 |
+
class="cf_trigger" <?php if ($captainform_selected_trigger == 2): ?> checked="checked" <?php endif; ?>
|
52 |
+
value="2"/>
|
53 |
+
<?php echo __('Floating button', 'captainform'); ?>
|
54 |
+
</label>
|
55 |
+
</div>
|
56 |
+
<div class="cf_trigger_option">
|
57 |
+
<label>
|
58 |
+
<input type="radio" name="<?php echo $captainform_trigger_option_name; ?>"
|
59 |
+
class="cf_trigger" <?php if ($captainform_selected_trigger == 3): ?> checked="checked" <?php endif; ?>
|
60 |
+
value="3"/>
|
61 |
+
<?php echo __('Auto popup', 'captainform'); ?>
|
62 |
+
</label>
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
<div class="cf_trigger_selected_option_container_big">
|
66 |
+
<div class="cf_trigger_selected_option_title">
|
67 |
+
<?php echo __('Popup settings', 'captainform'); ?>
|
68 |
+
</div>
|
69 |
+
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_0">
|
70 |
+
<!-- text -->
|
71 |
+
<div class="left">
|
72 |
+
<span class="label">
|
73 |
+
<?php echo __('Text:', 'captainform'); ?>
|
74 |
+
</span>
|
75 |
+
</div>
|
76 |
+
<div class="right">
|
77 |
+
<input type="text" name="<?php echo $captainform_trigger_0_name; ?>"
|
78 |
+
class="cf_trigger_selected_option cf_trigger_0_text"
|
79 |
+
value="<?php echo $captainform_trigger_0_text; ?>"/>
|
80 |
+
</div>
|
81 |
+
<div class="clear"></div>
|
82 |
+
</div>
|
83 |
+
<div class="clear"></div>
|
84 |
+
|
85 |
+
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_1">
|
86 |
+
<!-- image -->
|
87 |
+
<div class="left">
|
88 |
+
<span class="label">
|
89 |
+
<?php echo __('Image:', 'captainform'); ?>
|
90 |
+
</span>
|
91 |
+
</div>
|
92 |
+
<div class="right">
|
93 |
+
<input type="text" name="<?php echo $captainform_trigger_1_name; ?>" class="cf_trigger_1_url"
|
94 |
+
value="<?php echo $captainform_trigger_1_url; ?>"/>
|
95 |
+
</div>
|
96 |
+
<div class="clear"></div>
|
97 |
+
</div>
|
98 |
+
<div class="clear"></div>
|
99 |
+
|
100 |
+
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_2">
|
101 |
+
<!-- floating button -->
|
102 |
+
<div class="left">
|
103 |
+
<span class="label">
|
104 |
+
<?php echo __('Text:', 'captainform'); ?>
|
105 |
+
</span>
|
106 |
+
</div>
|
107 |
+
<div class="right">
|
108 |
+
<input type="text" name="<?php echo $captainform_trigger_2_text_name; ?>" class="cf_trigger_2_text"
|
109 |
+
value="<?php echo $captainform_trigger_2_text; ?>"/>
|
110 |
+
</div>
|
111 |
+
<div class="clear"></div>
|
112 |
+
|
113 |
+
<div class="left">
|
114 |
+
<span class="label">
|
115 |
+
<?php echo __('Position:', 'captainform'); ?>
|
116 |
+
</span>
|
117 |
+
</div>
|
118 |
+
<div class="cf_trigger_2_container right">
|
119 |
+
<label class="cf_trigger_2_label">
|
120 |
+
<input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>"
|
121 |
+
class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 1): ?> checked="checked" <?php endif; ?>
|
122 |
+
value="1"/>
|
123 |
+
<?php echo __('Left', 'captainform'); ?>
|
124 |
+
</label>
|
125 |
+
<label class="cf_trigger_2_label">
|
126 |
+
<input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>"
|
127 |
+
class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 2): ?> checked="checked" <?php endif; ?>
|
128 |
+
value="2"/>
|
129 |
+
<?php echo __('Right', 'captainform'); ?>
|
130 |
+
</label>
|
131 |
+
<label class="cf_trigger_2_label">
|
132 |
+
<input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>"
|
133 |
+
class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 3): ?> checked="checked" <?php endif; ?>
|
134 |
+
value="3"/>
|
135 |
+
<?php echo __('Bottom', 'captainform'); ?>
|
136 |
+
</label>
|
137 |
+
</div>
|
138 |
+
<div class="clear"></div>
|
139 |
+
|
140 |
+
<div class="left">
|
141 |
+
<span class="label">
|
142 |
+
<?php echo __('Background color:', 'captainform'); ?>
|
143 |
+
</span>
|
144 |
+
</div>
|
145 |
+
<div class="right">
|
146 |
+
<input type="text" name="<?php echo $captainform_trigger_2_background_name; ?>"
|
147 |
+
class="color color-captainform cf_trigger_2_background_color"
|
148 |
+
value="<?php echo $captainform_trigger_2_background; ?>"/>
|
149 |
+
</div>
|
150 |
+
<div class="clear"></div>
|
151 |
+
|
152 |
+
<div class="left">
|
153 |
+
<span class="label">
|
154 |
+
<?php echo __('Text color:', 'captainform'); ?>
|
155 |
+
</span>
|
156 |
+
</div>
|
157 |
+
<div class="right">
|
158 |
+
<input type="text" name="<?php echo $captainform_trigger_2_color_name; ?>"
|
159 |
+
class="color color-captainform cf_trigger_2_color" value="<?php echo $captainform_trigger_2_color; ?>"/>
|
160 |
+
</div>
|
161 |
+
<div class="clear"></div>
|
162 |
+
</div>
|
163 |
+
<div class="clear"></div>
|
164 |
+
|
165 |
+
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_3">
|
166 |
+
<!-- auto popup -->
|
167 |
+
<div class="cf_auto_popup_trigger_option">
|
168 |
+
<div>
|
169 |
+
<label>
|
170 |
+
<input
|
171 |
+
type="radio"
|
172 |
+
name="<?php echo $captainform_auto_popup_trigger_option_name; ?>"
|
173 |
+
class="captainform_auto_popup_trigger"
|
174 |
+
<?php if ($captainform_auto_popup_selected_trigger == 1): ?> checked="checked" <?php endif; ?>
|
175 |
+
value="1"
|
176 |
+
/>
|
177 |
+
<?php echo __('After', 'captainform'); ?>
|
178 |
+
<input
|
179 |
+
type="text"
|
180 |
+
name="<?php echo $captainform_trigger_3_after_name; ?>"
|
181 |
+
class="cf_trigger_selected_option cf_trigger_2_time"
|
182 |
+
value="<?php echo $captainform_trigger_3_after; ?>"
|
183 |
+
/>
|
184 |
+
<?php echo __('seconds', 'captainform'); ?>
|
185 |
+
</label>
|
186 |
+
</div>
|
187 |
+
<div>
|
188 |
+
<label>
|
189 |
+
<input
|
190 |
+
type="radio"
|
191 |
+
name="<?php echo $captainform_auto_popup_trigger_option_name; ?>"
|
192 |
+
class="captainform_auto_popup_trigger"
|
193 |
+
<?php if ($captainform_auto_popup_selected_trigger == 2): ?> checked="checked" <?php endif; ?>
|
194 |
+
value="2"/>
|
195 |
+
<?php echo __('When user leaves page', 'captainform'); ?>
|
196 |
+
</label>
|
197 |
+
</div>
|
198 |
+
</div>
|
199 |
+
</div>
|
200 |
+
<div class="clear"></div>
|
201 |
+
</div>
|
202 |
+
|
203 |
+
</div>
|
204 |
+
|
205 |
+
<div class="use_custom_vars_container">
|
206 |
+
<div class="cf_lightbox_title">
|
207 |
+
<?php echo __('Prefill form fields');?>
|
208 |
+
</div>
|
209 |
+
<div class="custom_vars_draw">
|
210 |
+
|
211 |
+
</div>
|
212 |
+
|
213 |
+
</div>
|
214 |
+
</div>
|
captainform.php
CHANGED
@@ -1,37 +1,87 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
*
|
14 |
-
*
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
*
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The plugin bootstrap file
|
5 |
+
*
|
6 |
+
* This file is read by WordPress to generate the plugin information in the plugin
|
7 |
+
* admin area. This file also includes all of the dependencies used by the plugin,
|
8 |
+
* registers the activation and deactivation functions, and defines a function
|
9 |
+
* that starts the plugin.
|
10 |
+
*
|
11 |
+
* @link http://captainform.com
|
12 |
+
* @since 2.0.0
|
13 |
+
* @package Captainform
|
14 |
+
*
|
15 |
+
* @wordpress-plugin
|
16 |
+
* Plugin Name: CaptainForm
|
17 |
+
* Plugin URI: http://captainform.com
|
18 |
+
* Description: CaptainForm is a fully-featured WordPress form plugin created for web designers, developers, and also for non-tech savvy users.
|
19 |
+
* Version: 2.2.6
|
20 |
+
* Author: captainform
|
21 |
+
* Author URI: https://profiles.wordpress.org/captainform
|
22 |
+
* License: GPL-2.0+
|
23 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
24 |
+
* Text Domain: captainform
|
25 |
+
* Domain Path: /languages
|
26 |
+
*/
|
27 |
+
|
28 |
+
// If this file is called directly, abort.
|
29 |
+
if ( ! defined( 'WPINC' ) ) {
|
30 |
+
die;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The code that runs during plugin activation.
|
35 |
+
* This action is documented in includes/class-captainform-activator.php
|
36 |
+
*/
|
37 |
+
function activate_captainform() {
|
38 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-captainform-activator.php';
|
39 |
+
Captainform_Activator::activate();
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* The code that runs during plugin deactivation.
|
44 |
+
* This action is documented in includes/class-captainform-deactivator.php
|
45 |
+
*/
|
46 |
+
function deactivate_captainform() {
|
47 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-captainform-deactivator.php';
|
48 |
+
Captainform_Deactivator::deactivate();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The code that runs during plugin uninstall.
|
53 |
+
*/
|
54 |
+
function uninstall_captainform() {
|
55 |
+
}
|
56 |
+
|
57 |
+
register_activation_hook( __FILE__, 'activate_captainform' );
|
58 |
+
register_deactivation_hook( __FILE__, 'deactivate_captainform' );
|
59 |
+
register_uninstall_hook(__FILE__, 'uninstall_captainform');
|
60 |
+
|
61 |
+
/**
|
62 |
+
* The core plugin class that is used to define internationalization,
|
63 |
+
* admin-specific hooks, and public-facing site hooks.
|
64 |
+
*/
|
65 |
+
require plugin_dir_path( __FILE__ ) . 'includes/class-captainform.php';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* The file that contains the function call for the plugin
|
69 |
+
*/
|
70 |
+
require plugin_dir_path( __FILE__ ) . 'includes/captainform-function-call.php';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Begins execution of the plugin.
|
74 |
+
*
|
75 |
+
* Since everything within the plugin is registered via hooks,
|
76 |
+
* then kicking off the plugin from this point in the file does
|
77 |
+
* not affect the page life cycle.
|
78 |
+
*
|
79 |
+
* @since 2.0.0
|
80 |
+
*/
|
81 |
+
function run_captainform() {
|
82 |
+
|
83 |
+
$plugin = new Captainform();
|
84 |
+
$plugin->run();
|
85 |
+
|
86 |
+
}
|
87 |
+
run_captainform();
|
dialog/editor_plugin.js
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
(function () {
|
2 |
-
tinymce.create('tinymce.plugins.captainform', {
|
3 |
-
init: function (editor, url) {
|
4 |
-
|
5 |
-
var root_url = url.replace("/captainform/dialog", "/captainform");
|
6 |
-
editor.addButton('captainform', {
|
7 |
-
image: root_url + "/includes/images/captainform-18.png",
|
8 |
-
tooltip: 'Insert Form',
|
9 |
-
cmd: 'captainform_insert'
|
10 |
-
});
|
11 |
-
|
12 |
-
editor.addCommand('captainform_insert', function () {
|
13 |
-
// Calls the pop-up modal
|
14 |
-
editor.windowManager.open({
|
15 |
-
action: 'captainform_insert_dialog',
|
16 |
-
title: 'Insert Form',
|
17 |
-
width: (jQuery(window).width() * 0.7) < 600 ? jQuery(window).width() * 0.7 : 600,
|
18 |
-
// minus head and foot of dialog box
|
19 |
-
height: ((jQuery(window).height() - 36 - 50) * 0.7) < 365 ? (jQuery(window).height() - 36 - 50) * 0.7 : 365,
|
20 |
-
resizable: true,
|
21 |
-
inline: 1,
|
22 |
-
scrollbars: 'x',
|
23 |
-
id: 'captainform-insert-dialog',
|
24 |
-
buttons: [{
|
25 |
-
text: 'Insert form',
|
26 |
-
id: 'captainform-button-insert',
|
27 |
-
class: 'captainform-insert',
|
28 |
-
onclick: function (e) {
|
29 |
-
insertShortcode();
|
30 |
-
editor.windowManager.close();
|
31 |
-
},
|
32 |
-
},
|
33 |
-
{
|
34 |
-
text: 'Cancel',
|
35 |
-
id: 'captainform-button-cancel',
|
36 |
-
onclick: 'close'
|
37 |
-
}],
|
38 |
-
});
|
39 |
-
appendInsertDialog(root_url);
|
40 |
-
});
|
41 |
-
},
|
42 |
-
getInfo : function() {
|
43 |
-
return {
|
44 |
-
longname : 'CaptainForm for Wordpress plugin',
|
45 |
-
author : 'Captain Form',
|
46 |
-
authorurl : 'http://www.captainform.com',
|
47 |
-
infourl : '',
|
48 |
-
version : "1.2.0"
|
49 |
-
};
|
50 |
-
}
|
51 |
-
|
52 |
-
});
|
53 |
-
|
54 |
-
tinymce.PluginManager.add('captainform', tinymce.plugins.captainform);
|
55 |
-
|
56 |
-
function insertShortcode() {
|
57 |
-
var code = document.getElementById('captainform_publish_code').value;
|
58 |
-
top.window.tinyMCE.execCommand('mceInsertContent', false, code);
|
59 |
-
}
|
60 |
-
function appendInsertDialog(root_url) {
|
61 |
-
var captainformDialogBody;
|
62 |
-
captainformDialogBody = jQuery('#captainform-insert-dialog-body');
|
63 |
-
|
64 |
-
captainformDialogBody.append('<link rel="stylesheet" type="text/css" href="'+root_url+'/includes/css/chosen/chosen.css" />');
|
65 |
-
captainformDialogBody.append('<link rel="stylesheet" type="text/css" href="'+root_url+'/includes/css/widget.css" />');
|
66 |
-
captainformDialogBody.append('<link rel="stylesheet" type="text/css" href="'+root_url+'/includes/css/publish_lightbox_posts.css" />');
|
67 |
-
|
68 |
-
captainformDialogBody.append('<span class="captainform_spinner">Loading, please wait...</span>');
|
69 |
-
// Get the form template from WordPress
|
70 |
-
var ajax_url = captainform_get_absolute_path() + 'admin-ajax.php';
|
71 |
-
jQuery.post(ajax_url, {
|
72 |
-
action: 'captainform_insert_dialog'
|
73 |
-
}, function (response) {
|
74 |
-
window.captainform_is_widget_page = false;
|
75 |
-
captainformDialogBody.children('.captainform_spinner').remove();
|
76 |
-
captainformDialogBody.append(response);
|
77 |
-
}).done(function () {
|
78 |
-
if (typeof jscolor != 'undefined') {
|
79 |
-
jscolor.dir = root_url + "/includes/js/jscolor/";
|
80 |
-
captainform_bind_widget();
|
81 |
-
}
|
82 |
-
});
|
83 |
-
}
|
84 |
-
})();
|
85 |
-
|
86 |
-
function captainform_get_absolute_path() {
|
87 |
-
var loc = window.location;
|
88 |
-
var pathName = loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1);
|
89 |
-
return loc.href.substring(0, loc.href.length - ((loc.pathname + loc.search + loc.hash).length - pathName.length));
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/CaptainFormWidget.php
DELETED
@@ -1,206 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
if (!class_exists('CaptainFormWidget')) {
|
4 |
-
|
5 |
-
class CaptainFormWidget extends WP_Widget
|
6 |
-
{
|
7 |
-
private $publish_type = 'widget';
|
8 |
-
private static $widget_count = 0;
|
9 |
-
|
10 |
-
function __construct()
|
11 |
-
{
|
12 |
-
parent::__construct(
|
13 |
-
false,
|
14 |
-
// name of the widget
|
15 |
-
__('CaptainForm', 'captainform'),
|
16 |
-
// widget options
|
17 |
-
array(
|
18 |
-
'description' => __('Add a form to the sidebar', 'captainform')
|
19 |
-
)
|
20 |
-
);
|
21 |
-
if (is_admin()) {
|
22 |
-
add_action('admin_print_scripts-widgets.php', 'captainform_widget_css');
|
23 |
-
add_action('admin_print_scripts-widgets.php', 'captainform_widget_js');
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
function form($instance)
|
28 |
-
{
|
29 |
-
$embeded_form = isset($instance['captainform_form_id']) ? esc_attr($instance['captainform_form_id']) : '';
|
30 |
-
$response = captainform_get_forms($this->publish_type, ++self::$widget_count);
|
31 |
-
|
32 |
-
$captainform_display_as_lightbox_name = $this->get_field_name('captainform_display_as_lightbox');
|
33 |
-
$captainform_trigger_option_name = $this->get_field_name('captainform_selected_trigger');
|
34 |
-
$captainform_lightbox_publish_code_name = $this->get_field_name('captainform_lightbox_publish_code');
|
35 |
-
|
36 |
-
//Text
|
37 |
-
$captainform_trigger_0_name = $this->get_field_name('captainform_trigger_0_text');
|
38 |
-
$captainform_trigger_0_text = (isset($instance['captainform_trigger_0_text']) ? esc_attr($instance['captainform_trigger_0_text']) : "Contact us");
|
39 |
-
|
40 |
-
//click on image
|
41 |
-
$captainform_trigger_1_name = $this->get_field_name('captainform_trigger_1_url');
|
42 |
-
$captainform_trigger_1_url = isset($instance['captainform_trigger_1_url']) ? esc_attr($instance['captainform_trigger_1_url']) : '';
|
43 |
-
if ($captainform_trigger_1_url == "")
|
44 |
-
$captainform_trigger_1_url = plugins_url('/includes/images/publish_lighbox_default_image_v2.png', dirname(__FILE__));
|
45 |
-
|
46 |
-
//floating button
|
47 |
-
$captainform_trigger_2_text_name = $this->get_field_name('captainform_trigger_2_text');
|
48 |
-
$captainform_trigger_2_text = (isset($instance['captainform_trigger_2_text']) ? esc_attr($instance['captainform_trigger_2_text']) : "Contact us");
|
49 |
-
$captainform_trigger_2_position_name = $this->get_field_name('captainform_trigger_2_position');
|
50 |
-
$captainform_trigger_2_position = (isset($instance['captainform_trigger_2_position']) ? ($instance['captainform_trigger_2_position'] != '' ? esc_attr($instance['captainform_trigger_2_position']) : 1) : 1);
|
51 |
-
$captainform_trigger_2_background_name = $this->get_field_name('captainform_trigger_2_background');
|
52 |
-
$captainform_trigger_2_background = (isset($instance['captainform_trigger_2_background']) ? esc_attr($instance['captainform_trigger_2_background']) : '');
|
53 |
-
if ($captainform_trigger_2_background == '')
|
54 |
-
$captainform_trigger_2_background = "FF0000";
|
55 |
-
$captainform_trigger_2_color_name = $this->get_field_name('captainform_trigger_2_color');
|
56 |
-
$captainform_trigger_2_color = (isset($instance['captainform_trigger_2_color']) ? esc_attr($instance['captainform_trigger_2_color']) : '');
|
57 |
-
if ($captainform_trigger_2_color == '')
|
58 |
-
$captainform_trigger_2_color = "FFFFFF";
|
59 |
-
|
60 |
-
//Auto popup
|
61 |
-
$captainform_trigger_3_after_name = $this->get_field_name('captainform_trigger_3_after');
|
62 |
-
$captainform_trigger_3_after = (isset($instance['captainform_trigger_3_after']) ? esc_attr($instance['captainform_trigger_3_after']) : 5);
|
63 |
-
|
64 |
-
$captainform_publish_code_value = isset($instance['captainform_lightbox_publish_code']) ? esc_attr($instance['captainform_lightbox_publish_code']) : '';
|
65 |
-
$display_as_lightbox = (isset($instance['captainform_display_as_lightbox']) ? esc_attr($instance['captainform_display_as_lightbox']) : 3);
|
66 |
-
$captainform_selected_trigger = (isset($instance['captainform_selected_trigger']) && $display_as_lightbox == 1 ? esc_attr($instance['captainform_selected_trigger']) : 3);
|
67 |
-
|
68 |
-
if ($response->status == 'ok') {
|
69 |
-
// markup for form
|
70 |
-
?>
|
71 |
-
<div class="captainform_widget_container">
|
72 |
-
<p>
|
73 |
-
<label for="<?php echo $this->get_field_id('captainform_form_id'); ?>">
|
74 |
-
Select the form you want to embed:
|
75 |
-
</label>
|
76 |
-
</p>
|
77 |
-
<div>
|
78 |
-
<select name="<?php echo $this->get_field_name('captainform_form_id'); ?>"
|
79 |
-
class="captainform_widget_select"
|
80 |
-
id="<?php echo $this->get_field_id('captainform_form_id'); ?>">
|
81 |
-
<?php foreach ($response->forms as $form): ?>
|
82 |
-
<option
|
83 |
-
value="<?php echo $form->f_id; ?>" <?php echo ($form->f_id == $embeded_form) ? 'selected' : '' ?> >
|
84 |
-
<?php echo $form->f_name; ?>
|
85 |
-
</option>
|
86 |
-
<?php endforeach; ?>
|
87 |
-
</select>
|
88 |
-
</div>
|
89 |
-
<?php
|
90 |
-
require(plugin_dir_path(dirname(__FILE__)) . 'views/publish_lightbox.php');
|
91 |
-
?>
|
92 |
-
<input type="hidden" name="<?php echo $captainform_lightbox_publish_code_name; ?>"
|
93 |
-
class='cf_generated_code' value="<?php echo $captainform_publish_code_value; ?>"/>
|
94 |
-
</div>
|
95 |
-
<?php
|
96 |
-
} else {
|
97 |
-
?>
|
98 |
-
<div class="error_message_container">
|
99 |
-
<?php
|
100 |
-
if ($response->error_message) {
|
101 |
-
if (isset($response->error_code) && $response->error_code == 2) {
|
102 |
-
echo sprintf("%sCreate a form%s and return here to publish it in your sidebar.", '<a href="admin.php?page=CaptainForm-NewForm">', "</a>");
|
103 |
-
} elseif (isset($response->error_code) && $response->error_code == 1) {
|
104 |
-
echo sprintf("Please activate your account first! Go to the CaptainForm tab and enter your license key or activate your free account. %sCreate a form%s and return here to publish it.", '<a href="admin.php?page=CaptainForm-NewForm">', "</a>");
|
105 |
-
} else
|
106 |
-
echo $response->error_message;
|
107 |
-
} else
|
108 |
-
echo 'Fatal error - ' . $response->status;
|
109 |
-
?>
|
110 |
-
</div>
|
111 |
-
<?php
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
function update($new_instance, $old_instance)
|
116 |
-
{
|
117 |
-
$instance = $old_instance;
|
118 |
-
$instance['captainform_form_id'] = intval($new_instance['captainform_form_id']);
|
119 |
-
$display_as_lightbox = intval($new_instance['captainform_display_as_lightbox']);
|
120 |
-
$instance['captainform_display_as_lightbox'] = $display_as_lightbox;
|
121 |
-
$instance['captainform_selected_trigger'] = ($display_as_lightbox == 1 ? intval($new_instance['captainform_selected_trigger']) : 0);
|
122 |
-
$instance['captainform_trigger_0_text'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_0_text'] : '');
|
123 |
-
$instance['captainform_trigger_1_url'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_1_url'] : '');
|
124 |
-
$instance['captainform_trigger_2_text'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_text'] : '');
|
125 |
-
$instance['captainform_trigger_2_position'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_position'] : '');
|
126 |
-
$instance['captainform_trigger_2_background'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_background'] : '');
|
127 |
-
$instance['captainform_trigger_2_color'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_color'] : '');
|
128 |
-
$instance['captainform_trigger_3_after'] = ($display_as_lightbox == 1 ? (intval($new_instance['captainform_trigger_3_after']) > 0 ? intval($new_instance['captainform_trigger_3_after']) : 3) : 3);
|
129 |
-
$instance['captainform_lightbox_publish_code'] = $new_instance['captainform_lightbox_publish_code'];
|
130 |
-
return $instance;
|
131 |
-
}
|
132 |
-
|
133 |
-
function widget($args, $instance)
|
134 |
-
{
|
135 |
-
extract($args);
|
136 |
-
global $post;
|
137 |
-
$shortcode = '[captainform id="' . $instance['captainform_form_id'] . '"]';
|
138 |
-
if (isset($instance['captainform_lightbox_publish_code']) && $instance['captainform_lightbox_publish_code'] != '')
|
139 |
-
$shortcode = $instance['captainform_lightbox_publish_code'];
|
140 |
-
|
141 |
-
$is_lightbox_pattern = '/\[[^\[]*captain-?form.*lightbox=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
142 |
-
$is_lighbox = preg_match($is_lightbox_pattern, $shortcode) ? true : false;
|
143 |
-
|
144 |
-
$type_pattern = '/\[[^\[]*captain-?form.*type=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
145 |
-
preg_match($type_pattern, $shortcode, $matches_type);
|
146 |
-
$shortcode_option_type = isset($matches_type[1]) ? $matches_type[1] : null;
|
147 |
-
|
148 |
-
$show_widget_area = ($is_lighbox && in_array($shortcode_option_type, array('floating-button', 'auto-popup'))) ? false : true;
|
149 |
-
|
150 |
-
if ($show_widget_area) {
|
151 |
-
echo $before_widget;
|
152 |
-
echo $before_title . $after_title;
|
153 |
-
}
|
154 |
-
|
155 |
-
echo captainform_widget_text_filter($shortcode);
|
156 |
-
|
157 |
-
wp_reset_query();
|
158 |
-
|
159 |
-
if ($show_widget_area)
|
160 |
-
echo $after_widget;
|
161 |
-
}
|
162 |
-
|
163 |
-
}
|
164 |
-
|
165 |
-
}
|
166 |
-
|
167 |
-
function captainform_register_forms_widget()
|
168 |
-
{
|
169 |
-
register_widget('CaptainFormWidget');
|
170 |
-
}
|
171 |
-
|
172 |
-
$php_version = phpversion();
|
173 |
-
if ($php_version >= 5.3) {
|
174 |
-
add_action('widgets_init', 'captainform_register_forms_widget');
|
175 |
-
} else if ($php_version >= 5.2) {
|
176 |
-
add_action('widgets_init',
|
177 |
-
create_function('', 'return register_widget("CaptainFormWidget");')
|
178 |
-
);
|
179 |
-
}
|
180 |
-
|
181 |
-
function captainform_widget_text_filter($content)
|
182 |
-
{
|
183 |
-
$content = captainform_text_filter($content);
|
184 |
-
return $content;
|
185 |
-
}
|
186 |
-
|
187 |
-
add_filter('widget_text', 'captainform_widget_text_filter', 1);
|
188 |
-
|
189 |
-
/* resources */
|
190 |
-
|
191 |
-
function captainform_widget_css()
|
192 |
-
{
|
193 |
-
wp_enqueue_style('cf-widget-css', plugins_url('/css/widget.css', __FILE__), false, false);
|
194 |
-
wp_enqueue_style('cf-chosen-css', plugins_url('/css/chosen/chosen.css', __FILE__), false, false);
|
195 |
-
}
|
196 |
-
|
197 |
-
function captainform_widget_js()
|
198 |
-
{
|
199 |
-
wp_register_script('cf_color_picker_js', plugins_url('/js/jscolor/jscolor.js', __FILE__), array('jquery'), false, true);
|
200 |
-
wp_register_script('cf_widget_js', plugins_url('/js/widget.js', __FILE__), array('cf_color_picker_js'), false, true);
|
201 |
-
wp_register_script('cf_chosen_js', plugins_url('/js/chosen.jquery.js', __FILE__), array('cf_widget_js'), false, false);
|
202 |
-
wp_enqueue_script('jquery');
|
203 |
-
wp_enqueue_script('cf_color_picker_js');
|
204 |
-
wp_enqueue_script('cf_chosen_js');
|
205 |
-
wp_enqueue_script('cf_widget_js');
|
206 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin-page.php
DELETED
@@ -1,387 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
|
4 |
-
function captainform_generate_installation_id()
|
5 |
-
{
|
6 |
-
// we generate an installationId with maximum length of 58, because the space in DB is 60
|
7 |
-
// and we prepend -- for the email
|
8 |
-
$alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
9 |
-
|
10 |
-
$admin_email = get_site_option("admin_email");
|
11 |
-
$timestamp = dechex(time());
|
12 |
-
|
13 |
-
$neededChars = 13 - strlen($timestamp);
|
14 |
-
$rand = substr(str_shuffle($alphanum), 0, $neededChars);
|
15 |
-
|
16 |
-
$computedId = $timestamp . $rand . "." . $admin_email;
|
17 |
-
|
18 |
-
if (strlen($computedId) >= 58)
|
19 |
-
$computedId = substr($computedId, -58);
|
20 |
-
return $computedId;
|
21 |
-
}
|
22 |
-
|
23 |
-
function captainform_generate_installation_key()
|
24 |
-
{
|
25 |
-
$alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
26 |
-
$installation_key = md5(substr(str_shuffle($alphanum), 0, 15));
|
27 |
-
return $installation_key;
|
28 |
-
}
|
29 |
-
|
30 |
-
function captainform_update_website_url(){
|
31 |
-
update_site_option($GLOBALS['captainform_option3'], get_site_option("siteurl"));
|
32 |
-
}
|
33 |
-
|
34 |
-
function captainform_generate_new_credentials()
|
35 |
-
{
|
36 |
-
$installation_id = captainform_generate_installation_id();
|
37 |
-
update_site_option($GLOBALS['captainform_option1'], $installation_id);
|
38 |
-
|
39 |
-
$installation_key = captainform_generate_installation_key();
|
40 |
-
update_site_option($GLOBALS['captainform_option2'], $installation_key);
|
41 |
-
|
42 |
-
captainform_update_website_url();
|
43 |
-
}
|
44 |
-
|
45 |
-
function captainform_get_site_type()
|
46 |
-
{
|
47 |
-
return is_multisite();
|
48 |
-
}
|
49 |
-
|
50 |
-
function captainform_get_ref_param()
|
51 |
-
{
|
52 |
-
$plugin_referer = '';
|
53 |
-
$myref = (__DIR__) . '/referer.php';
|
54 |
-
if (file_exists($myref)) {
|
55 |
-
require_once($myref);
|
56 |
-
$plugin_referer = '&plugin_referer=' . $captainform_referer;
|
57 |
-
}
|
58 |
-
return $plugin_referer;
|
59 |
-
}
|
60 |
-
|
61 |
-
function check_credentials_error(){
|
62 |
-
$site_url = get_site_option($GLOBALS['captainform_option3']);
|
63 |
-
$site = get_site_option("siteurl");
|
64 |
-
|
65 |
-
if(!empty($site_url) && $site_url != $site)
|
66 |
-
{
|
67 |
-
if(isset($_POST['captainform_reset_keys']))
|
68 |
-
{
|
69 |
-
if(intval($_POST['captainform_reset_keys']) == 1)
|
70 |
-
captainform_generate_new_credentials();
|
71 |
-
else
|
72 |
-
{
|
73 |
-
captainform_update_website_url();
|
74 |
-
return $site;
|
75 |
-
}
|
76 |
-
return true;
|
77 |
-
}
|
78 |
-
captainform_draw_credentials_error();
|
79 |
-
return false;
|
80 |
-
}
|
81 |
-
return true;
|
82 |
-
}
|
83 |
-
|
84 |
-
function captainform_page_handler()
|
85 |
-
{
|
86 |
-
global $captainform_plugin_version;
|
87 |
-
|
88 |
-
$credentials_check = check_credentials_error();
|
89 |
-
if (!$credentials_check) return false;
|
90 |
-
|
91 |
-
$installation_id = get_site_option($GLOBALS['captainform_option1']);
|
92 |
-
$installation_key = get_site_option($GLOBALS['captainform_option2']);
|
93 |
-
$site = get_site_option("siteurl");
|
94 |
-
$site_real = get_option("siteurl");
|
95 |
-
|
96 |
-
$current_user = wp_get_current_user();
|
97 |
-
$display_name = $current_user->data->display_name;
|
98 |
-
$page = $_GET['page'];
|
99 |
-
$wp_protocol = parse_url(site_url(), 0);
|
100 |
-
$wp_subid = "wp-" . str_replace('.' . get_site_option("admin_email"), "", $installation_id);
|
101 |
-
$wp_subid = explode('.', $wp_subid);
|
102 |
-
$wp_subid = $wp_subid[0];
|
103 |
-
|
104 |
-
$wp_seturl = $wp_protocol . "://" . $wp_subid . "." . $GLOBALS['captainform_servicedomain'];
|
105 |
-
|
106 |
-
$wp_seturl = strtolower($wp_seturl);
|
107 |
-
$url = $wp_seturl . "/fh-connect.php?inst=" . captainform_wpp_encrypt($installation_id) .
|
108 |
-
"&key=" . captainform_wpp_encrypt($installation_key) .
|
109 |
-
"&site=" . captainform_wpp_encrypt($site) .
|
110 |
-
"&site_real=" . captainform_wpp_encrypt($site_real) .
|
111 |
-
"&display_name=" . captainform_wpp_encrypt($display_name) .
|
112 |
-
"&page=" . $page .
|
113 |
-
"&is_multisite=" . var_export(captainform_get_site_type(), true) .
|
114 |
-
captainform_get_ref_param() .
|
115 |
-
"&wp_version=" . captainform_wpp_encrypt($captainform_plugin_version) .
|
116 |
-
"&wp_php=" . captainform_wpp_encrypt(phpversion());
|
117 |
-
|
118 |
-
if(gettype($credentials_check) == 'string')
|
119 |
-
$url .= '&wp_url_changed=true';
|
120 |
-
|
121 |
-
switch ($page) {
|
122 |
-
case "CaptainForm":
|
123 |
-
case 'CaptainForm-NewForm':
|
124 |
-
case 'CaptainForm-MyAccount':
|
125 |
-
case 'CaptainForm-ChangePlan':
|
126 |
-
case 'CaptainForm-Support':
|
127 |
-
if (isset($_GET['cf_form_id'])) {
|
128 |
-
ob_end_clean();
|
129 |
-
captainform_preview_form();
|
130 |
-
}
|
131 |
-
captainform_draw_main_iframe($url, array($wp_subid . "." . $GLOBALS['captainform_servicedomain'], $wp_protocol, $wp_seturl));
|
132 |
-
break;
|
133 |
-
case "Captainform-Preview":
|
134 |
-
break;
|
135 |
-
case "CaptainFormOptions":
|
136 |
-
captainform_options_page();
|
137 |
-
break;
|
138 |
-
default:
|
139 |
-
break;
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
function captainform_preview_form($redirect = true)
|
144 |
-
{
|
145 |
-
$special_captainform_code = '[captainform id="{cf_form_id}"]';
|
146 |
-
$post_type = "captainform_post";
|
147 |
-
$post_exists = false;
|
148 |
-
$post_arr = array();
|
149 |
-
$post_content = null;
|
150 |
-
$post_id = null;
|
151 |
-
if (isset($_GET['cf_form_id']))
|
152 |
-
$form_id = (int)$_GET['cf_form_id'];
|
153 |
-
else
|
154 |
-
$form_id = 726633;
|
155 |
-
|
156 |
-
if (isset($_GET['captainform_theme_style'])) {
|
157 |
-
$captainform_theme_style = $_GET['captainform_theme_style'];
|
158 |
-
}
|
159 |
-
if (isset($_GET['captainform_preview_as_lightbox'])) {
|
160 |
-
$captainform_preview_as_lightbox = $_GET['captainform_preview_as_lightbox'];
|
161 |
-
}
|
162 |
-
|
163 |
-
//search for the post
|
164 |
-
$args = "post_type=" . $post_type;
|
165 |
-
$query1 = new WP_Query($args);
|
166 |
-
|
167 |
-
if ($query1->have_posts())
|
168 |
-
while ($query1->have_posts()) {
|
169 |
-
$post_arr = $query1->the_post();
|
170 |
-
$post_id = $query1->post->ID;
|
171 |
-
$post_content = get_the_content();
|
172 |
-
$post_exists = true;
|
173 |
-
break;
|
174 |
-
}
|
175 |
-
wp_reset_postdata();
|
176 |
-
|
177 |
-
//Create the post if not exists
|
178 |
-
if ($post_exists == false) {
|
179 |
-
$post = array(
|
180 |
-
'post_content' => $special_captainform_code, // The full text of the post.
|
181 |
-
'post_name' => "CaptainForm_form_preview", // The name (slug) for your post
|
182 |
-
'post_title' => "CaptainForm Preview", // The title of your post.
|
183 |
-
'post_status' => 'draft',
|
184 |
-
'post_type' => $post_type,
|
185 |
-
'post_excerpt' => $special_captainform_code, // For all your post excerpt needs.
|
186 |
-
);
|
187 |
-
$post_id = wp_insert_post($post);
|
188 |
-
} else if ($post_exists == true && strpos($post_content, $special_captainform_code) === false && $post_id != null) {
|
189 |
-
$my_post = array();
|
190 |
-
$my_post['ID'] = $post_id;
|
191 |
-
|
192 |
-
$replace_old_shortcodes = captainform_replace_old_shortcodes($post_content);
|
193 |
-
|
194 |
-
if($replace_old_shortcodes['replaced'] === true)
|
195 |
-
{
|
196 |
-
$post_content = $replace_old_shortcodes['content'];
|
197 |
-
}
|
198 |
-
|
199 |
-
$my_post['post_excerpt' ] = $special_captainform_code;
|
200 |
-
$my_post['post_content'] = $post_content . $special_captainform_code;
|
201 |
-
wp_update_post($my_post);
|
202 |
-
}
|
203 |
-
elseif($post_exists == true && strpos($post_content, $special_captainform_code) !== false && $post_id != null )
|
204 |
-
{
|
205 |
-
$replace_old_shortcodes = captainform_replace_old_shortcodes($post_content);
|
206 |
-
if($replace_old_shortcodes['replaced'] === true)
|
207 |
-
{
|
208 |
-
$post_content = $replace_old_shortcodes['content'];
|
209 |
-
|
210 |
-
$my_post = array();
|
211 |
-
$my_post['ID'] = $post_id;
|
212 |
-
$my_post['post_content'] = $post_content;
|
213 |
-
$my_post['post_excerpt' ] = $special_captainform_code;
|
214 |
-
wp_update_post($my_post);
|
215 |
-
}
|
216 |
-
}
|
217 |
-
|
218 |
-
$url = add_query_arg('cf_form_id', $form_id, (get_permalink($post_id)));
|
219 |
-
if (isset($_GET['captainform_theme_style']))
|
220 |
-
$url = add_query_arg('captainform_theme_style', $captainform_theme_style, $url);
|
221 |
-
if (isset($_GET['captainform_preview_as_lightbox']))
|
222 |
-
$url = add_query_arg('captainform_preview_as_lightbox', $captainform_preview_as_lightbox, $url);
|
223 |
-
|
224 |
-
if ($redirect === true) {
|
225 |
-
wp_redirect($url);
|
226 |
-
exit();
|
227 |
-
} else
|
228 |
-
return $url;
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* @param String $content Remove old shortcodes from content
|
233 |
-
* @return Array
|
234 |
-
*/
|
235 |
-
function captainform_replace_old_shortcodes($content)
|
236 |
-
{
|
237 |
-
$old_shortcodes = array(
|
238 |
-
'[captainform i{cf_form_id}]'
|
239 |
-
);
|
240 |
-
|
241 |
-
$old_shortcode_found = false;
|
242 |
-
foreach($old_shortcodes as $old_code)
|
243 |
-
{
|
244 |
-
if(strpos($content, $old_code) !== false)
|
245 |
-
{
|
246 |
-
$content = str_replace ($old_code, "", $content);
|
247 |
-
$old_shortcode_found = true;
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
return array(
|
252 |
-
'content' => $content,
|
253 |
-
'replaced' => $old_shortcode_found
|
254 |
-
);
|
255 |
-
}
|
256 |
-
|
257 |
-
function captainform_remove_menu_items()
|
258 |
-
{
|
259 |
-
remove_menu_page('edit.php?post_type=' . 'captainform_post');
|
260 |
-
}
|
261 |
-
|
262 |
-
add_action('admin_menu', 'captainform_remove_menu_items');
|
263 |
-
|
264 |
-
function captainform_add_options_link()
|
265 |
-
{
|
266 |
-
if (current_user_can('manage_options')) {
|
267 |
-
add_menu_page('CaptainForm', 'CaptainForm', 'manage_options', 'CaptainForm', 'captainform_page_handler', plugins_url('/images/captainform-18.png', __FILE__), '6.000000000000000000123123123123123123123');
|
268 |
-
add_submenu_page('CaptainForm', 'CaptainForm', 'My Forms', 'manage_options', 'CaptainForm', 'captainform_page_handler');
|
269 |
-
add_submenu_page('CaptainForm', 'NewForm', 'New Form', 'manage_options', 'CaptainForm-NewForm', 'captainform_page_handler');
|
270 |
-
add_submenu_page('CaptainForm', 'MyAccount', 'My Account', 'manage_options', 'CaptainForm-MyAccount', 'captainform_page_handler');
|
271 |
-
add_submenu_page('CaptainForm', 'ChangePlan', 'Change Plan', 'manage_options', 'CaptainForm-ChangePlan', 'captainform_page_handler');
|
272 |
-
add_submenu_page('CaptainForm', 'Support', 'Support', 'manage_options', 'CaptainForm-Support', 'captainform_page_handler');
|
273 |
-
|
274 |
-
//Wordpress Settings->CaptainForm
|
275 |
-
add_options_page('CaptainForm Options', 'CaptainForm', 'manage_options', 'CaptainFormOptions', 'captainform_page_handler');
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
add_action('admin_menu', 'captainform_add_options_link');
|
280 |
-
|
281 |
-
function captainform_register_settings()
|
282 |
-
{
|
283 |
-
// creates our settings in the options table
|
284 |
-
register_setting('cf_wpp_settings_group', 'cf_wpp_settings');
|
285 |
-
}
|
286 |
-
|
287 |
-
add_action('admin_init', 'captainform_register_settings');
|
288 |
-
add_action('init', 'add_ob_start');
|
289 |
-
|
290 |
-
function add_ob_start()
|
291 |
-
{
|
292 |
-
ob_start();
|
293 |
-
}
|
294 |
-
|
295 |
-
add_action('init', 'captainform_new_post_type');
|
296 |
-
|
297 |
-
function captainform_new_post_type()
|
298 |
-
{
|
299 |
-
register_post_type('captainform_post', array(
|
300 |
-
'public' => true,
|
301 |
-
'show_in_nav_menus' => false,
|
302 |
-
'exclude_from_search' => true,
|
303 |
-
'show_ui' => false,
|
304 |
-
));
|
305 |
-
}
|
306 |
-
|
307 |
-
add_filter('mce_external_plugins', 'captainform_register_external_plugins');
|
308 |
-
|
309 |
-
function captainform_register_external_plugins($plugin_array)
|
310 |
-
{
|
311 |
-
$plugin_path = plugin_dir_url(plugin_dir_path(__FILE__));
|
312 |
-
|
313 |
-
$plugin_array['captainform'] = $plugin_path . 'dialog/editor_plugin.js';
|
314 |
-
$plugin_array['captainform_chosen'] = $plugin_path . 'includes/js/chosen.jquery.js';
|
315 |
-
$plugin_array['captainform_jscolor'] = $plugin_path . 'includes/js/jscolor/jscolor.js';
|
316 |
-
$plugin_array['captainform_widget_js'] = $plugin_path . 'includes/js/widget.js';
|
317 |
-
return $plugin_array;
|
318 |
-
}
|
319 |
-
|
320 |
-
add_action('wp_ajax_captainform_insert_dialog', 'captainform_insert_dialog');
|
321 |
-
|
322 |
-
function captainform_insert_dialog()
|
323 |
-
{
|
324 |
-
$response = captainform_get_forms('page_or_post');
|
325 |
-
if ($response->status == 'ok') {
|
326 |
-
$captainform_publish_code_value = "";
|
327 |
-
?>
|
328 |
-
<div class="captainform_widget_container">
|
329 |
-
<b>Select the form you want to embed:</b>
|
330 |
-
<br>
|
331 |
-
<select name="<?php echo $GLOBALS['captainform_plugin_name']; ?>_form_toembed"
|
332 |
-
id="<?php echo $GLOBALS['captainform_plugin_name']; ?>_form_toembed"
|
333 |
-
class="captainform_widget_select">
|
334 |
-
<?php
|
335 |
-
$first_form_id = null;
|
336 |
-
foreach ($response->forms as $form) {
|
337 |
-
if ($captainform_publish_code_value == "")
|
338 |
-
$captainform_publish_code_value = '[captainform id="' . $form->f_id . '"]';
|
339 |
-
?>
|
340 |
-
<option value="<?php echo $form->f_id; ?>"><?php echo $form->f_name; ?></option>
|
341 |
-
<?php
|
342 |
-
}
|
343 |
-
?>
|
344 |
-
</select>
|
345 |
-
<div id="captainform_publish_lightbox_main_container">
|
346 |
-
<?php
|
347 |
-
$captainform_display_as_lightbox_name = "cf_display_as_lightbox_name";
|
348 |
-
$captainform_trigger_option_name = "cf_trigger_option_name";
|
349 |
-
$captainform_selected_trigger = 0;
|
350 |
-
$captainform_trigger_0_name = "cf_trigger_0_name";
|
351 |
-
$captainform_trigger_0_text = "Contact Us";
|
352 |
-
$captainform_trigger_1_name = "cf_trigger_1_name";
|
353 |
-
$captainform_trigger_1_url = plugins_url('/includes/images/publish_lighbox_default_image_v2.png', dirname(__FILE__));
|
354 |
-
$captainform_trigger_2_text_name = "cf_trigger_2_text_name";
|
355 |
-
$captainform_trigger_2_text = "Contact us";
|
356 |
-
$captainform_trigger_2_position_name = "cf_trigger_2_position_name";
|
357 |
-
$captainform_trigger_2_position = 1;
|
358 |
-
$captainform_trigger_2_background_name = "cf_trigger_2_background_name";
|
359 |
-
$captainform_trigger_2_background = "FF0000";
|
360 |
-
$captainform_trigger_2_color_name = "cf_trigger_2_color_name";
|
361 |
-
$captainform_trigger_2_color = "FFFFFF";
|
362 |
-
$captainform_trigger_3_after_name = "cf_trigger_3_after_name";
|
363 |
-
$captainform_trigger_3_after = 3;
|
364 |
-
require(plugin_dir_path(dirname(__FILE__)) . 'views/publish_lightbox.php');
|
365 |
-
?>
|
366 |
-
<br/>
|
367 |
-
<input type="hidden" id="captainform_publish_code"
|
368 |
-
name="<?php if (isset($captainform_lightbox_publish_code_name)) echo $captainform_lightbox_publish_code_name; ?>"
|
369 |
-
class="cf_generated_code" value='<?php echo $captainform_publish_code_value; ?>'/>
|
370 |
-
<div class="clear"></div>
|
371 |
-
</div>
|
372 |
-
<div class="clear"></div>
|
373 |
-
</div>
|
374 |
-
<?php
|
375 |
-
} else {
|
376 |
-
if ($response->error_message) {
|
377 |
-
if (isset($response->error_code) && $response->error_code == 2) {
|
378 |
-
echo "Create a form and return here to publish it";
|
379 |
-
} elseif (isset($response->error_code) && $response->error_code == 1) {
|
380 |
-
echo "Please activate your account first! Go to the CaptainForm tab and enter your license key or activate your free account. Create a form and return here to publish it.";
|
381 |
-
} else
|
382 |
-
echo $response->error_message;
|
383 |
-
} else
|
384 |
-
echo 'Fatal error - ' . $response->status;
|
385 |
-
}
|
386 |
-
exit();
|
387 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/captainform-function-call.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The file that defines the function call
|
5 |
+
*
|
6 |
+
* This function can be used in any file of the website
|
7 |
+
*
|
8 |
+
* @link http://captainform.com
|
9 |
+
* @since 2.0.0
|
10 |
+
*
|
11 |
+
* @package Captainform
|
12 |
+
* @subpackage Captainform/includes
|
13 |
+
*/
|
14 |
+
|
15 |
+
if (!function_exists('captain_form')) {
|
16 |
+
|
17 |
+
function captain_form($id, $custom_options = array())
|
18 |
+
{
|
19 |
+
$custom_vars = isset($custom_options['custom_vars']) ? $custom_options['custom_vars'] : array();
|
20 |
+
|
21 |
+
$shortcode_final = '[captainform id="' . $id . '" ';
|
22 |
+
$shortcode_final .= (isset($custom_options['lightbox'])) ? "lightbox='{$custom_options['lightbox']}' " : '';
|
23 |
+
$shortcode_final .= (isset($custom_options['type'])) ? "type='{$custom_options['type']}' " : '';
|
24 |
+
$shortcode_final .= (isset($custom_options['url'])) ? "url='{$custom_options['url']}' " : '';
|
25 |
+
if (isset($custom_options['text_content']))
|
26 |
+
$shortcode_final .= "text_content='" . $custom_options['text_content'] . "' ";
|
27 |
+
else
|
28 |
+
$shortcode_final .= (isset($custom_options['content'])) ? "content='{$custom_options['content']}' " : '';
|
29 |
+
$shortcode_final .= (isset($custom_options['miliseconds'])) ? "miliseconds='{$custom_options['miliseconds']}' " : '';
|
30 |
+
$shortcode_final .= (isset($custom_options['text_color'])) ? "text_color='{$custom_options['text_color']}' " : '';
|
31 |
+
$shortcode_final .= (isset($custom_options['bg_color'])) ? "bg_color='{$custom_options['bg_color']}' " : '';
|
32 |
+
$shortcode_final .= (isset($custom_options['position'])) ? "position='{$custom_options['position']}' " : '';
|
33 |
+
|
34 |
+
foreach($custom_vars as $key => $value) {
|
35 |
+
if(strpos($key, 'cf_custom_var') !== false)
|
36 |
+
$shortcode_final .= $key . '=' . (strpos($value, '"') !== false ? "'" . $value . "' " : '"' . $value . '" ');
|
37 |
+
}
|
38 |
+
|
39 |
+
$shortcode_final .= ']';
|
40 |
+
|
41 |
+
return do_shortcode($shortcode_final);
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
includes/class-captainform-account.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @link http://captainform.com
|
4 |
+
* @since 2.0.0
|
5 |
+
*
|
6 |
+
* @package Captainform
|
7 |
+
* @subpackage Captainform/includes
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* This class responsible for maintaining and registering all account settings.
|
12 |
+
*
|
13 |
+
* @since 2.0.0
|
14 |
+
* @package Captainform
|
15 |
+
* @subpackage Captainform/includes
|
16 |
+
* @author captainform <team@captainform.com>
|
17 |
+
*/
|
18 |
+
class Captainform_Account
|
19 |
+
{
|
20 |
+
|
21 |
+
/**
|
22 |
+
* The unique identifier of this plugin.
|
23 |
+
*
|
24 |
+
* @since 2.0.0
|
25 |
+
* @access protected
|
26 |
+
* @var string $plugin_name The string used to uniquely identify this plugin.
|
27 |
+
*/
|
28 |
+
protected static $plugin_name;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* The current version of the plugin.
|
32 |
+
*
|
33 |
+
* @since 2.0.0
|
34 |
+
* @access protected
|
35 |
+
* @var string $version The current version of the plugin.
|
36 |
+
*/
|
37 |
+
protected static $version;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Initialize the class and set its properties.
|
41 |
+
*
|
42 |
+
* @since 2.0.0
|
43 |
+
* @param string $plugin_name The name of this plugin.
|
44 |
+
* @param string $version The version of this plugin.
|
45 |
+
*/
|
46 |
+
public function __construct( $plugin_name, $version ) {
|
47 |
+
|
48 |
+
self::$plugin_name = $plugin_name;
|
49 |
+
self::$version = $version;
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* The method that generates the installation ID option for the captainform plugin
|
55 |
+
*
|
56 |
+
* @since 2.0.0
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public static function generate_installation_id()
|
60 |
+
{
|
61 |
+
$alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
62 |
+
|
63 |
+
$admin_email = get_site_option("admin_email");
|
64 |
+
$timestamp = dechex(time());
|
65 |
+
|
66 |
+
$neededChars = 13 - strlen($timestamp);
|
67 |
+
$rand = substr(str_shuffle($alphanum), 0, $neededChars);
|
68 |
+
|
69 |
+
$computedId = $timestamp . $rand . "." . $admin_email;
|
70 |
+
|
71 |
+
if (strlen($computedId) >= 58)
|
72 |
+
$computedId = substr($computedId, -58);
|
73 |
+
|
74 |
+
return $computedId;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* The method that generates the installation key option for the captainform plugin
|
79 |
+
*
|
80 |
+
* @since 2.0.0
|
81 |
+
* @return string
|
82 |
+
*/
|
83 |
+
public static function generate_installation_key()
|
84 |
+
{
|
85 |
+
$alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
86 |
+
$installation_key = md5(substr(str_shuffle($alphanum), 0, 15));
|
87 |
+
|
88 |
+
return $installation_key;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* The method that updates the URL of the website when it has changed
|
93 |
+
*
|
94 |
+
* @since 2.0.0
|
95 |
+
*/
|
96 |
+
public static function update_website_url()
|
97 |
+
{
|
98 |
+
update_site_option('captainform_site_url', get_site_option("siteurl"));
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* The method that generates a new set of credentials for the captainform plugin
|
103 |
+
*
|
104 |
+
* @since 2.0.0
|
105 |
+
*/
|
106 |
+
public static function generate_new_credentials()
|
107 |
+
{
|
108 |
+
$installation_id = self::generate_installation_id();
|
109 |
+
update_site_option('captainform_installation_id', $installation_id);
|
110 |
+
|
111 |
+
$installation_key = self::generate_installation_key();
|
112 |
+
update_site_option('captainform_installation_key', $installation_key);
|
113 |
+
|
114 |
+
self::update_website_url();
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* This method checks if the credentials for the plugin are good and displays the error message if needed
|
119 |
+
*
|
120 |
+
* @since 2.0.0
|
121 |
+
* @return bool|mixed
|
122 |
+
*/
|
123 |
+
public static function check_credentials_error()
|
124 |
+
{
|
125 |
+
$site_url = get_site_option('captainform_site_url');
|
126 |
+
$site_url = str_replace(array('https://www.', 'http://www.', 'https://', 'http://', 'www.'), '', $site_url);
|
127 |
+
$site = get_site_option("siteurl");
|
128 |
+
$site = str_replace(array('https://www.', 'http://www.', 'https://', 'http://', 'www.'), '', $site);
|
129 |
+
|
130 |
+
if (!empty($site_url) && $site_url != $site) {
|
131 |
+
if (isset($_POST['captainform_reset_keys'])) {
|
132 |
+
if (intval($_POST['captainform_reset_keys']) == 1)
|
133 |
+
self::generate_new_credentials();
|
134 |
+
else {
|
135 |
+
self::update_website_url();
|
136 |
+
|
137 |
+
return $site;
|
138 |
+
}
|
139 |
+
|
140 |
+
return true;
|
141 |
+
}
|
142 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/captainform-admin-plugin-credentials-error.php';
|
143 |
+
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
return true;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* The method that sets the options for the plugin if they are not set
|
152 |
+
*
|
153 |
+
* @since 2.0.0
|
154 |
+
*/
|
155 |
+
public function check_account_settings()
|
156 |
+
{
|
157 |
+
if (get_site_option('captainform_installation_id') == '') {
|
158 |
+
add_site_option('captainform_installation_id', self::generate_installation_id());
|
159 |
+
}
|
160 |
+
|
161 |
+
if (get_site_option('captainform_installation_key') == '') {
|
162 |
+
add_site_option('captainform_installation_key', self::generate_installation_key());
|
163 |
+
}
|
164 |
+
|
165 |
+
if (get_site_option('captainform_site_url') == '') {
|
166 |
+
add_site_option('captainform_site_url', get_site_option("siteurl"));
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
includes/class-captainform-activator.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin activation
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin activation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's activation.
|
17 |
+
*
|
18 |
+
* @since 2.0.0
|
19 |
+
* @package Captainform
|
20 |
+
* @subpackage Captainform/includes
|
21 |
+
* @author captainform <team@captainform.com>
|
22 |
+
*/
|
23 |
+
class Captainform_Activator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* This function is called during plugin activation.
|
27 |
+
*
|
28 |
+
* @since 2.0.0
|
29 |
+
*/
|
30 |
+
public static function activate() {
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
includes/class-captainform-deactivator.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin deactivation
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin deactivation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's deactivation.
|
17 |
+
*
|
18 |
+
* @since 2.0.0
|
19 |
+
* @package Captainform
|
20 |
+
* @subpackage Captainform/includes
|
21 |
+
* @author captainform <team@captainform.com>
|
22 |
+
*/
|
23 |
+
class Captainform_Deactivator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* This function is called during plugin deactivation.
|
27 |
+
*
|
28 |
+
* @since 2.0.0
|
29 |
+
*/
|
30 |
+
public static function deactivate() {
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
includes/class-captainform-i18n.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Define the internationalization functionality
|
5 |
+
*
|
6 |
+
* Loads and defines the internationalization files for this plugin
|
7 |
+
* so that it is ready for translation.
|
8 |
+
*
|
9 |
+
* @link http://captainform.com
|
10 |
+
* @since 1.0.0
|
11 |
+
*
|
12 |
+
* @package Captainform
|
13 |
+
* @subpackage Captainform/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Define the internationalization functionality.
|
18 |
+
*
|
19 |
+
* Loads and defines the internationalization files for this plugin
|
20 |
+
* so that it is ready for translation.
|
21 |
+
*
|
22 |
+
* @since 2.0.0
|
23 |
+
* @package Captainform
|
24 |
+
* @subpackage Captainform/includes
|
25 |
+
* @author captainform <team@captainform.com>
|
26 |
+
*/
|
27 |
+
class Captainform_i18n {
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Load the plugin text domain for translation.
|
32 |
+
*
|
33 |
+
* @since 2.0.0
|
34 |
+
*/
|
35 |
+
public function load_plugin_textdomain() {
|
36 |
+
|
37 |
+
load_plugin_textdomain(
|
38 |
+
'captainform',
|
39 |
+
false,
|
40 |
+
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
41 |
+
);
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
}
|
includes/class-captainform-loader.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Register all actions and filters for the plugin
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Register all actions and filters for the plugin.
|
15 |
+
*
|
16 |
+
* Maintain a list of all hooks that are registered throughout
|
17 |
+
* the plugin, and register them with the WordPress API. Call the
|
18 |
+
* run function to execute the list of actions and filters.
|
19 |
+
*
|
20 |
+
* @package Captainform
|
21 |
+
* @subpackage Captainform/includes
|
22 |
+
* @author captainform <team@captainform.com>
|
23 |
+
*/
|
24 |
+
class Captainform_Loader {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The array of actions registered with WordPress.
|
28 |
+
*
|
29 |
+
* @since 2.0.0
|
30 |
+
* @access protected
|
31 |
+
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
32 |
+
*/
|
33 |
+
protected $actions;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The array of filters registered with WordPress.
|
37 |
+
*
|
38 |
+
* @since 2.0.0
|
39 |
+
* @access protected
|
40 |
+
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
41 |
+
*/
|
42 |
+
protected $filters;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The array of actions registered with WordPress.
|
46 |
+
*
|
47 |
+
* @since 2.0.0
|
48 |
+
* @access protected
|
49 |
+
* @var array $shortcodes The shortcodes registered with WordPress to fire when the plugin loads.
|
50 |
+
*/
|
51 |
+
protected $shortcodes;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Initialize the collections used to maintain the actions and filters.
|
55 |
+
*
|
56 |
+
* @since 2.0.0
|
57 |
+
*/
|
58 |
+
public function __construct() {
|
59 |
+
|
60 |
+
$this->actions = array();
|
61 |
+
$this->filters = array();
|
62 |
+
$this->shortcodes = array();
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Add a new action to the collection to be registered with WordPress.
|
68 |
+
*
|
69 |
+
* @since 2.0.0
|
70 |
+
* @param string $hook The name of the WordPress action that is being registered.
|
71 |
+
* @param object $component A reference to the instance of the object on which the action is defined.
|
72 |
+
* @param string $callback The name of the function definition on the $component.
|
73 |
+
* @param int $priority Optional. he priority at which the function should be fired. Default is 10.
|
74 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
75 |
+
*/
|
76 |
+
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
77 |
+
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Add a new filter to the collection to be registered with WordPress.
|
82 |
+
*
|
83 |
+
* @since 2.0.0
|
84 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
85 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
86 |
+
* @param string $callback The name of the function definition on the $component.
|
87 |
+
* @param int $priority Optional. he priority at which the function should be fired. Default is 10.
|
88 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
|
89 |
+
*/
|
90 |
+
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
91 |
+
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Add a new shortcode to the collection to be registered with WordPress.
|
96 |
+
*
|
97 |
+
* @since 2.0.0
|
98 |
+
* @param string $hook The name of the shortcode that is being registered.
|
99 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
100 |
+
* @param string $callback The name of the function definition on the $component.
|
101 |
+
*/
|
102 |
+
public function add_shortcode( $hook, $component, $callback) {
|
103 |
+
$this->shortcodes = $this->add( $this->shortcodes, $hook, $component, $callback, 0, 1 );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* A utility function that is used to register the actions and hooks into a single
|
108 |
+
* collection.
|
109 |
+
*
|
110 |
+
* @since 2.0.0
|
111 |
+
* @access private
|
112 |
+
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
113 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
114 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
115 |
+
* @param string $callback The name of the function definition on the $component.
|
116 |
+
* @param int $priority The priority at which the function should be fired.
|
117 |
+
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
118 |
+
* @return array The collection of actions and filters registered with WordPress.
|
119 |
+
*/
|
120 |
+
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
121 |
+
|
122 |
+
$hooks[] = array(
|
123 |
+
'hook' => $hook,
|
124 |
+
'component' => $component,
|
125 |
+
'callback' => $callback,
|
126 |
+
'priority' => $priority,
|
127 |
+
'accepted_args' => $accepted_args
|
128 |
+
);
|
129 |
+
|
130 |
+
return $hooks;
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Register the filters and actions with WordPress.
|
136 |
+
*
|
137 |
+
* @since 2.0.0
|
138 |
+
*/
|
139 |
+
public function run() {
|
140 |
+
|
141 |
+
foreach ( $this->filters as $hook ) {
|
142 |
+
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
143 |
+
}
|
144 |
+
|
145 |
+
foreach ( $this->actions as $hook ) {
|
146 |
+
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
147 |
+
}
|
148 |
+
|
149 |
+
foreach ( $this->shortcodes as $hook ) {
|
150 |
+
add_shortcode( $hook['hook'], array( $hook['component'], $hook['callback'] ));
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
}
|
includes/class-captainform-preview.php
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during form preview
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The form preview class
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the form preview
|
17 |
+
*
|
18 |
+
* @since 2.0.0
|
19 |
+
* @package Captainform
|
20 |
+
* @subpackage Captainform/includes
|
21 |
+
* @author captainform <team@captainform.com>
|
22 |
+
*/
|
23 |
+
class Captainform_Preview {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @since 2.0.0
|
27 |
+
* @access private
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
private static $shortcode = '[captainform id="{cf_form_id}"]';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @since 2.0.0
|
34 |
+
* @access private
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
private static $post_type = 'captainform_post';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @since 2.0.0
|
41 |
+
* @access private
|
42 |
+
* @var int
|
43 |
+
*/
|
44 |
+
private static $post_id;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @since 2.0.0
|
48 |
+
* @param bool $redirect
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
public static function preview_form($redirect = true)
|
52 |
+
{
|
53 |
+
$post_exists = false;
|
54 |
+
$post_content = '';
|
55 |
+
|
56 |
+
//search for the preview post
|
57 |
+
$query1 = new WP_Query('post_type=' . self::getPostType());
|
58 |
+
|
59 |
+
if ($query1->have_posts())
|
60 |
+
while ($query1->have_posts()) {
|
61 |
+
self::setPostId($query1->post->ID);
|
62 |
+
$query1->the_post();
|
63 |
+
$post_content = get_the_content();
|
64 |
+
$post_exists = true;
|
65 |
+
break;
|
66 |
+
}
|
67 |
+
wp_reset_postdata();
|
68 |
+
|
69 |
+
if ( ! $post_exists) {
|
70 |
+
self::setPostId(self::create_post());
|
71 |
+
} else if ($post_exists === true && strpos($post_content, self::getShortcode()) === false && self::getPostId() != null) {
|
72 |
+
|
73 |
+
$replace_old_shortcodes = self::replace_old_shortcodes($post_content);
|
74 |
+
|
75 |
+
if($replace_old_shortcodes['replaced'] === true)
|
76 |
+
$post_content = $replace_old_shortcodes['content'];
|
77 |
+
|
78 |
+
self::update_post(array(
|
79 |
+
'post_content' => $post_content . self::getShortcode(),
|
80 |
+
));
|
81 |
+
}
|
82 |
+
elseif($post_exists === true && strpos($post_content, self::getShortcode()) !== false && self::getPostId() != null )
|
83 |
+
{
|
84 |
+
$replace_old_shortcodes = self::replace_old_shortcodes($post_content);
|
85 |
+
if($replace_old_shortcodes['replaced'] === true) {
|
86 |
+
self::update_post(array(
|
87 |
+
'post_content' => $replace_old_shortcodes['content'],
|
88 |
+
));
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
if ($redirect === true) {
|
93 |
+
wp_redirect(self::get_preview_url());
|
94 |
+
exit();
|
95 |
+
} else
|
96 |
+
return self::get_preview_url();
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @since 2.0.0
|
101 |
+
* @access private
|
102 |
+
* @return string
|
103 |
+
*/
|
104 |
+
private static function get_preview_url() {
|
105 |
+
|
106 |
+
$url = add_query_arg('cf_form_id', self::get_form_id(), get_permalink(self::getPostId()));
|
107 |
+
|
108 |
+
if (isset($_GET['captainform_theme_style']))
|
109 |
+
$url = add_query_arg('captainform_theme_style', $_GET['captainform_theme_style'], $url);
|
110 |
+
|
111 |
+
if (isset($_GET['captainform_preview_as_lightbox']))
|
112 |
+
$url = add_query_arg('captainform_preview_as_lightbox', $_GET['captainform_preview_as_lightbox'], $url);
|
113 |
+
|
114 |
+
return $url;
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @since 2.0.0
|
120 |
+
* @access private
|
121 |
+
* @param string $content Remove old shortcodes from content
|
122 |
+
* @return array
|
123 |
+
*/
|
124 |
+
private static function replace_old_shortcodes($content)
|
125 |
+
{
|
126 |
+
$old_shortcodes = array(
|
127 |
+
'[captainform i{cf_form_id}]'
|
128 |
+
);
|
129 |
+
|
130 |
+
$old_shortcode_found = false;
|
131 |
+
foreach($old_shortcodes as $old_code)
|
132 |
+
{
|
133 |
+
if(strpos($content, $old_code) !== false)
|
134 |
+
{
|
135 |
+
$content = str_replace ($old_code, "", $content);
|
136 |
+
$old_shortcode_found = true;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
return array(
|
141 |
+
'content' => $content,
|
142 |
+
'replaced' => $old_shortcode_found
|
143 |
+
);
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @since 2.0.0
|
148 |
+
* @access private
|
149 |
+
* @return int
|
150 |
+
*/
|
151 |
+
private static function get_form_id() {
|
152 |
+
|
153 |
+
return isset($_GET['cf_form_id']) ? intval($_GET['cf_form_id']) : 726633;
|
154 |
+
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* @since 2.0.0
|
159 |
+
* @return string
|
160 |
+
*/
|
161 |
+
public static function getShortcode()
|
162 |
+
{
|
163 |
+
return self::$shortcode;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* @since 2.0.0
|
168 |
+
* @return string
|
169 |
+
*/
|
170 |
+
public static function getPostType()
|
171 |
+
{
|
172 |
+
return self::$post_type;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* @since 2.0.0
|
177 |
+
* @access private
|
178 |
+
* @param array $post_data
|
179 |
+
*/
|
180 |
+
private static function update_post($post_data) {
|
181 |
+
|
182 |
+
$post_data['ID'] = self::getPostId();
|
183 |
+
$post_data['post_excerpt'] = self::getShortcode();
|
184 |
+
|
185 |
+
wp_update_post($post_data);
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* @since 2.0.0
|
191 |
+
* @access private
|
192 |
+
* @return int|WP_Error
|
193 |
+
*/
|
194 |
+
private static function create_post()
|
195 |
+
{
|
196 |
+
$post = array(
|
197 |
+
'post_content' => self::getShortcode(),
|
198 |
+
'post_name' => "CaptainForm_form_preview",
|
199 |
+
'post_title' => "CaptainForm Preview",
|
200 |
+
'post_status' => 'draft',
|
201 |
+
'post_type' => self::getPostType(),
|
202 |
+
'post_excerpt' => self::getShortcode(),
|
203 |
+
);
|
204 |
+
|
205 |
+
return wp_insert_post($post);
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* @since 2.0.0
|
210 |
+
* @return mixed
|
211 |
+
*/
|
212 |
+
public static function getPostId()
|
213 |
+
{
|
214 |
+
return self::$post_id;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* @since 2.0.0
|
219 |
+
* @param mixed $post_id
|
220 |
+
*/
|
221 |
+
public static function setPostId($post_id)
|
222 |
+
{
|
223 |
+
self::$post_id = $post_id;
|
224 |
+
}
|
225 |
+
|
226 |
+
}
|
includes/class-captainform-shortcodes.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Register all shortcodes for the plugin
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Register all shortcodes for the plugin.
|
15 |
+
*
|
16 |
+
* Maintain a list of all shortcodes that are registered throughout
|
17 |
+
* the plugin, and register them with the WordPress API.
|
18 |
+
*
|
19 |
+
* @package Captainform
|
20 |
+
* @subpackage Captainform/includes
|
21 |
+
* @author captainform <team@captainform.com>
|
22 |
+
*/
|
23 |
+
class Captainform_Shortcodes {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The ID of this plugin.
|
27 |
+
*
|
28 |
+
* @since 2.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $plugin_name The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private static $plugin_name;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The version of this plugin.
|
36 |
+
*
|
37 |
+
* @since 2.0.0
|
38 |
+
* @access private
|
39 |
+
* @var string $version The current version of this plugin.
|
40 |
+
*/
|
41 |
+
private static $version;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* The array of actions registered with WordPress.
|
45 |
+
*
|
46 |
+
* @since 2.0.0
|
47 |
+
* @access protected
|
48 |
+
* @var array $shortcodes The shortcodes registered with WordPress to fire when the plugin loads.
|
49 |
+
*/
|
50 |
+
protected $shortcodes;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Initialize the class and set its properties.
|
54 |
+
*
|
55 |
+
* @since 2.0.0
|
56 |
+
* @param string $plugin_name The name of the plugin.
|
57 |
+
* @param string $version The version of this plugin.
|
58 |
+
*/
|
59 |
+
public function __construct( $plugin_name, $version ) {
|
60 |
+
|
61 |
+
self::$plugin_name = $plugin_name;
|
62 |
+
self::$version = $version;
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* A utility function that is used to register the shortcodes into a single collection.
|
68 |
+
*
|
69 |
+
* @since 2.0.0
|
70 |
+
* @access private
|
71 |
+
*
|
72 |
+
* @param array $atts The collection of hooks that is being registered (that is, actions or filters).
|
73 |
+
*
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function evaluate( $atts ) {
|
77 |
+
|
78 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-captainform-public-form-embedding.php';
|
79 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-captainform-public-form-resource-loader.php';
|
80 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-captainform-public-form-custom-vars.php';
|
81 |
+
|
82 |
+
$form_embedding = new Captainform_FormEmbedding($atts, self::$plugin_name, self::$version);
|
83 |
+
return $form_embedding->run();
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @since 2.0.0
|
89 |
+
* @access private
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
private function remove_shortcode(){
|
93 |
+
return '';
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @since 2.0.0
|
98 |
+
* @param $content
|
99 |
+
* @return string
|
100 |
+
*/
|
101 |
+
public function evaluate_excerpt($content){
|
102 |
+
$pattern = '/\[[^\[]*captain-?form[^\]]*\]/';
|
103 |
+
return preg_replace_callback($pattern, array($this, 'remove_shortcode'), $content);
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
includes/class-captainform-utils.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @link http://captainform.com
|
4 |
+
* @since 2.0.0
|
5 |
+
*
|
6 |
+
* @package Captainform
|
7 |
+
* @subpackage Captainform/includes
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* This class contains some utilities needed for the plugin.
|
12 |
+
*
|
13 |
+
* @since 2.0.0
|
14 |
+
* @package Captainform
|
15 |
+
* @subpackage Captainform/includes
|
16 |
+
* @author captainform <team@captainform.com>
|
17 |
+
*/
|
18 |
+
class Captainform_Utils
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Get the forms from the remote host.
|
22 |
+
*
|
23 |
+
* @since 2.0.0
|
24 |
+
*
|
25 |
+
* @param string $publish_method The name of this plugin.
|
26 |
+
* @param int $count The version of this plugin.
|
27 |
+
*
|
28 |
+
* @return array|bool|mixed|object
|
29 |
+
*/
|
30 |
+
public static function get_remote_forms($publish_method, $count = 2)
|
31 |
+
{
|
32 |
+
$remote_url = 'http://app.captainform.com/wp_dispatcher.php?' .
|
33 |
+
'app_id=' . urlencode(get_site_option('captainform_installation_id')) .
|
34 |
+
'&app_key=' . urlencode(get_site_option('captainform_installation_key'));
|
35 |
+
|
36 |
+
if ($publish_method && $count == 2)
|
37 |
+
$remote_url .= '&publish_method=' . $publish_method;
|
38 |
+
|
39 |
+
$result = wp_remote_fopen($remote_url);
|
40 |
+
if ($result === false)
|
41 |
+
return false;
|
42 |
+
|
43 |
+
return json_decode($result);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Starts the session if it's not started already
|
48 |
+
*
|
49 |
+
* @since 2.0.0
|
50 |
+
*/
|
51 |
+
public function session_start() {
|
52 |
+
if (!session_id())
|
53 |
+
@session_start(array('cookie_lifetime' => 86400));
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Starts the output buffer so we can display the form preview
|
58 |
+
*
|
59 |
+
* @since 2.0.0
|
60 |
+
*/
|
61 |
+
public function ob_start() {
|
62 |
+
ob_start();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Adds jQuery to WordPress
|
67 |
+
* BugFix for WP4.4.2 + Twenty Ten Theme
|
68 |
+
*
|
69 |
+
* @since 2.0.0
|
70 |
+
*/
|
71 |
+
public function add_jquery() {
|
72 |
+
wp_enqueue_script('jquery');
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Register the captainform custom post type.
|
77 |
+
*
|
78 |
+
* @since 2.0.0
|
79 |
+
*/
|
80 |
+
public function register_post_type() {
|
81 |
+
register_post_type('captainform_post', array(
|
82 |
+
'public' => true,
|
83 |
+
'show_in_nav_menus' => false,
|
84 |
+
'exclude_from_search' => true,
|
85 |
+
'show_ui' => false,
|
86 |
+
));
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* JS optimization exclude strings, as configured in admin page.
|
91 |
+
*
|
92 |
+
* @since 2.1.3
|
93 |
+
* @param $exclude : comma-separated list of exclude strings
|
94 |
+
* @return string : comma-seperated list of exclude strings
|
95 |
+
*/
|
96 |
+
public function autoptimize_override_js_exclude($exclude) {
|
97 |
+
return $exclude . ', captainform-form-popup, captainform-main, iframeResizer.min';
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @since 2.0.0
|
102 |
+
* @param string $param
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
private static function get_referer_params($param = '') {
|
106 |
+
$file_exists = false;
|
107 |
+
$file = plugin_dir_path(dirname(__FILE__)) . 'referer.php';
|
108 |
+
if (file_exists($file)) {
|
109 |
+
require_once($file);
|
110 |
+
$file_exists = true;
|
111 |
+
}
|
112 |
+
if ($param == 'unique_id') {
|
113 |
+
if ($file_exists && isset($captainform_unique_id) && $captainform_unique_id) {
|
114 |
+
return $captainform_unique_id;
|
115 |
+
}
|
116 |
+
return 'captainform_' . substr(md5(get_site_url()),-12);
|
117 |
+
}
|
118 |
+
if ($param == 'source') {
|
119 |
+
if ($file_exists && isset($captainform_referer) && $captainform_referer) {
|
120 |
+
return $captainform_referer;
|
121 |
+
}
|
122 |
+
return 'plugin_directory';
|
123 |
+
}
|
124 |
+
return '';
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
includes/class-captainform-widget.php
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @link http://captainform.com
|
5 |
+
* @since 2.0.0
|
6 |
+
*
|
7 |
+
* @package Captainform
|
8 |
+
* @subpackage Captainform/includes
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* This class is responsible for the captainform widget.
|
13 |
+
*
|
14 |
+
* @since 2.0.0
|
15 |
+
* @package Captainform
|
16 |
+
* @subpackage Captainform/includes
|
17 |
+
* @author captainform <team@captainform.com>
|
18 |
+
*/
|
19 |
+
class Captainform_Widget extends WP_Widget
|
20 |
+
{
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @since 2.0.0
|
24 |
+
* @access private
|
25 |
+
* @var string $publish_type
|
26 |
+
*/
|
27 |
+
private $publish_type = 'widget';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The number of captainform widgets.
|
31 |
+
*
|
32 |
+
* @since 2.0.0
|
33 |
+
* @access private
|
34 |
+
* @var int $widget_count
|
35 |
+
*/
|
36 |
+
private static $widget_count = 0;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Captainform_Widget constructor.
|
40 |
+
*
|
41 |
+
* @since 2.0.0
|
42 |
+
*/
|
43 |
+
public function __construct()
|
44 |
+
{
|
45 |
+
parent::__construct(
|
46 |
+
false,
|
47 |
+
__('CaptainForm', 'captainform'),
|
48 |
+
array(
|
49 |
+
'description' => __('Add a form to the sidebar', 'captainform'),
|
50 |
+
)
|
51 |
+
);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @since 2.0.0
|
56 |
+
* @param array $instance
|
57 |
+
*
|
58 |
+
* @return string|void
|
59 |
+
*/
|
60 |
+
public function form($instance)
|
61 |
+
{
|
62 |
+
$embeded_form = isset($instance['captainform_form_id']) ? esc_attr($instance['captainform_form_id']) : '';
|
63 |
+
$response = Captainform_Utils::get_remote_forms($this->publish_type, ++self::$widget_count);
|
64 |
+
|
65 |
+
$captainform_display_as_lightbox_name = $this->get_field_name('captainform_display_as_lightbox');
|
66 |
+
$captainform_trigger_option_name = $this->get_field_name('captainform_selected_trigger');
|
67 |
+
$captainform_lightbox_publish_code_name = $this->get_field_name('captainform_lightbox_publish_code');
|
68 |
+
|
69 |
+
//Text
|
70 |
+
$captainform_trigger_0_name = $this->get_field_name('captainform_trigger_0_text');
|
71 |
+
$captainform_trigger_0_text = (isset($instance['captainform_trigger_0_text']) ? esc_attr($instance['captainform_trigger_0_text']) : "Contact us");
|
72 |
+
|
73 |
+
//click on image
|
74 |
+
$captainform_trigger_1_name = $this->get_field_name('captainform_trigger_1_url');
|
75 |
+
$captainform_trigger_1_url = isset($instance['captainform_trigger_1_url']) ? esc_attr($instance['captainform_trigger_1_url']) : '';
|
76 |
+
if ($captainform_trigger_1_url == "")
|
77 |
+
$captainform_trigger_1_url = plugin_dir_url( __FILE__ ) . '../public/images/publish_lighbox_default_image_v2.png';
|
78 |
+
|
79 |
+
//floating button
|
80 |
+
$captainform_trigger_2_text_name = $this->get_field_name('captainform_trigger_2_text');
|
81 |
+
$captainform_trigger_2_text = (isset($instance['captainform_trigger_2_text']) ? esc_attr($instance['captainform_trigger_2_text']) : "Contact us");
|
82 |
+
$captainform_trigger_2_position_name = $this->get_field_name('captainform_trigger_2_position');
|
83 |
+
$captainform_trigger_2_position = (isset($instance['captainform_trigger_2_position']) ? ($instance['captainform_trigger_2_position'] != '' ? esc_attr($instance['captainform_trigger_2_position']) : 1) : 1);
|
84 |
+
$captainform_trigger_2_background_name = $this->get_field_name('captainform_trigger_2_background');
|
85 |
+
$captainform_trigger_2_background = (isset($instance['captainform_trigger_2_background']) ? esc_attr($instance['captainform_trigger_2_background']) : '');
|
86 |
+
if ($captainform_trigger_2_background == '')
|
87 |
+
$captainform_trigger_2_background = "FF0000";
|
88 |
+
$captainform_trigger_2_color_name = $this->get_field_name('captainform_trigger_2_color');
|
89 |
+
$captainform_trigger_2_color = (isset($instance['captainform_trigger_2_color']) ? esc_attr($instance['captainform_trigger_2_color']) : '');
|
90 |
+
if ($captainform_trigger_2_color == '')
|
91 |
+
$captainform_trigger_2_color = "FFFFFF";
|
92 |
+
|
93 |
+
//Auto popup
|
94 |
+
$captainform_trigger_3_after_name = $this->get_field_name('captainform_trigger_3_after');
|
95 |
+
$captainform_trigger_3_after = (isset($instance['captainform_trigger_3_after']) ? esc_attr($instance['captainform_trigger_3_after']) : 5);
|
96 |
+
|
97 |
+
$captainform_publish_code_value = isset($instance['captainform_lightbox_publish_code']) ? esc_attr($instance['captainform_lightbox_publish_code']) : '';
|
98 |
+
$display_as_lightbox = (isset($instance['captainform_display_as_lightbox']) ? esc_attr($instance['captainform_display_as_lightbox']) : 3);
|
99 |
+
$captainform_selected_trigger = (isset($instance['captainform_selected_trigger']) && $display_as_lightbox == 1 ? esc_attr($instance['captainform_selected_trigger']) : 3);
|
100 |
+
|
101 |
+
$captainform_auto_popup_trigger_option_name = $this->get_field_name('captainform_auto_popup_trigger');
|
102 |
+
$captainform_auto_popup_selected_trigger = isset($instance['captainform_auto_popup_trigger']) ? esc_attr($instance['captainform_auto_popup_trigger']) : 1;
|
103 |
+
|
104 |
+
$captainform_custom_vars_name = $this->get_field_name('captainform_custom_vars_name');
|
105 |
+
$captainform_custom_vars_code = isset($instance['captainform_custom_vars_name']) ? esc_attr($instance['captainform_custom_vars_name']) : '';
|
106 |
+
|
107 |
+
$captainform_form_controls = $response->controls;
|
108 |
+
?>
|
109 |
+
<script type="text/javascript">
|
110 |
+
var captainform_forms_controls = <?php echo json_encode($captainform_form_controls);?>;
|
111 |
+
</script>
|
112 |
+
<?php
|
113 |
+
if ($response->status == 'ok') {
|
114 |
+
?>
|
115 |
+
<div class="captainform_widget_container">
|
116 |
+
<p>
|
117 |
+
<label for="<?php echo $this->get_field_id('captainform_form_id'); ?>">
|
118 |
+
Select the form you want to embed:
|
119 |
+
</label>
|
120 |
+
</p>
|
121 |
+
<div>
|
122 |
+
<select name="<?php echo $this->get_field_name('captainform_form_id'); ?>"
|
123 |
+
class="captainform_widget_select"
|
124 |
+
id="<?php echo $this->get_field_id('captainform_form_id'); ?>">
|
125 |
+
<?php foreach ($response->forms as $form): ?>
|
126 |
+
<option value="<?php echo $form->f_id; ?>" <?php echo ($form->f_id == $embeded_form) ? 'selected' : '' ?> >
|
127 |
+
<?php echo $form->f_name; ?>
|
128 |
+
</option>
|
129 |
+
<?php endforeach; ?>
|
130 |
+
</select>
|
131 |
+
</div>
|
132 |
+
<?php
|
133 |
+
require plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/captainform-admin-publish-options.php';
|
134 |
+
?>
|
135 |
+
<input type="hidden" class='cf_generated_code'
|
136 |
+
name="<?php echo $captainform_lightbox_publish_code_name; ?>"
|
137 |
+
value="<?php echo $captainform_publish_code_value; ?>"/>
|
138 |
+
|
139 |
+
<input type="hidden" name="<?php echo $captainform_custom_vars_name ;?>" class="captainform_custom_vars_code" value="<?php echo $captainform_custom_vars_code;?>"/>
|
140 |
+
</div>
|
141 |
+
<?php
|
142 |
+
} else {
|
143 |
+
?>
|
144 |
+
<div class="error_message_container">
|
145 |
+
<?php
|
146 |
+
if ($response->error_message) {
|
147 |
+
if (isset($response->error_code) && $response->error_code == 2) {
|
148 |
+
echo sprintf("%sCreate a form%s and return here to publish it in your sidebar.", '<a href="admin.php?page=CaptainForm-NewForm">', "</a>");
|
149 |
+
} elseif (isset($response->error_code) && $response->error_code == 1) {
|
150 |
+
echo sprintf("Please activate your account first! Go to the CaptainForm tab and enter your license key or activate your free account. %sCreate a form%s and return here to publish it.", '<a href="admin.php?page=CaptainForm-NewForm">', "</a>");
|
151 |
+
} else
|
152 |
+
echo $response->error_message;
|
153 |
+
} else
|
154 |
+
echo __('There was an error. Pleas contact us!', 'captainform');
|
155 |
+
?>
|
156 |
+
</div>
|
157 |
+
<?php
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @since 2.0.0
|
163 |
+
* @param array $new_instance
|
164 |
+
* @param array $old_instance
|
165 |
+
*
|
166 |
+
* @return array
|
167 |
+
*/
|
168 |
+
public function update($new_instance, $old_instance)
|
169 |
+
{
|
170 |
+
$instance = $old_instance;
|
171 |
+
$instance['captainform_form_id'] = intval($new_instance['captainform_form_id']);
|
172 |
+
$display_as_lightbox = intval($new_instance['captainform_display_as_lightbox']);
|
173 |
+
$instance['captainform_display_as_lightbox'] = $display_as_lightbox;
|
174 |
+
$instance['captainform_selected_trigger'] = ($display_as_lightbox == 1 ? intval($new_instance['captainform_selected_trigger']) : 0);
|
175 |
+
$instance['captainform_trigger_0_text'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_0_text'] : '');
|
176 |
+
$instance['captainform_trigger_1_url'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_1_url'] : '');
|
177 |
+
$instance['captainform_trigger_2_text'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_text'] : '');
|
178 |
+
$instance['captainform_trigger_2_position'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_position'] : '');
|
179 |
+
$instance['captainform_trigger_2_background'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_background'] : '');
|
180 |
+
$instance['captainform_trigger_2_color'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_color'] : '');
|
181 |
+
$instance['captainform_trigger_3_after'] = ($display_as_lightbox == 1 ? (intval($new_instance['captainform_trigger_3_after']) > 0 ? intval($new_instance['captainform_trigger_3_after']) : 3) : 3);
|
182 |
+
$instance['captainform_custom_vars_name'] = $new_instance['captainform_custom_vars_name'];
|
183 |
+
$instance['captainform_lightbox_publish_code'] = $new_instance['captainform_lightbox_publish_code'];
|
184 |
+
$instance['captainform_auto_popup_trigger'] = $new_instance['captainform_auto_popup_trigger'];
|
185 |
+
|
186 |
+
return $instance;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* @since 2.0.0
|
191 |
+
* @param array $args
|
192 |
+
* @param array $instance
|
193 |
+
*/
|
194 |
+
public function widget($args, $instance)
|
195 |
+
{
|
196 |
+
global $post;
|
197 |
+
extract($args);
|
198 |
+
$shortcode = '[captainform id="' . $instance['captainform_form_id'] . '"]';
|
199 |
+
if (isset($instance['captainform_lightbox_publish_code']) && $instance['captainform_lightbox_publish_code'] != '')
|
200 |
+
$shortcode = $instance['captainform_lightbox_publish_code'];
|
201 |
+
|
202 |
+
if(!empty($instance['captainform_custom_vars_name']))
|
203 |
+
$shortcode = substr($shortcode,0, strlen($shortcode) -1) . ' '. $instance['captainform_custom_vars_name']. "]";
|
204 |
+
$is_lightbox_pattern = '/\[[^\[]*captain-?form.*lightbox=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
205 |
+
$is_lighbox = preg_match($is_lightbox_pattern, $shortcode) ? true : false;
|
206 |
+
|
207 |
+
$type_pattern = '/\[[^\[]*captain-?form.*type=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
208 |
+
preg_match($type_pattern, $shortcode, $matches_type);
|
209 |
+
$shortcode_option_type = isset($matches_type[1]) ? $matches_type[1] : null;
|
210 |
+
|
211 |
+
$show_widget_area = ($is_lighbox && in_array($shortcode_option_type, array('floating-button', 'auto-popup', 'window-leave'))) ? false : true;
|
212 |
+
|
213 |
+
if ($show_widget_area && isset($before_title) && isset($before_widget) && isset($after_title)) {
|
214 |
+
echo $before_widget . $before_title . $after_title;
|
215 |
+
}
|
216 |
+
|
217 |
+
echo do_shortcode($shortcode);
|
218 |
+
|
219 |
+
wp_reset_query();
|
220 |
+
|
221 |
+
if ($show_widget_area && isset($after_widget))
|
222 |
+
echo $after_widget;
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Register the stylesheets for the widgets area.
|
227 |
+
*
|
228 |
+
* @since 2.0.0
|
229 |
+
*/
|
230 |
+
public function enqueue_styles() {
|
231 |
+
|
232 |
+
wp_register_style('cf-widget-css', plugin_dir_url( __FILE__ ) . '../admin/css/widget.css', false, false);
|
233 |
+
wp_enqueue_style('cf-widget-css');
|
234 |
+
wp_register_style('cf-chosen-css', plugin_dir_url( __FILE__ ) . '../admin/css/chosen/chosen.css', false, false);
|
235 |
+
wp_enqueue_style('cf-chosen-css');
|
236 |
+
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Register the JavaScript for the widgets area.
|
241 |
+
*
|
242 |
+
* @since 2.0.0
|
243 |
+
*/
|
244 |
+
public function enqueue_scripts() {
|
245 |
+
|
246 |
+
wp_register_script('cf_color_picker_js', plugin_dir_url( __FILE__ ) . '../admin/js/jscolor/jscolor.js', array('jquery'), false, true);
|
247 |
+
wp_enqueue_script('cf_widget_js', plugin_dir_url( __FILE__ ) . '../admin/js/widget.js', array('cf_color_picker_js'), false, true);
|
248 |
+
wp_enqueue_script('cf_chosen_js', plugin_dir_url( __FILE__ ) . '../admin/js/chosen.jquery.js', array('cf_widget_js'), false, false);
|
249 |
+
wp_enqueue_script('jquery');
|
250 |
+
wp_enqueue_script('cf_color_picker_js');
|
251 |
+
wp_enqueue_script('cf_widget_js');
|
252 |
+
wp_enqueue_script('cf_chosen_js');
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Register the widget into WordPress.
|
258 |
+
*
|
259 |
+
* @since 2.0.0
|
260 |
+
*/
|
261 |
+
public function register_widget() {
|
262 |
+
|
263 |
+
register_widget('Captainform_Widget');
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Evaluates the captainform shortcode if the text widget contains one
|
269 |
+
*
|
270 |
+
* @param $content string Text widget content
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
public function text_widget($content) {
|
274 |
+
|
275 |
+
if(has_shortcode( $content, 'captainform' ) || has_shortcode( $content, 'captain-form' ))
|
276 |
+
return do_shortcode($content);
|
277 |
+
|
278 |
+
return $content;
|
279 |
+
|
280 |
+
}
|
281 |
+
|
282 |
+
}
|
includes/class-captainform.php
ADDED
@@ -0,0 +1,478 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The file that defines the core plugin class
|
5 |
+
*
|
6 |
+
* A class definition that includes attributes and functions used across both the
|
7 |
+
* public-facing side of the site and the admin area.
|
8 |
+
*
|
9 |
+
* @link http://captainform.com
|
10 |
+
* @since 2.0.0
|
11 |
+
*
|
12 |
+
* @package Captainform
|
13 |
+
* @subpackage Captainform/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The core plugin class.
|
18 |
+
*
|
19 |
+
* This is used to define internationalization, admin-specific hooks, and
|
20 |
+
* public-facing site hooks.
|
21 |
+
*
|
22 |
+
* Also maintains the unique identifier of this plugin as well as the current
|
23 |
+
* version of the plugin.
|
24 |
+
*
|
25 |
+
* @since 2.0.0
|
26 |
+
* @package Captainform
|
27 |
+
* @subpackage Captainform/includes
|
28 |
+
* @author captainform <team@captainform.com>
|
29 |
+
*/
|
30 |
+
class Captainform {
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The loader that's responsible for maintaining and registering all hooks that power
|
34 |
+
* the plugin.
|
35 |
+
*
|
36 |
+
* @since 2.0.0
|
37 |
+
* @access protected
|
38 |
+
* @var Captainform_Loader $loader Maintains and registers all hooks for the plugin.
|
39 |
+
*/
|
40 |
+
protected $loader;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* The class that's responsible for maintaining and registering all account settings
|
44 |
+
*
|
45 |
+
* @since 2.0.0
|
46 |
+
* @access protected
|
47 |
+
* @var Captainform_Account $account Maintains and registers all account settings for the plugin.
|
48 |
+
*/
|
49 |
+
protected $account;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The class responsible for defining all actions that occur in the admin area.
|
53 |
+
*
|
54 |
+
* @since 2.0.0
|
55 |
+
* @access protected
|
56 |
+
* @var Captainform_Account $account Maintains and registers all admin functionality.
|
57 |
+
*/
|
58 |
+
protected $admin;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The class that's responsible for maintaining and registering the captainform widget
|
62 |
+
*
|
63 |
+
* @since 2.0.0
|
64 |
+
* @access protected
|
65 |
+
* @var Captainform_Widget $widget Maintains and registers the widget for this plugin.
|
66 |
+
*/
|
67 |
+
protected $widget;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* The class that's responsible for captainform utilities
|
71 |
+
*
|
72 |
+
* @since 2.0.0
|
73 |
+
* @access protected
|
74 |
+
* @var Captainform_Widget $utils Maintains and registers some utilities needed for this plugin.
|
75 |
+
*/
|
76 |
+
protected $utils;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* The unique identifier of this plugin.
|
80 |
+
*
|
81 |
+
* @since 2.0.0
|
82 |
+
* @access protected
|
83 |
+
* @var string $plugin_name The string used to uniquely identify this plugin.
|
84 |
+
*/
|
85 |
+
protected $plugin_name;
|
86 |
+
|
87 |
+
/**
|
88 |
+
* The current version of the plugin.
|
89 |
+
*
|
90 |
+
* @since 2.0.0
|
91 |
+
* @access protected
|
92 |
+
* @var string $version The current version of the plugin.
|
93 |
+
*/
|
94 |
+
protected $version;
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Define the core functionality of the plugin.
|
98 |
+
*
|
99 |
+
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
100 |
+
* Load the dependencies, define the locale, and set the hooks for the admin area and
|
101 |
+
* the public-facing side of the site.
|
102 |
+
*
|
103 |
+
* @since 2.0.0
|
104 |
+
*/
|
105 |
+
public function __construct() {
|
106 |
+
|
107 |
+
$this->plugin_name = 'captainform';
|
108 |
+
$this->version = '2.2.6';
|
109 |
+
|
110 |
+
$this->load_dependencies();
|
111 |
+
$this->set_locale();
|
112 |
+
$this->define_general_hooks();
|
113 |
+
|
114 |
+
if(defined( 'DOING_AJAX' ) && DOING_AJAX)
|
115 |
+
$this->define_ajax_hooks();
|
116 |
+
elseif ( is_admin() )
|
117 |
+
$this->define_admin_hooks();
|
118 |
+
else
|
119 |
+
$this->define_public_hooks();
|
120 |
+
|
121 |
+
$this->define_shortcodes();
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Load the required dependencies for this plugin.
|
126 |
+
*
|
127 |
+
* Include the following files that make up the plugin:
|
128 |
+
*
|
129 |
+
* - Captainform_Loader. Orchestrates the hooks of the plugin.
|
130 |
+
* - Captainform_i18n. Defines internationalization functionality.
|
131 |
+
* - Captainform_Widget. Handles the widgets
|
132 |
+
* - Captainform_Shortcodes. Handles the shortcodes for the public side of the site.
|
133 |
+
* - Captainform_Utils. Various functions needed
|
134 |
+
* - Captainform_Encrypt. Handles the encryption of the params.
|
135 |
+
*
|
136 |
+
* Create an instance of the loader which will be used to register the hooks
|
137 |
+
* with WordPress.
|
138 |
+
*
|
139 |
+
* @since 2.0.0
|
140 |
+
* @access private
|
141 |
+
*/
|
142 |
+
private function load_dependencies() {
|
143 |
+
|
144 |
+
/**
|
145 |
+
* The class responsible for orchestrating the actions and filters of the
|
146 |
+
* core plugin.
|
147 |
+
*/
|
148 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-captainform-loader.php';
|
149 |
+
|
150 |
+
/**
|
151 |
+
* The class responsible for defining internationalization functionality
|
152 |
+
* of the plugin.
|
153 |
+
*/
|
154 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-captainform-i18n.php';
|
155 |
+
|
156 |
+
/**
|
157 |
+
* The class responsible for captainform widget.
|
158 |
+
*/
|
159 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-captainform-widget.php';
|
160 |
+
|
161 |
+
/**
|
162 |
+
* The class responsible for defining all shortcodes
|
163 |
+
*/
|
164 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-captainform-shortcodes.php';
|
165 |
+
|
166 |
+
/**
|
167 |
+
* The class responsible for captainform widget.
|
168 |
+
*/
|
169 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-captainform-utils.php';
|
170 |
+
|
171 |
+
/**
|
172 |
+
* The class responsible for encrypting strings
|
173 |
+
*/
|
174 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/encryption/class-captainform-encrypt.php';
|
175 |
+
|
176 |
+
if (!function_exists('is_plugin_active_for_network') && file_exists(ABSPATH . '/wp-admin/includes/plugin.php'))
|
177 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php');
|
178 |
+
|
179 |
+
if($this->isForgeEnabled()) {
|
180 |
+
/**
|
181 |
+
* The class responsible for captainform forge element
|
182 |
+
*/
|
183 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/integrations/class-captainform-integration-forge-element.php';
|
184 |
+
}
|
185 |
+
|
186 |
+
if(defined( 'DOING_AJAX' ) && DOING_AJAX)
|
187 |
+
$this->load_ajax_dependencies();
|
188 |
+
elseif( is_admin() )
|
189 |
+
$this->load_admin_dependencies();
|
190 |
+
else
|
191 |
+
$this->load_public_dependencies();
|
192 |
+
|
193 |
+
$this->loader = new Captainform_Loader();
|
194 |
+
$this->widget = new Captainform_Widget();
|
195 |
+
$this->utils = new Captainform_Utils();
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Load the required dependencies for the ajax functionality of the plugin.
|
201 |
+
*
|
202 |
+
* Include the following files that make up the plugin:
|
203 |
+
*
|
204 |
+
* - Captainform_Integrations_Handler.
|
205 |
+
* - Captainform_WP_Users
|
206 |
+
* - Captainform_WP_Posts
|
207 |
+
* - Captainform_WP_Submissions
|
208 |
+
*
|
209 |
+
* @since 2.0.0
|
210 |
+
* @access private
|
211 |
+
*/
|
212 |
+
private function load_ajax_dependencies() {
|
213 |
+
|
214 |
+
/**
|
215 |
+
* The class responsible for maintaining and registering all account settings
|
216 |
+
*/
|
217 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/integrations/class-captainform-integration-handler.php';
|
218 |
+
|
219 |
+
/**
|
220 |
+
* The class responsible for the WordPress posts integration
|
221 |
+
*/
|
222 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/integrations/class-captainform-integration-posts.php';
|
223 |
+
|
224 |
+
/**
|
225 |
+
* The class responsible for the WordPress users integration
|
226 |
+
*/
|
227 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/integrations/class-captainform-integration-users.php';
|
228 |
+
|
229 |
+
/**
|
230 |
+
* The class responsible for the WordPress Submissions integration
|
231 |
+
*/
|
232 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/integrations/class-captainform-integration-submissions.php';
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Load the required dependencies for the admin area functionality of the plugin.
|
237 |
+
*
|
238 |
+
* Include the following files that make up the plugin:
|
239 |
+
*
|
240 |
+
* - Captainform_Admin. Defines all hooks for the admin area.
|
241 |
+
* - Captainform_Account. Maintains and registers all account settings.
|
242 |
+
*
|
243 |
+
* @since 2.0.0
|
244 |
+
* @access private
|
245 |
+
*/
|
246 |
+
private function load_admin_dependencies() {
|
247 |
+
|
248 |
+
/**
|
249 |
+
* The class responsible for maintaining and registering all account settings
|
250 |
+
*/
|
251 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-captainform-account.php';
|
252 |
+
|
253 |
+
/**
|
254 |
+
* The class responsible for defining all actions that occur in the admin area.
|
255 |
+
*/
|
256 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-captainform-admin.php';
|
257 |
+
|
258 |
+
$this->admin = new Captainform_Admin( $this->get_plugin_name(), $this->get_version() );
|
259 |
+
$this->account = new Captainform_Account( $this->get_plugin_name(), $this->get_version() );
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Load the required dependencies for the public-facing functionality of the plugin.
|
265 |
+
*
|
266 |
+
* Include the following files that make up the plugin:
|
267 |
+
*
|
268 |
+
* - Captainform_Public. Defines all hooks for the public side of the site.
|
269 |
+
*
|
270 |
+
* @since 2.0.0
|
271 |
+
* @access private
|
272 |
+
*/
|
273 |
+
private function load_public_dependencies() {
|
274 |
+
|
275 |
+
/**
|
276 |
+
* The class responsible for defining all actions that occur in the public-facing
|
277 |
+
* side of the site.
|
278 |
+
*/
|
279 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'public/class-captainform-public.php';
|
280 |
+
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Define the locale for this plugin for internationalization.
|
285 |
+
*
|
286 |
+
* Uses the Captainform_i18n class in order to set the domain and to register the hook
|
287 |
+
* with WordPress.
|
288 |
+
*
|
289 |
+
* @since 2.0.0
|
290 |
+
* @access private
|
291 |
+
*/
|
292 |
+
private function set_locale() {
|
293 |
+
|
294 |
+
$plugin_i18n = new Captainform_i18n();
|
295 |
+
|
296 |
+
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
297 |
+
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Register all of the hooks related both to the public-facing functionality and the admin area functionality
|
302 |
+
* of the plugin.
|
303 |
+
*
|
304 |
+
* @since 2.0.0
|
305 |
+
* @access private
|
306 |
+
*/
|
307 |
+
private function define_general_hooks() {
|
308 |
+
|
309 |
+
$php_version = phpversion();
|
310 |
+
if ($php_version >= 5.3) {
|
311 |
+
$this->loader->add_action( 'widgets_init', $this->widget, 'register_widget' );
|
312 |
+
} else if ($php_version >= 5.2) {
|
313 |
+
add_action(
|
314 |
+
'widgets_init',
|
315 |
+
create_function('', 'return register_widget("Captainform_Widget");')
|
316 |
+
);
|
317 |
+
}
|
318 |
+
|
319 |
+
$this->loader->add_action( 'init', $this->utils, 'register_post_type' );
|
320 |
+
$this->loader->add_action( 'init', $this->utils, 'session_start' );
|
321 |
+
$this->loader->add_action( 'init', $this->utils, 'add_jquery' );
|
322 |
+
|
323 |
+
if($this->isForgeEnabled()){
|
324 |
+
$forge = new Captainform_ForgeElement($this->get_plugin_name(), $this->get_version());
|
325 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $forge, 'enqueue_styles' );
|
326 |
+
$this->loader->add_filter( 'forge_elements', $forge, 'forge_element_metadata' );
|
327 |
+
}
|
328 |
+
|
329 |
+
$this->loader->add_action( 'admin_print_scripts-widgets.php', $this->widget, 'enqueue_styles' );
|
330 |
+
$this->loader->add_action( 'admin_print_scripts-widgets.php', $this->widget, 'enqueue_scripts' );
|
331 |
+
|
332 |
+
$this->loader->add_filter('autoptimize_filter_js_exclude', $this->utils, 'autoptimize_override_js_exclude');
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Register all of the hooks related to the admin area functionality
|
337 |
+
* of the plugin.
|
338 |
+
*
|
339 |
+
* @since 2.0.0
|
340 |
+
* @access private
|
341 |
+
*/
|
342 |
+
private function define_admin_hooks() {
|
343 |
+
|
344 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'enqueue_styles' );
|
345 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'enqueue_scripts' );
|
346 |
+
$this->loader->add_action( 'admin_menu', $this->admin, 'add_menu_items' );
|
347 |
+
$this->loader->add_action( 'admin_menu', $this->admin, 'register_settings' );
|
348 |
+
|
349 |
+
$this->loader->add_action( 'init', $this->utils, 'ob_start' );
|
350 |
+
|
351 |
+
$this->loader->add_action( 'wp_ajax_captainform_insert_dialog', $this->admin, 'mce_insert_dialog' );
|
352 |
+
|
353 |
+
if (in_array($this->plugin_name . '/' . $this->plugin_name . '.php', get_option('active_plugins')) ||
|
354 |
+
(function_exists('is_plugin_active_for_network') && is_plugin_active_for_network($this->plugin_name . '/' . $this->plugin_name . '.php'))) {
|
355 |
+
|
356 |
+
$this->loader->add_action('media_buttons', $this->admin, 'add_captainform_media_button');
|
357 |
+
$this->loader->add_filter('wp_enqueue_media', $this->admin, 'register_media_scripts');
|
358 |
+
}
|
359 |
+
$this->loader->add_action( 'init', $this->account, 'check_account_settings' );
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Register all of the hooks related to the public-facing functionality
|
364 |
+
* of the plugin.
|
365 |
+
*
|
366 |
+
* @since 2.0.0
|
367 |
+
* @access private
|
368 |
+
*/
|
369 |
+
private function define_public_hooks() {
|
370 |
+
|
371 |
+
$plugin_public = new Captainform_Public( $this->get_plugin_name(), $this->get_version() );
|
372 |
+
|
373 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
|
374 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
|
375 |
+
|
376 |
+
$this->loader->add_filter( 'widget_text', $this->widget, 'text_widget' );
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Register all of the hooks related to WordPress ajax
|
381 |
+
*
|
382 |
+
* @since 2.0.0
|
383 |
+
* @access private
|
384 |
+
*/
|
385 |
+
private function define_ajax_hooks() {
|
386 |
+
/**
|
387 |
+
* The class responsible for defining all actions that occur in the admin area.
|
388 |
+
*/
|
389 |
+
require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-captainform-admin.php';
|
390 |
+
|
391 |
+
$this->admin = new Captainform_Admin( $this->get_plugin_name(), $this->get_version() );
|
392 |
+
$this->loader->add_action( 'wp_ajax_captainform_insert_dialog', $this->admin, 'mce_insert_dialog' );
|
393 |
+
|
394 |
+
foreach(Captainform_WP_Posts::get_integration_hooks() as $hook => $action){
|
395 |
+
add_action('wp_ajax_' . $hook, array('Captainform_WP_Posts', $action));
|
396 |
+
add_action('wp_ajax_nopriv_' . $hook, array('Captainform_WP_Posts', $action));
|
397 |
+
}
|
398 |
+
|
399 |
+
foreach(Captainform_WP_Users::get_integration_hooks() as $hook => $action){
|
400 |
+
add_action('wp_ajax_' . $hook, array('Captainform_WP_Users', $action));
|
401 |
+
add_action('wp_ajax_nopriv_' . $hook, array('Captainform_WP_Users', $action));
|
402 |
+
}
|
403 |
+
|
404 |
+
foreach(Captainform_WP_Submissions::get_integration_hooks() as $hook => $action){
|
405 |
+
add_action('wp_ajax_' . $hook, array('Captainform_WP_Submissions', $action));
|
406 |
+
add_action('wp_ajax_nopriv_' . $hook, array('Captainform_WP_Submissions', $action));
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Register all the shortcodes
|
412 |
+
* of the plugin.
|
413 |
+
*
|
414 |
+
* @since 2.0.0
|
415 |
+
* @access private
|
416 |
+
*/
|
417 |
+
private function define_shortcodes() {
|
418 |
+
|
419 |
+
$plugin_shortcodes = new Captainform_Shortcodes( $this->get_plugin_name(), $this->get_version() );
|
420 |
+
|
421 |
+
$this->loader->add_shortcode( 'captainform', $plugin_shortcodes, 'evaluate' );
|
422 |
+
$this->loader->add_shortcode( 'captain-form', $plugin_shortcodes, 'evaluate' );
|
423 |
+
$this->loader->add_filter( 'the_excerpt', $plugin_shortcodes, 'evaluate_excerpt' );
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Run the loader to execute all of the hooks with WordPress.
|
428 |
+
*
|
429 |
+
* @since 2.0.0
|
430 |
+
*/
|
431 |
+
public function run() {
|
432 |
+
$this->loader->run();
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Check whether or not Forge plugin is enabled
|
437 |
+
*
|
438 |
+
* @since 2.0.0
|
439 |
+
* @return bool
|
440 |
+
*/
|
441 |
+
private function isForgeEnabled(){
|
442 |
+
return
|
443 |
+
in_array('forge/forge.php', get_option('active_plugins')) ||
|
444 |
+
(function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('forge/forge.php'));
|
445 |
+
}
|
446 |
+
|
447 |
+
/**
|
448 |
+
* The name of the plugin used to uniquely identify it within the context of
|
449 |
+
* WordPress and to define internationalization functionality.
|
450 |
+
*
|
451 |
+
* @since 2.0.0
|
452 |
+
* @return string The name of the plugin.
|
453 |
+
*/
|
454 |
+
public function get_plugin_name() {
|
455 |
+
return $this->plugin_name;
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* The reference to the class that orchestrates the hooks with the plugin.
|
460 |
+
*
|
461 |
+
* @since 2.0.0
|
462 |
+
* @return Captainform_Loader Orchestrates the hooks of the plugin.
|
463 |
+
*/
|
464 |
+
public function get_loader() {
|
465 |
+
return $this->loader;
|
466 |
+
}
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Retrieve the version number of the plugin.
|
470 |
+
*
|
471 |
+
* @since 2.0.0
|
472 |
+
* @return string The version number of the plugin.
|
473 |
+
*/
|
474 |
+
public function get_version() {
|
475 |
+
return $this->version;
|
476 |
+
}
|
477 |
+
|
478 |
+
}
|
includes/css/form_popup.css
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
*{
|
2 |
-
outline: none;
|
3 |
-
}
|
4 |
-
|
5 |
-
.captainform_popup_bg_form{
|
6 |
-
position: fixed;
|
7 |
-
top: 0px;
|
8 |
-
left: 0px;
|
9 |
-
width: 100%;
|
10 |
-
height: 100%;
|
11 |
-
box-sizing: border-box;
|
12 |
-
background: url(../images/black-50.png);
|
13 |
-
display: none;
|
14 |
-
z-index: 9999990;
|
15 |
-
/*background-color: rgba(241, 241, 241,0.9);*/
|
16 |
-
}
|
17 |
-
|
18 |
-
.captainform_popup_box_form{
|
19 |
-
display: block;
|
20 |
-
/* overflow: hidden;*/
|
21 |
-
position: absolute;
|
22 |
-
width: 500px;
|
23 |
-
height: 250px;
|
24 |
-
max-height: 100%;
|
25 |
-
max-width: 100%;
|
26 |
-
box-sizing: border-box;
|
27 |
-
margin: auto;
|
28 |
-
top: 0; left: 0; bottom: 0; right: 0;
|
29 |
-
font-family: Arial;
|
30 |
-
font-size: 14px;
|
31 |
-
background: white;
|
32 |
-
/* border: solid 0px #868686;*/
|
33 |
-
border-radius: 4px;
|
34 |
-
border: none!important;
|
35 |
-
padding: 8px!important;
|
36 |
-
padding-bottom: 8px!important;
|
37 |
-
display: none;
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
.captainform_loader_form{
|
42 |
-
display: block;
|
43 |
-
overflow: hidden;
|
44 |
-
position: absolute;
|
45 |
-
width: 128px;
|
46 |
-
height: 128px;
|
47 |
-
box-sizing: border-box;
|
48 |
-
margin: auto;
|
49 |
-
top: 0; left: 0; bottom: 0; right: 0;
|
50 |
-
background: transparent url('../images/ring.svg') no-repeat center center;
|
51 |
-
/*background-size: 128px auto;*/
|
52 |
-
}
|
53 |
-
|
54 |
-
.captainform_popup_body_form{
|
55 |
-
display: block;
|
56 |
-
overflow: hidden;
|
57 |
-
box-sizing: border-box;
|
58 |
-
overflow-y: auto;
|
59 |
-
max-height: 1000px;
|
60 |
-
background: white;
|
61 |
-
padding: 0!important;
|
62 |
-
margin: 0!important;
|
63 |
-
line-height: normal!important;
|
64 |
-
/*-webkit-overflow-scrolling: touch;*/
|
65 |
-
}
|
66 |
-
|
67 |
-
.captainform_popup_close_form{
|
68 |
-
position: absolute;
|
69 |
-
box-sizing: border-box;
|
70 |
-
right: -22px;
|
71 |
-
top: -22px;
|
72 |
-
width: 28px!important;
|
73 |
-
height: 28px!important;
|
74 |
-
background-repeat: no-repeat;
|
75 |
-
background-position: 5px center;
|
76 |
-
background-image: url(../images/icon-alert-close.png);
|
77 |
-
border-radius: 50%;
|
78 |
-
cursor: pointer;
|
79 |
-
background-color: #313131;
|
80 |
-
border: solid 2px white;
|
81 |
-
overflow: hidden;
|
82 |
-
/* display: none;*/
|
83 |
-
}
|
84 |
-
|
85 |
-
.close_cnt{
|
86 |
-
display: block!important;
|
87 |
-
box-sizing: border-box;
|
88 |
-
overflow: visible!important;
|
89 |
-
position: relative!important;
|
90 |
-
height: 0px!important;
|
91 |
-
padding: 0!important;
|
92 |
-
margin: 0!important;
|
93 |
-
width: 100%;
|
94 |
-
}
|
95 |
-
|
96 |
-
.popup_iframe_form{
|
97 |
-
width:100%;
|
98 |
-
overflow: hidden;
|
99 |
-
border:none;
|
100 |
-
margin: 0!important;
|
101 |
-
padding: 0!important;
|
102 |
-
box-sizing: border-box;
|
103 |
-
/*background: #EFEFEF;*/
|
104 |
-
}
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/css/publish_lightbox_posts.css
DELETED
@@ -1,150 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* CSS for the CaptainForm popup from Posts and Pages
|
3 |
-
*/
|
4 |
-
body {
|
5 |
-
overflow: hidden;
|
6 |
-
}
|
7 |
-
|
8 |
-
.captainform_body_class {
|
9 |
-
overflow: visible;
|
10 |
-
}
|
11 |
-
|
12 |
-
.captainform_spinner {
|
13 |
-
width: 100%;
|
14 |
-
text-align: center;
|
15 |
-
display: inline-block;
|
16 |
-
}
|
17 |
-
|
18 |
-
.captainform_widget_container {
|
19 |
-
font-family: Arial;
|
20 |
-
font-size: 14px;
|
21 |
-
width: 100%;
|
22 |
-
float: left;
|
23 |
-
display: inline-block;
|
24 |
-
}
|
25 |
-
|
26 |
-
#captainform-insert-dialog-body,
|
27 |
-
.captainform_widget_container,
|
28 |
-
.captainform_widget_container b,
|
29 |
-
.captainform_widget_container p,
|
30 |
-
.captainform_widget_container div,
|
31 |
-
.captainform_widget_container span {
|
32 |
-
white-space: normal !important;
|
33 |
-
}
|
34 |
-
|
35 |
-
#captainform_form_toembed,
|
36 |
-
#captainform_form_toembed_chosen {
|
37 |
-
margin-right: 5px;
|
38 |
-
margin-top: 15px;
|
39 |
-
float: left;
|
40 |
-
min-height: 25px;
|
41 |
-
min-width: 100px;
|
42 |
-
min-width: initial;
|
43 |
-
}
|
44 |
-
|
45 |
-
#captainform_form_toembed_chosen .chosen-single {
|
46 |
-
background: url('../images/dropdownarrow.png');
|
47 |
-
background-position: right 5px center;
|
48 |
-
background-repeat: no-repeat;
|
49 |
-
background-size: 10px;
|
50 |
-
}
|
51 |
-
|
52 |
-
#captainform_form_toembed_button {
|
53 |
-
margin-top: 15px;
|
54 |
-
height: 25px;
|
55 |
-
background: #25a7c1;
|
56 |
-
color: #fff;
|
57 |
-
font-weight: 600;
|
58 |
-
border-radius: 3px;
|
59 |
-
}
|
60 |
-
|
61 |
-
.captainform_widget_container input[type=text]{
|
62 |
-
border-radius: 3px;
|
63 |
-
border: 1px solid #b6b6b6;
|
64 |
-
color: #303030;
|
65 |
-
font-size: 14px;
|
66 |
-
height: auto;
|
67 |
-
padding: 7px;
|
68 |
-
width: 300px;
|
69 |
-
border-top: 1px solid #b6b6b6;
|
70 |
-
border-left: 1px solid #b6b6b6;
|
71 |
-
border-bottom: 1px solid #dadada;
|
72 |
-
border-right: 1px solid #dadada;
|
73 |
-
outline: 0;
|
74 |
-
}
|
75 |
-
|
76 |
-
.cf_trigger_option {
|
77 |
-
padding: 5px;
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
-
.cf_trigger_selected_option_container .left {
|
82 |
-
width: 30%;
|
83 |
-
}
|
84 |
-
|
85 |
-
.cf_trigger_selected_option_container .right {
|
86 |
-
width: 70%;
|
87 |
-
}
|
88 |
-
|
89 |
-
.cf_trigger_selected_option_container .right input[type=text] {
|
90 |
-
width: 100%;
|
91 |
-
}
|
92 |
-
|
93 |
-
.cf_trigger_selected_option_container {
|
94 |
-
padding: 0 10px;
|
95 |
-
}
|
96 |
-
|
97 |
-
.cf_trigger_2_time {
|
98 |
-
width: 80px !important;
|
99 |
-
}
|
100 |
-
|
101 |
-
.lightbox_trigger {
|
102 |
-
padding: 0px;
|
103 |
-
}
|
104 |
-
|
105 |
-
#captainform_form_toembed_button {
|
106 |
-
display: inline-block;
|
107 |
-
float: left;
|
108 |
-
background: #25A7C1 !important;
|
109 |
-
box-shadow: 0px 2px 0px 0.00px #005a70;
|
110 |
-
color: #FFF;
|
111 |
-
cursor: pointer;
|
112 |
-
border-radius: 3px !important;
|
113 |
-
-moz-border-radius: 3px !important;
|
114 |
-
-webkit-border-radius: 3px !important;
|
115 |
-
padding: 0px 15px 0px 15px;
|
116 |
-
color: #FFFFFF;
|
117 |
-
font-weight: bold;
|
118 |
-
font-size: 14px;
|
119 |
-
height: 29px;
|
120 |
-
line-height: 30px;
|
121 |
-
}
|
122 |
-
|
123 |
-
.captainform_seconds {
|
124 |
-
float: left;
|
125 |
-
padding: 6px;
|
126 |
-
}
|
127 |
-
|
128 |
-
.cf_trigger_selected_option.cf_trigger_2_time {
|
129 |
-
float: left;
|
130 |
-
}
|
131 |
-
|
132 |
-
.chosen-single {
|
133 |
-
height: 29px !important;
|
134 |
-
}
|
135 |
-
|
136 |
-
.chosen-single span:first-child {
|
137 |
-
line-height: 30px !important;
|
138 |
-
}
|
139 |
-
|
140 |
-
#captainform-insert-dialog-body {
|
141 |
-
overflow: hidden;
|
142 |
-
overflow-y: visible;
|
143 |
-
padding: 10px;
|
144 |
-
box-sizing: border-box;
|
145 |
-
}
|
146 |
-
|
147 |
-
#captainform_publish_lightbox_main_container {
|
148 |
-
width: 100%;
|
149 |
-
float: left;
|
150 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/display-functions.php
DELETED
@@ -1,283 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
/*our display functions for outputting information*/
|
4 |
-
$custom_vars = null;
|
5 |
-
function captainform_add_content($content)
|
6 |
-
{
|
7 |
-
$content = captainform_text_filter($content);
|
8 |
-
return $content;
|
9 |
-
}
|
10 |
-
|
11 |
-
function captainform_filter_summary($content)
|
12 |
-
{
|
13 |
-
$content = captainform_text_filter($content, NULL, NULL, true);
|
14 |
-
return $content;
|
15 |
-
}
|
16 |
-
|
17 |
-
add_filter('the_content', 'captainform_add_content');
|
18 |
-
add_filter('post_content', 'captainform_add_content');
|
19 |
-
add_filter('the_excerpt', 'captainform_filter_summary');
|
20 |
-
|
21 |
-
function captainform_get_custom_vars_from_shortcode($shortcode)
|
22 |
-
{
|
23 |
-
$custom_vars_string = '';
|
24 |
-
|
25 |
-
preg_match_all('/cf_custom_var([\\d-]+)=(\'[^\']+\'|"[^"]+")/', $shortcode, $matches, PREG_SET_ORDER);
|
26 |
-
if (count($matches))
|
27 |
-
foreach ($matches as $custom_var)
|
28 |
-
if (isset($custom_var[1]) && !empty($custom_var[1]) && isset($custom_var[2]) && !empty($custom_var[2]))
|
29 |
-
$custom_vars_string .= '&control' . $custom_var[1] . '=' . urlencode(substr($custom_var[2], 1, -1));
|
30 |
-
|
31 |
-
return $custom_vars_string;
|
32 |
-
}
|
33 |
-
|
34 |
-
function captainform_get_custom_vars_from_url()
|
35 |
-
{
|
36 |
-
$custom_vars_string = '';
|
37 |
-
|
38 |
-
foreach ($_GET as $key => $value) {
|
39 |
-
if (strpos($key, 'control') !== false) {
|
40 |
-
$custom_vars_string .= '&' . $key . '=' . $value;
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
return $custom_vars_string;
|
45 |
-
}
|
46 |
-
|
47 |
-
function captainform_get_custom_vars($shortcode, $extra_vars)
|
48 |
-
{
|
49 |
-
$custom_vars_string = '';
|
50 |
-
$custom_vars_string .= captainform_get_custom_vars_from_shortcode($shortcode);
|
51 |
-
$custom_vars_string .= captainform_get_custom_vars_from_url();
|
52 |
-
if (gettype($extra_vars) == "array" && count($extra_vars)) {
|
53 |
-
foreach ($extra_vars as $key => $value)
|
54 |
-
$custom_vars_string .= '&' . $key . '=' . $value;
|
55 |
-
} elseif (strlen($extra_vars))
|
56 |
-
$custom_vars_string .= $extra_vars;
|
57 |
-
|
58 |
-
if (strlen($custom_vars_string))
|
59 |
-
$custom_vars_string .= '&embeddingCustomVars=true';
|
60 |
-
|
61 |
-
return $custom_vars_string;
|
62 |
-
}
|
63 |
-
|
64 |
-
function captainform_replace_pattern($matches)
|
65 |
-
{
|
66 |
-
global $custom_vars;
|
67 |
-
$shortcode = $matches[1];
|
68 |
-
|
69 |
-
$captainform_theme_style = '';
|
70 |
-
if (isset($_GET['captainform_theme_style'])) {
|
71 |
-
wp_register_script('captainform_iframe_resizer_win', plugins_url('/includes/js/iframeResizer.contentWindow.min.js', __DIR__), array(), '3.5', false);
|
72 |
-
wp_enqueue_script('captainform_iframe_resizer_win');
|
73 |
-
wp_register_script('nolink', plugins_url('/includes/js/nolink.js', __DIR__), array(), uniqid(), false);
|
74 |
-
wp_enqueue_script('nolink');
|
75 |
-
//wp_enqueue_style('hide_adminbar', plugins_url('/includes/css/hide_adminbar.css', __DIR__), false, uniqid());
|
76 |
-
$captainform_theme_style = '&style=' . $_GET['captainform_theme_style'];
|
77 |
-
}
|
78 |
-
|
79 |
-
$type_regex = '/\[[^\[]*captain-?form*.*type=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
80 |
-
$lightbox_regex = '/\[[^\[]*captain-?form.*lightbox=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
81 |
-
|
82 |
-
$content_regex = "/\\[[^\\[]*captain-?form.*content=[\\',\"]{1}([^'\"]+)[\\'\"]{1}[^\\]]*\\]/i";
|
83 |
-
$text_content_regex = '/\[[^\[]*captain-?form.*text_content=[\',"]{1}([^\'"]+)[\'"]{1}[^\]]*\]/';
|
84 |
-
|
85 |
-
$url_regex = '/\[[^\[]*captain-?form.*url=[\',"]{1}([a-zA-Z0-9\/\-_\.\s\:\?\=]+)[\',"]{1}[^\]]*\]/';
|
86 |
-
$miliseconds_regex = '/\[[^\[]*captain-?form.*miliseconds=[\',"]{1}([0-9]+)[\',"]{1}[^\]]*\]/';
|
87 |
-
$text_color_regex = '/\[[^\[]*captain-?form.*text_color=[\',"]{1}([a-zA-Z0-9]+)[\',"]{1}[^\]]*\]/';
|
88 |
-
$bg_color_regex = '/\[[^\[]*captain-?form.*bg_color=[\',"]{1}([a-zA-Z0-9]+)[\',"]{1}[^\]]*\]/';
|
89 |
-
$position_regex = '/\[[^\[]*captain-?form.*position=[\',"]{1}([a-zA-Z]+)[\',"]{1}[^\]]*\]/';
|
90 |
-
|
91 |
-
preg_match($type_regex, $shortcode, $matches_type);
|
92 |
-
preg_match($lightbox_regex, $shortcode, $matches_lightbox);
|
93 |
-
preg_match($content_regex, $shortcode, $matches_content);
|
94 |
-
preg_match($text_content_regex, $shortcode, $matches_text_content);
|
95 |
-
preg_match($url_regex, $shortcode, $matches_url);
|
96 |
-
preg_match($miliseconds_regex, $shortcode, $matches_miliseconds);
|
97 |
-
preg_match($text_color_regex, $shortcode, $matches_text_color);
|
98 |
-
preg_match($bg_color_regex, $shortcode, $matches_bg_color);
|
99 |
-
preg_match($position_regex, $shortcode, $matches_position);
|
100 |
-
|
101 |
-
$shortcode_option_type = isset($matches_type[1]) ? $matches_type[1] : null;
|
102 |
-
$shortcode_option_lightbox = isset($matches_lightbox[1]) ? $matches_lightbox[1] : null;
|
103 |
-
$shortcode_option_content = isset($matches_content[1]) ? urldecode($matches_content[1]) : null;
|
104 |
-
$shortcode_option_text_content = isset($matches_text_content[1]) ? urldecode($matches_text_content[1]) : null;
|
105 |
-
$shortcode_option_url = isset($matches_url[1]) ? $matches_url[1] : null;
|
106 |
-
$shortcode_option_miliseconds = isset($matches_miliseconds[1]) ? $matches_miliseconds[1] : null;
|
107 |
-
$shortcode_option_text_color = isset($matches_text_color[1]) ? $matches_text_color[1] : '';
|
108 |
-
$shortcode_option_bg_color = isset($matches_bg_color[1]) ? $matches_bg_color[1] : '';
|
109 |
-
$shortcode_option_position = isset($matches_position[1]) ? $matches_position[1] : '';
|
110 |
-
|
111 |
-
if (isset($_GET['cf_form_id']) && isset($_GET['captainform_theme_style'])) {
|
112 |
-
if (intval($_GET['cf_form_id']) && is_numeric($matches[4]) && $_GET['cf_form_id'] !== intval($matches[4])) {
|
113 |
-
echo 'Form hidden in preview mode.';
|
114 |
-
return '';
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
$custom_vars_string = captainform_get_custom_vars($shortcode, $custom_vars);
|
119 |
-
|
120 |
-
$form_id = 0;
|
121 |
-
if (is_numeric($matches[4]))
|
122 |
-
$form_id = intval($matches[4]);
|
123 |
-
elseif ($matches[4] == '{cf_form_id}') {
|
124 |
-
if (isset($_GET['cf_form_id']) && intval($_GET['cf_form_id'])) {
|
125 |
-
$form_id = intval($_GET['cf_form_id']);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
if (!$form_id)
|
130 |
-
return '';
|
131 |
-
|
132 |
-
$button_style = '';
|
133 |
-
$content = 'Contact Us';
|
134 |
-
|
135 |
-
$options = array(
|
136 |
-
'id' => $form_id,
|
137 |
-
'style' => $captainform_theme_style,
|
138 |
-
'customVars' => isset($custom_vars_string) ? $custom_vars_string : "",
|
139 |
-
);
|
140 |
-
|
141 |
-
$pattern_type = $GLOBALS['captainform_formcode_pattern'];
|
142 |
-
|
143 |
-
if ($shortcode_option_lightbox == 1 || isset($_GET['captainform_preview_as_lightbox'])) {
|
144 |
-
$miliseconds = 3000;
|
145 |
-
|
146 |
-
if (isset($_GET['captainform_preview_as_lightbox'])) {
|
147 |
-
$shortcode_option_type = 'auto-popup';
|
148 |
-
$miliseconds = 1000;
|
149 |
-
}
|
150 |
-
|
151 |
-
if (isset($GLOBALS['captainform_formcode_pattern_lightbox']))
|
152 |
-
$pattern_type = $GLOBALS['captainform_formcode_pattern_lightbox'];
|
153 |
-
|
154 |
-
if (strlen(trim($shortcode_option_text_content))) {
|
155 |
-
$content = $shortcode_option_text_content;
|
156 |
-
} else if (strlen(trim($shortcode_option_content))) {
|
157 |
-
$content = $shortcode_option_content;
|
158 |
-
}
|
159 |
-
|
160 |
-
switch ($shortcode_option_type) {
|
161 |
-
case 'text':
|
162 |
-
break;
|
163 |
-
case 'image':
|
164 |
-
if (strlen(trim($shortcode_option_url))) {
|
165 |
-
$content = '<img border="0" src="' . $shortcode_option_url . '" />';
|
166 |
-
}
|
167 |
-
break;
|
168 |
-
case 'floating-button':
|
169 |
-
if ($shortcode_option_position == 'right') {
|
170 |
-
$pos = 2;
|
171 |
-
$extra_style = 'right: 0; top: 40%;';
|
172 |
-
} elseif ($shortcode_option_position == 'left') {
|
173 |
-
$pos = 1;
|
174 |
-
$extra_style = 'left: 0; top: 40%;';
|
175 |
-
} elseif ($shortcode_option_position == 'bottom') {
|
176 |
-
$pos = 3;
|
177 |
-
$extra_style = 'right: 20%; bottom: 0;';
|
178 |
-
} else {
|
179 |
-
$pos = 1;
|
180 |
-
$extra_style = 'left: 0; top: 0; bottom: 0;';
|
181 |
-
}
|
182 |
-
|
183 |
-
$button_style = 'style="outline:0; text-decoration:none; color:transparent; display:scroll ;z-index:10; border: none; position:fixed; ' . $extra_style . '"';
|
184 |
-
$content = '<img style="box-shadow: none;" border="0" src="https://' . $GLOBALS['captainform_servicedomain'] . '/verticalbutton2.php?bg=' . $shortcode_option_bg_color . '&fnt=' . $shortcode_option_text_color . '&pos=' . $pos . '&text=' . $content . '&font=arialblk" />';
|
185 |
-
break;
|
186 |
-
case 'auto-popup':
|
187 |
-
if (strlen(trim($shortcode_option_miliseconds))) {
|
188 |
-
$miliseconds = intval($shortcode_option_miliseconds);
|
189 |
-
}
|
190 |
-
if (isset($GLOBALS['captainform_formcode_pattern_lightbox_auto']))
|
191 |
-
$pattern_type = $GLOBALS['captainform_formcode_pattern_lightbox_auto'];
|
192 |
-
break;
|
193 |
-
default:
|
194 |
-
break;
|
195 |
-
}
|
196 |
-
|
197 |
-
$options = array(
|
198 |
-
'id' => $form_id,
|
199 |
-
'button_style' => $button_style,
|
200 |
-
'content' => $content,
|
201 |
-
'miliseconds' => $miliseconds,
|
202 |
-
'customVars' => isset($custom_vars_string) ? $custom_vars_string : "",
|
203 |
-
'style' => $captainform_theme_style
|
204 |
-
);
|
205 |
-
}
|
206 |
-
|
207 |
-
$formcode = captainform_replace_patterns($pattern_type, $options);
|
208 |
-
return $formcode;
|
209 |
-
}
|
210 |
-
|
211 |
-
function captainform_remove_pattern()
|
212 |
-
{
|
213 |
-
return '';
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* parse content and replace plugin short tag with correct code
|
218 |
-
* @param string
|
219 |
-
* @return string
|
220 |
-
**/
|
221 |
-
function captainform_text_filter($content, $custom_vars = "", $custom_options = array(), $summary = false)
|
222 |
-
{
|
223 |
-
$GLOBALS['custom_vars'] = $custom_vars;
|
224 |
-
|
225 |
-
$pattern = '/(\[[^\[]*(captain-?form).*(id?|i)=?"?([0-9]+|{cf_form_id})"?[^\]]*\])/';
|
226 |
-
if ($summary === true)
|
227 |
-
return preg_replace_callback($pattern, 'captainform_remove_pattern', $content);
|
228 |
-
else
|
229 |
-
return preg_replace_callback($pattern, 'captainform_replace_pattern', $content);
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* add editor button for select forms
|
234 |
-
* */
|
235 |
-
// Makes sure the plugin is defined before trying to use it
|
236 |
-
if (!function_exists('is_plugin_active_for_network')) {
|
237 |
-
require_once(ABSPATH . '/wp-admin/includes/plugin.php');
|
238 |
-
}
|
239 |
-
|
240 |
-
//show editor toolbar icon only if plugin is active
|
241 |
-
if (in_array($captainform_plugin_name . '/' . $captainform_plugin_name . '.php', get_option('active_plugins')) || is_plugin_active_for_network($captainform_plugin_name . '/' . $captainform_plugin_name . '.php'))
|
242 |
-
add_filter('mce_buttons', 'captainform_add_button', 0);
|
243 |
-
|
244 |
-
function captainform_add_button($buttons)
|
245 |
-
{
|
246 |
-
array_push($buttons, 'separator', 'captainform');
|
247 |
-
return $buttons;
|
248 |
-
}
|
249 |
-
|
250 |
-
|
251 |
-
if (!function_exists('captain_form')) {
|
252 |
-
|
253 |
-
|
254 |
-
function captain_form($id, $custom_options = array())
|
255 |
-
{
|
256 |
-
$custom_vars = isset($custom_options['custom_vars']) ? $custom_options['custom_vars'] : '';
|
257 |
-
|
258 |
-
$shortcode_final = '[captainform id="' . $id . '" ';
|
259 |
-
$shortcode_final .= (isset($custom_options['lightbox'])) ? "lightbox='{$custom_options['lightbox']}'" : '';
|
260 |
-
$shortcode_final .= (isset($custom_options['type'])) ? "type='{$custom_options['type']}'" : '';
|
261 |
-
$shortcode_final .= (isset($custom_options['url'])) ? "url='{$custom_options['url']}'" : '';
|
262 |
-
if (isset($custom_options['text_content']))
|
263 |
-
$shortcode_final .= "text_content='" . $custom_options['text_content'] . "'";
|
264 |
-
else
|
265 |
-
$shortcode_final .= (isset($custom_options['content'])) ? "content='{$custom_options['content']}'" : '';
|
266 |
-
$shortcode_final .= (isset($custom_options['miliseconds'])) ? "miliseconds='{$custom_options['miliseconds']}'" : '';
|
267 |
-
$shortcode_final .= (isset($custom_options['text_color'])) ? "text_color='{$custom_options['text_color']}'" : '';
|
268 |
-
$shortcode_final .= (isset($custom_options['bg_color'])) ? "bg_color='{$custom_options['bg_color']}'" : '';
|
269 |
-
$shortcode_final .= (isset($custom_options['position'])) ? "position='{$custom_options['position']}'" : '';
|
270 |
-
|
271 |
-
$shortcode_final .= ']';
|
272 |
-
|
273 |
-
if ($custom_vars != "") {
|
274 |
-
if (gettype($custom_vars) == "array") {
|
275 |
-
$custom_vars = http_build_query($custom_vars);
|
276 |
-
}
|
277 |
-
}
|
278 |
-
return captainform_widget_text_filter($shortcode_final, $custom_vars);
|
279 |
-
}
|
280 |
-
|
281 |
-
//Allow captain_form() function to be called from any file
|
282 |
-
register_activation_hook(__FILE__, 'captain_form');
|
283 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/{encryption.php → encryption/class-captainform-encrypt.php}
RENAMED
@@ -1,6 +1,25 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
{
|
5 |
public static $cryptKey = 'q923Mr!x';
|
6 |
|
@@ -91,22 +110,4 @@ class captainform_encrytion
|
|
91 |
{
|
92 |
return substr($string, $count);
|
93 |
}
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* encrypt params
|
98 |
-
* @param string
|
99 |
-
**/
|
100 |
-
function captainform_wpp_encrypt($str)
|
101 |
-
{
|
102 |
-
return captainform_encrytion::encrypt($str);
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* decrypt params
|
107 |
-
* @param string
|
108 |
-
**/
|
109 |
-
function captainform_wpp_decrypt($str)
|
110 |
-
{
|
111 |
-
return captainform_encrytion::decrypt($str);
|
112 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* The file that defines the encryption class
|
4 |
+
*
|
5 |
+
* A class definition that encrypts the parameters used in the admin area.
|
6 |
+
*
|
7 |
+
* @link http://captainform.com
|
8 |
+
* @since 2.0.0
|
9 |
+
*
|
10 |
+
* @package Captainform
|
11 |
+
* @subpackage Captainform/includes/encryption
|
12 |
+
*/
|
13 |
|
14 |
+
/**
|
15 |
+
* This class is responsible for encrypting the parameters used in the admin area
|
16 |
+
*
|
17 |
+
* @since 2.0.0
|
18 |
+
* @package Captainform
|
19 |
+
* @subpackage Captainform/includes/encryption
|
20 |
+
* @author captainform <team@captainform.com>
|
21 |
+
*/
|
22 |
+
class Captainform_Encrypt
|
23 |
{
|
24 |
public static $cryptKey = 'q923Mr!x';
|
25 |
|
110 |
{
|
111 |
return substr($string, $count);
|
112 |
}
|
113 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/form-resources/global-vars.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<script type="text/javascript">
|
2 |
-
var captainformDomReady=function(e){var t=!1,n=function(){document.addEventListener?(document.removeEventListener("DOMContentLoaded",d),window.removeEventListener("load",d)):(document.detachEvent("onreadystatechange",d),window.detachEvent("onload",d))},d=function(){t||!document.addEventListener&&"load"!==event.type&&"complete"!==document.readyState||(t=!0,n(),e())};if("complete"===document.readyState)e();else if(document.addEventListener)document.addEventListener("DOMContentLoaded",d),window.addEventListener("load",d);else{document.attachEvent("onreadystatechange",d),window.attachEvent("onload",d);var o=!1;try{o=null==window.frameElement&&document.documentElement}catch(a){}o&&o.doScroll&&!function c(){if(!t){try{o.doScroll("left")}catch(d){return setTimeout(c,50)}t=!0,n(),e()}}()}};
|
3 |
-
captainformDomReady(function() {
|
4 |
-
if (document.getElementById('captainform_js_global_vars') == null) {
|
5 |
-
append_element({
|
6 |
-
elementType: "script",
|
7 |
-
type: "text/javascript",
|
8 |
-
id: "captainform_js_global_vars",
|
9 |
-
textContent: 'var frmRef=""; try { frmRef=window.top.location.href; } catch(err) {}; var captainform_servicedomain="<?php echo $captainform_servicedomain;?>";var cfJsHost = "https://";',
|
10 |
-
});
|
11 |
-
}
|
12 |
-
});
|
13 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/form-resources/lightbox-auto-embedding.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<script type="text/javascript">
|
2 |
-
var customVarsMF = '{{CUSTOMVARS}}';
|
3 |
-
var captainform_theme_style = '{{STYLE}}';
|
4 |
-
setTimeout(function(){
|
5 |
-
if (typeof captainform_create_form_popup == 'function')
|
6 |
-
captainform_create_form_popup({url: cfJsHost + captainform_servicedomain + '/form-{{ID}}/?' + customVarsMF + captainform_theme_style, popup_w: 1000});
|
7 |
-
}, {{MILISECONDS}} );
|
8 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/form-resources/lightbox-embedding.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<script type="text/javascript">
|
2 |
-
var customVarsMF = '{{CUSTOMVARS}}';
|
3 |
-
var captainform_theme_style = '{{STYLE}}';
|
4 |
-
</script>
|
5 |
-
<a href="javascript:" {{BUTTON_STYLE}} class="blueLink13"
|
6 |
-
onclick="captainform_create_form_popup({url: cfJsHost + captainform_servicedomain + '/form-{{ID}}/?' + customVarsMF + captainform_theme_style, popup_w: 1000})">{{CONTENT}}</a>
|
|
|
|
|
|
|
|
|
|
|
|
includes/form-resources/tinybox-resources.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
add_action('init', 'captainform_popup_resorces');
|
3 |
-
function captainform_popup_resorces()
|
4 |
-
{
|
5 |
-
global $captainform_plugin_version;
|
6 |
-
wp_enqueue_style('captainform_form_popup_style', plugins_url('/css/form_popup.css', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version);
|
7 |
-
$user_agent = getenv("HTTP_USER_AGENT");
|
8 |
-
if (strpos($user_agent, "Mac") !== FALSE)
|
9 |
-
{
|
10 |
-
//wp_enqueue_style('captainform_form_popup_style', plugins_url('/css/wp_captainform_os.css', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version);
|
11 |
-
}
|
12 |
-
//wp_register_script('captainform_ires35', plugins_url('/js/iframeResizer.min.js', __DIR__), array(), $captainform_plugin_version, false);
|
13 |
-
wp_register_script('captainform_ires35', plugins_url('/js/iframeResizer.min.js', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version, false);
|
14 |
-
wp_enqueue_script('captainform_ires35');
|
15 |
-
wp_register_script('captainform_form_popup', plugins_url('/js/form_popup.js', plugin_dir_path(__FILE__)), array('jquery'), $captainform_plugin_version, false);
|
16 |
-
wp_enqueue_script('captainform_form_popup');
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/hooks.php
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) or die( 'No direct access!' );
|
3 |
-
global $args;
|
4 |
-
$args = array();
|
5 |
-
|
6 |
-
function captainform_curl_call(){
|
7 |
-
global $args;
|
8 |
-
$_curl_url = 'http://' . $GLOBALS['captainform_servicedomain'] . '/modules/captainform/plugin_track.php?';
|
9 |
-
|
10 |
-
$args['website'] = get_site_url();
|
11 |
-
$args['is_multisite'] = is_multisite();
|
12 |
-
$args['unique_id'] = captainform_get_referer_params('unique_id');
|
13 |
-
|
14 |
-
$args['installation_id'] = captainform_wpp_encrypt(get_site_option($GLOBALS['captainform_option1']));
|
15 |
-
$args['installation_key'] = captainform_wpp_encrypt(get_site_option($GLOBALS['captainform_option2']));
|
16 |
-
$args['source'] = captainform_get_referer_params('source');
|
17 |
-
|
18 |
-
$_curl_url .= http_build_query($args);
|
19 |
-
|
20 |
-
$response = wp_remote_get( $_curl_url, $args );
|
21 |
-
}
|
22 |
-
|
23 |
-
function captainform_deactivate(){
|
24 |
-
global $args;
|
25 |
-
$args['action'] = 'deactivate';
|
26 |
-
captainform_curl_call();
|
27 |
-
}
|
28 |
-
|
29 |
-
function captainform_activate(){
|
30 |
-
global $args;
|
31 |
-
$args['action'] = 'activate';
|
32 |
-
|
33 |
-
check_captainform_settings();
|
34 |
-
captainform_curl_call();
|
35 |
-
}
|
36 |
-
|
37 |
-
function captainform_uninstall(){
|
38 |
-
global $args;
|
39 |
-
$args['action'] = 'uninstall';
|
40 |
-
captainform_curl_call();
|
41 |
-
}
|
42 |
-
|
43 |
-
function captainform_get_referer_params($param = '') {
|
44 |
-
$file_exists = false;
|
45 |
-
$plugin_referer = '';
|
46 |
-
$file = (__DIR__) . '/referer.php';
|
47 |
-
if (file_exists($file)) {
|
48 |
-
require_once($file);
|
49 |
-
$file_exists = true;
|
50 |
-
}
|
51 |
-
if ($param == 'unique_id') {
|
52 |
-
if ($file_exists && isset($captainform_unique_id) && $captainform_unique_id) {
|
53 |
-
return $captainform_unique_id;
|
54 |
-
}
|
55 |
-
return 'captainform_' . substr(md5(get_site_url()),-12);
|
56 |
-
}
|
57 |
-
if ($param == 'source') {
|
58 |
-
if ($file_exists && isset($captainform_referer) && $captainform_referer) {
|
59 |
-
return $captainform_referer;
|
60 |
-
}
|
61 |
-
return 'plugin_directory';
|
62 |
-
}
|
63 |
-
return '';
|
64 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
includes/init.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
function captainform_session_start()
|
3 |
-
{
|
4 |
-
@session_start(array('cookie_lifetime' => 86400));
|
5 |
-
}
|
6 |
-
|
7 |
-
//BugFix for WP4.4.2 + Twenty Ten Theme
|
8 |
-
function captainform_add_jquery()
|
9 |
-
{
|
10 |
-
wp_enqueue_script('jquery');
|
11 |
-
}
|
12 |
-
|
13 |
-
function check_captainform_settings(){
|
14 |
-
if (get_site_option($GLOBALS['captainform_option1']) == '') {
|
15 |
-
add_site_option($GLOBALS['captainform_option1'], captainform_generate_installation_id());
|
16 |
-
}
|
17 |
-
|
18 |
-
if (get_site_option($GLOBALS['captainform_option2']) == '') {
|
19 |
-
add_site_option($GLOBALS['captainform_option2'], captainform_generate_installation_key());
|
20 |
-
}
|
21 |
-
|
22 |
-
if (get_site_option($GLOBALS['captainform_option3']) == '') {
|
23 |
-
add_site_option($GLOBALS['captainform_option3'], get_site_option("siteurl"));
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
function adding_captainform_misc_functions() {
|
28 |
-
wp_register_script('captainform_misc_functions', plugin_dir_url( __FILE__ ) . 'js/misc_functions.js', array(), uniqid(), false);
|
29 |
-
wp_enqueue_script('captainform_misc_functions');
|
30 |
-
}
|
31 |
-
|
32 |
-
if (!session_id())
|
33 |
-
add_action('init', 'captainform_session_start');
|
34 |
-
add_action('init', 'captainform_add_jquery');
|
35 |
-
add_action('init', 'check_captainform_settings');
|
36 |
-
add_action('wp_enqueue_scripts', 'adding_captainform_misc_functions');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/integrations/class-captainform-integration-forge-element.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Captainform_ForgeElement
|
5 |
+
*/
|
6 |
+
class Captainform_ForgeElement
|
7 |
+
{
|
8 |
+
|
9 |
+
/**
|
10 |
+
* The ID of this plugin.
|
11 |
+
*
|
12 |
+
* @since 2.0.0
|
13 |
+
* @access private
|
14 |
+
* @var string $plugin_name The ID of this plugin.
|
15 |
+
*/
|
16 |
+
private static $plugin_name;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The version of this plugin.
|
20 |
+
*
|
21 |
+
* @since 2.0.0
|
22 |
+
* @access private
|
23 |
+
* @var string $version The current version of this plugin.
|
24 |
+
*/
|
25 |
+
private static $version;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Captainform_ForgeElement constructor.
|
29 |
+
* @param $plugin_name
|
30 |
+
* @param $version
|
31 |
+
*/
|
32 |
+
public function __construct($plugin_name, $version)
|
33 |
+
{
|
34 |
+
self::$plugin_name = $plugin_name;
|
35 |
+
self::$version = $version;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Register the stylesheets for the public-facing side of the site.
|
40 |
+
*
|
41 |
+
* @since 2.0.0
|
42 |
+
*/
|
43 |
+
public function enqueue_styles()
|
44 |
+
{
|
45 |
+
|
46 |
+
wp_enqueue_style('captainform_forge_element_css', plugin_dir_url(__FILE__) . '../../public/css/captainform-forge-element.css', array(), self::$version, 'all');
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
public function forge_element_metadata($data)
|
51 |
+
{
|
52 |
+
|
53 |
+
$fields = array();
|
54 |
+
|
55 |
+
$selectField = array(
|
56 |
+
'type' => "list",
|
57 |
+
'name' => "form_id",
|
58 |
+
'label' => __('Select Form', self::$plugin_name),
|
59 |
+
'default' => "none",
|
60 |
+
'choices' => array('none' => __('Please select...', self::$plugin_name)),
|
61 |
+
);
|
62 |
+
|
63 |
+
$fields['select'] = $selectField;
|
64 |
+
|
65 |
+
$response = Captainform_Utils::get_remote_forms('page_or_post');
|
66 |
+
if ($response->status == "ok") {
|
67 |
+
foreach ($response->forms as $form) {
|
68 |
+
$fields['select']['choices'][$form->f_id] = $form->f_name;
|
69 |
+
}
|
70 |
+
$fields['my_forms'] = $this->get_forge_button("My Forms", admin_url("admin.php?page=CaptainForm"), "_captainFormTab");
|
71 |
+
} else {
|
72 |
+
$fields['select']['choices']['none'] = __('No forms available', 'captainform');
|
73 |
+
$fields['select']['description'] = __('There are no forms available, please create one by clicking the button below.', self::$plugin_name);
|
74 |
+
$fields['create'] = $this->get_forge_button("New Form", admin_url("admin.php?page=CaptainForm-NewForm"), "_captainFormTab");
|
75 |
+
}
|
76 |
+
|
77 |
+
$data['captainform'] = array(
|
78 |
+
'title' => __('CaptainForm', 'captainform'),
|
79 |
+
'description' => __('User-friendly form builder', self::$plugin_name),
|
80 |
+
'featured' => 50,
|
81 |
+
'group' => 'forms',
|
82 |
+
'callback' => 'captainform_forge_element',
|
83 |
+
'fields' => $fields,
|
84 |
+
);
|
85 |
+
|
86 |
+
return $data;
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
private function get_forge_button($text = "null", $url = "null", $target = "_blank")
|
92 |
+
{
|
93 |
+
|
94 |
+
return array(
|
95 |
+
'type' => "captainform_button",
|
96 |
+
'name' => "selector",
|
97 |
+
'default' => "none",
|
98 |
+
'text' => __($text, self::$plugin_name),
|
99 |
+
'url' => $url,
|
100 |
+
'target' => $target,
|
101 |
+
);
|
102 |
+
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
function captainform_forge_element($atts, $content)
|
107 |
+
{
|
108 |
+
if ($atts['form_id'] != "none") {
|
109 |
+
$container_id = md5($atts['form_id'] + time());
|
110 |
+
$container = "<div id='{$container_id}'>%s</div>";
|
111 |
+
return sprintf($container, captain_form($atts['form_id']));
|
112 |
+
} else {
|
113 |
+
return '<div class="forge-captainform-form-placeholder"></div>';
|
114 |
+
}
|
115 |
+
}
|
includes/integrations/{wp-integrations-handler.php → class-captainform-integration-handler.php}
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
defined('ABSPATH') or die('No direct access!');
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
protected static $public_key;
|
7 |
protected static $message;
|
@@ -25,7 +25,7 @@ class CaptainForm_WP_Integrations_Handler
|
|
25 |
exit();
|
26 |
}
|
27 |
|
28 |
-
if (!isset(self::$api_key) || self::$api_key == "" || self::$api_key !=
|
29 |
echo self::message("Invalid API Key", 0);
|
30 |
exit();
|
31 |
}
|
@@ -33,10 +33,10 @@ class CaptainForm_WP_Integrations_Handler
|
|
33 |
$verify = openssl_verify(self::$message, self::$signature, base64_decode(self::$public_key), OPENSSL_ALGO_SHA1);
|
34 |
|
35 |
if ($verify == 1) {
|
36 |
-
if (!
|
37 |
-
|
38 |
} else {
|
39 |
-
|
40 |
}
|
41 |
echo self::message("WordPress connected", 1);
|
42 |
} elseif ($verify == 0) {
|
@@ -59,15 +59,17 @@ class CaptainForm_WP_Integrations_Handler
|
|
59 |
|
60 |
protected static function authenticate($option_db_name)
|
61 |
{
|
62 |
-
if (!get_option($option_db_name)) {
|
63 |
return false;
|
64 |
}
|
65 |
|
66 |
-
self::$public_key =
|
|
|
67 |
self::$message = $_REQUEST["message"];
|
68 |
self::$signature = base64_decode(str_replace(" ", "+", $_REQUEST["signature"]));
|
69 |
return openssl_verify(self::$message, self::$signature, base64_decode(self::$public_key), OPENSSL_ALGO_SHA1);
|
70 |
-
}
|
|
|
71 |
|
72 |
protected static function message($message, $status, $data = '')
|
73 |
{
|
@@ -78,7 +80,8 @@ class CaptainForm_WP_Integrations_Handler
|
|
78 |
"data" => $data,
|
79 |
)
|
80 |
);
|
81 |
-
}
|
|
|
82 |
|
83 |
public static function strip_data($data)
|
84 |
{
|
@@ -87,29 +90,38 @@ class CaptainForm_WP_Integrations_Handler
|
|
87 |
$data = stripslashes($data);
|
88 |
return $data;
|
89 |
}
|
90 |
-
}
|
|
|
91 |
|
92 |
function RetrieveExtension($data)
|
93 |
{
|
94 |
-
$imageContents = base64_decode($data);
|
|
|
95 |
// If its not base64 end processing and return false
|
96 |
if ($imageContents === false) {
|
97 |
return false;
|
98 |
-
}
|
|
|
99 |
|
100 |
if(function_exists('finfo_file') && function_exists('finfo_open'))
|
101 |
{
|
102 |
-
$validExtensions = array('png', 'jpeg', 'jpg', 'gif');
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
-
fwrite($tempFile, $imageContents);
|
106 |
-
$contentType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $tempFile);
|
107 |
-
fclose($tempFile);
|
108 |
|
109 |
if (substr($contentType, 0, 5) !== 'image')
|
110 |
return false;
|
111 |
|
112 |
-
$extension = ltrim($contentType, 'image/');
|
|
|
113 |
return false;
|
114 |
|
115 |
return $extension;
|
1 |
<?php
|
2 |
defined('ABSPATH') or die('No direct access!');
|
3 |
|
4 |
+
class Captainform_Integrations_Handler
|
5 |
{
|
6 |
protected static $public_key;
|
7 |
protected static $message;
|
25 |
exit();
|
26 |
}
|
27 |
|
28 |
+
if (!isset(self::$api_key) || self::$api_key == "" || self::$api_key != get_site_option('captainform_installation_key')) {
|
29 |
echo self::message("Invalid API Key", 0);
|
30 |
exit();
|
31 |
}
|
33 |
$verify = openssl_verify(self::$message, self::$signature, base64_decode(self::$public_key), OPENSSL_ALGO_SHA1);
|
34 |
|
35 |
if ($verify == 1) {
|
36 |
+
if (!get_site_option($option_db_name)) {
|
37 |
+
add_site_option($option_db_name, self::$public_key);
|
38 |
} else {
|
39 |
+
update_site_option($option_db_name, self::$public_key);
|
40 |
}
|
41 |
echo self::message("WordPress connected", 1);
|
42 |
} elseif ($verify == 0) {
|
59 |
|
60 |
protected static function authenticate($option_db_name)
|
61 |
{
|
62 |
+
if (!get_site_option($option_db_name) && !get_option($option_db_name)) {
|
63 |
return false;
|
64 |
}
|
65 |
|
66 |
+
if(get_site_option($option_db_name) ) self::$public_key = get_site_option($option_db_name);
|
67 |
+
else self::$public_key = get_option($option_db_name);
|
68 |
self::$message = $_REQUEST["message"];
|
69 |
self::$signature = base64_decode(str_replace(" ", "+", $_REQUEST["signature"]));
|
70 |
return openssl_verify(self::$message, self::$signature, base64_decode(self::$public_key), OPENSSL_ALGO_SHA1);
|
71 |
+
}
|
72 |
+
|
73 |
|
74 |
protected static function message($message, $status, $data = '')
|
75 |
{
|
80 |
"data" => $data,
|
81 |
)
|
82 |
);
|
83 |
+
}
|
84 |
+
|
85 |
|
86 |
public static function strip_data($data)
|
87 |
{
|
90 |
$data = stripslashes($data);
|
91 |
return $data;
|
92 |
}
|
93 |
+
}
|
94 |
+
|
95 |
|
96 |
function RetrieveExtension($data)
|
97 |
{
|
98 |
+
$imageContents = base64_decode($data);
|
99 |
+
|
100 |
// If its not base64 end processing and return false
|
101 |
if ($imageContents === false) {
|
102 |
return false;
|
103 |
+
}
|
104 |
+
|
105 |
|
106 |
if(function_exists('finfo_file') && function_exists('finfo_open'))
|
107 |
{
|
108 |
+
$validExtensions = array('png', 'jpeg', 'jpg', 'gif');
|
109 |
+
|
110 |
+
$tempFile = tmpfile();
|
111 |
+
|
112 |
+
|
113 |
+
fwrite($tempFile, $imageContents);
|
114 |
+
|
115 |
+
$contentType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $tempFile);
|
116 |
+
|
117 |
+
fclose($tempFile);
|
118 |
|
|
|
|
|
|
|
119 |
|
120 |
if (substr($contentType, 0, 5) !== 'image')
|
121 |
return false;
|
122 |
|
123 |
+
$extension = ltrim($contentType, 'image/');
|
124 |
+
if (!in_array(strtolower($extension), $validExtensions))
|
125 |
return false;
|
126 |
|
127 |
return $extension;
|
includes/integrations/class-captainform-integration-posts.php
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined('ABSPATH') or die('No direct access!');
|
3 |
+
|
4 |
+
class Captainform_WP_Posts extends Captainform_Integrations_Handler
|
5 |
+
{
|
6 |
+
const OPTION_DB_NAME = '123cf_post_public_key';
|
7 |
+
|
8 |
+
|
9 |
+
public static function connect($param = null)
|
10 |
+
{
|
11 |
+
parent::connect(self::OPTION_DB_NAME);
|
12 |
+
}
|
13 |
+
|
14 |
+
public static function check_connection($param = null)
|
15 |
+
{
|
16 |
+
parent::check_connection(self::OPTION_DB_NAME);
|
17 |
+
}
|
18 |
+
|
19 |
+
public static function get_integration_hooks()
|
20 |
+
{
|
21 |
+
return array(
|
22 |
+
'cfp-connect' => 'connect',
|
23 |
+
'cfp-new-post' => 'new_post',
|
24 |
+
'cfp-get-wp-data' => 'get_wp_data',
|
25 |
+
'cfp-check-connection' => 'check_connection',
|
26 |
+
);
|
27 |
+
}
|
28 |
+
|
29 |
+
public static function new_post()
|
30 |
+
{
|
31 |
+
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
32 |
+
echo self::message("There was an error while trying to authenticate with wordpress", 0);
|
33 |
+
exit();
|
34 |
+
}
|
35 |
+
$post_title = strip_tags(rawurldecode($_POST["post_title"]));
|
36 |
+
$post_title = preg_replace("/ /", ' ', $post_title);
|
37 |
+
$post_title = stripslashes($post_title);
|
38 |
+
|
39 |
+
|
40 |
+
$post_content = rawurldecode($_POST["post_content"]);
|
41 |
+
$post_content = stripslashes($post_content);
|
42 |
+
$post_status = $_POST["post_status"];
|
43 |
+
$post_category = urldecode($_POST["post_category"]);
|
44 |
+
$post_author = $_POST["post_author"];
|
45 |
+
$post_format = $_POST["post_format"];
|
46 |
+
$comments = $_POST["comment_status"];
|
47 |
+
$comments == "1" ? $comment_status = "open" : $comment_status = "closed";
|
48 |
+
$post_excerpt = rawurldecode($_POST["post_excerpt"]);
|
49 |
+
$post_excerpt = preg_replace("/ /", ' ', $post_excerpt);
|
50 |
+
$post_excerpt = stripslashes($post_excerpt);
|
51 |
+
$post_tags = explode(",", rawurldecode($_POST["post_tags"]));
|
52 |
+
$post_image = str_replace(" ", "+", $_POST["post_image"]);
|
53 |
+
$post_image_name = $_POST["post_image_name"];
|
54 |
+
|
55 |
+
|
56 |
+
$custom_fields_keys = self::get_custom_post_fields();
|
57 |
+
$custom_fields_values = array();
|
58 |
+
foreach ($custom_fields_keys as $key) {
|
59 |
+
if ($_POST[$key]) {
|
60 |
+
$custom_fields_values[rawurldecode($key)] = $_POST[$key];
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
$post_categories = explode(",", $post_category);
|
66 |
+
$cat_id_arr = array();
|
67 |
+
if (is_array($post_categories)) {
|
68 |
+
foreach ($post_categories as $category_name) {
|
69 |
+
$category_id = get_cat_ID($category_name);
|
70 |
+
if ($category_id) {
|
71 |
+
$cat_id_arr[] = $category_id;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
$new_post = array(
|
78 |
+
'post_author' => $post_author,
|
79 |
+
'post_title' => $post_title,
|
80 |
+
'post_content' => $post_content,
|
81 |
+
'post_status' => $post_status,
|
82 |
+
'comment_status' => $comment_status,
|
83 |
+
'post_excerpt' => $post_excerpt,
|
84 |
+
'post_category' => $cat_id_arr
|
85 |
+
);
|
86 |
+
|
87 |
+
|
88 |
+
$post_id = wp_insert_post($new_post);
|
89 |
+
if ($post_id) {
|
90 |
+
foreach ($custom_fields_values as $meta_key => $meta_value) {
|
91 |
+
add_post_meta($post_id, str_replace("|***|", " ", $meta_key), $meta_value);
|
92 |
+
}
|
93 |
+
set_post_format($post_id, $post_format);
|
94 |
+
wp_set_post_tags($post_id, $post_tags);
|
95 |
+
if (isset($post_image) && RetrieveExtension($post_image)) {
|
96 |
+
self::upload_image($post_id, $post_image, $post_image_name);
|
97 |
+
}
|
98 |
+
echo self::message("New post created", 1);
|
99 |
+
exit();
|
100 |
+
}
|
101 |
+
echo self::message("There was an error while trying to create new post", 0);
|
102 |
+
exit();
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
private static function get_custom_post_fields()
|
107 |
+
{
|
108 |
+
global $wpdb;
|
109 |
+
$custom_fields = array();
|
110 |
+
$fields = $wpdb->get_results('SELECT DISTINCT meta_key FROM wp_postmeta', OBJECT);
|
111 |
+
foreach ($fields as $field) {
|
112 |
+
if (substr($field->meta_key, 0, 1) != "_") {
|
113 |
+
|
114 |
+
|
115 |
+
$meta_key = str_replace(" ", "|***|", $field->meta_key);
|
116 |
+
$custom_fields[] = $meta_key;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
return $custom_fields;
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
private static function insert_child_category($category, $wp_categories)
|
124 |
+
{
|
125 |
+
if ($category->parent == 0) {
|
126 |
+
$wp_categories[] = $category;
|
127 |
+
$args = array('hierarchical' => true, 'hide_empty' => 0, 'child_of' => $category->cat_ID);
|
128 |
+
$child_categories = get_categories($args);
|
129 |
+
foreach ($child_categories as $child_cat) {
|
130 |
+
$wp_categories[] = $child_cat;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
return $wp_categories;
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
public static function get_wp_data()
|
138 |
+
{
|
139 |
+
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
140 |
+
echo captainform_cfp_message("There was an error while trying to authenticate with wordpress", 0);
|
141 |
+
exit();
|
142 |
+
}
|
143 |
+
|
144 |
+
global $wpdb;
|
145 |
+
$data = array();
|
146 |
+
$custom_fields = array();
|
147 |
+
|
148 |
+
$fields = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$wpdb->prefix}postmeta", OBJECT);
|
149 |
+
foreach ($fields as $field) {
|
150 |
+
if (substr($field->meta_key, 0, 1) != "_") {
|
151 |
+
$custom_fields[] = $field->meta_key;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$data["custom_fields"] = $custom_fields;
|
155 |
+
$args = array('orderby' => 'name', 'hierarchical' => true, 'hide_empty' => 0, 'parent' => 0);
|
156 |
+
$categories = get_categories($args);
|
157 |
+
$wp_categories = array();
|
158 |
+
foreach ($categories as $category) {
|
159 |
+
$wp_categories = self::insert_child_category($category, $wp_categories);
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
$data["categories"] = $wp_categories;
|
164 |
+
$args_authors = array('who' => 'author');
|
165 |
+
$users = get_users($args_authors);
|
166 |
+
$authors = array();
|
167 |
+
foreach ($users as $user) {
|
168 |
+
$authors[] = array("id" => $user->data->ID, "username" => $user->data->user_login);
|
169 |
+
}
|
170 |
+
$data["authors"] = $authors;
|
171 |
+
echo json_encode($data);
|
172 |
+
exit();
|
173 |
+
}
|
174 |
+
|
175 |
+
private static function upload_image($post_id, $post_image, $post_image_name = null)
|
176 |
+
{
|
177 |
+
$upload_dir = wp_upload_dir();
|
178 |
+
$upload_path = str_replace('/', DIRECTORY_SEPARATOR, $upload_dir['path']) . DIRECTORY_SEPARATOR;
|
179 |
+
$decoded_img = base64_decode($post_image);
|
180 |
+
if (!$post_image_name) {
|
181 |
+
$filename = 'image.png';
|
182 |
+
} else {
|
183 |
+
$filename = $post_image_name;
|
184 |
+
}
|
185 |
+
$hashed_filename = md5($filename . microtime()) . '_' . $filename;
|
186 |
+
$image_upload = file_put_contents($upload_path . $hashed_filename, $decoded_img);
|
187 |
+
if (!function_exists('wp_handle_sideload')) {
|
188 |
+
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
189 |
+
}
|
190 |
+
if (!function_exists('wp_get_current_user')) {
|
191 |
+
require_once(ABSPATH . 'wp-includes/pluggable.php');
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
$file = array();
|
196 |
+
$file['error'] = '';
|
197 |
+
$file['tmp_name'] = $upload_path . $hashed_filename;
|
198 |
+
$file['name'] = $hashed_filename;
|
199 |
+
$file['type'] = 'image/jpg';
|
200 |
+
$file['size'] = filesize($upload_path . $hashed_filename);
|
201 |
+
|
202 |
+
|
203 |
+
$file_return = wp_handle_sideload($file, array('test_form' => false));
|
204 |
+
$file_url = $file_return['file'];
|
205 |
+
$filetype = wp_check_filetype(basename($file_url), null);
|
206 |
+
$attachment = array(
|
207 |
+
'guid' => $upload_dir['url'] . '/' . basename($file_url),
|
208 |
+
'post_mime_type' => $filetype['type'],
|
209 |
+
'post_title' => preg_replace('/\.[^.]+$/', '', basename($file_url)),
|
210 |
+
'post_content' => '',
|
211 |
+
'post_status' => 'inherit'
|
212 |
+
);
|
213 |
+
$attach_id = wp_insert_attachment($attachment, $file_url, $post_id);
|
214 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
215 |
+
$attach_data = wp_generate_attachment_metadata($attach_id, $file_url);
|
216 |
+
wp_update_attachment_metadata($attach_id, $attach_data);
|
217 |
+
update_post_meta($post_id, '_thumbnail_id', $attach_id);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
new Captainform_WP_Posts();
|
222 |
+
|
223 |
+
|
includes/integrations/class-captainform-integration-submissions.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* The class for the captainform plugin form submissions
|
1 |
*
|
2 |
* This is used to handle the form submissions for the captainform plugin
|
3 |
*
|
4 |
* @since 2.0.0
|
5 |
* @package Captainform
|
6 |
* @subpackage Captainform/includes/integrations
|
7 |
* @author captainform <team@captainform.com>
|
8 |
*/
|
9 |
/**
|
10 |
* @since 2.0.0
|
11 |
*/
|
12 |
const OPTION_DB_NAME = 'captainform_wp_submissions_public_key';
|
13 |
/**
|
14 |
* @since 2.0.0
|
15 |
* @param null $param
|
16 |
*/
|
17 |
public static function connect($param = null)
|
18 |
{
|
19 |
parent::connect(self::OPTION_DB_NAME);
|
20 |
}
|
21 |
/**
|
22 |
* @since 2.0.0
|
23 |
* @param null $param
|
24 |
*/
|
25 |
public static function check_connection($param = null)
|
26 |
{
|
27 |
parent::check_connection(self::OPTION_DB_NAME);
|
28 |
}
|
29 |
/**
|
30 |
* @since 2.0.0
|
31 |
* @return array
|
32 |
*/
|
33 |
public static function get_integration_hooks()
|
34 |
{
|
35 |
return array(
|
36 |
'captainform_submissions_connect' => 'connect',
|
37 |
'captainform_submissions_query' => 'query',
|
38 |
);
|
39 |
}
|
40 |
/**
|
41 |
* @since 2.0.0
|
42 |
* @access private
|
43 |
* @param $from
|
44 |
* @param $to
|
45 |
* @param $subject
|
46 |
* @return mixed
|
47 |
*/
|
48 |
private static function str_replace_first($from, $to, $subject)
|
49 |
{
|
50 |
$from = '/'.preg_quote($from, '/').'/';
|
51 |
return preg_replace($from, $to, $subject, 1);
|
52 |
}
|
53 |
/**
|
54 |
* @since 2.0.0
|
55 |
*/
|
56 |
public static function createTable()
|
57 |
{
|
58 |
global $wpdb;
|
59 |
$tablename = $wpdb->prefix . 'captainform_submissions';
|
60 |
$sql = "CREATE TABLE IF NOT EXISTS `$tablename` (
|
61 |
$wpdb->query($sql);
|
62 |
}
|
63 |
/**
|
64 |
* @since 2.0.0
|
65 |
*/
|
66 |
public static function query()
|
67 |
{
|
68 |
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
69 |
echo self::message("There was an error while trying to authenticate with WordPress", 0);
|
70 |
exit();
|
71 |
}
|
72 |
global $wpdb;
|
73 |
self::createTable();
|
74 |
$statement = $_REQUEST['statement'];
|
75 |
$select_count = $_REQUEST['select_count'];
|
76 |
$query = Captainform_Encrypt::decrypt($_REQUEST['query']);
|
77 |
$query = self::str_replace_first('[wp-prefix]',$wpdb->prefix,$query);
|
78 |
if($statement == 'SELECT')
|
79 |
{
|
80 |
if($select_count) $return = $wpdb->get_var($query);
|
81 |
else $return = $wpdb->get_results($query, ARRAY_A); //$return = json_encode($return);
|
82 |
}
|
83 |
elseif($statement == 'INSERT' || $statement == 'UPDATE' || $statement == 'DELETE')
|
84 |
{
|
85 |
$return = $wpdb->query($query);
|
86 |
}
|
87 |
elseif($statement == 'TABLE_PREFIX')
|
88 |
{
|
89 |
$return = $wpdb->prefix;
|
90 |
}
|
91 |
$return = json_encode(array('captainform_valid_response',$return));
|
92 |
echo $return;
|
93 |
exit();
|
94 |
}
|
1 |
+
<?php
|
2 |
* The class for the captainform plugin form submissions
|
3 |
*
|
4 |
* This is used to handle the form submissions for the captainform plugin
|
5 |
*
|
6 |
* @since 2.0.0
|
7 |
* @package Captainform
|
8 |
* @subpackage Captainform/includes/integrations
|
9 |
* @author captainform <team@captainform.com>
|
10 |
*/
|
11 |
/**
|
12 |
* @since 2.0.0
|
13 |
*/
|
14 |
const OPTION_DB_NAME = 'captainform_wp_submissions_public_key';
|
15 |
/**
|
16 |
* @since 2.0.0
|
17 |
* @param null $param
|
18 |
*/
|
19 |
public static function connect($param = null)
|
20 |
{
|
21 |
parent::connect(self::OPTION_DB_NAME);
|
22 |
}
|
23 |
/**
|
24 |
* @since 2.0.0
|
25 |
* @param null $param
|
26 |
*/
|
27 |
public static function check_connection($param = null)
|
28 |
{
|
29 |
parent::check_connection(self::OPTION_DB_NAME);
|
30 |
}
|
31 |
/**
|
32 |
* @since 2.0.0
|
33 |
* @return array
|
34 |
*/
|
35 |
public static function get_integration_hooks()
|
36 |
{
|
37 |
return array(
|
38 |
'captainform_submissions_connect' => 'connect',
|
39 |
'captainform_submissions_query' => 'query',
|
40 |
);
|
41 |
}
|
42 |
/**
|
43 |
* @since 2.0.0
|
44 |
* @access private
|
45 |
* @param $from
|
46 |
* @param $to
|
47 |
* @param $subject
|
48 |
* @return mixed
|
49 |
*/
|
50 |
private static function str_replace_first($from, $to, $subject)
|
51 |
{
|
52 |
$from = '/'.preg_quote($from, '/').'/';
|
53 |
return preg_replace($from, $to, $subject, 1);
|
54 |
}
|
55 |
/**
|
56 |
* @since 2.0.0
|
57 |
*/
|
58 |
public static function createTable()
|
59 |
{
|
60 |
global $wpdb;
|
61 |
$tablename = $wpdb->prefix . 'captainform_submissions';
|
62 |
$sql = "CREATE TABLE IF NOT EXISTS `$tablename` (
|
63 |
$wpdb->query($sql);
|
64 |
}
|
65 |
/**
|
66 |
* @since 2.0.0
|
67 |
*/
|
68 |
public static function query()
|
69 |
{
|
70 |
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
71 |
echo self::message("There was an error while trying to authenticate with WordPress", 0);
|
72 |
exit();
|
73 |
}
|
74 |
global $wpdb;
|
75 |
self::createTable();
|
76 |
$statement = $_REQUEST['statement'];
|
77 |
$select_count = $_REQUEST['select_count'];
|
78 |
$query = Captainform_Encrypt::decrypt($_REQUEST['query']);
|
79 |
$query = self::str_replace_first('[wp-prefix]',$wpdb->prefix,$query);
|
80 |
if($statement == 'SELECT')
|
81 |
{
|
82 |
if($select_count) $return = $wpdb->get_var($query);
|
83 |
else $return = $wpdb->get_results($query, ARRAY_A); //$return = json_encode($return);
|
84 |
}
|
85 |
elseif($statement == 'INSERT' || $statement == 'UPDATE' || $statement == 'DELETE')
|
86 |
{
|
87 |
$return = $wpdb->query($query);
|
88 |
}
|
89 |
elseif($statement == 'TABLE_PREFIX')
|
90 |
{
|
91 |
$return = $wpdb->prefix;
|
92 |
}
|
93 |
$return = json_encode(array('captainform_valid_response',$return));
|
94 |
echo $return;
|
95 |
exit();
|
96 |
}
|
includes/integrations/class-captainform-integration-users.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
const OPTION_DB_NAME = 'captainform_wp_users_public_key';
|
1 |
static function connect($param = null)
|
2 |
{
|
3 |
parent::connect(self::OPTION_DB_NAME);
|
4 |
}
|
5 |
static function check_connection($param = null)
|
6 |
{
|
7 |
parent::check_connection(self::OPTION_DB_NAME);
|
8 |
}
|
9 |
public static function get_integration_hooks()
|
10 |
{
|
11 |
return array(
|
12 |
'captainform_new_users_connect' => 'connect',
|
13 |
'captainform_new_user' => 'new_user',
|
14 |
'captainform_new_users_get_wp_data' => 'get_wp_data',
|
15 |
'captainform_new_users_check_connection' => 'check_connection',
|
16 |
);
|
17 |
}
|
18 |
private static function get_wp_roles()
|
19 |
{
|
20 |
global $wp_roles;
|
21 |
$roles = array();
|
22 |
foreach ($wp_roles->role_names as $role => $name)
|
23 |
$roles[] = $name;
|
24 |
return $roles;
|
25 |
}
|
26 |
public static function new_user()
|
27 |
{
|
28 |
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
29 |
echo self::message("There was an error while trying to authenticate with WordPress", 0);
|
30 |
exit();
|
31 |
}
|
32 |
$user_id = null;
|
33 |
$username = isset($_REQUEST['username']) ? self::strip_data($_REQUEST['username']) : '';
|
34 |
$email_address = isset($_REQUEST['email_address']) ? self::strip_data($_REQUEST['email_address']) : '';
|
35 |
$password = isset($_REQUEST['password']) ? self::strip_data($_REQUEST['password']) : '';
|
36 |
$website = isset($_REQUEST['website']) ? self::strip_data($_REQUEST['website']) : '';
|
37 |
$first_name = isset($_REQUEST['first_name']) ? self::strip_data($_REQUEST['first_name']) : '';
|
38 |
$last_name = isset($_REQUEST['last_name']) ? self::strip_data($_REQUEST['last_name']) : '';
|
39 |
$display_name = isset($_REQUEST['display_name']) ? self::strip_data($_REQUEST['display_name']) : '';
|
40 |
$nickname = isset($_REQUEST['nickname']) ? self::strip_data($_REQUEST['nickname']) : '';
|
41 |
$description = isset($_REQUEST['description']) ? self::strip_data($_REQUEST['description']) : '';
|
42 |
$rich_editing = isset($_REQUEST['rich_editing']) ? self::strip_data($_REQUEST['rich_editing']) : '';
|
43 |
$show_admin_bar_front = isset($_REQUEST['show_admin_bar_front']) ? (self::strip_data($_REQUEST['show_admin_bar_front']) == 1 ? 'true' : 'false') : 'false';
|
44 |
$role = isset($_REQUEST['role']) ? strtolower(self::strip_data($_REQUEST['role'])) : '';
|
45 |
$jabber = isset($_REQUEST['jabber']) ? self::strip_data($_REQUEST['jabber']) : '';
|
46 |
$aim = isset($_REQUEST['aim']) ? self::strip_data($_REQUEST['aim']) : '';
|
47 |
$yahoo = isset($_REQUEST['yahoo']) ? self::strip_data($_REQUEST['yahoo']) : '';
|
48 |
$wordpress_url = isset($_REQUEST['wordpress_url']) ? self::strip_data($_REQUEST['wordpress_url']) : '';
|
49 |
$send_password = isset($_REQUEST['send_password']) == 1 ? (self::strip_data($_REQUEST['send_password']) == 1 ? true : false) : false;
|
50 |
$random_password = isset($_REQUEST['random_password']) ? (self::strip_data($_REQUEST['random_password']) == 1 ? true : false) : false;
|
51 |
if ($random_password == false && trim($password) == "")
|
52 |
$random_password = true;
|
53 |
$username_exists = username_exists($username);
|
54 |
$email_exists = email_exists($email_address);
|
55 |
if (!empty($username_exists) || !empty($email_exists)) {
|
56 |
$labels_arr = array();
|
57 |
$message = '';
|
58 |
if (!empty($username_exists))
|
59 |
$labels_arr[] = 'username';
|
60 |
if (!empty($email_exists))
|
61 |
$labels_arr[] = 'email';
|
62 |
$labels_string = implode(" and ", $labels_arr);
|
63 |
$aux = (count($labels_arr) > 1 ? "" : "s");
|
64 |
$message = sprintf("There was an error when trying to create the WordPress user. Sorry, that %s already exist%s!", $labels_string, $aux);
|
65 |
echo self::message($message, 0);
|
66 |
exit();
|
67 |
}
|
68 |
if (empty($username_exists) && empty($email_exists)) {
|
69 |
// Generate the password and create the user
|
70 |
if ($random_password) {
|
71 |
$password = wp_generate_password(12, false);
|
72 |
}
|
73 |
$user_id = wp_create_user($username, $password, $email_address);
|
74 |
if (is_numeric($user_id)) {
|
75 |
wp_update_user(
|
76 |
array(
|
77 |
'ID' => $user_id,
|
78 |
'username' => $username,
|
79 |
'user_url' => $website,
|
80 |
'first_name' => $first_name,
|
81 |
'last_name' => $last_name,
|
82 |
'display_name' => $display_name,
|
83 |
'nickname' => $nickname,
|
84 |
'description' => $description,
|
85 |
'rich_editing' => $rich_editing ? 'true' : 'false',
|
86 |
'show_admin_bar_front' => $show_admin_bar_front,
|
87 |
'role' => $role,
|
88 |
'jabber' => $jabber,
|
89 |
'aim' => $aim,
|
90 |
'yahoo' => $yahoo,
|
91 |
)
|
92 |
);
|
93 |
// Set the role
|
94 |
$user = new WP_User($user_id);
|
95 |
$user->set_role($role);
|
96 |
// Email the user
|
97 |
$admin_email = get_option('admin_email');
|
98 |
$headers = 'From: ' . $admin_email . ' <' . $admin_email . '>' . "\r\n";
|
99 |
$headers .= "MIME-Version: 1.0\r\n";
|
100 |
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
|
101 |
$email_content = 'Hello,<br /><br />';
|
102 |
$email_content .= 'Your WordPress user account has been created on ' . $wordpress_url . '.<br />';
|
103 |
$email_content .= '<b>Username</b>: ' . $username . '<br />';
|
104 |
$email_content .= '<b>Email Address</b>: ' . $email_address . '<br />';
|
105 |
if ($random_password || $send_password)
|
106 |
$email_content .= '<b>Password</b>: ' . $password . '<br /><br />';
|
107 |
$email_content .= 'You can log in here: ' . $wordpress_url . '/wp-login.php<br /><br />Best regards.';
|
108 |
wp_mail($email_address, 'Welcome!', $email_content, $headers);
|
109 |
}
|
110 |
}
|
111 |
$data = array();
|
112 |
$data["user_id"] = $user_id;
|
113 |
$status = is_numeric($user_id) && $user_id > 0 ? 1 : 0;
|
114 |
$message = '';
|
115 |
if ($status == 0 && is_wp_error($user_id)) {
|
116 |
$message = $user_id->get_error_message();
|
117 |
}
|
118 |
echo self::message($message, $status, json_encode($data));
|
119 |
exit();
|
120 |
}
|
121 |
public static function get_wp_data()
|
122 |
{
|
123 |
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
124 |
echo self::message("There was an error while trying to authenticate with WordPress", 0);
|
125 |
exit();
|
126 |
}
|
127 |
$data = array();
|
128 |
$data["user_roles"] = self::get_wp_roles();
|
129 |
echo json_encode($data);
|
130 |
exit();
|
131 |
}
|
1 |
+
<?php
|
2 |
const OPTION_DB_NAME = 'captainform_wp_users_public_key';
|
3 |
static function connect($param = null)
|
4 |
{
|
5 |
parent::connect(self::OPTION_DB_NAME);
|
6 |
}
|
7 |
static function check_connection($param = null)
|
8 |
{
|
9 |
parent::check_connection(self::OPTION_DB_NAME);
|
10 |
}
|
11 |
public static function get_integration_hooks()
|
12 |
{
|
13 |
return array(
|
14 |
'captainform_new_users_connect' => 'connect',
|
15 |
'captainform_new_user' => 'new_user',
|
16 |
'captainform_new_users_get_wp_data' => 'get_wp_data',
|
17 |
'captainform_new_users_check_connection' => 'check_connection',
|
18 |
);
|
19 |
}
|
20 |
private static function get_wp_roles()
|
21 |
{
|
22 |
global $wp_roles;
|
23 |
$roles = array();
|
24 |
foreach ($wp_roles->role_names as $role => $name)
|
25 |
$roles[] = $name;
|
26 |
return $roles;
|
27 |
}
|
28 |
public static function new_user()
|
29 |
{
|
30 |
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
31 |
echo self::message("There was an error while trying to authenticate with WordPress", 0);
|
32 |
exit();
|
33 |
}
|
34 |
$user_id = null;
|
35 |
$username = isset($_REQUEST['username']) ? self::strip_data($_REQUEST['username']) : '';
|
36 |
$email_address = isset($_REQUEST['email_address']) ? self::strip_data($_REQUEST['email_address']) : '';
|
37 |
$password = isset($_REQUEST['password']) ? self::strip_data($_REQUEST['password']) : '';
|
38 |
$website = isset($_REQUEST['website']) ? self::strip_data($_REQUEST['website']) : '';
|
39 |
$first_name = isset($_REQUEST['first_name']) ? self::strip_data($_REQUEST['first_name']) : '';
|
40 |
$last_name = isset($_REQUEST['last_name']) ? self::strip_data($_REQUEST['last_name']) : '';
|
41 |
$display_name = isset($_REQUEST['display_name']) ? self::strip_data($_REQUEST['display_name']) : '';
|
42 |
$nickname = isset($_REQUEST['nickname']) ? self::strip_data($_REQUEST['nickname']) : '';
|
43 |
$description = isset($_REQUEST['description']) ? self::strip_data($_REQUEST['description']) : '';
|
44 |
$rich_editing = isset($_REQUEST['rich_editing']) ? self::strip_data($_REQUEST['rich_editing']) : '';
|
45 |
$show_admin_bar_front = isset($_REQUEST['show_admin_bar_front']) ? (self::strip_data($_REQUEST['show_admin_bar_front']) == 1 ? 'true' : 'false') : 'false';
|
46 |
$role = isset($_REQUEST['role']) ? strtolower(self::strip_data($_REQUEST['role'])) : '';
|
47 |
$jabber = isset($_REQUEST['jabber']) ? self::strip_data($_REQUEST['jabber']) : '';
|
48 |
$aim = isset($_REQUEST['aim']) ? self::strip_data($_REQUEST['aim']) : '';
|
49 |
$yahoo = isset($_REQUEST['yahoo']) ? self::strip_data($_REQUEST['yahoo']) : '';
|
50 |
$wordpress_url = isset($_REQUEST['wordpress_url']) ? self::strip_data($_REQUEST['wordpress_url']) : '';
|
51 |
$send_password = isset($_REQUEST['send_password']) == 1 ? (self::strip_data($_REQUEST['send_password']) == 1 ? true : false) : false;
|
52 |
$random_password = isset($_REQUEST['random_password']) ? (self::strip_data($_REQUEST['random_password']) == 1 ? true : false) : false;
|
53 |
if ($random_password == false && trim($password) == "")
|
54 |
$random_password = true;
|
55 |
$username_exists = username_exists($username);
|
56 |
$email_exists = email_exists($email_address);
|
57 |
if (!empty($username_exists) || !empty($email_exists)) {
|
58 |
$labels_arr = array();
|
59 |
$message = '';
|
60 |
if (!empty($username_exists))
|
61 |
$labels_arr[] = 'username';
|
62 |
if (!empty($email_exists))
|
63 |
$labels_arr[] = 'email';
|
64 |
$labels_string = implode(" and ", $labels_arr);
|
65 |
$aux = (count($labels_arr) > 1 ? "" : "s");
|
66 |
$message = sprintf("There was an error when trying to create the WordPress user. Sorry, that %s already exist%s!", $labels_string, $aux);
|
67 |
echo self::message($message, 0);
|
68 |
exit();
|
69 |
}
|
70 |
if (empty($username_exists) && empty($email_exists)) {
|
71 |
// Generate the password and create the user
|
72 |
if ($random_password) {
|
73 |
$password = wp_generate_password(12, false);
|
74 |
}
|
75 |
$user_id = wp_create_user($username, $password, $email_address);
|
76 |
if (is_numeric($user_id)) {
|
77 |
wp_update_user(
|
78 |
array(
|
79 |
'ID' => $user_id,
|
80 |
'username' => $username,
|
81 |
'user_url' => $website,
|
82 |
'first_name' => $first_name,
|
83 |
'last_name' => $last_name,
|
84 |
'display_name' => $display_name,
|
85 |
'nickname' => $nickname,
|
86 |
'description' => $description,
|
87 |
'rich_editing' => $rich_editing ? 'true' : 'false',
|
88 |
'show_admin_bar_front' => $show_admin_bar_front,
|
89 |
'role' => $role,
|
90 |
'jabber' => $jabber,
|
91 |
'aim' => $aim,
|
92 |
'yahoo' => $yahoo,
|
93 |
)
|
94 |
);
|
95 |
// Set the role
|
96 |
$user = new WP_User($user_id);
|
97 |
$user->set_role($role);
|
98 |
// Email the user
|
99 |
$admin_email = get_option('admin_email');
|
100 |
$headers = 'From: ' . $admin_email . ' <' . $admin_email . '>' . "\r\n";
|
101 |
$headers .= "MIME-Version: 1.0\r\n";
|
102 |
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
|
103 |
$email_content = 'Hello,<br /><br />';
|
104 |
$email_content .= 'Your WordPress user account has been created on ' . $wordpress_url . '.<br />';
|
105 |
$email_content .= '<b>Username</b>: ' . $username . '<br />';
|
106 |
$email_content .= '<b>Email Address</b>: ' . $email_address . '<br />';
|
107 |
if ($random_password || $send_password)
|
108 |
$email_content .= '<b>Password</b>: ' . $password . '<br /><br />';
|
109 |
$email_content .= 'You can log in here: ' . $wordpress_url . '/wp-login.php<br /><br />Best regards.';
|
110 |
wp_mail($email_address, 'Welcome!', $email_content, $headers);
|
111 |
}
|
112 |
}
|
113 |
$data = array();
|
114 |
$data["user_id"] = $user_id;
|
115 |
$status = is_numeric($user_id) && $user_id > 0 ? 1 : 0;
|
116 |
$message = '';
|
117 |
if ($status == 0 && is_wp_error($user_id)) {
|
118 |
$message = $user_id->get_error_message();
|
119 |
}
|
120 |
echo self::message($message, $status, json_encode($data));
|
121 |
exit();
|
122 |
}
|
123 |
public static function get_wp_data()
|
124 |
{
|
125 |
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
126 |
echo self::message("There was an error while trying to authenticate with WordPress", 0);
|
127 |
exit();
|
128 |
}
|
129 |
$data = array();
|
130 |
$data["user_roles"] = self::get_wp_roles();
|
131 |
echo json_encode($data);
|
132 |
exit();
|
133 |
}
|
includes/integrations/forge-element.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
define('FORGE_ELEMENT_DOMAIN', 'captainform');
|
3 |
-
|
4 |
-
function adding_captainform_forge_element_css()
|
5 |
-
{
|
6 |
-
wp_enqueue_style('forge_element_css', plugin_dir_url( __FILE__ ) . '../css/forge_element.css', false, uniqid());
|
7 |
-
}
|
8 |
-
|
9 |
-
function forge_element_captainform($atts, $content)
|
10 |
-
{
|
11 |
-
if ($atts['form_id'] != "none") {
|
12 |
-
$container_id = md5($atts['form_id'] + time());
|
13 |
-
$container = "<div id=\"{$container_id}\">%s</div>";
|
14 |
-
return sprintf($container, captain_form($atts['form_id']));
|
15 |
-
} else {
|
16 |
-
return '<div class="forge-captainform-form-placeholder"></div>';
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
add_filter('forge_elements', 'forge_element_captainform_metadata');
|
21 |
-
function forge_element_captainform_metadata($data)
|
22 |
-
{
|
23 |
-
|
24 |
-
$fields = array();
|
25 |
-
|
26 |
-
$selectField = array(
|
27 |
-
'type' => "list",
|
28 |
-
'name' => "form_id",
|
29 |
-
'label' => __('Select Form', FORGE_ELEMENT_DOMAIN),
|
30 |
-
'default' => "none",
|
31 |
-
'choices' => array('none' => __('Please select...', FORGE_ELEMENT_DOMAIN)),
|
32 |
-
);
|
33 |
-
|
34 |
-
$fields['select'] = $selectField;
|
35 |
-
|
36 |
-
$response = captainform_get_forms('page_or_post');
|
37 |
-
if ($response->status == "ok") {
|
38 |
-
foreach ($response->forms as $form) {
|
39 |
-
$fields['select']['choices'][$form->f_id] = $form->f_name;
|
40 |
-
}
|
41 |
-
$fields['my_forms'] = get_forge_captainform_button("My Forms", admin_url("admin.php?page=CaptainForm"), "_captainFormTab");
|
42 |
-
} else {
|
43 |
-
$fields['select']['choices']['none'] = __('No forms available', FORGE_ELEMENT_DOMAIN);
|
44 |
-
$fields['select']['description'] = __('There are no forms available, please create one by clicking the button below.', FORGE_ELEMENT_DOMAIN);
|
45 |
-
$fields['create'] = get_forge_captainform_button("New Form", admin_url("admin.php?page=CaptainForm-NewForm"), "_captainFormTab");
|
46 |
-
}
|
47 |
-
|
48 |
-
$data['captainform'] = array(
|
49 |
-
'title' => __('CaptainForm', FORGE_ELEMENT_DOMAIN),
|
50 |
-
'description' => __('User-friendly form builder', FORGE_ELEMENT_DOMAIN),
|
51 |
-
'featured' => 50,
|
52 |
-
'group' => 'forms',
|
53 |
-
'callback' => 'forge_element_captainform',
|
54 |
-
'fields' => $fields,
|
55 |
-
);
|
56 |
-
|
57 |
-
return $data;
|
58 |
-
}
|
59 |
-
|
60 |
-
function forge_field_captainform_button($args, $value = '')
|
61 |
-
{
|
62 |
-
if (!isset($args['target']) || empty($args['target']))
|
63 |
-
$args['target'] = "_blank";
|
64 |
-
|
65 |
-
$fieldContainer = '<div class="forge-captainform-field">%s</div>';
|
66 |
-
$controlsContainer = '<div class="forge-captainform-field-controls">%s</div>';
|
67 |
-
$aTag = '<a class="forge-captainform-field-button forge-captainform-create" href="%s" target="%s">%s</a>';
|
68 |
-
|
69 |
-
$aTag = sprintf($aTag, $args['url'], $args['target'], $args['text']);
|
70 |
-
$controlsContainer = sprintf($controlsContainer, $aTag);
|
71 |
-
|
72 |
-
return sprintf($fieldContainer, $controlsContainer);
|
73 |
-
}
|
74 |
-
|
75 |
-
function get_forge_captainform_button($text = "null", $url = "null", $target = "_blank")
|
76 |
-
{
|
77 |
-
|
78 |
-
return array(
|
79 |
-
'type' => "captainform_button",
|
80 |
-
'name' => "selector",
|
81 |
-
'default' => "none",
|
82 |
-
'text' => __($text, FORGE_ELEMENT_DOMAIN),
|
83 |
-
'url' => $url,
|
84 |
-
'target' => $target,
|
85 |
-
);
|
86 |
-
|
87 |
-
}
|
88 |
-
|
89 |
-
add_action('wp_enqueue_scripts', 'adding_captainform_forge_element_css');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/integrations/wp-posts.php
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
|
4 |
-
class CaptainForm_WP_POSTS extends CaptainForm_WP_Integrations_Handler
|
5 |
-
{
|
6 |
-
const OPTION_DB_NAME = '123cf_post_public_key';
|
7 |
-
|
8 |
-
public static function connect($param = null)
|
9 |
-
{
|
10 |
-
parent::connect(self::OPTION_DB_NAME);
|
11 |
-
}
|
12 |
-
|
13 |
-
public static function check_connection($param = null)
|
14 |
-
{
|
15 |
-
parent::check_connection(self::OPTION_DB_NAME);
|
16 |
-
}
|
17 |
-
|
18 |
-
public static function new_post()
|
19 |
-
{
|
20 |
-
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
21 |
-
echo self::message("There was an error while trying to authenticate with wordpress", 0);
|
22 |
-
exit();
|
23 |
-
}
|
24 |
-
$post_title = strip_tags(rawurldecode($_POST["post_title"]));
|
25 |
-
$post_title = preg_replace("/ /", ' ', $post_title);
|
26 |
-
$post_title = stripslashes($post_title);
|
27 |
-
|
28 |
-
$post_content = rawurldecode($_POST["post_content"]);
|
29 |
-
$post_content = stripslashes($post_content);
|
30 |
-
$post_status = $_POST["post_status"];
|
31 |
-
$post_category = urldecode($_POST["post_category"]);
|
32 |
-
$post_author = $_POST["post_author"];
|
33 |
-
$post_format = $_POST["post_format"];
|
34 |
-
$comments = $_POST["comment_status"];
|
35 |
-
$comments == "1" ? $comment_status = "open" : $comment_status = "closed";
|
36 |
-
$post_excerpt = rawurldecode($_POST["post_excerpt"]);
|
37 |
-
$post_excerpt = preg_replace("/ /", ' ', $post_excerpt);
|
38 |
-
$post_excerpt = stripslashes($post_excerpt);
|
39 |
-
$post_tags = explode(",", rawurldecode($_POST["post_tags"]));
|
40 |
-
$post_image = str_replace(" ", "+", $_POST["post_image"]);
|
41 |
-
$post_image_name = $_POST["post_image_name"];
|
42 |
-
|
43 |
-
$custom_fields_keys = self::get_custom_post_fields();
|
44 |
-
$custom_fields_values = array();
|
45 |
-
foreach ($custom_fields_keys as $key) {
|
46 |
-
if ($_POST[$key]) {
|
47 |
-
$custom_fields_values[rawurldecode($key)] = $_POST[$key];
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
$post_categories = explode(",", $post_category);
|
52 |
-
$cat_id_arr = array();
|
53 |
-
if (is_array($post_categories)) {
|
54 |
-
foreach ($post_categories as $category_name) {
|
55 |
-
$category_id = get_cat_ID($category_name);
|
56 |
-
if ($category_id) {
|
57 |
-
$cat_id_arr[] = $category_id;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
$new_post = array(
|
63 |
-
'post_author' => $post_author,
|
64 |
-
'post_title' => $post_title,
|
65 |
-
'post_content' => $post_content,
|
66 |
-
'post_status' => $post_status,
|
67 |
-
'comment_status' => $comment_status,
|
68 |
-
'post_excerpt' => $post_excerpt,
|
69 |
-
'post_category' => $cat_id_arr
|
70 |
-
);
|
71 |
-
|
72 |
-
$post_id = wp_insert_post($new_post);
|
73 |
-
if ($post_id) {
|
74 |
-
foreach ($custom_fields_values as $meta_key => $meta_value) {
|
75 |
-
add_post_meta($post_id, str_replace("|***|", " ", $meta_key), $meta_value);
|
76 |
-
}
|
77 |
-
set_post_format($post_id, $post_format);
|
78 |
-
wp_set_post_tags($post_id, $post_tags);
|
79 |
-
if (isset($post_image) && RetrieveExtension($post_image)) {
|
80 |
-
self::upload_image($post_id, $post_image, $post_image_name);
|
81 |
-
}
|
82 |
-
echo self::message("New post created", 1);
|
83 |
-
exit();
|
84 |
-
}
|
85 |
-
echo self::message("There was an error while trying to create new post", 0);
|
86 |
-
exit();
|
87 |
-
|
88 |
-
private static function get_custom_post_fields()
|
89 |
-
{
|
90 |
-
global $wpdb;
|
91 |
-
$custom_fields = array();
|
92 |
-
$fields = $wpdb->get_results('SELECT DISTINCT meta_key FROM wp_postmeta', OBJECT);
|
93 |
-
foreach ($fields as $field) {
|
94 |
-
if (substr($field->meta_key, 0, 1) != "_") {
|
95 |
-
|
96 |
-
$meta_key = str_replace(" ", "|***|", $field->meta_key);
|
97 |
-
$custom_fields[] = $meta_key;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
return $custom_fields;
|
101 |
-
}
|
102 |
-
|
103 |
-
private static function insert_child_category($category, $wp_categories)
|
104 |
-
{
|
105 |
-
if ($category->parent == 0) {
|
106 |
-
$wp_categories[] = $category;
|
107 |
-
$args = array('hierarchical' => true, 'hide_empty' => 0, 'child_of' => $category->cat_ID);
|
108 |
-
$child_categories = get_categories($args);
|
109 |
-
foreach ($child_categories as $child_cat) {
|
110 |
-
$wp_categories[] = $child_cat;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
return $wp_categories;
|
114 |
-
}
|
115 |
-
|
116 |
-
public static function get_wp_data()
|
117 |
-
{
|
118 |
-
if (!self::authenticate(self::OPTION_DB_NAME)) {
|
119 |
-
echo captainform_cfp_message("There was an error while trying to authenticate with wordpress", 0);
|
120 |
-
exit();
|
121 |
-
}
|
122 |
-
global $wpdb;
|
123 |
-
$data = array();
|
124 |
-
$custom_fields = array();
|
125 |
-
|
126 |
-
$fields = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$wpdb->prefix}postmeta", OBJECT);
|
127 |
-
foreach ($fields as $field) {
|
128 |
-
if (substr($field->meta_key, 0, 1) != "_") {
|
129 |
-
$custom_fields[] = $field->meta_key;
|
130 |
-
}
|
131 |
-
}
|
132 |
-
$data["custom_fields"] = $custom_fields;
|
133 |
-
$args = array('orderby' => 'name', 'hierarchical' => true, 'hide_empty' => 0, 'parent' => 0);
|
134 |
-
$categories = get_categories($args);
|
135 |
-
$wp_categories = array();
|
136 |
-
foreach ($categories as $category) {
|
137 |
-
$wp_categories = self::insert_child_category($category, $wp_categories);
|
138 |
-
}
|
139 |
-
|
140 |
-
$data["categories"] = $wp_categories;
|
141 |
-
$args_authors = array('who' => 'author');
|
142 |
-
$users = get_users($args_authors);
|
143 |
-
$authors = array();
|
144 |
-
foreach ($users as $user) {
|
145 |
-
$authors[] = array("id" => $user->data->ID, "username" => $user->data->user_login);
|
146 |
-
}
|
147 |
-
$data["authors"] = $authors;
|
148 |
-
echo json_encode($data);
|
149 |
-
exit();
|
150 |
-
}
|
151 |
-
private static function upload_image($post_id, $post_image, $post_image_name = null)
|
152 |
-
{
|
153 |
-
$upload_dir = wp_upload_dir();
|
154 |
-
$upload_path = str_replace('/', DIRECTORY_SEPARATOR, $upload_dir['path']) . DIRECTORY_SEPARATOR;
|
155 |
-
$decoded_img = base64_decode($post_image);
|
156 |
-
if (!$post_image_name) {
|
157 |
-
$filename = 'image.png';
|
158 |
-
} else {
|
159 |
-
$filename = $post_image_name;
|
160 |
-
}
|
161 |
-
$hashed_filename = md5($filename . microtime()) . '_' . $filename;
|
162 |
-
$image_upload = file_put_contents($upload_path . $hashed_filename, $decoded_img);
|
163 |
-
if (!function_exists('wp_handle_sideload')) {
|
164 |
-
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
165 |
-
}
|
166 |
-
if (!function_exists('wp_get_current_user')) {
|
167 |
-
require_once(ABSPATH . 'wp-includes/pluggable.php');
|
168 |
-
}
|
169 |
-
|
170 |
-
$file = array();
|
171 |
-
$file['error'] = '';
|
172 |
-
$file['tmp_name'] = $upload_path . $hashed_filename;
|
173 |
-
$file['name'] = $hashed_filename;
|
174 |
-
$file['type'] = 'image/jpg';
|
175 |
-
$file['size'] = filesize($upload_path . $hashed_filename);
|
176 |
-
|
177 |
-
$file_return = wp_handle_sideload($file, array('test_form' => false));
|
178 |
-
$file_url = $file_return['file'];
|
179 |
-
$filetype = wp_check_filetype(basename($file_url), null);
|
180 |
-
$attachment = array(
|
181 |
-
'guid' => $upload_dir['url'] . '/' . basename($file_url),
|
182 |
-
'post_mime_type' => $filetype['type'],
|
183 |
-
'post_title' => preg_replace('/\.[^.]+$/', '', basename($file_url)),
|
184 |
-
'post_content' => '',
|
185 |
-
'post_status' => 'inherit'
|
186 |
-
);
|
187 |
-
$attach_id = wp_insert_attachment($attachment, $file_url, $post_id);
|
188 |
-
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
189 |
-
$attach_data = wp_generate_attachment_metadata($attach_id, $file_url);
|
190 |
-
wp_update_attachment_metadata($attach_id, $attach_data);
|
191 |
-
update_post_meta($post_id, '_thumbnail_id', $attach_id);
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
new CaptainForm_WP_POSTS();
|
196 |
-
add_action('wp_ajax_cfp-connect', array('CaptainForm_WP_POSTS', 'connect'));
|
197 |
-
add_action('wp_ajax_nopriv_cfp-connect', array('CaptainForm_WP_POSTS', 'connect'));
|
198 |
-
add_action('wp_ajax_cfp-new-post', array('CaptainForm_WP_POSTS', 'new_post'));
|
199 |
-
add_action('wp_ajax_nopriv_cfp-new-post', array('CaptainForm_WP_POSTS', 'new_post'));
|
200 |
-
add_action('wp_ajax_cfp-get-wp-data', array('CaptainForm_WP_POSTS', 'get_wp_data'));
|
201 |
-
add_action('wp_ajax_nopriv_cfp-get-wp-data', array('CaptainForm_WP_POSTS', 'get_wp_data'));
|
202 |
-
add_action('wp_ajax_cfp-check-connection', array('CaptainForm_WP_POSTS', 'check_connection'));
|
203 |
-
add_action('wp_ajax_nopriv_cfp-check-connection', array('CaptainForm_WP_POSTS', 'check_connection'));
|
204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/integrations/wp-users.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
static function connect($param = null)
|
4 |
-
private static function get_wp_roles()
|
5 |
-
$show_admin_bar_front = isset($_REQUEST['show_admin_bar_front']) ? (self::strip_data($_REQUEST['show_admin_bar_front']) == 1 ? 'true' : 'false') : 'false' ;
|
6 |
-
$role = isset($_REQUEST['role']) ? strtolower(self::strip_data($_REQUEST['role'])) : '';
|
7 |
-
$jabber =isset($_REQUEST['jabber']) ? self::strip_data($_REQUEST['jabber']) : '';
|
8 |
-
$aim = isset($_REQUEST['aim']) ? self::strip_data($_REQUEST['aim']) : '';
|
9 |
-
$yahoo =isset($_REQUEST['yahoo']) ? self::strip_data($_REQUEST['yahoo']) : '';
|
10 |
-
$wordpress_url = isset($_REQUEST['wordpress_url']) ? self::strip_data($_REQUEST['wordpress_url']) : '';
|
11 |
-
$send_password = isset($_REQUEST['send_password']) == 1 ? (self::strip_data($_REQUEST['send_password']) == 1 ? true : false) : false;
|
12 |
-
$random_password = isset($_REQUEST['random_password']) ? (self::strip_data($_REQUEST['random_password']) == 1 ? true : false) : false;
|
13 |
-
|
14 |
-
if($random_password == false && trim($password) == "")
|
15 |
-
$random_password = true;
|
16 |
-
|
17 |
-
|
18 |
-
$username_exists = username_exists($username);
|
19 |
-
$email_exists = email_exists($email_address);
|
20 |
-
if(!empty($username_exists)|| !empty($email_exists))
|
21 |
-
{
|
22 |
-
$labels_arr = array();
|
23 |
-
$message = '';
|
24 |
-
if(!empty($username_exists))
|
25 |
-
$labels_arr[] = 'username';
|
26 |
-
if(!empty($email_exists))
|
27 |
-
$labels_arr[] = 'email';
|
28 |
-
$labels_string = implode(" and ", $labels_arr);
|
29 |
-
$aux = (count($labels_arr)>1 ? "": "s");
|
30 |
-
$message = sprintf("There was an error when trying to create the WordPress user. Sorry, that %s already exist%s!", $labels_string, $aux);
|
31 |
-
echo self::message($message, 0);
|
32 |
-
exit();
|
33 |
-
}
|
34 |
-
|
35 |
-
if (empty($username_exists) && empty($email_exists))
|
36 |
-
{
|
37 |
-
// Generate the password and create the user
|
38 |
-
{
|
39 |
-
}
|
40 |
-
{
|
41 |
-
// Email the user
|
42 |
-
$headers = 'From: ' . $admin_email . ' <' . $admin_email . '>' . "\r\n";
|
43 |
-
$headers .= "MIME-Version: 1.0\r\n";
|
44 |
-
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
|
45 |
-
|
46 |
-
$email_content = 'Hello,<br /><br />';
|
47 |
-
$email_content .= '<b>Email Address</b>: ' . $email_address . '<br />';
|
48 |
-
|
49 |
-
if($random_password || $send_password)
|
50 |
-
wp_mail($email_address, 'Welcome!', $email_content, $headers);
|
51 |
-
$data = array();
|
52 |
-
if($status == 0 && is_wp_error( $user_id ))
|
53 |
-
{
|
54 |
-
$message = $user_id->get_error_message();
|
55 |
-
}
|
56 |
-
echo self::message($message, $status, json_encode($data));
|
57 |
-
static function get_wp_data()
|
58 |
-
new CaptainForm_WP_Users();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/js/chosen.jquery.js
DELETED
@@ -1,1317 +0,0 @@
|
|
1 |
-
|
2 |
-
(function() {
|
3 |
-
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
4 |
-
__hasProp = {}.hasOwnProperty,
|
5 |
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
6 |
-
|
7 |
-
SelectParser = (function() {
|
8 |
-
function SelectParser() {
|
9 |
-
this.options_index = 0;
|
10 |
-
this.parsed = [];
|
11 |
-
}
|
12 |
-
|
13 |
-
SelectParser.prototype.add_node = function(child) {
|
14 |
-
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
15 |
-
return this.add_group(child);
|
16 |
-
} else {
|
17 |
-
return this.add_option(child);
|
18 |
-
}
|
19 |
-
};
|
20 |
-
|
21 |
-
SelectParser.prototype.add_group = function(group) {
|
22 |
-
var group_position, option, _i, _len, _ref, _results;
|
23 |
-
group_position = this.parsed.length;
|
24 |
-
this.parsed.push({
|
25 |
-
array_index: group_position,
|
26 |
-
group: true,
|
27 |
-
label: this.escapeExpression(group.label),
|
28 |
-
children: 0,
|
29 |
-
disabled: group.disabled
|
30 |
-
});
|
31 |
-
_ref = group.childNodes;
|
32 |
-
_results = [];
|
33 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
34 |
-
option = _ref[_i];
|
35 |
-
_results.push(this.add_option(option, group_position, group.disabled));
|
36 |
-
}
|
37 |
-
return _results;
|
38 |
-
};
|
39 |
-
|
40 |
-
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
41 |
-
if (option.nodeName.toUpperCase() === "OPTION") {
|
42 |
-
if (option.text !== "") {
|
43 |
-
if (group_position != null) {
|
44 |
-
this.parsed[group_position].children += 1;
|
45 |
-
}
|
46 |
-
this.parsed.push({
|
47 |
-
array_index: this.parsed.length,
|
48 |
-
options_index: this.options_index,
|
49 |
-
value: option.value,
|
50 |
-
text: option.text,
|
51 |
-
html: option.innerHTML,
|
52 |
-
selected: option.selected,
|
53 |
-
disabled: group_disabled === true ? group_disabled : option.disabled,
|
54 |
-
group_array_index: group_position,
|
55 |
-
classes: option.className,
|
56 |
-
style: option.style.cssText
|
57 |
-
});
|
58 |
-
} else {
|
59 |
-
this.parsed.push({
|
60 |
-
array_index: this.parsed.length,
|
61 |
-
options_index: this.options_index,
|
62 |
-
empty: true
|
63 |
-
});
|
64 |
-
}
|
65 |
-
return this.options_index += 1;
|
66 |
-
}
|
67 |
-
};
|
68 |
-
|
69 |
-
SelectParser.prototype.escapeExpression = function(text) {
|
70 |
-
var map, unsafe_chars;
|
71 |
-
if ((text == null) || text === false) {
|
72 |
-
return "";
|
73 |
-
}
|
74 |
-
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
75 |
-
return text;
|
76 |
-
}
|
77 |
-
map = {
|
78 |
-
"<": "<",
|
79 |
-
">": ">",
|
80 |
-
'"': """,
|
81 |
-
"'": "'",
|
82 |
-
"`": "`"
|
83 |
-
};
|
84 |
-
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
85 |
-
return text.replace(unsafe_chars, function(chr) {
|
86 |
-
return map[chr] || "&";
|
87 |
-
});
|
88 |
-
};
|
89 |
-
|
90 |
-
return SelectParser;
|
91 |
-
|
92 |
-
})();
|
93 |
-
|
94 |
-
SelectParser.select_to_array = function(select) {
|
95 |
-
var child, parser, _i, _len, _ref;
|
96 |
-
parser = new SelectParser();
|
97 |
-
_ref = select.childNodes;
|
98 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
99 |
-
child = _ref[_i];
|
100 |
-
parser.add_node(child);
|
101 |
-
}
|
102 |
-
return parser.parsed;
|
103 |
-
};
|
104 |
-
|
105 |
-
AbstractChosen = (function() {
|
106 |
-
function AbstractChosen(form_field, options) {
|
107 |
-
this.form_field = form_field;
|
108 |
-
this.options = options != null ? options : {};
|
109 |
-
if (!AbstractChosen.browser_is_supported()) {
|
110 |
-
return;
|
111 |
-
}
|
112 |
-
this.is_multiple = this.form_field.multiple;
|
113 |
-
this.set_default_text();
|
114 |
-
this.set_default_values();
|
115 |
-
this.setup();
|
116 |
-
this.set_up_html();
|
117 |
-
this.register_observers();
|
118 |
-
}
|
119 |
-
|
120 |
-
AbstractChosen.prototype.set_default_values = function() {
|
121 |
-
var _this = this;
|
122 |
-
this.click_test_action = function(evt) {
|
123 |
-
return _this.test_active_click(evt);
|
124 |
-
};
|
125 |
-
this.activate_action = function(evt) {
|
126 |
-
return _this.activate_field(evt);
|
127 |
-
};
|
128 |
-
this.active_field = false;
|
129 |
-
this.mouse_on_container = false;
|
130 |
-
this.results_showing = false;
|
131 |
-
this.result_highlighted = null;
|
132 |
-
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
133 |
-
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
134 |
-
this.disable_search = this.options.disable_search || false;
|
135 |
-
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
136 |
-
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
137 |
-
this.search_contains = this.options.search_contains || false;
|
138 |
-
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
139 |
-
this.max_selected_options = this.options.max_selected_options || Infinity;
|
140 |
-
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
141 |
-
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
142 |
-
return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
143 |
-
};
|
144 |
-
|
145 |
-
AbstractChosen.prototype.set_default_text = function() {
|
146 |
-
if (this.form_field.getAttribute("data-placeholder")) {
|
147 |
-
this.default_text = this.form_field.getAttribute("data-placeholder");
|
148 |
-
} else if (this.is_multiple) {
|
149 |
-
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
150 |
-
} else {
|
151 |
-
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
152 |
-
}
|
153 |
-
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
154 |
-
};
|
155 |
-
|
156 |
-
AbstractChosen.prototype.mouse_enter = function() {
|
157 |
-
return this.mouse_on_container = true;
|
158 |
-
};
|
159 |
-
|
160 |
-
AbstractChosen.prototype.mouse_leave = function() {
|
161 |
-
return this.mouse_on_container = false;
|
162 |
-
};
|
163 |
-
|
164 |
-
AbstractChosen.prototype.input_focus = function(evt) {
|
165 |
-
var _this = this;
|
166 |
-
if (this.is_multiple) {
|
167 |
-
if (!this.active_field) {
|
168 |
-
return setTimeout((function() {
|
169 |
-
return _this.container_mousedown();
|
170 |
-
}), 50);
|
171 |
-
}
|
172 |
-
} else {
|
173 |
-
if (!this.active_field) {
|
174 |
-
return this.activate_field();
|
175 |
-
}
|
176 |
-
}
|
177 |
-
};
|
178 |
-
|
179 |
-
AbstractChosen.prototype.input_blur = function(evt) {
|
180 |
-
var _this = this;
|
181 |
-
if (!this.mouse_on_container) {
|
182 |
-
this.active_field = false;
|
183 |
-
return setTimeout((function() {
|
184 |
-
return _this.blur_test();
|
185 |
-
}), 100);
|
186 |
-
}
|
187 |
-
};
|
188 |
-
|
189 |
-
AbstractChosen.prototype.results_option_build = function(options) {
|
190 |
-
var content, data, _i, _len, _ref;
|
191 |
-
content = '';
|
192 |
-
_ref = this.results_data;
|
193 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
194 |
-
data = _ref[_i];
|
195 |
-
if (data.group) {
|
196 |
-
content += this.result_add_group(data);
|
197 |
-
} else {
|
198 |
-
content += this.result_add_option(data);
|
199 |
-
}
|
200 |
-
if (options != null ? options.first : void 0) {
|
201 |
-
if (data.selected && this.is_multiple) {
|
202 |
-
this.choice_build(data);
|
203 |
-
} else if (data.selected && !this.is_multiple) {
|
204 |
-
this.single_set_selected_text(data.text);
|
205 |
-
}
|
206 |
-
}
|
207 |
-
}
|
208 |
-
return content;
|
209 |
-
};
|
210 |
-
|
211 |
-
AbstractChosen.prototype.result_add_option = function(option) {
|
212 |
-
var classes, option_el;
|
213 |
-
if (!option.search_match) {
|
214 |
-
return '';
|
215 |
-
}
|
216 |
-
if (!this.include_option_in_results(option)) {
|
217 |
-
return '';
|
218 |
-
}
|
219 |
-
classes = [];
|
220 |
-
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
221 |
-
classes.push("active-result");
|
222 |
-
}
|
223 |
-
if (option.disabled && !(option.selected && this.is_multiple)) {
|
224 |
-
classes.push("disabled-result");
|
225 |
-
}
|
226 |
-
if (option.selected) {
|
227 |
-
classes.push("result-selected");
|
228 |
-
}
|
229 |
-
if (option.group_array_index != null) {
|
230 |
-
classes.push("group-option");
|
231 |
-
}
|
232 |
-
if (option.classes !== "") {
|
233 |
-
classes.push(option.classes);
|
234 |
-
}
|
235 |
-
option_el = document.createElement("li");
|
236 |
-
option_el.className = classes.join(" ");
|
237 |
-
option_el.style.cssText = option.style;
|
238 |
-
option_el.setAttribute("data-option-array-index", option.array_index);
|
239 |
-
option_el.innerHTML = option.search_text;
|
240 |
-
return this.outerHTML(option_el);
|
241 |
-
};
|
242 |
-
|
243 |
-
AbstractChosen.prototype.result_add_group = function(group) {
|
244 |
-
var group_el;
|
245 |
-
if (!(group.search_match || group.group_match)) {
|
246 |
-
return '';
|
247 |
-
}
|
248 |
-
if (!(group.active_options > 0)) {
|
249 |
-
return '';
|
250 |
-
}
|
251 |
-
group_el = document.createElement("li");
|
252 |
-
group_el.className = "group-result";
|
253 |
-
group_el.innerHTML = group.search_text;
|
254 |
-
return this.outerHTML(group_el);
|
255 |
-
};
|
256 |
-
|
257 |
-
AbstractChosen.prototype.results_update_field = function() {
|
258 |
-
this.set_default_text();
|
259 |
-
if (!this.is_multiple) {
|
260 |
-
this.results_reset_cleanup();
|
261 |
-
}
|
262 |
-
this.result_clear_highlight();
|
263 |
-
this.results_build();
|
264 |
-
if (this.results_showing) {
|
265 |
-
return this.winnow_results();
|
266 |
-
}
|
267 |
-
};
|
268 |
-
|
269 |
-
AbstractChosen.prototype.reset_single_select_options = function() {
|
270 |
-
var result, _i, _len, _ref, _results;
|
271 |
-
_ref = this.results_data;
|
272 |
-
_results = [];
|
273 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
274 |
-
result = _ref[_i];
|
275 |
-
if (result.selected) {
|
276 |
-
_results.push(result.selected = false);
|
277 |
-
} else {
|
278 |
-
_results.push(void 0);
|
279 |
-
}
|
280 |
-
}
|
281 |
-
return _results;
|
282 |
-
};
|
283 |
-
|
284 |
-
AbstractChosen.prototype.results_toggle = function() {
|
285 |
-
if (this.results_showing) {
|
286 |
-
return this.results_hide();
|
287 |
-
} else {
|
288 |
-
return this.results_show();
|
289 |
-
}
|
290 |
-
};
|
291 |
-
|
292 |
-
AbstractChosen.prototype.results_search = function(evt) {
|
293 |
-
if (this.results_showing) {
|
294 |
-
return this.winnow_results();
|
295 |
-
} else {
|
296 |
-
return this.results_show();
|
297 |
-
}
|
298 |
-
};
|
299 |
-
|
300 |
-
AbstractChosen.prototype.winnow_results = function() {
|
301 |
-
var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
302 |
-
this.no_results_clear();
|
303 |
-
results = 0;
|
304 |
-
searchText = this.get_search_text();
|
305 |
-
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
306 |
-
regexAnchor = this.search_contains ? "" : "^"; // aditza rev
|
307 |
-
regex = new RegExp(regexAnchor + escapedSearchText, 'i');
|
308 |
-
zregex = new RegExp(escapedSearchText, 'i');
|
309 |
-
_ref = this.results_data;
|
310 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
311 |
-
option = _ref[_i];
|
312 |
-
option.search_match = false;
|
313 |
-
results_group = null;
|
314 |
-
if (this.include_option_in_results(option)) {
|
315 |
-
if (option.group) {
|
316 |
-
option.group_match = false;
|
317 |
-
option.active_options = 0;
|
318 |
-
}
|
319 |
-
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
320 |
-
results_group = this.results_data[option.group_array_index];
|
321 |
-
if (results_group.active_options === 0 && results_group.search_match) {
|
322 |
-
results += 1;
|
323 |
-
}
|
324 |
-
results_group.active_options += 1;
|
325 |
-
}
|
326 |
-
if (!(option.group && !this.group_search)) {
|
327 |
-
option.search_text = option.group ? option.label : option.html;
|
328 |
-
option.search_match = this.search_string_match(option.search_text, regex);
|
329 |
-
if (option.search_match && !option.group) {
|
330 |
-
results += 1;
|
331 |
-
}
|
332 |
-
if (option.search_match) {
|
333 |
-
if (searchText.length) {
|
334 |
-
startpos = option.search_text.search(zregex);
|
335 |
-
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
336 |
-
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
337 |
-
}
|
338 |
-
if (results_group != null) {
|
339 |
-
results_group.group_match = true;
|
340 |
-
}
|
341 |
-
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
342 |
-
option.search_match = true;
|
343 |
-
}
|
344 |
-
}
|
345 |
-
}
|
346 |
-
}
|
347 |
-
this.result_clear_highlight();
|
348 |
-
if (results < 1 && searchText.length) {
|
349 |
-
this.update_results_content("");
|
350 |
-
return this.no_results(searchText);
|
351 |
-
} else {
|
352 |
-
this.update_results_content(this.results_option_build());
|
353 |
-
return this.winnow_results_set_highlight();
|
354 |
-
}
|
355 |
-
};
|
356 |
-
|
357 |
-
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
358 |
-
var part, parts, _i, _len;
|
359 |
-
if (regex.test(search_string)) {
|
360 |
-
return true;
|
361 |
-
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
362 |
-
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
363 |
-
if (parts.length) {
|
364 |
-
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
365 |
-
part = parts[_i];
|
366 |
-
if (regex.test(part)) {
|
367 |
-
return true;
|
368 |
-
}
|
369 |
-
}
|
370 |
-
}
|
371 |
-
}
|
372 |
-
};
|
373 |
-
|
374 |
-
AbstractChosen.prototype.choices_count = function() {
|
375 |
-
var option, _i, _len, _ref;
|
376 |
-
if (this.selected_option_count != null) {
|
377 |
-
return this.selected_option_count;
|
378 |
-
}
|
379 |
-
this.selected_option_count = 0;
|
380 |
-
_ref = this.form_field.options;
|
381 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
382 |
-
option = _ref[_i];
|
383 |
-
if (option.selected) {
|
384 |
-
this.selected_option_count += 1;
|
385 |
-
}
|
386 |
-
}
|
387 |
-
return this.selected_option_count;
|
388 |
-
};
|
389 |
-
|
390 |
-
AbstractChosen.prototype.choices_click = function(evt) {
|
391 |
-
evt.preventDefault();
|
392 |
-
if (!(this.results_showing || this.is_disabled)) {
|
393 |
-
return this.results_show();
|
394 |
-
}
|
395 |
-
};
|
396 |
-
|
397 |
-
AbstractChosen.prototype.keyup_checker = function(evt) {
|
398 |
-
var stroke, _ref;
|
399 |
-
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
400 |
-
this.search_field_scale();
|
401 |
-
switch (stroke) {
|
402 |
-
case 8:
|
403 |
-
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
404 |
-
return this.keydown_backstroke();
|
405 |
-
} else if (!this.pending_backstroke) {
|
406 |
-
this.result_clear_highlight();
|
407 |
-
return this.results_search();
|
408 |
-
}
|
409 |
-
break;
|
410 |
-
case 13:
|
411 |
-
evt.preventDefault();
|
412 |
-
if (this.results_showing) {
|
413 |
-
if (!this.is_multiple || this.result_highlight) {
|
414 |
-
return this.result_select(evt);
|
415 |
-
}
|
416 |
-
|
417 |
-
//daca select-ul are clasa "chosen-allow-additem" will activate create option option
|
418 |
-
if( this.form_field_jq.hasClass('chosen-allow-additem') ) {
|
419 |
-
$(this.form_field).append('<option>' + $(evt.target).val() + '</option>');
|
420 |
-
$(this.form_field).trigger('chosen:updated');
|
421 |
-
this.result_highlight = this.search_results.find('li.active-result').last();
|
422 |
-
return this.result_select(evt);
|
423 |
-
}
|
424 |
-
}
|
425 |
-
|
426 |
-
break;
|
427 |
-
case 188:
|
428 |
-
evt.preventDefault();
|
429 |
-
if (this.results_showing) {
|
430 |
-
if (!this.is_multiple || this.result_highlight) {
|
431 |
-
return this.result_select(evt);
|
432 |
-
}
|
433 |
-
|
434 |
-
//daca select-ul are clasa "chosen-allow-additem" will activate create option option
|
435 |
-
if( this.form_field_jq.hasClass('chosen-allow-additem') ) {
|
436 |
-
$(this.form_field).append('<option>' + $(evt.target).val() + '</option>');
|
437 |
-
$(this.form_field).trigger('chosen:updated');
|
438 |
-
this.result_highlight = this.search_results.find('li.active-result').last();
|
439 |
-
return this.result_select(evt);
|
440 |
-
}
|
441 |
-
}
|
442 |
-
|
443 |
-
break;
|
444 |
-
case 27:
|
445 |
-
if (this.results_showing) {
|
446 |
-
this.results_hide();
|
447 |
-
}
|
448 |
-
return true;
|
449 |
-
case 9:
|
450 |
-
case 38:
|
451 |
-
case 40:
|
452 |
-
case 16:
|
453 |
-
case 91:
|
454 |
-
case 17:
|
455 |
-
break;
|
456 |
-
default:
|
457 |
-
return this.results_search();
|
458 |
-
}
|
459 |
-
};
|
460 |
-
|
461 |
-
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
462 |
-
var _this = this;
|
463 |
-
return setTimeout((function() {
|
464 |
-
return _this.results_search();
|
465 |
-
}), 50);
|
466 |
-
};
|
467 |
-
|
468 |
-
// adrian
|
469 |
-
AbstractChosen.prototype.container_width = function() {
|
470 |
-
if (this.options.width != null) {
|
471 |
-
return this.options.width;
|
472 |
-
} else {
|
473 |
-
var xxx = this.form_field.offsetWidth + 20;
|
474 |
-
return "" + xxx + "px";
|
475 |
-
//return "70%";
|
476 |
-
}
|
477 |
-
};
|
478 |
-
|
479 |
-
// original
|
480 |
-
/*
|
481 |
-
AbstractChosen.prototype.container_width = function() {
|
482 |
-
if (this.options.width != null) {
|
483 |
-
return this.options.width;
|
484 |
-
} else {
|
485 |
-
return "" + this.form_field.offsetWidth + "px";
|
486 |
-
}
|
487 |
-
};
|
488 |
-
*/
|
489 |
-
|
490 |
-
AbstractChosen.prototype.include_option_in_results = function(option) {
|
491 |
-
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
492 |
-
return false;
|
493 |
-
}
|
494 |
-
if (!this.display_disabled_options && option.disabled) {
|
495 |
-
return false;
|
496 |
-
}
|
497 |
-
if (option.empty) {
|
498 |
-
return false;
|
499 |
-
}
|
500 |
-
return true;
|
501 |
-
};
|
502 |
-
|
503 |
-
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
504 |
-
this.touch_started = true;
|
505 |
-
return this.search_results_mouseover(evt);
|
506 |
-
};
|
507 |
-
|
508 |
-
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
509 |
-
this.touch_started = false;
|
510 |
-
return this.search_results_mouseout(evt);
|
511 |
-
};
|
512 |
-
|
513 |
-
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
514 |
-
if (this.touch_started) {
|
515 |
-
return this.search_results_mouseup(evt);
|
516 |
-
}
|
517 |
-
};
|
518 |
-
|
519 |
-
AbstractChosen.prototype.outerHTML = function(element) {
|
520 |
-
var tmp;
|
521 |
-
if (element.outerHTML) {
|
522 |
-
return element.outerHTML;
|
523 |
-
}
|
524 |
-
tmp = document.createElement("div");
|
525 |
-
tmp.appendChild(element);
|
526 |
-
return tmp.innerHTML;
|
527 |
-
};
|
528 |
-
|
529 |
-
AbstractChosen.browser_is_supported = function() {
|
530 |
-
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
531 |
-
return document.documentMode >= 8;
|
532 |
-
}
|
533 |
-
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
534 |
-
return false;
|
535 |
-
}
|
536 |
-
if (/Android/i.test(window.navigator.userAgent)) {
|
537 |
-
if (/Mobile/i.test(window.navigator.userAgent)) {
|
538 |
-
return false;
|
539 |
-
}
|
540 |
-
}
|
541 |
-
return true;
|
542 |
-
};
|
543 |
-
|
544 |
-
AbstractChosen.default_multiple_text = "Select Some Options";
|
545 |
-
|
546 |
-
AbstractChosen.default_single_text = "Select an Option";
|
547 |
-
|
548 |
-
AbstractChosen.default_no_result_text = "No results match";
|
549 |
-
|
550 |
-
return AbstractChosen;
|
551 |
-
|
552 |
-
})();
|
553 |
-
|
554 |
-
$ = jQuery;
|
555 |
-
|
556 |
-
$.fn.extend({
|
557 |
-
chosen: function(options) {
|
558 |
-
if (!AbstractChosen.browser_is_supported()) {
|
559 |
-
return this;
|
560 |
-
}
|
561 |
-
return this.each(function(input_field) {
|
562 |
-
var $this, chosen;
|
563 |
-
$this = $(this);
|
564 |
-
chosen = $this.data('chosen');
|
565 |
-
if (options === 'destroy' && chosen) {
|
566 |
-
chosen.destroy();
|
567 |
-
} else if (!chosen) {
|
568 |
-
$this.data('chosen', new Chosen(this, options));
|
569 |
-
}
|
570 |
-
});
|
571 |
-
}
|
572 |
-
});
|
573 |
-
|
574 |
-
Chosen = (function(_super) {
|
575 |
-
__extends(Chosen, _super);
|
576 |
-
|
577 |
-
function Chosen() {
|
578 |
-
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
579 |
-
return _ref;
|
580 |
-
}
|
581 |
-
|
582 |
-
Chosen.prototype.setup = function() {
|
583 |
-
this.form_field_jq = $(this.form_field);
|
584 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
585 |
-
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
586 |
-
};
|
587 |
-
|
588 |
-
Chosen.prototype.set_up_html = function() {
|
589 |
-
var container_classes, container_props;
|
590 |
-
container_classes = ["chosen-container"];
|
591 |
-
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
592 |
-
if (this.inherit_select_classes && this.form_field.className) {
|
593 |
-
container_classes.push(this.form_field.className);
|
594 |
-
}
|
595 |
-
if (this.is_rtl) {
|
596 |
-
container_classes.push("chosen-rtl");
|
597 |
-
}
|
598 |
-
|
599 |
-
// adrian force width
|
600 |
-
$('#'+this.form_field.id).show();
|
601 |
-
var woobb = $('#'+this.form_field.id).width()+20;
|
602 |
-
|
603 |
-
container_props = {
|
604 |
-
'class': container_classes.join(' '),
|
605 |
-
'style': "width: " + ( woobb ) + "px;", // adrian
|
606 |
-
'title': this.form_field.title
|
607 |
-
};
|
608 |
-
|
609 |
-
|
610 |
-
if (this.form_field.id.length) {
|
611 |
-
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
612 |
-
}
|
613 |
-
if (this.form_field.getAttribute('onclick') != '') {
|
614 |
-
container_props.onclick = this.form_field.getAttribute('onclick');
|
615 |
-
container_props.onfocus = this.form_field.getAttribute('onclick');
|
616 |
-
}
|
617 |
-
|
618 |
-
this.container = $("<div />", container_props);
|
619 |
-
if (this.is_multiple) {
|
620 |
-
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
621 |
-
} else {
|
622 |
-
this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div class="bbarrow"><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
623 |
-
}
|
624 |
-
this.form_field_jq.hide().after(this.container);
|
625 |
-
this.dropdown = this.container.find('div.chosen-drop').first();
|
626 |
-
this.search_field = this.container.find('input').first();
|
627 |
-
this.search_results = this.container.find('ul.chosen-results').first();
|
628 |
-
this.search_field_scale();
|
629 |
-
this.search_no_results = this.container.find('li.no-results').first();
|
630 |
-
if (this.is_multiple) {
|
631 |
-
this.search_choices = this.container.find('ul.chosen-choices').first();
|
632 |
-
this.search_container = this.container.find('li.search-field').first();
|
633 |
-
} else {
|
634 |
-
this.search_container = this.container.find('div.chosen-search').first();
|
635 |
-
this.selected_item = this.container.find('.chosen-single').first();
|
636 |
-
}
|
637 |
-
this.results_build();
|
638 |
-
this.set_tab_index();
|
639 |
-
this.set_label_behavior();
|
640 |
-
return this.form_field_jq.trigger("chosen:ready", {
|
641 |
-
chosen: this
|
642 |
-
});
|
643 |
-
};
|
644 |
-
|
645 |
-
Chosen.prototype.register_observers = function() {
|
646 |
-
var _this = this;
|
647 |
-
this.container.bind('mousedown.chosen', function(evt) {
|
648 |
-
_this.container_mousedown(evt);
|
649 |
-
});
|
650 |
-
this.container.bind('mouseup.chosen', function(evt) {
|
651 |
-
_this.container_mouseup(evt);
|
652 |
-
});
|
653 |
-
this.container.bind('mouseenter.chosen', function(evt) {
|
654 |
-
_this.mouse_enter(evt);
|
655 |
-
});
|
656 |
-
this.container.bind('mouseleave.chosen', function(evt) {
|
657 |
-
_this.mouse_leave(evt);
|
658 |
-
});
|
659 |
-
this.search_results.bind('mouseup.chosen', function(evt) {
|
660 |
-
_this.search_results_mouseup(evt);
|
661 |
-
});
|
662 |
-
this.search_results.bind('mouseover.chosen', function(evt) {
|
663 |
-
_this.search_results_mouseover(evt);
|
664 |
-
});
|
665 |
-
this.search_results.bind('mouseout.chosen', function(evt) {
|
666 |
-
_this.search_results_mouseout(evt);
|
667 |
-
});
|
668 |
-
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
669 |
-
_this.search_results_mousewheel(evt);
|
670 |
-
});
|
671 |
-
this.search_results.bind('touchstart.chosen', function(evt) {
|
672 |
-
_this.search_results_touchstart(evt);
|
673 |
-
});
|
674 |
-
this.search_results.bind('touchmove.chosen', function(evt) {
|
675 |
-
_this.search_results_touchmove(evt);
|
676 |
-
});
|
677 |
-
this.search_results.bind('touchend.chosen', function(evt) {
|
678 |
-
_this.search_results_touchend(evt);
|
679 |
-
});
|
680 |
-
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
681 |
-
_this.results_update_field(evt);
|
682 |
-
});
|
683 |
-
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
684 |
-
_this.activate_field(evt);
|
685 |
-
});
|
686 |
-
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
687 |
-
_this.container_mousedown(evt);
|
688 |
-
});
|
689 |
-
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
690 |
-
_this.input_blur(evt);
|
691 |
-
});
|
692 |
-
this.search_field.bind('blur.chosen', function(evt) {
|
693 |
-
_this.input_blur(evt);
|
694 |
-
});
|
695 |
-
this.search_field.bind('keyup.chosen', function(evt) {
|
696 |
-
_this.keyup_checker(evt);
|
697 |
-
});
|
698 |
-
this.search_field.bind('keydown.chosen', function(evt) {
|
699 |
-
_this.keydown_checker(evt);
|
700 |
-
});
|
701 |
-
this.search_field.bind('focus.chosen', function(evt) {
|
702 |
-
_this.input_focus(evt);
|
703 |
-
});
|
704 |
-
this.search_field.bind('cut.chosen', function(evt) {
|
705 |
-
_this.clipboard_event_checker(evt);
|
706 |
-
});
|
707 |
-
this.search_field.bind('paste.chosen', function(evt) {
|
708 |
-
_this.clipboard_event_checker(evt);
|
709 |
-
});
|
710 |
-
if (this.is_multiple) {
|
711 |
-
return this.search_choices.bind('click.chosen', function(evt) {
|
712 |
-
_this.choices_click(evt);
|
713 |
-
});
|
714 |
-
} else {
|
715 |
-
return this.container.bind('click.chosen', function(evt) {
|
716 |
-
evt.preventDefault();
|
717 |
-
});
|
718 |
-
}
|
719 |
-
};
|
720 |
-
|
721 |
-
Chosen.prototype.destroy = function() {
|
722 |
-
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
723 |
-
if (this.search_field[0].tabIndex) {
|
724 |
-
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
725 |
-
}
|
726 |
-
this.container.remove();
|
727 |
-
this.form_field_jq.removeData('chosen');
|
728 |
-
return this.form_field_jq.show();
|
729 |
-
};
|
730 |
-
|
731 |
-
Chosen.prototype.search_field_disabled = function() {
|
732 |
-
this.is_disabled = this.form_field_jq[0].disabled;
|
733 |
-
if (this.is_disabled) {
|
734 |
-
this.container.addClass('chosen-disabled');
|
735 |
-
this.search_field[0].disabled = true;
|
736 |
-
if (!this.is_multiple) {
|
737 |
-
this.selected_item.unbind("focus.chosen", this.activate_action);
|
738 |
-
}
|
739 |
-
return this.close_field();
|
740 |
-
} else {
|
741 |
-
this.container.removeClass('chosen-disabled');
|
742 |
-
this.search_field[0].disabled = false;
|
743 |
-
if (!this.is_multiple) {
|
744 |
-
return this.selected_item.bind("focus.chosen", this.activate_action);
|
745 |
-
}
|
746 |
-
}
|
747 |
-
};
|
748 |
-
|
749 |
-
Chosen.prototype.container_mousedown = function(evt) {
|
750 |
-
if (!this.is_disabled) {
|
751 |
-
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
752 |
-
evt.preventDefault();
|
753 |
-
}
|
754 |
-
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
755 |
-
if (!this.active_field) {
|
756 |
-
if (this.is_multiple) {
|
757 |
-
this.search_field.val("");
|
758 |
-
}
|
759 |
-
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
760 |
-
this.results_show();
|
761 |
-
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
762 |
-
evt.preventDefault();
|
763 |
-
this.results_toggle();
|
764 |
-
}
|
765 |
-
return this.activate_field();
|
766 |
-
}
|
767 |
-
}
|
768 |
-
};
|
769 |
-
|
770 |
-
Chosen.prototype.container_mouseup = function(evt) {
|
771 |
-
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
772 |
-
return this.results_reset(evt);
|
773 |
-
}
|
774 |
-
};
|
775 |
-
|
776 |
-
Chosen.prototype.search_results_mousewheel = function(evt) {
|
777 |
-
var delta;
|
778 |
-
if (evt.originalEvent) {
|
779 |
-
delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
780 |
-
}
|
781 |
-
if (delta != null) {
|
782 |
-
evt.preventDefault();
|
783 |
-
if (evt.type === 'DOMMouseScroll') {
|
784 |
-
delta = delta * 40;
|
785 |
-
}
|
786 |
-
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
787 |
-
}
|
788 |
-
};
|
789 |
-
|
790 |
-
Chosen.prototype.blur_test = function(evt) {
|
791 |
-
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
792 |
-
return this.close_field();
|
793 |
-
}
|
794 |
-
};
|
795 |
-
|
796 |
-
Chosen.prototype.close_field = function() {
|
797 |
-
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
798 |
-
this.active_field = false;
|
799 |
-
this.results_hide();
|
800 |
-
this.container.removeClass("chosen-container-active");
|
801 |
-
this.clear_backstroke();
|
802 |
-
this.show_search_field_default();
|
803 |
-
return this.search_field_scale();
|
804 |
-
};
|
805 |
-
|
806 |
-
Chosen.prototype.activate_field = function() {
|
807 |
-
this.container.addClass("chosen-container-active");
|
808 |
-
this.active_field = true;
|
809 |
-
this.search_field.val(this.search_field.val());
|
810 |
-
return this.search_field.focus();
|
811 |
-
};
|
812 |
-
|
813 |
-
Chosen.prototype.test_active_click = function(evt) {
|
814 |
-
var active_container;
|
815 |
-
active_container = $(evt.target).closest('.chosen-container');
|
816 |
-
if (active_container.length && this.container[0] === active_container[0]) {
|
817 |
-
return this.active_field = true;
|
818 |
-
} else {
|
819 |
-
return this.close_field();
|
820 |
-
}
|
821 |
-
};
|
822 |
-
|
823 |
-
Chosen.prototype.results_build = function() {
|
824 |
-
this.parsing = true;
|
825 |
-
this.selected_option_count = null;
|
826 |
-
this.results_data = SelectParser.select_to_array(this.form_field);
|
827 |
-
if (this.is_multiple) {
|
828 |
-
this.search_choices.find("li.search-choice").remove();
|
829 |
-
} else if (!this.is_multiple) {
|
830 |
-
this.single_set_selected_text();
|
831 |
-
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
832 |
-
this.search_field[0].readOnly = true;
|
833 |
-
this.container.addClass("chosen-container-single-nosearch");
|
834 |
-
} else {
|
835 |
-
this.search_field[0].readOnly = false;
|
836 |
-
this.container.removeClass("chosen-container-single-nosearch");
|
837 |
-
}
|
838 |
-
}
|
839 |
-
this.update_results_content(this.results_option_build({
|
840 |
-
first: true
|
841 |
-
}));
|
842 |
-
this.search_field_disabled();
|
843 |
-
this.show_search_field_default();
|
844 |
-
this.search_field_scale();
|
845 |
-
return this.parsing = false;
|
846 |
-
};
|
847 |
-
|
848 |
-
Chosen.prototype.result_do_highlight = function(el) {
|
849 |
-
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
850 |
-
if (el.length) {
|
851 |
-
this.result_clear_highlight();
|
852 |
-
this.result_highlight = el;
|
853 |
-
this.result_highlight.addClass("highlighted");
|
854 |
-
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
855 |
-
visible_top = this.search_results.scrollTop();
|
856 |
-
visible_bottom = maxHeight + visible_top;
|
857 |
-
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
858 |
-
high_bottom = high_top + this.result_highlight.outerHeight();
|
859 |
-
if (high_bottom >= visible_bottom) {
|
860 |
-
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
861 |
-
} else if (high_top < visible_top) {
|
862 |
-
return this.search_results.scrollTop(high_top);
|
863 |
-
}
|
864 |
-
}
|
865 |
-
};
|
866 |
-
|
867 |
-
Chosen.prototype.result_clear_highlight = function() {
|
868 |
-
if (this.result_highlight) {
|
869 |
-
this.result_highlight.removeClass("highlighted");
|
870 |
-
}
|
871 |
-
return this.result_highlight = null;
|
872 |
-
};
|
873 |
-
|
874 |
-
Chosen.prototype.results_show = function() {
|
875 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
876 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
877 |
-
chosen: this
|
878 |
-
});
|
879 |
-
return false;
|
880 |
-
}
|
881 |
-
this.container.addClass("chosen-with-drop");
|
882 |
-
this.results_showing = true;
|
883 |
-
this.search_field.focus();
|
884 |
-
this.search_field.val(this.search_field.val());
|
885 |
-
this.winnow_results();
|
886 |
-
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
887 |
-
chosen: this
|
888 |
-
});
|
889 |
-
};
|
890 |
-
|
891 |
-
Chosen.prototype.update_results_content = function(content) {
|
892 |
-
return this.search_results.html(content);
|
893 |
-
};
|
894 |
-
|
895 |
-
Chosen.prototype.results_hide = function() {
|
896 |
-
if (this.results_showing) {
|
897 |
-
this.result_clear_highlight();
|
898 |
-
this.container.removeClass("chosen-with-drop");
|
899 |
-
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
900 |
-
chosen: this
|
901 |
-
});
|
902 |
-
}
|
903 |
-
return this.results_showing = false;
|
904 |
-
};
|
905 |
-
|
906 |
-
Chosen.prototype.set_tab_index = function(el) {
|
907 |
-
var ti;
|
908 |
-
if (this.form_field.tabIndex) {
|
909 |
-
ti = this.form_field.tabIndex;
|
910 |
-
this.form_field.tabIndex = -1;
|
911 |
-
return this.search_field[0].tabIndex = ti;
|
912 |
-
}
|
913 |
-
};
|
914 |
-
|
915 |
-
Chosen.prototype.set_label_behavior = function() {
|
916 |
-
var _this = this;
|
917 |
-
this.form_field_label = this.form_field_jq.parents("label");
|
918 |
-
if (!this.form_field_label.length && this.form_field.id.length) {
|
919 |
-
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
920 |
-
}
|
921 |
-
if (this.form_field_label.length > 0) {
|
922 |
-
return this.form_field_label.bind('click.chosen', function(evt) {
|
923 |
-
if (_this.is_multiple) {
|
924 |
-
return _this.container_mousedown(evt);
|
925 |
-
} else {
|
926 |
-
return _this.activate_field();
|
927 |
-
}
|
928 |
-
});
|
929 |
-
}
|
930 |
-
};
|
931 |
-
|
932 |
-
Chosen.prototype.show_search_field_default = function() {
|
933 |
-
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
934 |
-
this.search_field.val(this.default_text);
|
935 |
-
return this.search_field.addClass("default");
|
936 |
-
} else {
|
937 |
-
this.search_field.val("");
|
938 |
-
return this.search_field.removeClass("default");
|
939 |
-
}
|
940 |
-
};
|
941 |
-
|
942 |
-
Chosen.prototype.search_results_mouseup = function(evt) {
|
943 |
-
var target;
|
944 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
945 |
-
if (target.length) {
|
946 |
-
this.result_highlight = target;
|
947 |
-
this.result_select(evt);
|
948 |
-
return this.search_field.focus();
|
949 |
-
}
|
950 |
-
};
|
951 |
-
|
952 |
-
Chosen.prototype.search_results_mouseover = function(evt) {
|
953 |
-
var target;
|
954 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
955 |
-
if (target) {
|
956 |
-
return this.result_do_highlight(target);
|
957 |
-
}
|
958 |
-
};
|
959 |
-
|
960 |
-
Chosen.prototype.search_results_mouseout = function(evt) {
|
961 |
-
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
962 |
-
return this.result_clear_highlight();
|
963 |
-
}
|
964 |
-
};
|
965 |
-
|
966 |
-
Chosen.prototype.choice_build = function(item) {
|
967 |
-
var choice, close_link,
|
968 |
-
_this = this;
|
969 |
-
choice = $('<li />', {
|
970 |
-
"class": "search-choice"
|
971 |
-
}).html("<span>" + item.html + "</span>");
|
972 |
-
if (item.disabled) {
|
973 |
-
choice.addClass('search-choice-disabled');
|
974 |
-
} else {
|
975 |
-
close_link = $('<a />', {
|
976 |
-
"class": 'search-choice-close',
|
977 |
-
'data-option-array-index': item.array_index
|
978 |
-
});
|
979 |
-
close_link.bind('click.chosen', function(evt) {
|
980 |
-
return _this.choice_destroy_link_click(evt);
|
981 |
-
});
|
982 |
-
choice.append(close_link);
|
983 |
-
}
|
984 |
-
return this.search_container.before(choice);
|
985 |
-
};
|
986 |
-
|
987 |
-
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
988 |
-
evt.preventDefault();
|
989 |
-
evt.stopPropagation();
|
990 |
-
if (!this.is_disabled) {
|
991 |
-
return this.choice_destroy($(evt.target));
|
992 |
-
}
|
993 |
-
};
|
994 |
-
|
995 |
-
Chosen.prototype.choice_destroy = function(link) {
|
996 |
-
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
997 |
-
this.show_search_field_default();
|
998 |
-
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
999 |
-
this.results_hide();
|
1000 |
-
}
|
1001 |
-
link.parents('li').first().remove();
|
1002 |
-
return this.search_field_scale();
|
1003 |
-
}
|
1004 |
-
};
|
1005 |
-
|
1006 |
-
Chosen.prototype.results_reset = function() {
|
1007 |
-
this.reset_single_select_options();
|
1008 |
-
this.form_field.options[0].selected = true;
|
1009 |
-
this.single_set_selected_text();
|
1010 |
-
this.show_search_field_default();
|
1011 |
-
this.results_reset_cleanup();
|
1012 |
-
this.form_field_jq.trigger("change");
|
1013 |
-
if (this.active_field) {
|
1014 |
-
return this.results_hide();
|
1015 |
-
}
|
1016 |
-
};
|
1017 |
-
|
1018 |
-
Chosen.prototype.results_reset_cleanup = function() {
|
1019 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
1020 |
-
return this.selected_item.find("abbr").remove();
|
1021 |
-
};
|
1022 |
-
|
1023 |
-
Chosen.prototype.result_select = function(evt) {
|
1024 |
-
var high, item;
|
1025 |
-
if (this.result_highlight) {
|
1026 |
-
high = this.result_highlight;
|
1027 |
-
this.result_clear_highlight();
|
1028 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1029 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
1030 |
-
chosen: this
|
1031 |
-
});
|
1032 |
-
return false;
|
1033 |
-
}
|
1034 |
-
if (this.is_multiple) {
|
1035 |
-
high.removeClass("active-result");
|
1036 |
-
} else {
|
1037 |
-
this.reset_single_select_options();
|
1038 |
-
}
|
1039 |
-
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
1040 |
-
item.selected = true;
|
1041 |
-
this.form_field.options[item.options_index].selected = true;
|
1042 |
-
this.selected_option_count = null;
|
1043 |
-
if (this.is_multiple) {
|
1044 |
-
this.choice_build(item);
|
1045 |
-
} else {
|
1046 |
-
this.single_set_selected_text(item.text);
|
1047 |
-
}
|
1048 |
-
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1049 |
-
this.results_hide();
|
1050 |
-
}
|
1051 |
-
this.search_field.val("");
|
1052 |
-
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1053 |
-
this.form_field_jq.trigger("change", {
|
1054 |
-
'selected': this.form_field.options[item.options_index].value
|
1055 |
-
});
|
1056 |
-
}
|
1057 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
1058 |
-
return this.search_field_scale();
|
1059 |
-
}
|
1060 |
-
};
|
1061 |
-
|
1062 |
-
Chosen.prototype.single_set_selected_text = function(text) {
|
1063 |
-
if (text == null) {
|
1064 |
-
text = this.default_text;
|
1065 |
-
}
|
1066 |
-
if (text === this.default_text) {
|
1067 |
-
this.selected_item.addClass("chosen-default");
|
1068 |
-
} else {
|
1069 |
-
this.single_deselect_control_build();
|
1070 |
-
this.selected_item.removeClass("chosen-default");
|
1071 |
-
}
|
1072 |
-
return this.selected_item.find("span").text(text);
|
1073 |
-
};
|
1074 |
-
|
1075 |
-
Chosen.prototype.result_deselect = function(pos) {
|
1076 |
-
var result_data;
|
1077 |
-
result_data = this.results_data[pos];
|
1078 |
-
if (!this.form_field.options[result_data.options_index].disabled) {
|
1079 |
-
result_data.selected = false;
|
1080 |
-
this.form_field.options[result_data.options_index].selected = false;
|
1081 |
-
this.selected_option_count = null;
|
1082 |
-
this.result_clear_highlight();
|
1083 |
-
if (this.results_showing) {
|
1084 |
-
this.winnow_results();
|
1085 |
-
}
|
1086 |
-
this.form_field_jq.trigger("change", {
|
1087 |
-
deselected: this.form_field.options[result_data.options_index].value
|
1088 |
-
});
|
1089 |
-
this.search_field_scale();
|
1090 |
-
return true;
|
1091 |
-
} else {
|
1092 |
-
return false;
|
1093 |
-
}
|
1094 |
-
};
|
1095 |
-
|
1096 |
-
Chosen.prototype.single_deselect_control_build = function() {
|
1097 |
-
if (!this.allow_single_deselect) {
|
1098 |
-
return;
|
1099 |
-
}
|
1100 |
-
if (!this.selected_item.find("abbr").length) {
|
1101 |
-
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1102 |
-
}
|
1103 |
-
return this.selected_item.addClass("chosen-single-with-deselect");
|
1104 |
-
};
|
1105 |
-
|
1106 |
-
Chosen.prototype.get_search_text = function() {
|
1107 |
-
if (this.search_field.val() === this.default_text) {
|
1108 |
-
return "";
|
1109 |
-
} else {
|
1110 |
-
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1111 |
-
}
|
1112 |
-
};
|
1113 |
-
|
1114 |
-
Chosen.prototype.winnow_results_set_highlight = function() {
|
1115 |
-
var do_high, selected_results;
|
1116 |
-
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1117 |
-
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1118 |
-
if (do_high != null) {
|
1119 |
-
return this.result_do_highlight(do_high);
|
1120 |
-
}
|
1121 |
-
};
|
1122 |
-
|
1123 |
-
Chosen.prototype.no_results = function(terms) {
|
1124 |
-
var no_results_html;
|
1125 |
-
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1126 |
-
no_results_html.find("span").first().html(terms);
|
1127 |
-
this.search_results.append(no_results_html);
|
1128 |
-
return this.form_field_jq.trigger("chosen:no_results", {
|
1129 |
-
chosen: this
|
1130 |
-
});
|
1131 |
-
};
|
1132 |
-
|
1133 |
-
Chosen.prototype.no_results_clear = function() {
|
1134 |
-
return this.search_results.find(".no-results").remove();
|
1135 |
-
};
|
1136 |
-
|
1137 |
-
Chosen.prototype.keydown_arrow = function() {
|
1138 |
-
var next_sib;
|
1139 |
-
if (this.results_showing && this.result_highlight) {
|
1140 |
-
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1141 |
-
if (next_sib) {
|
1142 |
-
return this.result_do_highlight(next_sib);
|
1143 |
-
}
|
1144 |
-
} else {
|
1145 |
-
return this.results_show();
|
1146 |
-
}
|
1147 |
-
};
|
1148 |
-
|
1149 |
-
Chosen.prototype.keyup_arrow = function() {
|
1150 |
-
var prev_sibs;
|
1151 |
-
if (!this.results_showing && !this.is_multiple) {
|
1152 |
-
return this.results_show();
|
1153 |
-
} else if (this.result_highlight) {
|
1154 |
-
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1155 |
-
if (prev_sibs.length) {
|
1156 |
-
return this.result_do_highlight(prev_sibs.first());
|
1157 |
-
} else {
|
1158 |
-
if (this.choices_count() > 0) {
|
1159 |
-
this.results_hide();
|
1160 |
-
}
|
1161 |
-
return this.result_clear_highlight();
|
1162 |
-
}
|
1163 |
-
}
|
1164 |
-
};
|
1165 |
-
|
1166 |
-
Chosen.prototype.keydown_backstroke = function() {
|
1167 |
-
var next_available_destroy;
|
1168 |
-
if (this.pending_backstroke) {
|
1169 |
-
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1170 |
-
return this.clear_backstroke();
|
1171 |
-
} else {
|
1172 |
-
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1173 |
-
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1174 |
-
this.pending_backstroke = next_available_destroy;
|
1175 |
-
if (this.single_backstroke_delete) {
|
1176 |
-
return this.keydown_backstroke();
|
1177 |
-
} else {
|
1178 |
-
return this.pending_backstroke.addClass("search-choice-focus");
|
1179 |
-
}
|
1180 |
-
}
|
1181 |
-
}
|
1182 |
-
};
|
1183 |
-
|
1184 |
-
Chosen.prototype.clear_backstroke = function() {
|
1185 |
-
if (this.pending_backstroke) {
|
1186 |
-
this.pending_backstroke.removeClass("search-choice-focus");
|
1187 |
-
}
|
1188 |
-
return this.pending_backstroke = null;
|
1189 |
-
};
|
1190 |
-
|
1191 |
-
Chosen.prototype.keydown_checker = function(evt) {
|
1192 |
-
var stroke, _ref1;
|
1193 |
-
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1194 |
-
this.search_field_scale();
|
1195 |
-
if (stroke !== 8 && this.pending_backstroke) {
|
1196 |
-
this.clear_backstroke();
|
1197 |
-
}
|
1198 |
-
switch (stroke) {
|
1199 |
-
case 8:
|
1200 |
-
this.backstroke_length = this.search_field.val().length;
|
1201 |
-
break;
|
1202 |
-
case 9:
|
1203 |
-
if (this.results_showing && !this.is_multiple) {
|
1204 |
-
this.result_select(evt);
|
1205 |
-
}
|
1206 |
-
this.mouse_on_container = false;
|
1207 |
-
break;
|
1208 |
-
case 13:
|
1209 |
-
evt.preventDefault();
|
1210 |
-
break;
|
1211 |
-
case 188:
|
1212 |
-
evt.preventDefault();
|
1213 |
-
break;
|
1214 |
-
case 38:
|
1215 |
-
evt.preventDefault();
|
1216 |
-
this.keyup_arrow();
|
1217 |
-
break;
|
1218 |
-
case 40:
|
1219 |
-
evt.preventDefault();
|
1220 |
-
this.keydown_arrow();
|
1221 |
-
break;
|
1222 |
-
}
|
1223 |
-
};
|
1224 |
-
|
1225 |
-
Chosen.prototype.search_field_scale = function() {
|
1226 |
-
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1227 |
-
if (this.is_multiple) {
|
1228 |
-
h = 0;
|
1229 |
-
w = 0;
|
1230 |
-
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1231 |
-
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1232 |
-
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1233 |
-
style = styles[_i];
|
1234 |
-
style_block += style + ":" + this.search_field.css(style) + ";";
|
1235 |
-
}
|
1236 |
-
div = $('<div />', {
|
1237 |
-
'style': style_block
|
1238 |
-
});
|
1239 |
-
div.text(this.search_field.val());
|
1240 |
-
$('body').append(div);
|
1241 |
-
w = div.width() + 25;
|
1242 |
-
div.remove();
|
1243 |
-
f_width = this.container.outerWidth();
|
1244 |
-
if (w > f_width - 10) {
|
1245 |
-
w = f_width - 10;
|
1246 |
-
}
|
1247 |
-
return this.search_field.css({
|
1248 |
-
'width': w + 'px'
|
1249 |
-
});
|
1250 |
-
}
|
1251 |
-
};
|
1252 |
-
|
1253 |
-
return Chosen;
|
1254 |
-
|
1255 |
-
})(AbstractChosen);
|
1256 |
-
|
1257 |
-
}).call(this);
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
(function($){
|
1263 |
-
$(document).ready(function() {
|
1264 |
-
|
1265 |
-
$('.clearable').mousemove(function() {
|
1266 |
-
var divname=$(this).attr("name");
|
1267 |
-
var cid_arr = divname.split("_");
|
1268 |
-
var cid = cid_arr[1];
|
1269 |
-
var xb = 'clear_'+cid;
|
1270 |
-
var obj = $( "input[id*="+cid+"]" );
|
1271 |
-
for(i=0;i<obj.length;i++){
|
1272 |
-
var id=obj[i].id;
|
1273 |
-
if($('#'+id).prop('checked')){
|
1274 |
-
$('#'+xb).show();
|
1275 |
-
}
|
1276 |
-
}
|
1277 |
-
$('.xbtnp').hide();
|
1278 |
-
});
|
1279 |
-
|
1280 |
-
$('.clearable').mouseout(function() {
|
1281 |
-
var divname=$(this).attr("name");
|
1282 |
-
var cid_arr = divname.split("_");
|
1283 |
-
var cid = cid_arr[1];
|
1284 |
-
var xb = 'clear_'+cid;
|
1285 |
-
$('#'+xb).hide();
|
1286 |
-
});
|
1287 |
-
|
1288 |
-
$('.xbtn_top').mousemove(function() {
|
1289 |
-
$(this).show();
|
1290 |
-
$('.xbtnp').hide();
|
1291 |
-
});
|
1292 |
-
|
1293 |
-
$('.xbtn_top').mouseenter(function() {
|
1294 |
-
$(this).show();
|
1295 |
-
});
|
1296 |
-
|
1297 |
-
$('.xbtn_top').click(function(e) {
|
1298 |
-
e.preventDefault();
|
1299 |
-
var divname=$(this).attr("id");
|
1300 |
-
var cid_arr = divname.split("_");
|
1301 |
-
var cid = cid_arr[1];
|
1302 |
-
var obj = $( "input[id*="+cid+"]" );
|
1303 |
-
obj.prop('checked', false);
|
1304 |
-
|
1305 |
-
var objother = $( "input[id*="+cid+"-other]" );
|
1306 |
-
objother.val('');
|
1307 |
-
|
1308 |
-
var c = InputRules(cid);
|
1309 |
-
$(this).hide();
|
1310 |
-
//OCULUS
|
1311 |
-
var oculus_class = 'customRadioImage'+cid;
|
1312 |
-
$('.'+oculus_class).css('background-position','0px 0px');
|
1313 |
-
});
|
1314 |
-
|
1315 |
-
//jQuery Functions
|
1316 |
-
});
|
1317 |
-
}(jQuery));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/js/iframeResizer.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["iframeResizer.js"],"names":["window","addEventListener","obj","evt","func","attachEvent","removeEventListener","el","detachEvent","setupRequestAnimationFrame","x","vendors","length","requestAnimationFrame","log","getMyID","iframeId","retStr","top","self","parentIFrame","getId","formatLogHeader","msgId","isLogEnabled","settings","logEnabled","msg","output","info","warn","type","enabled","console","iFrameListener","event","resizeIFrame","resize","setSize","messageData","setPagePosition","ensureInRange","syncResize","processMsg","data","substr","msgIdLen","split","iframe","id","height","width","Dimension","max","Number","min","dimension","toLowerCase","size","isMessageFromIFrame","checkAllowedOrigin","checkList","i","retCode","checkOrigin","origin","checkSingle","remoteHost","constructor","Array","Error","isMessageForUs","isMessageFromMetaParent","true","false","undefined","getMsgBody","offset","indexOf","msgHeaderLen","forwardMsgFromIFrame","msgBody","callback","message","JSON","parse","getPageInfo","bodyPosition","document","body","getBoundingClientRect","iFramePosition","stringify","clientHeight","Math","documentElement","innerHeight","clientWidth","innerWidth","offsetTop","parseInt","offsetLeft","left","scrollTop","pageYOffset","scrollLeft","pageXOffset","sendPageInfoToIframe","debouncedTrigger","trigger","debouce","startPageInfoMonitor","setListener","sendPageInfo","stop","forEach","start","stopPageInfo","stopPageInfoMonitor","checkIFrameExists","retBool","getElementPosition","target","getPagePosition","floor","pagePosition","y","scrollRequestFromChild","addOffset","reposition","newPosition","scrollTo","calcOffset","scrollParent","unsetPagePosition","findTarget","location","jumpToTarget","jumpPosition","hash","jumpToParent","moveToAnchor","hashData","decodeURIComponent","getElementById","getElementsByName","funcName","val","chkCallback","actionMsg","firstRun","closeIFrame","resetIFrame","hasSettings","iFrameReadyMsgReceived","createOutgoingMsg","logId","retVal","TypeError","parentNode","removeChild","reset","setDimension","style","chkZero","hiddenCheckEnabled","fixHiddenIFrames","processDimension","sizeHeight","sizeWidth","doNotSync","calleeMsg","postMessageToIFrame","targetOrigin","contentWindow","postMessage","iFrameNotFound","chkAndSend","bodyMarginV1","interval","enablePublicMethods","autoResize","bodyMargin","heightCalculationMethod","bodyBackground","bodyPadding","tolerance","inPageLinks","resizeFrom","widthCalculationMethod","setupIFrame","options","setLimits","addStyle","Infinity","chkMinMax","newId","defaults","count","ensureHasId","src","setScrolling","scrolling","overflow","setupBodyMarginValues","checkReset","resetRequertMethod","resetRequiredMethods","setupIFrameObject","Function","prototype","bind","iFrameResizer","close","anchor","sendMessage","init","iFrameLoaded","checkOptions","copyOptions","option","hasOwnProperty","getTargetOrigin","processOptions","slice","join","beenHere","fn","time","timer","setTimeout","checkIFrames","checkIFrame","settingId","chkDimension","isVisible","offsetParent","mutationObserved","mutations","createMutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","observer","MutationObserver","observe","WebKitMutationObserver","resizeIFrames","sendTriggerMsg","tabVisible","visibilityState","eventName","isIFrameResizeEnabled","setupEventListeners","factory","element","chkType","tagName","toUpperCase","iFrames","push","call","querySelectorAll","createJQueryPublicMethod","$","iFrameResize","this","filter","each","index","end","msgHeader","scroll","bodyScroll","documentElementScroll","maxHeight","maxWidth","minHeight","minWidth","closedCallback","initCallback","messageCallback","resizedCallback","scrollCallback","jQuery","define","amd","module","exports"],"mappings":";;;;;;;CAWC,SAAUA,GACV,YA+CA,SAASC,GAAiBC,EAAIC,EAAIC,GAE7B,oBAAsBJ,GACzBE,EAAID,iBAAiBE,EAAIC,GAAM,GACrB,eAAiBJ,IAC3BE,EAAIG,YAAY,KAAKF,EAAIC,GAI3B,QAASE,GAAoBC,EAAGJ,EAAIC,GAE/B,uBAAyBJ,GAC5BO,EAAGD,oBAAoBH,EAAIC,GAAM,GACvB,eAAiBJ,IAC3BO,EAAGC,YAAY,KAAKL,EAAIC,GAI1B,QAASK,KACR,GAECC,GADAC,GAAW,MAAO,SAAU,IAAK,KAIlC,KAAKD,EAAI,EAAGA,EAAIC,EAAQC,SAAWC,EAAuBH,GAAK,EAC9DG,EAAwBb,EAAOW,EAAQD,GAAK,wBAGxC,IACJI,EAAI,QAAQ,uCAId,QAASC,GAAQC,GAChB,GAAIC,GAAS,cAAcD,CAU3B,OARIhB,GAAOkB,MAAMlB,EAAOmB,OAEtBF,EADGjB,EAAOoB,cAAgBpB,EAAOoB,aAAaC,MACrCrB,EAAOoB,aAAaC,QAAQ,KAAKL,EAEjC,qBAAqBA,GAIzBC,EAGR,QAASK,GAAgBN,GACxB,MAAOO,GAAQ,IAAMR,EAAQC,GAAY,IAG1C,QAASQ,GAAaR,GACrB,MAAOS,GAAST,GAAYS,EAAST,GAAUF,IAAMY,EAGtD,QAASZ,GAAIE,EAASW,GACrBC,EAAO,MAAMZ,EAASW,EAAIH,EAAaR,IAGxC,QAASa,GAAKb,EAASW,GACtBC,EAAO,OAAOZ,EAASW,EAAIH,EAAaR,IAGzC,QAASc,GAAKd,EAASW,GACtBC,EAAO,OAAOZ,EAASW,GAAI,GAG5B,QAASC,GAAOG,EAAKf,EAASW,EAAIK,IAC7B,IAASA,GAAW,gBAAoBhC,GAAOiC,SAClDA,QAAQF,GAAMT,EAAgBN,GAAUW,GAI1C,QAASO,GAAeC,GACvB,QAASC,KACR,QAASC,KACRC,EAAQC,GACRC,EAAgBxB,GAGjByB,EAAc,UACdA,EAAc,SAEdC,EAAWL,EAAOE,EAAY,QAG/B,QAASI,KACR,GAAIC,GAAOjB,EAAIkB,OAAOC,GAAUC,MAAM,IAEtC,QACCC,OAAQvB,EAASmB,EAAK,IAAII,OAC1BC,GAAQL,EAAK,GACbM,OAAQN,EAAK,GACbO,MAAQP,EAAK,GACbb,KAAQa,EAAK,IAIf,QAASH,GAAcW,GACtB,GACCC,GAAOC,OAAO7B,EAAST,GAAU,MAAQoC,IACzCG,EAAOD,OAAO7B,EAAST,GAAU,MAAQoC,IACzCI,EAAYJ,EAAUK,cACtBC,EAAOJ,OAAOf,EAAYiB,GAE3B1C,GAAIE,EAAS,YAAcwC,EAAY,gBAAkBD,EAAM,IAAMF,GAE5DE,EAALG,IACHA,EAAKH,EACLzC,EAAIE,EAAS,OAASwC,EAAY,kBAG/BE,EAAKL,IACRK,EAAKL,EACLvC,EAAIE,EAAS,OAASwC,EAAY,kBAGnCjB,EAAYiB,GAAa,GAAKE,EAI/B,QAASC,KACR,QAASC,KACR,QAASC,KACR,GACCC,GAAI,EACJC,GAAU,CAIX,KAFAjD,EAAIE,EAAS,wDAA0DgD,GAEhEF,EAAIE,EAAYpD,OAAQkD,IAC9B,GAAIE,EAAYF,KAAOG,EAAQ,CAC9BF,GAAU,CACV,OAGF,MAAOA,GAGR,QAASG,KACR,GAAIC,GAAc1C,EAAST,GAAUmD,UAErC,OADArD,GAAIE,EAAS,gCAAgCmD,GACtCF,IAAWE,EAGnB,MAAOH,GAAYI,cAAgBC,MAAQR,IAAcK,IAG1D,GACCD,GAAc9B,EAAM8B,OACpBD,EAAcvC,EAAST,GAAUgD,WAElC,IAAIA,GAAgB,GAAGC,GAAW,SAAYL,IAC7C,KAAM,IAAIU,OACT,qCAAuCL,EACvC,QAAU1B,EAAYS,OAAOC,GAC7B,kBAAoBd,EAAMS,KAC1B,qHAIF,QAAO,EAGR,QAAS2B,KACR,MAAOhD,MAAY,GAAKI,GAAKkB,OAAO,EAAEC,IAAenB,EAAIkB,OAAOC,GAAUC,MAAM,KAAK,IAAMtB,GAG5F,QAAS+C,KAGR,GAAIT,GAAUxB,EAAYR,QAAS0C,OAAO,EAAEC,QAAQ,EAAEC,UAAY,EAMlE,OAJIZ,IACHjD,EAAIE,EAAS,+CAGP+C,EAGR,QAASa,GAAWC,GACnB,MAAOlD,GAAIkB,OAAOlB,EAAImD,QAAQ,KAAKC,EAAaF,GAGjD,QAASG,GAAqBC,GAC7BnE,EAAIE,EAAS,oCAAqCuB,EAAYS,OAAOC,GAAK,cAAgBgC,EAAU,KACpGC,EAAS,mBACRlC,OAAQT,EAAYS,OACpBmC,QAASC,KAAKC,MAAMJ,KAErBnE,EAAIE,EAAS,MAGd,QAASsE,KACR,GACCC,GAAiBC,SAASC,KAAKC,wBAC/BC,EAAiBpD,EAAYS,OAAO0C,uBAErC,OAAON,MAAKQ,WACXC,aAAcC,KAAKzC,IAAImC,SAASO,gBAAgBF,aAAc7F,EAAOgG,aAAe,GACpFC,YAAcH,KAAKzC,IAAImC,SAASO,gBAAgBE,YAAcjG,EAAOkG,YAAe,GACpFC,UAAcC,SAAST,EAAezE,IAAOqE,EAAarE,IAAM,IAChEmF,WAAcD,SAAST,EAAeW,KAAOf,EAAae,KAAM,IAChEC,UAAcvG,EAAOwG,YACrBC,WAAczG,EAAO0G,cAIvB,QAASC,GAAqB3D,EAAOhC,GACpC,QAAS4F,KACRC,EACC,iBACA,YAAcvB,IACdtC,EACAhC,GAIF8F,EAAQF,EAAiB,IAI1B,QAASG,KACR,QAASC,GAAYjF,EAAK3B,GACzB,QAAS6G,KACJxF,EAASwB,GACZ0D,EAAqBlF,EAASwB,GAAID,OAAOC,GAEzCiE,KAID,SAAS,UAAUC,QAAQ,SAAShH,GACpCW,EAAImC,EAAIlB,EAAQ5B,EAAM,8BACtBC,EAAKJ,EAAOG,EAAI8G,KAIlB,QAASC,KACRF,EAAY,UAAW1G,GAGxB,QAAS8G,KACRJ,EAAY,OAAQ/G,GAGrB,GAAIgD,GAAKjC,CAEToG,KAEA3F,EAASwB,GAAIoE,aAAeH,EAG7B,QAASI,KACJ7F,EAAST,IAAaS,EAAST,GAAUqG,eAC5C5F,EAAST,GAAUqG,qBACZ5F,GAAST,GAAUqG,cAI5B,QAASE,KACR,GAAIC,IAAU,CAMd,OAJI,QAASjF,EAAYS,SACxBlB,EAAKd,EAAS,WAAWuB,EAAYU,GAAG,eACxCuE,GAAU,GAEJA,EAGR,QAASC,GAAmBC,GAC3B,GAAI/B,GAAiB+B,EAAOhC,uBAI5B,OAFAiC,GAAgB3G,IAGfN,EAAGoF,KAAK8B,MAAOtE,OAAOqC,EAAeW,MAAQhD,OAAOuE,EAAanH,IACjEoH,EAAGhC,KAAK8B,MAAOtE,OAAOqC,EAAezE,KAAQoC,OAAOuE,EAAaC,KAInE,QAASC,GAAuBC,GAE/B,QAASC,KACRJ,EAAeK,EACfC,IACArH,EAAIE,EAAS,MAGd,QAASoH,KACR,OACC1H,EAAG4C,OAAOf,EAAYY,OAAS0B,EAAOnE,EACtCoH,EAAGxE,OAAOf,EAAYW,QAAU2B,EAAOiD,GAIzC,QAASO,KACJrI,EAAOoB,aACVpB,EAAOoB,aAAa,YAAY4G,EAAU,SAAS,KAAKE,EAAYxH,EAAEwH,EAAYJ,GAElFhG,EAAKd,EAAS,yEAIhB,GACC6D,GAASmD,EAAYP,EAAmBlF,EAAYS,SAAWtC,EAAE,EAAEoH,EAAE,GACrEI,EAAcE,GAEftH,GAAIE,EAAS,8CAA8C6D,EAAOnE,EAAE,MAAMmE,EAAOiD,EAAE,KAEhF9H,EAAOkB,MAAMlB,EAAOmB,KACtBkH,IAEAJ,IAIF,QAASE,MACJ,IAAUjD,EAAS,iBAAiB2C,GACvCrF,EAAgBxB,GAEhBsH,IAIF,QAASC,GAAWC,GACnB,QAASC,KACR,GAAIC,GAAejB,EAAmBC,EAEtC5G,GAAIE,EAAS,4BAA4B2H,EAAK,WAAWD,EAAahI,EAAE,OAAOgI,EAAaZ,GAC5FD,GACCnH,EAAGgI,EAAahI,EAChBoH,EAAGY,EAAaZ,GAGjBK,IACArH,EAAIE,EAAS,MAGd,QAAS4H,KACJ5I,EAAOoB,aACVpB,EAAOoB,aAAayH,aAAaF,GAEjC7H,EAAIE,EAAS,iBAAiB2H,EAAK,gDAIrC,GACCA,GAAWH,EAASzF,MAAM,KAAK,IAAM,GACrC+F,EAAWC,mBAAmBJ,GAC9BjB,EAAWlC,SAASwD,eAAeF,IAAatD,SAASyD,kBAAkBH,GAAU,EAElFpB,GACHe,IACSzI,EAAOkB,MAAMlB,EAAOmB,KAC7ByH,IAEA9H,EAAIE,EAAS,iBAAiB2H,EAAK,cAIrC,QAASzD,GAASgE,EAASC,GAC1B,MAAOC,GAAYpI,EAASkI,EAASC,GAGtC,QAASE,KAIR,OAFG5H,EAAST,GAAUsI,UAAUA,IAEzB/G,EAAYR,MACnB,IAAK,QACJwH,EAAYhH,EAAYS,OACxB,MACD,KAAK,UACJgC,EAAqBJ,EAAW,GAChC,MACD,KAAK,WACJmD,GAAuB,EACvB,MACD,KAAK,iBACJA,GAAuB,EACvB,MACD,KAAK,WACJpB,EAAqBlF,EAAST,GAAUgC,OAAOhC,GAC/C+F,GACA,MACD,KAAK,eACJO,GACA,MACD,KAAK,aACJiB,EAAW3D,EAAW,GACtB,MACD,KAAK,QACJ4E,EAAYjH,EACZ,MACD,KAAK,OACJH,IACA8C,EAAS,eAAe3C,EAAYS,QACpCkC,EAAS,kBAAkB3C,EAC3B,MACD,SACCH,IACA8C,EAAS,kBAAkB3C,IAI7B,QAASkH,GAAYzI,GACpB,GAAIwG,IAAU,CAOd,OALK/F,GAAST,KACbwG,GAAU,EACV1F,EAAKS,EAAYR,KAAO,oBAAsBf,EAAW,kBAAoBW,IAGvE6F,EAGR,QAASkC,KACR,IAAK,GAAI1I,KAAYS,GACpBoF,EAAQ,wBAAwB8C,EAAkB3I,GAAUwE,SAASwD,eAAehI,GAAUA,GAIhG,QAASsI,KACR7H,EAAST,GAAUsI,UAAW,EAG/B,GACC3H,GAAMQ,EAAMS,KACZL,KACAvB,EAAW,IAET,+BAAgCW,EAClC+H,IACUnF,KACVhC,EAAcI,IACd3B,EAAc4I,EAAQrH,EAAYU,IAE7BuB,KAA6BiF,EAAYzI,KAC7CF,EAAIE,EAAS,aAAaW,GAErB4F,KAAuB5D,KAC3B0F,MAIFxH,EAAKb,EAAS,YAAYW,GAM5B,QAASyH,GAAYpI,EAASkI,EAASC,GACtC,GACC/I,GAAO,KACPyJ,EAAS,IAEV,IAAGpI,EAAST,GAAU,CAGrB,GAFAZ,EAAOqB,EAAST,GAAUkI,GAEtB,kBAAsB9I,GAGzB,KAAM,IAAI0J,WAAUZ,EAAS,cAAclI,EAAS,sBAFpD6I,GAASzJ,EAAK+I,GAMhB,MAAOU,GAGR,QAASN,GAAYvG,GACpB,GAAIhC,GAAWgC,EAAOC,EAEtBnC,GAAIE,EAAS,oBAAoBA,GACjCgC,EAAO+G,WAAWC,YAAYhH,GAC9BoG,EAAYpI,EAAS,iBAAiBA,GACtCF,EAAIE,EAAS,YACNS,GAAST,GAGjB,QAAS2G,GAAgB3G,GACrB,OAAS6G,IACXA,GACCnH,EAA2BiE,SAAvB3E,EAAO0G,YAA6B1G,EAAO0G,YAAclB,SAASO,gBAAgBU,WACtFqB,EAA2BnD,SAAvB3E,EAAOwG,YAA6BxG,EAAOwG,YAAchB,SAASO,gBAAgBQ,WAEvFzF,EAAIE,EAAS,sBAAsB6G,EAAanH,EAAE,IAAImH,EAAaC,IAIrE,QAAStF,GAAgBxB,GACrB,OAAS6G,IACX7H,EAAOmI,SAASN,EAAanH,EAAEmH,EAAaC,GAC5ChH,EAAIE,EAAS,sBAAsB6G,EAAanH,EAAE,IAAImH,EAAaC,GACnEQ,KAIF,QAASA,KACRT,EAAe,KAGhB,QAAS2B,GAAYjH,GACpB,QAAS0H,KACR3H,EAAQC,GACRsE,EAAQ,QAAQ,QAAQtE,EAAYS,OAAOT,EAAYU,IAGxDnC,EAAIyB,EAAYU,GAAG,4BAA4B,SAASV,EAAYR,KAAK,YAAY,WACrF4F,EAAgBpF,EAAYU,IAC5BP,EAAWuH,EAAM1H,EAAY,SAG9B,QAASD,GAAQC,GAChB,QAAS2H,GAAa1G,GACrBjB,EAAYS,OAAOmH,MAAM3G,GAAajB,EAAYiB,GAAa,KAC/D1C,EACCyB,EAAYU,GACZ,WAAajC,EACb,KAAOwC,EACP,WAAajB,EAAYiB,GAAa,MAIxC,QAAS4G,GAAQ5G,GAMX6G,GAAsB,MAAQ9H,EAAYiB,KAC9C6G,GAAqB,EACrBvJ,EAAIE,EAAS,wDACbsJ,KAIF,QAASC,GAAiB/G,GACzB0G,EAAa1G,GACb4G,EAAQ5G,GAGT,GAAIxC,GAAWuB,EAAYS,OAAOC,EAE/BxB,GAAST,KACPS,EAAST,GAAUwJ,YAAcD,EAAiB,UAClD9I,EAAST,GAAUyJ,WAAcF,EAAiB,UAIxD,QAAS7H,GAAWtC,EAAKmC,EAAYmI,GAEjCA,IAAYnI,EAAYR,MAAQlB,GAClCC,EAAIyB,EAAYU,GAAG,8BACnBpC,EAAsBT,IAEtBA,IAIF,QAASyG,GAAQ8D,EAAUhJ,EAAIqB,EAAOC,GACrC,QAAS2H,KACR,GAAIlD,GAASjG,EAASwB,GAAI4H,YAC1B/J,GAAImC,EAAG,IAAM0H,EAAY,2BAA2B1H,EAAG,MAAMtB,EAAI,mBAAmB+F,GACpF1E,EAAO8H,cAAcC,YAAaxJ,EAAQI,EAAK+F,GAGhD,QAASsD,KACRnJ,EAAKoB,EAAG,IAAM0H,EAAY,YAAY1H,EAAG,eACtCxB,EAASwB,UACJxB,GAASwB,GAIlB,QAASgI,KACLjI,GAAU,iBAAmBA,IAAW,OAASA,EAAO8H,cAC1DF,IAEAI,IAIF/H,EAAKA,GAAMD,EAAOC,GAEfxB,EAASwB,IACXgI,IAKF,QAAStB,GAAkB3I,GAC1B,MAAOA,GACN,IAAMS,EAAST,GAAUkK,aACzB,IAAMzJ,EAAST,GAAUyJ,UACzB,IAAMhJ,EAAST,GAAUF,IACzB,IAAMW,EAAST,GAAUmK,SACzB,IAAM1J,EAAST,GAAUoK,oBACzB,IAAM3J,EAAST,GAAUqK,WACzB,IAAM5J,EAAST,GAAUsK,WACzB,IAAM7J,EAAST,GAAUuK,wBACzB,IAAM9J,EAAST,GAAUwK,eACzB,IAAM/J,EAAST,GAAUyK,YACzB,IAAMhK,EAAST,GAAU0K,UACzB,IAAMjK,EAAST,GAAU2K,YACzB,IAAMlK,EAAST,GAAU4K,WACzB,IAAMnK,EAAST,GAAU6K,uBAG3B,QAASC,GAAY9I,EAAO+I,GAC3B,QAASC,KACR,QAASC,GAAS9B,GACZ+B,EAAAA,IAAazK,EAAST,GAAUmJ,IAAY,IAAM1I,EAAST,GAAUmJ,KACzEnH,EAAOmH,MAAMA,GAAS1I,EAAST,GAAUmJ,GAAS,KAClDrJ,EAAIE,EAAS,OAAOmJ,EAAM,MAAM1I,EAAST,GAAUmJ,GAAO,OAI5D,QAASgC,GAAU3I,GAClB,GAAI/B,EAAST,GAAU,MAAMwC,GAAW/B,EAAST,GAAU,MAAMwC,GAChE,KAAM,IAAIc,OAAM,gBAAgBd,EAAU,+BAA+BA,GAI3E2I,EAAU,UACVA,EAAU,SAEVF,EAAS,aACTA,EAAS,aACTA,EAAS,YACTA,EAAS,YAGV,QAASG,KACR,GAAInJ,GAAO8I,GAAWA,EAAQ9I,IAAOoJ,EAASpJ,GAAKqJ,GAInD,OAHK,QAAO9G,SAASwD,eAAe/F,KACnCA,GAAUqJ,KAEJrJ,EAGR,QAASsJ,GAAYvL,GAUpB,MATA4I,GAAM5I,EACF,KAAKA,IACRgC,EAAOC,GAAKjC,EAAYoL,IACxB1K,GAAcqK,OAAejL,IAC7B8I,EAAM5I,EACNF,EAAIE,EAAS,4BAA6BA,EAAU,KAAOgC,EAAOwJ,IAAM,MAIlExL,EAGR,QAASyL,KACR3L,EAAIE,EAAS,qBAAuBS,EAAST,GAAU0L,UAAY,UAAY,YAAc,QAAU1L,GACvGgC,EAAOmH,MAAMwC,UAAW,IAAUlL,EAAST,GAAU0L,UAAY,SAAW,OAC5E1J,EAAO0J,WAAiB,IAAUjL,EAAST,GAAU0L,UAAY,KAAO,MAMzE,QAASE,MACH,gBAAkBnL,GAAST,GAAoB,YAAO,MAAMS,EAAST,GAAUsK,cACnF7J,EAAST,GAAUkK,aAAezJ,EAAST,GAAUsK,WACrD7J,EAAST,GAAUsK,WAAe,GAAK7J,EAAST,GAAUsK,WAAa,MAIzE,QAASuB,KAIR,GACCvD,GAAqB7H,EAAST,GAAUsI,SACxCwD,EAAqBrL,EAAST,GAAUuK,0BAA2BwB,IAE/DzD,GAAYwD,GAChBtD,GAAaxG,OAAOA,EAAQE,OAAO,EAAGC,MAAM,EAAGpB,KAAK,SAItD,QAASiL,KACLC,SAASC,UAAUC,OACrB1L,EAAST,GAAUgC,OAAOoK,eAEzBC,MAAe9D,EAAY4D,KAAK,KAAK1L,EAAST,GAAUgC,QAExDX,OAAewE,EAAQsG,KAAK,KAAK,gBAAiB,SAAU1L,EAAST,GAAUgC,QAE/E6F,aAAe,SAASyE,GACvBzG,EAAQ,iBAAiB,cAAcyG,EAAQ7L,EAAST,GAAUgC,OAAOhC,IAG1EuM,YAAe,SAASpI,GACvBA,EAAUC,KAAKQ,UAAUT,GACzB0B,EAAQ,eAAe,WAAW1B,EAAS1D,EAAST,GAAUgC,OAAOhC,MASzE,QAASwM,GAAK7L,GACb,QAAS8L,KACR5G,EAAQ,gBAAgBlF,EAAIqB,GAC5B6J,IAGD5M,EAAiB+C,EAAO,OAAOyK,GAC/B5G,EAAQ,OAAOlF,EAAIqB,GAGpB,QAAS0K,GAAa3B,GACrB,GAAI,gBAAoBA,GACvB,KAAM,IAAIjC,WAAU,4BAItB,QAAS6D,GAAY5B,GACpB,IAAK,GAAI6B,KAAUvB,GACdA,EAASwB,eAAeD,KAC3BnM,EAAST,GAAU4M,GAAU7B,EAAQ8B,eAAeD,GAAU7B,EAAQ6B,GAAUvB,EAASuB,IAK5F,QAASE,GAAiB3J,GACzB,MAAQ,KAAOA,GAAc,YAAcA,EAAc,IAAMA,EAGhE,QAAS4J,GAAehC,GACvBA,EAAUA,MACVtK,EAAST,IACRsI,UAAW,EACXtG,OAAUA,EACVmB,WAAanB,EAAOwJ,IAAIzJ,MAAM,KAAKiL,MAAM,EAAE,GAAGC,KAAK,MAGpDP,EAAa3B,GACb4B,EAAY5B,GAEZtK,EAAST,GAAU6J,cAAe,IAASpJ,EAAST,GAAUgD,YAAc8J,EAAgBrM,EAAST,GAAUmD,YAAc,IAG9H,QAAS+J,KACR,MAAQlN,KAAYS,IAAY,iBAAmBuB,GAGpD,GAAIhC,GAAWuL,EAAYvJ,EAAOC,GAE7BiL,KAQJpM,EAAKd,EAAS,mCAPd+M,EAAehC,GACfU,IACAT,IACAY,IACAY,EAAK7D,EAAkB3I,IACvBgM,KAMF,QAASlG,GAAQqH,EAAGC,GACf,OAASC,IACZA,EAAQC,WAAW,WAClBD,EAAQ,KACRF,KACEC,IAKL,QAAS9D,KACR,QAASiE,KACR,QAASC,GAAYC,GACpB,QAASC,GAAalL,GACrB,MAAO,QAAU/B,EAASgN,GAAWzL,OAAOmH,MAAM3G,GAGnD,QAASmL,GAAUpO,GAClB,MAAQ,QAASA,EAAGqO,aAGjBD,EAAUlN,EAASgN,GAAWzL,UAAY0L,EAAa,WAAaA,EAAa,WACpF7H,EAAQ,oBAAqB,SAAUpF,EAASgN,GAAWzL,OAAOyL,GAIpE,IAAK,GAAIA,KAAahN,GACrB+M,EAAYC,GAId,QAASI,GAAiBC,GACzBhO,EAAI,SAAS,sBAAwBgO,EAAU,GAAGpH,OAAS,IAAMoH,EAAU,GAAG/M,MAC9E+E,EAAQyH,EAAa,IAGtB,QAASQ,KACR,GACCrH,GAASlC,SAASwJ,cAAc,QAEhCC,GACCC,YAAwB,EACxBC,mBAAwB,EACxBC,eAAwB,EACxBC,uBAAwB,EACxBC,WAAwB,EACxBC,SAAwB,GAGzBC,EAAW,GAAIC,GAAiBZ,EAEjCW,GAASE,QAAQhI,EAAQuH,GAG1B,GAAIQ,GAAmBzP,EAAOyP,kBAAoBzP,EAAO2P,sBAErDF,IAAkBV,IAIvB,QAASa,GAAczN,GACtB,QAASE,KACRwN,EAAe,UAAU1N,EAAM,UAGhCrB,EAAI,SAAS,kBAAkBqB,GAC/B2E,EAAQzE,EAAO,IAIhB,QAASyN,KACR,QAASzN,KACRwN,EAAe,cAAc,UAG3B,WAAarK,SAASuK,kBACxBjP,EAAI,WAAW,mCACfgG,EAAQzE,EAAO,KAIjB,QAASwN,GAAeG,EAAU7N,GACjC,QAAS8N,GAAsBjP,GAC9B,MAAO,WAAaS,EAAST,GAAU4K,YACrCnK,EAAST,GAAUqK,aAClB5J,EAAST,GAAUsI,SAGvB,IAAK,GAAItI,KAAYS,GACjBwO,EAAsBjP,IACxB6F,EAAQmJ,EAAU7N,EAAMqD,SAASwD,eAAehI,GAAUA,GAK7D,QAASkP,KACRjQ,EAAiBD,EAAO,UAAUkC,GAElCjC,EAAiBD,EAAO,SAAU,WAAW4P,EAAc,YAE3D3P,EAAiBuF,SAAS,mBAAmBsK,GAC7C7P,EAAiBuF,SAAS,2BAA2BsK,GACrD7P,EAAiBD,EAAO,UAAU,WAAW4P,EAAc,WAC3D3P,EAAiBD,EAAO,QAAQ,WAAW4P,EAAc,WAI1D,QAASO,KACR,QAAS3C,GAAKzB,EAAQqE,GACrB,QAASC,KACR,IAAID,EAAQE,QACX,KAAM,IAAIxG,WAAU,oCACd,IAAI,WAAasG,EAAQE,QAAQC,cACvC,KAAM,IAAIzG,WAAU,iCAAiCsG,EAAQE,QAAQ,KAIpEF,IACFC,IACAvE,EAAYsE,EAASrE,GACrByE,EAAQC,KAAKL,IAIf,GAAII,EAKJ,OAHA/P,KACAyP,IAEO,SAAuBnE,EAAQrE,GAGrC,OAFA8I,WAEc,IACd,IAAK,YACL,IAAK,SACJnM,MAAM6I,UAAU/F,QAAQuJ,KACvBlL,SAASmL,iBAAkBjJ,GAAU,UACrC8F,EAAKL,KAAKxI,OAAWoH,GAEtB,MACD,KAAK,SACJyB,EAAKzB,EAAQrE,EACb,MACD,SACC,KAAM,IAAIoC,WAAU,+BAA+B,GAAS,KAG7D,MAAO0G,IAIT,QAASI,GAAyBC,GACjCA,EAAE1C,GAAG2C,aAAe,SAAwB/E,GAC3C,MAAOgF,MAAKC,OAAO,UAAUC,KAAK,SAAUC,EAAOd,GAClDtE,EAAYsE,EAASrE,KACnBoF,OAr8BL,GACC7E,GAAwB,EACxB5K,GAAwB,EACxB2I,GAAwB,EACxB+G,EAAwB,UACxBrM,EAAwBqM,EAAUxQ,OAClCW,EAAwB,gBACxBuB,EAAwBvB,EAAMX,OAC9BiH,EAAwB,KACxBhH,EAAwBb,EAAOa,sBAC/BkM,GAAyB1J,IAAI,EAAEgO,OAAO,EAAEC,WAAW,EAAEC,sBAAsB,GAC3E9P,KACA4M,EAAwB,KACxBzE,EAAwB,YAExByC,GACChB,YAA4B,EAC5BG,eAA4B,KAC5BF,WAA4B,KAC5BJ,aAA4B,EAC5BO,YAA4B,KAC5BzH,aAA4B,EAC5B2H,aAA4B,EAC5BP,qBAA4B,EAC5BG,wBAA4B,aAC5BtI,GAA4B,gBAC5BkI,SAA4B,GAC5BrK,KAA4B,EAC5B0Q,UAA4BtF,EAAAA,EAC5BuF,SAA4BvF,EAAAA,EAC5BwF,UAA4B,EAC5BC,SAA4B,EAC5B/F,WAA4B,SAC5Bc,WAA4B,EAC5BlC,YAA4B,EAC5BC,WAA4B,EAC5BiB,UAA4B,EAC5BG,uBAA4B,SAC5B+F,eAA4B,aAC5BC,aAA4B,aAC5BC,gBAA4B,WAAWhQ,EAAK,yCAC5CiQ,gBAA4B,aAC5BC,eAA4B,WAAW,OAAO,GA+5B5ChS,GAAOiS,QAAUrB,EAAyBqB,QAExB,kBAAXC,SAAyBA,OAAOC,IAC1CD,UAAU/B,GACkB,gBAAXiC,SAAiD,gBAAnBA,QAAOC,QACtDD,OAAOC,QAAUlC,IAEjBnQ,EAAO8Q,aAAe9Q,EAAO8Q,cAAgBX,KAG5CnQ","file":"iframeResizer.min.js","sourcesContent":["/*\n * File: iframeResizer.js\n * Desc: Force iframes to size to content.\n * Requires: iframeResizer.contentWindow.js to be loaded into the target frame.\n * Doc: https://github.com/davidjbradshaw/iframe-resizer\n * Author: David J. Bradshaw - dave@bradshaw.net\n * Contributor: Jure Mav - jure.mav@gmail.com\n * Contributor: Reed Dadoune - reed@dadoune.com\n */\n\n\n;(function(window) {\n\t'use strict';\n\n\tvar\n\t\tcount = 0,\n\t\tlogEnabled = false,\n\t\thiddenCheckEnabled = false,\n\t\tmsgHeader = 'message',\n\t\tmsgHeaderLen = msgHeader.length,\n\t\tmsgId = '[iFrameSizer]', //Must match iframe msg ID\n\t\tmsgIdLen = msgId.length,\n\t\tpagePosition = null,\n\t\trequestAnimationFrame = window.requestAnimationFrame,\n\t\tresetRequiredMethods = {max:1,scroll:1,bodyScroll:1,documentElementScroll:1},\n\t\tsettings = {},\n\t\ttimer = null,\n\t\tlogId = 'Host Page',\n\n\t\tdefaults = {\n\t\t\tautoResize : true,\n\t\t\tbodyBackground : null,\n\t\t\tbodyMargin : null,\n\t\t\tbodyMarginV1 : 8,\n\t\t\tbodyPadding : null,\n\t\t\tcheckOrigin : true,\n\t\t\tinPageLinks : false,\n\t\t\tenablePublicMethods : true,\n\t\t\theightCalculationMethod : 'bodyOffset',\n\t\t\tid : 'iFrameResizer',\n\t\t\tinterval : 32,\n\t\t\tlog : false,\n\t\t\tmaxHeight : Infinity,\n\t\t\tmaxWidth : Infinity,\n\t\t\tminHeight : 0,\n\t\t\tminWidth : 0,\n\t\t\tresizeFrom : 'parent',\n\t\t\tscrolling : false,\n\t\t\tsizeHeight : true,\n\t\t\tsizeWidth : false,\n\t\t\ttolerance : 0,\n\t\t\twidthCalculationMethod : 'scroll',\n\t\t\tclosedCallback : function(){},\n\t\t\tinitCallback : function(){},\n\t\t\tmessageCallback : function(){warn('MessageCallback function not defined');},\n\t\t\tresizedCallback : function(){},\n\t\t\tscrollCallback : function(){return true;}\n\t\t};\n\n\tfunction addEventListener(obj,evt,func){\n\t\t/* istanbul ignore else */ // Not testable in PhantonJS\n\t\tif ('addEventListener' in window){\n\t\t\tobj.addEventListener(evt,func, false);\n\t\t} else if ('attachEvent' in window){//IE\n\t\t\tobj.attachEvent('on'+evt,func);\n\t\t}\n\t}\n\n\tfunction removeEventListener(el,evt,func){\n\t\t/* istanbul ignore else */ // Not testable in phantonJS\n\t\tif ('removeEventListener' in window){\n\t\t\tel.removeEventListener(evt,func, false);\n\t\t} else if ('detachEvent' in window){ //IE\n\t\t\tel.detachEvent('on'+evt,func);\n\t\t}\n\t}\n\n\tfunction setupRequestAnimationFrame(){\n\t\tvar\n\t\t\tvendors = ['moz', 'webkit', 'o', 'ms'],\n\t\t\tx;\n\n\t\t// Remove vendor prefixing if prefixed and break early if not\n\t\tfor (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {\n\t\t\trequestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];\n\t\t}\n\n\t\tif (!(requestAnimationFrame)){\n\t\t\tlog('setup','RequestAnimationFrame not supported');\n\t\t}\n\t}\n\n\tfunction getMyID(iframeId){\n\t\tvar retStr = 'Host page: '+iframeId;\n\n\t\tif (window.top!==window.self){\n\t\t\tif (window.parentIFrame && window.parentIFrame.getId){\n\t\t\t\tretStr = window.parentIFrame.getId()+': '+iframeId;\n\t\t\t} else {\n\t\t\t\tretStr = 'Nested host page: '+iframeId;\n\t\t\t}\n\t\t}\n\n\t\treturn retStr;\n\t}\n\n\tfunction formatLogHeader(iframeId){\n\t\treturn msgId + '[' + getMyID(iframeId) + ']';\n\t}\n\n\tfunction isLogEnabled(iframeId){\n\t\treturn settings[iframeId] ? settings[iframeId].log : logEnabled;\n\t}\n\n\tfunction log(iframeId,msg){\n\t\toutput('log',iframeId,msg,isLogEnabled(iframeId));\n\t}\n\n\tfunction info(iframeId,msg){\n\t\toutput('info',iframeId,msg,isLogEnabled(iframeId));\n\t}\n\n\tfunction warn(iframeId,msg){\n\t\toutput('warn',iframeId,msg,true);\n\t}\n\n\tfunction output(type,iframeId,msg,enabled){\n\t\tif (true === enabled && 'object' === typeof window.console){\n\t\t\tconsole[type](formatLogHeader(iframeId),msg);\n\t\t}\n\t}\n\n\tfunction iFrameListener(event){\n\t\tfunction resizeIFrame(){\n\t\t\tfunction resize(){\n\t\t\t\tsetSize(messageData);\n\t\t\t\tsetPagePosition(iframeId);\n\t\t\t}\n\n\t\t\tensureInRange('Height');\n\t\t\tensureInRange('Width');\n\n\t\t\tsyncResize(resize,messageData,'init');\n\t\t}\n\n\t\tfunction processMsg(){\n\t\t\tvar data = msg.substr(msgIdLen).split(':');\n\n\t\t\treturn {\n\t\t\t\tiframe: settings[data[0]].iframe,\n\t\t\t\tid: data[0],\n\t\t\t\theight: data[1],\n\t\t\t\twidth: data[2],\n\t\t\t\ttype: data[3]\n\t\t\t};\n\t\t}\n\n\t\tfunction ensureInRange(Dimension){\n\t\t\tvar\n\t\t\t\tmax = Number(settings[iframeId]['max' + Dimension]),\n\t\t\t\tmin = Number(settings[iframeId]['min' + Dimension]),\n\t\t\t\tdimension = Dimension.toLowerCase(),\n\t\t\t\tsize = Number(messageData[dimension]);\n\n\t\t\tlog(iframeId,'Checking ' + dimension + ' is in range ' + min + '-' + max);\n\n\t\t\tif (size<min) {\n\t\t\t\tsize=min;\n\t\t\t\tlog(iframeId,'Set ' + dimension + ' to min value');\n\t\t\t}\n\n\t\t\tif (size>max) {\n\t\t\t\tsize=max;\n\t\t\t\tlog(iframeId,'Set ' + dimension + ' to max value');\n\t\t\t}\n\n\t\t\tmessageData[dimension] = '' + size;\n\t\t}\n\n\n\t\tfunction isMessageFromIFrame(){\n\t\t\tfunction checkAllowedOrigin(){\n\t\t\t\tfunction checkList(){\n\t\t\t\t\tvar\n\t\t\t\t\t\ti = 0,\n\t\t\t\t\t\tretCode = false;\n\n\t\t\t\t\tlog(iframeId,'Checking connection is from allowed list of origins: ' + checkOrigin);\n\n\t\t\t\t\tfor (; i < checkOrigin.length; i++) {\n\t\t\t\t\t\tif (checkOrigin[i] === origin) {\n\t\t\t\t\t\t\tretCode = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn retCode;\n\t\t\t\t}\n\n\t\t\t\tfunction checkSingle(){\n\t\t\t\t\tvar remoteHost = settings[iframeId].remoteHost;\n\t\t\t\t\tlog(iframeId,'Checking connection is from: '+remoteHost);\n\t\t\t\t\treturn origin === remoteHost;\n\t\t\t\t}\n\n\t\t\t\treturn checkOrigin.constructor === Array ? checkList() : checkSingle();\n\t\t\t}\n\n\t\t\tvar\n\t\t\t\torigin = event.origin,\n\t\t\t\tcheckOrigin = settings[iframeId].checkOrigin;\n\n\t\t\tif (checkOrigin && (''+origin !== 'null') && !checkAllowedOrigin()) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Unexpected message received from: ' + origin +\n\t\t\t\t\t' for ' + messageData.iframe.id +\n\t\t\t\t\t'. Message was: ' + event.data +\n\t\t\t\t\t'. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tfunction isMessageForUs(){\n\t\t\treturn msgId === (('' + msg).substr(0,msgIdLen)) && (msg.substr(msgIdLen).split(':')[0] in settings); //''+Protects against non-string msg\n\t\t}\n\n\t\tfunction isMessageFromMetaParent(){\n\t\t\t//Test if this message is from a parent above us. This is an ugly test, however, updating\n\t\t\t//the message format would break backwards compatibity.\n\t\t\tvar retCode = messageData.type in {'true':1,'false':1,'undefined':1};\n\n\t\t\tif (retCode){\n\t\t\t\tlog(iframeId,'Ignoring init message from meta parent page');\n\t\t\t}\n\n\t\t\treturn retCode;\n\t\t}\n\n\t\tfunction getMsgBody(offset){\n\t\t\treturn msg.substr(msg.indexOf(':')+msgHeaderLen+offset);\n\t\t}\n\n\t\tfunction forwardMsgFromIFrame(msgBody){\n\t\t\tlog(iframeId,'MessageCallback passed: {iframe: '+ messageData.iframe.id + ', message: ' + msgBody + '}');\n\t\t\tcallback('messageCallback',{\n\t\t\t\tiframe: messageData.iframe,\n\t\t\t\tmessage: JSON.parse(msgBody)\n\t\t\t});\n\t\t\tlog(iframeId,'--');\n\t\t}\n\n\t\tfunction getPageInfo(){\n\t\t\tvar\n\t\t\t\tbodyPosition = document.body.getBoundingClientRect(),\n\t\t\t\tiFramePosition = messageData.iframe.getBoundingClientRect();\n\n\t\t\treturn JSON.stringify({\n\t\t\t\tclientHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0),\n\t\t\t\tclientWidth: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),\n\t\t\t\toffsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),\n\t\t\t\toffsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),\n\t\t\t\tscrollTop: window.pageYOffset,\n\t\t\t\tscrollLeft: window.pageXOffset\n\t\t\t});\n\t\t}\n\n\t\tfunction sendPageInfoToIframe(iframe,iframeId){\n\t\t\tfunction debouncedTrigger(){\n\t\t\t\ttrigger(\n\t\t\t\t\t'Send Page Info',\n\t\t\t\t\t'pageInfo:' + getPageInfo(), \n\t\t\t\t\tiframe, \n\t\t\t\t\tiframeId\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tdebouce(debouncedTrigger,32);\n\t\t}\n\n\n\t\tfunction startPageInfoMonitor(){\n\t\t\tfunction setListener(type,func){\n\t\t\t\tfunction sendPageInfo(){\n\t\t\t\t\tif (settings[id]){\n\t\t\t\t\t\tsendPageInfoToIframe(settings[id].iframe,id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstop();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t['scroll','resize'].forEach(function(evt){\n\t\t\t\t\tlog(id, type + evt + ' listener for sendPageInfo');\n\t\t\t\t\tfunc(window,evt,sendPageInfo);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction stop(){\n\t\t\t\tsetListener('Remove ', removeEventListener);\n\t\t\t}\n\n\t\t\tfunction start(){\n\t\t\t\tsetListener('Add ', addEventListener);\n\t\t\t}\n\t\t\t\n\t\t\tvar id = iframeId; //Create locally scoped copy of iFrame ID\n\n\t\t\tstart();\n\n\t\t\tsettings[id].stopPageInfo = stop;\n\t\t}\n\n\t\tfunction stopPageInfoMonitor(){\n\t\t\tif (settings[iframeId] && settings[iframeId].stopPageInfo){\n\t\t\t\tsettings[iframeId].stopPageInfo();\n\t\t\t\tdelete settings[iframeId].stopPageInfo;\n\t\t\t}\n\t\t}\n\n\t\tfunction checkIFrameExists(){\n\t\t\tvar retBool = true;\n\n\t\t\tif (null === messageData.iframe) {\n\t\t\t\twarn(iframeId,'IFrame ('+messageData.id+') not found');\n\t\t\t\tretBool = false;\n\t\t\t}\n\t\t\treturn retBool;\n\t\t}\n\n\t\tfunction getElementPosition(target){\n\t\t\tvar iFramePosition = target.getBoundingClientRect();\n\n\t\t\tgetPagePosition(iframeId);\n\n\t\t\treturn {\n\t\t\t\tx: Math.floor( Number(iFramePosition.left) + Number(pagePosition.x) ),\n\t\t\t\ty: Math.floor( Number(iFramePosition.top) + Number(pagePosition.y) )\n\t\t\t};\n\t\t}\n\n\t\tfunction scrollRequestFromChild(addOffset){\n\t\t\t/* istanbul ignore next */ //Not testable in Karma\n\t\t\tfunction reposition(){\n\t\t\t\tpagePosition = newPosition;\n\t\t\t\tscrollTo();\n\t\t\t\tlog(iframeId,'--');\n\t\t\t}\n\n\t\t\tfunction calcOffset(){\n\t\t\t\treturn {\n\t\t\t\t\tx: Number(messageData.width) + offset.x,\n\t\t\t\t\ty: Number(messageData.height) + offset.y\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction scrollParent(){\n\t\t\t\tif (window.parentIFrame){\n\t\t\t\t\twindow.parentIFrame['scrollTo'+(addOffset?'Offset':'')](newPosition.x,newPosition.y);\n\t\t\t\t} else {\n\t\t\t\t\twarn(iframeId,'Unable to scroll to requested position, window.parentIFrame not found');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar\n\t\t\t\toffset = addOffset ? getElementPosition(messageData.iframe) : {x:0,y:0},\n\t\t\t\tnewPosition = calcOffset();\n\n\t\t\tlog(iframeId,'Reposition requested from iFrame (offset x:'+offset.x+' y:'+offset.y+')');\n\n\t\t\tif(window.top!==window.self){\n\t\t\t\tscrollParent();\n\t\t\t} else {\n\t\t\t\treposition();\n\t\t\t}\n\t\t}\n\n\t\tfunction scrollTo(){\n\t\t\tif (false !== callback('scrollCallback',pagePosition)){\n\t\t\t\tsetPagePosition(iframeId);\n\t\t\t} else {\n\t\t\t\tunsetPagePosition();\n\t\t\t}\n\t\t}\n\n\t\tfunction findTarget(location){\n\t\t\tfunction jumpToTarget(){\n\t\t\t\tvar jumpPosition = getElementPosition(target);\n\n\t\t\t\tlog(iframeId,'Moving to in page link (#'+hash+') at x: '+jumpPosition.x+' y: '+jumpPosition.y);\n\t\t\t\tpagePosition = {\n\t\t\t\t\tx: jumpPosition.x,\n\t\t\t\t\ty: jumpPosition.y\n\t\t\t\t};\n\n\t\t\t\tscrollTo();\n\t\t\t\tlog(iframeId,'--');\n\t\t\t}\n\n\t\t\tfunction jumpToParent(){\n\t\t\t\tif (window.parentIFrame){\n\t\t\t\t\twindow.parentIFrame.moveToAnchor(hash);\n\t\t\t\t} else {\n\t\t\t\t\tlog(iframeId,'In page link #'+hash+' not found and window.parentIFrame not found');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar\n\t\t\t\thash = location.split('#')[1] || '',\n\t\t\t\thashData = decodeURIComponent(hash),\n\t\t\t\ttarget = document.getElementById(hashData) || document.getElementsByName(hashData)[0];\n\n\t\t\tif (target){\n\t\t\t\tjumpToTarget();\n\t\t\t} else if(window.top!==window.self){\n\t\t\t\tjumpToParent();\n\t\t\t} else {\n\t\t\t\tlog(iframeId,'In page link #'+hash+' not found');\n\t\t\t}\n\t\t}\n\n\t\tfunction callback(funcName,val){\n\t\t\treturn chkCallback(iframeId,funcName,val);\n\t\t}\n\n\t\tfunction actionMsg(){\n\n\t\t\tif(settings[iframeId].firstRun) firstRun();\n\n\t\t\tswitch(messageData.type){\n\t\t\tcase 'close':\n\t\t\t\tcloseIFrame(messageData.iframe);\n\t\t\t\tbreak;\n\t\t\tcase 'message':\n\t\t\t\tforwardMsgFromIFrame(getMsgBody(6));\n\t\t\t\tbreak;\n\t\t\tcase 'scrollTo':\n\t\t\t\tscrollRequestFromChild(false);\n\t\t\t\tbreak;\n\t\t\tcase 'scrollToOffset':\n\t\t\t\tscrollRequestFromChild(true);\n\t\t\t\tbreak;\n\t\t\tcase 'pageInfo':\n\t\t\t\tsendPageInfoToIframe(settings[iframeId].iframe,iframeId);\n\t\t\t\tstartPageInfoMonitor();\n\t\t\t\tbreak;\n\t\t\tcase 'pageInfoStop':\n\t\t\t\tstopPageInfoMonitor();\n\t\t\t\tbreak;\n\t\t\tcase 'inPageLink':\n\t\t\t\tfindTarget(getMsgBody(9));\n\t\t\t\tbreak;\n\t\t\tcase 'reset':\n\t\t\t\tresetIFrame(messageData);\n\t\t\t\tbreak;\n\t\t\tcase 'init':\n\t\t\t\tresizeIFrame();\n\t\t\t\tcallback('initCallback',messageData.iframe);\n\t\t\t\tcallback('resizedCallback',messageData);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tresizeIFrame();\n\t\t\t\tcallback('resizedCallback',messageData);\n\t\t\t}\n\t\t}\n\n\t\tfunction hasSettings(iframeId){\n\t\t\tvar retBool = true;\n\n\t\t\tif (!settings[iframeId]){\n\t\t\t\tretBool = false;\n\t\t\t\twarn(messageData.type + ' No settings for ' + iframeId + '. Message was: ' + msg);\n\t\t\t}\n\n\t\t\treturn retBool;\n\t\t}\n\n\t\tfunction iFrameReadyMsgReceived(){\n\t\t\tfor (var iframeId in settings){\n\t\t\t\ttrigger('iFrame requested init',createOutgoingMsg(iframeId),document.getElementById(iframeId),iframeId);\n\t\t\t}\n\t\t}\n\n\t\tfunction firstRun() {\n\t\t\tsettings[iframeId].firstRun = false;\n\t\t}\n\n\t\tvar\n\t\t\tmsg = event.data,\n\t\t\tmessageData = {},\n\t\t\tiframeId = null;\n\n\t\tif('[iFrameResizerChild]Ready' === msg){\n\t\t\tiFrameReadyMsgReceived();\n\t\t} else if (isMessageForUs()){\n\t\t\tmessageData = processMsg();\n\t\t\tiframeId = logId = messageData.id;\n\n\t\t\tif (!isMessageFromMetaParent() && hasSettings(iframeId)){\n\t\t\t\tlog(iframeId,'Received: '+msg);\n\n\t\t\t\tif ( checkIFrameExists() && isMessageFromIFrame() ){\n\t\t\t\t\tactionMsg();\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tinfo(iframeId,'Ignored: '+msg);\n\t\t}\n\n\t}\n\n\n\tfunction chkCallback(iframeId,funcName,val){\n\t\tvar\n\t\t\tfunc = null,\n\t\t\tretVal = null;\n\n\t\tif(settings[iframeId]){\n\t\t\tfunc = settings[iframeId][funcName];\n\n\t\t\tif( 'function' === typeof func){\n\t\t\t\tretVal = func(val);\n\t\t\t} else {\n\t\t\t\tthrow new TypeError(funcName+' on iFrame['+iframeId+'] is not a function');\n\t\t\t}\n\t\t}\n\n\t\treturn retVal;\n\t}\n\n\tfunction closeIFrame(iframe){\n\t\tvar iframeId = iframe.id;\n\n\t\tlog(iframeId,'Removing iFrame: '+iframeId);\n\t\tiframe.parentNode.removeChild(iframe);\n\t\tchkCallback(iframeId,'closedCallback',iframeId);\n\t\tlog(iframeId,'--');\n\t\tdelete settings[iframeId];\n\t}\n\n\tfunction getPagePosition(iframeId){\n\t\tif(null === pagePosition){\n\t\t\tpagePosition = {\n\t\t\t\tx: (window.pageXOffset !== undefined) ? window.pageXOffset : document.documentElement.scrollLeft,\n\t\t\t\ty: (window.pageYOffset !== undefined) ? window.pageYOffset : document.documentElement.scrollTop\n\t\t\t};\n\t\t\tlog(iframeId,'Get page position: '+pagePosition.x+','+pagePosition.y);\n\t\t}\n\t}\n\n\tfunction setPagePosition(iframeId){\n\t\tif(null !== pagePosition){\n\t\t\twindow.scrollTo(pagePosition.x,pagePosition.y);\n\t\t\tlog(iframeId,'Set page position: '+pagePosition.x+','+pagePosition.y);\n\t\t\tunsetPagePosition();\n\t\t}\n\t}\n\n\tfunction unsetPagePosition(){\n\t\tpagePosition = null;\n\t}\n\n\tfunction resetIFrame(messageData){\n\t\tfunction reset(){\n\t\t\tsetSize(messageData);\n\t\t\ttrigger('reset','reset',messageData.iframe,messageData.id);\n\t\t}\n\n\t\tlog(messageData.id,'Size reset requested by '+('init'===messageData.type?'host page':'iFrame'));\n\t\tgetPagePosition(messageData.id);\n\t\tsyncResize(reset,messageData,'reset');\n\t}\n\n\tfunction setSize(messageData){\n\t\tfunction setDimension(dimension){\n\t\t\tmessageData.iframe.style[dimension] = messageData[dimension] + 'px';\n\t\t\tlog(\n\t\t\t\tmessageData.id,\n\t\t\t\t'IFrame (' + iframeId +\n\t\t\t\t') ' + dimension +\n\t\t\t\t' set to ' + messageData[dimension] + 'px'\n\t\t\t);\n\t\t}\n\n\t\tfunction chkZero(dimension){\n\t\t\t//FireFox sets dimension of hidden iFrames to zero.\n\t\t\t//So if we detect that set up an event to check for\n\t\t\t//when iFrame becomes visible.\n\n\t\t\t/* istanbul ignore next */ //Not testable in PhantomJS\n\t\t\tif (!hiddenCheckEnabled && '0' === messageData[dimension]){\n\t\t\t\thiddenCheckEnabled = true;\n\t\t\t\tlog(iframeId,'Hidden iFrame detected, creating visibility listener');\n\t\t\t\tfixHiddenIFrames();\n\t\t\t}\n\t\t}\n\n\t\tfunction processDimension(dimension){\n\t\t\tsetDimension(dimension);\n\t\t\tchkZero(dimension);\n\t\t}\n\n\t\tvar iframeId = messageData.iframe.id;\n\n\t\tif(settings[iframeId]){\n\t\t\tif( settings[iframeId].sizeHeight) { processDimension('height'); }\n\t\t\tif( settings[iframeId].sizeWidth ) { processDimension('width'); }\n\t\t}\n\t}\n\n\tfunction syncResize(func,messageData,doNotSync){\n\t\t/* istanbul ignore if */ //Not testable in PhantomJS\n\t\tif(doNotSync!==messageData.type && requestAnimationFrame){\n\t\t\tlog(messageData.id,'Requesting animation frame');\n\t\t\trequestAnimationFrame(func);\n\t\t} else {\n\t\t\tfunc();\n\t\t}\n\t}\n\n\tfunction trigger(calleeMsg,msg,iframe,id){\n\t\tfunction postMessageToIFrame(){\n\t\t\tvar target = settings[id].targetOrigin;\n\t\t\tlog(id,'[' + calleeMsg + '] Sending msg to iframe['+id+'] ('+msg+') targetOrigin: '+target);\n\t\t\tiframe.contentWindow.postMessage( msgId + msg, target );\n\t\t}\n\n\t\tfunction iFrameNotFound(){\n\t\t\tinfo(id,'[' + calleeMsg + '] IFrame('+id+') not found');\n\t\t\tif(settings[id]) {\n\t\t\t\tdelete settings[id];\n\t\t\t}\n\t\t}\n\n\t\tfunction chkAndSend(){\n\t\t\tif(iframe && 'contentWindow' in iframe && (null !== iframe.contentWindow)){ //Null test for PhantomJS\n\t\t\t\tpostMessageToIFrame();\n\t\t\t} else {\n\t\t\t\tiFrameNotFound();\n\t\t\t}\n\t\t}\n\n\t\tid = id || iframe.id;\n\n\t\tif(settings[id]) {\n\t\t\tchkAndSend();\n\t\t}\n\n\t}\n\n\tfunction createOutgoingMsg(iframeId){\n\t\treturn iframeId +\n\t\t\t':' + settings[iframeId].bodyMarginV1 +\n\t\t\t':' + settings[iframeId].sizeWidth +\n\t\t\t':' + settings[iframeId].log +\n\t\t\t':' + settings[iframeId].interval +\n\t\t\t':' + settings[iframeId].enablePublicMethods +\n\t\t\t':' + settings[iframeId].autoResize +\n\t\t\t':' + settings[iframeId].bodyMargin +\n\t\t\t':' + settings[iframeId].heightCalculationMethod +\n\t\t\t':' + settings[iframeId].bodyBackground +\n\t\t\t':' + settings[iframeId].bodyPadding +\n\t\t\t':' + settings[iframeId].tolerance +\n\t\t\t':' + settings[iframeId].inPageLinks +\n\t\t\t':' + settings[iframeId].resizeFrom +\n\t\t\t':' + settings[iframeId].widthCalculationMethod;\n\t}\n\n\tfunction setupIFrame(iframe,options){\n\t\tfunction setLimits(){\n\t\t\tfunction addStyle(style){\n\t\t\t\tif ((Infinity !== settings[iframeId][style]) && (0 !== settings[iframeId][style])){\n\t\t\t\t\tiframe.style[style] = settings[iframeId][style] + 'px';\n\t\t\t\t\tlog(iframeId,'Set '+style+' = '+settings[iframeId][style]+'px');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction chkMinMax(dimension){\n\t\t\t\tif (settings[iframeId]['min'+dimension]>settings[iframeId]['max'+dimension]){\n\t\t\t\t\tthrow new Error('Value for min'+dimension+' can not be greater than max'+dimension);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchkMinMax('Height');\n\t\t\tchkMinMax('Width');\n\n\t\t\taddStyle('maxHeight');\n\t\t\taddStyle('minHeight');\n\t\t\taddStyle('maxWidth');\n\t\t\taddStyle('minWidth');\n\t\t}\n\n\t\tfunction newId(){\n\t\t\tvar id = ((options && options.id) || defaults.id + count++);\n\t\t\tif (null!==document.getElementById(id)){\n\t\t\t\tid = id + count++;\n\t\t\t}\n\t\t\treturn id;\n\t\t}\n\n\t\tfunction ensureHasId(iframeId){\n\t\t\tlogId=iframeId;\n\t\t\tif (''===iframeId){\n\t\t\t\tiframe.id = iframeId = newId();\n\t\t\t\tlogEnabled = (options || {}).log;\n\t\t\t\tlogId=iframeId;\n\t\t\t\tlog(iframeId,'Added missing iframe ID: '+ iframeId +' (' + iframe.src + ')');\n\t\t\t}\n\n\n\t\t\treturn iframeId;\n\t\t}\n\n\t\tfunction setScrolling(){\n\t\t\tlog(iframeId,'IFrame scrolling ' + (settings[iframeId].scrolling ? 'enabled' : 'disabled') + ' for ' + iframeId);\n\t\t\tiframe.style.overflow = false === settings[iframeId].scrolling ? 'hidden' : 'auto';\n\t\t\tiframe.scrolling = false === settings[iframeId].scrolling ? 'no' : 'yes';\n\t\t}\n\n\t\t//The V1 iFrame script expects an int, where as in V2 expects a CSS\n\t\t//string value such as '1px 3em', so if we have an int for V2, set V1=V2\n\t\t//and then convert V2 to a string PX value.\n\t\tfunction setupBodyMarginValues(){\n\t\t\tif (('number'===typeof(settings[iframeId].bodyMargin)) || ('0'===settings[iframeId].bodyMargin)){\n\t\t\t\tsettings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;\n\t\t\t\tsettings[iframeId].bodyMargin = '' + settings[iframeId].bodyMargin + 'px';\n\t\t\t}\n\t\t}\n\n\t\tfunction checkReset(){\n\t\t\t// Reduce scope of firstRun to function, because IE8's JS execution\n\t\t\t// context stack is borked and this value gets externally\n\t\t\t// changed midway through running this function!!!\n\t\t\tvar\n\t\t\t\tfirstRun = settings[iframeId].firstRun,\n\t\t\t\tresetRequertMethod = settings[iframeId].heightCalculationMethod in resetRequiredMethods;\n\n\t\t\tif (!firstRun && resetRequertMethod){\n\t\t\t\tresetIFrame({iframe:iframe, height:0, width:0, type:'init'});\n\t\t\t}\n\t\t}\n\n\t\tfunction setupIFrameObject(){\n\t\t\tif(Function.prototype.bind){ //Ignore unpolyfilled IE8.\n\t\t\t\tsettings[iframeId].iframe.iFrameResizer = {\n\n\t\t\t\t\tclose : closeIFrame.bind(null,settings[iframeId].iframe),\n\n\t\t\t\t\tresize : trigger.bind(null,'Window resize', 'resize', settings[iframeId].iframe),\n\n\t\t\t\t\tmoveToAnchor : function(anchor){\n\t\t\t\t\t\ttrigger('Move to anchor','inPageLink:'+anchor, settings[iframeId].iframe,iframeId);\n\t\t\t\t\t},\n\n\t\t\t\t\tsendMessage : function(message){\n\t\t\t\t\t\tmessage = JSON.stringify(message);\n\t\t\t\t\t\ttrigger('Send Message','message:'+message, settings[iframeId].iframe,iframeId);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t//We have to call trigger twice, as we can not be sure if all\n\t\t//iframes have completed loading when this code runs. The\n\t\t//event listener also catches the page changing in the iFrame.\n\t\tfunction init(msg){\n\t\t\tfunction iFrameLoaded(){\n\t\t\t\ttrigger('iFrame.onload',msg,iframe);\n\t\t\t\tcheckReset();\n\t\t\t}\n\n\t\t\taddEventListener(iframe,'load',iFrameLoaded);\n\t\t\ttrigger('init',msg,iframe);\n\t\t}\n\n\t\tfunction checkOptions(options){\n\t\t\tif ('object' !== typeof options){\n\t\t\t\tthrow new TypeError('Options is not an object');\n\t\t\t}\n\t\t}\n\n\t\tfunction copyOptions(options){\n\t\t\tfor (var option in defaults) {\n\t\t\t\tif (defaults.hasOwnProperty(option)){\n\t\t\t\t\tsettings[iframeId][option] = options.hasOwnProperty(option) ? options[option] : defaults[option];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction getTargetOrigin (remoteHost){\n\t\t\treturn ('' === remoteHost || 'file://' === remoteHost) ? '*' : remoteHost;\n\t\t}\n\n\t\tfunction processOptions(options){\n\t\t\toptions = options || {};\n\t\t\tsettings[iframeId] = {\n\t\t\t\tfirstRun\t: true,\n\t\t\t\tiframe\t\t: iframe,\n\t\t\t\tremoteHost\t: iframe.src.split('/').slice(0,3).join('/')\n\t\t\t};\n\n\t\t\tcheckOptions(options);\n\t\t\tcopyOptions(options);\n\n\t\t\tsettings[iframeId].targetOrigin = true === settings[iframeId].checkOrigin ? getTargetOrigin(settings[iframeId].remoteHost) : '*';\n\t\t}\n\n\t\tfunction beenHere(){\n\t\t\treturn (iframeId in settings && 'iFrameResizer' in iframe);\n\t\t}\n\n\t\tvar iframeId = ensureHasId(iframe.id);\n\n\t\tif (!beenHere()){\n\t\t\tprocessOptions(options);\n\t\t\tsetScrolling();\n\t\t\tsetLimits();\n\t\t\tsetupBodyMarginValues();\n\t\t\tinit(createOutgoingMsg(iframeId));\n\t\t\tsetupIFrameObject();\n\t\t} else {\n\t\t\twarn(iframeId,'Ignored iFrame, already setup.');\n\t\t}\n\t}\n\n\tfunction debouce(fn,time){\n\t\tif (null === timer){\n\t\t\ttimer = setTimeout(function(){\n\t\t\t\ttimer = null;\n\t\t\t\tfn();\n\t\t\t}, time);\n\t\t}\n\t}\n\n\t/* istanbul ignore next */ //Not testable in PhantomJS\n\tfunction fixHiddenIFrames(){\n\t\tfunction checkIFrames(){\n\t\t\tfunction checkIFrame(settingId){\n\t\t\t\tfunction chkDimension(dimension){\n\t\t\t\t\treturn '0px' === settings[settingId].iframe.style[dimension];\n\t\t\t\t}\n\n\t\t\t\tfunction isVisible(el) {\n\t\t\t\t\treturn (null !== el.offsetParent);\n\t\t\t\t}\n\n\t\t\t\tif (isVisible(settings[settingId].iframe) && (chkDimension('height') || chkDimension('width'))){\n\t\t\t\t\ttrigger('Visibility change', 'resize', settings[settingId].iframe,settingId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var settingId in settings){\n\t\t\t\tcheckIFrame(settingId);\n\t\t\t}\n\t\t}\n\n\t\tfunction mutationObserved(mutations){\n\t\t\tlog('window','Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type);\n\t\t\tdebouce(checkIFrames,16);\n\t\t}\n\n\t\tfunction createMutationObserver(){\n\t\t\tvar\n\t\t\t\ttarget = document.querySelector('body'),\n\n\t\t\t\tconfig = {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tattributeOldValue : false,\n\t\t\t\t\tcharacterData : true,\n\t\t\t\t\tcharacterDataOldValue : false,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tsubtree : true\n\t\t\t\t},\n\n\t\t\t\tobserver = new MutationObserver(mutationObserved);\n\n\t\t\tobserver.observe(target, config);\n\t\t}\n\n\t\tvar MutationObserver = window.MutationObserver || window.WebKitMutationObserver;\n\n\t\tif (MutationObserver) createMutationObserver();\n\t}\n\n\n\tfunction resizeIFrames(event){\n\t\tfunction resize(){\n\t\t\tsendTriggerMsg('Window '+event,'resize');\n\t\t}\n\n\t\tlog('window','Trigger event: '+event);\n\t\tdebouce(resize,16);\n\t}\n\n\t/* istanbul ignore next */ //Not testable in PhantomJS\n\tfunction tabVisible() {\n\t\tfunction resize(){\n\t\t\tsendTriggerMsg('Tab Visable','resize');\n\t\t}\n\n\t\tif('hidden' !== document.visibilityState) {\n\t\t\tlog('document','Trigger event: Visiblity change');\n\t\t\tdebouce(resize,16);\n\t\t}\n\t}\n\n\tfunction sendTriggerMsg(eventName,event){\n\t\tfunction isIFrameResizeEnabled(iframeId) {\n\t\t\treturn\t'parent' === settings[iframeId].resizeFrom &&\n\t\t\t\t\tsettings[iframeId].autoResize &&\n\t\t\t\t\t!settings[iframeId].firstRun;\n\t\t}\n\n\t\tfor (var iframeId in settings){\n\t\t\tif(isIFrameResizeEnabled(iframeId)){\n\t\t\t\ttrigger(eventName,event,document.getElementById(iframeId),iframeId);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction setupEventListeners(){\n\t\taddEventListener(window,'message',iFrameListener);\n\n\t\taddEventListener(window,'resize', function(){resizeIFrames('resize');});\n\n\t\taddEventListener(document,'visibilitychange',tabVisible);\n\t\taddEventListener(document,'-webkit-visibilitychange',tabVisible); //Andriod 4.4\n\t\taddEventListener(window,'focusin',function(){resizeIFrames('focus');}); //IE8-9\n\t\taddEventListener(window,'focus',function(){resizeIFrames('focus');});\n\t}\n\n\n\tfunction factory(){\n\t\tfunction init(options,element){\n\t\t\tfunction chkType(){\n\t\t\t\tif(!element.tagName) {\n\t\t\t\t\tthrow new TypeError('Object is not a valid DOM element');\n\t\t\t\t} else if ('IFRAME' !== element.tagName.toUpperCase()) {\n\t\t\t\t\tthrow new TypeError('Expected <IFRAME> tag, found <'+element.tagName+'>');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(element) {\n\t\t\t\tchkType();\n\t\t\t\tsetupIFrame(element, options);\n\t\t\t\tiFrames.push(element);\n\t\t\t}\n\t\t}\n\n\t\tvar iFrames;\n\n\t\tsetupRequestAnimationFrame();\n\t\tsetupEventListeners();\n\n\t\treturn function iFrameResizeF(options,target){\n\t\t\tiFrames = []; //Only return iFrames past in on this call\n\n\t\t\tswitch (typeof(target)){\n\t\t\tcase 'undefined':\n\t\t\tcase 'string':\n\t\t\t\tArray.prototype.forEach.call(\n\t\t\t\t\tdocument.querySelectorAll( target || 'iframe' ),\n\t\t\t\t\tinit.bind(undefined, options)\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase 'object':\n\t\t\t\tinit(options,target);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new TypeError('Unexpected data type ('+typeof(target)+')');\n\t\t\t}\n\n\t\t\treturn iFrames;\n\t\t};\n\t}\n\n\tfunction createJQueryPublicMethod($){\n\t\t$.fn.iFrameResize = function $iFrameResizeF(options) {\n\t\t\treturn this.filter('iframe').each(function (index, element) {\n\t\t\t\tsetupIFrame(element, options);\n\t\t\t}).end();\n\t\t};\n\t}\n\n\tif (window.jQuery) { createJQueryPublicMethod(jQuery); }\n\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine([],factory);\n\t} else if (typeof module === 'object' && typeof module.exports === 'object') { //Node for browserfy\n\t\tmodule.exports = factory();\n\t} else {\n\t\twindow.iFrameResize = window.iFrameResize || factory();\n\t}\n\n})(window || {});\n"]}
|
|
includes/js/misc_functions.js
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Created by bogdan on 7/13/16.
|
3 |
-
*/
|
4 |
-
|
5 |
-
function append_element(options) {
|
6 |
-
if(options == undefined)
|
7 |
-
return false;
|
8 |
-
if(!("elementType" in options))
|
9 |
-
return false;
|
10 |
-
|
11 |
-
var parent = null;
|
12 |
-
|
13 |
-
if(!!options.following)
|
14 |
-
parent = options.following.parentElement;
|
15 |
-
else if(!!options.inside)
|
16 |
-
parent = options.inside;
|
17 |
-
else if(!!options.replacing)
|
18 |
-
parent = options.replacing.parentElement;
|
19 |
-
else if(options.elementType == "script")
|
20 |
-
parent = document.head;
|
21 |
-
else
|
22 |
-
parent = document.body;
|
23 |
-
|
24 |
-
if(parent == null)
|
25 |
-
return false;
|
26 |
-
|
27 |
-
var element = document.createElement(options.elementType);
|
28 |
-
delete options.elementType;
|
29 |
-
|
30 |
-
element = jQuery.extend(element, options);
|
31 |
-
|
32 |
-
if(!!options.replacing)
|
33 |
-
parent.replaceChild(element, options.replacing);
|
34 |
-
else
|
35 |
-
parent.appendChild(element);
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/js/widget.js
DELETED
@@ -1,212 +0,0 @@
|
|
1 |
-
window.captainform_is_widget_page = true;
|
2 |
-
jQuery(document).ready(function ($) {
|
3 |
-
captainform_bind_widget();
|
4 |
-
});
|
5 |
-
|
6 |
-
function captainform_bind_widget(widget_id_to_bind)
|
7 |
-
{
|
8 |
-
var prefix = '';
|
9 |
-
if (typeof widget_id_to_bind != 'undefined' && widget_id_to_bind != '' && widget_id_to_bind != null)
|
10 |
-
prefix = "#" + widget_id_to_bind + " ";
|
11 |
-
|
12 |
-
bind_searchable(prefix);
|
13 |
-
bind_lightbox_publish(prefix);
|
14 |
-
if (typeof jscolor != 'undefined')
|
15 |
-
jscolor.init();
|
16 |
-
}
|
17 |
-
|
18 |
-
function bind_lightbox_publish(prefix)
|
19 |
-
{
|
20 |
-
jQuery(prefix + '.cf_lightbox_cotainer').each(function () {
|
21 |
-
if (jQuery(this).find(".cf_display_as_lightbox").is(':checked'))
|
22 |
-
{
|
23 |
-
jQuery(this).find('.cf_triggers_container').show();
|
24 |
-
if (jQuery(this).find('.cf_trigger:checked').val() == 1)
|
25 |
-
{
|
26 |
-
image_obj = jQuery(this).find('.cf_trigger_1_url');
|
27 |
-
captainform_test_valid_image(image_obj.val(), image_obj)
|
28 |
-
}
|
29 |
-
}
|
30 |
-
else if (!jQuery(this).find(".cf_display_as_lightbox").is(':checked'))
|
31 |
-
{
|
32 |
-
jQuery(this).find('.cf_triggers_container').hide();
|
33 |
-
}
|
34 |
-
});
|
35 |
-
|
36 |
-
jQuery(prefix + '.cf_display_as_lightbox').on('click', function () {
|
37 |
-
if (jQuery(this).is(':checked'))
|
38 |
-
jQuery(this).closest('.cf_lightbox_cotainer').find('.cf_triggers_container').show();
|
39 |
-
else
|
40 |
-
jQuery(this).closest('.cf_lightbox_cotainer').find('.cf_triggers_container').hide();
|
41 |
-
});
|
42 |
-
|
43 |
-
jQuery(prefix + '.cf_trigger').on('click', function () {
|
44 |
-
var value = jQuery(this).val();
|
45 |
-
var options_container = jQuery(this).closest('.cf_triggers_container');
|
46 |
-
jQuery(options_container).find('.cf_trigger_selected_option_container').hide();
|
47 |
-
jQuery(options_container).find('.cf_trigger_selected_option_cotainter_' + value).show();
|
48 |
-
|
49 |
-
});
|
50 |
-
|
51 |
-
jQuery(prefix + '.cf_trigger').each(function () {
|
52 |
-
var value = jQuery(this).val();
|
53 |
-
if (jQuery(this).is(':checked'))
|
54 |
-
{
|
55 |
-
var options_container = jQuery(this).closest('.cf_triggers_container');
|
56 |
-
jQuery(options_container).find('.cf_trigger_selected_option_container').hide();
|
57 |
-
jQuery(options_container).find('.cf_trigger_selected_option_cotainter_' + value).show();
|
58 |
-
}
|
59 |
-
});
|
60 |
-
|
61 |
-
jQuery(prefix + '.cf_display_as_lightbox').on('change', function () {
|
62 |
-
if (!jQuery(this).is(':checked'))
|
63 |
-
{
|
64 |
-
var formid = jQuery(this).closest('.captainform_widget_container').find('.captainform_widget_select').val();
|
65 |
-
var code = '[captainform id="' + formid + '"]';
|
66 |
-
jQuery(this).closest('.captainform_widget_container').find('.cf_generated_code').val(code);
|
67 |
-
}
|
68 |
-
});
|
69 |
-
|
70 |
-
jQuery(prefix + '.cf_trigger_1_url').on('change keyup', function () {
|
71 |
-
captainform_test_valid_image(jQuery(this).val(), jQuery(this));
|
72 |
-
})
|
73 |
-
|
74 |
-
jQuery(prefix + '.cf_triggers_container input , ' + prefix + ' .cf_display_as_lightbox' + ',' + prefix + ' .captainform_widget_select,' + prefix + ' .captainform_form_toembed').on('change keyup', function () {
|
75 |
-
if (window.captainform_is_widget_page == true)
|
76 |
-
var formid = jQuery(this).closest('.captainform_widget_container').find('.captainform_widget_select').val();
|
77 |
-
else
|
78 |
-
var formid = document.getElementById('captainform_form_toembed').options[document.getElementById('captainform_form_toembed').selectedIndex].value;
|
79 |
-
var display_as_lightbox = jQuery(this).closest('.captainform_widget_container').find('.cf_display_as_lightbox').is(':checked');
|
80 |
-
var code = '[captainform id="' + formid+'"';
|
81 |
-
if (display_as_lightbox == true)
|
82 |
-
{
|
83 |
-
code += ' lightbox="1" ';
|
84 |
-
var selected_trigger = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger:checked').val();
|
85 |
-
switch (selected_trigger)
|
86 |
-
{
|
87 |
-
case '0' : //text
|
88 |
-
var text_selected = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_0_text').val();
|
89 |
-
code += 'text_content="' + encodeURIComponent(text_selected) + '" type="text"';
|
90 |
-
break;
|
91 |
-
case '1': //image
|
92 |
-
var image_obj = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_1_url');
|
93 |
-
var image_url = image_obj.val();
|
94 |
-
code += 'url="' + encodeURI(image_url) + '" type="image"';
|
95 |
-
break;
|
96 |
-
case '2': //floating button
|
97 |
-
var text = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_text').val();
|
98 |
-
var position = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_position:checked').val();
|
99 |
-
var background_color = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_background_color').val();
|
100 |
-
var text_color = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_color').val();
|
101 |
-
|
102 |
-
code += 'text_content="' + encodeURIComponent(text) + '" ';
|
103 |
-
code += 'bg_color="' + background_color + '" ';
|
104 |
-
code += 'text_color="' + text_color + '" ';
|
105 |
-
|
106 |
-
switch (position)
|
107 |
-
{
|
108 |
-
case '1':
|
109 |
-
code += 'position="left" ';
|
110 |
-
break;
|
111 |
-
case '2':
|
112 |
-
code += 'position="right" ';
|
113 |
-
break;
|
114 |
-
case '3':
|
115 |
-
code += 'position="bottom" ';
|
116 |
-
break;
|
117 |
-
default:
|
118 |
-
code += 'position="left" ';
|
119 |
-
}
|
120 |
-
code += 'type="floating-button"';
|
121 |
-
break;
|
122 |
-
case '3': //Auto popup
|
123 |
-
var after = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_time').val() * 1000;
|
124 |
-
if(after <= 0)
|
125 |
-
after = 3000;
|
126 |
-
if (after != '')
|
127 |
-
code += 'miliseconds="' + after + '" ';
|
128 |
-
else
|
129 |
-
code += 'miliseconds="' + 3000 + '" ';
|
130 |
-
code += 'type="auto-popup"';
|
131 |
-
break;
|
132 |
-
}
|
133 |
-
}
|
134 |
-
code += ']';
|
135 |
-
|
136 |
-
if (window.captainform_is_widget_page == true)
|
137 |
-
jQuery(this).closest('.captainform_widget_container').find('.cf_generated_code').val(code);
|
138 |
-
else
|
139 |
-
jQuery('.cf_generated_code').val(code);
|
140 |
-
|
141 |
-
});
|
142 |
-
}
|
143 |
-
|
144 |
-
function bind_searchable(prefix)
|
145 |
-
{
|
146 |
-
try {
|
147 |
-
jQuery(prefix + '.captainform_widget_select').chosen({search_contains: true, no_results_text: 'No results match'});
|
148 |
-
jQuery(prefix + '.captainform_widget_container').find('.chosen-container.chosen-container-single').each(function () {
|
149 |
-
if (jQuery(this).parent().find('.chosen-container.chosen-container-single').length > 1)
|
150 |
-
{
|
151 |
-
jQuery(this).parent().find('.chosen-container.chosen-container-single').last().remove();
|
152 |
-
}
|
153 |
-
});
|
154 |
-
}
|
155 |
-
catch (err)
|
156 |
-
{
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
jQuery(document).ajaxComplete(function (event, XMLHttpRequest, ajaxOptions) {
|
161 |
-
var request = {}, pairs, i, split, widget;
|
162 |
-
if(typeof ajaxOptions.data != 'undefined')
|
163 |
-
{
|
164 |
-
pairs = ajaxOptions.data.split('&');
|
165 |
-
for (i in pairs) {
|
166 |
-
split = pairs[i].split('=');
|
167 |
-
request[decodeURIComponent(split[0])] = decodeURIComponent(split[1]);
|
168 |
-
}
|
169 |
-
}
|
170 |
-
if ((request.action && (request.action === 'save-widget') && (typeof request['widget-id'] != 'undefined') && (request['widget-id'].indexOf('captainformwidget') != -1))|| (typeof request.wp_customize != 'undefined' && request.wp_customize == 'on')) {
|
171 |
-
var my_widget_id = request['widget-id'];
|
172 |
-
var widget_div_id = null;
|
173 |
-
var bind_captainform_widgets = false;
|
174 |
-
if(typeof request.wp_customize != 'undefined' && request.wp_customize == 'on'){
|
175 |
-
bind_captainform_widgets = true;
|
176 |
-
}
|
177 |
-
else{
|
178 |
-
jQuery('.widget').each(function () {
|
179 |
-
if (jQuery(this).attr('id').match(new RegExp(my_widget_id))) {
|
180 |
-
widget_div_id = jQuery(this).attr('id');
|
181 |
-
}
|
182 |
-
});
|
183 |
-
if (widget_div_id != null)
|
184 |
-
bind_captainform_widgets =true;
|
185 |
-
}
|
186 |
-
if(bind_captainform_widgets == true)
|
187 |
-
captainform_bind_widget(widget_div_id);
|
188 |
-
}
|
189 |
-
});
|
190 |
-
|
191 |
-
function captainform_test_valid_image(url, object, timeout) {
|
192 |
-
timeout = timeout || 5000;
|
193 |
-
var timedOut = false, timer;
|
194 |
-
var img = new Image();
|
195 |
-
img.onerror = img.onabort = function () {
|
196 |
-
if (!timedOut) {
|
197 |
-
clearTimeout(timer);
|
198 |
-
jQuery(object).addClass('cf_red_border'); //error
|
199 |
-
}
|
200 |
-
};
|
201 |
-
img.onload = function () {
|
202 |
-
if (!timedOut) {
|
203 |
-
clearTimeout(timer);
|
204 |
-
jQuery(object).removeClass('cf_red_border'); //success
|
205 |
-
}
|
206 |
-
};
|
207 |
-
img.src = url;
|
208 |
-
timer = setTimeout(function () {
|
209 |
-
timedOut = true;
|
210 |
-
jQuery(object).addClass('cf_red_border'); //timeout
|
211 |
-
}, timeout);
|
212 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/settings.php
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
global $captainform_plugin_name,
|
4 |
-
$captainform_plugin_version,
|
5 |
-
$captainform_formcode_pattern,
|
6 |
-
$captainform_replace_patterns,
|
7 |
-
$captainform_servicedomain,
|
8 |
-
$captainform_option1,
|
9 |
-
$captainform_option2,
|
10 |
-
$captainform_option3,
|
11 |
-
$captainform_widget_text_filter;
|
12 |
-
|
13 |
-
$captainform_plugin_name = 'captainform';
|
14 |
-
$captainform_plugin_version = "1.7.2.3";
|
15 |
-
|
16 |
-
//plugin options key name
|
17 |
-
$captainform_option1 = $captainform_plugin_name . '_installation_id';
|
18 |
-
$captainform_option2 = $captainform_plugin_name . '_installation_key';
|
19 |
-
$captainform_option3 = $captainform_plugin_name . '_site_url';
|
20 |
-
|
21 |
-
//plugin directory
|
22 |
-
$captainform_plugin_dir = plugin_dir_url(dirname(__FILE__));
|
23 |
-
|
24 |
-
//service domain for handler of form code
|
25 |
-
$captainform_servicedomain = 'app.captainform.com';
|
26 |
-
|
27 |
-
$params = array(
|
28 |
-
'captainform_servicedomain' => $captainform_servicedomain,
|
29 |
-
'captainform_plugin_dir' => $captainform_plugin_dir,
|
30 |
-
);
|
31 |
-
|
32 |
-
//Global Resources -- used for every type of embedding
|
33 |
-
$captainform_common_js_vars = captainform_getFormResources('global-vars', $params);
|
34 |
-
//TinyBox Resources
|
35 |
-
$captainform_tinybox_resources = captainform_getFormResources('tinybox-resources', $params);
|
36 |
-
//Normal Embedding
|
37 |
-
$captainform_formcode_pattern = $captainform_common_js_vars . captainform_getFormResources('normal-embedding', $params);
|
38 |
-
//LightBox Embedding [text/image/floating button]
|
39 |
-
$captainform_formcode_pattern_lightbox = $captainform_common_js_vars . $captainform_tinybox_resources . captainform_getFormResources('lightbox-embedding', $params);
|
40 |
-
//LightBox Embedding [auto-popup]
|
41 |
-
$captainform_formcode_pattern_lightbox_auto = $captainform_common_js_vars . $captainform_tinybox_resources . captainform_getFormResources('lightbox-auto-embedding', $params);
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Loads form resources
|
45 |
-
* @param string - resource file
|
46 |
-
* @param array - array of variables to replace in resource files
|
47 |
-
* @return string
|
48 |
-
**/
|
49 |
-
function captainform_getFormResources($resource, $params = array())
|
50 |
-
{
|
51 |
-
if (count($params))
|
52 |
-
foreach ($params as $key => $val)
|
53 |
-
$$key = $val;
|
54 |
-
|
55 |
-
ob_start();
|
56 |
-
include_once("form-resources/$resource.php");
|
57 |
-
return ob_get_clean();
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* captainform_get_forms validates users based on wordpress app instalattion id and key
|
62 |
-
**/
|
63 |
-
function captainform_get_forms($publish_method, $count = 2)
|
64 |
-
{
|
65 |
-
$url = 'http://' . $GLOBALS['captainform_servicedomain'] . '/wp_dispatcher.php?app_id='
|
66 |
-
. urlencode(get_site_option($GLOBALS['captainform_option1']))
|
67 |
-
. '&app_key=' . urlencode(get_site_option($GLOBALS['captainform_option2']));
|
68 |
-
|
69 |
-
if ($publish_method && $count == 2)
|
70 |
-
$url .= '&publish_method=' . $publish_method;
|
71 |
-
|
72 |
-
$res = wp_remote_fopen($url);
|
73 |
-
if ($res === false)
|
74 |
-
return false;
|
75 |
-
|
76 |
-
return json_decode($res);
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* replace patterns into strings that have patterns
|
81 |
-
* @param string
|
82 |
-
* @param array - associate array - key is pattern, value is string for replace pattern
|
83 |
-
* @return string
|
84 |
-
**/
|
85 |
-
function captainform_replace_patterns($str, $data = null)
|
86 |
-
{
|
87 |
-
if ($data)
|
88 |
-
if (is_array($data)) {
|
89 |
-
foreach ($data as $k => $v)
|
90 |
-
if ($k)
|
91 |
-
$str = str_replace('{{' . strtoupper($k) . '}}', $v, $str);
|
92 |
-
}
|
93 |
-
return $str;
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/shortcodes.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function captainform_shortcode_handler($shortcode)
|
4 |
-
{
|
5 |
-
if (isset($shortcode[0]))
|
6 |
-
$form_id = $shortcode[0];
|
7 |
-
if (isset($shortcode['id']))
|
8 |
-
$form_id = $shortcode['id'];
|
9 |
-
|
10 |
-
$custom_options = array(
|
11 |
-
'form_id' => $form_id,
|
12 |
-
'lightbox' => (isset($shortcode['lightbox'])) ? $shortcode['lightbox'] : false,
|
13 |
-
'type' => (isset($shortcode['type'])) ? $shortcode['type'] : null,
|
14 |
-
'content' => (isset($shortcode['text_content'])) ? $shortcode['text_content'] : (isset($shortcode['content']) ? $shortcode['content'] : null),
|
15 |
-
'url' => (isset($shortcode['url'])) ? $shortcode['url'] : null,
|
16 |
-
'miliseconds' => (isset($shortcode['miliseconds'])) ? $shortcode['miliseconds'] : null,
|
17 |
-
'text_color' => (isset($shortcode['text_color'])) ? $shortcode['text_color'] : null,
|
18 |
-
'bg_color' => (isset($shortcode['bg_color'])) ? $shortcode['bg_color'] : null,
|
19 |
-
'position' => (isset($shortcode['position'])) ? $shortcode['position'] : null,
|
20 |
-
);
|
21 |
-
|
22 |
-
$shortcode_final = '[captainform id="' . $form_id . '" ';
|
23 |
-
$shortcode_final .= (isset($shortcode['lightbox'])) ? " lightbox='{$shortcode['lightbox']}'" : '';
|
24 |
-
$shortcode_final .= (isset($shortcode['type'])) ? " type='{$shortcode['type']}'" : '';
|
25 |
-
$shortcode_final .= (isset($shortcode['url'])) ? " url='{$shortcode['url']}'" : '';
|
26 |
-
$shortcode_final .= (isset($shortcode['text_content'])) ? ' text_content="' . $shortcode['text_content'] . '"' : (isset($shortcode['content']) ? ' content="' . $shortcode['content'] . '"' : '');
|
27 |
-
$shortcode_final .= (isset($shortcode['miliseconds'])) ? " miliseconds='{$shortcode['miliseconds']}'" : '';
|
28 |
-
$shortcode_final .= (isset($shortcode['text_color'])) ? " text_color='{$shortcode['text_color']}'" : '';
|
29 |
-
$shortcode_final .= (isset($shortcode['bg_color'])) ? " bg_color='{$shortcode['bg_color']}'" : '';
|
30 |
-
$shortcode_final .= (isset($shortcode['position'])) ? " position='{$shortcode['position']}'" : '';
|
31 |
-
|
32 |
-
$shortcode_final .= ']';
|
33 |
-
|
34 |
-
$content = captainform_widget_text_filter($shortcode_final, NULL, $custom_options);
|
35 |
-
return $content;
|
36 |
-
}
|
37 |
-
|
38 |
-
add_shortcode('captainform', 'captainform_shortcode_handler');
|
39 |
-
add_shortcode('captain-form', 'captainform_shortcode_handler');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
languages/captainform.pot
ADDED
File without changes
|
public/class-captainform-public-form-custom-vars.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The class that handles the custom variables
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/public
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The custom variables class
|
15 |
+
*
|
16 |
+
* Gets all the custom variables (shortcode, URL) and returns them in a string format.
|
17 |
+
*
|
18 |
+
* @package Captainform
|
19 |
+
* @subpackage Captainform/public
|
20 |
+
* @author captainform <team@captainform.com>
|
21 |
+
*/
|
22 |
+
class Captainform_FormCustomVars {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The form options.
|
26 |
+
*
|
27 |
+
* @since 2.0.0
|
28 |
+
* @access private
|
29 |
+
* @var array $version An array containing all the form options.
|
30 |
+
*/
|
31 |
+
private $shortcodeOptions;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get Custom options for Wordpress Logged In users
|
35 |
+
*
|
36 |
+
* @since 2.1.6
|
37 |
+
* @access private
|
38 |
+
* @var array Options and identifier for $current_user
|
39 |
+
*/
|
40 |
+
private $wordpressShortcodeOptions = array(
|
41 |
+
'WORDPRESS_USERNAME' => 'user_login' ,
|
42 |
+
'WORDPRESS_EMAIL' => 'user_email',
|
43 |
+
'WORDPRESS_FIRSTNAME' => 'user_firstname',
|
44 |
+
'WORDPRESS_LASTNAME' => 'user_lastname',
|
45 |
+
'WORDPRESS_DISPLAYNAME' =>'display_name',
|
46 |
+
'WORDPRESS_URL' => 'user_url',
|
47 |
+
'WORDPRESS_USERID' => 'ID',
|
48 |
+
'CAPTAINFORMREQUEST' ,
|
49 |
+
);
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Custom vars identifier.
|
53 |
+
*
|
54 |
+
* @since 2.0.0
|
55 |
+
* @access private
|
56 |
+
* @var array $version A string to recognize the form custom variables.
|
57 |
+
*/
|
58 |
+
private $customVarIdentifier = 'cf_custom_var';
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Captainform_FormCustomVars constructor.
|
62 |
+
*
|
63 |
+
* @since 2.0.0
|
64 |
+
* @access public
|
65 |
+
* @param array $shortcodeOptions
|
66 |
+
*/
|
67 |
+
public function __construct(array $shortcodeOptions) {
|
68 |
+
$this->shortcodeOptions = $shortcodeOptions;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* The method that gets the custom variables from the shortcode
|
73 |
+
*
|
74 |
+
* @since 2.0.0
|
75 |
+
* @access private
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
private function get_custom_vars_from_shortcode()
|
79 |
+
{
|
80 |
+
$custom_vars_string = '';
|
81 |
+
$current_user = wp_get_current_user();
|
82 |
+
|
83 |
+
foreach($this->shortcodeOptions as $option => $value){
|
84 |
+
if(strpos($option, $this->customVarIdentifier) !== false){
|
85 |
+
if(array_key_exists($value,$this->wordpressShortcodeOptions))
|
86 |
+
{
|
87 |
+
if(isset($current_user->{$this->wordpressShortcodeOptions[$value]})){
|
88 |
+
$value = $current_user->{$this->wordpressShortcodeOptions[$value]};
|
89 |
+
}
|
90 |
+
else
|
91 |
+
$value = "";
|
92 |
+
}
|
93 |
+
else if(strpos($value, 'CAPTAINFORMREQUEST_') !== false)
|
94 |
+
{
|
95 |
+
if(isset($_REQUEST[substr($value,strlen('CAPTAINFORMREQUEST_'))]))
|
96 |
+
$value = $_REQUEST[substr($value,strlen('CAPTAINFORMREQUEST_'))];
|
97 |
+
else
|
98 |
+
$value = "";
|
99 |
+
}
|
100 |
+
|
101 |
+
$custom_vars_string .= '&control' . ltrim($option, $this->customVarIdentifier) . '=' . str_replace('+',' ',urlencode($value));
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
return $custom_vars_string;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* The method that gets the custom variables from the URL
|
110 |
+
*
|
111 |
+
* @since 2.0.0
|
112 |
+
* @access private
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
private function get_custom_vars_from_url() {
|
116 |
+
$custom_vars_string = '';
|
117 |
+
|
118 |
+
foreach ($_GET as $key => $value) {
|
119 |
+
if (strpos($key, 'control') !== false) {
|
120 |
+
$custom_vars_string .= '&' . $key . '=' . $value;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
return $custom_vars_string;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* This method returns all the custom variables in a string format, ready to be appended to the form URL
|
129 |
+
*
|
130 |
+
* @since 2.0.0
|
131 |
+
* @access public
|
132 |
+
* @param string $extra_vars
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
public function get_custom_vars($extra_vars = ''){
|
136 |
+
$custom_vars_string = '';
|
137 |
+
$custom_vars_string .= $this->get_custom_vars_from_shortcode();
|
138 |
+
$custom_vars_string .= $this->get_custom_vars_from_url();
|
139 |
+
if (gettype($extra_vars) == "array" && count($extra_vars)) {
|
140 |
+
foreach ($extra_vars as $key => $value)
|
141 |
+
$custom_vars_string .= '&' . $key . '=' . $value;
|
142 |
+
} elseif (strlen($extra_vars))
|
143 |
+
$custom_vars_string .= $extra_vars;
|
144 |
+
|
145 |
+
if(strlen($custom_vars_string))
|
146 |
+
$custom_vars_string .= '&embeddingCustomVars=true';
|
147 |
+
|
148 |
+
return $custom_vars_string;
|
149 |
+
}
|
150 |
+
}
|
public/class-captainform-public-form-embedding.php
ADDED
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fired when a form is displayed
|
4 |
+
*
|
5 |
+
* @link http://captainform.com
|
6 |
+
* @since 2.0.0
|
7 |
+
*
|
8 |
+
* @package Captainform
|
9 |
+
* @subpackage Captainform/public
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The class that displays the forms
|
14 |
+
*
|
15 |
+
* @package Captainform
|
16 |
+
* @subpackage Captainform/public
|
17 |
+
* @author captainform <team@captainform.com>
|
18 |
+
*/
|
19 |
+
class Captainform_FormEmbedding
|
20 |
+
{
|
21 |
+
|
22 |
+
/**
|
23 |
+
* The ID of this plugin.
|
24 |
+
*
|
25 |
+
* @since 2.0.0
|
26 |
+
* @access private
|
27 |
+
* @var string $plugin_name The ID of this plugin.
|
28 |
+
*/
|
29 |
+
private $plugin_name;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The version of this plugin.
|
33 |
+
*
|
34 |
+
* @since 2.0.0
|
35 |
+
* @access private
|
36 |
+
* @var string $version The current version of this plugin.
|
37 |
+
*/
|
38 |
+
private $version;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The form options.
|
42 |
+
*
|
43 |
+
* @since 2.0.0
|
44 |
+
* @access private
|
45 |
+
* @var array $version An array containing all the form options.
|
46 |
+
*/
|
47 |
+
private $shortcodeOptions;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The embedding options to be replaced in the form resources scripts.
|
51 |
+
*
|
52 |
+
* @since 2.0.0
|
53 |
+
* @access private
|
54 |
+
* @var array $version An array containing all the embedding options.
|
55 |
+
*/
|
56 |
+
private $embeddingOptions;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* An instance of the class that loads the scripts needed to display the form
|
60 |
+
*
|
61 |
+
* @since 2.0.0
|
62 |
+
* @access private
|
63 |
+
* @var Captainform_FormResourceLoader $resourceLoader
|
64 |
+
*/
|
65 |
+
private $resourceLoader;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Initialize the class and set its properties.
|
69 |
+
*
|
70 |
+
* @since 2.0.0
|
71 |
+
*
|
72 |
+
* @param array $options The form options extracted from the shortcode.
|
73 |
+
* @param string $plugin_name The name of the plugin.
|
74 |
+
* @param string $version The version of this plugin.
|
75 |
+
*/
|
76 |
+
public function __construct($options, $plugin_name, $version)
|
77 |
+
{
|
78 |
+
|
79 |
+
$this->shortcodeOptions = $options;
|
80 |
+
$this->plugin_name = $plugin_name;
|
81 |
+
$this->version = $version;
|
82 |
+
$this->resourceLoader = new Captainform_FormResourceLoader(array(), $this->version);
|
83 |
+
|
84 |
+
if ($this->is_theme_preview())
|
85 |
+
$this->enqueue_theme_preview_scripts();
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Checks whether we are previewing a theme or not
|
90 |
+
*
|
91 |
+
* @since 2.0.0
|
92 |
+
* @access private
|
93 |
+
* @return bool
|
94 |
+
*/
|
95 |
+
private function is_theme_preview()
|
96 |
+
{
|
97 |
+
return isset($_GET['captainform_theme_style']);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Register the JavaScript for the public-facing side of the site when we are in theme preview.
|
102 |
+
*
|
103 |
+
* @since 2.0.0
|
104 |
+
* @access private
|
105 |
+
*/
|
106 |
+
private function enqueue_theme_preview_scripts()
|
107 |
+
{
|
108 |
+
|
109 |
+
wp_enqueue_script('captainform_iframe_resizer_win', plugin_dir_url(__FILE__) . '../admin/js/iframeResizer.contentWindow.min.js', array(), '3.5', false);
|
110 |
+
wp_enqueue_script('nolink', plugin_dir_url(__FILE__) . '../admin/js/nolink.js', array(), $this->version, false);
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function run()
|
118 |
+
{
|
119 |
+
$this->set_form_id();
|
120 |
+
|
121 |
+
if ($this->is_preview_mode())
|
122 |
+
return $this->show_preview_message();
|
123 |
+
|
124 |
+
return $this->display_form();
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Sets the real ID for the form that is being displayed
|
129 |
+
*
|
130 |
+
* @since 2.0.0
|
131 |
+
* @access private
|
132 |
+
*/
|
133 |
+
private function set_form_id()
|
134 |
+
{
|
135 |
+
$form_id = 0;
|
136 |
+
if (isset($this->shortcodeOptions['id'])) {
|
137 |
+
if (is_numeric($this->shortcodeOptions['id']))
|
138 |
+
$form_id = intval($this->shortcodeOptions['id']);
|
139 |
+
elseif ($this->shortcodeOptions['id'] == '{cf_form_id}')
|
140 |
+
if (isset($_GET['cf_form_id']) && intval($_GET['cf_form_id']))
|
141 |
+
$form_id = intval($_GET['cf_form_id']);
|
142 |
+
} elseif (isset($this->shortcodeOptions[0])) {
|
143 |
+
$form_id = intval(trim($this->shortcodeOptions[0], 'i'));
|
144 |
+
unset($this->shortcodeOptions[0]);
|
145 |
+
}
|
146 |
+
|
147 |
+
$this->shortcodeOptions['id'] = $form_id;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Checks whether we are in preview mode or not.
|
152 |
+
* @since 2.0.0
|
153 |
+
* @access private
|
154 |
+
* @return bool
|
155 |
+
*/
|
156 |
+
private function is_preview_mode()
|
157 |
+
{
|
158 |
+
return
|
159 |
+
isset($_GET['cf_form_id']) &&
|
160 |
+
isset($_GET['captainform_theme_style']) &&
|
161 |
+
intval($_GET['cf_form_id']) &&
|
162 |
+
is_numeric($this->shortcodeOptions['id']) &&
|
163 |
+
intval($_GET['cf_form_id']) !== intval($this->shortcodeOptions['id']);
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Shows the message that is displayed instead of the other forms on the page during form preview.
|
168 |
+
*
|
169 |
+
* @since 2.0.0
|
170 |
+
* @access private
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
private function show_preview_message()
|
174 |
+
{
|
175 |
+
return 'Form hidden in preview mode.';
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
*
|
180 |
+
* @since 2.0.0
|
181 |
+
* @access private
|
182 |
+
* @return string
|
183 |
+
*/
|
184 |
+
private function display_form()
|
185 |
+
{
|
186 |
+
if (!$this->shortcodeOptions['id'])
|
187 |
+
return '';
|
188 |
+
|
189 |
+
$embedding_type = $this->get_embedding_type();
|
190 |
+
$this->set_embedding_options($embedding_type);
|
191 |
+
|
192 |
+
return $this->resourceLoader->run($embedding_type, $this->embeddingOptions);
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Gets the embedding type.
|
197 |
+
*
|
198 |
+
* @since 2.0.0
|
199 |
+
* @access private
|
200 |
+
* @return mixed|string
|
201 |
+
*/
|
202 |
+
private function get_embedding_type()
|
203 |
+
{
|
204 |
+
if (isset($this->shortcodeOptions['lightbox']) && $this->shortcodeOptions['lightbox'] == 1)
|
205 |
+
if ($this->is_preview_as_popup())
|
206 |
+
return 'auto-popup';
|
207 |
+
elseif (isset($this->shortcodeOptions['type']))
|
208 |
+
return $this->shortcodeOptions['type'];
|
209 |
+
|
210 |
+
return 'normal_embedding';
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Checks whether we are previewing the form as a popup or not.
|
215 |
+
*
|
216 |
+
* @since 2.0.0
|
217 |
+
* @access private
|
218 |
+
* @return bool
|
219 |
+
*/
|
220 |
+
private function is_preview_as_popup()
|
221 |
+
{
|
222 |
+
return isset($_GET['captainform_preview_as_lightbox']);
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Sets all the embedding options based on the options from the shortcode
|
227 |
+
*
|
228 |
+
* @since 2.0.0
|
229 |
+
* @access private
|
230 |
+
* @param $embedding_type
|
231 |
+
*/
|
232 |
+
private function set_embedding_options($embedding_type)
|
233 |
+
{
|
234 |
+
$custom_vars = new Captainform_FormCustomVars($this->shortcodeOptions);
|
235 |
+
$this->embeddingOptions = array(
|
236 |
+
'id' => $this->shortcodeOptions['id'],
|
237 |
+
'content' => 'Contact Us',
|
238 |
+
'miliseconds' => $this->is_preview_as_popup() ? 1000 : 3000,
|
239 |
+
'customVars' => $custom_vars->get_custom_vars(),
|
240 |
+
'style' => $this->get_theme_preview_style(),
|
241 |
+
'lightbox_type' => '',
|
242 |
+
'position_class' => '',
|
243 |
+
);
|
244 |
+
|
245 |
+
if (isset($this->shortcodeOptions['lightbox']) && $this->shortcodeOptions['lightbox'] == 1) {
|
246 |
+
if (isset($this->shortcodeOptions['text_content']) && strlen(trim($this->shortcodeOptions['text_content'])))
|
247 |
+
$this->embeddingOptions['content'] = urldecode($this->shortcodeOptions['text_content']);
|
248 |
+
elseif (isset($this->shortcodeOptions['content']) && strlen(trim($this->shortcodeOptions['content'])))
|
249 |
+
$this->embeddingOptions['content'] = urldecode($this->shortcodeOptions['content']);
|
250 |
+
}
|
251 |
+
|
252 |
+
switch ($embedding_type) {
|
253 |
+
case 'text':
|
254 |
+
break;
|
255 |
+
case 'image':
|
256 |
+
if (isset($this->shortcodeOptions['url']) && strlen(trim($this->shortcodeOptions['url']))) {
|
257 |
+
$this->embeddingOptions['content'] = '<img border="0" src="' . $this->shortcodeOptions['url'] . '" />';
|
258 |
+
}
|
259 |
+
$this->embeddingOptions['lightbox_type'] = 'image';
|
260 |
+
break;
|
261 |
+
case 'floating-button':
|
262 |
+
$this->embeddingOptions['position'] = 1;
|
263 |
+
$this->embeddingOptions['position_class'] = 'default';
|
264 |
+
if (isset($this->shortcodeOptions['position'])) {
|
265 |
+
if ($this->shortcodeOptions['position'] == 'right') {
|
266 |
+
$this->embeddingOptions['position'] = 2;
|
267 |
+
$this->embeddingOptions['position_class'] = 'right';
|
268 |
+
} elseif ($this->shortcodeOptions['position'] == 'left') {
|
269 |
+
$this->embeddingOptions['position'] = 1;
|
270 |
+
$this->embeddingOptions['position_class'] = 'left';
|
271 |
+
} elseif ($this->shortcodeOptions['position'] == 'bottom') {
|
272 |
+
$this->embeddingOptions['position'] = 3;
|
273 |
+
$this->embeddingOptions['position_class'] = 'bottom';
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
$this->embeddingOptions['text_color'] = isset($this->shortcodeOptions['text_color']) ? $this->shortcodeOptions['text_color'] : '';
|
278 |
+
$this->embeddingOptions['bg_color'] = isset($this->shortcodeOptions['bg_color']) ? $this->shortcodeOptions['bg_color'] : '';
|
279 |
+
$this->embeddingOptions['lightbox_type'] = 'floating';
|
280 |
+
break;
|
281 |
+
case 'auto-popup':
|
282 |
+
if (isset($this->shortcodeOptions['miliseconds']))
|
283 |
+
$this->embeddingOptions['miliseconds'] = intval($this->shortcodeOptions['miliseconds']);
|
284 |
+
break;
|
285 |
+
default:
|
286 |
+
break;
|
287 |
+
}
|
288 |
+
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* This method returns the style that is sent via URL during theme preview.
|
293 |
+
*
|
294 |
+
* @since 2.0.0
|
295 |
+
* @access private
|
296 |
+
* @return string
|
297 |
+
*/
|
298 |
+
private function get_theme_preview_style()
|
299 |
+
{
|
300 |
+
return isset($_GET['captainform_theme_style']) ? '&style=' . $_GET['captainform_theme_style'] : '';
|
301 |
+
}
|
302 |
+
}
|
public/class-captainform-public-form-resource-loader.php
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired when a form is displayed
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/public
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The form resource loader class
|
15 |
+
*
|
16 |
+
* Loads the resources for all the embedding types.
|
17 |
+
*
|
18 |
+
* @package Captainform
|
19 |
+
* @subpackage Captainform/public
|
20 |
+
* @author captainform <team@captainform.com>
|
21 |
+
*/
|
22 |
+
class Captainform_FormResourceLoader {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The version of this plugin.
|
26 |
+
*
|
27 |
+
* @since 2.0.0
|
28 |
+
* @access private
|
29 |
+
* @var string $version The current version of this plugin.
|
30 |
+
*/
|
31 |
+
private $version;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The form options.
|
35 |
+
*
|
36 |
+
* @since 2.0.0
|
37 |
+
* @access private
|
38 |
+
* @var array $version An array containing all the form options.
|
39 |
+
*/
|
40 |
+
private $options;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Initialize the class and set its properties.
|
44 |
+
*
|
45 |
+
* @since 2.0.0
|
46 |
+
* @param array $options The form options extracted from the shortcode.
|
47 |
+
* @param $version
|
48 |
+
*/
|
49 |
+
public function __construct( array $options = array(), $version ) {
|
50 |
+
|
51 |
+
$this->version = $version;
|
52 |
+
|
53 |
+
$this->options = array_merge(
|
54 |
+
array(
|
55 |
+
'captainform_servicedomain' => 'app.captainform.com',
|
56 |
+
'captainform_plugin_dir' => plugin_dir_url(dirname(__FILE__)),
|
57 |
+
'embedding_type' => '',
|
58 |
+
),
|
59 |
+
$options
|
60 |
+
);
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Replace data into scripts that have variables.
|
66 |
+
*
|
67 |
+
* @since 2.0.0
|
68 |
+
* @access private
|
69 |
+
* @param string $string
|
70 |
+
* @param array $data associate array - key is pattern, value is string for replace pattern
|
71 |
+
* @return string
|
72 |
+
**/
|
73 |
+
private function replace_data_in_scripts($string, $data = null) {
|
74 |
+
if ($data)
|
75 |
+
if (is_array($data)) {
|
76 |
+
foreach ($data as $k => $v)
|
77 |
+
if ($k)
|
78 |
+
$string = str_replace('{{' . strtoupper($k) . '}}', $v, $string);
|
79 |
+
}
|
80 |
+
return $string;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Loads the files that contains the embedding scripts.
|
85 |
+
*
|
86 |
+
* @since 2.0.0
|
87 |
+
* @access private
|
88 |
+
* @param string $resource resource file
|
89 |
+
* @return string
|
90 |
+
**/
|
91 |
+
function load_form_resource($resource) {
|
92 |
+
$this->enqueue_public_styles();
|
93 |
+
if (count($this->options))
|
94 |
+
foreach ($this->options as $key => $val)
|
95 |
+
$$key = $val;
|
96 |
+
|
97 |
+
ob_start();
|
98 |
+
include 'partials/form-resources/captainform-' . $resource . '.php';
|
99 |
+
return ob_get_clean();
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Adds the scripts and the styles for the popup.
|
104 |
+
*
|
105 |
+
* @since 2.0.0
|
106 |
+
* @access private
|
107 |
+
*/
|
108 |
+
private function add_tinybox_resources() {
|
109 |
+
$this->enqueue_popup_scripts();
|
110 |
+
$this->enqueue_popup_styles();
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Returns the global variables for the form scripts.
|
115 |
+
*
|
116 |
+
* @since 2.0.0
|
117 |
+
* @access private
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
private function load_captainform_global_vars() {
|
121 |
+
return $this->load_form_resource('global-vars');
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Returns the scripts for the normal embedding.
|
126 |
+
*
|
127 |
+
* @since 2.0.0
|
128 |
+
* @access private
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
private function load_normal_embedding_resources() {
|
132 |
+
return
|
133 |
+
$this->load_captainform_global_vars() .
|
134 |
+
$this->load_form_resource('normal-embedding');
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Returns the scripts for the popup embedding.
|
139 |
+
*
|
140 |
+
* @since 2.0.0
|
141 |
+
* @access private
|
142 |
+
*
|
143 |
+
* @param string $popupType
|
144 |
+
*
|
145 |
+
* @return string
|
146 |
+
*/
|
147 |
+
private function load_popup_embedding_resources($popupType = '') {
|
148 |
+
if(!empty($popupType))
|
149 |
+
$popupType .= '-';
|
150 |
+
|
151 |
+
$this->add_tinybox_resources();
|
152 |
+
|
153 |
+
return
|
154 |
+
$this->load_captainform_global_vars() .
|
155 |
+
$this->load_form_resource('lightbox-' . $popupType . 'embedding');
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Returns the required embedding scripts based on the embedding type.
|
160 |
+
*
|
161 |
+
* @since 2.0.0
|
162 |
+
* @access private
|
163 |
+
* @param $embedding_type
|
164 |
+
* @return string
|
165 |
+
*/
|
166 |
+
private function get_form_resources($embedding_type){
|
167 |
+
switch($embedding_type){
|
168 |
+
case 'normal_embedding':
|
169 |
+
return $this->load_normal_embedding_resources();
|
170 |
+
break;
|
171 |
+
case 'text':
|
172 |
+
case 'image':
|
173 |
+
case 'floating-button':
|
174 |
+
return $this->load_popup_embedding_resources();
|
175 |
+
break;
|
176 |
+
case 'auto-popup':
|
177 |
+
return $this->load_popup_embedding_resources('auto');
|
178 |
+
case 'window-leave':
|
179 |
+
return $this->load_popup_embedding_resources('window-leave');
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Register the styles for the public-facing side of the site.
|
185 |
+
*
|
186 |
+
* @since 2.1.3
|
187 |
+
* @access private
|
188 |
+
*/
|
189 |
+
private function enqueue_public_styles(){
|
190 |
+
wp_enqueue_style( 'captainform_public_css', plugin_dir_url( __FILE__ ) . 'css/captainform-public.css', array(), $this->version, 'all' );
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Register the stylesheets for the public-facing side of the site.
|
195 |
+
*
|
196 |
+
* @since 2.0.0
|
197 |
+
*/
|
198 |
+
public function enqueue_popup_styles() {
|
199 |
+
|
200 |
+
wp_enqueue_style('captainform_form_popup_style', plugin_dir_url( __FILE__ ) . '../admin/css/form_popup.css', array(), $this->version, 'all');
|
201 |
+
if (strpos(getenv("HTTP_USER_AGENT"), "Mac") !== FALSE) {
|
202 |
+
//wp_enqueue_style('captainform_form_popup_style', plugin_dir_url( __FILE__ ) . '../admin/css/wp_captainform_os.css', array(), $this->version, 'all');
|
203 |
+
}
|
204 |
+
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Register the JavaScript for the public-facing side of the site.
|
209 |
+
*
|
210 |
+
* @since 2.0.0
|
211 |
+
*/
|
212 |
+
public function enqueue_popup_scripts() {
|
213 |
+
|
214 |
+
wp_enqueue_script('captainform_form_popup', plugin_dir_url( __FILE__ ) . '../admin/js/captainform-form-popup.js', array('jquery'), $this->version, false);
|
215 |
+
wp_enqueue_script('captainform_ires35', plugin_dir_url( __FILE__ ) . '../admin/js/iframeResizer.min.js', array(), $this->version, false);
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* @since 2.0.0
|
221 |
+
* @param $embedding_type
|
222 |
+
* @param $options
|
223 |
+
* @return string
|
224 |
+
*/
|
225 |
+
public function run($embedding_type, $options) {
|
226 |
+
$this->options['embedding_type'] = $embedding_type;
|
227 |
+
|
228 |
+
return $this->replace_data_in_scripts($this->get_form_resources($embedding_type), $options);
|
229 |
+
}
|
230 |
+
}
|
public/class-captainform-public.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The public-facing functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link http://captainform.com
|
7 |
+
* @since 2.0.0
|
8 |
+
*
|
9 |
+
* @package Captainform
|
10 |
+
* @subpackage Captainform/public
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The public-facing functionality of the plugin.
|
15 |
+
*
|
16 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
17 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package Captainform
|
20 |
+
* @subpackage Captainform/public
|
21 |
+
* @author captainform <team@captainform.com>
|
22 |
+
*/
|
23 |
+
class Captainform_Public {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The ID of this plugin.
|
27 |
+
*
|
28 |
+
* @since 2.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $plugin_name The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private static $plugin_name;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The version of this plugin.
|
36 |
+
*
|
37 |
+
* @since 2.0.0
|
38 |
+
* @access private
|
39 |
+
* @var string $version The current version of this plugin.
|
40 |
+
*/
|
41 |
+
private static $version;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Initialize the class and set its properties.
|
45 |
+
*
|
46 |
+
* @since 2.0.0
|
47 |
+
* @param string $plugin_name The name of the plugin.
|
48 |
+
* @param string $version The version of this plugin.
|
49 |
+
*/
|
50 |
+
public function __construct( $plugin_name, $version ) {
|
51 |
+
|
52 |
+
self::$plugin_name = $plugin_name;
|
53 |
+
self::$version = $version;
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Register the stylesheets for the public-facing side of the site.
|
59 |
+
*
|
60 |
+
* @since 2.0.0
|
61 |
+
*/
|
62 |
+
public function enqueue_styles() {
|
63 |
+
//We moved this in FORM-RESOURCES-LOADER so it's loaded only if we have a form on the page
|
64 |
+
//wp_enqueue_style( 'captainform_public_css', plugin_dir_url( __FILE__ ) . 'css/captainform-public.css', array(), self::$version, 'all' );
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Register the JavaScript for the public-facing side of the site.
|
70 |
+
*
|
71 |
+
* @since 2.0.0
|
72 |
+
*/
|
73 |
+
public function enqueue_scripts() {
|
74 |
+
|
75 |
+
//wp_enqueue_script( 'captainform_public_js', plugin_dir_url( __FILE__ ) . 'js/captainform-public.js', array( 'jquery' ), self::$version, false );
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
includes/css/forge_element.css → public/css/captainform-forge-element.css
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
.forge-builder-collection-icon-captainform {
|
2 |
-
background: url(
|
3 |
background-size: cover;
|
4 |
background-repeat: no-repeat;
|
5 |
}
|
1 |
.forge-builder-collection-icon-captainform {
|
2 |
+
background: url(../../admin/images/captainform-32.png);
|
3 |
background-size: cover;
|
4 |
background-repeat: no-repeat;
|
5 |
}
|
public/css/captainform-public.css
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* All of the CSS for your public-facing functionality should be
|
3 |
+
* included in this file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
.captainform_lightbox {
|
7 |
+
outline: none !important;
|
8 |
+
text-decoration: none;
|
9 |
+
border: none;
|
10 |
+
box-shadow: none !important;
|
11 |
+
}
|
12 |
+
|
13 |
+
.captainform_lightbox img {
|
14 |
+
max-width: 100%;
|
15 |
+
margin: 0 !important;
|
16 |
+
padding: 0 !important;
|
17 |
+
box-shadow: none !important;
|
18 |
+
border: none !important;
|
19 |
+
}
|
20 |
+
|
21 |
+
.captainform_lightbox[floating] {
|
22 |
+
position: fixed;
|
23 |
+
padding: 12px;
|
24 |
+
margin:0;
|
25 |
+
cursor: pointer;
|
26 |
+
line-height: 1em;
|
27 |
+
z-index: 100;
|
28 |
+
-webkit-transition: padding .2s;
|
29 |
+
-o-transition: padding .2s;
|
30 |
+
transition: padding .2s;
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
.captainform_lightbox[image] a,
|
35 |
+
.captainform_lightbox[image] a:hover,
|
36 |
+
.captainform_lightbox[floating] a,
|
37 |
+
.captainform_lightbox[floating] a:hover {
|
38 |
+
text-decoration: none;
|
39 |
+
box-shadow: none;
|
40 |
+
border: none;
|
41 |
+
}
|
42 |
+
|
43 |
+
.captainform_lightbox[floating]:hover {
|
44 |
+
opacity: .93;
|
45 |
+
}
|
46 |
+
|
47 |
+
.captainform_lightbox[floating].default {
|
48 |
+
left: 0;
|
49 |
+
top: 0;
|
50 |
+
bottom: 0;
|
51 |
+
}
|
52 |
+
|
53 |
+
.captainform_lightbox[floating].left,
|
54 |
+
.captainform_lightbox[floating].right {
|
55 |
+
-moz-transform: rotate(-90deg);
|
56 |
+
-webkit-transform: rotate(-90deg);
|
57 |
+
-o-transform: rotate(-90deg);
|
58 |
+
-ms-transform: rotate(-90deg);
|
59 |
+
transform: rotate(-90deg);
|
60 |
+
}
|
61 |
+
|
62 |
+
.captainform_lightbox[floating].left {
|
63 |
+
left: 0;
|
64 |
+
top: 40%;
|
65 |
+
border-radius: 0 0 4px 4px;
|
66 |
+
-moz-transform-origin: top left;
|
67 |
+
-webkit-transform-origin: top left;
|
68 |
+
-o-transform-origin: top left;
|
69 |
+
transform-origin: top left;
|
70 |
+
}
|
71 |
+
|
72 |
+
.captainform_lightbox[floating].left:hover {
|
73 |
+
/*padding-top: 16px;*/
|
74 |
+
}
|
75 |
+
|
76 |
+
.captainform_lightbox[floating].right {
|
77 |
+
right: 0;
|
78 |
+
top: 40%;
|
79 |
+
border-radius: 4px 4px 0 0;
|
80 |
+
-moz-transform-origin: bottom right;
|
81 |
+
-webkit-transform-origin: bottom right;
|
82 |
+
-o-transform-origin: bottom right;
|
83 |
+
transform-origin: bottom right;
|
84 |
+
}
|
85 |
+
|
86 |
+
.captainform_lightbox[floating].right:hover {
|
87 |
+
/* TODO: Fix right button animation */
|
88 |
+
/*padding-bottom: 16px;*/
|
89 |
+
}
|
90 |
+
|
91 |
+
.captainform_lightbox[floating].bottom {
|
92 |
+
width: auto;
|
93 |
+
right: 20%;
|
94 |
+
bottom: 0;
|
95 |
+
border-radius: 4px 4px 0 0;
|
96 |
+
}
|
97 |
+
|
98 |
+
.captainform_lightbox[floating].bottom:hover {
|
99 |
+
/*padding-bottom: 16px;*/
|
100 |
+
}
|
{includes → public}/images/loader_350.gif
RENAMED
File without changes
|
{includes → public}/images/ppform_preloader.gif
RENAMED
File without changes
|
{includes → public}/images/publish_lighbox_default_image_v2.png
RENAMED
File without changes
|
public/images/ring.svg
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?><svg width='70px' height='70px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-ring"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><defs><filter id="uil-ring-shadow" x="-100%" y="-100%" width="300%" height="300%"><feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset><feGaussianBlur result="blurOut" in="offOut" stdDeviation="0"></feGaussianBlur><feBlend in="SourceGraphic" in2="blurOut" mode="normal"></feBlend></filter></defs><path d="M10,50c0,0,0,0.5,0.1,1.4c0,0.5,0.1,1,0.2,1.7c0,0.3,0.1,0.7,0.1,1.1c0.1,0.4,0.1,0.8,0.2,1.2c0.2,0.8,0.3,1.8,0.5,2.8 c0.3,1,0.6,2.1,0.9,3.2c0.3,1.1,0.9,2.3,1.4,3.5c0.5,1.2,1.2,2.4,1.8,3.7c0.3,0.6,0.8,1.2,1.2,1.9c0.4,0.6,0.8,1.3,1.3,1.9 c1,1.2,1.9,2.6,3.1,3.7c2.2,2.5,5,4.7,7.9,6.7c3,2,6.5,3.4,10.1,4.6c3.6,1.1,7.5,1.5,11.2,1.6c4-0.1,7.7-0.6,11.3-1.6 c3.6-1.2,7-2.6,10-4.6c3-2,5.8-4.2,7.9-6.7c1.2-1.2,2.1-2.5,3.1-3.7c0.5-0.6,0.9-1.3,1.3-1.9c0.4-0.6,0.8-1.3,1.2-1.9 c0.6-1.3,1.3-2.5,1.8-3.7c0.5-1.2,1-2.4,1.4-3.5c0.3-1.1,0.6-2.2,0.9-3.2c0.2-1,0.4-1.9,0.5-2.8c0.1-0.4,0.1-0.8,0.2-1.2 c0-0.4,0.1-0.7,0.1-1.1c0.1-0.7,0.1-1.2,0.2-1.7C90,50.5,90,50,90,50s0,0.5,0,1.4c0,0.5,0,1,0,1.7c0,0.3,0,0.7,0,1.1 c0,0.4-0.1,0.8-0.1,1.2c-0.1,0.9-0.2,1.8-0.4,2.8c-0.2,1-0.5,2.1-0.7,3.3c-0.3,1.2-0.8,2.4-1.2,3.7c-0.2,0.7-0.5,1.3-0.8,1.9 c-0.3,0.7-0.6,1.3-0.9,2c-0.3,0.7-0.7,1.3-1.1,2c-0.4,0.7-0.7,1.4-1.2,2c-1,1.3-1.9,2.7-3.1,4c-2.2,2.7-5,5-8.1,7.1 c-0.8,0.5-1.6,1-2.4,1.5c-0.8,0.5-1.7,0.9-2.6,1.3L66,87.7l-1.4,0.5c-0.9,0.3-1.8,0.7-2.8,1c-3.8,1.1-7.9,1.7-11.8,1.8L47,90.8 c-1,0-2-0.2-3-0.3l-1.5-0.2l-0.7-0.1L41.1,90c-1-0.3-1.9-0.5-2.9-0.7c-0.9-0.3-1.9-0.7-2.8-1L34,87.7l-1.3-0.6 c-0.9-0.4-1.8-0.8-2.6-1.3c-0.8-0.5-1.6-1-2.4-1.5c-3.1-2.1-5.9-4.5-8.1-7.1c-1.2-1.2-2.1-2.7-3.1-4c-0.5-0.6-0.8-1.4-1.2-2 c-0.4-0.7-0.8-1.3-1.1-2c-0.3-0.7-0.6-1.3-0.9-2c-0.3-0.7-0.6-1.3-0.8-1.9c-0.4-1.3-0.9-2.5-1.2-3.7c-0.3-1.2-0.5-2.3-0.7-3.3 c-0.2-1-0.3-2-0.4-2.8c-0.1-0.4-0.1-0.8-0.1-1.2c0-0.4,0-0.7,0-1.1c0-0.7,0-1.2,0-1.7C10,50.5,10,50,10,50z" fill="#FFF" filter="url(#uil-ring-shadow)"><animateTransform attributeName="transform" type="rotate" from="0 50 50" to="360 50 50" repeatCount="indefinite" dur="1s"></animateTransform></path></svg>
|
public/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
public/js/captainform-public.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* All of the code for your public-facing JavaScript source
|
6 |
+
* should reside in this file.
|
7 |
+
*
|
8 |
+
* Note: It has been assumed you will write jQuery code here, so the
|
9 |
+
* $ function reference has been prepared for usage within the scope
|
10 |
+
* of this function.
|
11 |
+
*
|
12 |
+
* This enables you to define handlers, for when the DOM is ready:
|
13 |
+
*
|
14 |
+
* $(function() {
|
15 |
+
*
|
16 |
+
* });
|
17 |
+
*
|
18 |
+
* When the window is loaded:
|
19 |
+
*
|
20 |
+
* $( window ).load(function() {
|
21 |
+
*
|
22 |
+
* });
|
23 |
+
*
|
24 |
+
* ...and/or other possibilities.
|
25 |
+
*
|
26 |
+
* Ideally, it is not considered best practise to attach more than a
|
27 |
+
* single DOM-ready or window-load handler for a particular page.
|
28 |
+
* Although scripts in the WordPress core, Plugins and Themes may be
|
29 |
+
* practising this, we should strive to set a better example in our own work.
|
30 |
+
*/
|
31 |
+
|
32 |
+
})( jQuery );
|
public/partials/captainform-public-display.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Provide a public-facing view for the plugin
|
5 |
+
*
|
6 |
+
* This file is used to markup the public-facing aspects of the plugin.
|
7 |
+
*
|
8 |
+
* @link http://captainform.com
|
9 |
+
* @since 2.0.0
|
10 |
+
*
|
11 |
+
* @package Captainform
|
12 |
+
* @subpackage Captainform/public/partials
|
13 |
+
*/
|
14 |
+
?>
|
15 |
+
|
16 |
+
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
public/partials/form-resources/captainform-global-vars.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--noptimize--><script type="text/javascript">
|
2 |
+
var captainformCustomVars = {};
|
3 |
+
var captainformThemeStyle = {};
|
4 |
+
var append_element = append_element || function(e){if(void 0==e)return!1;if(!("elementType"in e))return!1;var n=null;if(n=e.following?e.following.parentElement:e.inside?e.inside:e.replacing?e.replacing.parentElement:"script"==e.elementType?document.head:document.body,null==n)return!1;var l=document.createElement(e.elementType);delete e.elementType,l=jQuery.extend(l,e),e.replacing?n.replaceChild(l,e.replacing):n.appendChild(l)};
|
5 |
+
var captainformDomReady = captainformDomReady || function(e){var t=!1,n=function(){document.addEventListener?(document.removeEventListener("DOMContentLoaded",d),window.removeEventListener("load",d)):(document.detachEvent("onreadystatechange",d),window.detachEvent("onload",d))},d=function(){t||!document.addEventListener&&"load"!==event.type&&"complete"!==document.readyState||(t=!0,n(),e())};if("complete"===document.readyState)e();else if(document.addEventListener)document.addEventListener("DOMContentLoaded",d),window.addEventListener("load",d);else{document.attachEvent("onreadystatechange",d),window.attachEvent("onload",d);var o=!1;try{o=null==window.frameElement&&document.documentElement}catch(a){}o&&o.doScroll&&!function c(){if(!t){try{o.doScroll("left")}catch(d){return setTimeout(c,50)}t=!0,n(),e()}}()}};
|
6 |
+
var readyStateOverflowInterval;
|
7 |
+
captainformDomReady(function() {
|
8 |
+
if (document.getElementById('captainform_js_global_vars') == null) {
|
9 |
+
append_element({
|
10 |
+
elementType: "script",
|
11 |
+
type: "text/javascript",
|
12 |
+
id: "captainform_js_global_vars",
|
13 |
+
textContent: 'var frmRef=""; try { frmRef=window.top.location.href; } catch(err) {}; var captainform_servicedomain="<?php echo $captainform_servicedomain;?>";var cfJsHost = "https://";',
|
14 |
+
});
|
15 |
+
}
|
16 |
+
<?php if($embedding_type == 'normal_embedding'): ?>
|
17 |
+
try {
|
18 |
+
clearInterval(readyStateOverflowInterval);
|
19 |
+
}
|
20 |
+
catch(e) {
|
21 |
+
console.warn('[CaptainForm] Clear readyStateOverflowInterval error');
|
22 |
+
}
|
23 |
+
readyStateOverflowInterval = setInterval(function () {
|
24 |
+
try {
|
25 |
+
var elements = ['html', 'body'];
|
26 |
+
var foundElementWithOverflowHidden = false;
|
27 |
+
jQuery(elements).each(function (index, element) {
|
28 |
+
if (jQuery(element).css('overflow-y') == 'hidden') {
|
29 |
+
foundElementWithOverflowHidden = true;
|
30 |
+
if(jQuery(element).height() > jQuery('window').height()){
|
31 |
+
jQuery(window).resize();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
if(!foundElementWithOverflowHidden) {
|
35 |
+
clearInterval(readyStateOverflowInterval);
|
36 |
+
}
|
37 |
+
});
|
38 |
+
}
|
39 |
+
catch (e) {
|
40 |
+
console.warn('[CaptainForm] Overflow check error');
|
41 |
+
}
|
42 |
+
}, 300);
|
43 |
+
<?php endif; ?>
|
44 |
+
});
|
45 |
+
</script><!--/noptimize-->
|
public/partials/form-resources/captainform-lightbox-auto-embedding.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $unique = uniqid(); ?><!--noptimize--><script type="text/javascript">
|
2 |
+
captainForm{{ID}}PreloadInterval<?php echo $unique?> = setInterval(function(){
|
3 |
+
if(typeof cfJsHost != 'undefined'){
|
4 |
+
captainformCustomVars['{{ID}}'] = '{{CUSTOMVARS}}';
|
5 |
+
captainformThemeStyle['{{ID}}'] = '{{STYLE}}';
|
6 |
+
var popupParams = {
|
7 |
+
formId: '{{ID}}'
|
8 |
+
};
|
9 |
+
if(parseInt('{{MILISECONDS}}') >= 3000) {
|
10 |
+
setTimeout(function () {
|
11 |
+
captainform_preload_form_popup(popupParams);
|
12 |
+
}, parseInt('{{MILISECONDS}}') - 2000);
|
13 |
+
}
|
14 |
+
clearInterval(captainForm{{ID}}PreloadInterval<?php echo $unique?>);
|
15 |
+
setTimeout(function(){
|
16 |
+
if (typeof captainform_create_form_popup == 'function')
|
17 |
+
captainform_create_form_popup(popupParams);
|
18 |
+
}, parseInt('{{MILISECONDS}}'));
|
19 |
+
}
|
20 |
+
}, 10);
|
21 |
+
</script><!--/noptimize-->
|
public/partials/form-resources/captainform-lightbox-embedding.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $unique = uniqid(); ?><!--noptimize--><script type="text/javascript">
|
2 |
+
captainForm{{ID}}PreloadInterval<?php echo $unique?> = setInterval(function(){
|
3 |
+
if(typeof cfJsHost != 'undefined'){
|
4 |
+
captainformCustomVars['{{ID}}'] = '{{CUSTOMVARS}}';
|
5 |
+
captainformThemeStyle['{{ID}}'] = '{{STYLE}}';
|
6 |
+
var popupParams = {
|
7 |
+
formId: '{{ID}}'
|
8 |
+
};
|
9 |
+
captainform_preload_form_popup(popupParams);
|
10 |
+
clearInterval(captainForm{{ID}}PreloadInterval<?php echo $unique?>);
|
11 |
+
var popupTrigger = jQuery("#captainformForm{{ID}}EmbedPopup<?php echo $unique?>");
|
12 |
+
popupTrigger.css('visibility', 'visible');
|
13 |
+
popupTrigger.click(function(){
|
14 |
+
captainform_create_form_popup(popupParams);
|
15 |
+
});
|
16 |
+
}
|
17 |
+
}, 10);
|
18 |
+
</script><!--/noptimize--><span {{LIGHTBOX_TYPE}} id='captainformForm{{ID}}EmbedPopup<?php echo $unique?>' class="captainform_lightbox {{POSITION_CLASS}}" style="visibility:hidden; background-color: #{{BG_COLOR}};"><span id='captainformForm{{ID}}EmbedPopupContent<?php echo $unique?>' class="floating-button-content"><a style="color:#{{TEXT_COLOR}}" href="javascript:">{{CONTENT}}</a></span></span><!--noptimize--><script type="text/javascript">
|
19 |
+
function resize{{ID}}<?php echo $unique?>(wrapper){
|
20 |
+
if ('{{POSITION_CLASS}}' == 'left')
|
21 |
+
jQuery(wrapper).css('top', jQuery(window).height() * 0.4 + wrapper.width() + wrapper.css('padding').replace('px', '') * 2);
|
22 |
+
else if ('{{POSITION_CLASS}}' == 'right')
|
23 |
+
jQuery(wrapper).css('top', jQuery(window).height() * 0.4 - wrapper.outerHeight());
|
24 |
+
}
|
25 |
+
if('{{LIGHTBOX_TYPE}}' == 'floating') {
|
26 |
+
setTimeout(function () {
|
27 |
+
var wrapper = jQuery('#captainformForm{{ID}}EmbedPopup<?php echo $unique?>');
|
28 |
+
resize{{ID}}<?php echo $unique?>(wrapper);
|
29 |
+
jQuery(wrapper).find('a').removeAttr('href');
|
30 |
+
}, 50);
|
31 |
+
}
|
32 |
+
window.addEventListener('resize', function(){
|
33 |
+
var wrapper = jQuery('#captainformForm{{ID}}EmbedPopup<?php echo $unique?>');
|
34 |
+
resize{{ID}}<?php echo $unique?>(wrapper);
|
35 |
+
}, true);
|
36 |
+
</script><!--/noptimize-->
|
public/partials/form-resources/captainform-lightbox-window-leave-embedding.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $unique = uniqid(); ?><!--noptimize--><script type="text/javascript">
|
2 |
+
var captainform{{ID}}TriggerDelay = 500;
|
3 |
+
var form{{ID}}Triggered = false;
|
4 |
+
setTimeout(function(){
|
5 |
+
captainForm{{ID}}WindowLeavePreloadInterval<?php echo $unique?> = setInterval(function() {
|
6 |
+
if(typeof cfJsHost != 'undefined') {
|
7 |
+
captainformCustomVars['{{ID}}'] = '{{CUSTOMVARS}}';
|
8 |
+
captainformThemeStyle['{{ID}}'] = '{{STYLE}}';
|
9 |
+
var popupParams = {
|
10 |
+
formId: '{{ID}}'
|
11 |
+
};
|
12 |
+
captainform_preload_form_popup(popupParams);
|
13 |
+
jQuery(document).mouseleave(function () {
|
14 |
+
if(!form{{ID}}Triggered && (jQuery('#captainform_popup_form').is(':visible') === false || jQuery('#captainform_popup_form').hasClass('popup-hidden'))){
|
15 |
+
captainform_create_form_popup(popupParams);
|
16 |
+
form{{ID}}Triggered = true;
|
17 |
+
}
|
18 |
+
});
|
19 |
+
clearInterval(captainForm{{ID}}WindowLeavePreloadInterval<?php echo $unique?>);
|
20 |
+
}
|
21 |
+
}, 10);
|
22 |
+
}, captainform{{ID}}TriggerDelay || 1);
|
23 |
+
</script><!--/noptimize-->
|
includes/form-resources/normal-embedding.php → public/partials/form-resources/captainform-normal-embedding.php
RENAMED
@@ -1,9 +1,8 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
captainformDomReady(function(){
|
5 |
-
if(document.getElementById('captainform_easyxdmjs') == null)
|
6 |
-
{
|
7 |
append_element({
|
8 |
elementType: "script",
|
9 |
type: "text/javascript",
|
@@ -11,8 +10,7 @@
|
|
11 |
src: cfJsHost + captainform_servicedomain + "/includes/easyXDM.min.js",
|
12 |
});
|
13 |
}
|
14 |
-
if(document.getElementById('iframeresizer_embedding_system') == null)
|
15 |
-
{
|
16 |
append_element({
|
17 |
elementType: "script",
|
18 |
type: "text/javascript",
|
@@ -24,8 +22,9 @@
|
|
24 |
elementType: "script",
|
25 |
type: "text/javascript",
|
26 |
id: "jsform-{{ID}}",
|
27 |
-
src: cfJsHost + captainform_servicedomain + "/jsform-{{ID}}.js?" +
|
28 |
replacing: document.getElementById("{{ID}}"),
|
29 |
});
|
30 |
});
|
31 |
-
</script
|
|
1 |
+
<!--noptimize--><script type="text/javascript">
|
2 |
+
captainformCustomVars['{{ID}}'] = '{{CUSTOMVARS}}';
|
3 |
+
captainformThemeStyle['{{ID}}'] = '{{STYLE}}';
|
4 |
+
captainformDomReady(function () {
|
5 |
+
if (document.getElementById('captainform_easyxdmjs') == null) {
|
|
|
6 |
append_element({
|
7 |
elementType: "script",
|
8 |
type: "text/javascript",
|
10 |
src: cfJsHost + captainform_servicedomain + "/includes/easyXDM.min.js",
|
11 |
});
|
12 |
}
|
13 |
+
if (document.getElementById('iframeresizer_embedding_system') == null) {
|
|
|
14 |
append_element({
|
15 |
elementType: "script",
|
16 |
type: "text/javascript",
|
22 |
elementType: "script",
|
23 |
type: "text/javascript",
|
24 |
id: "jsform-{{ID}}",
|
25 |
+
src: cfJsHost + captainform_servicedomain + "/jsform-{{ID}}.js?" + captainformCustomVars['{{ID}}'] + captainformThemeStyle['{{ID}}'],
|
26 |
replacing: document.getElementById("{{ID}}"),
|
27 |
});
|
28 |
});
|
29 |
+
</script><!--/noptimize-->
|
30 |
+
<div id="{{ID}}"></div>
|
readme.txt
CHANGED
@@ -1,217 +1,671 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
Contributors: captainform, 123contactform
|
4 |
-
Tags: CaptainForm, form
|
5 |
-
Requires at least: 3.9
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag:
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
26 |
-
*
|
27 |
-
*
|
28 |
-
*
|
29 |
-
*
|
30 |
-
*
|
31 |
-
*
|
32 |
-
*
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
*
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
[
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
*
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
*
|
103 |
-
|
104 |
-
|
105 |
-
*
|
106 |
-
*
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
=
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
*
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
*
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
*
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
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 |
* Initial release
|
1 |
+
=== Forms by CaptainForm - Form Builder for WordPress ===
|
2 |
+
|
3 |
+
Contributors: captainform, 123contactform
|
4 |
+
Tags: CaptainForm, contact form, drag-and-drop, file upload forms, form builder plugin, newsletter subscription, order form, payment form, paypal form, popup form, registration form, secure forms, survey
|
5 |
+
Requires at least: 3.9
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: trunk
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Drag and drop form builder. Create payment forms, order forms, registration forms and requests, applications, subscriptions, receive uploads and more.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
CaptainForm is a user-friendly form builder plugin that provides advanced functionality in an easy to use, drag and drop interface. The plugin requires no add-ons and all of the features are built-in. The form builder is ideal for building any type of responsive form or survey such as: order forms, payment forms, registration forms, request forms, application forms, job applications, appointment forms, support request forms, contact forms, lead generation forms, quote requests, newsletter subscriptions, feedback surveys, quizzes, user-submitted posts and more.
|
16 |
+
|
17 |
+
[youtube https://www.youtube.com/watch?v=7VqexfhshiA]
|
18 |
+
|
19 |
+
CaptainForm's visual editor offers a friendly environment to build any type of form with ease. Captain Form is integrated with many apps and payment processors, such as Google Drive, Dropbox, MailChimp, Active Campaign, SalesForce, PayPal, Stripe, Authorize.net, Braintree, Sage Pay and many more. You can also create any type of upload form to receive file attachments through your forms. Stellar customer support through live chat and email, and advanced data security are provided on all service plans, including the free one. This WordPress form builder and survey builder is useful for lead generation, online registration management, payment collection, market research and more. Creating user-friendly forms is easier than ever before!
|
20 |
+
|
21 |
+
**Some of CaptainForm's superpowers:**
|
22 |
+
|
23 |
+
* Build fully customizable forms and surveys using our drag & drop form editor with more than 25 field types: name, email, phone number, address, website, choice fields (checkboxes, radio buttons, dropdowns), file upload (single or multiple), digital signature, star rating, terms of service, Google map, Likert scale, social buttons etc.
|
24 |
+
* Create responsive forms and surveys from scratch or import one of our 30+ form templates: contact form, order form, payment form, file upload form, feedback form, event registration form, donation form, job application form, business demographic survey, newsletter subscription form, customer satisfaction survey, booking form, quote request form, loan application form and many more. You can create engaging forms with multiple pages for an easier navigation, and also place multiple fields per row.
|
25 |
+
* Receive files through your forms. Users can upload attachments such as images, PDFs and any other type of files through your upload forms. You can also choose to enable single or multiple file uploads.
|
26 |
+
* Benefit from an add-on free form builder – all 3rd party apps and payment integrations are built inside the core plugin.
|
27 |
+
* Collect payments through popular payment gateways. Create credit card payment forms, PayPal forms, PayPal Pro forms, PayPal Payflow forms, Auhorize.net forms, Stripe forms, Braintree forms, Sage Pay forms, PayU.ro forms, Sisow forms, PayFast forms and FreshBooks forms. It is fast, simple and no form add-ons are required.
|
28 |
+
* Use the form builder to send collected data automatically to a wide range of external services through 3rd party integrations: MailChimp, Dropbox, SalesForce, Campaign Monitor, Active Campaign, Evernote, Google Calendar, Google Drive, Zendesk, ExactTarget and many more.
|
29 |
+
* Secure your web forms and submissions with advanced security features such as CAPTCHA, reCAPTCHA, SSL Encryption, data encryption, IP and country filters – available on all plans within the form builder.
|
30 |
+
* Publish your WordPress forms and surveys in multiple ways: in posts, in pages, as popups, in widgets or using the function call.
|
31 |
+
* Set up multiple recipients so that more people receive notifications when a form submissions is made, send emails only to specific recipients based on the content of the submission and customize the content of the submission.
|
32 |
+
* Trigger custom autoresponders (confirmation emails) and redirect your form users to a custom "Thank you" page (success page) after submission.
|
33 |
+
* Receive collected data as PDF form submissions. PDF notifications come in two different ways. The PDF can have the layout of the regular form submission or the layout of the form.
|
34 |
+
* Use your own SMTP connection details so that data is sent through your email server.
|
35 |
+
* Enable your customers to save their progress for later and continue filling out the form at a later date with our save and resume feature.
|
36 |
+
* Create smart forms with complex calculations that include mathematical operations and link them to payment gateways, when needed, with just a few clicks.
|
37 |
+
* Sort, filter, analyze or export all collected data as CSV, EXCEL or PDF. Data can be manipulated in various other ways. For example, you can generate charts and reports.
|
38 |
+
* Use CaptainForm on WordPress multisite networks.
|
39 |
+
* Get free of charge quality customer support service by email and live chat – available on all plans (free and premium).
|
40 |
+
|
41 |
+
Here are a few quick guides on how to build some popular types of forms with our form builder: [registration form](http://www.captainform.com/wordpress-event-registration-plugin), [booking form](http://www.captainform.com/wordpress-booking-plugin), [job application form](http://www.captainform.com/docs/how-to-build-an-online-job-application-form-featuring-a-file-upload-field), [order form](http://www.captainform.com/docs/payments/), [PayPal order form](http://www.captainform.com/wordpress-paypal-order-form-plugin), [donation form](http://www.captainform.com/wordpress-donation-form-plugin), [quote request form](http://www.captainform.com/docs/how-to-build-a-wordpress-quote-request-form/), [feedback form](http://www.captainform.com/wordpress-feedback-form-plugin), [survey](http://www.captainform.com/wordpress-survey-plugin/), [quiz](http://www.captainform.com/wordpress-quiz-plugin), [poll](http://www.captainform.com/wordpress-poll-plugin), [contact form](http://www.captainform.com/wordpress-contact-form-plugin), [subscription form](http://www.captainform.com/wordpress-subscription-form-plugin), [auto-popup newsletter subscription form](http://www.captainform.com/wordpress-autopopup-newsletter-plugin), [popup form](http://www.captainform.com/wordpress-popup-plugin/), [WordPress users registration form](http://www.captainform.com/docs/how-to-register-users-on-wordpress-with-a-registration-form/).
|
42 |
+
|
43 |
+
**There are 4 different service plans available: a free plan and 3 paid plans, working on an annual subscription basis.**
|
44 |
+
|
45 |
+
* Regular (Free): 3 forms, 15 fields/form, 500 submissions/month, 100MB storage space
|
46 |
+
* Apprentice ($35/year): use on 1 site, unlimited forms and fields, 5K submissions/month, 500MB storage space, 5 native apps
|
47 |
+
* Master ($95/year): use on 3 sites, unlimited forms and fields, 20K submissions/month, 2GB storage space, 14 native apps
|
48 |
+
* Hero ($195/year): use on unlimited sites, unlimited forms and fields, 100K submissions/month, 10GB storage space, 24 native apps, multisite support, payment integration
|
49 |
+
|
50 |
+
**Features available on the Regular (Free) plan**
|
51 |
+
|
52 |
+
* Real time [drag & drop form builder](http://www.captainform.com/docs/formeditor/)
|
53 |
+
* 30+ form templates and the option to start from scratch
|
54 |
+
* 25+ types of form fields, including the [file upload](http://www.captainform.com/docs/how-to-add-a-file-upload-field-to-my-form) field which allows you to receive attachments through forms
|
55 |
+
* Required fields and optional fields
|
56 |
+
* [Field validation](http://www.captainform.com/docs/custom-field-validation-for-wordpress-forms) and field instructions that contribute to a good user experience on your forms
|
57 |
+
* [Forms with pagination](http://www.captainform.com/docs/multi-page-forms) and multiple fields per row
|
58 |
+
* Mathematical operations for advanced calculations
|
59 |
+
* Conditional logic (1 rule)
|
60 |
+
* Predefined form themes and the option to customize [form design](http://www.captainform.com/docs/themes/) extensively
|
61 |
+
* Various [form publishing](http://www.captainform.com/docs/publish/) options: in [pages and posts](http://www.captainform.com/docs/how-to-publish-a-form-on-wordpress-using-a-shortcode), in [widgets](http://www.captainform.com/docs/how-to-publish-a-form-on-wordpress-using-a-sidebar-widget), as [popup forms](http://www.captainform.com/docs/how-to-publish-a-form-on-WordPress-using-a-lightbox) and [auto-popup forms](http://www.captainform.com/docs/how-to-make-a-lightbox-form-auto-popup-on-your-wp-website), in [theme files](http://www.captainform.com/docs/how-to-publish-a-form-on-wordpress-using-a-function-call)
|
62 |
+
* Email notifications sent to the form owner
|
63 |
+
* Notification copy and default autoresponder sent to the form user
|
64 |
+
* Custom [Thank You page](http://www.captainform.com/docs/how-to-customize-the-thank-you-page-of-the-form)
|
65 |
+
* [Submissions archive](http://www.captainform.com/docs/submissions/) and export to CSV and Excel
|
66 |
+
* [Google Analytics tracking](http://www.captainform.com/docs/how-to-track-your-online-forms-with-google-universal-analytics)
|
67 |
+
* Various [CAPTCHA](http://www.captainform.com/docs/what-is-smart-captcha) types: simple, smart, reCAPTCHA
|
68 |
+
* Country filters and IP limitation
|
69 |
+
* Mobile forms (forms are compatible with mobile devices)
|
70 |
+
|
71 |
+
**Features available on the Apprentice plan ($35/year)**
|
72 |
+
|
73 |
+
* Everything in the Regular plan
|
74 |
+
* Multiple and custom recipients
|
75 |
+
* [Custom autoresponder](http://www.captainform.com/docs/how-to-create-customized-autoresponders/)
|
76 |
+
* [Custom email notifications](http://www.captainform.com/docs/notifications/)
|
77 |
+
* [PDF notifications](http://www.captainform.com/docs/pdf-notifications/)
|
78 |
+
* [SMS notifications](http://www.captainform.com/docs/sms-notifications)
|
79 |
+
* [Multilanguage forms](http://www.captainform.com/docs/translations/)
|
80 |
+
* Integration with [Google Drive](http://www.captainform.com/docs/google-drive/), [Dropbox](http://www.captainform.com/docs/dropbox/), [WordPress Posts](http://www.captainform.com/docs/how-to-create-wordpress-posts-through-form-submissions/), [Google Groups](http://www.captainform.com/docs/google-groups) and [Yahoo Groups](http://www.captainform.com/docs/yahoo-groups)
|
81 |
+
* Allow users to [save and resume a submission](http://www.captainform.com/docs/can-users-save-and-resume-a-form-submission)
|
82 |
+
* Allow users to [preview a submission](http://www.captainform.com/docs/can-users-preview-the-submission-summary-before-sending-the-form)
|
83 |
+
* Allow users to [print a submission](http://www.captainform.com/docs/can-i-add-a-print-button-to-my-form/)
|
84 |
+
* [Edit a submission](http://www.captainform.com/docs/can-form-users-edit-delivered-submissions-at-a-later-time) at a later time (for both form owners and form users)
|
85 |
+
* [Approval requests](http://www.captainform.com/docs/approval-of-submission) that allow you to approve or reject a submission
|
86 |
+
* Conditional logic (3 rules)
|
87 |
+
* [Form reports](http://www.captainform.com/docs/reports/) (pie charts, bar charts, line charts etc.) and report filters for the data you collect
|
88 |
+
* Custom SMTP server
|
89 |
+
* Password protection
|
90 |
+
* Quiz functionality ([correct answers](http://www.captainform.com/docs/how-to-assign-points-to-online-quizzes), quiz score, [countdown timer](http://www.captainform.com/docs/how-to-add-a-countdown-timer-to-my-captainform-wp-quiz) etc.)
|
91 |
+
|
92 |
+
**Features available on the Master plan ($95/year)**
|
93 |
+
|
94 |
+
* Everything in the Regular and Apprentice plans
|
95 |
+
* Integration with [MailChimp](http://www.captainform.com/docs/mailchimp/), [Active Campaign](http://www.captainform.com/docs/active-campaign), [Campaign Monitor](http://www.captainform.com/docs/campaign-monitor-integration/), [AWeber](http://www.captainform.com/docs/aweber), [iContact](http://www.captainform.com/docs/icontact), [Get Response](http://www.captainform.com/docs/getresponse), [Vertical Response](http://www.captainform.com/docs/verticalresponse), [ExactTarget](http://www.captainform.com/docs/how-to-send-web-form-data-into-exacttarget-lists), [Enormail](http://www.captainform.com/docs/enormail-integration)
|
96 |
+
* [Conditional logic](http://www.captainform.com/docs/rules/) (unlimited rules)
|
97 |
+
* [Custom JS scripts](http://www.captainform.com/docs/how-to-add-javascript-code-to-the-thank-you-page) on the form or on its Thank You page
|
98 |
+
|
99 |
+
**Features available on the Hero plan ($195/year)**
|
100 |
+
|
101 |
+
* Everything in the Regular, Apprentice and Master plans
|
102 |
+
* Payment integration with [PayPal](http://www.captainform.com/docs/step-by-step-guide-on-paypal-integration), [PayPal Payflow](http://www.captainform.com/docs/order-forms-paypal-payflow-integration), [PayPal Pro](http://www.captainform.com/docs/step-by-step-guide-on-paypal-pro-integration), [Stripe](http://www.captainform.com/docs/step-by-step-guide-on-stripe-integration), [Authorize.net](http://www.captainform.com/docs/can-i-integrate-my-order-form-with-authorize-net/), [Braintree](http://www.captainform.com/docs/braintree-payments-integration), [Sisow](http://www.captainform.com/docs/can-i-use-sisow-as-a-payment-processor), [Sage Pay](http://www.captainform.com/docs/can-i-use-sage-pay-as-a-payment-processor), [PayU.ro](http://www.captainform.com/docs/order-forms-with-payu-integration), [PayFast](http://www.captainform.com/docs/payfast), [Freshbooks](http://www.captainform.com/docs/step-by-step-guide-on-freshbooks-integration-for-web-order-forms)
|
103 |
+
* Accept PayPal payments or [credit card payments](http://www.captainform.com/docs/accept-credit-card-payments-through-your-form/)
|
104 |
+
* [Coupon codes](http://www.captainform.com/docs/how-to-create-coupon-codes-for-wordpress-payment-form)
|
105 |
+
* Integration with [Salesforce](http://www.captainform.com/docs/salesforce/), [Top Producer](http://www.captainform.com/docs/top-producer), [Zoho CRM](http://www.captainform.com/docs/zoho-crm), [Marketo](http://www.captainform.com/docs/marketo-integration), [Pipeline Deals](http://www.captainform.com/docs/pipeline-deals), [Evernote](http://www.captainform.com/docs/evernote-integration), [Smartsheet](http://www.captainform.com/docs/smartsheet/), [Google Calendar](http://www.captainform.com/docs/google-calendar), [Zendesk](http://www.captainform.com/docs/zendesk), [Desk.com](http://www.captainform.com/docs/desk-com-integration-for-web-forms/), [Webhooks](http://www.captainform.com/docs/webhooks/), [WordPress Users](http://www.captainform.com/docs/how-to-register-users-on-wordpress-with-a-registration-form/)
|
106 |
+
* Support for WordPress multisite networks
|
107 |
+
|
108 |
+
All service plans (including the free one) come with SSL encryption, data encryption and support by email and chat. View our complete [Features Matrix](http://www.captainform.com/features-matrix/).
|
109 |
+
|
110 |
+
The CaptainForm forms and surveys work well with all of the popular themes and page builders, like: Visual Composer, Beaver Builder, Live Composer, Divi, Elementor, Uncode, Avada, Site Origin, Themify.
|
111 |
+
For more information, please visit the official home page of the [CaptainForm form builder](http://www.captainform.com/?utm_source=WPDirectory&utm_medium=WP&utm_campaign=SubmitWPDirectory&x-channel=media&x-subchannel=partner&x-source=WPDirectory).
|
112 |
+
|
113 |
+
== Installation ==
|
114 |
+
|
115 |
+
Here's how you install and activate the CaptainForm plugin:
|
116 |
+
|
117 |
+
1. Download the CaptainForm plugin.
|
118 |
+
2. Upload the .zip file in your WordPress plugin directory.
|
119 |
+
3. Activate the plugin from the "Plugins" menu in WordPress.
|
120 |
+
4. After activating CaptainForm, choose the type of plan you wish to use.
|
121 |
+
|
122 |
+
[youtube https://www.youtube.com/watch?v=yJBVR7RTz88]
|
123 |
+
|
124 |
+
== Screenshots ==
|
125 |
+
|
126 |
+
1. The CaptainForm template library featuring the most used templates
|
127 |
+
2. The CaptainForm My Forms section
|
128 |
+
3. Building an Event Registration Form
|
129 |
+
4. The CaptainForm collection of 3rd party applications
|
130 |
+
5. The Publish section of the form builder
|
131 |
+
6. An example of how a form looks on a simple page
|
132 |
+
|
133 |
+
== Frequently Asked Questions ==
|
134 |
+
|
135 |
+
= What type of forms can I create with the CaptainForm form builder? =
|
136 |
+
|
137 |
+
The sky is the limit. Anything that has form fields and a submit button (from a simple contact form to forms designed for complex workflows) can be created with our drag and drop form builder. Forms are responsive, so they look well on any device. We have various form templates available so that you get started smoothly. Besides the form templates, here are some of the most popular form types created with CaptainForm, to give you some inspiration.
|
138 |
+
|
139 |
+
* [Registration forms and request forms](http://www.captainform.com/docs/wp-event-registration-form-guide) for any type of events: conferences, workshops, seminars, meetups, fundraisings, wedding RSVPs, birthday parties, contest entries etc. You can use content blocks to specify details about the event and use special features like limiting the number of seats and participants or setting the form to be active only during a specified period.
|
140 |
+
|
141 |
+
* [Application forms](http://www.captainform.com/docs/how-to-build-an-online-job-application-form-featuring-a-file-upload-field) with different purposes. Collect applicant information through job application forms, program application forms, scholarship application forms etc. Use regular form fields (like name, email, phone, address) to request the basic candidate details and then ask for any data that is necessary during the application process. You can allow applicants to upload documents and you can build forms with pagination to make longer forms easy to fill out.
|
142 |
+
|
143 |
+
* [Order forms](http://www.captainform.com/docs/payments/) that you can build in different ways. You can choose to simply list your products and services, include quantity boxes when needed, and receive orders by email. Or you can integrate your form with one of our 10+ payment gateways and turn your form into a payment form, so that payments are also processed automatically. Accept [credit card payments](http://www.captainform.com/docs/accept-credit-card-payments-through-your-form/) or [PayPal payments](http://www.captainform.com/wordpress-paypal-order-form-plugin). Our form builder also comes with advanced calculations, so another thing that you can do is build quote request forms that give customers an idea about the price they are going to pay based on the specifics of their requests.
|
144 |
+
|
145 |
+
* [Donation forms](http://www.captainform.com/docs/how-to-make-a-wordpress-donation-form-with-captainform-wp-plugin). Non-profit organizations can always put donations to good use, so why not collect donations in a very easy way? The CaptainForm form builder allows you to receive both fixed amounts and custom amounts. For example, you can use choice fields to let users choose their preferred amount or you can let them specify how much they want to donate. Users will then be redirected to your chosen payment processor to complete the donation.
|
146 |
+
|
147 |
+
* [Contact forms](http://www.captainform.com/docs/how-to-add-a-contact-form-in-wordpress-captainform/). Contact forms seem mainstream, but their power goes way beyond that. Your contact form can be used for lead generation and can be integrated with a third party app that extends the power of the data you collect. You can integrate your contact form with a CRM (to make the best out of the leads you receive) or even with a helpdesk application (to manage messages just like support tickets and keep them well organized).
|
148 |
+
|
149 |
+
* [Newsletter subscription forms](http://www.captainform.com/wordpress-autopopup-newsletter-plugin). CaptainForm integrates with various email marketing applications, like MailChimp, Active Campaign, Campaign Monitor, AWeber, Vertical Response, Get Response, Exact Target, Enormail. When you integrate your form with an email marketing app, new email addresses are added to your email lists with each form submission and you grow your newsletter audience automatically.
|
150 |
+
|
151 |
+
* [Surveys](http://www.captainform.com/docs/quick-guide-to-build-a-powerful-online-survey). Using surveys helps you understand your market niche quickly. The CaptainForm form builder comes with various survey fields, like radio buttons and dropdown lists (for single choice), checkboxes (for multiple choice) or Likert scales. Popular survey templates include business demographic surveys, customer surveys, product surveys, employee 360 degree evaluation surveys.
|
152 |
+
|
153 |
+
* [Quizzes](http://www.captainform.com/docs/how-to-make-an-online-quiz-tutorial) and [polls](http://www.captainform.com/docs/how-to-add-a-poll-on-wordpress-using-captainform). Build a quiz by assigning points to questions and specifying the correct answers. You can trigger different messages based on the quiz score and you can show form users their quiz results and the correct answers at the end. Use a countdown timer to limit the amount of time in which the quiz should be completed. Build education quizzes, personality quizzes, trivia forms and more. Polls, on the other hand, usually contain a small number of questions and are meant to show how opinions over a popular topic are distributed. We have seen many of our users publishing polls in the sidebar of their websites and blogs using the CaptainForm sidebar widget.
|
154 |
+
|
155 |
+
= What form fields can I use in my forms? =
|
156 |
+
|
157 |
+
Form fields that you can drag and drop in the [CaptainForm form builder](http://www.captainform.com/):
|
158 |
+
|
159 |
+
**Name** - The Name field is split into First Name and Last Name. Additionally, you can choose to enable the Middle Name, the Title and the Initials.
|
160 |
+
|
161 |
+
**Email** - The Email field is normally used to collect the email addresses of your form visitors. By default, email validation is enabled, so that only valid email addresses can be typed in this field. The Email field comes with different options (for example, you can choose not to accept duplicate emails) and can be used in more complex workflows, like our approval request feature. Autoresponders (confirmation messages) and copies to the sender are also sent based on the Email field.
|
162 |
+
|
163 |
+
**Phone** - The Phone field supports various phone number formats. The phone number is split into three inputs that accept a custom number of characters. Enable the one that is suitable for your form visitors.
|
164 |
+
|
165 |
+
**Website** - The Website field has URL validation by default. This means that form users need to provide a valid URL of a website.
|
166 |
+
|
167 |
+
**Address** - The Address field is split into multiple fields (Street Address Line 1, Street Address Line 2, City, State or Region, ZIP Code and Country). Based on your needs, you can choose which of these fields are visible and/or required.
|
168 |
+
|
169 |
+
**Short text** - This is a simple input that accepts values based on the field validation that you specify.
|
170 |
+
|
171 |
+
**Long text** - This is a text area that accepts paragraphs of texts. You can set the size of the text box and you can also specify a minimum or a maximum length of the text.
|
172 |
+
|
173 |
+
**Number** - This field is an input that accepts only numeric values.
|
174 |
+
|
175 |
+
**Dropdown** - Dropdowns are choice fields that contain options displayed as dropdown lists. You can make dropdowns searchable, decide which option is selected by default, specify the number of times an options can be chosen, randomize options etc.
|
176 |
+
|
177 |
+
**Radio buttons** - Just like dropdowns, radio buttons allows for a single choice, and have similar configuration options. Their layout is different and all choices are visible from the start. Usually, radio buttons are suitable when the number of choices is smaller, while dropdowns are used with greater numbers of options.
|
178 |
+
|
179 |
+
**Checkbox** - Checkbox fields allow for multiple selection. Users can tick as many choices as they want, but you can specify the minimum and maximum number of choices when that is needed.
|
180 |
+
|
181 |
+
**Likert scale** - Likert scales allow you to specify ranges of options that are displayed as scales. For example: degrees of agreement (from Strongly Agree to Strongly Disagree), degrees of probability (from Definitely Yes to Definitely Not), degrees of satisfaction (from Very Satisfied to Very Unsatisfied). You can customize these scales according to your needs.
|
182 |
+
|
183 |
+
**File upload** - File upload fields allow users to [upload attachments](http://www.captainform.com/docs/how-to-add-a-file-upload-field-to-my-form) and send them through your forms. You will receive file uploads attached to the notification email and you can also manage attachments from your CaptainForm account. You can decide what file extensions can be uploaded (PDF documents, Word documents, audio or video files, ZIP archives, JPG and PNG images, GIF files etc.) or what the minimum and maximum file attachment size should be. File upload fields can accept single file uploads (one file per field) or multiple file uploads (more files per field).
|
184 |
+
|
185 |
+
**Heading** - This field contains text and is normally used to mark the beginning of a new section in your form.
|
186 |
+
|
187 |
+
**HTML block** - This field contains a What You See Is What You Get editor in which you can provide as many text paragraphs as you want and you can easily customize your HTML content with different font families and sizes, font colors and formats (bold, italic, underlined), images, tables etc. You can also write HTML/CSS code in here.
|
188 |
+
|
189 |
+
**Date** - Date fields allow users to choose specific dates. The field comes with different formats (like mm/dd/yyyy or dd/mm/yyyy) and contains a popup calendar, so that users can easily select a date. There are various configuration options. For example, you can decide whether the week starts on a Monday or on a Sunday or what days of the week are accepted for selection.
|
190 |
+
|
191 |
+
**Time** - Time fields allow users to indicate a specific time. The field comes in the 24-hour format and in the 12-hour format (in which case the AM/PM box can be shown or hidden).
|
192 |
+
|
193 |
+
**Price** - Price fields come in different formats, with or without decimals, and support multiple currencies (from the US dollar or the British pound to the Japanese yen or the Danish krone).
|
194 |
+
|
195 |
+
**Image** - Add images to your forms. Upload them from your computer or specify the image path and the image will show up on your form.
|
196 |
+
|
197 |
+
**Google map** - Google maps can be embedded within your forms for geolocation. Specific addresses can be pinpointed on the map and you can also relate the map to an Address field. The details of the place that users pinpoint on the map will be used to prefill an Address field (or vice-versa). You can also send geo coordinates from the Google map to an input field.
|
198 |
+
|
199 |
+
**Digital signature** - The signature field is an area where users need to sign using the mouse. This field is especially useful with more official forms. For example, the submission content can represent a contract and can also be exported in PDF format. You can also decide upon the complexity degree that is required for the signature.
|
200 |
+
|
201 |
+
**Terms of service** - With a T.O.S. field you can ask for users' agreement on your policy or terms of any kind. Users simply need to tick a checkbox to agree to the terms of service and you can link to your terms either in a popup or using an external link to a page.
|
202 |
+
|
203 |
+
**Password** - Password fields are inputs with password validation. Characters are hidden by asterisks. Password fields are especially useful when you create new WordPress users through your forms. You can use two password fields with matching values and send the password by email to the new user.
|
204 |
+
|
205 |
+
**Star rating** - With rating stars, users can express their appreciation towards a product or service. Rating stars come in handy especially in review forms. Whether they review your restaurant, your event or a product that you are selling, users will be able to do so in a user-friendly form.
|
206 |
+
|
207 |
+
**Social buttons** - Add social icons to your forms, so that form users can easily share its URL (or a different one, according to your specifications). Social networks and functions included: Facebook like, Facebook share, Twitter, LinkedIn, Google +1.
|
208 |
+
|
209 |
+
**Page break** - Split your form into multiple pages and choose the type of pagination that you will be using. Drag and drop page breaks anywhere you need. Each will mark the beginning of a new page.
|
210 |
+
|
211 |
+
All form fields for which it is suitable come with field validation and field instructions, that you can set up if you want. Field validation means that form user needs to format their input according to the field type, so that you receive only relevant information. Field instructions contain additional information placed below the field label, which gives users more details about how they should fill in the fields.
|
212 |
+
|
213 |
+
You can also choose to use required fields and optional fields, based on how important certain information is. It is mandatory to fill in required fields before the form is sent, whereas optional fields will validate even if they are empty.
|
214 |
+
|
215 |
+
Furthermore, you can place multiple fields per row, build two-column forms, adjust the form width, set the text from right-to-left and do many more wonderful things with your forms.
|
216 |
+
|
217 |
+
= What form buttons are available? =
|
218 |
+
|
219 |
+
By default, only the Submit button is visible, but there are other button types that you can enable. Find their list below.
|
220 |
+
|
221 |
+
**Submit button** - Sends the form.
|
222 |
+
|
223 |
+
**Reset button** - Clears all fields so users can start over.
|
224 |
+
|
225 |
+
**Calculate button** - Calculates the total amount on order forms and payment forms.
|
226 |
+
|
227 |
+
**Purchase button** - It has the same role as the Submit button, but it is characteristic to payment forms.
|
228 |
+
|
229 |
+
**Next Page button** - Takes users to the next page in forms that are split into multiple pages.
|
230 |
+
|
231 |
+
**Previous button** - Takes users to the previous page in forms that are split into multiple pages.
|
232 |
+
|
233 |
+
**Save for Later button** - Allows users to save and resume a submission.
|
234 |
+
|
235 |
+
**Preview button** - Allows users to preview submissions in read-only format.
|
236 |
+
|
237 |
+
**Print button** - Allows users to print a copy of their submission right away.
|
238 |
+
|
239 |
+
= How to build forms with multiple pages? =
|
240 |
+
|
241 |
+
Drag and drop the Page Break field in the real time form editor to build [multipage forms](http://www.captainform.com/docs/multi-page-forms). You can do this as many times as needed. Each Page Break field represents the beginning of a new page. There are different types of pagination, like simple numbers, fancy numbers or percentage. A progress bar will guide users through the process of filling out your multipage form.
|
242 |
+
= Can I receive form entries at my email address? =
|
243 |
+
Sure, you will receive all forms submissions straight into your inbox. You can specify to what email addresses the submissions should be sent. Moreover, you can set up multiple email addresses to be used as recipients.
|
244 |
+
|
245 |
+
= How to customize the notifications sent through the forms? =
|
246 |
+
|
247 |
+
* Add multiple recipients that will receive notifications when a form submissions is made. Set up custom recipients so that only the relevant ones will receive notifications based on the submission content.
|
248 |
+
|
249 |
+
* Customize the header of the email that you receive (message subject, from name, from email etc.) and the layout of its content.
|
250 |
+
|
251 |
+
* Enable custom autoresponders (confirmation messages) and build their content using field values.
|
252 |
+
|
253 |
+
* Send a copy of the form submission to users. The form copy to sender will look just like the regular notification email.
|
254 |
+
|
255 |
+
* Enable PDF notifications. PDF submissions can have the default submission layout or the form layout (in which case you will need to purchase credits for conversion from HTML to PDF, as we are using an external service for this). PDF submissions will be attached to the notification email.
|
256 |
+
|
257 |
+
* Enable SMS notifications. Each time a form submission is made you will receive a notification via SMS. These notifications are also triggered through an external service so you will need to pay separately for SMS credits.
|
258 |
+
|
259 |
+
* Add Google Analytics tracking code your forms to compare submissions against form visits and monitor the form performance.
|
260 |
+
|
261 |
+
* Send emails through your own SMTP server.
|
262 |
+
|
263 |
+
= How to customize the Thank You page that form users see after submission? =
|
264 |
+
|
265 |
+
Choose one of the available options:
|
266 |
+
|
267 |
+
**Show text** - The Thank You page will contain the custom text that you provide.
|
268 |
+
|
269 |
+
**Redirect to a web page** - Users will be redirected to a URL of your choice after submission.
|
270 |
+
|
271 |
+
**Show text then redirect to a web page** - Users will first see a Thank You message and will then be redirected to your custom URL.
|
272 |
+
|
273 |
+
**Show report** - After submission, the form will redirect to one of the form reports. This is especially useful for polls.
|
274 |
+
|
275 |
+
**Show HTML block** - The Thank You page will contain an HTML block with custom content that you can create in a WYSIWYG editor. This way, you can include images and custom links on the Thank You page.
|
276 |
+
|
277 |
+
**Show quiz results** - If your form is a quiz (with points defined in the editor), you can redirect users to their quiz results where they will see their final score and the correct answers.
|
278 |
+
|
279 |
+
**Redirect with custom variables** - Redirect to a URL using custom values, either predefined or consisting in field values specified by the form user.
|
280 |
+
|
281 |
+
= How to customize the form design? =
|
282 |
+
|
283 |
+
By default, the form inherits the styles on your WordPress page. If you want to customize the form design, you can do so in the Themes section. Choose one of the predefined themes or create your own. Customize text fonts, colors, backgrounds, highlights, errors, buttons, the multipage navigation etc.
|
284 |
+
|
285 |
+
= What add-ons can I integrate with my forms? =
|
286 |
+
|
287 |
+
All add-ons are available straight from the core plugin, so that you don't need to search for and pay for additional plugins. You can find the third party apps in the Settings section of the form builder.
|
288 |
+
|
289 |
+
= CRM apps =
|
290 |
+
|
291 |
+
**SalesForce** - Integrate your form with [SalesForce](http://www.captainform.com/docs/salesforce/) and create objects like Leads, Contacts, Accounts, Documents, Opportunities, Cases etc.
|
292 |
+
|
293 |
+
**Top Producer** - Integrate real estate forms with [Top Producer](http://www.captainform.com/docs/top-producer).
|
294 |
+
|
295 |
+
**Zoho CRM** - Send data from your forms to [Zoho CRM](http://www.captainform.com/docs/zoho-crm) and create Leads, Contact or Accounts.
|
296 |
+
|
297 |
+
**Pipeline Deals** - Send data to [Pipeline Deals](http://www.captainform.com/docs/pipeline-deals) and create People, Deals or both objects at the same time.
|
298 |
+
|
299 |
+
**Marketo** - Create new leads in your [Marketo](http://www.captainform.com/docs/marketo-integration) lists.
|
300 |
+
|
301 |
+
= Email marketing apps =
|
302 |
+
|
303 |
+
**MailChimp** - Create [MailChimp](http://www.captainform.com/docs/mailchimp/) newsletter forms or integrate other types of forms with MailChimp to grow your mailing lists. You can use double opt-in, send welcome emails and do much more.
|
304 |
+
|
305 |
+
**Vertical Response** - Add new email addresses to your [Vertical Response](http://www.captainform.com/docs/verticalresponse) account.
|
306 |
+
|
307 |
+
**iContact** - Create new contacts in your [iContact](http://www.captainform.com/docs/icontact) email lists.
|
308 |
+
|
309 |
+
**AWeber** - Grow your [AWeber](http://www.captainform.com/docs/aweber) email lists through your forms.
|
310 |
+
|
311 |
+
**Get Response** - Send the data collected through your forms to [Get Response](http://www.captainform.com/docs/getresponse).
|
312 |
+
|
313 |
+
**Enormail** - Add new contacts to your [Enormail](http://www.captainform.com/docs/enormail-integration) mailing lists.
|
314 |
+
|
315 |
+
**Exact Target** - Send information to [Exact Target](http://www.captainform.com/docs/how-to-send-web-form-data-into-exacttarget-lists). You can also choose to send it to the data extensions in your Exact Target account.
|
316 |
+
|
317 |
+
**Campaign Monitor** - Add subscribers to your [Campaign Monitor](http://www.captainform.com/docs/campaign-monitor-integration/) mailing lists.
|
318 |
+
|
319 |
+
**Active Campaign** - Add subscribers to your [Active Campaign](http://www.captainform.com/docs/active-campaign) mailing lists.
|
320 |
+
|
321 |
+
= File management apps =
|
322 |
+
|
323 |
+
**Google Drive** - Integrate your form with [Google Drive](http://www.captainform.com/docs/google-drive/) to have your form submissions sent to a spreadsheet that allows for easy collaboration.
|
324 |
+
|
325 |
+
**Dropbox** - Integrate your form with [Dropbox](http://www.captainform.com/docs/dropbox/) and the file attachments uploaded through the form will be sent to your Dropbox account.
|
326 |
+
|
327 |
+
= Project management apps =
|
328 |
+
|
329 |
+
**Smartsheet** - [Smartsheet](http://www.captainform.com/docs/smartsheet/) forms will send submissions to your Smartsheet account.
|
330 |
+
|
331 |
+
**Evernote** - [Evernote](http://www.captainform.com/docs/evernote-integration) forms will create notes in your Evernote account with each form submission.
|
332 |
+
|
333 |
+
= Event management apps =
|
334 |
+
|
335 |
+
**Google Calendar** - Integrate your registration forms with [Google Calendar](http://www.captainform.com/docs/google-calendar) to create new events or to add new subscribers to existing events.
|
336 |
+
|
337 |
+
= Help desk apps =
|
338 |
+
|
339 |
+
**Zendesk** - Create support request forms and integrate them with [Zendesk](http://www.captainform.com/docs/zendesk). Each form submission will generate a new ticket in your Zendesk account. Other objects, like new agents, can also be created through forms with Zendesk integration.
|
340 |
+
|
341 |
+
**Desk.com** - Send the data collected through your support form to [Desk.com](http://www.captainform.com/docs/desk-com-integration-for-web-forms/) as support tickets.
|
342 |
+
|
343 |
+
= Social apps =
|
344 |
+
|
345 |
+
**Google Groups** - Add new members to your [Google Groups](http://www.captainform.com/docs/google-groups).
|
346 |
+
|
347 |
+
**Yahoo Groups** - Add new members to your [Yahoo Groups](http://www.captainform.com/docs/yahoo-groups).
|
348 |
+
|
349 |
+
= WordPress specific apps =
|
350 |
+
|
351 |
+
**WordPress Posts** - Create [user-generated WordPress posts](http://www.captainform.com/docs/how-to-create-wordpress-posts-through-form-submissions/) when a form submission is sent. You can configure the post in different ways: set its status on published, pending or draft; customize its content, excerpt and author; use custom posts etc.
|
352 |
+
|
353 |
+
**WordPress Users** - Create [new WordPress users](http://www.captainform.com/docs/how-to-register-users-on-wordpress-with-a-registration-form/) when a form submission is sent. You can send detailed user information: name, username, nickname, password, bio etc.
|
354 |
+
|
355 |
+
= Developer tools =
|
356 |
+
|
357 |
+
**Webhooks** - The [Webhooks](http://www.captainform.com/docs/webhooks/) integration allows you to connect a custom script to your form, so that you can manage collected data in any way.
|
358 |
+
|
359 |
+
= What payment processors can I integrate with my forms? =
|
360 |
+
|
361 |
+
Assign prices to the items that you are selling, create more complex formulas when needed, customize the payment summary and integrate your form with one of the payment gateways supported by the CaptainForm form builder. Should you need a different payment processor, please let us know.
|
362 |
+
|
363 |
+
You can enable the real-time payment summary on your form, trigger notifications after the payment is completed, set up taxes and discounts (per item or per total), show the subtotal amount and create discount coupon codes for the users of your payment form. When the form is submitted, the total amount will be sent to the payment processor and charged.
|
364 |
+
|
365 |
+
**PayPal** - Integrate your order form with PayPal and set up one-time or recurring payments. With recurring payments, you can specify how often the charge will be made and what the number of recurring payment cycles should be. Your [PayPal payment form](http://www.captainform.com/docs/step-by-step-guide-on-paypal-integration) can also be set to send the customer details (like name, email or address) to PayPal.
|
366 |
+
|
367 |
+
**PayPal Payflow** - If your chosen payment gateway is PayPal Payflow, then you can easily turn your order form into a [PayPal Payflow payment form](http://www.captainform.com/docs/order-forms-paypal-payflow-integration). Recurring billing is also supported here.
|
368 |
+
|
369 |
+
**PayPal Pro** - The same goes for [PayPal Pro payment forms](http://www.captainform.com/docs/step-by-step-guide-on-paypal-pro-integration). Just specify your connection details and customize the integration.
|
370 |
+
|
371 |
+
**Braintree** - [Braintree order forms](http://www.captainform.com/docs/braintree-payments-integration) allow you to receive one-time or recurring payments and submit the payment for settlement automatically. You can also choose to ask for the user's billing address on the payment page or to hide the billing address and prefill it with the information previously provided inside the form.
|
372 |
+
|
373 |
+
**Authorize.net** - Receive money through your [Authorize.net order form](http://www.captainform.com/docs/can-i-integrate-my-order-form-with-authorize-net/) and create Customer Information Profiles (CIM profiles) with each form submission.
|
374 |
+
|
375 |
+
**Stripe** - Collect payments through a [Stripe order form](http://www.captainform.com/docs/step-by-step-guide-on-stripe-integration). Stripe payment forms are currently among the quickest, friendliest and easiest to set up.
|
376 |
+
|
377 |
+
**Sage Pay** - Accept credit card payments through a [Sage Pay payment form](http://www.captainform.com/docs/can-i-use-sage-pay-as-a-payment-processor).
|
378 |
+
|
379 |
+
**Sisow** - Accept credit card payments through a [Sisow order form](http://www.captainform.com/docs/can-i-use-sisow-as-a-payment-processor). Sisow supports iDEAL, DIRECTebanking, MisterCash, Webshop Giftcard, Podium Cadeaukaart.
|
380 |
+
|
381 |
+
**Freshbooks** - Create invoices and estimates through [Freshbooks order forms](http://www.captainform.com/docs/step-by-step-guide-on-freshbooks-integration-for-web-order-forms).
|
382 |
+
|
383 |
+
**PayFast** - Accept credit card payments in South Africa using [PayFast order forms](http://www.captainform.com/docs/payfast).
|
384 |
+
|
385 |
+
**PayU.ro** - Collect credit card payments through [PayU](http://www.captainform.com/docs/order-forms-with-payu-integration) in Romania.
|
386 |
+
|
387 |
+
= Can I set up advanced calculations? =
|
388 |
+
Yes. The calculation feature allows you to assign values to items and display the total value on the form. Not only this, but you can also use calculations to create advanced formulas with complex mathematical operations.
|
389 |
+
= Do I have anti-spam protection? =
|
390 |
+
Definitely. All forms need anti-spam protection for an appropriate and reliable functioning. As anti-spam solutions, we provide reCAPTCHA, smart CAPTCHA, IP limitation and more.
|
391 |
+
= How to use form security options? =
|
392 |
+
|
393 |
+
* Use simple CAPTCHA, smart CAPTCHA or reCAPTCHA by Google.
|
394 |
+
* Set a password for your form so only those who know the password can access it.
|
395 |
+
* Limit the number of submissions received from the same IP or the total number of submission.
|
396 |
+
* Use country filters to reject or accept submissions coming from certain countries.
|
397 |
+
* Enable data encryption on forms in the My Account section of the form builder.
|
398 |
+
* SSL encryption comes by default on all forms (irrespective of the service plan) and we back up all data daily.
|
399 |
+
|
400 |
+
= How to enable conditional logic? =
|
401 |
+
|
402 |
+
There are three types of [conditional logic](http://www.captainform.com/docs/rules/) (form branching) that you can enable in our form builder. You will find these in the Rules section.
|
403 |
+
|
404 |
+
**Field rules** - Conditional logic for fields means that form fields will show or hide based on the user's previous choices or input.
|
405 |
+
|
406 |
+
**Autoresponder rules** - Conditional logic for autoresponders means that users will receive different confirmation messages based on the content of their submission.
|
407 |
+
|
408 |
+
**Form rules** - Form branching means that users will be redirected to different pages after submission based on the content of their submission.
|
409 |
+
|
410 |
+
= How to create multi-language forms? =
|
411 |
+
|
412 |
+
In the Translations section, you can add as many languages as needed and customize all form messages: from field labels to error messages or system messages. When you enable the multi-language option, a selection field will appear in the top-right corner of your form, allowing users to select their preferred language. You can decide what language is available by default.
|
413 |
+
|
414 |
+
= How can form users save and resume a submission? =
|
415 |
+
|
416 |
+
In the Advanced section, there are various options, among which the option to allow users to [save for later](http://www.captainform.com/docs/can-users-save-and-resume-a-form-submission) a submission. If you enable it, users will see a save & resume link next to the Submit button. It saves the progress and allows user to return to the exact same state.
|
417 |
+
|
418 |
+
= How to publish my forms? =
|
419 |
+
|
420 |
+
**In pages or posts** - Copy the shortcode from the Publish section or insert it directly from the post/page edit section.
|
421 |
+
|
422 |
+
**In sidebars** - Add the form widget to any of your sidebars. Drag the CaptainForm widget to a sidebar and select the form that you want to publish. Forms are responsive, so they will look well irrespective of the size of the section where they need to fit in.
|
423 |
+
|
424 |
+
**In popups** - You can publish your form as a popup without using a different plugin. The form popup can be triggered by a click on a text link, on an image or on a floating button. You can also create auto-popup forms that will appear automatically after a specified number of seconds.
|
425 |
+
|
426 |
+
**Using the function call** - This publishing option requires a bit of code knowledge. It is useful when you want to include the form in one of your WordPress theme files.
|
427 |
+
|
428 |
+
= Can I make a form active only for a specific period of time? =
|
429 |
+
|
430 |
+
Of course. In the My Forms section, where all of your forms are listed, you'll see on the right side of each form an Active button. If you hover over it, the box will expand and a Custom option will be available. By choosing it, you'll have the possibility to set the period of time when the form is active for your visitors.
|
431 |
+
|
432 |
+
= How can I manage the data that I collect through my forms? =
|
433 |
+
|
434 |
+
Besides the various options that you can set up in the Notifications section (like PDF submissions, copy to sender, custom confirmation message etc.), the third party apps that you can enable or the form reports that you can generate, there are other things that you can do with the data that you collect.
|
435 |
+
|
436 |
+
* View, sort, filter and delete submissions.
|
437 |
+
* Edit submissions or allows users to edit them.
|
438 |
+
* Print submissions or allow users to print them.
|
439 |
+
* Export submissions in CSV or Excel format.
|
440 |
+
* Import submissions from other forms.
|
441 |
+
* Enable approval requests. With requests for approval, somebody needs to review form submissions and approve or reject them.
|
442 |
+
|
443 |
+
= How can I generate charts and reports? =
|
444 |
+
|
445 |
+
The Reports section allows you to generate reports using different widgets: pie charts, bar charts, line charts, data tables etc. Reports are especially useful when you have choice fields in your form. Using them, you can get a quick look at the choice distribution.
|
446 |
+
|
447 |
+
= Where are form submissions stored? =
|
448 |
+
|
449 |
+
By default, submission are stored on the CaptainForm servers, where they are highly secure and backed up daily. We value privacy and security highly. You can choose to have submissions stored on your own server. Simply go in the My Account section and move submissions to your server. You can move them back to our servers at any point.
|
450 |
+
|
451 |
+
= How can digital agencies manage forms in a centralized way? =
|
452 |
+
|
453 |
+
The first site where you activate a license key is considered the primary site. The primary site can view and manage all forms. Activate the same key on your clients' websites and then decide, from the primary site, what forms are available on what websites. You can do this by grouping forms and sharing each group with the client website to which it belongs.
|
454 |
+
|
455 |
+
This feature is not only meant for WordPress design and development agencies, but also for any freelancer who needs a smart form builder for clients' websites.
|
456 |
+
|
457 |
+
CaptainForm also works with multisite WordPress instances. The Hero license is compatible with WordPress multisite and also allows for unlimited activations.
|
458 |
+
|
459 |
+
= How do I upgrade the plugin? =
|
460 |
+
|
461 |
+
While you can create fully functional free forms, if you need advanced functionality, you need to buy a license key. Choose the service plan that you want to use and click on the Upgrade button. You will be redirected to Avangate, our payment gateway, to fill out an order form with your card information. Once you complete the payment, a license key will be sent to you by email. Next, go to the Change Plan page, enter your license key into the activation box and hit the Activate button to activate your new plan.
|
462 |
+
|
463 |
+
= How do I change service plans? =
|
464 |
+
|
465 |
+
The same way you upgraded the plugin the first time. Click on the Upgrade or Downgrade button of the service plan you are interested in and complete the payment in Avangate. You will receive the new license key by email. Return to this page and enter the key in the activation box. Afterwards, hit the Activate button.
|
466 |
+
|
467 |
+
= How long is the license key valid? =
|
468 |
+
|
469 |
+
The license key is valid for 365 days from the day you bought it. If you do not activate the license key during this period, you will need to buy a new one to upgrade your account.
|
470 |
+
|
471 |
+
= What happens to my old service plan? =
|
472 |
+
|
473 |
+
If your subscription year is not over yet, you can either have it prorated or get a refund for what is left from your previous plan. Please contact us at the email address support@captainform.com to let us know what you prefer.
|
474 |
+
|
475 |
+
= What type of credit cards are supported? =
|
476 |
+
|
477 |
+
We support MasterCard, Visa, PayPal, American Express, JCB, Discover/Novus and Diners Club. You can also purchase a license key by bank or wire transfer. You may select any of these options on the payment form.
|
478 |
+
|
479 |
+
= How do I downgrade my plugin to the free account? =
|
480 |
+
|
481 |
+
To downgrade the plugin, click on the Downgrade button under our Regular plan and fill out the cancellation form. All premium features will be deactivated, but you can upgrade again at any time by purchasing a new license key.
|
482 |
+
|
483 |
+
== Changelog ==
|
484 |
+
= 2.2.6 (22 August 2017) =
|
485 |
+
* Fixed conflict with the color picker in Avada theme v5.2.1
|
486 |
+
|
487 |
+
= 2.2.5 (9 May 2017) =
|
488 |
+
* Updates for compatibility with SEO Redirection Plugin
|
489 |
+
|
490 |
+
= 2.2.4 (14 March 2017) =
|
491 |
+
* Compatibility updates for the page/post editor popup with Visual Composer and other page builders
|
492 |
+
|
493 |
+
= 2.2.3 (1 March 2017) =
|
494 |
+
* Removed unnecessary line breaks from around the popup image trigger on certain themes
|
495 |
+
|
496 |
+
= 2.2.2 (16 February 2017) =
|
497 |
+
* Mobile optimizations for the page/post editor popup
|
498 |
+
|
499 |
+
= 2.2.1 (6 February 2017) =
|
500 |
+
* New button for inserting forms into pages and posts
|
501 |
+
|
502 |
+
= 2.2.0 (30 January 2017) =
|
503 |
+
* Instant loading popup
|
504 |
+
* New popup trigger (when visitor leaves page)
|
505 |
+
* CSS floating button
|
506 |
+
* Compatibility fix for Avada
|
507 |
+
|
508 |
+
= 2.1.6 (17 January 2017) =
|
509 |
+
* Interface for prefilling form fields
|
510 |
+
* Functionality for prefilling form fields with details about the logged in WordPress user
|
511 |
+
|
512 |
+
= 2.1.5 (23 December 2016) =
|
513 |
+
* Fixed popups on iPhone 6,7
|
514 |
+
|
515 |
+
= 2.1.4 (6 December 2016) =
|
516 |
+
* Function call publishing now works with custom variables
|
517 |
+
|
518 |
+
= 2.1.3 (23 November 2016) =
|
519 |
+
* Fixed issues related to the compatibility with different cache plugins
|
520 |
+
* Better CSS delivery
|
521 |
+
* Better loading speed (removed unnecessary resources)
|
522 |
+
* Updated popup design for the websites where Autoptimize is installed
|
523 |
+
|
524 |
+
= 2.1.2 (22 November 2016) =
|
525 |
+
* Autoptimize compatibility
|
526 |
+
|
527 |
+
= 2.1.1 (16 November 2016) =
|
528 |
+
* Optimized the images that trigger popups to be resized based on their container
|
529 |
+
|
530 |
+
= 2.1.0 (8 November 2016) =
|
531 |
+
* New feature: Users can now choose to store form submissions on their own server or on the CaptainForm servers.
|
532 |
+
|
533 |
+
= 2.0.4 (7 November 2016) =
|
534 |
+
* Optimized short tags support
|
535 |
+
|
536 |
+
= 2.0.3 (31 October 2016) =
|
537 |
+
* Improved WordPress Users integration for multisite installations
|
538 |
+
|
539 |
+
= 2.0.2 (27 October 2016) =
|
540 |
+
* Fixed an SSL encryption issue that used to occur when the user changed the admin email address
|
541 |
+
|
542 |
+
= 2.0.1 (25 October 2016) =
|
543 |
+
* Minimized the embed code in order to avoid having paragraphs introduced automatically
|
544 |
+
|
545 |
+
= 2.0.0 (19 October 2016) =
|
546 |
+
* Prepared plugin for next release which will allow users to store submissions on their own servers
|
547 |
+
* Rewrote entire plugin for better overall performance and scalability, and for more comprehensive automated testing
|
548 |
+
|
549 |
+
= 1.7.2.3 (11 October 2016) =
|
550 |
+
* Extended compatibility with custom folder structure
|
551 |
+
|
552 |
+
= 1.7.2.2 (30 September 2016) =
|
553 |
+
* Added support for PHP 5.2
|
554 |
+
|
555 |
+
= 1.7.2.1 (22 September 2016) =
|
556 |
+
* Fix for cached JavaScript
|
557 |
+
|
558 |
+
= 1.7.2 (21 September 2016) =
|
559 |
+
* New functionality: prefill fields in embedded forms
|
560 |
+
* Fix for shortcode compatibility with different themes
|
561 |
+
|
562 |
+
= 1.7.1 (20 September 2016) =
|
563 |
+
* Fix for older PHP versions
|
564 |
+
|
565 |
+
= 1.7.0 (19 September 2016) =
|
566 |
+
* Integration between CaptainForm and Forge
|
567 |
+
|
568 |
+
= 1.6.1 (7 September 2016) =
|
569 |
+
* Interaction design improvements
|
570 |
+
|
571 |
+
= 1.6 (2 September 2016) =
|
572 |
+
* Updated shortcode parameters
|
573 |
+
|
574 |
+
= 1.5.7 (22 August 2016) =
|
575 |
+
* Mac OS optimizations
|
576 |
+
|
577 |
+
= 1.5.6 (26 July 2016) =
|
578 |
+
* Support for special characters in floating button image
|
579 |
+
|
580 |
+
= 1.5.5 (20 July 2016) =
|
581 |
+
* Optimized user-submitted posts
|
582 |
+
|
583 |
+
= 1.5.4 (14 July 2016) =
|
584 |
+
* New popup loader
|
585 |
+
|
586 |
+
= 1.5.3 (29 June 2016) =
|
587 |
+
* Popup preview UX improvements
|
588 |
+
|
589 |
+
= 1.5.2 (16 June 2016) =
|
590 |
+
* Optimized popup width
|
591 |
+
|
592 |
+
= 1.5.1 (8 June 2016) =
|
593 |
+
* New component for popup publishing
|
594 |
+
|
595 |
+
= 1.5.0 (6 June 2016) =
|
596 |
+
* Optimized the process of duplicating and moving sites
|
597 |
+
|
598 |
+
= 1.4.2 (30 May 2016) =
|
599 |
+
* New presentation text
|
600 |
+
|
601 |
+
= 1.4.1 (18 April 2016) =
|
602 |
+
* Enabled SSL encryption for all users by default
|
603 |
+
* Optimized the widget publishing method
|
604 |
+
|
605 |
+
= 1.4 (24 March 2016) =
|
606 |
+
* New functionality: Create WordPress users through form submissions
|
607 |
+
|
608 |
+
= 1.3.6 (16 March 2016) =
|
609 |
+
* Popup fix for iPhone devices
|
610 |
+
|
611 |
+
= 1.3.5 (11 March 2016) =
|
612 |
+
* Fixed double loader bug
|
613 |
+
|
614 |
+
= 1.3.4 (8 March 2016) =
|
615 |
+
* Addressed jQuery issue in 2010 theme on WP version 4.4.2
|
616 |
+
|
617 |
+
= 1.3.3 (4 March 2016) =
|
618 |
+
* Improved user experience on small devices
|
619 |
+
* Optimized preview mode
|
620 |
+
* Start session if it is not started when WP initializes
|
621 |
+
|
622 |
+
= 1.3.2 (17 February 2016) =
|
623 |
+
* Compatibility optimizations for PHP versions below 5.4
|
624 |
+
|
625 |
+
= 1.3.1 (16 February 2016) =
|
626 |
+
* New presentation text
|
627 |
+
|
628 |
+
= 1.3.0 (16 February 2016) =
|
629 |
+
* Security updates for post creation
|
630 |
+
|
631 |
+
= 1.2.1 (4 February 2016) =
|
632 |
+
* Optimized debugging mode
|
633 |
+
|
634 |
+
= 1.2.0 (1 February 2016) =
|
635 |
+
* Unified loaders mechanism
|
636 |
+
|
637 |
+
= 1.1.9 (1 February 2016) =
|
638 |
+
* Added author URI
|
639 |
+
|
640 |
+
= 1.1.8 (14 January 2016) =
|
641 |
+
* Form styling tweaks for a better integration on websites
|
642 |
+
* Higher preview flexibility (embedded form or popup form)
|
643 |
+
* Updates for the publishing method from pages/posts and widgets
|
644 |
+
|
645 |
+
= 1.1.7 (7 January 2016) =
|
646 |
+
* New alerting system for better usability
|
647 |
+
* Optimization of first user experience
|
648 |
+
* Updates for compatibility with other plugins
|
649 |
+
* Updates for forms included in post excerpts
|
650 |
+
|
651 |
+
= 1.1.6 (22 December 2015) =
|
652 |
+
* Compatibility optimizations for PHP 5.2 and 5.3
|
653 |
+
|
654 |
+
= 1.1.5 (22 December 2015) =
|
655 |
+
* Added new variable to collect referrer
|
656 |
+
|
657 |
+
= 1.1.4 (19 November 2015) =
|
658 |
+
* Updated Iframe Resizer to version 3.5
|
659 |
+
* Updated TinyBox design for old themes
|
660 |
+
* Eliminated the duplicate Post tab
|
661 |
+
|
662 |
+
= 1.1.3 (10 November 2015) =
|
663 |
+
* Fixed popups for Safari
|
664 |
+
* Fixed widget when in theme customization mode
|
665 |
+
|
666 |
+
= 1.1.2 (4 November 2015) =
|
667 |
+
* Performance optimization
|
668 |
+
* Updated readme.txt, added screenshots, changed header image
|
669 |
+
|
670 |
+
= 1.0.0 (2 November 2015) =
|
671 |
* Initial release
|
uninstall.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired when the plugin is uninstalled.
|
5 |
+
*
|
6 |
+
* When populating this file, consider the following flow
|
7 |
+
* of control:
|
8 |
+
*
|
9 |
+
* - This method should be static
|
10 |
+
* - Check if the $_REQUEST content actually is the plugin name
|
11 |
+
* - Run an admin referrer check to make sure it goes through authentication
|
12 |
+
* - Verify the output of $_GET makes sense
|
13 |
+
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
14 |
+
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
15 |
+
*
|
16 |
+
* This file may be updated more in future version of the Boilerplate; however, this is the
|
17 |
+
* general skeleton and outline for how the file should work.
|
18 |
+
*
|
19 |
+
* For more information, see the following discussion:
|
20 |
+
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
|
21 |
+
*
|
22 |
+
* @link http://captainform.com
|
23 |
+
* @since 1.0.0
|
24 |
+
*
|
25 |
+
* @package Captainform
|
26 |
+
*/
|
27 |
+
|
28 |
+
// If uninstall not called from WordPress, then exit.
|
29 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
30 |
+
exit;
|
31 |
+
}
|
views/credentials_error.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
|
4 |
-
function captainform_draw_credentials_error()
|
5 |
-
{
|
6 |
-
wp_enqueue_style('captainform_credentials_error', plugins_url('/includes/css/credentials_error.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
|
7 |
-
$url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
8 |
-
?>
|
9 |
-
<div id='captainform_credentials_error_wrapper'>
|
10 |
-
<div class="captainform_credentials_error_text">
|
11 |
-
<strong>Hey there! Looks like you have duplicated your site or moved its location. Do you plan to use CaptainForm at the old location anymore?</strong>
|
12 |
-
|
13 |
-
<p>
|
14 |
-
If you choose Yes, this new website will become a new instance of your CaptainForm account.
|
15 |
-
<br />
|
16 |
-
If you choose No, then your old URL will be overwritten by this new one.
|
17 |
-
</p>
|
18 |
-
</div>
|
19 |
-
|
20 |
-
|
21 |
-
<div>
|
22 |
-
<form action='//<?=$url?>' method='POST'>
|
23 |
-
<input type='hidden' id='captainform_reset_keys' name='captainform_reset_keys' value=2 />
|
24 |
-
<button class="button button-primary" onclick="document.getElementById('captainform_reset_keys').value=1;">Yes</button>
|
25 |
-
<button class="button button-white" onclick="document.getElementById('captainform_reset_keys').value=0; if (!confirm('Attention! If you are moving your primary website (the one where you first activated a paid license key) or a duplicate of it, CaptainForm will not work at the primary website URL anymore. The website you are currently on will become your new primary website.')) return false;">No</button>
|
26 |
-
</form>
|
27 |
-
</div>
|
28 |
-
</div>
|
29 |
-
<?php
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/main.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
|
4 |
-
function captainform_draw_main_iframe($url, $hostinfo)
|
5 |
-
{
|
6 |
-
global $captainform_wpp_options, $captainform_plugin_version;
|
7 |
-
ob_start();
|
8 |
-
$rev = uniqid();
|
9 |
-
$chost = $hostinfo[0];
|
10 |
-
$protocol = $hostinfo[1];
|
11 |
-
$chostp = $hostinfo[2];
|
12 |
-
?>
|
13 |
-
<script>
|
14 |
-
var version = '<?php echo $captainform_plugin_version; ?>';
|
15 |
-
var chost = '<?php echo $chost; ?>';
|
16 |
-
var chostp = '<?php echo $chostp; ?>';
|
17 |
-
var parent_site_url = '<?php echo site_url(); ?>';
|
18 |
-
var captainform_plugin_dir = '<?php echo plugins_url('', __DIR__); ?>';
|
19 |
-
</script>
|
20 |
-
<iframe id="captainform_iframe" src="<?php print $url; ?>"
|
21 |
-
style="width:99%; background: transparent; min-height: 700px;" scrolling="no"></iframe>
|
22 |
-
<?php
|
23 |
-
wp_register_script('captainform_iframe_resizer', plugins_url('/includes/js/iframeResizer.min.js', plugin_dir_path(__FILE__)), array(), '3.5', false);
|
24 |
-
wp_register_script('captainform_main_js', plugins_url('/includes/js/main.js', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version, false);
|
25 |
-
wp_register_script('captainform_reviews_js', plugins_url('/includes/js/review.js', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version, false);
|
26 |
-
wp_enqueue_script('captainform_iframe_resizer');
|
27 |
-
wp_enqueue_script('captainform_main_js');
|
28 |
-
wp_enqueue_script('captainform_reviews_js');
|
29 |
-
wp_enqueue_style('captainform_iframe_popup', plugins_url('/includes/css/iframe_popup.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
|
30 |
-
wp_enqueue_style('captainform_review_css', plugins_url('/includes/css/review.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
|
31 |
-
$user_agent = getenv("HTTP_USER_AGENT");
|
32 |
-
if (strpos($user_agent, "Mac") !== FALSE) {
|
33 |
-
wp_enqueue_style('captainform_iframe_popup', plugins_url('/includes/css/wp_captainform_os.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
|
34 |
-
}
|
35 |
-
ob_end_flush();
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/options_page.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined('ABSPATH') or die('No direct access!');
|
3 |
-
|
4 |
-
function captainform_options_page()
|
5 |
-
{
|
6 |
-
if(isset($_GET['reset']) && $_GET['reset'] == 'true'){
|
7 |
-
captainform_generate_new_credentials();
|
8 |
-
?>
|
9 |
-
<script>window.location.href = 'options-general.php?page=CaptainFormOptions'</script>
|
10 |
-
<?php
|
11 |
-
}
|
12 |
-
$installation_id = get_site_option($GLOBALS['captainform_option1']);
|
13 |
-
$installation_key = get_site_option($GLOBALS['captainform_option2']);
|
14 |
-
$site_url = get_site_option($GLOBALS['captainform_option3']);
|
15 |
-
ob_start();
|
16 |
-
?>
|
17 |
-
<div class="wrap">
|
18 |
-
<h1>CaptainForm Settings</h1>
|
19 |
-
<h2>Generate New Keys</h2>
|
20 |
-
<div>
|
21 |
-
<div>
|
22 |
-
<p>If you generate new keys, your website will be disconnected from its associated CaptainForm account. You will need to activate a new CaptainForm account.</p>
|
23 |
-
<p>Normally, you should not need to generate new keys. Please do this only when our Support Team asks you to do so.</p>
|
24 |
-
</div>
|
25 |
-
<table class="form-table">
|
26 |
-
<tr valign="top">
|
27 |
-
<td>Installation ID</td>
|
28 |
-
<td><code><?php echo $installation_id ?></code></td>
|
29 |
-
</tr>
|
30 |
-
<tr valign="top">
|
31 |
-
<td>Installation Key</td>
|
32 |
-
<td><code><?php echo $installation_key ?></code></td>
|
33 |
-
</tr>
|
34 |
-
<tr valign="top">
|
35 |
-
<td>Site URL</td>
|
36 |
-
<td><code><?php echo $site_url ?></code></td>
|
37 |
-
</tr>
|
38 |
-
<tr valign="top">
|
39 |
-
<td></td>
|
40 |
-
<td>
|
41 |
-
<a onclick="if(!confirm('Are you sure you want to do this? Please hit OK only after talking with our Support team (support@captainform.com).')) return false;" href="options-general.php?page=CaptainFormOptions&reset=true">
|
42 |
-
<button class="button button-primary">Generate New Keys</button>
|
43 |
-
</a>
|
44 |
-
</td>
|
45 |
-
</tr>
|
46 |
-
</table>
|
47 |
-
</div>
|
48 |
-
</div>
|
49 |
-
<?php
|
50 |
-
echo ob_get_clean();
|
51 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/publish_lightbox.php
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
<div class="cf_lightbox_cotainer">
|
2 |
-
<label class="lightbox_trigger">
|
3 |
-
<input type="checkbox" name="<?php echo $captainform_display_as_lightbox_name; ?>" class="cf_display_as_lightbox" value="1" <?php if (isset($display_as_lightbox) && ($display_as_lightbox == 1)): ?> checked="checked"<?php endif; ?>/>
|
4 |
-
<span class="lightbox_trigger_text">
|
5 |
-
Display as a lightbox
|
6 |
-
</span>
|
7 |
-
</label>
|
8 |
-
<div class="cf_triggers_container">
|
9 |
-
<div class="cf_lightbox_title">
|
10 |
-
<b>Lightbox trigger</b>
|
11 |
-
</div>
|
12 |
-
<div class="row">
|
13 |
-
<div class="cf_trigger_option">
|
14 |
-
<label>
|
15 |
-
<input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" <?php if ($captainform_selected_trigger == 0): ?> checked="checked" <?php endif; ?> class="cf_trigger" value="0" />
|
16 |
-
Text
|
17 |
-
</label>
|
18 |
-
</div>
|
19 |
-
<div class="cf_trigger_option">
|
20 |
-
<label>
|
21 |
-
<input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" class="cf_trigger" <?php if ($captainform_selected_trigger == 1): ?> checked="checked" <?php endif; ?> value="1" />
|
22 |
-
Click on image
|
23 |
-
</label>
|
24 |
-
</div>
|
25 |
-
<div class="cf_trigger_option">
|
26 |
-
<label>
|
27 |
-
<input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" class="cf_trigger" <?php if ($captainform_selected_trigger == 2): ?> checked="checked" <?php endif; ?> value="2" />
|
28 |
-
Floating button
|
29 |
-
</label>
|
30 |
-
</div>
|
31 |
-
<div class="cf_trigger_option">
|
32 |
-
<label>
|
33 |
-
<input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" class="cf_trigger" <?php if ($captainform_selected_trigger == 3): ?> checked="checked" <?php endif; ?> value="3" />
|
34 |
-
Auto popup
|
35 |
-
</label>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
<div class="cf_trigger_selected_option_container_big">
|
39 |
-
<div class="cf_trigger_selected_option_title">
|
40 |
-
Settings
|
41 |
-
</div>
|
42 |
-
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_0">
|
43 |
-
<!-- text -->
|
44 |
-
<div class="left">
|
45 |
-
<span class="label">
|
46 |
-
Text:
|
47 |
-
</span>
|
48 |
-
</div>
|
49 |
-
<div class="right">
|
50 |
-
<input type="text" name="<?php echo $captainform_trigger_0_name; ?>" class="cf_trigger_selected_option cf_trigger_0_text" value="<?php echo $captainform_trigger_0_text; ?>"/>
|
51 |
-
</div>
|
52 |
-
<div class="clear"></div>
|
53 |
-
</div>
|
54 |
-
<div class="clear"></div>
|
55 |
-
|
56 |
-
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_1">
|
57 |
-
<!-- image -->
|
58 |
-
<div class="left">
|
59 |
-
<span class="label">
|
60 |
-
Image :
|
61 |
-
</span>
|
62 |
-
</div>
|
63 |
-
<div class="right">
|
64 |
-
<input type="text" name="<?php echo $captainform_trigger_1_name; ?>" class="cf_trigger_1_url" value="<?php echo $captainform_trigger_1_url; ?>"/>
|
65 |
-
</div>
|
66 |
-
<div class="clear"></div>
|
67 |
-
</div>
|
68 |
-
<div class="clear"></div>
|
69 |
-
|
70 |
-
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_2">
|
71 |
-
<!-- floating button -->
|
72 |
-
<div class="left">
|
73 |
-
<span class="label">
|
74 |
-
Text:
|
75 |
-
</span>
|
76 |
-
</div>
|
77 |
-
<div class="right">
|
78 |
-
<input type="text" name="<?php echo $captainform_trigger_2_text_name; ?>" class="cf_trigger_2_text" value="<?php echo $captainform_trigger_2_text; ?>" />
|
79 |
-
</div>
|
80 |
-
<div class="clear"></div>
|
81 |
-
|
82 |
-
<div class="left">
|
83 |
-
<span class="label">
|
84 |
-
Position:
|
85 |
-
</span>
|
86 |
-
</div>
|
87 |
-
<div class="cf_trigger_2_container right">
|
88 |
-
<label class = "cf_trigger_2_label">
|
89 |
-
<input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>" class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 1): ?> checked="checked" <?php endif; ?> value="1" />
|
90 |
-
Left
|
91 |
-
</label>
|
92 |
-
<label class = "cf_trigger_2_label">
|
93 |
-
<input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>" class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 2): ?> checked="checked" <?php endif; ?> value="2" />
|
94 |
-
Right
|
95 |
-
</label>
|
96 |
-
<label class = "cf_trigger_2_label">
|
97 |
-
<input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>" class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 3): ?> checked="checked" <?php endif; ?> value="3" />
|
98 |
-
Bottom
|
99 |
-
</label>
|
100 |
-
</div>
|
101 |
-
<div class="clear"></div>
|
102 |
-
|
103 |
-
<div class="left">
|
104 |
-
<span class="label">
|
105 |
-
Background color:
|
106 |
-
</span>
|
107 |
-
</div>
|
108 |
-
<div class="right">
|
109 |
-
<input type="text" name="<?php echo $captainform_trigger_2_background_name; ?>" class="color cf_trigger_2_background_color" value="<?php echo $captainform_trigger_2_background; ?>"/>
|
110 |
-
</div>
|
111 |
-
<div class="clear"></div>
|
112 |
-
|
113 |
-
<div class="left">
|
114 |
-
<span class="label">
|
115 |
-
Text color:
|
116 |
-
</span>
|
117 |
-
</div>
|
118 |
-
<div class="right">
|
119 |
-
<input type="text" name="<?php echo $captainform_trigger_2_color_name; ?>" class="color cf_trigger_2_color" value="<?php echo $captainform_trigger_2_color; ?>"/>
|
120 |
-
</div>
|
121 |
-
<div class="clear"></div>
|
122 |
-
</div>
|
123 |
-
<div class="clear"></div>
|
124 |
-
|
125 |
-
<div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_3">
|
126 |
-
<!-- auto popup -->
|
127 |
-
<div class="left">
|
128 |
-
<span class="label">
|
129 |
-
After :
|
130 |
-
</span>
|
131 |
-
</div>
|
132 |
-
<div class="right">
|
133 |
-
<input type="text" name="<?php echo $captainform_trigger_3_after_name; ?>" class="cf_trigger_selected_option cf_trigger_2_time" value="<?php echo $captainform_trigger_3_after; ?>"/>
|
134 |
-
<span class="captainform_seconds">seconds</span>
|
135 |
-
</div>
|
136 |
-
<div class="clear"></div>
|
137 |
-
</div>
|
138 |
-
<div class="clear"></div>
|
139 |
-
</div>
|
140 |
-
|
141 |
-
</div>
|
142 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|