Version Description
- Fixed https://github.com/ColorlibHQ/colorlib-login-customizer/issues/30
- Fixed https://github.com/ColorlibHQ/colorlib-login-customizer/issues/41
- Added https://github.com/ColorlibHQ/colorlib-login-customizer/issues/27
Download this release
Release Info
Developer | machothemes |
Plugin | Custom Login Page Customizer by Colorlib |
Version | 1.2.4 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.4
- LICENSE +674 -674
- assets/css/clc-customizer-previewer.css +41 -41
- assets/css/clc-customizer.css +435 -435
- assets/css/jquery.minicolors.css +320 -320
- assets/js/clc-customizer.js +321 -321
- assets/js/clc-preview.js +214 -186
- assets/js/jquery.minicolors.js +1109 -1109
- assets/js/jquery.minicolors.min.js +8 -8
- colorlib-login-customizer.php +46 -46
- includes/class-colorlib-login-customizer-autoloader.php +46 -46
- includes/class-colorlib-login-customizer-feedback.php +262 -262
- includes/class-colorlib-login-customizer-plugin-request.php +225 -225
- includes/class-colorlib-login-customizer.php +274 -274
- includes/index.php +3 -3
- includes/lib/class-colorlib-login-customizer-css-customization.php +941 -875
- includes/lib/class-colorlib-login-customizer-customizer.php +940 -917
- includes/lib/class-colorlib-login-customizer-settings.php +142 -142
- includes/lib/controls/class-colorlib-login-customizer-background-control.php +51 -51
- includes/lib/controls/class-colorlib-login-customizer-button-group-control.php +117 -117
- includes/lib/controls/class-colorlib-login-customizer-column-width.php +93 -93
- includes/lib/controls/class-colorlib-login-customizer-control-color-picker.php +92 -92
- includes/lib/controls/class-colorlib-login-customizer-control-toggle.php +81 -81
- includes/lib/controls/class-colorlib-login-customizer-range-slider-control.php +112 -112
- includes/lib/controls/class-colorlib-login-customizer-template-control.php +137 -137
- includes/login-template.php +221 -217
- readme.txt +121 -123
- uninstall.php +17 -17
LICENSE
CHANGED
@@ -1,674 +1,674 @@
|
|
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 |
-
{project} Copyright (C) {year} {fullname}
|
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>.
|
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 |
+
{project} Copyright (C) {year} {fullname}
|
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>.
|
assets/css/clc-customizer-previewer.css
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
.clc-general-actions {
|
2 |
-
position: absolute;
|
3 |
-
top: 10px;
|
4 |
-
left: 10px;
|
5 |
-
z-index: 99;
|
6 |
-
}
|
7 |
-
|
8 |
-
.clc-preview-event {
|
9 |
-
cursor: pointer;
|
10 |
-
background-color: #008ec2;
|
11 |
-
border-radius: 100%;
|
12 |
-
color: #fff;
|
13 |
-
width: 30px;
|
14 |
-
height: 30px;
|
15 |
-
text-align: center;
|
16 |
-
border: 2px solid #fff;
|
17 |
-
box-shadow: 0 2px 1px rgba(46,68,83,.15);
|
18 |
-
}
|
19 |
-
.clc-preview-event > span {
|
20 |
-
margin-top: 5px;
|
21 |
-
}
|
22 |
-
|
23 |
-
.clc-general-actions > .clc-preview-event {
|
24 |
-
display: inline-block;
|
25 |
-
}
|
26 |
-
.login h1 a {
|
27 |
-
text-indent: initial;
|
28 |
-
position: relative;
|
29 |
-
overflow: visible;
|
30 |
-
}
|
31 |
-
.login h1 a .clc-preview-event {
|
32 |
-
position: absolute;
|
33 |
-
left: -15px;
|
34 |
-
top: -15px;
|
35 |
-
}
|
36 |
-
.login h1 a #logo-text {
|
37 |
-
display: none;
|
38 |
-
}
|
39 |
-
.login.clc-text-logo h1 a #logo-text {
|
40 |
-
display: block;
|
41 |
-
}
|
1 |
+
.clc-general-actions {
|
2 |
+
position: absolute;
|
3 |
+
top: 10px;
|
4 |
+
left: 10px;
|
5 |
+
z-index: 99;
|
6 |
+
}
|
7 |
+
|
8 |
+
.clc-preview-event {
|
9 |
+
cursor: pointer;
|
10 |
+
background-color: #008ec2;
|
11 |
+
border-radius: 100%;
|
12 |
+
color: #fff;
|
13 |
+
width: 30px;
|
14 |
+
height: 30px;
|
15 |
+
text-align: center;
|
16 |
+
border: 2px solid #fff;
|
17 |
+
box-shadow: 0 2px 1px rgba(46,68,83,.15);
|
18 |
+
}
|
19 |
+
.clc-preview-event > span {
|
20 |
+
margin-top: 5px;
|
21 |
+
}
|
22 |
+
|
23 |
+
.clc-general-actions > .clc-preview-event {
|
24 |
+
display: inline-block;
|
25 |
+
}
|
26 |
+
.login h1 a {
|
27 |
+
text-indent: initial;
|
28 |
+
position: relative;
|
29 |
+
overflow: visible;
|
30 |
+
}
|
31 |
+
.login h1 a .clc-preview-event {
|
32 |
+
position: absolute;
|
33 |
+
left: -15px;
|
34 |
+
top: -15px;
|
35 |
+
}
|
36 |
+
.login h1 a #logo-text {
|
37 |
+
display: none;
|
38 |
+
}
|
39 |
+
.login.clc-text-logo h1 a #logo-text {
|
40 |
+
display: block;
|
41 |
+
}
|
assets/css/clc-customizer.css
CHANGED
@@ -1,436 +1,436 @@
|
|
1 |
-
.customize-control-clc-range-slider input[type="text"] {
|
2 |
-
border: none;
|
3 |
-
text-align: center;
|
4 |
-
padding: 2px;
|
5 |
-
margin: 0;
|
6 |
-
font-size: 12px;
|
7 |
-
color: #333;
|
8 |
-
border-radius: 10px;
|
9 |
-
background-color: rgb(248, 248, 248);
|
10 |
-
-webkit-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
|
11 |
-
-moz-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
|
12 |
-
box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
|
13 |
-
width: 42px;
|
14 |
-
height: 22px;
|
15 |
-
}
|
16 |
-
|
17 |
-
.customize-control-clc-range-slider .ui-slider {
|
18 |
-
position: relative;
|
19 |
-
text-align: left;
|
20 |
-
height: 2px;
|
21 |
-
border-radius: 3px;
|
22 |
-
border: none;
|
23 |
-
margin-top: 10px;
|
24 |
-
margin-left: 10px;
|
25 |
-
display: inline-block;
|
26 |
-
width: 202px;
|
27 |
-
background: #d6d6d6;
|
28 |
-
}
|
29 |
-
|
30 |
-
.customize-control-clc-range-slider .ui-slider .ui-slider-handle {
|
31 |
-
position: absolute;
|
32 |
-
z-index: 2;
|
33 |
-
top: -10px;
|
34 |
-
cursor: default;
|
35 |
-
-ms-touch-action: none;
|
36 |
-
touch-action: none;
|
37 |
-
width: 18px;
|
38 |
-
height: 18px;
|
39 |
-
-webkit-border-radius: 9px;
|
40 |
-
-moz-border-radius: 9px;
|
41 |
-
border-radius: 9px;
|
42 |
-
background-color: #fff;
|
43 |
-
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
|
44 |
-
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
|
45 |
-
box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
|
46 |
-
border: solid 1px #d7d7d7;
|
47 |
-
transform: translateX(-50%);
|
48 |
-
}
|
49 |
-
|
50 |
-
.customize-control-clc-range-slider .ui-slider .ui-slider-range {
|
51 |
-
position: absolute;
|
52 |
-
z-index: 1;
|
53 |
-
font-size: 0.7em;
|
54 |
-
display: block;
|
55 |
-
border: 0;
|
56 |
-
background-position: 0 0;
|
57 |
-
background: #E04D43;
|
58 |
-
top: 0;
|
59 |
-
bottom: 0;
|
60 |
-
}
|
61 |
-
|
62 |
-
.clc-tooltip {
|
63 |
-
width: 150px;
|
64 |
-
position: absolute;
|
65 |
-
background: #55AAD3;
|
66 |
-
color: #EEE;
|
67 |
-
font-size: 12px;
|
68 |
-
min-height: 50px;
|
69 |
-
border-radius: 5px;
|
70 |
-
left: -75px; /* half of its width */
|
71 |
-
bottom: 25px;
|
72 |
-
z-index: 10;
|
73 |
-
display: none;
|
74 |
-
padding: 12px;
|
75 |
-
line-height: 1.5;
|
76 |
-
font-family: 'Arial', sans-serif;
|
77 |
-
}
|
78 |
-
|
79 |
-
.accordion-section-content > li:nth-of-type(2) .clc-tooltip {
|
80 |
-
bottom: initial;
|
81 |
-
top: 25px;
|
82 |
-
}
|
83 |
-
|
84 |
-
.dashicons.dashicons-editor-help {
|
85 |
-
cursor: pointer;
|
86 |
-
color: #55AAD3;
|
87 |
-
}
|
88 |
-
|
89 |
-
.dashicons.dashicons-editor-help:hover > .clc-tooltip {
|
90 |
-
display: block;
|
91 |
-
}
|
92 |
-
|
93 |
-
.predefined-color-schemes-container {
|
94 |
-
padding: 10px;
|
95 |
-
}
|
96 |
-
|
97 |
-
.predefined-color-schemes-container .ml-color-schemes-list {
|
98 |
-
list-style-type: none;
|
99 |
-
display: inline-block;
|
100 |
-
text-align: center;
|
101 |
-
}
|
102 |
-
|
103 |
-
.predefined-color-schemes-container .ml-color-schemes-list li {
|
104 |
-
display: inline-block;
|
105 |
-
text-align: center;
|
106 |
-
}
|
107 |
-
|
108 |
-
.predefined-color-schemes-container .ml-color-schemes-list a img {
|
109 |
-
width: 50px;
|
110 |
-
}
|
111 |
-
|
112 |
-
.customize-control-clc-templates {
|
113 |
-
margin-bottom: 0;
|
114 |
-
margin-top: -6px;
|
115 |
-
position: relative;
|
116 |
-
}
|
117 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates {
|
118 |
-
margin-left: -3px;
|
119 |
-
overflow-y: scroll;
|
120 |
-
padding-left: 3px;
|
121 |
-
padding-right: 3px;
|
122 |
-
padding-top: 3px;
|
123 |
-
width: calc(100% + 1px);
|
124 |
-
}
|
125 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__input {
|
126 |
-
display: none !important;
|
127 |
-
}
|
128 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__input:checked + label {
|
129 |
-
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.7);
|
130 |
-
}
|
131 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__label {
|
132 |
-
border-radius: 1px;
|
133 |
-
border: 1px solid transparent;
|
134 |
-
box-shadow: 0 0 0 0 #5b9dd9, 0 0 0 0 rgba(30, 140, 190, 0.8);
|
135 |
-
cursor: pointer;
|
136 |
-
display: block;
|
137 |
-
margin: 0 0 8px;
|
138 |
-
transition: border-color 100ms, box-shadow 100ms cubic-bezier(0.455, 0.03, 0.515, 0.955), transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
139 |
-
}
|
140 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__label:hover {
|
141 |
-
box-shadow: 0 0 0 1px #5b9dd9, 0 0 3px rgba(0, 115, 170, 0.8);
|
142 |
-
}
|
143 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__label:active {
|
144 |
-
transform: scale(0.985);
|
145 |
-
}
|
146 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__screenshot {
|
147 |
-
background-position: center center;
|
148 |
-
background-repeat: no-repeat;
|
149 |
-
background-size: contain;
|
150 |
-
border: 2px solid #eee;
|
151 |
-
border-radius: 3px;
|
152 |
-
bottom: 0;
|
153 |
-
left: 0;
|
154 |
-
position: absolute;
|
155 |
-
right: 0;
|
156 |
-
top: 0;
|
157 |
-
}
|
158 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__intrinsic {
|
159 |
-
line-height: 0;
|
160 |
-
margin-bottom: 0;
|
161 |
-
overflow: hidden;
|
162 |
-
position: relative;
|
163 |
-
}
|
164 |
-
.customize-control-clc-templates .colorlib-login-customizer-templates__intrinsic:after {
|
165 |
-
content: "";
|
166 |
-
display: block;
|
167 |
-
padding-top: 70.4%;
|
168 |
-
}
|
169 |
-
|
170 |
-
/* Group Button */
|
171 |
-
.colorlib-login-customizer-control-group {
|
172 |
-
width: 100%;
|
173 |
-
height: 33px;
|
174 |
-
background: #FEFEFE;
|
175 |
-
border-radius: 3px;
|
176 |
-
line-height: 35px;
|
177 |
-
cursor: pointer;
|
178 |
-
box-sizing: border-box;
|
179 |
-
border: solid 1px rgba(219, 219, 219, 0.9);
|
180 |
-
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.06);
|
181 |
-
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.06);
|
182 |
-
box-shadow: 0 0 4px rgba(0, 0, 0, 0.06);
|
183 |
-
height: 35px;
|
184 |
-
}
|
185 |
-
|
186 |
-
.colorlib-login-customizer-control-group a {
|
187 |
-
float: left;
|
188 |
-
height: 33px;
|
189 |
-
background: rgba(150, 180, 150, 0);
|
190 |
-
text-align: center;
|
191 |
-
text-decoration: none;
|
192 |
-
}
|
193 |
-
.colorlib-login-customizer-control-group.colorlib-login-customizer-group-four a {
|
194 |
-
width: 25%;
|
195 |
-
}
|
196 |
-
|
197 |
-
.colorlib-login-customizer-control-group.colorlib-login-customizer-group-three a {
|
198 |
-
width: 33.333333%;
|
199 |
-
}
|
200 |
-
|
201 |
-
.colorlib-login-customizer-control-group.colorlib-login-customizer-group-two a {
|
202 |
-
width: 50%;
|
203 |
-
}
|
204 |
-
.colorlib-login-customizer-control-group a.active {
|
205 |
-
background-color: #fefefe;
|
206 |
-
-webkit-box-shadow: inset 0 3px 0px #57a7c9, inset 2px 0px 5px 0px rgba(0, 0, 0, 0.05), inset -2px 0px 5px 0px rgba(0, 0, 0, 0.05);
|
207 |
-
-moz-box-shadow: inset 0 3px 0px #57a7c9, inset 2px 0px 5px 0px rgba(0, 0, 0, 0.05), inset -2px 0px 5px 0px rgba(0, 0, 0, 0.05);
|
208 |
-
box-shadow: inset 0 3px 0px #57a7c9, inset 2px 0px 5px 0px rgba(0, 0, 0, 0.05), inset -2px 0px 5px 0px rgba(0, 0, 0, 0.05); }
|
209 |
-
|
210 |
-
/* Toggle */
|
211 |
-
.customize-control-title.onoffswitch_label {
|
212 |
-
display: block;
|
213 |
-
float: left;
|
214 |
-
margin: 0;
|
215 |
-
height: 22px;
|
216 |
-
line-height: 22px; }
|
217 |
-
|
218 |
-
.onoffswitch_label {
|
219 |
-
display: block; }
|
220 |
-
|
221 |
-
.onoffswitch {
|
222 |
-
position: relative;
|
223 |
-
width: 52px;
|
224 |
-
display: block;
|
225 |
-
float: right;
|
226 |
-
-webkit-user-select: none;
|
227 |
-
-moz-user-select: none;
|
228 |
-
-ms-user-select: none; }
|
229 |
-
|
230 |
-
.onoffswitch-checkbox {
|
231 |
-
display: none !important; }
|
232 |
-
|
233 |
-
.onoffswitch-label {
|
234 |
-
display: block;
|
235 |
-
overflow: hidden;
|
236 |
-
cursor: pointer;
|
237 |
-
height: 22px;
|
238 |
-
padding: 0;
|
239 |
-
line-height: 19px;
|
240 |
-
transition: background-color 0.2s ease-in;
|
241 |
-
-webkit-border-radius: 11px;
|
242 |
-
-moz-border-radius: 11px;
|
243 |
-
border-radius: 30px;
|
244 |
-
background-color: #c4c4c4;
|
245 |
-
-webkit-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11);
|
246 |
-
-moz-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11);
|
247 |
-
box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11); }
|
248 |
-
.onoffswitch-label:before {
|
249 |
-
content: "";
|
250 |
-
display: block;
|
251 |
-
width: 18px;
|
252 |
-
height: 18px;
|
253 |
-
margin: 0;
|
254 |
-
position: absolute;
|
255 |
-
top: 2px;
|
256 |
-
bottom: 0;
|
257 |
-
right: 32px;
|
258 |
-
background-color: #fff;
|
259 |
-
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
260 |
-
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
261 |
-
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
262 |
-
-webkit-border-radius: 10px;
|
263 |
-
-moz-border-radius: 10px;
|
264 |
-
border-radius: 10px;
|
265 |
-
transition: all 0.2s ease-in 0s; }
|
266 |
-
.onoffswitch-label:after {
|
267 |
-
content: "OFF";
|
268 |
-
display: block;
|
269 |
-
color: #FFF;
|
270 |
-
position: absolute;
|
271 |
-
top: 2px;
|
272 |
-
bottom: 2px;
|
273 |
-
right: 6px;
|
274 |
-
font-size: 11px;
|
275 |
-
font-family: 'Arial'; }
|
276 |
-
|
277 |
-
.onoffswitch-checkbox:checked + .onoffswitch-label {
|
278 |
-
background-color: #3caf0e; }
|
279 |
-
|
280 |
-
.onoffswitch-checkbox:checked + .onoffswitch-label,
|
281 |
-
.onoffswitch-checkbox:checked + .onoffswitch-label:before {
|
282 |
-
border-color: #3caf0e; }
|
283 |
-
|
284 |
-
.onoffswitch-checkbox:checked + .onoffswitch-label:before {
|
285 |
-
right: 2px; }
|
286 |
-
|
287 |
-
.onoffswitch-checkbox:checked + .onoffswitch-label:after {
|
288 |
-
content: "ON";
|
289 |
-
display: block;
|
290 |
-
color: #FFF;
|
291 |
-
position: absolute;
|
292 |
-
top: 2px;
|
293 |
-
bottom: 2px;
|
294 |
-
right: 27px;
|
295 |
-
font-size: 11px;
|
296 |
-
font-family: 'Arial'; }
|
297 |
-
|
298 |
-
/* Color Picker */
|
299 |
-
.clc-color-picker-title {
|
300 |
-
margin-left: 42px;
|
301 |
-
margin-bottom: 0 !important;
|
302 |
-
line-height: 24px !important;
|
303 |
-
}
|
304 |
-
.clc-color-picker-title .clc-color-picker-description {
|
305 |
-
font-size: 13px;
|
306 |
-
line-height: 16px;
|
307 |
-
font-weight: initial;
|
308 |
-
color: #959696;
|
309 |
-
display: block; }
|
310 |
-
.clc-color-picker-title .clc-color-picker-default {
|
311 |
-
font-style: italic;
|
312 |
-
font-weight: 300;
|
313 |
-
color: #959696;
|
314 |
-
cursor: pointer; }
|
315 |
-
.clc-color-picker-title .clc-color-picker-default:hover, .clc-color-picker-title .clc-color-picker-default:focus {
|
316 |
-
color: #55AAD3; }
|
317 |
-
|
318 |
-
.minicolors-theme-default {
|
319 |
-
display: block !important; }
|
320 |
-
.minicolors-theme-default .clc-color-picker {
|
321 |
-
z-index: 100;
|
322 |
-
position: absolute;
|
323 |
-
top: -20px;
|
324 |
-
left: 50px;
|
325 |
-
opacity: 0;
|
326 |
-
visibility: hidden;
|
327 |
-
width: 153px !important;
|
328 |
-
padding: 5px;
|
329 |
-
transition: all .1s ease-in; }
|
330 |
-
.minicolors-theme-default.minicolors-focus .clc-color-picker {
|
331 |
-
opacity: 1;
|
332 |
-
visibility: visible; }
|
333 |
-
.minicolors-theme-default .minicolors-input-swatch {
|
334 |
-
width: 30px;
|
335 |
-
height: 22px;
|
336 |
-
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
|
337 |
-
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
|
338 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
|
339 |
-
cursor: pointer; }
|
340 |
-
|
341 |
-
.lite {
|
342 |
-
opacity: 0;
|
343 |
-
visibility: hidden; }
|
344 |
-
|
345 |
-
.minicolors-position-left .minicolors-panel {
|
346 |
-
left: 50px; }
|
347 |
-
.customize-control-clc-color-picker {
|
348 |
-
padding: 18px 0 6px 0; }
|
349 |
-
|
350 |
-
/* Layout Columns */
|
351 |
-
.clc-layouts-container-advanced .clc-layouts-setup {
|
352 |
-
display: inline-block;
|
353 |
-
width: 100%;
|
354 |
-
}
|
355 |
-
.clc-layouts-container-advanced .clc-column {
|
356 |
-
border-right: 4px solid #f4f4f4;
|
357 |
-
float: left;
|
358 |
-
position: relative;
|
359 |
-
box-sizing: border-box;
|
360 |
-
height: 40px;
|
361 |
-
background-color: #cacaca;
|
362 |
-
-webkit-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.15);
|
363 |
-
-moz-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.15);
|
364 |
-
box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.15);
|
365 |
-
text-align: center;
|
366 |
-
}
|
367 |
-
.clc-layouts-container-advanced .clc-column.col12 {
|
368 |
-
width: 100%;
|
369 |
-
}
|
370 |
-
.clc-layouts-container-advanced .clc-column.col11 {
|
371 |
-
width: 91.66666667%;
|
372 |
-
}
|
373 |
-
.clc-layouts-container-advanced .clc-column.col10 {
|
374 |
-
width: 83.33333333%;
|
375 |
-
}
|
376 |
-
.clc-layouts-container-advanced .clc-column.col9 {
|
377 |
-
width: 75%;
|
378 |
-
}
|
379 |
-
.clc-layouts-container-advanced .clc-column.col8 {
|
380 |
-
width: 66.66666667%;
|
381 |
-
}
|
382 |
-
.clc-layouts-container-advanced .clc-column.col7 {
|
383 |
-
width: 58.33333333%;
|
384 |
-
}
|
385 |
-
.clc-layouts-container-advanced .clc-column.col6 {
|
386 |
-
width: 50%; }
|
387 |
-
.clc-layouts-container-advanced .clc-column.col5 {
|
388 |
-
width: 41.66666667%;
|
389 |
-
}
|
390 |
-
.clc-layouts-container-advanced .clc-column.col4 {
|
391 |
-
width: 33.33333333%;
|
392 |
-
}
|
393 |
-
.clc-layouts-container-advanced .clc-column.col3 {
|
394 |
-
width: 25%;
|
395 |
-
}
|
396 |
-
.clc-layouts-container-advanced .clc-column.col2 {
|
397 |
-
width: 16.66666667%;
|
398 |
-
}
|
399 |
-
.clc-layouts-container-advanced .clc-column.col1 {
|
400 |
-
width: 8.33333333%;
|
401 |
-
}
|
402 |
-
.clc-layouts-container-advanced .clc-column a {
|
403 |
-
opacity: .2;
|
404 |
-
width: 17px;
|
405 |
-
height: 17px;
|
406 |
-
-webkit-border-radius: 3px;
|
407 |
-
-moz-border-radius: 3px;
|
408 |
-
border-radius: 3px;
|
409 |
-
background-color: #e14d43;
|
410 |
-
color: #fff;
|
411 |
-
position: absolute;
|
412 |
-
top: 50%;
|
413 |
-
left: 2%;
|
414 |
-
-webkit-transform: translate(0%, -50%);
|
415 |
-
-ms-transform: translate(0%, -50%);
|
416 |
-
-o-transform: translate(0%, -50%);
|
417 |
-
transform: translate(0%, -50%);
|
418 |
-
-webkit-transition: opacity .2s;
|
419 |
-
transition: opacity .2s;
|
420 |
-
}
|
421 |
-
.clc-layouts-container-advanced .clc-column a .dashicons {
|
422 |
-
font-size: 12px;
|
423 |
-
line-height: 17px;
|
424 |
-
width: initial;
|
425 |
-
height: initial;
|
426 |
-
}
|
427 |
-
.clc-layouts-container-advanced .clc-column.clc-column-left a {
|
428 |
-
left: auto;
|
429 |
-
right: 2%;
|
430 |
-
}
|
431 |
-
.clc-layouts-container-advanced .clc-column:hover > a,
|
432 |
-
.clc-layouts-container-advanced .clc-column:focus > a {
|
433 |
-
opacity: 1;
|
434 |
-
-webkit-transition: opacity .2s;
|
435 |
-
transition: opacity .2s;
|
436 |
}
|
1 |
+
.customize-control-clc-range-slider input[type="text"] {
|
2 |
+
border: none;
|
3 |
+
text-align: center;
|
4 |
+
padding: 2px;
|
5 |
+
margin: 0;
|
6 |
+
font-size: 12px;
|
7 |
+
color: #333;
|
8 |
+
border-radius: 10px;
|
9 |
+
background-color: rgb(248, 248, 248);
|
10 |
+
-webkit-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
|
11 |
+
-moz-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
|
12 |
+
box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
|
13 |
+
width: 42px;
|
14 |
+
height: 22px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.customize-control-clc-range-slider .ui-slider {
|
18 |
+
position: relative;
|
19 |
+
text-align: left;
|
20 |
+
height: 2px;
|
21 |
+
border-radius: 3px;
|
22 |
+
border: none;
|
23 |
+
margin-top: 10px;
|
24 |
+
margin-left: 10px;
|
25 |
+
display: inline-block;
|
26 |
+
width: 202px;
|
27 |
+
background: #d6d6d6;
|
28 |
+
}
|
29 |
+
|
30 |
+
.customize-control-clc-range-slider .ui-slider .ui-slider-handle {
|
31 |
+
position: absolute;
|
32 |
+
z-index: 2;
|
33 |
+
top: -10px;
|
34 |
+
cursor: default;
|
35 |
+
-ms-touch-action: none;
|
36 |
+
touch-action: none;
|
37 |
+
width: 18px;
|
38 |
+
height: 18px;
|
39 |
+
-webkit-border-radius: 9px;
|
40 |
+
-moz-border-radius: 9px;
|
41 |
+
border-radius: 9px;
|
42 |
+
background-color: #fff;
|
43 |
+
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
|
44 |
+
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
|
45 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
|
46 |
+
border: solid 1px #d7d7d7;
|
47 |
+
transform: translateX(-50%);
|
48 |
+
}
|
49 |
+
|
50 |
+
.customize-control-clc-range-slider .ui-slider .ui-slider-range {
|
51 |
+
position: absolute;
|
52 |
+
z-index: 1;
|
53 |
+
font-size: 0.7em;
|
54 |
+
display: block;
|
55 |
+
border: 0;
|
56 |
+
background-position: 0 0;
|
57 |
+
background: #E04D43;
|
58 |
+
top: 0;
|
59 |
+
bottom: 0;
|
60 |
+
}
|
61 |
+
|
62 |
+
.clc-tooltip {
|
63 |
+
width: 150px;
|
64 |
+
position: absolute;
|
65 |
+
background: #55AAD3;
|
66 |
+
color: #EEE;
|
67 |
+
font-size: 12px;
|
68 |
+
min-height: 50px;
|
69 |
+
border-radius: 5px;
|
70 |
+
left: -75px; /* half of its width */
|
71 |
+
bottom: 25px;
|
72 |
+
z-index: 10;
|
73 |
+
display: none;
|
74 |
+
padding: 12px;
|
75 |
+
line-height: 1.5;
|
76 |
+
font-family: 'Arial', sans-serif;
|
77 |
+
}
|
78 |
+
|
79 |
+
.accordion-section-content > li:nth-of-type(2) .clc-tooltip {
|
80 |
+
bottom: initial;
|
81 |
+
top: 25px;
|
82 |
+
}
|
83 |
+
|
84 |
+
.dashicons.dashicons-editor-help {
|
85 |
+
cursor: pointer;
|
86 |
+
color: #55AAD3;
|
87 |
+
}
|
88 |
+
|
89 |
+
.dashicons.dashicons-editor-help:hover > .clc-tooltip {
|
90 |
+
display: block;
|
91 |
+
}
|
92 |
+
|
93 |
+
.predefined-color-schemes-container {
|
94 |
+
padding: 10px;
|
95 |
+
}
|
96 |
+
|
97 |
+
.predefined-color-schemes-container .ml-color-schemes-list {
|
98 |
+
list-style-type: none;
|
99 |
+
display: inline-block;
|
100 |
+
text-align: center;
|
101 |
+
}
|
102 |
+
|
103 |
+
.predefined-color-schemes-container .ml-color-schemes-list li {
|
104 |
+
display: inline-block;
|
105 |
+
text-align: center;
|
106 |
+
}
|
107 |
+
|
108 |
+
.predefined-color-schemes-container .ml-color-schemes-list a img {
|
109 |
+
width: 50px;
|
110 |
+
}
|
111 |
+
|
112 |
+
.customize-control-clc-templates {
|
113 |
+
margin-bottom: 0;
|
114 |
+
margin-top: -6px;
|
115 |
+
position: relative;
|
116 |
+
}
|
117 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates {
|
118 |
+
margin-left: -3px;
|
119 |
+
overflow-y: scroll;
|
120 |
+
padding-left: 3px;
|
121 |
+
padding-right: 3px;
|
122 |
+
padding-top: 3px;
|
123 |
+
width: calc(100% + 1px);
|
124 |
+
}
|
125 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__input {
|
126 |
+
display: none !important;
|
127 |
+
}
|
128 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__input:checked + label {
|
129 |
+
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.7);
|
130 |
+
}
|
131 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__label {
|
132 |
+
border-radius: 1px;
|
133 |
+
border: 1px solid transparent;
|
134 |
+
box-shadow: 0 0 0 0 #5b9dd9, 0 0 0 0 rgba(30, 140, 190, 0.8);
|
135 |
+
cursor: pointer;
|
136 |
+
display: block;
|
137 |
+
margin: 0 0 8px;
|
138 |
+
transition: border-color 100ms, box-shadow 100ms cubic-bezier(0.455, 0.03, 0.515, 0.955), transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
139 |
+
}
|
140 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__label:hover {
|
141 |
+
box-shadow: 0 0 0 1px #5b9dd9, 0 0 3px rgba(0, 115, 170, 0.8);
|
142 |
+
}
|
143 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__label:active {
|
144 |
+
transform: scale(0.985);
|
145 |
+
}
|
146 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__screenshot {
|
147 |
+
background-position: center center;
|
148 |
+
background-repeat: no-repeat;
|
149 |
+
background-size: contain;
|
150 |
+
border: 2px solid #eee;
|
151 |
+
border-radius: 3px;
|
152 |
+
bottom: 0;
|
153 |
+
left: 0;
|
154 |
+
position: absolute;
|
155 |
+
right: 0;
|
156 |
+
top: 0;
|
157 |
+
}
|
158 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__intrinsic {
|
159 |
+
line-height: 0;
|
160 |
+
margin-bottom: 0;
|
161 |
+
overflow: hidden;
|
162 |
+
position: relative;
|
163 |
+
}
|
164 |
+
.customize-control-clc-templates .colorlib-login-customizer-templates__intrinsic:after {
|
165 |
+
content: "";
|
166 |
+
display: block;
|
167 |
+
padding-top: 70.4%;
|
168 |
+
}
|
169 |
+
|
170 |
+
/* Group Button */
|
171 |
+
.colorlib-login-customizer-control-group {
|
172 |
+
width: 100%;
|
173 |
+
height: 33px;
|
174 |
+
background: #FEFEFE;
|
175 |
+
border-radius: 3px;
|
176 |
+
line-height: 35px;
|
177 |
+
cursor: pointer;
|
178 |
+
box-sizing: border-box;
|
179 |
+
border: solid 1px rgba(219, 219, 219, 0.9);
|
180 |
+
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.06);
|
181 |
+
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.06);
|
182 |
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.06);
|
183 |
+
height: 35px;
|
184 |
+
}
|
185 |
+
|
186 |
+
.colorlib-login-customizer-control-group a {
|
187 |
+
float: left;
|
188 |
+
height: 33px;
|
189 |
+
background: rgba(150, 180, 150, 0);
|
190 |
+
text-align: center;
|
191 |
+
text-decoration: none;
|
192 |
+
}
|
193 |
+
.colorlib-login-customizer-control-group.colorlib-login-customizer-group-four a {
|
194 |
+
width: 25%;
|
195 |
+
}
|
196 |
+
|
197 |
+
.colorlib-login-customizer-control-group.colorlib-login-customizer-group-three a {
|
198 |
+
width: 33.333333%;
|
199 |
+
}
|
200 |
+
|
201 |
+
.colorlib-login-customizer-control-group.colorlib-login-customizer-group-two a {
|
202 |
+
width: 50%;
|
203 |
+
}
|
204 |
+
.colorlib-login-customizer-control-group a.active {
|
205 |
+
background-color: #fefefe;
|
206 |
+
-webkit-box-shadow: inset 0 3px 0px #57a7c9, inset 2px 0px 5px 0px rgba(0, 0, 0, 0.05), inset -2px 0px 5px 0px rgba(0, 0, 0, 0.05);
|
207 |
+
-moz-box-shadow: inset 0 3px 0px #57a7c9, inset 2px 0px 5px 0px rgba(0, 0, 0, 0.05), inset -2px 0px 5px 0px rgba(0, 0, 0, 0.05);
|
208 |
+
box-shadow: inset 0 3px 0px #57a7c9, inset 2px 0px 5px 0px rgba(0, 0, 0, 0.05), inset -2px 0px 5px 0px rgba(0, 0, 0, 0.05); }
|
209 |
+
|
210 |
+
/* Toggle */
|
211 |
+
.customize-control-title.onoffswitch_label {
|
212 |
+
display: block;
|
213 |
+
float: left;
|
214 |
+
margin: 0;
|
215 |
+
height: 22px;
|
216 |
+
line-height: 22px; }
|
217 |
+
|
218 |
+
.onoffswitch_label {
|
219 |
+
display: block; }
|
220 |
+
|
221 |
+
.onoffswitch {
|
222 |
+
position: relative;
|
223 |
+
width: 52px;
|
224 |
+
display: block;
|
225 |
+
float: right;
|
226 |
+
-webkit-user-select: none;
|
227 |
+
-moz-user-select: none;
|
228 |
+
-ms-user-select: none; }
|
229 |
+
|
230 |
+
.onoffswitch-checkbox {
|
231 |
+
display: none !important; }
|
232 |
+
|
233 |
+
.onoffswitch-label {
|
234 |
+
display: block;
|
235 |
+
overflow: hidden;
|
236 |
+
cursor: pointer;
|
237 |
+
height: 22px;
|
238 |
+
padding: 0;
|
239 |
+
line-height: 19px;
|
240 |
+
transition: background-color 0.2s ease-in;
|
241 |
+
-webkit-border-radius: 11px;
|
242 |
+
-moz-border-radius: 11px;
|
243 |
+
border-radius: 30px;
|
244 |
+
background-color: #c4c4c4;
|
245 |
+
-webkit-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11);
|
246 |
+
-moz-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11);
|
247 |
+
box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11); }
|
248 |
+
.onoffswitch-label:before {
|
249 |
+
content: "";
|
250 |
+
display: block;
|
251 |
+
width: 18px;
|
252 |
+
height: 18px;
|
253 |
+
margin: 0;
|
254 |
+
position: absolute;
|
255 |
+
top: 2px;
|
256 |
+
bottom: 0;
|
257 |
+
right: 32px;
|
258 |
+
background-color: #fff;
|
259 |
+
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
260 |
+
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
261 |
+
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
262 |
+
-webkit-border-radius: 10px;
|
263 |
+
-moz-border-radius: 10px;
|
264 |
+
border-radius: 10px;
|
265 |
+
transition: all 0.2s ease-in 0s; }
|
266 |
+
.onoffswitch-label:after {
|
267 |
+
content: "OFF";
|
268 |
+
display: block;
|
269 |
+
color: #FFF;
|
270 |
+
position: absolute;
|
271 |
+
top: 2px;
|
272 |
+
bottom: 2px;
|
273 |
+
right: 6px;
|
274 |
+
font-size: 11px;
|
275 |
+
font-family: 'Arial'; }
|
276 |
+
|
277 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label {
|
278 |
+
background-color: #3caf0e; }
|
279 |
+
|
280 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label,
|
281 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label:before {
|
282 |
+
border-color: #3caf0e; }
|
283 |
+
|
284 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label:before {
|
285 |
+
right: 2px; }
|
286 |
+
|
287 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label:after {
|
288 |
+
content: "ON";
|
289 |
+
display: block;
|
290 |
+
color: #FFF;
|
291 |
+
position: absolute;
|
292 |
+
top: 2px;
|
293 |
+
bottom: 2px;
|
294 |
+
right: 27px;
|
295 |
+
font-size: 11px;
|
296 |
+
font-family: 'Arial'; }
|
297 |
+
|
298 |
+
/* Color Picker */
|
299 |
+
.clc-color-picker-title {
|
300 |
+
margin-left: 42px;
|
301 |
+
margin-bottom: 0 !important;
|
302 |
+
line-height: 24px !important;
|
303 |
+
}
|
304 |
+
.clc-color-picker-title .clc-color-picker-description {
|
305 |
+
font-size: 13px;
|
306 |
+
line-height: 16px;
|
307 |
+
font-weight: initial;
|
308 |
+
color: #959696;
|
309 |
+
display: block; }
|
310 |
+
.clc-color-picker-title .clc-color-picker-default {
|
311 |
+
font-style: italic;
|
312 |
+
font-weight: 300;
|
313 |
+
color: #959696;
|
314 |
+
cursor: pointer; }
|
315 |
+
.clc-color-picker-title .clc-color-picker-default:hover, .clc-color-picker-title .clc-color-picker-default:focus {
|
316 |
+
color: #55AAD3; }
|
317 |
+
|
318 |
+
.minicolors-theme-default {
|
319 |
+
display: block !important; }
|
320 |
+
.minicolors-theme-default .clc-color-picker {
|
321 |
+
z-index: 100;
|
322 |
+
position: absolute;
|
323 |
+
top: -20px;
|
324 |
+
left: 50px;
|
325 |
+
opacity: 0;
|
326 |
+
visibility: hidden;
|
327 |
+
width: 153px !important;
|
328 |
+
padding: 5px;
|
329 |
+
transition: all .1s ease-in; }
|
330 |
+
.minicolors-theme-default.minicolors-focus .clc-color-picker {
|
331 |
+
opacity: 1;
|
332 |
+
visibility: visible; }
|
333 |
+
.minicolors-theme-default .minicolors-input-swatch {
|
334 |
+
width: 30px;
|
335 |
+
height: 22px;
|
336 |
+
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
|
337 |
+
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
|
338 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
|
339 |
+
cursor: pointer; }
|
340 |
+
|
341 |
+
.lite {
|
342 |
+
opacity: 0;
|
343 |
+
visibility: hidden; }
|
344 |
+
|
345 |
+
.minicolors-position-left .minicolors-panel {
|
346 |
+
left: 50px; }
|
347 |
+
.customize-control-clc-color-picker {
|
348 |
+
padding: 18px 0 6px 0; }
|
349 |
+
|
350 |
+
/* Layout Columns */
|
351 |
+
.clc-layouts-container-advanced .clc-layouts-setup {
|
352 |
+
display: inline-block;
|
353 |
+
width: 100%;
|
354 |
+
}
|
355 |
+
.clc-layouts-container-advanced .clc-column {
|
356 |
+
border-right: 4px solid #f4f4f4;
|
357 |
+
float: left;
|
358 |
+
position: relative;
|
359 |
+
box-sizing: border-box;
|
360 |
+
height: 40px;
|
361 |
+
background-color: #cacaca;
|
362 |
+
-webkit-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.15);
|
363 |
+
-moz-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.15);
|
364 |
+
box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.15);
|
365 |
+
text-align: center;
|
366 |
+
}
|
367 |
+
.clc-layouts-container-advanced .clc-column.col12 {
|
368 |
+
width: 100%;
|
369 |
+
}
|
370 |
+
.clc-layouts-container-advanced .clc-column.col11 {
|
371 |
+
width: 91.66666667%;
|
372 |
+
}
|
373 |
+
.clc-layouts-container-advanced .clc-column.col10 {
|
374 |
+
width: 83.33333333%;
|
375 |
+
}
|
376 |
+
.clc-layouts-container-advanced .clc-column.col9 {
|
377 |
+
width: 75%;
|
378 |
+
}
|
379 |
+
.clc-layouts-container-advanced .clc-column.col8 {
|
380 |
+
width: 66.66666667%;
|
381 |
+
}
|
382 |
+
.clc-layouts-container-advanced .clc-column.col7 {
|
383 |
+
width: 58.33333333%;
|
384 |
+
}
|
385 |
+
.clc-layouts-container-advanced .clc-column.col6 {
|
386 |
+
width: 50%; }
|
387 |
+
.clc-layouts-container-advanced .clc-column.col5 {
|
388 |
+
width: 41.66666667%;
|
389 |
+
}
|
390 |
+
.clc-layouts-container-advanced .clc-column.col4 {
|
391 |
+
width: 33.33333333%;
|
392 |
+
}
|
393 |
+
.clc-layouts-container-advanced .clc-column.col3 {
|
394 |
+
width: 25%;
|
395 |
+
}
|
396 |
+
.clc-layouts-container-advanced .clc-column.col2 {
|
397 |
+
width: 16.66666667%;
|
398 |
+
}
|
399 |
+
.clc-layouts-container-advanced .clc-column.col1 {
|
400 |
+
width: 8.33333333%;
|
401 |
+
}
|
402 |
+
.clc-layouts-container-advanced .clc-column a {
|
403 |
+
opacity: .2;
|
404 |
+
width: 17px;
|
405 |
+
height: 17px;
|
406 |
+
-webkit-border-radius: 3px;
|
407 |
+
-moz-border-radius: 3px;
|
408 |
+
border-radius: 3px;
|
409 |
+
background-color: #e14d43;
|
410 |
+
color: #fff;
|
411 |
+
position: absolute;
|
412 |
+
top: 50%;
|
413 |
+
left: 2%;
|
414 |
+
-webkit-transform: translate(0%, -50%);
|
415 |
+
-ms-transform: translate(0%, -50%);
|
416 |
+
-o-transform: translate(0%, -50%);
|
417 |
+
transform: translate(0%, -50%);
|
418 |
+
-webkit-transition: opacity .2s;
|
419 |
+
transition: opacity .2s;
|
420 |
+
}
|
421 |
+
.clc-layouts-container-advanced .clc-column a .dashicons {
|
422 |
+
font-size: 12px;
|
423 |
+
line-height: 17px;
|
424 |
+
width: initial;
|
425 |
+
height: initial;
|
426 |
+
}
|
427 |
+
.clc-layouts-container-advanced .clc-column.clc-column-left a {
|
428 |
+
left: auto;
|
429 |
+
right: 2%;
|
430 |
+
}
|
431 |
+
.clc-layouts-container-advanced .clc-column:hover > a,
|
432 |
+
.clc-layouts-container-advanced .clc-column:focus > a {
|
433 |
+
opacity: 1;
|
434 |
+
-webkit-transition: opacity .2s;
|
435 |
+
transition: opacity .2s;
|
436 |
}
|
assets/css/jquery.minicolors.css
CHANGED
@@ -1,320 +1,320 @@
|
|
1 |
-
.minicolors {
|
2 |
-
position: relative;
|
3 |
-
}
|
4 |
-
|
5 |
-
.minicolors-sprite {
|
6 |
-
background-image: url(../img/minicolors/jquery.minicolors.png);
|
7 |
-
}
|
8 |
-
|
9 |
-
.minicolors-swatch {
|
10 |
-
position: absolute;
|
11 |
-
vertical-align: middle;
|
12 |
-
background-position: -80px 0;
|
13 |
-
border: solid 1px #ccc;
|
14 |
-
cursor: text;
|
15 |
-
padding: 0;
|
16 |
-
margin: 0;
|
17 |
-
display: inline-block;
|
18 |
-
}
|
19 |
-
|
20 |
-
.minicolors-swatch-color {
|
21 |
-
position: absolute;
|
22 |
-
top: 0;
|
23 |
-
left: 0;
|
24 |
-
right: 0;
|
25 |
-
bottom: 0;
|
26 |
-
}
|
27 |
-
|
28 |
-
.minicolors input[type=hidden] + .minicolors-swatch {
|
29 |
-
width: 28px;
|
30 |
-
position: static;
|
31 |
-
cursor: pointer;
|
32 |
-
}
|
33 |
-
|
34 |
-
.minicolors input[type=hidden][disabled] + .minicolors-swatch {
|
35 |
-
cursor: default;
|
36 |
-
}
|
37 |
-
|
38 |
-
/* Panel */
|
39 |
-
.minicolors-panel {
|
40 |
-
position: absolute;
|
41 |
-
width: 173px;
|
42 |
-
background: white;
|
43 |
-
border: solid 1px #CCC;
|
44 |
-
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
|
45 |
-
z-index: 99999;
|
46 |
-
box-sizing: content-box;
|
47 |
-
display: none;
|
48 |
-
}
|
49 |
-
|
50 |
-
.minicolors-panel.minicolors-visible {
|
51 |
-
display: block;
|
52 |
-
}
|
53 |
-
|
54 |
-
/* Panel positioning */
|
55 |
-
.minicolors-position-top .minicolors-panel {
|
56 |
-
top: -154px;
|
57 |
-
}
|
58 |
-
|
59 |
-
.minicolors-position-right .minicolors-panel {
|
60 |
-
right: 0;
|
61 |
-
}
|
62 |
-
|
63 |
-
.minicolors-position-bottom .minicolors-panel {
|
64 |
-
top: auto;
|
65 |
-
}
|
66 |
-
|
67 |
-
.minicolors-position-left .minicolors-panel {
|
68 |
-
left: 0;
|
69 |
-
}
|
70 |
-
|
71 |
-
.minicolors-with-opacity .minicolors-panel {
|
72 |
-
width: 194px;
|
73 |
-
}
|
74 |
-
|
75 |
-
.minicolors .minicolors-grid {
|
76 |
-
position: relative;
|
77 |
-
top: 1px;
|
78 |
-
left: 1px;
|
79 |
-
width: 150px;
|
80 |
-
height: 150px;
|
81 |
-
margin-bottom: 2px;
|
82 |
-
background-position: -120px 0;
|
83 |
-
cursor: crosshair;
|
84 |
-
}
|
85 |
-
|
86 |
-
.minicolors .minicolors-grid-inner {
|
87 |
-
position: absolute;
|
88 |
-
top: 0;
|
89 |
-
left: 0;
|
90 |
-
width: 150px;
|
91 |
-
height: 150px;
|
92 |
-
}
|
93 |
-
|
94 |
-
.minicolors-slider-saturation .minicolors-grid {
|
95 |
-
background-position: -420px 0;
|
96 |
-
}
|
97 |
-
|
98 |
-
.minicolors-slider-saturation .minicolors-grid-inner {
|
99 |
-
background-position: -270px 0;
|
100 |
-
background-image: inherit;
|
101 |
-
}
|
102 |
-
|
103 |
-
.minicolors-slider-brightness .minicolors-grid {
|
104 |
-
background-position: -570px 0;
|
105 |
-
}
|
106 |
-
|
107 |
-
.minicolors-slider-brightness .minicolors-grid-inner {
|
108 |
-
background-color: black;
|
109 |
-
}
|
110 |
-
|
111 |
-
.minicolors-slider-wheel .minicolors-grid {
|
112 |
-
background-position: -720px 0;
|
113 |
-
}
|
114 |
-
|
115 |
-
.minicolors-slider,
|
116 |
-
.minicolors-opacity-slider {
|
117 |
-
position: absolute;
|
118 |
-
top: 1px;
|
119 |
-
left: 152px;
|
120 |
-
width: 20px;
|
121 |
-
height: 150px;
|
122 |
-
background-color: white;
|
123 |
-
background-position: 0 0;
|
124 |
-
cursor: row-resize;
|
125 |
-
}
|
126 |
-
|
127 |
-
.minicolors-slider-saturation .minicolors-slider {
|
128 |
-
background-position: -60px 0;
|
129 |
-
}
|
130 |
-
|
131 |
-
.minicolors-slider-brightness .minicolors-slider {
|
132 |
-
background-position: -20px 0;
|
133 |
-
}
|
134 |
-
|
135 |
-
.minicolors-slider-wheel .minicolors-slider {
|
136 |
-
background-position: -20px 0;
|
137 |
-
}
|
138 |
-
|
139 |
-
.minicolors-opacity-slider {
|
140 |
-
left: 173px;
|
141 |
-
background-position: -40px 0;
|
142 |
-
display: none;
|
143 |
-
}
|
144 |
-
|
145 |
-
.minicolors-with-opacity .minicolors-opacity-slider {
|
146 |
-
display: block;
|
147 |
-
}
|
148 |
-
|
149 |
-
/* Pickers */
|
150 |
-
.minicolors-grid .minicolors-picker {
|
151 |
-
position: absolute;
|
152 |
-
top: 70px;
|
153 |
-
left: 70px;
|
154 |
-
width: 12px;
|
155 |
-
height: 12px;
|
156 |
-
border: solid 1px black;
|
157 |
-
border-radius: 10px;
|
158 |
-
margin-top: -6px;
|
159 |
-
margin-left: -6px;
|
160 |
-
background: none;
|
161 |
-
}
|
162 |
-
|
163 |
-
.minicolors-grid .minicolors-picker > div {
|
164 |
-
position: absolute;
|
165 |
-
top: 0;
|
166 |
-
left: 0;
|
167 |
-
width: 8px;
|
168 |
-
height: 8px;
|
169 |
-
border-radius: 8px;
|
170 |
-
border: solid 2px white;
|
171 |
-
box-sizing: content-box;
|
172 |
-
}
|
173 |
-
|
174 |
-
.minicolors-picker {
|
175 |
-
position: absolute;
|
176 |
-
top: 0;
|
177 |
-
left: 0;
|
178 |
-
width: 18px;
|
179 |
-
height: 2px;
|
180 |
-
background: white;
|
181 |
-
border: solid 1px black;
|
182 |
-
margin-top: -2px;
|
183 |
-
box-sizing: content-box;
|
184 |
-
}
|
185 |
-
|
186 |
-
/* Swatches */
|
187 |
-
.minicolors-swatches,
|
188 |
-
.minicolors-swatches li {
|
189 |
-
margin: 5px 0 3px 5px;
|
190 |
-
padding: 0;
|
191 |
-
list-style: none;
|
192 |
-
overflow: hidden;
|
193 |
-
}
|
194 |
-
|
195 |
-
.minicolors-swatches .minicolors-swatch {
|
196 |
-
position: relative;
|
197 |
-
float: left;
|
198 |
-
cursor: pointer;
|
199 |
-
margin:0 4px 0 0;
|
200 |
-
}
|
201 |
-
|
202 |
-
.minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
|
203 |
-
margin-right: 7px;
|
204 |
-
}
|
205 |
-
|
206 |
-
.minicolors-swatch.selected {
|
207 |
-
border-color: #000;
|
208 |
-
}
|
209 |
-
|
210 |
-
/* Inline controls */
|
211 |
-
.minicolors-inline {
|
212 |
-
display: inline-block;
|
213 |
-
}
|
214 |
-
|
215 |
-
.minicolors-inline .minicolors-input {
|
216 |
-
display: none !important;
|
217 |
-
}
|
218 |
-
|
219 |
-
.minicolors-inline .minicolors-panel {
|
220 |
-
position: relative;
|
221 |
-
top: auto;
|
222 |
-
left: auto;
|
223 |
-
box-shadow: none;
|
224 |
-
z-index: auto;
|
225 |
-
display: inline-block;
|
226 |
-
}
|
227 |
-
|
228 |
-
/* Default theme */
|
229 |
-
.minicolors-theme-default .minicolors-swatch {
|
230 |
-
top: 5px;
|
231 |
-
left: 5px;
|
232 |
-
width: 18px;
|
233 |
-
height: 18px;
|
234 |
-
}
|
235 |
-
.minicolors-theme-default .minicolors-swatches .minicolors-swatch {
|
236 |
-
margin-bottom: 2px;
|
237 |
-
top: 0;
|
238 |
-
left: 0;
|
239 |
-
width: 18px;
|
240 |
-
height: 18px;
|
241 |
-
}
|
242 |
-
.minicolors-theme-default.minicolors-position-right .minicolors-swatch {
|
243 |
-
left: auto;
|
244 |
-
right: 5px;
|
245 |
-
}
|
246 |
-
.minicolors-theme-default.minicolors {
|
247 |
-
width: auto;
|
248 |
-
display: inline-block;
|
249 |
-
}
|
250 |
-
.minicolors-theme-default .minicolors-input {
|
251 |
-
height: 20px;
|
252 |
-
width: auto;
|
253 |
-
display: inline-block;
|
254 |
-
padding-left: 26px;
|
255 |
-
}
|
256 |
-
.minicolors-theme-default.minicolors-position-right .minicolors-input {
|
257 |
-
padding-right: 26px;
|
258 |
-
padding-left: inherit;
|
259 |
-
}
|
260 |
-
|
261 |
-
/* Bootstrap theme */
|
262 |
-
.minicolors-theme-bootstrap .minicolors-swatch {
|
263 |
-
z-index: 2;
|
264 |
-
top: 3px;
|
265 |
-
left: 3px;
|
266 |
-
width: 28px;
|
267 |
-
height: 28px;
|
268 |
-
border-radius: 3px;
|
269 |
-
}
|
270 |
-
.minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
|
271 |
-
margin-bottom: 2px;
|
272 |
-
top: 0;
|
273 |
-
left: 0;
|
274 |
-
width: 20px;
|
275 |
-
height: 20px;
|
276 |
-
}
|
277 |
-
.minicolors-theme-bootstrap .minicolors-swatch-color {
|
278 |
-
border-radius: inherit;
|
279 |
-
}
|
280 |
-
.minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
|
281 |
-
left: auto;
|
282 |
-
right: 3px;
|
283 |
-
}
|
284 |
-
.minicolors-theme-bootstrap .minicolors-input {
|
285 |
-
float: none;
|
286 |
-
padding-left: 44px;
|
287 |
-
}
|
288 |
-
.minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
|
289 |
-
padding-right: 44px;
|
290 |
-
padding-left: 12px;
|
291 |
-
}
|
292 |
-
.minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
|
293 |
-
top: 4px;
|
294 |
-
left: 4px;
|
295 |
-
width: 37px;
|
296 |
-
height: 37px;
|
297 |
-
border-radius: 5px;
|
298 |
-
}
|
299 |
-
.minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
|
300 |
-
width: 24px;
|
301 |
-
height: 24px;
|
302 |
-
}
|
303 |
-
.minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
|
304 |
-
width: 18px;
|
305 |
-
height: 18px;
|
306 |
-
}
|
307 |
-
.input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
|
308 |
-
border-top-left-radius: 0;
|
309 |
-
border-bottom-left-radius: 0;
|
310 |
-
}
|
311 |
-
|
312 |
-
/* Semantic Ui theme */
|
313 |
-
.minicolors-theme-semanticui .minicolors-swatch {
|
314 |
-
top: 0;
|
315 |
-
left: 0;
|
316 |
-
padding: 18px;
|
317 |
-
}
|
318 |
-
.minicolors-theme-semanticui input {
|
319 |
-
text-indent: 30px;
|
320 |
-
}
|
1 |
+
.minicolors {
|
2 |
+
position: relative;
|
3 |
+
}
|
4 |
+
|
5 |
+
.minicolors-sprite {
|
6 |
+
background-image: url(../img/minicolors/jquery.minicolors.png);
|
7 |
+
}
|
8 |
+
|
9 |
+
.minicolors-swatch {
|
10 |
+
position: absolute;
|
11 |
+
vertical-align: middle;
|
12 |
+
background-position: -80px 0;
|
13 |
+
border: solid 1px #ccc;
|
14 |
+
cursor: text;
|
15 |
+
padding: 0;
|
16 |
+
margin: 0;
|
17 |
+
display: inline-block;
|
18 |
+
}
|
19 |
+
|
20 |
+
.minicolors-swatch-color {
|
21 |
+
position: absolute;
|
22 |
+
top: 0;
|
23 |
+
left: 0;
|
24 |
+
right: 0;
|
25 |
+
bottom: 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
.minicolors input[type=hidden] + .minicolors-swatch {
|
29 |
+
width: 28px;
|
30 |
+
position: static;
|
31 |
+
cursor: pointer;
|
32 |
+
}
|
33 |
+
|
34 |
+
.minicolors input[type=hidden][disabled] + .minicolors-swatch {
|
35 |
+
cursor: default;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Panel */
|
39 |
+
.minicolors-panel {
|
40 |
+
position: absolute;
|
41 |
+
width: 173px;
|
42 |
+
background: white;
|
43 |
+
border: solid 1px #CCC;
|
44 |
+
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
|
45 |
+
z-index: 99999;
|
46 |
+
box-sizing: content-box;
|
47 |
+
display: none;
|
48 |
+
}
|
49 |
+
|
50 |
+
.minicolors-panel.minicolors-visible {
|
51 |
+
display: block;
|
52 |
+
}
|
53 |
+
|
54 |
+
/* Panel positioning */
|
55 |
+
.minicolors-position-top .minicolors-panel {
|
56 |
+
top: -154px;
|
57 |
+
}
|
58 |
+
|
59 |
+
.minicolors-position-right .minicolors-panel {
|
60 |
+
right: 0;
|
61 |
+
}
|
62 |
+
|
63 |
+
.minicolors-position-bottom .minicolors-panel {
|
64 |
+
top: auto;
|
65 |
+
}
|
66 |
+
|
67 |
+
.minicolors-position-left .minicolors-panel {
|
68 |
+
left: 0;
|
69 |
+
}
|
70 |
+
|
71 |
+
.minicolors-with-opacity .minicolors-panel {
|
72 |
+
width: 194px;
|
73 |
+
}
|
74 |
+
|
75 |
+
.minicolors .minicolors-grid {
|
76 |
+
position: relative;
|
77 |
+
top: 1px;
|
78 |
+
left: 1px;
|
79 |
+
width: 150px;
|
80 |
+
height: 150px;
|
81 |
+
margin-bottom: 2px;
|
82 |
+
background-position: -120px 0;
|
83 |
+
cursor: crosshair;
|
84 |
+
}
|
85 |
+
|
86 |
+
.minicolors .minicolors-grid-inner {
|
87 |
+
position: absolute;
|
88 |
+
top: 0;
|
89 |
+
left: 0;
|
90 |
+
width: 150px;
|
91 |
+
height: 150px;
|
92 |
+
}
|
93 |
+
|
94 |
+
.minicolors-slider-saturation .minicolors-grid {
|
95 |
+
background-position: -420px 0;
|
96 |
+
}
|
97 |
+
|
98 |
+
.minicolors-slider-saturation .minicolors-grid-inner {
|
99 |
+
background-position: -270px 0;
|
100 |
+
background-image: inherit;
|
101 |
+
}
|
102 |
+
|
103 |
+
.minicolors-slider-brightness .minicolors-grid {
|
104 |
+
background-position: -570px 0;
|
105 |
+
}
|
106 |
+
|
107 |
+
.minicolors-slider-brightness .minicolors-grid-inner {
|
108 |
+
background-color: black;
|
109 |
+
}
|
110 |
+
|
111 |
+
.minicolors-slider-wheel .minicolors-grid {
|
112 |
+
background-position: -720px 0;
|
113 |
+
}
|
114 |
+
|
115 |
+
.minicolors-slider,
|
116 |
+
.minicolors-opacity-slider {
|
117 |
+
position: absolute;
|
118 |
+
top: 1px;
|
119 |
+
left: 152px;
|
120 |
+
width: 20px;
|
121 |
+
height: 150px;
|
122 |
+
background-color: white;
|
123 |
+
background-position: 0 0;
|
124 |
+
cursor: row-resize;
|
125 |
+
}
|
126 |
+
|
127 |
+
.minicolors-slider-saturation .minicolors-slider {
|
128 |
+
background-position: -60px 0;
|
129 |
+
}
|
130 |
+
|
131 |
+
.minicolors-slider-brightness .minicolors-slider {
|
132 |
+
background-position: -20px 0;
|
133 |
+
}
|
134 |
+
|
135 |
+
.minicolors-slider-wheel .minicolors-slider {
|
136 |
+
background-position: -20px 0;
|
137 |
+
}
|
138 |
+
|
139 |
+
.minicolors-opacity-slider {
|
140 |
+
left: 173px;
|
141 |
+
background-position: -40px 0;
|
142 |
+
display: none;
|
143 |
+
}
|
144 |
+
|
145 |
+
.minicolors-with-opacity .minicolors-opacity-slider {
|
146 |
+
display: block;
|
147 |
+
}
|
148 |
+
|
149 |
+
/* Pickers */
|
150 |
+
.minicolors-grid .minicolors-picker {
|
151 |
+
position: absolute;
|
152 |
+
top: 70px;
|
153 |
+
left: 70px;
|
154 |
+
width: 12px;
|
155 |
+
height: 12px;
|
156 |
+
border: solid 1px black;
|
157 |
+
border-radius: 10px;
|
158 |
+
margin-top: -6px;
|
159 |
+
margin-left: -6px;
|
160 |
+
background: none;
|
161 |
+
}
|
162 |
+
|
163 |
+
.minicolors-grid .minicolors-picker > div {
|
164 |
+
position: absolute;
|
165 |
+
top: 0;
|
166 |
+
left: 0;
|
167 |
+
width: 8px;
|
168 |
+
height: 8px;
|
169 |
+
border-radius: 8px;
|
170 |
+
border: solid 2px white;
|
171 |
+
box-sizing: content-box;
|
172 |
+
}
|
173 |
+
|
174 |
+
.minicolors-picker {
|
175 |
+
position: absolute;
|
176 |
+
top: 0;
|
177 |
+
left: 0;
|
178 |
+
width: 18px;
|
179 |
+
height: 2px;
|
180 |
+
background: white;
|
181 |
+
border: solid 1px black;
|
182 |
+
margin-top: -2px;
|
183 |
+
box-sizing: content-box;
|
184 |
+
}
|
185 |
+
|
186 |
+
/* Swatches */
|
187 |
+
.minicolors-swatches,
|
188 |
+
.minicolors-swatches li {
|
189 |
+
margin: 5px 0 3px 5px;
|
190 |
+
padding: 0;
|
191 |
+
list-style: none;
|
192 |
+
overflow: hidden;
|
193 |
+
}
|
194 |
+
|
195 |
+
.minicolors-swatches .minicolors-swatch {
|
196 |
+
position: relative;
|
197 |
+
float: left;
|
198 |
+
cursor: pointer;
|
199 |
+
margin:0 4px 0 0;
|
200 |
+
}
|
201 |
+
|
202 |
+
.minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
|
203 |
+
margin-right: 7px;
|
204 |
+
}
|
205 |
+
|
206 |
+
.minicolors-swatch.selected {
|
207 |
+
border-color: #000;
|
208 |
+
}
|
209 |
+
|
210 |
+
/* Inline controls */
|
211 |
+
.minicolors-inline {
|
212 |
+
display: inline-block;
|
213 |
+
}
|
214 |
+
|
215 |
+
.minicolors-inline .minicolors-input {
|
216 |
+
display: none !important;
|
217 |
+
}
|
218 |
+
|
219 |
+
.minicolors-inline .minicolors-panel {
|
220 |
+
position: relative;
|
221 |
+
top: auto;
|
222 |
+
left: auto;
|
223 |
+
box-shadow: none;
|
224 |
+
z-index: auto;
|
225 |
+
display: inline-block;
|
226 |
+
}
|
227 |
+
|
228 |
+
/* Default theme */
|
229 |
+
.minicolors-theme-default .minicolors-swatch {
|
230 |
+
top: 5px;
|
231 |
+
left: 5px;
|
232 |
+
width: 18px;
|
233 |
+
height: 18px;
|
234 |
+
}
|
235 |
+
.minicolors-theme-default .minicolors-swatches .minicolors-swatch {
|
236 |
+
margin-bottom: 2px;
|
237 |
+
top: 0;
|
238 |
+
left: 0;
|
239 |
+
width: 18px;
|
240 |
+
height: 18px;
|
241 |
+
}
|
242 |
+
.minicolors-theme-default.minicolors-position-right .minicolors-swatch {
|
243 |
+
left: auto;
|
244 |
+
right: 5px;
|
245 |
+
}
|
246 |
+
.minicolors-theme-default.minicolors {
|
247 |
+
width: auto;
|
248 |
+
display: inline-block;
|
249 |
+
}
|
250 |
+
.minicolors-theme-default .minicolors-input {
|
251 |
+
height: 20px;
|
252 |
+
width: auto;
|
253 |
+
display: inline-block;
|
254 |
+
padding-left: 26px;
|
255 |
+
}
|
256 |
+
.minicolors-theme-default.minicolors-position-right .minicolors-input {
|
257 |
+
padding-right: 26px;
|
258 |
+
padding-left: inherit;
|
259 |
+
}
|
260 |
+
|
261 |
+
/* Bootstrap theme */
|
262 |
+
.minicolors-theme-bootstrap .minicolors-swatch {
|
263 |
+
z-index: 2;
|
264 |
+
top: 3px;
|
265 |
+
left: 3px;
|
266 |
+
width: 28px;
|
267 |
+
height: 28px;
|
268 |
+
border-radius: 3px;
|
269 |
+
}
|
270 |
+
.minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
|
271 |
+
margin-bottom: 2px;
|
272 |
+
top: 0;
|
273 |
+
left: 0;
|
274 |
+
width: 20px;
|
275 |
+
height: 20px;
|
276 |
+
}
|
277 |
+
.minicolors-theme-bootstrap .minicolors-swatch-color {
|
278 |
+
border-radius: inherit;
|
279 |
+
}
|
280 |
+
.minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
|
281 |
+
left: auto;
|
282 |
+
right: 3px;
|
283 |
+
}
|
284 |
+
.minicolors-theme-bootstrap .minicolors-input {
|
285 |
+
float: none;
|
286 |
+
padding-left: 44px;
|
287 |
+
}
|
288 |
+
.minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
|
289 |
+
padding-right: 44px;
|
290 |
+
padding-left: 12px;
|
291 |
+
}
|
292 |
+
.minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
|
293 |
+
top: 4px;
|
294 |
+
left: 4px;
|
295 |
+
width: 37px;
|
296 |
+
height: 37px;
|
297 |
+
border-radius: 5px;
|
298 |
+
}
|
299 |
+
.minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
|
300 |
+
width: 24px;
|
301 |
+
height: 24px;
|
302 |
+
}
|
303 |
+
.minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
|
304 |
+
width: 18px;
|
305 |
+
height: 18px;
|
306 |
+
}
|
307 |
+
.input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
|
308 |
+
border-top-left-radius: 0;
|
309 |
+
border-bottom-left-radius: 0;
|
310 |
+
}
|
311 |
+
|
312 |
+
/* Semantic Ui theme */
|
313 |
+
.minicolors-theme-semanticui .minicolors-swatch {
|
314 |
+
top: 0;
|
315 |
+
left: 0;
|
316 |
+
padding: 18px;
|
317 |
+
}
|
318 |
+
.minicolors-theme-semanticui input {
|
319 |
+
text-indent: 30px;
|
320 |
+
}
|
assets/js/clc-customizer.js
CHANGED
@@ -1,321 +1,321 @@
|
|
1 |
-
( function( $ ) {
|
2 |
-
'use strict';
|
3 |
-
|
4 |
-
if ( 'undefined' !== typeof( wp ) && 'undefined' !== typeof( wp.customize ) ) {
|
5 |
-
|
6 |
-
// Detect when the templates section is expanded (or closed) so we can hide the templates shortcut when it's open.
|
7 |
-
wp.customize.panel( 'clc_main_panel', function( section ) {
|
8 |
-
section.expanded.bind( function( isExpanding ) {
|
9 |
-
var loginURL = CLCUrls.siteurl + '?colorlib-login-customizer-customization=true';
|
10 |
-
|
11 |
-
// Value of isExpanding will = true if you're entering the section, false if you're leaving it.
|
12 |
-
if ( isExpanding ) {
|
13 |
-
wp.customize.previewer.previewUrl.set( loginURL );
|
14 |
-
} else {
|
15 |
-
wp.customize.previewer.previewUrl.set( CLCUrls.siteurl );
|
16 |
-
}
|
17 |
-
});
|
18 |
-
});
|
19 |
-
|
20 |
-
wp.customize.controlConstructor['clc-templates'] = wp.customize.Control.extend({
|
21 |
-
ready: function() {
|
22 |
-
var control = this;
|
23 |
-
|
24 |
-
this.container.on( 'change', 'input:radio', function() {
|
25 |
-
var template = $( this ).val();
|
26 |
-
|
27 |
-
control.loadTemplate( 'default' );
|
28 |
-
|
29 |
-
if ( 'default' !== template ) {
|
30 |
-
control.loadTemplate( template );
|
31 |
-
}
|
32 |
-
|
33 |
-
});
|
34 |
-
},
|
35 |
-
loadTemplate: function( optionName ) {
|
36 |
-
var control = this,
|
37 |
-
options = control.params.options[ optionName ];
|
38 |
-
|
39 |
-
$.each( options, function( index, option ) {
|
40 |
-
var currentControl = wp.customize.control( option.name );
|
41 |
-
|
42 |
-
if ( 'default' === optionName ) {
|
43 |
-
currentControl.setting( option.value );
|
44 |
-
} else {
|
45 |
-
currentControl.setting( option.value );
|
46 |
-
}
|
47 |
-
|
48 |
-
});
|
49 |
-
}
|
50 |
-
});
|
51 |
-
|
52 |
-
wp.customize.controlConstructor['clc-range-slider'] = wp.customize.Control.extend({
|
53 |
-
ready: function() {
|
54 |
-
var control = this,
|
55 |
-
controlField = control.container.find( 'input.clc-slider' ),
|
56 |
-
controlSlider = control.container.find( 'div.clc-slider' ),
|
57 |
-
controlSliderData = control.params.choices,
|
58 |
-
updating = false;
|
59 |
-
|
60 |
-
controlSlider.slider({
|
61 |
-
range: 'min',
|
62 |
-
min: controlSliderData.min,
|
63 |
-
max: controlSliderData.max,
|
64 |
-
step: controlSliderData.step,
|
65 |
-
value: controlField.val(),
|
66 |
-
slide: function( event, ui ) {
|
67 |
-
controlField.val( ui.value ).keyup();
|
68 |
-
},
|
69 |
-
stop: function( event, ui ) {
|
70 |
-
controlField.val( ui.value );
|
71 |
-
updating = true;
|
72 |
-
control.setting.set( ui.value );
|
73 |
-
updating = false;
|
74 |
-
}
|
75 |
-
});
|
76 |
-
|
77 |
-
// Whenever the setting's value changes, refresh the preview.
|
78 |
-
control.setting.bind( function( value ) {
|
79 |
-
|
80 |
-
// Bail if the update came from the control itself.
|
81 |
-
if ( updating ) {
|
82 |
-
return;
|
83 |
-
}
|
84 |
-
|
85 |
-
controlField.val( value );
|
86 |
-
controlSlider.slider( 'value', value );
|
87 |
-
|
88 |
-
});
|
89 |
-
|
90 |
-
}
|
91 |
-
});
|
92 |
-
|
93 |
-
wp.customize.controlConstructor['clc-button-group'] = wp.customize.Control.extend({
|
94 |
-
ready: function() {
|
95 |
-
var control = this,
|
96 |
-
updating = false;
|
97 |
-
control.container.on( 'click', '.colorlib-login-customizer-control-group > a', function() {
|
98 |
-
var value = $( this ).attr( 'data-value' );
|
99 |
-
$( this ).siblings().removeClass( 'active' );
|
100 |
-
$( this ).addClass( 'active' );
|
101 |
-
|
102 |
-
updating = true;
|
103 |
-
control.setting.set( value );
|
104 |
-
updating = false;
|
105 |
-
});
|
106 |
-
|
107 |
-
// Whenever the setting's value changes, refresh the preview.
|
108 |
-
control.setting.bind( function( value ) {
|
109 |
-
|
110 |
-
var options = control.container.find( '.colorlib-login-customizer-control-group > a' );
|
111 |
-
|
112 |
-
// Bail if the update came from the control itself.
|
113 |
-
if ( updating ) {
|
114 |
-
return;
|
115 |
-
}
|
116 |
-
|
117 |
-
options.removeClass( 'active' );
|
118 |
-
options.filter( '[data-value=' + value + ']' ).addClass( 'active' );
|
119 |
-
|
120 |
-
});
|
121 |
-
|
122 |
-
}
|
123 |
-
});
|
124 |
-
|
125 |
-
wp.customize.controlConstructor['clc-column-width'] = wp.customize.Control.extend({
|
126 |
-
ready: function() {
|
127 |
-
var control = this,
|
128 |
-
updating = false;
|
129 |
-
|
130 |
-
control.values = control.params.value;
|
131 |
-
|
132 |
-
control.container.on( 'click', '.clc-layouts-setup .clc-column > a', function() {
|
133 |
-
var currentAction = $( this ).data( 'action' );
|
134 |
-
|
135 |
-
updating = true;
|
136 |
-
control.updateColumns( currentAction );
|
137 |
-
updating = false;
|
138 |
-
|
139 |
-
});
|
140 |
-
|
141 |
-
// Whenever the setting's value changes, refresh the preview.
|
142 |
-
control.setting.bind( function( value ) {
|
143 |
-
|
144 |
-
// Bail if the update came from the control itself.
|
145 |
-
if ( updating ) {
|
146 |
-
return;
|
147 |
-
}
|
148 |
-
|
149 |
-
control.values = value;
|
150 |
-
control.rederColumns();
|
151 |
-
|
152 |
-
});
|
153 |
-
|
154 |
-
},
|
155 |
-
|
156 |
-
updateColumns: function( increment ) {
|
157 |
-
var incrementElement,
|
158 |
-
decrementElement,
|
159 |
-
control = this;
|
160 |
-
|
161 |
-
if ( 11 === control.values[ increment ] ) {
|
162 |
-
return;
|
163 |
-
}
|
164 |
-
|
165 |
-
if ( 'left' == increment ) {
|
166 |
-
incrementElement = control.container.find( '.clc-column-left' );
|
167 |
-
decrementElement = control.container.find( '.clc-column-right' );
|
168 |
-
|
169 |
-
control.values['left'] += 1;
|
170 |
-
control.values['right'] -= 1;
|
171 |
-
|
172 |
-
}else{
|
173 |
-
incrementElement = control.container.find( '.clc-column-right' );
|
174 |
-
decrementElement = control.container.find( '.clc-column-left' );
|
175 |
-
|
176 |
-
control.values['right'] += 1;
|
177 |
-
control.values['left'] -= 1;
|
178 |
-
|
179 |
-
}
|
180 |
-
|
181 |
-
// Update control values
|
182 |
-
control.setting( '' );
|
183 |
-
control.setting( control.values );
|
184 |
-
|
185 |
-
control.rederColumns();
|
186 |
-
|
187 |
-
},
|
188 |
-
|
189 |
-
rederColumns: function() {
|
190 |
-
var control = this,
|
191 |
-
leftColumn = control.container.find( '.clc-column-left' ),
|
192 |
-
rightColumn = control.container.find( '.clc-column-right' ),
|
193 |
-
classes = 'col12 col11 col10 col9 col8 col7 col6 col5 col4 col3 col2 col1';
|
194 |
-
|
195 |
-
leftColumn.removeClass( classes ).addClass( 'col' + control.values['left'] );
|
196 |
-
rightColumn.removeClass( classes ).addClass( 'col' + control.values['right'] );
|
197 |
-
|
198 |
-
}
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
});
|
203 |
-
|
204 |
-
wp.customize.controlConstructor['clc-color-picker'] = wp.customize.Control.extend({
|
205 |
-
ready: function() {
|
206 |
-
var control = this,
|
207 |
-
updating = false,
|
208 |
-
clear = control.container.find( 'a.clc-color-picker-default' ),
|
209 |
-
input = $( control.container ).find( '.clc-color-picker' );
|
210 |
-
|
211 |
-
input.minicolors({
|
212 |
-
format: 'hex',
|
213 |
-
opacity: true,
|
214 |
-
keywords: 'transparent, initial, inherit',
|
215 |
-
change: function( value, opacity ) {
|
216 |
-
updating = true;
|
217 |
-
control.setting.set( input.minicolors( 'rgbaString' ) );
|
218 |
-
updating = false;
|
219 |
-
}
|
220 |
-
});
|
221 |
-
|
222 |
-
if ( clear.length > 0 ) {
|
223 |
-
clear.on( 'click', function( e ) {
|
224 |
-
var defaultValue = $( this ).attr( 'data-default' );
|
225 |
-
e.preventDefault();
|
226 |
-
|
227 |
-
input.minicolors( 'value', defaultValue );
|
228 |
-
updating = true;
|
229 |
-
control.setting.set( defaultValue );
|
230 |
-
updating = false;
|
231 |
-
});
|
232 |
-
}
|
233 |
-
|
234 |
-
// Whenever the setting's value changes, refresh the preview.
|
235 |
-
control.setting.bind( function( value ) {
|
236 |
-
|
237 |
-
// Bail if the update came from the control itself.
|
238 |
-
if ( updating ) {
|
239 |
-
return;
|
240 |
-
}
|
241 |
-
input.minicolors( 'value', value );
|
242 |
-
|
243 |
-
});
|
244 |
-
}
|
245 |
-
});
|
246 |
-
|
247 |
-
// Listen for previewer events
|
248 |
-
wp.customize.bind( 'ready', function() {
|
249 |
-
wp.customize.previewer.bind( 'clc-focus-section', function( sectionName ) {
|
250 |
-
var section = wp.customize.section( sectionName );
|
251 |
-
|
252 |
-
if ( undefined !== section ) {
|
253 |
-
section.focus();
|
254 |
-
}
|
255 |
-
});
|
256 |
-
|
257 |
-
wp.customize( 'clc-options[columns]', function( value ) {
|
258 |
-
value.bind( function( to ) {
|
259 |
-
var alignControl = wp.customize.control( 'clc-options[form-column-align]' ),
|
260 |
-
backgroundControl = wp.customize.control( 'clc-options[custom-background-form]' ),
|
261 |
-
columnsWidthControl = wp.customize.control( 'clc-options[columns-width]' ),
|
262 |
-
backgroundColorControl = wp.customize.control( 'clc-options[custom-background-color-form]' );
|
263 |
-
if ( '2' === to ) {
|
264 |
-
alignControl.toggle( true );
|
265 |
-
backgroundControl.toggle( true );
|
266 |
-
backgroundColorControl.toggle( true );
|
267 |
-
columnsWidthControl.toggle( true );
|
268 |
-
} else {
|
269 |
-
alignControl.toggle( false );
|
270 |
-
backgroundControl.toggle( false );
|
271 |
-
backgroundColorControl.toggle( false );
|
272 |
-
columnsWidthControl.toggle( false );
|
273 |
-
}
|
274 |
-
});
|
275 |
-
});
|
276 |
-
|
277 |
-
// validation for the login-level setting
|
278 |
-
wp.customize( 'clc-options[login-label]', function ( setting ) {
|
279 |
-
setting.validate = function ( value ) {
|
280 |
-
var code, notification;
|
281 |
-
|
282 |
-
code = 'required';
|
283 |
-
if ( ! value ) {
|
284 |
-
notification = new wp.customize.Notification( code, {message: 'value is empty' } );
|
285 |
-
setting.notifications.add( code, notification );
|
286 |
-
} else {
|
287 |
-
setting.notifications.remove( code );
|
288 |
-
}
|
289 |
-
|
290 |
-
return value;
|
291 |
-
};
|
292 |
-
} );
|
293 |
-
|
294 |
-
wp.customize( 'clc-options[use-text-logo]', function( value ) {
|
295 |
-
value.bind( function( to ) {
|
296 |
-
var logoText = wp.customize.control( 'clc-options[logo-text]' ),
|
297 |
-
logoTextColor = wp.customize.control( 'clc-options[logo-text-color]' ),
|
298 |
-
logoTextColorHover = wp.customize.control( 'clc-options[logo-text-color-hover]' ),
|
299 |
-
logoTextSize = wp.customize.control( 'clc-options[logo-text-size]' ),
|
300 |
-
logoImage = wp.customize.control( 'clc-options[custom-logo]' );
|
301 |
-
|
302 |
-
if ( '1' == to ) {
|
303 |
-
logoText.toggle( true );
|
304 |
-
logoTextColor.toggle( true );
|
305 |
-
logoTextColorHover.toggle( true );
|
306 |
-
logoTextSize.toggle( true );
|
307 |
-
logoImage.toggle( false );
|
308 |
-
}else{
|
309 |
-
logoText.toggle( false );
|
310 |
-
logoTextColor.toggle( false );
|
311 |
-
logoTextColorHover.toggle( false );
|
312 |
-
logoTextSize.toggle( false );
|
313 |
-
logoImage.toggle( true );
|
314 |
-
}
|
315 |
-
});
|
316 |
-
});
|
317 |
-
|
318 |
-
});
|
319 |
-
|
320 |
-
}
|
321 |
-
})( jQuery );
|
1 |
+
( function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
if ( 'undefined' !== typeof( wp ) && 'undefined' !== typeof( wp.customize ) ) {
|
5 |
+
|
6 |
+
// Detect when the templates section is expanded (or closed) so we can hide the templates shortcut when it's open.
|
7 |
+
wp.customize.panel( 'clc_main_panel', function( section ) {
|
8 |
+
section.expanded.bind( function( isExpanding ) {
|
9 |
+
var loginURL = CLCUrls.siteurl + '?colorlib-login-customizer-customization=true';
|
10 |
+
|
11 |
+
// Value of isExpanding will = true if you're entering the section, false if you're leaving it.
|
12 |
+
if ( isExpanding ) {
|
13 |
+
wp.customize.previewer.previewUrl.set( loginURL );
|
14 |
+
} else {
|
15 |
+
wp.customize.previewer.previewUrl.set( CLCUrls.siteurl );
|
16 |
+
}
|
17 |
+
});
|
18 |
+
});
|
19 |
+
|
20 |
+
wp.customize.controlConstructor['clc-templates'] = wp.customize.Control.extend({
|
21 |
+
ready: function() {
|
22 |
+
var control = this;
|
23 |
+
|
24 |
+
this.container.on( 'change', 'input:radio', function() {
|
25 |
+
var template = $( this ).val();
|
26 |
+
|
27 |
+
control.loadTemplate( 'default' );
|
28 |
+
|
29 |
+
if ( 'default' !== template ) {
|
30 |
+
control.loadTemplate( template );
|
31 |
+
}
|
32 |
+
|
33 |
+
});
|
34 |
+
},
|
35 |
+
loadTemplate: function( optionName ) {
|
36 |
+
var control = this,
|
37 |
+
options = control.params.options[ optionName ];
|
38 |
+
|
39 |
+
$.each( options, function( index, option ) {
|
40 |
+
var currentControl = wp.customize.control( option.name );
|
41 |
+
|
42 |
+
if ( 'default' === optionName ) {
|
43 |
+
currentControl.setting( option.value );
|
44 |
+
} else {
|
45 |
+
currentControl.setting( option.value );
|
46 |
+
}
|
47 |
+
|
48 |
+
});
|
49 |
+
}
|
50 |
+
});
|
51 |
+
|
52 |
+
wp.customize.controlConstructor['clc-range-slider'] = wp.customize.Control.extend({
|
53 |
+
ready: function() {
|
54 |
+
var control = this,
|
55 |
+
controlField = control.container.find( 'input.clc-slider' ),
|
56 |
+
controlSlider = control.container.find( 'div.clc-slider' ),
|
57 |
+
controlSliderData = control.params.choices,
|
58 |
+
updating = false;
|
59 |
+
|
60 |
+
controlSlider.slider({
|
61 |
+
range: 'min',
|
62 |
+
min: controlSliderData.min,
|
63 |
+
max: controlSliderData.max,
|
64 |
+
step: controlSliderData.step,
|
65 |
+
value: controlField.val(),
|
66 |
+
slide: function( event, ui ) {
|
67 |
+
controlField.val( ui.value ).keyup();
|
68 |
+
},
|
69 |
+
stop: function( event, ui ) {
|
70 |
+
controlField.val( ui.value );
|
71 |
+
updating = true;
|
72 |
+
control.setting.set( ui.value );
|
73 |
+
updating = false;
|
74 |
+
}
|
75 |
+
});
|
76 |
+
|
77 |
+
// Whenever the setting's value changes, refresh the preview.
|
78 |
+
control.setting.bind( function( value ) {
|
79 |
+
|
80 |
+
// Bail if the update came from the control itself.
|
81 |
+
if ( updating ) {
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
|
85 |
+
controlField.val( value );
|
86 |
+
controlSlider.slider( 'value', value );
|
87 |
+
|
88 |
+
});
|
89 |
+
|
90 |
+
}
|
91 |
+
});
|
92 |
+
|
93 |
+
wp.customize.controlConstructor['clc-button-group'] = wp.customize.Control.extend({
|
94 |
+
ready: function() {
|
95 |
+
var control = this,
|
96 |
+
updating = false;
|
97 |
+
control.container.on( 'click', '.colorlib-login-customizer-control-group > a', function() {
|
98 |
+
var value = $( this ).attr( 'data-value' );
|
99 |
+
$( this ).siblings().removeClass( 'active' );
|
100 |
+
$( this ).addClass( 'active' );
|
101 |
+
|
102 |
+
updating = true;
|
103 |
+
control.setting.set( value );
|
104 |
+
updating = false;
|
105 |
+
});
|
106 |
+
|
107 |
+
// Whenever the setting's value changes, refresh the preview.
|
108 |
+
control.setting.bind( function( value ) {
|
109 |
+
|
110 |
+
var options = control.container.find( '.colorlib-login-customizer-control-group > a' );
|
111 |
+
|
112 |
+
// Bail if the update came from the control itself.
|
113 |
+
if ( updating ) {
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
|
117 |
+
options.removeClass( 'active' );
|
118 |
+
options.filter( '[data-value=' + value + ']' ).addClass( 'active' );
|
119 |
+
|
120 |
+
});
|
121 |
+
|
122 |
+
}
|
123 |
+
});
|
124 |
+
|
125 |
+
wp.customize.controlConstructor['clc-column-width'] = wp.customize.Control.extend({
|
126 |
+
ready: function() {
|
127 |
+
var control = this,
|
128 |
+
updating = false;
|
129 |
+
|
130 |
+
control.values = control.params.value;
|
131 |
+
|
132 |
+
control.container.on( 'click', '.clc-layouts-setup .clc-column > a', function() {
|
133 |
+
var currentAction = $( this ).data( 'action' );
|
134 |
+
|
135 |
+
updating = true;
|
136 |
+
control.updateColumns( currentAction );
|
137 |
+
updating = false;
|
138 |
+
|
139 |
+
});
|
140 |
+
|
141 |
+
// Whenever the setting's value changes, refresh the preview.
|
142 |
+
control.setting.bind( function( value ) {
|
143 |
+
|
144 |
+
// Bail if the update came from the control itself.
|
145 |
+
if ( updating ) {
|
146 |
+
return;
|
147 |
+
}
|
148 |
+
|
149 |
+
control.values = value;
|
150 |
+
control.rederColumns();
|
151 |
+
|
152 |
+
});
|
153 |
+
|
154 |
+
},
|
155 |
+
|
156 |
+
updateColumns: function( increment ) {
|
157 |
+
var incrementElement,
|
158 |
+
decrementElement,
|
159 |
+
control = this;
|
160 |
+
|
161 |
+
if ( 11 === control.values[ increment ] ) {
|
162 |
+
return;
|
163 |
+
}
|
164 |
+
|
165 |
+
if ( 'left' == increment ) {
|
166 |
+
incrementElement = control.container.find( '.clc-column-left' );
|
167 |
+
decrementElement = control.container.find( '.clc-column-right' );
|
168 |
+
|
169 |
+
control.values['left'] += 1;
|
170 |
+
control.values['right'] -= 1;
|
171 |
+
|
172 |
+
}else{
|
173 |
+
incrementElement = control.container.find( '.clc-column-right' );
|
174 |
+
decrementElement = control.container.find( '.clc-column-left' );
|
175 |
+
|
176 |
+
control.values['right'] += 1;
|
177 |
+
control.values['left'] -= 1;
|
178 |
+
|
179 |
+
}
|
180 |
+
|
181 |
+
// Update control values
|
182 |
+
control.setting( '' );
|
183 |
+
control.setting( control.values );
|
184 |
+
|
185 |
+
control.rederColumns();
|
186 |
+
|
187 |
+
},
|
188 |
+
|
189 |
+
rederColumns: function() {
|
190 |
+
var control = this,
|
191 |
+
leftColumn = control.container.find( '.clc-column-left' ),
|
192 |
+
rightColumn = control.container.find( '.clc-column-right' ),
|
193 |
+
classes = 'col12 col11 col10 col9 col8 col7 col6 col5 col4 col3 col2 col1';
|
194 |
+
|
195 |
+
leftColumn.removeClass( classes ).addClass( 'col' + control.values['left'] );
|
196 |
+
rightColumn.removeClass( classes ).addClass( 'col' + control.values['right'] );
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
|
202 |
+
});
|
203 |
+
|
204 |
+
wp.customize.controlConstructor['clc-color-picker'] = wp.customize.Control.extend({
|
205 |
+
ready: function() {
|
206 |
+
var control = this,
|
207 |
+
updating = false,
|
208 |
+
clear = control.container.find( 'a.clc-color-picker-default' ),
|
209 |
+
input = $( control.container ).find( '.clc-color-picker' );
|
210 |
+
|
211 |
+
input.minicolors({
|
212 |
+
format: 'hex',
|
213 |
+
opacity: true,
|
214 |
+
keywords: 'transparent, initial, inherit',
|
215 |
+
change: function( value, opacity ) {
|
216 |
+
updating = true;
|
217 |
+
control.setting.set( input.minicolors( 'rgbaString' ) );
|
218 |
+
updating = false;
|
219 |
+
}
|
220 |
+
});
|
221 |
+
|
222 |
+
if ( clear.length > 0 ) {
|
223 |
+
clear.on( 'click', function( e ) {
|
224 |
+
var defaultValue = $( this ).attr( 'data-default' );
|
225 |
+
e.preventDefault();
|
226 |
+
|
227 |
+
input.minicolors( 'value', defaultValue );
|
228 |
+
updating = true;
|
229 |
+
control.setting.set( defaultValue );
|
230 |
+
updating = false;
|
231 |
+
});
|
232 |
+
}
|
233 |
+
|
234 |
+
// Whenever the setting's value changes, refresh the preview.
|
235 |
+
control.setting.bind( function( value ) {
|
236 |
+
|
237 |
+
// Bail if the update came from the control itself.
|
238 |
+
if ( updating ) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
input.minicolors( 'value', value );
|
242 |
+
|
243 |
+
});
|
244 |
+
}
|
245 |
+
});
|
246 |
+
|
247 |
+
// Listen for previewer events
|
248 |
+
wp.customize.bind( 'ready', function() {
|
249 |
+
wp.customize.previewer.bind( 'clc-focus-section', function( sectionName ) {
|
250 |
+
var section = wp.customize.section( sectionName );
|
251 |
+
|
252 |
+
if ( undefined !== section ) {
|
253 |
+
section.focus();
|
254 |
+
}
|
255 |
+
});
|
256 |
+
|
257 |
+
wp.customize( 'clc-options[columns]', function( value ) {
|
258 |
+
value.bind( function( to ) {
|
259 |
+
var alignControl = wp.customize.control( 'clc-options[form-column-align]' ),
|
260 |
+
backgroundControl = wp.customize.control( 'clc-options[custom-background-form]' ),
|
261 |
+
columnsWidthControl = wp.customize.control( 'clc-options[columns-width]' ),
|
262 |
+
backgroundColorControl = wp.customize.control( 'clc-options[custom-background-color-form]' );
|
263 |
+
if ( '2' === to ) {
|
264 |
+
alignControl.toggle( true );
|
265 |
+
backgroundControl.toggle( true );
|
266 |
+
backgroundColorControl.toggle( true );
|
267 |
+
columnsWidthControl.toggle( true );
|
268 |
+
} else {
|
269 |
+
alignControl.toggle( false );
|
270 |
+
backgroundControl.toggle( false );
|
271 |
+
backgroundColorControl.toggle( false );
|
272 |
+
columnsWidthControl.toggle( false );
|
273 |
+
}
|
274 |
+
});
|
275 |
+
});
|
276 |
+
|
277 |
+
// validation for the login-level setting
|
278 |
+
wp.customize( 'clc-options[login-label]', function ( setting ) {
|
279 |
+
setting.validate = function ( value ) {
|
280 |
+
var code, notification;
|
281 |
+
|
282 |
+
code = 'required';
|
283 |
+
if ( ! value ) {
|
284 |
+
notification = new wp.customize.Notification( code, {message: 'value is empty' } );
|
285 |
+
setting.notifications.add( code, notification );
|
286 |
+
} else {
|
287 |
+
setting.notifications.remove( code );
|
288 |
+
}
|
289 |
+
|
290 |
+
return value;
|
291 |
+
};
|
292 |
+
} );
|
293 |
+
|
294 |
+
wp.customize( 'clc-options[use-text-logo]', function( value ) {
|
295 |
+
value.bind( function( to ) {
|
296 |
+
var logoText = wp.customize.control( 'clc-options[logo-text]' ),
|
297 |
+
logoTextColor = wp.customize.control( 'clc-options[logo-text-color]' ),
|
298 |
+
logoTextColorHover = wp.customize.control( 'clc-options[logo-text-color-hover]' ),
|
299 |
+
logoTextSize = wp.customize.control( 'clc-options[logo-text-size]' ),
|
300 |
+
logoImage = wp.customize.control( 'clc-options[custom-logo]' );
|
301 |
+
|
302 |
+
if ( '1' == to ) {
|
303 |
+
logoText.toggle( true );
|
304 |
+
logoTextColor.toggle( true );
|
305 |
+
logoTextColorHover.toggle( true );
|
306 |
+
logoTextSize.toggle( true );
|
307 |
+
logoImage.toggle( false );
|
308 |
+
}else{
|
309 |
+
logoText.toggle( false );
|
310 |
+
logoTextColor.toggle( false );
|
311 |
+
logoTextColorHover.toggle( false );
|
312 |
+
logoTextSize.toggle( false );
|
313 |
+
logoImage.toggle( true );
|
314 |
+
}
|
315 |
+
});
|
316 |
+
});
|
317 |
+
|
318 |
+
});
|
319 |
+
|
320 |
+
}
|
321 |
+
})( jQuery );
|
assets/js/clc-preview.js
CHANGED
@@ -1,186 +1,214 @@
|
|
1 |
-
( function( $ ) {
|
2 |
-
|
3 |
-
var clcCustomCSS = {
|
4 |
-
selectors: {},
|
5 |
-
settings: {},
|
6 |
-
style: '',
|
7 |
-
init: function( settings, selectors ) {
|
8 |
-
this.selectors = selectors;
|
9 |
-
this.settings = settings;
|
10 |
-
|
11 |
-
this.style = $( '#clc-style' );
|
12 |
-
this._binds();
|
13 |
-
},
|
14 |
-
_binds: function() {
|
15 |
-
var self = this;
|
16 |
-
$.each( self.settings, function( index, setting ) {
|
17 |
-
wp.customize( setting.name, function( value ) {
|
18 |
-
value.bind( function( to ) {
|
19 |
-
self.settings[ index ].value = to;
|
20 |
-
self.createCSSLines();
|
21 |
-
} );
|
22 |
-
} );
|
23 |
-
});
|
24 |
-
},
|
25 |
-
createCSSLines: function() {
|
26 |
-
var style = '',
|
27 |
-
self = this;
|
28 |
-
$.each( self.selectors, function( index, selector ) {
|
29 |
-
var cssLine = index + '{';
|
30 |
-
$.each( selector, function( index, option ) {
|
31 |
-
cssLine = cssLine + self.generateCSSLine( option );
|
32 |
-
});
|
33 |
-
style = style + cssLine + '}';
|
34 |
-
});
|
35 |
-
|
36 |
-
self.style.html( style );
|
37 |
-
|
38 |
-
},
|
39 |
-
generateCSSLine: function( option ) {
|
40 |
-
var line = this.settings[ option ].attribute + ':';
|
41 |
-
|
42 |
-
if ( '' === this.settings[ option ].value ) {
|
43 |
-
return '';
|
44 |
-
}
|
45 |
-
if ( undefined === this.settings[ option ].attribute || undefined === this.settings[ option ].value ) {
|
46 |
-
return '';
|
47 |
-
}
|
48 |
-
|
49 |
-
if ( $.inArray( this.settings[ option ].attribute, [ 'width', 'min-width', 'max-width', 'background-size', 'height', 'min-height', 'max-height', 'font-size' ] ) >= 0 ) {
|
50 |
-
line += this.settings[ option ].value + 'px';
|
51 |
-
}else if ( 'background-image' === this.settings[ option ].attribute ) {
|
52 |
-
line += 'url(' + this.settings[ option ].value + ')';
|
53 |
-
}else if ( 'display' === this.settings[ option ].attribute ) {
|
54 |
-
if ( this.settings[ option ].value ) {
|
55 |
-
line += 'none';
|
56 |
-
} else {
|
57 |
-
line += 'block';
|
58 |
-
}
|
59 |
-
} else {
|
60 |
-
line += this.settings[ option ].value;
|
61 |
-
}
|
62 |
-
line += ';';
|
63 |
-
|
64 |
-
return line;
|
65 |
-
}
|
66 |
-
};
|
67 |
-
|
68 |
-
clcCustomCSS.init( CLC.settings, CLC.selectors );
|
69 |
-
|
70 |
-
// Live edits
|
71 |
-
/* Columns */
|
72 |
-
wp.customize( 'clc-options[columns]', function( value ) {
|
73 |
-
value.bind( function( to ) {
|
74 |
-
if ( '2' === to ) {
|
75 |
-
$( 'body' ).addClass( 'ml-half-screen' );
|
76 |
-
} else {
|
77 |
-
$( 'body' ).removeClass( 'ml-half-screen' );
|
78 |
-
}
|
79 |
-
} );
|
80 |
-
} );
|
81 |
-
|
82 |
-
// Add class if we have text logo
|
83 |
-
wp.customize( 'clc-options[use-text-logo]', function( value ) {
|
84 |
-
value.bind( function( to ) {
|
85 |
-
if ( to ) {
|
86 |
-
$( 'body' ).addClass( 'clc-text-logo' );
|
87 |
-
} else {
|
88 |
-
$( 'body' ).removeClass( 'clc-text-logo' );
|
89 |
-
}
|
90 |
-
} );
|
91 |
-
} );
|
92 |
-
|
93 |
-
wp.customize( 'clc-options[logo-text]', function( value ) {
|
94 |
-
value.bind( function( to ) {
|
95 |
-
$( '#logo-text' ).text( to );
|
96 |
-
} );
|
97 |
-
} );
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
$( 'body' ).
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
$( 'body' ).
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
$( '
|
127 |
-
} );
|
128 |
-
} );
|
129 |
-
|
130 |
-
//
|
131 |
-
wp.customize( 'clc-options[
|
132 |
-
value.bind( function( to ) {
|
133 |
-
$( '#clc-
|
134 |
-
} );
|
135 |
-
} );
|
136 |
-
|
137 |
-
//
|
138 |
-
wp.customize( 'clc-options[
|
139 |
-
value.bind( function( to ) {
|
140 |
-
$( '#clc-
|
141 |
-
} );
|
142 |
-
} );
|
143 |
-
|
144 |
-
//
|
145 |
-
wp.customize( 'clc-options[
|
146 |
-
value.bind( function( to ) {
|
147 |
-
$( '#clc-
|
148 |
-
} );
|
149 |
-
} );
|
150 |
-
|
151 |
-
//
|
152 |
-
wp.customize( 'clc-options[
|
153 |
-
value.bind( function( to ) {
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function( $ ) {
|
2 |
+
|
3 |
+
var clcCustomCSS = {
|
4 |
+
selectors: {},
|
5 |
+
settings: {},
|
6 |
+
style: '',
|
7 |
+
init: function( settings, selectors ) {
|
8 |
+
this.selectors = selectors;
|
9 |
+
this.settings = settings;
|
10 |
+
|
11 |
+
this.style = $( '#clc-style' );
|
12 |
+
this._binds();
|
13 |
+
},
|
14 |
+
_binds: function() {
|
15 |
+
var self = this;
|
16 |
+
$.each( self.settings, function( index, setting ) {
|
17 |
+
wp.customize( setting.name, function( value ) {
|
18 |
+
value.bind( function( to ) {
|
19 |
+
self.settings[ index ].value = to;
|
20 |
+
self.createCSSLines();
|
21 |
+
} );
|
22 |
+
} );
|
23 |
+
});
|
24 |
+
},
|
25 |
+
createCSSLines: function() {
|
26 |
+
var style = '',
|
27 |
+
self = this;
|
28 |
+
$.each( self.selectors, function( index, selector ) {
|
29 |
+
var cssLine = index + '{';
|
30 |
+
$.each( selector, function( index, option ) {
|
31 |
+
cssLine = cssLine + self.generateCSSLine( option );
|
32 |
+
});
|
33 |
+
style = style + cssLine + '}';
|
34 |
+
});
|
35 |
+
|
36 |
+
self.style.html( style );
|
37 |
+
|
38 |
+
},
|
39 |
+
generateCSSLine: function( option ) {
|
40 |
+
var line = this.settings[ option ].attribute + ':';
|
41 |
+
|
42 |
+
if ( '' === this.settings[ option ].value ) {
|
43 |
+
return '';
|
44 |
+
}
|
45 |
+
if ( undefined === this.settings[ option ].attribute || undefined === this.settings[ option ].value ) {
|
46 |
+
return '';
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( $.inArray( this.settings[ option ].attribute, [ 'width', 'min-width', 'max-width', 'background-size', 'height', 'min-height', 'max-height', 'font-size' ] ) >= 0 ) {
|
50 |
+
line += this.settings[ option ].value + 'px';
|
51 |
+
}else if ( 'background-image' === this.settings[ option ].attribute ) {
|
52 |
+
line += 'url(' + this.settings[ option ].value + ')';
|
53 |
+
}else if ( 'display' === this.settings[ option ].attribute ) {
|
54 |
+
if ( this.settings[ option ].value ) {
|
55 |
+
line += 'none';
|
56 |
+
} else {
|
57 |
+
line += 'block';
|
58 |
+
}
|
59 |
+
} else {
|
60 |
+
line += this.settings[ option ].value;
|
61 |
+
}
|
62 |
+
line += ';';
|
63 |
+
|
64 |
+
return line;
|
65 |
+
}
|
66 |
+
};
|
67 |
+
|
68 |
+
clcCustomCSS.init( CLC.settings, CLC.selectors );
|
69 |
+
|
70 |
+
// Live edits
|
71 |
+
/* Columns */
|
72 |
+
wp.customize( 'clc-options[columns]', function( value ) {
|
73 |
+
value.bind( function( to ) {
|
74 |
+
if ( '2' === to ) {
|
75 |
+
$( 'body' ).addClass( 'ml-half-screen' );
|
76 |
+
} else {
|
77 |
+
$( 'body' ).removeClass( 'ml-half-screen' );
|
78 |
+
}
|
79 |
+
} );
|
80 |
+
} );
|
81 |
+
|
82 |
+
// Add class if we have text logo
|
83 |
+
wp.customize( 'clc-options[use-text-logo]', function( value ) {
|
84 |
+
value.bind( function( to ) {
|
85 |
+
if ( to ) {
|
86 |
+
$( 'body' ).addClass( 'clc-text-logo' );
|
87 |
+
} else {
|
88 |
+
$( 'body' ).removeClass( 'clc-text-logo' );
|
89 |
+
}
|
90 |
+
} );
|
91 |
+
} );
|
92 |
+
|
93 |
+
wp.customize( 'clc-options[logo-text]', function( value ) {
|
94 |
+
value.bind( function( to ) {
|
95 |
+
$( '#logo-text' ).text( to );
|
96 |
+
} );
|
97 |
+
} );
|
98 |
+
|
99 |
+
// logo title
|
100 |
+
wp.customize( 'clc-options[logo-title]', function( value ) {
|
101 |
+
value.bind( function( to ) {
|
102 |
+
$( '#clc-logo-link' ).attr( 'title', to );
|
103 |
+
} );
|
104 |
+
} );
|
105 |
+
|
106 |
+
/* Column Align */
|
107 |
+
wp.customize( 'clc-options[form-column-align]', function( value ) {
|
108 |
+
value.bind( function( to ) {
|
109 |
+
$( 'body' ).removeClass( 'ml-login-align-1 ml-login-align-2 ml-login-align-3 ml-login-align-4' );
|
110 |
+
$( 'body' ).addClass( 'ml-login-align-' + to );
|
111 |
+
} );
|
112 |
+
} );
|
113 |
+
|
114 |
+
/* Column Vertical Align */
|
115 |
+
wp.customize( 'clc-options[form-vertical-align]', function( value ) {
|
116 |
+
value.bind( function( to ) {
|
117 |
+
$( 'body' ).removeClass( 'ml-login-vertical-align-1 ml-login-vertical-align-2 ml-login-vertical-align-3' );
|
118 |
+
$( 'body' ).addClass( 'ml-login-vertical-align-' + to );
|
119 |
+
} );
|
120 |
+
} );
|
121 |
+
|
122 |
+
/* Column Horizontal Align */
|
123 |
+
wp.customize( 'clc-options[form-horizontal-align]', function( value ) {
|
124 |
+
value.bind( function( to ) {
|
125 |
+
$( 'body' ).removeClass( 'ml-login-horizontal-align-1 ml-login-horizontal-align-2 ml-login-horizontal-align-3' );
|
126 |
+
$( 'body' ).addClass( 'ml-login-horizontal-align-' + to );
|
127 |
+
} );
|
128 |
+
} );
|
129 |
+
|
130 |
+
// Custom CSS
|
131 |
+
wp.customize( 'clc-options[custom-css]', function( value ) {
|
132 |
+
value.bind( function( to ) {
|
133 |
+
$( '#clc-custom-css' ).text( to );
|
134 |
+
} );
|
135 |
+
} );
|
136 |
+
|
137 |
+
// Username label
|
138 |
+
wp.customize( 'clc-options[username-label]', function( value ) {
|
139 |
+
value.bind( function( to ) {
|
140 |
+
$( '#clc-username-label' ).text( to );
|
141 |
+
} );
|
142 |
+
} );
|
143 |
+
|
144 |
+
// Password label
|
145 |
+
wp.customize( 'clc-options[password-label]', function( value ) {
|
146 |
+
value.bind( function( to ) {
|
147 |
+
$( '#clc-password-label' ).text( to );
|
148 |
+
} );
|
149 |
+
} );
|
150 |
+
|
151 |
+
// Remember Me label
|
152 |
+
wp.customize( 'clc-options[rememberme-label]', function( value ) {
|
153 |
+
value.bind( function( to ) {
|
154 |
+
$( '#clc-rememberme-label' ).text( to );
|
155 |
+
} );
|
156 |
+
} );
|
157 |
+
|
158 |
+
// Logo url
|
159 |
+
wp.customize( 'clc-options[logo-url]', function( value ) {
|
160 |
+
value.bind( function( to ) {
|
161 |
+
$( 'a#clc-logo-link' ).attr('href', to );
|
162 |
+
} );
|
163 |
+
} );
|
164 |
+
|
165 |
+
// Lost password text
|
166 |
+
wp.customize( 'clc-options[lost-password-text]', function( value ) {
|
167 |
+
value.bind( function( to ) {
|
168 |
+
$( '#clc-lost-password-text' ).text( to );
|
169 |
+
} );
|
170 |
+
} );
|
171 |
+
|
172 |
+
// Back to site text
|
173 |
+
wp.customize( 'clc-options[back-to-text]', function( value ) {
|
174 |
+
value.bind( function( to ) {
|
175 |
+
$( '#clc-back-to-text' ).html( '← ' + to );
|
176 |
+
} );
|
177 |
+
} );
|
178 |
+
|
179 |
+
// Login label
|
180 |
+
wp.customize( 'clc-options[login-label]', function( value ) {
|
181 |
+
value.bind( function( to ) {
|
182 |
+
if( ! to ) {
|
183 |
+
return;
|
184 |
+
}
|
185 |
+
$( '#wp-submit' ).val( to );
|
186 |
+
} );
|
187 |
+
} );
|
188 |
+
|
189 |
+
// Columns width
|
190 |
+
wp.customize( 'clc-options[columns-width]', function( value ) {
|
191 |
+
value.bind( function( to ) {
|
192 |
+
var customCSS = '',
|
193 |
+
leftWidth,
|
194 |
+
rightWidth;
|
195 |
+
if ( '' !== to && undefined !== to.left && undefined !== to.right ) {
|
196 |
+
leftWidth = ( 100 / 12 )*parseInt( to.left, 10 );
|
197 |
+
rightWidth = ( 100 / 12 )*parseInt( to.right, 10 );
|
198 |
+
customCSS = '.ml-half-screen.ml-login-align-3 .ml-container .ml-extra-div,.ml-half-screen.ml-login-align-1 .ml-container .ml-form-container{ width:' + leftWidth + '%; }';
|
199 |
+
customCSS += '.ml-half-screen.ml-login-align-4 .ml-container .ml-extra-div,.ml-half-screen.ml-login-align-2 .ml-container .ml-form-container{ flex-basis:' + leftWidth + '%; }';
|
200 |
+
|
201 |
+
customCSS += '.ml-half-screen.ml-login-align-3 .ml-container .ml-form-container,.ml-half-screen.ml-login-align-1 .ml-container .ml-extra-div{ width:' + rightWidth + '%; }';
|
202 |
+
customCSS += '.ml-half-screen.ml-login-align-4 .ml-container .ml-form-container,.ml-half-screen.ml-login-align-2 .ml-container .ml-extra-div{ flex-basis:' + rightWidth + '%; }';
|
203 |
+
|
204 |
+
$( '#clc-columns-style' ).text( customCSS );
|
205 |
+
|
206 |
+
}
|
207 |
+
} );
|
208 |
+
} );
|
209 |
+
|
210 |
+
$( '.clc-preview-event' ).click( function() {
|
211 |
+
wp.customize.preview.send( 'clc-focus-section', $( this ).data( 'section' ) );
|
212 |
+
} );
|
213 |
+
|
214 |
+
})( jQuery );
|
assets/js/jquery.minicolors.js
CHANGED
@@ -1,1109 +1,1109 @@
|
|
1 |
-
// jscs:disable
|
2 |
-
|
3 |
-
// jQuery MiniColors: A tiny color picker built on jQuery
|
4 |
-
//
|
5 |
-
// Developed by Cory LaViska for A Beautiful Site, LLC
|
6 |
-
//
|
7 |
-
// Licensed under the MIT license: http://opensource.org/licenses/MIT
|
8 |
-
//
|
9 |
-
(function (factory) {
|
10 |
-
if(typeof define === 'function' && define.amd) {
|
11 |
-
// AMD. Register as an anonymous module.
|
12 |
-
define(['jquery'], factory);
|
13 |
-
} else if(typeof exports === 'object') {
|
14 |
-
// Node/CommonJS
|
15 |
-
module.exports = factory(require('jquery'));
|
16 |
-
} else {
|
17 |
-
// Browser globals
|
18 |
-
factory(jQuery);
|
19 |
-
}
|
20 |
-
}(function ($) {
|
21 |
-
'use strict';
|
22 |
-
|
23 |
-
// Defaults
|
24 |
-
$.minicolors = {
|
25 |
-
defaults: {
|
26 |
-
animationSpeed: 50,
|
27 |
-
animationEasing: 'swing',
|
28 |
-
change: null,
|
29 |
-
changeDelay: 0,
|
30 |
-
control: 'hue',
|
31 |
-
defaultValue: '',
|
32 |
-
format: 'hex',
|
33 |
-
hide: null,
|
34 |
-
hideSpeed: 100,
|
35 |
-
inline: false,
|
36 |
-
keywords: '',
|
37 |
-
letterCase: 'lowercase',
|
38 |
-
opacity: false,
|
39 |
-
position: 'bottom left',
|
40 |
-
show: null,
|
41 |
-
showSpeed: 100,
|
42 |
-
theme: 'default',
|
43 |
-
swatches: []
|
44 |
-
}
|
45 |
-
};
|
46 |
-
|
47 |
-
// Public methods
|
48 |
-
$.extend($.fn, {
|
49 |
-
minicolors: function(method, data) {
|
50 |
-
|
51 |
-
switch(method) {
|
52 |
-
// Destroy the control
|
53 |
-
case 'destroy':
|
54 |
-
$(this).each(function() {
|
55 |
-
destroy($(this));
|
56 |
-
});
|
57 |
-
return $(this);
|
58 |
-
|
59 |
-
// Hide the color picker
|
60 |
-
case 'hide':
|
61 |
-
hide();
|
62 |
-
return $(this);
|
63 |
-
|
64 |
-
// Get/set opacity
|
65 |
-
case 'opacity':
|
66 |
-
// Getter
|
67 |
-
if(data === undefined) {
|
68 |
-
// Getter
|
69 |
-
return $(this).attr('data-opacity');
|
70 |
-
} else {
|
71 |
-
// Setter
|
72 |
-
$(this).each(function() {
|
73 |
-
updateFromInput($(this).attr('data-opacity', data));
|
74 |
-
});
|
75 |
-
}
|
76 |
-
return $(this);
|
77 |
-
|
78 |
-
// Get an RGB(A) object based on the current color/opacity
|
79 |
-
case 'rgbObject':
|
80 |
-
return rgbObject($(this), method === 'rgbaObject');
|
81 |
-
|
82 |
-
// Get an RGB(A) string based on the current color/opacity
|
83 |
-
case 'rgbString':
|
84 |
-
case 'rgbaString':
|
85 |
-
return rgbString($(this), method === 'rgbaString');
|
86 |
-
|
87 |
-
// Get/set settings on the fly
|
88 |
-
case 'settings':
|
89 |
-
if(data === undefined) {
|
90 |
-
return $(this).data('minicolors-settings');
|
91 |
-
} else {
|
92 |
-
// Setter
|
93 |
-
$(this).each(function() {
|
94 |
-
var settings = $(this).data('minicolors-settings') || {};
|
95 |
-
destroy($(this));
|
96 |
-
$(this).minicolors($.extend(true, settings, data));
|
97 |
-
});
|
98 |
-
}
|
99 |
-
return $(this);
|
100 |
-
|
101 |
-
// Show the color picker
|
102 |
-
case 'show':
|
103 |
-
show($(this).eq(0));
|
104 |
-
return $(this);
|
105 |
-
|
106 |
-
// Get/set the hex color value
|
107 |
-
case 'value':
|
108 |
-
if(data === undefined) {
|
109 |
-
// Getter
|
110 |
-
return $(this).val();
|
111 |
-
} else {
|
112 |
-
// Setter
|
113 |
-
$(this).each(function() {
|
114 |
-
if(typeof(data) === 'object' && data !== null) {
|
115 |
-
if(data.opacity) {
|
116 |
-
$(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
|
117 |
-
}
|
118 |
-
if(data.color) {
|
119 |
-
$(this).val(data.color);
|
120 |
-
}
|
121 |
-
} else {
|
122 |
-
$(this).val(data);
|
123 |
-
}
|
124 |
-
updateFromInput($(this));
|
125 |
-
});
|
126 |
-
}
|
127 |
-
return $(this);
|
128 |
-
|
129 |
-
// Initializes the control
|
130 |
-
default:
|
131 |
-
if(method !== 'create') data = method;
|
132 |
-
$(this).each(function() {
|
133 |
-
init($(this), data);
|
134 |
-
});
|
135 |
-
return $(this);
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
}
|
140 |
-
});
|
141 |
-
|
142 |
-
// Initialize input elements
|
143 |
-
function init(input, settings) {
|
144 |
-
var minicolors = $('<div class="minicolors" />');
|
145 |
-
var defaults = $.minicolors.defaults;
|
146 |
-
var size;
|
147 |
-
var swatches;
|
148 |
-
var swatch;
|
149 |
-
var panel;
|
150 |
-
var i;
|
151 |
-
|
152 |
-
// Do nothing if already initialized
|
153 |
-
if(input.data('minicolors-initialized')) return;
|
154 |
-
|
155 |
-
// Handle settings
|
156 |
-
settings = $.extend(true, {}, defaults, settings);
|
157 |
-
|
158 |
-
// The wrapper
|
159 |
-
minicolors
|
160 |
-
.addClass('minicolors-theme-' + settings.theme)
|
161 |
-
.toggleClass('minicolors-with-opacity', settings.opacity);
|
162 |
-
|
163 |
-
// Custom positioning
|
164 |
-
if(settings.position !== undefined) {
|
165 |
-
$.each(settings.position.split(' '), function() {
|
166 |
-
minicolors.addClass('minicolors-position-' + this);
|
167 |
-
});
|
168 |
-
}
|
169 |
-
|
170 |
-
// Input size
|
171 |
-
if(settings.format === 'rgb') {
|
172 |
-
size = settings.opacity ? '25' : '20';
|
173 |
-
} else {
|
174 |
-
size = settings.keywords ? '11' : '7';
|
175 |
-
}
|
176 |
-
|
177 |
-
// The input
|
178 |
-
input
|
179 |
-
.addClass('minicolors-input')
|
180 |
-
.data('minicolors-initialized', false)
|
181 |
-
.data('minicolors-settings', settings)
|
182 |
-
.prop('size', size)
|
183 |
-
.wrap(minicolors)
|
184 |
-
.after(
|
185 |
-
'<div class="minicolors-panel minicolors-slider-' + settings.control + '">' +
|
186 |
-
'<div class="minicolors-slider minicolors-sprite">' +
|
187 |
-
'<div class="minicolors-picker"></div>' +
|
188 |
-
'</div>' +
|
189 |
-
'<div class="minicolors-opacity-slider minicolors-sprite">' +
|
190 |
-
'<div class="minicolors-picker"></div>' +
|
191 |
-
'</div>' +
|
192 |
-
'<div class="minicolors-grid minicolors-sprite">' +
|
193 |
-
'<div class="minicolors-grid-inner"></div>' +
|
194 |
-
'<div class="minicolors-picker"><div></div></div>' +
|
195 |
-
'</div>' +
|
196 |
-
'</div>'
|
197 |
-
);
|
198 |
-
|
199 |
-
// The swatch
|
200 |
-
if(!settings.inline) {
|
201 |
-
input.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>');
|
202 |
-
input.next('.minicolors-input-swatch').on('click', function(event) {
|
203 |
-
event.preventDefault();
|
204 |
-
input.focus();
|
205 |
-
});
|
206 |
-
}
|
207 |
-
|
208 |
-
// Prevent text selection in IE
|
209 |
-
panel = input.parent().find('.minicolors-panel');
|
210 |
-
panel.on('selectstart', function() { return false; }).end();
|
211 |
-
|
212 |
-
// Swatches
|
213 |
-
if(settings.swatches && settings.swatches.length !== 0) {
|
214 |
-
panel.addClass('minicolors-with-swatches');
|
215 |
-
swatches = $('<ul class="minicolors-swatches"></ul>')
|
216 |
-
.appendTo(panel);
|
217 |
-
for(i = 0; i < settings.swatches.length; ++i) {
|
218 |
-
swatch = settings.swatches[i];
|
219 |
-
swatch = isRgb(swatch) ? parseRgb(swatch, true) : hex2rgb(parseHex(swatch, true));
|
220 |
-
$('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>')
|
221 |
-
.appendTo(swatches)
|
222 |
-
.data('swatch-color', settings.swatches[i])
|
223 |
-
.find('.minicolors-swatch-color')
|
224 |
-
.css({
|
225 |
-
backgroundColor: rgb2hex(swatch),
|
226 |
-
opacity: swatch.a
|
227 |
-
});
|
228 |
-
settings.swatches[i] = swatch;
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
// Inline controls
|
233 |
-
if(settings.inline) input.parent().addClass('minicolors-inline');
|
234 |
-
|
235 |
-
updateFromInput(input, false);
|
236 |
-
|
237 |
-
input.data('minicolors-initialized', true);
|
238 |
-
}
|
239 |
-
|
240 |
-
// Returns the input back to its original state
|
241 |
-
function destroy(input) {
|
242 |
-
var minicolors = input.parent();
|
243 |
-
|
244 |
-
// Revert the input element
|
245 |
-
input
|
246 |
-
.removeData('minicolors-initialized')
|
247 |
-
.removeData('minicolors-settings')
|
248 |
-
.removeProp('size')
|
249 |
-
.removeClass('minicolors-input');
|
250 |
-
|
251 |
-
// Remove the wrap and destroy whatever remains
|
252 |
-
minicolors.before(input).remove();
|
253 |
-
}
|
254 |
-
|
255 |
-
// Shows the specified dropdown panel
|
256 |
-
function show(input) {
|
257 |
-
var minicolors = input.parent();
|
258 |
-
var panel = minicolors.find('.minicolors-panel');
|
259 |
-
var settings = input.data('minicolors-settings');
|
260 |
-
|
261 |
-
// Do nothing if uninitialized, disabled, inline, or already open
|
262 |
-
if(
|
263 |
-
!input.data('minicolors-initialized') ||
|
264 |
-
input.prop('disabled') ||
|
265 |
-
minicolors.hasClass('minicolors-inline') ||
|
266 |
-
minicolors.hasClass('minicolors-focus')
|
267 |
-
) return;
|
268 |
-
|
269 |
-
hide();
|
270 |
-
|
271 |
-
minicolors.addClass('minicolors-focus');
|
272 |
-
panel
|
273 |
-
.stop(true, true)
|
274 |
-
.fadeIn(settings.showSpeed, function() {
|
275 |
-
if(settings.show) settings.show.call(input.get(0));
|
276 |
-
});
|
277 |
-
}
|
278 |
-
|
279 |
-
// Hides all dropdown panels
|
280 |
-
function hide() {
|
281 |
-
$('.minicolors-focus').each(function() {
|
282 |
-
var minicolors = $(this);
|
283 |
-
var input = minicolors.find('.minicolors-input');
|
284 |
-
var panel = minicolors.find('.minicolors-panel');
|
285 |
-
var settings = input.data('minicolors-settings');
|
286 |
-
|
287 |
-
panel.fadeOut(settings.hideSpeed, function() {
|
288 |
-
if(settings.hide) settings.hide.call(input.get(0));
|
289 |
-
minicolors.removeClass('minicolors-focus');
|
290 |
-
});
|
291 |
-
|
292 |
-
});
|
293 |
-
}
|
294 |
-
|
295 |
-
// Moves the selected picker
|
296 |
-
function move(target, event, animate) {
|
297 |
-
var input = target.parents('.minicolors').find('.minicolors-input');
|
298 |
-
var settings = input.data('minicolors-settings');
|
299 |
-
var picker = target.find('[class$=-picker]');
|
300 |
-
var offsetX = target.offset().left;
|
301 |
-
var offsetY = target.offset().top;
|
302 |
-
var x = Math.round(event.pageX - offsetX);
|
303 |
-
var y = Math.round(event.pageY - offsetY);
|
304 |
-
var duration = animate ? settings.animationSpeed : 0;
|
305 |
-
var wx, wy, r, phi;
|
306 |
-
|
307 |
-
// Touch support
|
308 |
-
if(event.originalEvent.changedTouches) {
|
309 |
-
x = event.originalEvent.changedTouches[0].pageX - offsetX;
|
310 |
-
y = event.originalEvent.changedTouches[0].pageY - offsetY;
|
311 |
-
}
|
312 |
-
|
313 |
-
// Constrain picker to its container
|
314 |
-
if(x < 0) x = 0;
|
315 |
-
if(y < 0) y = 0;
|
316 |
-
if(x > target.width()) x = target.width();
|
317 |
-
if(y > target.height()) y = target.height();
|
318 |
-
|
319 |
-
// Constrain color wheel values to the wheel
|
320 |
-
if(target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid')) {
|
321 |
-
wx = 75 - x;
|
322 |
-
wy = 75 - y;
|
323 |
-
r = Math.sqrt(wx * wx + wy * wy);
|
324 |
-
phi = Math.atan2(wy, wx);
|
325 |
-
if(phi < 0) phi += Math.PI * 2;
|
326 |
-
if(r > 75) {
|
327 |
-
r = 75;
|
328 |
-
x = 75 - (75 * Math.cos(phi));
|
329 |
-
y = 75 - (75 * Math.sin(phi));
|
330 |
-
}
|
331 |
-
x = Math.round(x);
|
332 |
-
y = Math.round(y);
|
333 |
-
}
|
334 |
-
|
335 |
-
// Move the picker
|
336 |
-
if(target.is('.minicolors-grid')) {
|
337 |
-
picker
|
338 |
-
.stop(true)
|
339 |
-
.animate({
|
340 |
-
top: y + 'px',
|
341 |
-
left: x + 'px'
|
342 |
-
}, duration, settings.animationEasing, function() {
|
343 |
-
updateFromControl(input, target);
|
344 |
-
});
|
345 |
-
} else {
|
346 |
-
picker
|
347 |
-
.stop(true)
|
348 |
-
.animate({
|
349 |
-
top: y + 'px'
|
350 |
-
}, duration, settings.animationEasing, function() {
|
351 |
-
updateFromControl(input, target);
|
352 |
-
});
|
353 |
-
}
|
354 |
-
}
|
355 |
-
|
356 |
-
// Sets the input based on the color picker values
|
357 |
-
function updateFromControl(input, target) {
|
358 |
-
|
359 |
-
function getCoords(picker, container) {
|
360 |
-
var left, top;
|
361 |
-
if(!picker.length || !container) return null;
|
362 |
-
left = picker.offset().left;
|
363 |
-
top = picker.offset().top;
|
364 |
-
|
365 |
-
return {
|
366 |
-
x: left - container.offset().left + (picker.outerWidth() / 2),
|
367 |
-
y: top - container.offset().top + (picker.outerHeight() / 2)
|
368 |
-
};
|
369 |
-
}
|
370 |
-
|
371 |
-
var hue, saturation, brightness, x, y, r, phi;
|
372 |
-
var hex = input.val();
|
373 |
-
var opacity = input.attr('data-opacity');
|
374 |
-
|
375 |
-
// Helpful references
|
376 |
-
var minicolors = input.parent();
|
377 |
-
var settings = input.data('minicolors-settings');
|
378 |
-
var swatch = minicolors.find('.minicolors-input-swatch');
|
379 |
-
|
380 |
-
// Panel objects
|
381 |
-
var grid = minicolors.find('.minicolors-grid');
|
382 |
-
var slider = minicolors.find('.minicolors-slider');
|
383 |
-
var opacitySlider = minicolors.find('.minicolors-opacity-slider');
|
384 |
-
|
385 |
-
// Picker objects
|
386 |
-
var gridPicker = grid.find('[class$=-picker]');
|
387 |
-
var sliderPicker = slider.find('[class$=-picker]');
|
388 |
-
var opacityPicker = opacitySlider.find('[class$=-picker]');
|
389 |
-
|
390 |
-
// Picker positions
|
391 |
-
var gridPos = getCoords(gridPicker, grid);
|
392 |
-
var sliderPos = getCoords(sliderPicker, slider);
|
393 |
-
var opacityPos = getCoords(opacityPicker, opacitySlider);
|
394 |
-
|
395 |
-
// Handle colors
|
396 |
-
if(target.is('.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider')) {
|
397 |
-
|
398 |
-
// Determine HSB values
|
399 |
-
switch(settings.control) {
|
400 |
-
case 'wheel':
|
401 |
-
// Calculate hue, saturation, and brightness
|
402 |
-
x = (grid.width() / 2) - gridPos.x;
|
403 |
-
y = (grid.height() / 2) - gridPos.y;
|
404 |
-
r = Math.sqrt(x * x + y * y);
|
405 |
-
phi = Math.atan2(y, x);
|
406 |
-
if(phi < 0) phi += Math.PI * 2;
|
407 |
-
if(r > 75) {
|
408 |
-
r = 75;
|
409 |
-
gridPos.x = 69 - (75 * Math.cos(phi));
|
410 |
-
gridPos.y = 69 - (75 * Math.sin(phi));
|
411 |
-
}
|
412 |
-
saturation = keepWithin(r / 0.75, 0, 100);
|
413 |
-
hue = keepWithin(phi * 180 / Math.PI, 0, 360);
|
414 |
-
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
415 |
-
hex = hsb2hex({
|
416 |
-
h: hue,
|
417 |
-
s: saturation,
|
418 |
-
b: brightness
|
419 |
-
});
|
420 |
-
|
421 |
-
// Update UI
|
422 |
-
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
423 |
-
break;
|
424 |
-
|
425 |
-
case 'saturation':
|
426 |
-
// Calculate hue, saturation, and brightness
|
427 |
-
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
|
428 |
-
saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
429 |
-
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
430 |
-
hex = hsb2hex({
|
431 |
-
h: hue,
|
432 |
-
s: saturation,
|
433 |
-
b: brightness
|
434 |
-
});
|
435 |
-
|
436 |
-
// Update UI
|
437 |
-
slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
|
438 |
-
minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
|
439 |
-
break;
|
440 |
-
|
441 |
-
case 'brightness':
|
442 |
-
// Calculate hue, saturation, and brightness
|
443 |
-
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
|
444 |
-
saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
445 |
-
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
446 |
-
hex = hsb2hex({
|
447 |
-
h: hue,
|
448 |
-
s: saturation,
|
449 |
-
b: brightness
|
450 |
-
});
|
451 |
-
|
452 |
-
// Update UI
|
453 |
-
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
454 |
-
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
|
455 |
-
break;
|
456 |
-
|
457 |
-
default:
|
458 |
-
// Calculate hue, saturation, and brightness
|
459 |
-
hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height()), 10), 0, 360);
|
460 |
-
saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
|
461 |
-
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
462 |
-
hex = hsb2hex({
|
463 |
-
h: hue,
|
464 |
-
s: saturation,
|
465 |
-
b: brightness
|
466 |
-
});
|
467 |
-
|
468 |
-
// Update UI
|
469 |
-
grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
|
470 |
-
break;
|
471 |
-
}
|
472 |
-
|
473 |
-
// Handle opacity
|
474 |
-
if(settings.opacity) {
|
475 |
-
opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
|
476 |
-
} else {
|
477 |
-
opacity = 1;
|
478 |
-
}
|
479 |
-
|
480 |
-
updateInput(input, hex, opacity);
|
481 |
-
}
|
482 |
-
else {
|
483 |
-
// Set swatch color
|
484 |
-
swatch.find('span').css({
|
485 |
-
backgroundColor: hex,
|
486 |
-
opacity: opacity
|
487 |
-
});
|
488 |
-
|
489 |
-
// Handle change event
|
490 |
-
doChange(input, hex, opacity);
|
491 |
-
}
|
492 |
-
}
|
493 |
-
|
494 |
-
// Sets the value of the input and does the appropriate conversions
|
495 |
-
// to respect settings, also updates the swatch
|
496 |
-
function updateInput(input, value, opacity) {
|
497 |
-
var rgb;
|
498 |
-
|
499 |
-
// Helpful references
|
500 |
-
var minicolors = input.parent();
|
501 |
-
var settings = input.data('minicolors-settings');
|
502 |
-
var swatch = minicolors.find('.minicolors-input-swatch');
|
503 |
-
|
504 |
-
if(settings.opacity) input.attr('data-opacity', opacity);
|
505 |
-
|
506 |
-
// Set color string
|
507 |
-
if(settings.format === 'rgb') {
|
508 |
-
// Returns RGB(A) string
|
509 |
-
|
510 |
-
// Checks for input format and does the conversion
|
511 |
-
if(isRgb(value)) {
|
512 |
-
rgb = parseRgb(value, true);
|
513 |
-
}
|
514 |
-
else {
|
515 |
-
rgb = hex2rgb(parseHex(value, true));
|
516 |
-
}
|
517 |
-
|
518 |
-
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
|
519 |
-
if(isNaN(opacity) || !settings.opacity) opacity = 1;
|
520 |
-
|
521 |
-
if(input.minicolors('rgbObject').a <= 1 && rgb && settings.opacity) {
|
522 |
-
// Set RGBA string if alpha
|
523 |
-
value = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
|
524 |
-
} else {
|
525 |
-
// Set RGB string (alpha = 1)
|
526 |
-
value = 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
|
527 |
-
}
|
528 |
-
} else {
|
529 |
-
// Returns hex color
|
530 |
-
|
531 |
-
// Checks for input format and does the conversion
|
532 |
-
if(isRgb(value)) {
|
533 |
-
value = rgbString2hex(value);
|
534 |
-
}
|
535 |
-
|
536 |
-
value = convertCase(value, settings.letterCase);
|
537 |
-
}
|
538 |
-
|
539 |
-
// Update value from picker
|
540 |
-
input.val(value);
|
541 |
-
|
542 |
-
// Set swatch color
|
543 |
-
swatch.find('span').css({
|
544 |
-
backgroundColor: value,
|
545 |
-
opacity: opacity
|
546 |
-
});
|
547 |
-
|
548 |
-
// Handle change event
|
549 |
-
doChange(input, value, opacity);
|
550 |
-
}
|
551 |
-
|
552 |
-
// Sets the color picker values from the input
|
553 |
-
function updateFromInput(input, preserveInputValue) {
|
554 |
-
var hex, hsb, opacity, keywords, alpha, value, x, y, r, phi;
|
555 |
-
|
556 |
-
// Helpful references
|
557 |
-
var minicolors = input.parent();
|
558 |
-
var settings = input.data('minicolors-settings');
|
559 |
-
var swatch = minicolors.find('.minicolors-input-swatch');
|
560 |
-
|
561 |
-
// Panel objects
|
562 |
-
var grid = minicolors.find('.minicolors-grid');
|
563 |
-
var slider = minicolors.find('.minicolors-slider');
|
564 |
-
var opacitySlider = minicolors.find('.minicolors-opacity-slider');
|
565 |
-
|
566 |
-
// Picker objects
|
567 |
-
var gridPicker = grid.find('[class$=-picker]');
|
568 |
-
var sliderPicker = slider.find('[class$=-picker]');
|
569 |
-
var opacityPicker = opacitySlider.find('[class$=-picker]');
|
570 |
-
|
571 |
-
// Determine hex/HSB values
|
572 |
-
if(isRgb(input.val())) {
|
573 |
-
// If input value is a rgb(a) string, convert it to hex color and update opacity
|
574 |
-
hex = rgbString2hex(input.val());
|
575 |
-
alpha = keepWithin(parseFloat(getAlpha(input.val())).toFixed(2), 0, 1);
|
576 |
-
if(alpha) {
|
577 |
-
input.attr('data-opacity', alpha);
|
578 |
-
}
|
579 |
-
} else {
|
580 |
-
hex = convertCase(parseHex(input.val(), true), settings.letterCase);
|
581 |
-
}
|
582 |
-
|
583 |
-
if(!hex){
|
584 |
-
hex = convertCase(parseInput(settings.defaultValue, true), settings.letterCase);
|
585 |
-
}
|
586 |
-
hsb = hex2hsb(hex);
|
587 |
-
|
588 |
-
// Get array of lowercase keywords
|
589 |
-
keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
|
590 |
-
return $.trim(a.toLowerCase());
|
591 |
-
});
|
592 |
-
|
593 |
-
// Set color string
|
594 |
-
if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
|
595 |
-
value = convertCase(input.val());
|
596 |
-
} else {
|
597 |
-
value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
|
598 |
-
}
|
599 |
-
|
600 |
-
// Update input value
|
601 |
-
if(!preserveInputValue) input.val(value);
|
602 |
-
|
603 |
-
// Determine opacity value
|
604 |
-
if(settings.opacity) {
|
605 |
-
// Get from data-opacity attribute and keep within 0-1 range
|
606 |
-
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
|
607 |
-
if(isNaN(opacity)) opacity = 1;
|
608 |
-
input.attr('data-opacity', opacity);
|
609 |
-
swatch.find('span').css('opacity', opacity);
|
610 |
-
|
611 |
-
// Set opacity picker position
|
612 |
-
y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
|
613 |
-
opacityPicker.css('top', y + 'px');
|
614 |
-
}
|
615 |
-
|
616 |
-
// Set opacity to zero if input value is transparent
|
617 |
-
if(input.val().toLowerCase() === 'transparent') {
|
618 |
-
swatch.find('span').css('opacity', 0);
|
619 |
-
}
|
620 |
-
|
621 |
-
// Update swatch
|
622 |
-
swatch.find('span').css('backgroundColor', hex);
|
623 |
-
|
624 |
-
// Determine picker locations
|
625 |
-
switch(settings.control) {
|
626 |
-
case 'wheel':
|
627 |
-
// Set grid position
|
628 |
-
r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
|
629 |
-
phi = hsb.h * Math.PI / 180;
|
630 |
-
x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
|
631 |
-
y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
|
632 |
-
gridPicker.css({
|
633 |
-
top: y + 'px',
|
634 |
-
left: x + 'px'
|
635 |
-
});
|
636 |
-
|
637 |
-
// Set slider position
|
638 |
-
y = 150 - (hsb.b / (100 / grid.height()));
|
639 |
-
if(hex === '') y = 0;
|
640 |
-
sliderPicker.css('top', y + 'px');
|
641 |
-
|
642 |
-
// Update panel color
|
643 |
-
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
644 |
-
break;
|
645 |
-
|
646 |
-
case 'saturation':
|
647 |
-
// Set grid position
|
648 |
-
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
649 |
-
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
650 |
-
gridPicker.css({
|
651 |
-
top: y + 'px',
|
652 |
-
left: x + 'px'
|
653 |
-
});
|
654 |
-
|
655 |
-
// Set slider position
|
656 |
-
y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
|
657 |
-
sliderPicker.css('top', y + 'px');
|
658 |
-
|
659 |
-
// Update UI
|
660 |
-
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
|
661 |
-
minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
|
662 |
-
break;
|
663 |
-
|
664 |
-
case 'brightness':
|
665 |
-
// Set grid position
|
666 |
-
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
667 |
-
y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
|
668 |
-
gridPicker.css({
|
669 |
-
top: y + 'px',
|
670 |
-
left: x + 'px'
|
671 |
-
});
|
672 |
-
|
673 |
-
// Set slider position
|
674 |
-
y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
|
675 |
-
sliderPicker.css('top', y + 'px');
|
676 |
-
|
677 |
-
// Update UI
|
678 |
-
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
679 |
-
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
|
680 |
-
break;
|
681 |
-
|
682 |
-
default:
|
683 |
-
// Set grid position
|
684 |
-
x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
|
685 |
-
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
686 |
-
gridPicker.css({
|
687 |
-
top: y + 'px',
|
688 |
-
left: x + 'px'
|
689 |
-
});
|
690 |
-
|
691 |
-
// Set slider position
|
692 |
-
y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
|
693 |
-
sliderPicker.css('top', y + 'px');
|
694 |
-
|
695 |
-
// Update panel color
|
696 |
-
grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
|
697 |
-
break;
|
698 |
-
}
|
699 |
-
|
700 |
-
// Fire change event, but only if minicolors is fully initialized
|
701 |
-
if(input.data('minicolors-initialized')) {
|
702 |
-
doChange(input, value, opacity);
|
703 |
-
}
|
704 |
-
}
|
705 |
-
|
706 |
-
// Runs the change and changeDelay callbacks
|
707 |
-
function doChange(input, value, opacity) {
|
708 |
-
var settings = input.data('minicolors-settings');
|
709 |
-
var lastChange = input.data('minicolors-lastChange');
|
710 |
-
var obj, sel, i;
|
711 |
-
|
712 |
-
// Only run if it actually changed
|
713 |
-
if(!lastChange || lastChange.value !== value || lastChange.opacity !== opacity) {
|
714 |
-
|
715 |
-
// Remember last-changed value
|
716 |
-
input.data('minicolors-lastChange', {
|
717 |
-
value: value,
|
718 |
-
opacity: opacity
|
719 |
-
});
|
720 |
-
|
721 |
-
// Check and select applicable swatch
|
722 |
-
if(settings.swatches && settings.swatches.length !== 0) {
|
723 |
-
if(!isRgb(value)) {
|
724 |
-
obj = hex2rgb(value);
|
725 |
-
}
|
726 |
-
else {
|
727 |
-
obj = parseRgb(value, true);
|
728 |
-
}
|
729 |
-
sel = -1;
|
730 |
-
for(i = 0; i < settings.swatches.length; ++i) {
|
731 |
-
if(obj.r === settings.swatches[i].r && obj.g === settings.swatches[i].g && obj.b === settings.swatches[i].b && obj.a === settings.swatches[i].a) {
|
732 |
-
sel = i;
|
733 |
-
break;
|
734 |
-
}
|
735 |
-
}
|
736 |
-
|
737 |
-
input.parent().find('.minicolors-swatches .minicolors-swatch').removeClass('selected');
|
738 |
-
if(sel !== -1) {
|
739 |
-
input.parent().find('.minicolors-swatches .minicolors-swatch').eq(i).addClass('selected');
|
740 |
-
}
|
741 |
-
}
|
742 |
-
|
743 |
-
// Fire change event
|
744 |
-
if(settings.change) {
|
745 |
-
if(settings.changeDelay) {
|
746 |
-
// Call after a delay
|
747 |
-
clearTimeout(input.data('minicolors-changeTimeout'));
|
748 |
-
input.data('minicolors-changeTimeout', setTimeout(function() {
|
749 |
-
settings.change.call(input.get(0), value, opacity);
|
750 |
-
}, settings.changeDelay));
|
751 |
-
} else {
|
752 |
-
// Call immediately
|
753 |
-
settings.change.call(input.get(0), value, opacity);
|
754 |
-
}
|
755 |
-
}
|
756 |
-
input.trigger('change').trigger('input');
|
757 |
-
}
|
758 |
-
}
|
759 |
-
|
760 |
-
// Generates an RGB(A) object based on the input's value
|
761 |
-
function rgbObject(input) {
|
762 |
-
var rgb,
|
763 |
-
opacity = $(input).attr('data-opacity');
|
764 |
-
if( isRgb($(input).val()) ) {
|
765 |
-
rgb = parseRgb($(input).val(), true);
|
766 |
-
} else {
|
767 |
-
var hex = parseHex($(input).val(), true);
|
768 |
-
rgb = hex2rgb(hex);
|
769 |
-
}
|
770 |
-
if( !rgb ) return null;
|
771 |
-
if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
|
772 |
-
return rgb;
|
773 |
-
}
|
774 |
-
|
775 |
-
// Generates an RGB(A) string based on the input's value
|
776 |
-
function rgbString(input, alpha) {
|
777 |
-
var rgb,
|
778 |
-
opacity = $(input).attr('data-opacity');
|
779 |
-
if( isRgb($(input).val()) ) {
|
780 |
-
rgb = parseRgb($(input).val(), true);
|
781 |
-
} else {
|
782 |
-
var hex = parseHex($(input).val(), true);
|
783 |
-
rgb = hex2rgb(hex);
|
784 |
-
}
|
785 |
-
if( !rgb ) return null;
|
786 |
-
if( opacity === undefined ) opacity = 1;
|
787 |
-
if( alpha ) {
|
788 |
-
return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
|
789 |
-
} else {
|
790 |
-
return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
|
791 |
-
}
|
792 |
-
}
|
793 |
-
|
794 |
-
// Converts to the letter case specified in settings
|
795 |
-
function convertCase(string, letterCase) {
|
796 |
-
return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
|
797 |
-
}
|
798 |
-
|
799 |
-
// Parses a string and returns a valid hex string when possible
|
800 |
-
function parseHex(string, expand) {
|
801 |
-
string = string.replace(/^#/g, '');
|
802 |
-
if(!string.match(/^[A-F0-9]{3,6}/ig)) return '';
|
803 |
-
if(string.length !== 3 && string.length !== 6) return '';
|
804 |
-
if(string.length === 3 && expand) {
|
805 |
-
string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
|
806 |
-
}
|
807 |
-
return '#' + string;
|
808 |
-
}
|
809 |
-
|
810 |
-
// Parses a string and returns a valid RGB(A) string when possible
|
811 |
-
function parseRgb(string, obj) {
|
812 |
-
var values = string.replace(/[^\d,.]/g, '');
|
813 |
-
var rgba = values.split(',');
|
814 |
-
|
815 |
-
rgba[0] = keepWithin(parseInt(rgba[0], 10), 0, 255);
|
816 |
-
rgba[1] = keepWithin(parseInt(rgba[1], 10), 0, 255);
|
817 |
-
rgba[2] = keepWithin(parseInt(rgba[2], 10), 0, 255);
|
818 |
-
if(rgba[3]) {
|
819 |
-
rgba[3] = keepWithin(parseFloat(rgba[3], 10), 0, 1);
|
820 |
-
}
|
821 |
-
|
822 |
-
// Return RGBA object
|
823 |
-
if( obj ) {
|
824 |
-
if (rgba[3]) {
|
825 |
-
return {
|
826 |
-
r: rgba[0],
|
827 |
-
g: rgba[1],
|
828 |
-
b: rgba[2],
|
829 |
-
a: rgba[3]
|
830 |
-
};
|
831 |
-
} else {
|
832 |
-
return {
|
833 |
-
r: rgba[0],
|
834 |
-
g: rgba[1],
|
835 |
-
b: rgba[2]
|
836 |
-
};
|
837 |
-
}
|
838 |
-
}
|
839 |
-
|
840 |
-
// Return RGBA string
|
841 |
-
if(typeof(rgba[3]) !== 'undefined' && rgba[3] <= 1) {
|
842 |
-
return 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')';
|
843 |
-
} else {
|
844 |
-
return 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')';
|
845 |
-
}
|
846 |
-
|
847 |
-
}
|
848 |
-
|
849 |
-
// Parses a string and returns a valid color string when possible
|
850 |
-
function parseInput(string, expand) {
|
851 |
-
if(isRgb(string)) {
|
852 |
-
// Returns a valid rgb(a) string
|
853 |
-
return parseRgb(string);
|
854 |
-
} else {
|
855 |
-
return parseHex(string, expand);
|
856 |
-
}
|
857 |
-
}
|
858 |
-
|
859 |
-
// Keeps value within min and max
|
860 |
-
function keepWithin(value, min, max) {
|
861 |
-
if(value < min) value = min;
|
862 |
-
if(value > max) value = max;
|
863 |
-
return value;
|
864 |
-
}
|
865 |
-
|
866 |
-
// Checks if a string is a valid RGB(A) string
|
867 |
-
function isRgb(string) {
|
868 |
-
var rgb = string.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
|
869 |
-
return (rgb && rgb.length === 4) ? true : false;
|
870 |
-
}
|
871 |
-
|
872 |
-
// Function to get alpha from a RGB(A) string
|
873 |
-
function getAlpha(rgba) {
|
874 |
-
rgba = rgba.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i);
|
875 |
-
return (rgba && rgba.length === 6) ? rgba[4] : '1';
|
876 |
-
}
|
877 |
-
|
878 |
-
// Converts an HSB object to an RGB object
|
879 |
-
function hsb2rgb(hsb) {
|
880 |
-
var rgb = {};
|
881 |
-
var h = Math.round(hsb.h);
|
882 |
-
var s = Math.round(hsb.s * 255 / 100);
|
883 |
-
var v = Math.round(hsb.b * 255 / 100);
|
884 |
-
if(s === 0) {
|
885 |
-
rgb.r = rgb.g = rgb.b = v;
|
886 |
-
} else {
|
887 |
-
var t1 = v;
|
888 |
-
var t2 = (255 - s) * v / 255;
|
889 |
-
var t3 = (t1 - t2) * (h % 60) / 60;
|
890 |
-
if(h === 360) h = 0;
|
891 |
-
if(h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
|
892 |
-
else if(h < 120) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
|
893 |
-
else if(h < 180) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
|
894 |
-
else if(h < 240) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
|
895 |
-
else if(h < 300) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
|
896 |
-
else if(h < 360) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
|
897 |
-
else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
|
898 |
-
}
|
899 |
-
return {
|
900 |
-
r: Math.round(rgb.r),
|
901 |
-
g: Math.round(rgb.g),
|
902 |
-
b: Math.round(rgb.b)
|
903 |
-
};
|
904 |
-
}
|
905 |
-
|
906 |
-
// Converts an RGB string to a hex string
|
907 |
-
function rgbString2hex(rgb){
|
908 |
-
rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
|
909 |
-
return (rgb && rgb.length === 4) ? '#' +
|
910 |
-
('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +
|
911 |
-
('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +
|
912 |
-
('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';
|
913 |
-
}
|
914 |
-
|
915 |
-
// Converts an RGB object to a hex string
|
916 |
-
function rgb2hex(rgb) {
|
917 |
-
var hex = [
|
918 |
-
rgb.r.toString(16),
|
919 |
-
rgb.g.toString(16),
|
920 |
-
rgb.b.toString(16)
|
921 |
-
];
|
922 |
-
$.each(hex, function(nr, val) {
|
923 |
-
if(val.length === 1) hex[nr] = '0' + val;
|
924 |
-
});
|
925 |
-
return '#' + hex.join('');
|
926 |
-
}
|
927 |
-
|
928 |
-
// Converts an HSB object to a hex string
|
929 |
-
function hsb2hex(hsb) {
|
930 |
-
return rgb2hex(hsb2rgb(hsb));
|
931 |
-
}
|
932 |
-
|
933 |
-
// Converts a hex string to an HSB object
|
934 |
-
function hex2hsb(hex) {
|
935 |
-
var hsb = rgb2hsb(hex2rgb(hex));
|
936 |
-
if(hsb.s === 0) hsb.h = 360;
|
937 |
-
return hsb;
|
938 |
-
}
|
939 |
-
|
940 |
-
// Converts an RGB object to an HSB object
|
941 |
-
function rgb2hsb(rgb) {
|
942 |
-
var hsb = { h: 0, s: 0, b: 0 };
|
943 |
-
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
944 |
-
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
945 |
-
var delta = max - min;
|
946 |
-
hsb.b = max;
|
947 |
-
hsb.s = max !== 0 ? 255 * delta / max : 0;
|
948 |
-
if(hsb.s !== 0) {
|
949 |
-
if(rgb.r === max) {
|
950 |
-
hsb.h = (rgb.g - rgb.b) / delta;
|
951 |
-
} else if(rgb.g === max) {
|
952 |
-
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
953 |
-
} else {
|
954 |
-
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
955 |
-
}
|
956 |
-
} else {
|
957 |
-
hsb.h = -1;
|
958 |
-
}
|
959 |
-
hsb.h *= 60;
|
960 |
-
if(hsb.h < 0) {
|
961 |
-
hsb.h += 360;
|
962 |
-
}
|
963 |
-
hsb.s *= 100/255;
|
964 |
-
hsb.b *= 100/255;
|
965 |
-
return hsb;
|
966 |
-
}
|
967 |
-
|
968 |
-
// Converts a hex string to an RGB object
|
969 |
-
function hex2rgb(hex) {
|
970 |
-
hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
971 |
-
return {
|
972 |
-
r: hex >> 16,
|
973 |
-
g: (hex & 0x00FF00) >> 8,
|
974 |
-
b: (hex & 0x0000FF)
|
975 |
-
};
|
976 |
-
}
|
977 |
-
|
978 |
-
// Handle events
|
979 |
-
$([document])
|
980 |
-
// Hide on clicks outside of the control
|
981 |
-
.on('mousedown.minicolors touchstart.minicolors', function(event) {
|
982 |
-
if(!$(event.target).parents().add(event.target).hasClass('minicolors')) {
|
983 |
-
hide();
|
984 |
-
}
|
985 |
-
})
|
986 |
-
// Start moving
|
987 |
-
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
|
988 |
-
var target = $(this);
|
989 |
-
event.preventDefault();
|
990 |
-
$(event.delegateTarget).data('minicolors-target', target);
|
991 |
-
move(target, event, true);
|
992 |
-
})
|
993 |
-
// Move pickers
|
994 |
-
.on('mousemove.minicolors touchmove.minicolors', function(event) {
|
995 |
-
var target = $(event.delegateTarget).data('minicolors-target');
|
996 |
-
if(target) move(target, event);
|
997 |
-
})
|
998 |
-
// Stop moving
|
999 |
-
.on('mouseup.minicolors touchend.minicolors', function() {
|
1000 |
-
$(this).removeData('minicolors-target');
|
1001 |
-
})
|
1002 |
-
// Selected a swatch
|
1003 |
-
.on('click.minicolors', '.minicolors-swatches li', function(event) {
|
1004 |
-
event.preventDefault();
|
1005 |
-
var target = $(this), input = target.parents('.minicolors').find('.minicolors-input'), color = target.data('swatch-color');
|
1006 |
-
updateInput(input, color, getAlpha(color));
|
1007 |
-
updateFromInput(input);
|
1008 |
-
})
|
1009 |
-
// Show panel when swatch is clicked
|
1010 |
-
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-input-swatch', function(event) {
|
1011 |
-
var input = $(this).parent().find('.minicolors-input');
|
1012 |
-
event.preventDefault();
|
1013 |
-
show(input);
|
1014 |
-
})
|
1015 |
-
// Show on focus
|
1016 |
-
.on('focus.minicolors', '.minicolors-input', function() {
|
1017 |
-
var input = $(this);
|
1018 |
-
if(!input.data('minicolors-initialized')) return;
|
1019 |
-
show(input);
|
1020 |
-
})
|
1021 |
-
// Update value on blur
|
1022 |
-
.on('blur.minicolors', '.minicolors-input', function() {
|
1023 |
-
var input = $(this);
|
1024 |
-
var settings = input.data('minicolors-settings');
|
1025 |
-
var keywords;
|
1026 |
-
var hex;
|
1027 |
-
var rgba;
|
1028 |
-
var swatchOpacity;
|
1029 |
-
var value;
|
1030 |
-
|
1031 |
-
if(!input.data('minicolors-initialized')) return;
|
1032 |
-
|
1033 |
-
// Get array of lowercase keywords
|
1034 |
-
keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
|
1035 |
-
return $.trim(a.toLowerCase());
|
1036 |
-
});
|
1037 |
-
|
1038 |
-
// Set color string
|
1039 |
-
if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
|
1040 |
-
value = input.val();
|
1041 |
-
} else {
|
1042 |
-
// Get RGBA values for easy conversion
|
1043 |
-
if(isRgb(input.val())) {
|
1044 |
-
rgba = parseRgb(input.val(), true);
|
1045 |
-
} else {
|
1046 |
-
hex = parseHex(input.val(), true);
|
1047 |
-
rgba = hex ? hex2rgb(hex) : null;
|
1048 |
-
}
|
1049 |
-
|
1050 |
-
// Convert to format
|
1051 |
-
if(rgba === null) {
|
1052 |
-
value = settings.defaultValue;
|
1053 |
-
} else if(settings.format === 'rgb') {
|
1054 |
-
value = settings.opacity ?
|
1055 |
-
parseRgb('rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + input.attr('data-opacity') + ')') :
|
1056 |
-
parseRgb('rgb(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ')');
|
1057 |
-
} else {
|
1058 |
-
value = rgb2hex(rgba);
|
1059 |
-
}
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
// Update swatch opacity
|
1063 |
-
swatchOpacity = settings.opacity ? input.attr('data-opacity') : 1;
|
1064 |
-
if(value.toLowerCase() === 'transparent') swatchOpacity = 0;
|
1065 |
-
input
|
1066 |
-
.closest('.minicolors')
|
1067 |
-
.find('.minicolors-input-swatch > span')
|
1068 |
-
.css('opacity', swatchOpacity);
|
1069 |
-
|
1070 |
-
// Set input value
|
1071 |
-
input.val(value);
|
1072 |
-
|
1073 |
-
// Is it blank?
|
1074 |
-
if(input.val() === '') input.val(parseInput(settings.defaultValue, true));
|
1075 |
-
|
1076 |
-
// Adjust case
|
1077 |
-
input.val(convertCase(input.val(), settings.letterCase));
|
1078 |
-
|
1079 |
-
})
|
1080 |
-
// Handle keypresses
|
1081 |
-
.on('keydown.minicolors', '.minicolors-input', function(event) {
|
1082 |
-
var input = $(this);
|
1083 |
-
if(!input.data('minicolors-initialized')) return;
|
1084 |
-
switch(event.keyCode) {
|
1085 |
-
case 9: // tab
|
1086 |
-
hide();
|
1087 |
-
break;
|
1088 |
-
case 13: // enter
|
1089 |
-
case 27: // esc
|
1090 |
-
hide();
|
1091 |
-
input.blur();
|
1092 |
-
break;
|
1093 |
-
}
|
1094 |
-
})
|
1095 |
-
// Update on keyup
|
1096 |
-
.on('keyup.minicolors', '.minicolors-input', function() {
|
1097 |
-
var input = $(this);
|
1098 |
-
if(!input.data('minicolors-initialized')) return;
|
1099 |
-
updateFromInput(input, true);
|
1100 |
-
})
|
1101 |
-
// Update on paste
|
1102 |
-
.on('paste.minicolors', '.minicolors-input', function() {
|
1103 |
-
var input = $(this);
|
1104 |
-
if(!input.data('minicolors-initialized')) return;
|
1105 |
-
setTimeout(function() {
|
1106 |
-
updateFromInput(input, true);
|
1107 |
-
}, 1);
|
1108 |
-
});
|
1109 |
-
}));
|
1 |
+
// jscs:disable
|
2 |
+
|
3 |
+
// jQuery MiniColors: A tiny color picker built on jQuery
|
4 |
+
//
|
5 |
+
// Developed by Cory LaViska for A Beautiful Site, LLC
|
6 |
+
//
|
7 |
+
// Licensed under the MIT license: http://opensource.org/licenses/MIT
|
8 |
+
//
|
9 |
+
(function (factory) {
|
10 |
+
if(typeof define === 'function' && define.amd) {
|
11 |
+
// AMD. Register as an anonymous module.
|
12 |
+
define(['jquery'], factory);
|
13 |
+
} else if(typeof exports === 'object') {
|
14 |
+
// Node/CommonJS
|
15 |
+
module.exports = factory(require('jquery'));
|
16 |
+
} else {
|
17 |
+
// Browser globals
|
18 |
+
factory(jQuery);
|
19 |
+
}
|
20 |
+
}(function ($) {
|
21 |
+
'use strict';
|
22 |
+
|
23 |
+
// Defaults
|
24 |
+
$.minicolors = {
|
25 |
+
defaults: {
|
26 |
+
animationSpeed: 50,
|
27 |
+
animationEasing: 'swing',
|
28 |
+
change: null,
|
29 |
+
changeDelay: 0,
|
30 |
+
control: 'hue',
|
31 |
+
defaultValue: '',
|
32 |
+
format: 'hex',
|
33 |
+
hide: null,
|
34 |
+
hideSpeed: 100,
|
35 |
+
inline: false,
|
36 |
+
keywords: '',
|
37 |
+
letterCase: 'lowercase',
|
38 |
+
opacity: false,
|
39 |
+
position: 'bottom left',
|
40 |
+
show: null,
|
41 |
+
showSpeed: 100,
|
42 |
+
theme: 'default',
|
43 |
+
swatches: []
|
44 |
+
}
|
45 |
+
};
|
46 |
+
|
47 |
+
// Public methods
|
48 |
+
$.extend($.fn, {
|
49 |
+
minicolors: function(method, data) {
|
50 |
+
|
51 |
+
switch(method) {
|
52 |
+
// Destroy the control
|
53 |
+
case 'destroy':
|
54 |
+
$(this).each(function() {
|
55 |
+
destroy($(this));
|
56 |
+
});
|
57 |
+
return $(this);
|
58 |
+
|
59 |
+
// Hide the color picker
|
60 |
+
case 'hide':
|
61 |
+
hide();
|
62 |
+
return $(this);
|
63 |
+
|
64 |
+
// Get/set opacity
|
65 |
+
case 'opacity':
|
66 |
+
// Getter
|
67 |
+
if(data === undefined) {
|
68 |
+
// Getter
|
69 |
+
return $(this).attr('data-opacity');
|
70 |
+
} else {
|
71 |
+
// Setter
|
72 |
+
$(this).each(function() {
|
73 |
+
updateFromInput($(this).attr('data-opacity', data));
|
74 |
+
});
|
75 |
+
}
|
76 |
+
return $(this);
|
77 |
+
|
78 |
+
// Get an RGB(A) object based on the current color/opacity
|
79 |
+
case 'rgbObject':
|
80 |
+
return rgbObject($(this), method === 'rgbaObject');
|
81 |
+
|
82 |
+
// Get an RGB(A) string based on the current color/opacity
|
83 |
+
case 'rgbString':
|
84 |
+
case 'rgbaString':
|
85 |
+
return rgbString($(this), method === 'rgbaString');
|
86 |
+
|
87 |
+
// Get/set settings on the fly
|
88 |
+
case 'settings':
|
89 |
+
if(data === undefined) {
|
90 |
+
return $(this).data('minicolors-settings');
|
91 |
+
} else {
|
92 |
+
// Setter
|
93 |
+
$(this).each(function() {
|
94 |
+
var settings = $(this).data('minicolors-settings') || {};
|
95 |
+
destroy($(this));
|
96 |
+
$(this).minicolors($.extend(true, settings, data));
|
97 |
+
});
|
98 |
+
}
|
99 |
+
return $(this);
|
100 |
+
|
101 |
+
// Show the color picker
|
102 |
+
case 'show':
|
103 |
+
show($(this).eq(0));
|
104 |
+
return $(this);
|
105 |
+
|
106 |
+
// Get/set the hex color value
|
107 |
+
case 'value':
|
108 |
+
if(data === undefined) {
|
109 |
+
// Getter
|
110 |
+
return $(this).val();
|
111 |
+
} else {
|
112 |
+
// Setter
|
113 |
+
$(this).each(function() {
|
114 |
+
if(typeof(data) === 'object' && data !== null) {
|
115 |
+
if(data.opacity) {
|
116 |
+
$(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
|
117 |
+
}
|
118 |
+
if(data.color) {
|
119 |
+
$(this).val(data.color);
|
120 |
+
}
|
121 |
+
} else {
|
122 |
+
$(this).val(data);
|
123 |
+
}
|
124 |
+
updateFromInput($(this));
|
125 |
+
});
|
126 |
+
}
|
127 |
+
return $(this);
|
128 |
+
|
129 |
+
// Initializes the control
|
130 |
+
default:
|
131 |
+
if(method !== 'create') data = method;
|
132 |
+
$(this).each(function() {
|
133 |
+
init($(this), data);
|
134 |
+
});
|
135 |
+
return $(this);
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
}
|
140 |
+
});
|
141 |
+
|
142 |
+
// Initialize input elements
|
143 |
+
function init(input, settings) {
|
144 |
+
var minicolors = $('<div class="minicolors" />');
|
145 |
+
var defaults = $.minicolors.defaults;
|
146 |
+
var size;
|
147 |
+
var swatches;
|
148 |
+
var swatch;
|
149 |
+
var panel;
|
150 |
+
var i;
|
151 |
+
|
152 |
+
// Do nothing if already initialized
|
153 |
+
if(input.data('minicolors-initialized')) return;
|
154 |
+
|
155 |
+
// Handle settings
|
156 |
+
settings = $.extend(true, {}, defaults, settings);
|
157 |
+
|
158 |
+
// The wrapper
|
159 |
+
minicolors
|
160 |
+
.addClass('minicolors-theme-' + settings.theme)
|
161 |
+
.toggleClass('minicolors-with-opacity', settings.opacity);
|
162 |
+
|
163 |
+
// Custom positioning
|
164 |
+
if(settings.position !== undefined) {
|
165 |
+
$.each(settings.position.split(' '), function() {
|
166 |
+
minicolors.addClass('minicolors-position-' + this);
|
167 |
+
});
|
168 |
+
}
|
169 |
+
|
170 |
+
// Input size
|
171 |
+
if(settings.format === 'rgb') {
|
172 |
+
size = settings.opacity ? '25' : '20';
|
173 |
+
} else {
|
174 |
+
size = settings.keywords ? '11' : '7';
|
175 |
+
}
|
176 |
+
|
177 |
+
// The input
|
178 |
+
input
|
179 |
+
.addClass('minicolors-input')
|
180 |
+
.data('minicolors-initialized', false)
|
181 |
+
.data('minicolors-settings', settings)
|
182 |
+
.prop('size', size)
|
183 |
+
.wrap(minicolors)
|
184 |
+
.after(
|
185 |
+
'<div class="minicolors-panel minicolors-slider-' + settings.control + '">' +
|
186 |
+
'<div class="minicolors-slider minicolors-sprite">' +
|
187 |
+
'<div class="minicolors-picker"></div>' +
|
188 |
+
'</div>' +
|
189 |
+
'<div class="minicolors-opacity-slider minicolors-sprite">' +
|
190 |
+
'<div class="minicolors-picker"></div>' +
|
191 |
+
'</div>' +
|
192 |
+
'<div class="minicolors-grid minicolors-sprite">' +
|
193 |
+
'<div class="minicolors-grid-inner"></div>' +
|
194 |
+
'<div class="minicolors-picker"><div></div></div>' +
|
195 |
+
'</div>' +
|
196 |
+
'</div>'
|
197 |
+
);
|
198 |
+
|
199 |
+
// The swatch
|
200 |
+
if(!settings.inline) {
|
201 |
+
input.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>');
|
202 |
+
input.next('.minicolors-input-swatch').on('click', function(event) {
|
203 |
+
event.preventDefault();
|
204 |
+
input.focus();
|
205 |
+
});
|
206 |
+
}
|
207 |
+
|
208 |
+
// Prevent text selection in IE
|
209 |
+
panel = input.parent().find('.minicolors-panel');
|
210 |
+
panel.on('selectstart', function() { return false; }).end();
|
211 |
+
|
212 |
+
// Swatches
|
213 |
+
if(settings.swatches && settings.swatches.length !== 0) {
|
214 |
+
panel.addClass('minicolors-with-swatches');
|
215 |
+
swatches = $('<ul class="minicolors-swatches"></ul>')
|
216 |
+
.appendTo(panel);
|
217 |
+
for(i = 0; i < settings.swatches.length; ++i) {
|
218 |
+
swatch = settings.swatches[i];
|
219 |
+
swatch = isRgb(swatch) ? parseRgb(swatch, true) : hex2rgb(parseHex(swatch, true));
|
220 |
+
$('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>')
|
221 |
+
.appendTo(swatches)
|
222 |
+
.data('swatch-color', settings.swatches[i])
|
223 |
+
.find('.minicolors-swatch-color')
|
224 |
+
.css({
|
225 |
+
backgroundColor: rgb2hex(swatch),
|
226 |
+
opacity: swatch.a
|
227 |
+
});
|
228 |
+
settings.swatches[i] = swatch;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
// Inline controls
|
233 |
+
if(settings.inline) input.parent().addClass('minicolors-inline');
|
234 |
+
|
235 |
+
updateFromInput(input, false);
|
236 |
+
|
237 |
+
input.data('minicolors-initialized', true);
|
238 |
+
}
|
239 |
+
|
240 |
+
// Returns the input back to its original state
|
241 |
+
function destroy(input) {
|
242 |
+
var minicolors = input.parent();
|
243 |
+
|
244 |
+
// Revert the input element
|
245 |
+
input
|
246 |
+
.removeData('minicolors-initialized')
|
247 |
+
.removeData('minicolors-settings')
|
248 |
+
.removeProp('size')
|
249 |
+
.removeClass('minicolors-input');
|
250 |
+
|
251 |
+
// Remove the wrap and destroy whatever remains
|
252 |
+
minicolors.before(input).remove();
|
253 |
+
}
|
254 |
+
|
255 |
+
// Shows the specified dropdown panel
|
256 |
+
function show(input) {
|
257 |
+
var minicolors = input.parent();
|
258 |
+
var panel = minicolors.find('.minicolors-panel');
|
259 |
+
var settings = input.data('minicolors-settings');
|
260 |
+
|
261 |
+
// Do nothing if uninitialized, disabled, inline, or already open
|
262 |
+
if(
|
263 |
+
!input.data('minicolors-initialized') ||
|
264 |
+
input.prop('disabled') ||
|
265 |
+
minicolors.hasClass('minicolors-inline') ||
|
266 |
+
minicolors.hasClass('minicolors-focus')
|
267 |
+
) return;
|
268 |
+
|
269 |
+
hide();
|
270 |
+
|
271 |
+
minicolors.addClass('minicolors-focus');
|
272 |
+
panel
|
273 |
+
.stop(true, true)
|
274 |
+
.fadeIn(settings.showSpeed, function() {
|
275 |
+
if(settings.show) settings.show.call(input.get(0));
|
276 |
+
});
|
277 |
+
}
|
278 |
+
|
279 |
+
// Hides all dropdown panels
|
280 |
+
function hide() {
|
281 |
+
$('.minicolors-focus').each(function() {
|
282 |
+
var minicolors = $(this);
|
283 |
+
var input = minicolors.find('.minicolors-input');
|
284 |
+
var panel = minicolors.find('.minicolors-panel');
|
285 |
+
var settings = input.data('minicolors-settings');
|
286 |
+
|
287 |
+
panel.fadeOut(settings.hideSpeed, function() {
|
288 |
+
if(settings.hide) settings.hide.call(input.get(0));
|
289 |
+
minicolors.removeClass('minicolors-focus');
|
290 |
+
});
|
291 |
+
|
292 |
+
});
|
293 |
+
}
|
294 |
+
|
295 |
+
// Moves the selected picker
|
296 |
+
function move(target, event, animate) {
|
297 |
+
var input = target.parents('.minicolors').find('.minicolors-input');
|
298 |
+
var settings = input.data('minicolors-settings');
|
299 |
+
var picker = target.find('[class$=-picker]');
|
300 |
+
var offsetX = target.offset().left;
|
301 |
+
var offsetY = target.offset().top;
|
302 |
+
var x = Math.round(event.pageX - offsetX);
|
303 |
+
var y = Math.round(event.pageY - offsetY);
|
304 |
+
var duration = animate ? settings.animationSpeed : 0;
|
305 |
+
var wx, wy, r, phi;
|
306 |
+
|
307 |
+
// Touch support
|
308 |
+
if(event.originalEvent.changedTouches) {
|
309 |
+
x = event.originalEvent.changedTouches[0].pageX - offsetX;
|
310 |
+
y = event.originalEvent.changedTouches[0].pageY - offsetY;
|
311 |
+
}
|
312 |
+
|
313 |
+
// Constrain picker to its container
|
314 |
+
if(x < 0) x = 0;
|
315 |
+
if(y < 0) y = 0;
|
316 |
+
if(x > target.width()) x = target.width();
|
317 |
+
if(y > target.height()) y = target.height();
|
318 |
+
|
319 |
+
// Constrain color wheel values to the wheel
|
320 |
+
if(target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid')) {
|
321 |
+
wx = 75 - x;
|
322 |
+
wy = 75 - y;
|
323 |
+
r = Math.sqrt(wx * wx + wy * wy);
|
324 |
+
phi = Math.atan2(wy, wx);
|
325 |
+
if(phi < 0) phi += Math.PI * 2;
|
326 |
+
if(r > 75) {
|
327 |
+
r = 75;
|
328 |
+
x = 75 - (75 * Math.cos(phi));
|
329 |
+
y = 75 - (75 * Math.sin(phi));
|
330 |
+
}
|
331 |
+
x = Math.round(x);
|
332 |
+
y = Math.round(y);
|
333 |
+
}
|
334 |
+
|
335 |
+
// Move the picker
|
336 |
+
if(target.is('.minicolors-grid')) {
|
337 |
+
picker
|
338 |
+
.stop(true)
|
339 |
+
.animate({
|
340 |
+
top: y + 'px',
|
341 |
+
left: x + 'px'
|
342 |
+
}, duration, settings.animationEasing, function() {
|
343 |
+
updateFromControl(input, target);
|
344 |
+
});
|
345 |
+
} else {
|
346 |
+
picker
|
347 |
+
.stop(true)
|
348 |
+
.animate({
|
349 |
+
top: y + 'px'
|
350 |
+
}, duration, settings.animationEasing, function() {
|
351 |
+
updateFromControl(input, target);
|
352 |
+
});
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
// Sets the input based on the color picker values
|
357 |
+
function updateFromControl(input, target) {
|
358 |
+
|
359 |
+
function getCoords(picker, container) {
|
360 |
+
var left, top;
|
361 |
+
if(!picker.length || !container) return null;
|
362 |
+
left = picker.offset().left;
|
363 |
+
top = picker.offset().top;
|
364 |
+
|
365 |
+
return {
|
366 |
+
x: left - container.offset().left + (picker.outerWidth() / 2),
|
367 |
+
y: top - container.offset().top + (picker.outerHeight() / 2)
|
368 |
+
};
|
369 |
+
}
|
370 |
+
|
371 |
+
var hue, saturation, brightness, x, y, r, phi;
|
372 |
+
var hex = input.val();
|
373 |
+
var opacity = input.attr('data-opacity');
|
374 |
+
|
375 |
+
// Helpful references
|
376 |
+
var minicolors = input.parent();
|
377 |
+
var settings = input.data('minicolors-settings');
|
378 |
+
var swatch = minicolors.find('.minicolors-input-swatch');
|
379 |
+
|
380 |
+
// Panel objects
|
381 |
+
var grid = minicolors.find('.minicolors-grid');
|
382 |
+
var slider = minicolors.find('.minicolors-slider');
|
383 |
+
var opacitySlider = minicolors.find('.minicolors-opacity-slider');
|
384 |
+
|
385 |
+
// Picker objects
|
386 |
+
var gridPicker = grid.find('[class$=-picker]');
|
387 |
+
var sliderPicker = slider.find('[class$=-picker]');
|
388 |
+
var opacityPicker = opacitySlider.find('[class$=-picker]');
|
389 |
+
|
390 |
+
// Picker positions
|
391 |
+
var gridPos = getCoords(gridPicker, grid);
|
392 |
+
var sliderPos = getCoords(sliderPicker, slider);
|
393 |
+
var opacityPos = getCoords(opacityPicker, opacitySlider);
|
394 |
+
|
395 |
+
// Handle colors
|
396 |
+
if(target.is('.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider')) {
|
397 |
+
|
398 |
+
// Determine HSB values
|
399 |
+
switch(settings.control) {
|
400 |
+
case 'wheel':
|
401 |
+
// Calculate hue, saturation, and brightness
|
402 |
+
x = (grid.width() / 2) - gridPos.x;
|
403 |
+
y = (grid.height() / 2) - gridPos.y;
|
404 |
+
r = Math.sqrt(x * x + y * y);
|
405 |
+
phi = Math.atan2(y, x);
|
406 |
+
if(phi < 0) phi += Math.PI * 2;
|
407 |
+
if(r > 75) {
|
408 |
+
r = 75;
|
409 |
+
gridPos.x = 69 - (75 * Math.cos(phi));
|
410 |
+
gridPos.y = 69 - (75 * Math.sin(phi));
|
411 |
+
}
|
412 |
+
saturation = keepWithin(r / 0.75, 0, 100);
|
413 |
+
hue = keepWithin(phi * 180 / Math.PI, 0, 360);
|
414 |
+
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
415 |
+
hex = hsb2hex({
|
416 |
+
h: hue,
|
417 |
+
s: saturation,
|
418 |
+
b: brightness
|
419 |
+
});
|
420 |
+
|
421 |
+
// Update UI
|
422 |
+
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
423 |
+
break;
|
424 |
+
|
425 |
+
case 'saturation':
|
426 |
+
// Calculate hue, saturation, and brightness
|
427 |
+
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
|
428 |
+
saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
429 |
+
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
430 |
+
hex = hsb2hex({
|
431 |
+
h: hue,
|
432 |
+
s: saturation,
|
433 |
+
b: brightness
|
434 |
+
});
|
435 |
+
|
436 |
+
// Update UI
|
437 |
+
slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
|
438 |
+
minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
|
439 |
+
break;
|
440 |
+
|
441 |
+
case 'brightness':
|
442 |
+
// Calculate hue, saturation, and brightness
|
443 |
+
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
|
444 |
+
saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
445 |
+
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
446 |
+
hex = hsb2hex({
|
447 |
+
h: hue,
|
448 |
+
s: saturation,
|
449 |
+
b: brightness
|
450 |
+
});
|
451 |
+
|
452 |
+
// Update UI
|
453 |
+
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
454 |
+
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
|
455 |
+
break;
|
456 |
+
|
457 |
+
default:
|
458 |
+
// Calculate hue, saturation, and brightness
|
459 |
+
hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height()), 10), 0, 360);
|
460 |
+
saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
|
461 |
+
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
462 |
+
hex = hsb2hex({
|
463 |
+
h: hue,
|
464 |
+
s: saturation,
|
465 |
+
b: brightness
|
466 |
+
});
|
467 |
+
|
468 |
+
// Update UI
|
469 |
+
grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
|
470 |
+
break;
|
471 |
+
}
|
472 |
+
|
473 |
+
// Handle opacity
|
474 |
+
if(settings.opacity) {
|
475 |
+
opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
|
476 |
+
} else {
|
477 |
+
opacity = 1;
|
478 |
+
}
|
479 |
+
|
480 |
+
updateInput(input, hex, opacity);
|
481 |
+
}
|
482 |
+
else {
|
483 |
+
// Set swatch color
|
484 |
+
swatch.find('span').css({
|
485 |
+
backgroundColor: hex,
|
486 |
+
opacity: opacity
|
487 |
+
});
|
488 |
+
|
489 |
+
// Handle change event
|
490 |
+
doChange(input, hex, opacity);
|
491 |
+
}
|
492 |
+
}
|
493 |
+
|
494 |
+
// Sets the value of the input and does the appropriate conversions
|
495 |
+
// to respect settings, also updates the swatch
|
496 |
+
function updateInput(input, value, opacity) {
|
497 |
+
var rgb;
|
498 |
+
|
499 |
+
// Helpful references
|
500 |
+
var minicolors = input.parent();
|
501 |
+
var settings = input.data('minicolors-settings');
|
502 |
+
var swatch = minicolors.find('.minicolors-input-swatch');
|
503 |
+
|
504 |
+
if(settings.opacity) input.attr('data-opacity', opacity);
|
505 |
+
|
506 |
+
// Set color string
|
507 |
+
if(settings.format === 'rgb') {
|
508 |
+
// Returns RGB(A) string
|
509 |
+
|
510 |
+
// Checks for input format and does the conversion
|
511 |
+
if(isRgb(value)) {
|
512 |
+
rgb = parseRgb(value, true);
|
513 |
+
}
|
514 |
+
else {
|
515 |
+
rgb = hex2rgb(parseHex(value, true));
|
516 |
+
}
|
517 |
+
|
518 |
+
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
|
519 |
+
if(isNaN(opacity) || !settings.opacity) opacity = 1;
|
520 |
+
|
521 |
+
if(input.minicolors('rgbObject').a <= 1 && rgb && settings.opacity) {
|
522 |
+
// Set RGBA string if alpha
|
523 |
+
value = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
|
524 |
+
} else {
|
525 |
+
// Set RGB string (alpha = 1)
|
526 |
+
value = 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
|
527 |
+
}
|
528 |
+
} else {
|
529 |
+
// Returns hex color
|
530 |
+
|
531 |
+
// Checks for input format and does the conversion
|
532 |
+
if(isRgb(value)) {
|
533 |
+
value = rgbString2hex(value);
|
534 |
+
}
|
535 |
+
|
536 |
+
value = convertCase(value, settings.letterCase);
|
537 |
+
}
|
538 |
+
|
539 |
+
// Update value from picker
|
540 |
+
input.val(value);
|
541 |
+
|
542 |
+
// Set swatch color
|
543 |
+
swatch.find('span').css({
|
544 |
+
backgroundColor: value,
|
545 |
+
opacity: opacity
|
546 |
+
});
|
547 |
+
|
548 |
+
// Handle change event
|
549 |
+
doChange(input, value, opacity);
|
550 |
+
}
|
551 |
+
|
552 |
+
// Sets the color picker values from the input
|
553 |
+
function updateFromInput(input, preserveInputValue) {
|
554 |
+
var hex, hsb, opacity, keywords, alpha, value, x, y, r, phi;
|
555 |
+
|
556 |
+
// Helpful references
|
557 |
+
var minicolors = input.parent();
|
558 |
+
var settings = input.data('minicolors-settings');
|
559 |
+
var swatch = minicolors.find('.minicolors-input-swatch');
|
560 |
+
|
561 |
+
// Panel objects
|
562 |
+
var grid = minicolors.find('.minicolors-grid');
|
563 |
+
var slider = minicolors.find('.minicolors-slider');
|
564 |
+
var opacitySlider = minicolors.find('.minicolors-opacity-slider');
|
565 |
+
|
566 |
+
// Picker objects
|
567 |
+
var gridPicker = grid.find('[class$=-picker]');
|
568 |
+
var sliderPicker = slider.find('[class$=-picker]');
|
569 |
+
var opacityPicker = opacitySlider.find('[class$=-picker]');
|
570 |
+
|
571 |
+
// Determine hex/HSB values
|
572 |
+
if(isRgb(input.val())) {
|
573 |
+
// If input value is a rgb(a) string, convert it to hex color and update opacity
|
574 |
+
hex = rgbString2hex(input.val());
|
575 |
+
alpha = keepWithin(parseFloat(getAlpha(input.val())).toFixed(2), 0, 1);
|
576 |
+
if(alpha) {
|
577 |
+
input.attr('data-opacity', alpha);
|
578 |
+
}
|
579 |
+
} else {
|
580 |
+
hex = convertCase(parseHex(input.val(), true), settings.letterCase);
|
581 |
+
}
|
582 |
+
|
583 |
+
if(!hex){
|
584 |
+
hex = convertCase(parseInput(settings.defaultValue, true), settings.letterCase);
|
585 |
+
}
|
586 |
+
hsb = hex2hsb(hex);
|
587 |
+
|
588 |
+
// Get array of lowercase keywords
|
589 |
+
keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
|
590 |
+
return $.trim(a.toLowerCase());
|
591 |
+
});
|
592 |
+
|
593 |
+
// Set color string
|
594 |
+
if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
|
595 |
+
value = convertCase(input.val());
|
596 |
+
} else {
|
597 |
+
value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
|
598 |
+
}
|
599 |
+
|
600 |
+
// Update input value
|
601 |
+
if(!preserveInputValue) input.val(value);
|
602 |
+
|
603 |
+
// Determine opacity value
|
604 |
+
if(settings.opacity) {
|
605 |
+
// Get from data-opacity attribute and keep within 0-1 range
|
606 |
+
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
|
607 |
+
if(isNaN(opacity)) opacity = 1;
|
608 |
+
input.attr('data-opacity', opacity);
|
609 |
+
swatch.find('span').css('opacity', opacity);
|
610 |
+
|
611 |
+
// Set opacity picker position
|
612 |
+
y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
|
613 |
+
opacityPicker.css('top', y + 'px');
|
614 |
+
}
|
615 |
+
|
616 |
+
// Set opacity to zero if input value is transparent
|
617 |
+
if(input.val().toLowerCase() === 'transparent') {
|
618 |
+
swatch.find('span').css('opacity', 0);
|
619 |
+
}
|
620 |
+
|
621 |
+
// Update swatch
|
622 |
+
swatch.find('span').css('backgroundColor', hex);
|
623 |
+
|
624 |
+
// Determine picker locations
|
625 |
+
switch(settings.control) {
|
626 |
+
case 'wheel':
|
627 |
+
// Set grid position
|
628 |
+
r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
|
629 |
+
phi = hsb.h * Math.PI / 180;
|
630 |
+
x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
|
631 |
+
y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
|
632 |
+
gridPicker.css({
|
633 |
+
top: y + 'px',
|
634 |
+
left: x + 'px'
|
635 |
+
});
|
636 |
+
|
637 |
+
// Set slider position
|
638 |
+
y = 150 - (hsb.b / (100 / grid.height()));
|
639 |
+
if(hex === '') y = 0;
|
640 |
+
sliderPicker.css('top', y + 'px');
|
641 |
+
|
642 |
+
// Update panel color
|
643 |
+
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
644 |
+
break;
|
645 |
+
|
646 |
+
case 'saturation':
|
647 |
+
// Set grid position
|
648 |
+
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
649 |
+
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
650 |
+
gridPicker.css({
|
651 |
+
top: y + 'px',
|
652 |
+
left: x + 'px'
|
653 |
+
});
|
654 |
+
|
655 |
+
// Set slider position
|
656 |
+
y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
|
657 |
+
sliderPicker.css('top', y + 'px');
|
658 |
+
|
659 |
+
// Update UI
|
660 |
+
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
|
661 |
+
minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
|
662 |
+
break;
|
663 |
+
|
664 |
+
case 'brightness':
|
665 |
+
// Set grid position
|
666 |
+
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
667 |
+
y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
|
668 |
+
gridPicker.css({
|
669 |
+
top: y + 'px',
|
670 |
+
left: x + 'px'
|
671 |
+
});
|
672 |
+
|
673 |
+
// Set slider position
|
674 |
+
y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
|
675 |
+
sliderPicker.css('top', y + 'px');
|
676 |
+
|
677 |
+
// Update UI
|
678 |
+
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
679 |
+
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
|
680 |
+
break;
|
681 |
+
|
682 |
+
default:
|
683 |
+
// Set grid position
|
684 |
+
x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
|
685 |
+
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
686 |
+
gridPicker.css({
|
687 |
+
top: y + 'px',
|
688 |
+
left: x + 'px'
|
689 |
+
});
|
690 |
+
|
691 |
+
// Set slider position
|
692 |
+
y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
|
693 |
+
sliderPicker.css('top', y + 'px');
|
694 |
+
|
695 |
+
// Update panel color
|
696 |
+
grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
|
697 |
+
break;
|
698 |
+
}
|
699 |
+
|
700 |
+
// Fire change event, but only if minicolors is fully initialized
|
701 |
+
if(input.data('minicolors-initialized')) {
|
702 |
+
doChange(input, value, opacity);
|
703 |
+
}
|
704 |
+
}
|
705 |
+
|
706 |
+
// Runs the change and changeDelay callbacks
|
707 |
+
function doChange(input, value, opacity) {
|
708 |
+
var settings = input.data('minicolors-settings');
|
709 |
+
var lastChange = input.data('minicolors-lastChange');
|
710 |
+
var obj, sel, i;
|
711 |
+
|
712 |
+
// Only run if it actually changed
|
713 |
+
if(!lastChange || lastChange.value !== value || lastChange.opacity !== opacity) {
|
714 |
+
|
715 |
+
// Remember last-changed value
|
716 |
+
input.data('minicolors-lastChange', {
|
717 |
+
value: value,
|
718 |
+
opacity: opacity
|
719 |
+
});
|
720 |
+
|
721 |
+
// Check and select applicable swatch
|
722 |
+
if(settings.swatches && settings.swatches.length !== 0) {
|
723 |
+
if(!isRgb(value)) {
|
724 |
+
obj = hex2rgb(value);
|
725 |
+
}
|
726 |
+
else {
|
727 |
+
obj = parseRgb(value, true);
|
728 |
+
}
|
729 |
+
sel = -1;
|
730 |
+
for(i = 0; i < settings.swatches.length; ++i) {
|
731 |
+
if(obj.r === settings.swatches[i].r && obj.g === settings.swatches[i].g && obj.b === settings.swatches[i].b && obj.a === settings.swatches[i].a) {
|
732 |
+
sel = i;
|
733 |
+
break;
|
734 |
+
}
|
735 |
+
}
|
736 |
+
|
737 |
+
input.parent().find('.minicolors-swatches .minicolors-swatch').removeClass('selected');
|
738 |
+
if(sel !== -1) {
|
739 |
+
input.parent().find('.minicolors-swatches .minicolors-swatch').eq(i).addClass('selected');
|
740 |
+
}
|
741 |
+
}
|
742 |
+
|
743 |
+
// Fire change event
|
744 |
+
if(settings.change) {
|
745 |
+
if(settings.changeDelay) {
|
746 |
+
// Call after a delay
|
747 |
+
clearTimeout(input.data('minicolors-changeTimeout'));
|
748 |
+
input.data('minicolors-changeTimeout', setTimeout(function() {
|
749 |
+
settings.change.call(input.get(0), value, opacity);
|
750 |
+
}, settings.changeDelay));
|
751 |
+
} else {
|
752 |
+
// Call immediately
|
753 |
+
settings.change.call(input.get(0), value, opacity);
|
754 |
+
}
|
755 |
+
}
|
756 |
+
input.trigger('change').trigger('input');
|
757 |
+
}
|
758 |
+
}
|
759 |
+
|
760 |
+
// Generates an RGB(A) object based on the input's value
|
761 |
+
function rgbObject(input) {
|
762 |
+
var rgb,
|
763 |
+
opacity = $(input).attr('data-opacity');
|
764 |
+
if( isRgb($(input).val()) ) {
|
765 |
+
rgb = parseRgb($(input).val(), true);
|
766 |
+
} else {
|
767 |
+
var hex = parseHex($(input).val(), true);
|
768 |
+
rgb = hex2rgb(hex);
|
769 |
+
}
|
770 |
+
if( !rgb ) return null;
|
771 |
+
if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
|
772 |
+
return rgb;
|
773 |
+
}
|
774 |
+
|
775 |
+
// Generates an RGB(A) string based on the input's value
|
776 |
+
function rgbString(input, alpha) {
|
777 |
+
var rgb,
|
778 |
+
opacity = $(input).attr('data-opacity');
|
779 |
+
if( isRgb($(input).val()) ) {
|
780 |
+
rgb = parseRgb($(input).val(), true);
|
781 |
+
} else {
|
782 |
+
var hex = parseHex($(input).val(), true);
|
783 |
+
rgb = hex2rgb(hex);
|
784 |
+
}
|
785 |
+
if( !rgb ) return null;
|
786 |
+
if( opacity === undefined ) opacity = 1;
|
787 |
+
if( alpha ) {
|
788 |
+
return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
|
789 |
+
} else {
|
790 |
+
return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
|
791 |
+
}
|
792 |
+
}
|
793 |
+
|
794 |
+
// Converts to the letter case specified in settings
|
795 |
+
function convertCase(string, letterCase) {
|
796 |
+
return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
|
797 |
+
}
|
798 |
+
|
799 |
+
// Parses a string and returns a valid hex string when possible
|
800 |
+
function parseHex(string, expand) {
|
801 |
+
string = string.replace(/^#/g, '');
|
802 |
+
if(!string.match(/^[A-F0-9]{3,6}/ig)) return '';
|
803 |
+
if(string.length !== 3 && string.length !== 6) return '';
|
804 |
+
if(string.length === 3 && expand) {
|
805 |
+
string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
|
806 |
+
}
|
807 |
+
return '#' + string;
|
808 |
+
}
|
809 |
+
|
810 |
+
// Parses a string and returns a valid RGB(A) string when possible
|
811 |
+
function parseRgb(string, obj) {
|
812 |
+
var values = string.replace(/[^\d,.]/g, '');
|
813 |
+
var rgba = values.split(',');
|
814 |
+
|
815 |
+
rgba[0] = keepWithin(parseInt(rgba[0], 10), 0, 255);
|
816 |
+
rgba[1] = keepWithin(parseInt(rgba[1], 10), 0, 255);
|
817 |
+
rgba[2] = keepWithin(parseInt(rgba[2], 10), 0, 255);
|
818 |
+
if(rgba[3]) {
|
819 |
+
rgba[3] = keepWithin(parseFloat(rgba[3], 10), 0, 1);
|
820 |
+
}
|
821 |
+
|
822 |
+
// Return RGBA object
|
823 |
+
if( obj ) {
|
824 |
+
if (rgba[3]) {
|
825 |
+
return {
|
826 |
+
r: rgba[0],
|
827 |
+
g: rgba[1],
|
828 |
+
b: rgba[2],
|
829 |
+
a: rgba[3]
|
830 |
+
};
|
831 |
+
} else {
|
832 |
+
return {
|
833 |
+
r: rgba[0],
|
834 |
+
g: rgba[1],
|
835 |
+
b: rgba[2]
|
836 |
+
};
|
837 |
+
}
|
838 |
+
}
|
839 |
+
|
840 |
+
// Return RGBA string
|
841 |
+
if(typeof(rgba[3]) !== 'undefined' && rgba[3] <= 1) {
|
842 |
+
return 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')';
|
843 |
+
} else {
|
844 |
+
return 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')';
|
845 |
+
}
|
846 |
+
|
847 |
+
}
|
848 |
+
|
849 |
+
// Parses a string and returns a valid color string when possible
|
850 |
+
function parseInput(string, expand) {
|
851 |
+
if(isRgb(string)) {
|
852 |
+
// Returns a valid rgb(a) string
|
853 |
+
return parseRgb(string);
|
854 |
+
} else {
|
855 |
+
return parseHex(string, expand);
|
856 |
+
}
|
857 |
+
}
|
858 |
+
|
859 |
+
// Keeps value within min and max
|
860 |
+
function keepWithin(value, min, max) {
|
861 |
+
if(value < min) value = min;
|
862 |
+
if(value > max) value = max;
|
863 |
+
return value;
|
864 |
+
}
|
865 |
+
|
866 |
+
// Checks if a string is a valid RGB(A) string
|
867 |
+
function isRgb(string) {
|
868 |
+
var rgb = string.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
|
869 |
+
return (rgb && rgb.length === 4) ? true : false;
|
870 |
+
}
|
871 |
+
|
872 |
+
// Function to get alpha from a RGB(A) string
|
873 |
+
function getAlpha(rgba) {
|
874 |
+
rgba = rgba.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i);
|
875 |
+
return (rgba && rgba.length === 6) ? rgba[4] : '1';
|
876 |
+
}
|
877 |
+
|
878 |
+
// Converts an HSB object to an RGB object
|
879 |
+
function hsb2rgb(hsb) {
|
880 |
+
var rgb = {};
|
881 |
+
var h = Math.round(hsb.h);
|
882 |
+
var s = Math.round(hsb.s * 255 / 100);
|
883 |
+
var v = Math.round(hsb.b * 255 / 100);
|
884 |
+
if(s === 0) {
|
885 |
+
rgb.r = rgb.g = rgb.b = v;
|
886 |
+
} else {
|
887 |
+
var t1 = v;
|
888 |
+
var t2 = (255 - s) * v / 255;
|
889 |
+
var t3 = (t1 - t2) * (h % 60) / 60;
|
890 |
+
if(h === 360) h = 0;
|
891 |
+
if(h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
|
892 |
+
else if(h < 120) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
|
893 |
+
else if(h < 180) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
|
894 |
+
else if(h < 240) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
|
895 |
+
else if(h < 300) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
|
896 |
+
else if(h < 360) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
|
897 |
+
else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
|
898 |
+
}
|
899 |
+
return {
|
900 |
+
r: Math.round(rgb.r),
|
901 |
+
g: Math.round(rgb.g),
|
902 |
+
b: Math.round(rgb.b)
|
903 |
+
};
|
904 |
+
}
|
905 |
+
|
906 |
+
// Converts an RGB string to a hex string
|
907 |
+
function rgbString2hex(rgb){
|
908 |
+
rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
|
909 |
+
return (rgb && rgb.length === 4) ? '#' +
|
910 |
+
('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +
|
911 |
+
('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +
|
912 |
+
('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';
|
913 |
+
}
|
914 |
+
|
915 |
+
// Converts an RGB object to a hex string
|
916 |
+
function rgb2hex(rgb) {
|
917 |
+
var hex = [
|
918 |
+
rgb.r.toString(16),
|
919 |
+
rgb.g.toString(16),
|
920 |
+
rgb.b.toString(16)
|
921 |
+
];
|
922 |
+
$.each(hex, function(nr, val) {
|
923 |
+
if(val.length === 1) hex[nr] = '0' + val;
|
924 |
+
});
|
925 |
+
return '#' + hex.join('');
|
926 |
+
}
|
927 |
+
|
928 |
+
// Converts an HSB object to a hex string
|
929 |
+
function hsb2hex(hsb) {
|
930 |
+
return rgb2hex(hsb2rgb(hsb));
|
931 |
+
}
|
932 |
+
|
933 |
+
// Converts a hex string to an HSB object
|
934 |
+
function hex2hsb(hex) {
|
935 |
+
var hsb = rgb2hsb(hex2rgb(hex));
|
936 |
+
if(hsb.s === 0) hsb.h = 360;
|
937 |
+
return hsb;
|
938 |
+
}
|
939 |
+
|
940 |
+
// Converts an RGB object to an HSB object
|
941 |
+
function rgb2hsb(rgb) {
|
942 |
+
var hsb = { h: 0, s: 0, b: 0 };
|
943 |
+
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
944 |
+
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
945 |
+
var delta = max - min;
|
946 |
+
hsb.b = max;
|
947 |
+
hsb.s = max !== 0 ? 255 * delta / max : 0;
|
948 |
+
if(hsb.s !== 0) {
|
949 |
+
if(rgb.r === max) {
|
950 |
+
hsb.h = (rgb.g - rgb.b) / delta;
|
951 |
+
} else if(rgb.g === max) {
|
952 |
+
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
953 |
+
} else {
|
954 |
+
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
955 |
+
}
|
956 |
+
} else {
|
957 |
+
hsb.h = -1;
|
958 |
+
}
|
959 |
+
hsb.h *= 60;
|
960 |
+
if(hsb.h < 0) {
|
961 |
+
hsb.h += 360;
|
962 |
+
}
|
963 |
+
hsb.s *= 100/255;
|
964 |
+
hsb.b *= 100/255;
|
965 |
+
return hsb;
|
966 |
+
}
|
967 |
+
|
968 |
+
// Converts a hex string to an RGB object
|
969 |
+
function hex2rgb(hex) {
|
970 |
+
hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
971 |
+
return {
|
972 |
+
r: hex >> 16,
|
973 |
+
g: (hex & 0x00FF00) >> 8,
|
974 |
+
b: (hex & 0x0000FF)
|
975 |
+
};
|
976 |
+
}
|
977 |
+
|
978 |
+
// Handle events
|
979 |
+
$([document])
|
980 |
+
// Hide on clicks outside of the control
|
981 |
+
.on('mousedown.minicolors touchstart.minicolors', function(event) {
|
982 |
+
if(!$(event.target).parents().add(event.target).hasClass('minicolors')) {
|
983 |
+
hide();
|
984 |
+
}
|
985 |
+
})
|
986 |
+
// Start moving
|
987 |
+
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
|
988 |
+
var target = $(this);
|
989 |
+
event.preventDefault();
|
990 |
+
$(event.delegateTarget).data('minicolors-target', target);
|
991 |
+
move(target, event, true);
|
992 |
+
})
|
993 |
+
// Move pickers
|
994 |
+
.on('mousemove.minicolors touchmove.minicolors', function(event) {
|
995 |
+
var target = $(event.delegateTarget).data('minicolors-target');
|
996 |
+
if(target) move(target, event);
|
997 |
+
})
|
998 |
+
// Stop moving
|
999 |
+
.on('mouseup.minicolors touchend.minicolors', function() {
|
1000 |
+
$(this).removeData('minicolors-target');
|
1001 |
+
})
|
1002 |
+
// Selected a swatch
|
1003 |
+
.on('click.minicolors', '.minicolors-swatches li', function(event) {
|
1004 |
+
event.preventDefault();
|
1005 |
+
var target = $(this), input = target.parents('.minicolors').find('.minicolors-input'), color = target.data('swatch-color');
|
1006 |
+
updateInput(input, color, getAlpha(color));
|
1007 |
+
updateFromInput(input);
|
1008 |
+
})
|
1009 |
+
// Show panel when swatch is clicked
|
1010 |
+
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-input-swatch', function(event) {
|
1011 |
+
var input = $(this).parent().find('.minicolors-input');
|
1012 |
+
event.preventDefault();
|
1013 |
+
show(input);
|
1014 |
+
})
|
1015 |
+
// Show on focus
|
1016 |
+
.on('focus.minicolors', '.minicolors-input', function() {
|
1017 |
+
var input = $(this);
|
1018 |
+
if(!input.data('minicolors-initialized')) return;
|
1019 |
+
show(input);
|
1020 |
+
})
|
1021 |
+
// Update value on blur
|
1022 |
+
.on('blur.minicolors', '.minicolors-input', function() {
|
1023 |
+
var input = $(this);
|
1024 |
+
var settings = input.data('minicolors-settings');
|
1025 |
+
var keywords;
|
1026 |
+
var hex;
|
1027 |
+
var rgba;
|
1028 |
+
var swatchOpacity;
|
1029 |
+
var value;
|
1030 |
+
|
1031 |
+
if(!input.data('minicolors-initialized')) return;
|
1032 |
+
|
1033 |
+
// Get array of lowercase keywords
|
1034 |
+
keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
|
1035 |
+
return $.trim(a.toLowerCase());
|
1036 |
+
});
|
1037 |
+
|
1038 |
+
// Set color string
|
1039 |
+
if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
|
1040 |
+
value = input.val();
|
1041 |
+
} else {
|
1042 |
+
// Get RGBA values for easy conversion
|
1043 |
+
if(isRgb(input.val())) {
|
1044 |
+
rgba = parseRgb(input.val(), true);
|
1045 |
+
} else {
|
1046 |
+
hex = parseHex(input.val(), true);
|
1047 |
+
rgba = hex ? hex2rgb(hex) : null;
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
// Convert to format
|
1051 |
+
if(rgba === null) {
|
1052 |
+
value = settings.defaultValue;
|
1053 |
+
} else if(settings.format === 'rgb') {
|
1054 |
+
value = settings.opacity ?
|
1055 |
+
parseRgb('rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + input.attr('data-opacity') + ')') :
|
1056 |
+
parseRgb('rgb(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ')');
|
1057 |
+
} else {
|
1058 |
+
value = rgb2hex(rgba);
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
// Update swatch opacity
|
1063 |
+
swatchOpacity = settings.opacity ? input.attr('data-opacity') : 1;
|
1064 |
+
if(value.toLowerCase() === 'transparent') swatchOpacity = 0;
|
1065 |
+
input
|
1066 |
+
.closest('.minicolors')
|
1067 |
+
.find('.minicolors-input-swatch > span')
|
1068 |
+
.css('opacity', swatchOpacity);
|
1069 |
+
|
1070 |
+
// Set input value
|
1071 |
+
input.val(value);
|
1072 |
+
|
1073 |
+
// Is it blank?
|
1074 |
+
if(input.val() === '') input.val(parseInput(settings.defaultValue, true));
|
1075 |
+
|
1076 |
+
// Adjust case
|
1077 |
+
input.val(convertCase(input.val(), settings.letterCase));
|
1078 |
+
|
1079 |
+
})
|
1080 |
+
// Handle keypresses
|
1081 |
+
.on('keydown.minicolors', '.minicolors-input', function(event) {
|
1082 |
+
var input = $(this);
|
1083 |
+
if(!input.data('minicolors-initialized')) return;
|
1084 |
+
switch(event.keyCode) {
|
1085 |
+
case 9: // tab
|
1086 |
+
hide();
|
1087 |
+
break;
|
1088 |
+
case 13: // enter
|
1089 |
+
case 27: // esc
|
1090 |
+
hide();
|
1091 |
+
input.blur();
|
1092 |
+
break;
|
1093 |
+
}
|
1094 |
+
})
|
1095 |
+
// Update on keyup
|
1096 |
+
.on('keyup.minicolors', '.minicolors-input', function() {
|
1097 |
+
var input = $(this);
|
1098 |
+
if(!input.data('minicolors-initialized')) return;
|
1099 |
+
updateFromInput(input, true);
|
1100 |
+
})
|
1101 |
+
// Update on paste
|
1102 |
+
.on('paste.minicolors', '.minicolors-input', function() {
|
1103 |
+
var input = $(this);
|
1104 |
+
if(!input.data('minicolors-initialized')) return;
|
1105 |
+
setTimeout(function() {
|
1106 |
+
updateFromInput(input, true);
|
1107 |
+
}, 1);
|
1108 |
+
});
|
1109 |
+
}));
|
assets/js/jquery.minicolors.min.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
// jscs:disable
|
2 |
-
//
|
3 |
-
// jQuery MiniColors: A tiny color picker built on jQuery
|
4 |
-
//
|
5 |
-
// Developed by Cory LaViska for A Beautiful Site, LLC
|
6 |
-
//
|
7 |
-
// Licensed under the MIT license: http://opensource.org/licenses/MIT
|
8 |
-
//
|
9 |
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";function t(t,o){var s,a,n,r,e,l=i('<div class="minicolors" />'),h=i.minicolors.defaults;if(!t.data("minicolors-initialized")){if(o=i.extend(!0,{},h,o),l.addClass("minicolors-theme-"+o.theme).toggleClass("minicolors-with-opacity",o.opacity),void 0!==o.position&&i.each(o.position.split(" "),function(){l.addClass("minicolors-position-"+this)}),s="rgb"===o.format?o.opacity?"25":"20":o.keywords?"11":"7",t.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",o).prop("size",s).wrap(l).after('<div class="minicolors-panel minicolors-slider-'+o.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>'),o.inline||(t.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'),t.next(".minicolors-input-swatch").on("click",function(i){i.preventDefault(),t.focus()})),r=t.parent().find(".minicolors-panel"),r.on("selectstart",function(){return!1}).end(),o.swatches&&0!==o.swatches.length)for(r.addClass("minicolors-with-swatches"),a=i('<ul class="minicolors-swatches"></ul>').appendTo(r),e=0;e<o.swatches.length;++e)n=o.swatches[e],n=v(n)?g(n,!0):I(u(n,!0)),i('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>').appendTo(a).data("swatch-color",o.swatches[e]).find(".minicolors-swatch-color").css({backgroundColor:C(n),opacity:n.a}),o.swatches[e]=n;o.inline&&t.parent().addClass("minicolors-inline"),c(t,!1),t.data("minicolors-initialized",!0)}}function o(i){var t=i.parent();i.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),t.before(i).remove()}function s(i){var t=i.parent(),o=t.find(".minicolors-panel"),s=i.data("minicolors-settings");!i.data("minicolors-initialized")||i.prop("disabled")||t.hasClass("minicolors-inline")||t.hasClass("minicolors-focus")||(a(),t.addClass("minicolors-focus"),o.stop(!0,!0).fadeIn(s.showSpeed,function(){s.show&&s.show.call(i.get(0))}))}function a(){i(".minicolors-focus").each(function(){var t=i(this),o=t.find(".minicolors-input"),s=t.find(".minicolors-panel"),a=o.data("minicolors-settings");s.fadeOut(a.hideSpeed,function(){a.hide&&a.hide.call(o.get(0)),t.removeClass("minicolors-focus")})})}function n(i,t,o){var s,a,n,e,c=i.parents(".minicolors").find(".minicolors-input"),l=c.data("minicolors-settings"),h=i.find("[class$=-picker]"),d=i.offset().left,p=i.offset().top,u=Math.round(t.pageX-d),g=Math.round(t.pageY-p),m=o?l.animationSpeed:0;t.originalEvent.changedTouches&&(u=t.originalEvent.changedTouches[0].pageX-d,g=t.originalEvent.changedTouches[0].pageY-p),u<0&&(u=0),g<0&&(g=0),u>i.width()&&(u=i.width()),g>i.height()&&(g=i.height()),i.parent().is(".minicolors-slider-wheel")&&h.parent().is(".minicolors-grid")&&(s=75-u,a=75-g,n=Math.sqrt(s*s+a*a),e=Math.atan2(a,s),e<0&&(e+=2*Math.PI),n>75&&(n=75,u=75-75*Math.cos(e),g=75-75*Math.sin(e)),u=Math.round(u),g=Math.round(g)),i.is(".minicolors-grid")?h.stop(!0).animate({top:g+"px",left:u+"px"},m,l.animationEasing,function(){r(c,i)}):h.stop(!0).animate({top:g+"px"},m,l.animationEasing,function(){r(c,i)})}function r(i,t){function o(i,t){var o,s;return i.length&&t?(o=i.offset().left,s=i.offset().top,{x:o-t.offset().left+i.outerWidth()/2,y:s-t.offset().top+i.outerHeight()/2}):null}var s,a,n,r,c,h,d,p=i.val(),u=i.attr("data-opacity"),g=i.parent(),m=i.data("minicolors-settings"),v=g.find(".minicolors-input-swatch"),b=g.find(".minicolors-grid"),w=g.find(".minicolors-slider"),y=g.find(".minicolors-opacity-slider"),C=b.find("[class$=-picker]"),M=w.find("[class$=-picker]"),x=y.find("[class$=-picker]"),I=o(C,b),S=o(M,w),z=o(x,y);if(t.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(m.control){case"wheel":r=b.width()/2-I.x,c=b.height()/2-I.y,h=Math.sqrt(r*r+c*c),d=Math.atan2(c,r),d<0&&(d+=2*Math.PI),h>75&&(h=75,I.x=69-75*Math.cos(d),I.y=69-75*Math.sin(d)),a=f(h/.75,0,100),s=f(180*d/Math.PI,0,360),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100}));break;case"saturation":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(S.y*(100/w.height())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:100,b:n})),g.find(".minicolors-grid-inner").css("opacity",a/100);break;case"brightness":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(I.y*(100/b.height())),0,100),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100})),g.find(".minicolors-grid-inner").css("opacity",1-n/100);break;default:s=f(360-parseInt(S.y*(360/w.height()),10),0,360),a=f(Math.floor(I.x*(100/b.width())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),b.css("backgroundColor",k({h:s,s:100,b:100}))}u=m.opacity?parseFloat(1-z.y/y.height()).toFixed(2):1,e(i,p,u)}else v.find("span").css({backgroundColor:p,opacity:u}),l(i,p,u)}function e(i,t,o){var s,a=i.parent(),n=i.data("minicolors-settings"),r=a.find(".minicolors-input-swatch");n.opacity&&i.attr("data-opacity",o),"rgb"===n.format?(s=v(t)?g(t,!0):I(u(t,!0)),o=""===i.attr("data-opacity")?1:f(parseFloat(i.attr("data-opacity")).toFixed(2),0,1),!isNaN(o)&&n.opacity||(o=1),t=i.minicolors("rgbObject").a<=1&&s&&n.opacity?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(o)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):(v(t)&&(t=y(t)),t=p(t,n.letterCase)),i.val(t),r.find("span").css({backgroundColor:t,opacity:o}),l(i,t,o)}function c(t,o){var s,a,n,r,e,c,h,d,w,C,x=t.parent(),I=t.data("minicolors-settings"),S=x.find(".minicolors-input-swatch"),z=x.find(".minicolors-grid"),F=x.find(".minicolors-slider"),T=x.find(".minicolors-opacity-slider"),D=z.find("[class$=-picker]"),j=F.find("[class$=-picker]"),q=T.find("[class$=-picker]");switch(v(t.val())?(s=y(t.val()),e=f(parseFloat(b(t.val())).toFixed(2),0,1),e&&t.attr("data-opacity",e)):s=p(u(t.val(),!0),I.letterCase),s||(s=p(m(I.defaultValue,!0),I.letterCase)),a=M(s),r=I.keywords?i.map(I.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],c=""!==t.val()&&i.inArray(t.val().toLowerCase(),r)>-1?p(t.val()):v(t.val())?g(t.val()):s,o||t.val(c),I.opacity&&(n=""===t.attr("data-opacity")?1:f(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),isNaN(n)&&(n=1),t.attr("data-opacity",n),S.find("span").css("opacity",n),d=f(T.height()-T.height()*n,0,T.height()),q.css("top",d+"px")),"transparent"===t.val().toLowerCase()&&S.find("span").css("opacity",0),S.find("span").css("backgroundColor",s),I.control){case"wheel":w=f(Math.ceil(.75*a.s),0,z.height()/2),C=a.h*Math.PI/180,h=f(75-Math.cos(C)*w,0,z.width()),d=f(75-Math.sin(C)*w,0,z.height()),D.css({top:d+"px",left:h+"px"}),d=150-a.b/(100/z.height()),""===s&&(d=0),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100}));break;case"saturation":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.s*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:100,b:a.b})),x.find(".minicolors-grid-inner").css("opacity",a.s/100);break;case"brightness":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.s/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.b*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100})),x.find(".minicolors-grid-inner").css("opacity",1-a.b/100);break;default:h=f(Math.ceil(a.s/(100/z.width())),0,z.width()),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.h/(360/F.height()),0,F.height()),j.css("top",d+"px"),z.css("backgroundColor",k({h:a.h,s:100,b:100}))}t.data("minicolors-initialized")&&l(t,c,n)}function l(i,t,o){var s,a,n,r=i.data("minicolors-settings"),e=i.data("minicolors-lastChange");if(!e||e.value!==t||e.opacity!==o){if(i.data("minicolors-lastChange",{value:t,opacity:o}),r.swatches&&0!==r.swatches.length){for(s=v(t)?g(t,!0):I(t),a=-1,n=0;n<r.swatches.length;++n)if(s.r===r.swatches[n].r&&s.g===r.swatches[n].g&&s.b===r.swatches[n].b&&s.a===r.swatches[n].a){a=n;break}i.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected"),a!==-1&&i.parent().find(".minicolors-swatches .minicolors-swatch").eq(n).addClass("selected")}r.change&&(r.changeDelay?(clearTimeout(i.data("minicolors-changeTimeout")),i.data("minicolors-changeTimeout",setTimeout(function(){r.change.call(i.get(0),t,o)},r.changeDelay))):r.change.call(i.get(0),t,o)),i.trigger("change").trigger("input")}}function h(t){var o,s=i(t).attr("data-opacity");if(v(i(t).val()))o=g(i(t).val(),!0);else{var a=u(i(t).val(),!0);o=I(a)}return o?(void 0!==s&&i.extend(o,{a:parseFloat(s)}),o):null}function d(t,o){var s,a=i(t).attr("data-opacity");if(v(i(t).val()))s=g(i(t).val(),!0);else{var n=u(i(t).val(),!0);s=I(n)}return s?(void 0===a&&(a=1),o?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(a)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):null}function p(i,t){return"uppercase"===t?i.toUpperCase():i.toLowerCase()}function u(i,t){return i=i.replace(/^#/g,""),i.match(/^[A-F0-9]{3,6}/gi)?3!==i.length&&6!==i.length?"":(3===i.length&&t&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),"#"+i):""}function g(i,t){var o=i.replace(/[^\d,.]/g,""),s=o.split(",");return s[0]=f(parseInt(s[0],10),0,255),s[1]=f(parseInt(s[1],10),0,255),s[2]=f(parseInt(s[2],10),0,255),s[3]&&(s[3]=f(parseFloat(s[3],10),0,1)),t?s[3]?{r:s[0],g:s[1],b:s[2],a:s[3]}:{r:s[0],g:s[1],b:s[2]}:"undefined"!=typeof s[3]&&s[3]<=1?"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")":"rgb("+s[0]+", "+s[1]+", "+s[2]+")"}function m(i,t){return v(i)?g(i):u(i,t)}function f(i,t,o){return i<t&&(i=t),i>o&&(i=o),i}function v(i){var t=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return!(!t||4!==t.length)}function b(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i),i&&6===i.length?i[4]:"1"}function w(i){var t={},o=Math.round(i.h),s=Math.round(255*i.s/100),a=Math.round(255*i.b/100);if(0===s)t.r=t.g=t.b=a;else{var n=a,r=(255-s)*a/255,e=(n-r)*(o%60)/60;360===o&&(o=0),o<60?(t.r=n,t.b=r,t.g=r+e):o<120?(t.g=n,t.b=r,t.r=n-e):o<180?(t.g=n,t.r=r,t.b=r+e):o<240?(t.b=n,t.r=r,t.g=n-e):o<300?(t.b=n,t.g=r,t.r=r+e):o<360?(t.r=n,t.g=r,t.b=n-e):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}}function y(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),i&&4===i.length?"#"+("0"+parseInt(i[1],10).toString(16)).slice(-2)+("0"+parseInt(i[2],10).toString(16)).slice(-2)+("0"+parseInt(i[3],10).toString(16)).slice(-2):""}function C(t){var o=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];return i.each(o,function(i,t){1===t.length&&(o[i]="0"+t)}),"#"+o.join("")}function k(i){return C(w(i))}function M(i){var t=x(I(i));return 0===t.s&&(t.h=360),t}function x(i){var t={h:0,s:0,b:0},o=Math.min(i.r,i.g,i.b),s=Math.max(i.r,i.g,i.b),a=s-o;return t.b=s,t.s=0!==s?255*a/s:0,0!==t.s?i.r===s?t.h=(i.g-i.b)/a:i.g===s?t.h=2+(i.b-i.r)/a:t.h=4+(i.r-i.g)/a:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t}function I(i){return i=parseInt(i.indexOf("#")>-1?i.substring(1):i,16),{r:i>>16,g:(65280&i)>>8,b:255&i}}i.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default",swatches:[]}},i.extend(i.fn,{minicolors:function(n,r){switch(n){case"destroy":return i(this).each(function(){o(i(this))}),i(this);case"hide":return a(),i(this);case"opacity":return void 0===r?i(this).attr("data-opacity"):(i(this).each(function(){c(i(this).attr("data-opacity",r))}),i(this));case"rgbObject":return h(i(this),"rgbaObject"===n);case"rgbString":case"rgbaString":return d(i(this),"rgbaString"===n);case"settings":return void 0===r?i(this).data("minicolors-settings"):(i(this).each(function(){var t=i(this).data("minicolors-settings")||{};o(i(this)),i(this).minicolors(i.extend(!0,t,r))}),i(this));case"show":return s(i(this).eq(0)),i(this);case"value":return void 0===r?i(this).val():(i(this).each(function(){"object"==typeof r&&null!==r?(r.opacity&&i(this).attr("data-opacity",f(r.opacity,0,1)),r.color&&i(this).val(r.color)):i(this).val(r),c(i(this))}),i(this));default:return"create"!==n&&(r=n),i(this).each(function(){t(i(this),r)}),i(this)}}}),i([document]).on("mousedown.minicolors touchstart.minicolors",function(t){i(t.target).parents().add(t.target).hasClass("minicolors")||a()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var o=i(this);t.preventDefault(),i(t.delegateTarget).data("minicolors-target",o),n(o,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var o=i(t.delegateTarget).data("minicolors-target");o&&n(o,t)}).on("mouseup.minicolors touchend.minicolors",function(){i(this).removeData("minicolors-target")}).on("click.minicolors",".minicolors-swatches li",function(t){t.preventDefault();var o=i(this),s=o.parents(".minicolors").find(".minicolors-input"),a=o.data("swatch-color");e(s,a,b(a)),c(s)}).on("mousedown.minicolors touchstart.minicolors",".minicolors-input-swatch",function(t){var o=i(this).parent().find(".minicolors-input");t.preventDefault(),s(o)}).on("focus.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&s(t)}).on("blur.minicolors",".minicolors-input",function(){var t,o,s,a,n,r=i(this),e=r.data("minicolors-settings");r.data("minicolors-initialized")&&(t=e.keywords?i.map(e.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],""!==r.val()&&i.inArray(r.val().toLowerCase(),t)>-1?n=r.val():(v(r.val())?s=g(r.val(),!0):(o=u(r.val(),!0),s=o?I(o):null),n=null===s?e.defaultValue:"rgb"===e.format?g(e.opacity?"rgba("+s.r+","+s.g+","+s.b+","+r.attr("data-opacity")+")":"rgb("+s.r+","+s.g+","+s.b+")"):C(s)),a=e.opacity?r.attr("data-opacity"):1,"transparent"===n.toLowerCase()&&(a=0),r.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",a),r.val(n),""===r.val()&&r.val(m(e.defaultValue,!0)),r.val(p(r.val(),e.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(t){var o=i(this);if(o.data("minicolors-initialized"))switch(t.keyCode){case 9:a();break;case 13:case 27:a(),o.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&c(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&setTimeout(function(){c(t,!0)},1)})});
|
1 |
+
// jscs:disable
|
2 |
+
//
|
3 |
+
// jQuery MiniColors: A tiny color picker built on jQuery
|
4 |
+
//
|
5 |
+
// Developed by Cory LaViska for A Beautiful Site, LLC
|
6 |
+
//
|
7 |
+
// Licensed under the MIT license: http://opensource.org/licenses/MIT
|
8 |
+
//
|
9 |
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";function t(t,o){var s,a,n,r,e,l=i('<div class="minicolors" />'),h=i.minicolors.defaults;if(!t.data("minicolors-initialized")){if(o=i.extend(!0,{},h,o),l.addClass("minicolors-theme-"+o.theme).toggleClass("minicolors-with-opacity",o.opacity),void 0!==o.position&&i.each(o.position.split(" "),function(){l.addClass("minicolors-position-"+this)}),s="rgb"===o.format?o.opacity?"25":"20":o.keywords?"11":"7",t.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",o).prop("size",s).wrap(l).after('<div class="minicolors-panel minicolors-slider-'+o.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>'),o.inline||(t.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'),t.next(".minicolors-input-swatch").on("click",function(i){i.preventDefault(),t.focus()})),r=t.parent().find(".minicolors-panel"),r.on("selectstart",function(){return!1}).end(),o.swatches&&0!==o.swatches.length)for(r.addClass("minicolors-with-swatches"),a=i('<ul class="minicolors-swatches"></ul>').appendTo(r),e=0;e<o.swatches.length;++e)n=o.swatches[e],n=v(n)?g(n,!0):I(u(n,!0)),i('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>').appendTo(a).data("swatch-color",o.swatches[e]).find(".minicolors-swatch-color").css({backgroundColor:C(n),opacity:n.a}),o.swatches[e]=n;o.inline&&t.parent().addClass("minicolors-inline"),c(t,!1),t.data("minicolors-initialized",!0)}}function o(i){var t=i.parent();i.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),t.before(i).remove()}function s(i){var t=i.parent(),o=t.find(".minicolors-panel"),s=i.data("minicolors-settings");!i.data("minicolors-initialized")||i.prop("disabled")||t.hasClass("minicolors-inline")||t.hasClass("minicolors-focus")||(a(),t.addClass("minicolors-focus"),o.stop(!0,!0).fadeIn(s.showSpeed,function(){s.show&&s.show.call(i.get(0))}))}function a(){i(".minicolors-focus").each(function(){var t=i(this),o=t.find(".minicolors-input"),s=t.find(".minicolors-panel"),a=o.data("minicolors-settings");s.fadeOut(a.hideSpeed,function(){a.hide&&a.hide.call(o.get(0)),t.removeClass("minicolors-focus")})})}function n(i,t,o){var s,a,n,e,c=i.parents(".minicolors").find(".minicolors-input"),l=c.data("minicolors-settings"),h=i.find("[class$=-picker]"),d=i.offset().left,p=i.offset().top,u=Math.round(t.pageX-d),g=Math.round(t.pageY-p),m=o?l.animationSpeed:0;t.originalEvent.changedTouches&&(u=t.originalEvent.changedTouches[0].pageX-d,g=t.originalEvent.changedTouches[0].pageY-p),u<0&&(u=0),g<0&&(g=0),u>i.width()&&(u=i.width()),g>i.height()&&(g=i.height()),i.parent().is(".minicolors-slider-wheel")&&h.parent().is(".minicolors-grid")&&(s=75-u,a=75-g,n=Math.sqrt(s*s+a*a),e=Math.atan2(a,s),e<0&&(e+=2*Math.PI),n>75&&(n=75,u=75-75*Math.cos(e),g=75-75*Math.sin(e)),u=Math.round(u),g=Math.round(g)),i.is(".minicolors-grid")?h.stop(!0).animate({top:g+"px",left:u+"px"},m,l.animationEasing,function(){r(c,i)}):h.stop(!0).animate({top:g+"px"},m,l.animationEasing,function(){r(c,i)})}function r(i,t){function o(i,t){var o,s;return i.length&&t?(o=i.offset().left,s=i.offset().top,{x:o-t.offset().left+i.outerWidth()/2,y:s-t.offset().top+i.outerHeight()/2}):null}var s,a,n,r,c,h,d,p=i.val(),u=i.attr("data-opacity"),g=i.parent(),m=i.data("minicolors-settings"),v=g.find(".minicolors-input-swatch"),b=g.find(".minicolors-grid"),w=g.find(".minicolors-slider"),y=g.find(".minicolors-opacity-slider"),C=b.find("[class$=-picker]"),M=w.find("[class$=-picker]"),x=y.find("[class$=-picker]"),I=o(C,b),S=o(M,w),z=o(x,y);if(t.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(m.control){case"wheel":r=b.width()/2-I.x,c=b.height()/2-I.y,h=Math.sqrt(r*r+c*c),d=Math.atan2(c,r),d<0&&(d+=2*Math.PI),h>75&&(h=75,I.x=69-75*Math.cos(d),I.y=69-75*Math.sin(d)),a=f(h/.75,0,100),s=f(180*d/Math.PI,0,360),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100}));break;case"saturation":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(S.y*(100/w.height())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:100,b:n})),g.find(".minicolors-grid-inner").css("opacity",a/100);break;case"brightness":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(I.y*(100/b.height())),0,100),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100})),g.find(".minicolors-grid-inner").css("opacity",1-n/100);break;default:s=f(360-parseInt(S.y*(360/w.height()),10),0,360),a=f(Math.floor(I.x*(100/b.width())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),b.css("backgroundColor",k({h:s,s:100,b:100}))}u=m.opacity?parseFloat(1-z.y/y.height()).toFixed(2):1,e(i,p,u)}else v.find("span").css({backgroundColor:p,opacity:u}),l(i,p,u)}function e(i,t,o){var s,a=i.parent(),n=i.data("minicolors-settings"),r=a.find(".minicolors-input-swatch");n.opacity&&i.attr("data-opacity",o),"rgb"===n.format?(s=v(t)?g(t,!0):I(u(t,!0)),o=""===i.attr("data-opacity")?1:f(parseFloat(i.attr("data-opacity")).toFixed(2),0,1),!isNaN(o)&&n.opacity||(o=1),t=i.minicolors("rgbObject").a<=1&&s&&n.opacity?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(o)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):(v(t)&&(t=y(t)),t=p(t,n.letterCase)),i.val(t),r.find("span").css({backgroundColor:t,opacity:o}),l(i,t,o)}function c(t,o){var s,a,n,r,e,c,h,d,w,C,x=t.parent(),I=t.data("minicolors-settings"),S=x.find(".minicolors-input-swatch"),z=x.find(".minicolors-grid"),F=x.find(".minicolors-slider"),T=x.find(".minicolors-opacity-slider"),D=z.find("[class$=-picker]"),j=F.find("[class$=-picker]"),q=T.find("[class$=-picker]");switch(v(t.val())?(s=y(t.val()),e=f(parseFloat(b(t.val())).toFixed(2),0,1),e&&t.attr("data-opacity",e)):s=p(u(t.val(),!0),I.letterCase),s||(s=p(m(I.defaultValue,!0),I.letterCase)),a=M(s),r=I.keywords?i.map(I.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],c=""!==t.val()&&i.inArray(t.val().toLowerCase(),r)>-1?p(t.val()):v(t.val())?g(t.val()):s,o||t.val(c),I.opacity&&(n=""===t.attr("data-opacity")?1:f(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),isNaN(n)&&(n=1),t.attr("data-opacity",n),S.find("span").css("opacity",n),d=f(T.height()-T.height()*n,0,T.height()),q.css("top",d+"px")),"transparent"===t.val().toLowerCase()&&S.find("span").css("opacity",0),S.find("span").css("backgroundColor",s),I.control){case"wheel":w=f(Math.ceil(.75*a.s),0,z.height()/2),C=a.h*Math.PI/180,h=f(75-Math.cos(C)*w,0,z.width()),d=f(75-Math.sin(C)*w,0,z.height()),D.css({top:d+"px",left:h+"px"}),d=150-a.b/(100/z.height()),""===s&&(d=0),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100}));break;case"saturation":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.s*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:100,b:a.b})),x.find(".minicolors-grid-inner").css("opacity",a.s/100);break;case"brightness":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.s/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.b*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100})),x.find(".minicolors-grid-inner").css("opacity",1-a.b/100);break;default:h=f(Math.ceil(a.s/(100/z.width())),0,z.width()),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.h/(360/F.height()),0,F.height()),j.css("top",d+"px"),z.css("backgroundColor",k({h:a.h,s:100,b:100}))}t.data("minicolors-initialized")&&l(t,c,n)}function l(i,t,o){var s,a,n,r=i.data("minicolors-settings"),e=i.data("minicolors-lastChange");if(!e||e.value!==t||e.opacity!==o){if(i.data("minicolors-lastChange",{value:t,opacity:o}),r.swatches&&0!==r.swatches.length){for(s=v(t)?g(t,!0):I(t),a=-1,n=0;n<r.swatches.length;++n)if(s.r===r.swatches[n].r&&s.g===r.swatches[n].g&&s.b===r.swatches[n].b&&s.a===r.swatches[n].a){a=n;break}i.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected"),a!==-1&&i.parent().find(".minicolors-swatches .minicolors-swatch").eq(n).addClass("selected")}r.change&&(r.changeDelay?(clearTimeout(i.data("minicolors-changeTimeout")),i.data("minicolors-changeTimeout",setTimeout(function(){r.change.call(i.get(0),t,o)},r.changeDelay))):r.change.call(i.get(0),t,o)),i.trigger("change").trigger("input")}}function h(t){var o,s=i(t).attr("data-opacity");if(v(i(t).val()))o=g(i(t).val(),!0);else{var a=u(i(t).val(),!0);o=I(a)}return o?(void 0!==s&&i.extend(o,{a:parseFloat(s)}),o):null}function d(t,o){var s,a=i(t).attr("data-opacity");if(v(i(t).val()))s=g(i(t).val(),!0);else{var n=u(i(t).val(),!0);s=I(n)}return s?(void 0===a&&(a=1),o?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(a)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):null}function p(i,t){return"uppercase"===t?i.toUpperCase():i.toLowerCase()}function u(i,t){return i=i.replace(/^#/g,""),i.match(/^[A-F0-9]{3,6}/gi)?3!==i.length&&6!==i.length?"":(3===i.length&&t&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),"#"+i):""}function g(i,t){var o=i.replace(/[^\d,.]/g,""),s=o.split(",");return s[0]=f(parseInt(s[0],10),0,255),s[1]=f(parseInt(s[1],10),0,255),s[2]=f(parseInt(s[2],10),0,255),s[3]&&(s[3]=f(parseFloat(s[3],10),0,1)),t?s[3]?{r:s[0],g:s[1],b:s[2],a:s[3]}:{r:s[0],g:s[1],b:s[2]}:"undefined"!=typeof s[3]&&s[3]<=1?"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")":"rgb("+s[0]+", "+s[1]+", "+s[2]+")"}function m(i,t){return v(i)?g(i):u(i,t)}function f(i,t,o){return i<t&&(i=t),i>o&&(i=o),i}function v(i){var t=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return!(!t||4!==t.length)}function b(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i),i&&6===i.length?i[4]:"1"}function w(i){var t={},o=Math.round(i.h),s=Math.round(255*i.s/100),a=Math.round(255*i.b/100);if(0===s)t.r=t.g=t.b=a;else{var n=a,r=(255-s)*a/255,e=(n-r)*(o%60)/60;360===o&&(o=0),o<60?(t.r=n,t.b=r,t.g=r+e):o<120?(t.g=n,t.b=r,t.r=n-e):o<180?(t.g=n,t.r=r,t.b=r+e):o<240?(t.b=n,t.r=r,t.g=n-e):o<300?(t.b=n,t.g=r,t.r=r+e):o<360?(t.r=n,t.g=r,t.b=n-e):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}}function y(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),i&&4===i.length?"#"+("0"+parseInt(i[1],10).toString(16)).slice(-2)+("0"+parseInt(i[2],10).toString(16)).slice(-2)+("0"+parseInt(i[3],10).toString(16)).slice(-2):""}function C(t){var o=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];return i.each(o,function(i,t){1===t.length&&(o[i]="0"+t)}),"#"+o.join("")}function k(i){return C(w(i))}function M(i){var t=x(I(i));return 0===t.s&&(t.h=360),t}function x(i){var t={h:0,s:0,b:0},o=Math.min(i.r,i.g,i.b),s=Math.max(i.r,i.g,i.b),a=s-o;return t.b=s,t.s=0!==s?255*a/s:0,0!==t.s?i.r===s?t.h=(i.g-i.b)/a:i.g===s?t.h=2+(i.b-i.r)/a:t.h=4+(i.r-i.g)/a:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t}function I(i){return i=parseInt(i.indexOf("#")>-1?i.substring(1):i,16),{r:i>>16,g:(65280&i)>>8,b:255&i}}i.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default",swatches:[]}},i.extend(i.fn,{minicolors:function(n,r){switch(n){case"destroy":return i(this).each(function(){o(i(this))}),i(this);case"hide":return a(),i(this);case"opacity":return void 0===r?i(this).attr("data-opacity"):(i(this).each(function(){c(i(this).attr("data-opacity",r))}),i(this));case"rgbObject":return h(i(this),"rgbaObject"===n);case"rgbString":case"rgbaString":return d(i(this),"rgbaString"===n);case"settings":return void 0===r?i(this).data("minicolors-settings"):(i(this).each(function(){var t=i(this).data("minicolors-settings")||{};o(i(this)),i(this).minicolors(i.extend(!0,t,r))}),i(this));case"show":return s(i(this).eq(0)),i(this);case"value":return void 0===r?i(this).val():(i(this).each(function(){"object"==typeof r&&null!==r?(r.opacity&&i(this).attr("data-opacity",f(r.opacity,0,1)),r.color&&i(this).val(r.color)):i(this).val(r),c(i(this))}),i(this));default:return"create"!==n&&(r=n),i(this).each(function(){t(i(this),r)}),i(this)}}}),i([document]).on("mousedown.minicolors touchstart.minicolors",function(t){i(t.target).parents().add(t.target).hasClass("minicolors")||a()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var o=i(this);t.preventDefault(),i(t.delegateTarget).data("minicolors-target",o),n(o,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var o=i(t.delegateTarget).data("minicolors-target");o&&n(o,t)}).on("mouseup.minicolors touchend.minicolors",function(){i(this).removeData("minicolors-target")}).on("click.minicolors",".minicolors-swatches li",function(t){t.preventDefault();var o=i(this),s=o.parents(".minicolors").find(".minicolors-input"),a=o.data("swatch-color");e(s,a,b(a)),c(s)}).on("mousedown.minicolors touchstart.minicolors",".minicolors-input-swatch",function(t){var o=i(this).parent().find(".minicolors-input");t.preventDefault(),s(o)}).on("focus.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&s(t)}).on("blur.minicolors",".minicolors-input",function(){var t,o,s,a,n,r=i(this),e=r.data("minicolors-settings");r.data("minicolors-initialized")&&(t=e.keywords?i.map(e.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],""!==r.val()&&i.inArray(r.val().toLowerCase(),t)>-1?n=r.val():(v(r.val())?s=g(r.val(),!0):(o=u(r.val(),!0),s=o?I(o):null),n=null===s?e.defaultValue:"rgb"===e.format?g(e.opacity?"rgba("+s.r+","+s.g+","+s.b+","+r.attr("data-opacity")+")":"rgb("+s.r+","+s.g+","+s.b+")"):C(s)),a=e.opacity?r.attr("data-opacity"):1,"transparent"===n.toLowerCase()&&(a=0),r.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",a),r.val(n),""===r.val()&&r.val(m(e.defaultValue,!0)),r.val(p(r.val(),e.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(t){var o=i(this);if(o.data("minicolors-initialized"))switch(t.keyCode){case 9:a();break;case 13:case 27:a(),o.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&c(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&setTimeout(function(){c(t,!0)},1)})});
|
colorlib-login-customizer.php
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Plugin Name: Colorlib Login Customizer
|
4 |
-
* Version: 1.2.
|
5 |
-
* Description: Colorlib Login Customizer is an awesome and intuitive plugin that helps you personalize your login form directly from the Customizer. The plugin fully supports the Live Customizer feature and you can see all the changes in real time and edit them.
|
6 |
-
* Author: Colorlib
|
7 |
-
* Author URI: https://colorlib.com/
|
8 |
-
* Requires at least: 4.0
|
9 |
-
* Tested up to:
|
10 |
-
*
|
11 |
-
* Text Domain: colorlib-login-customizer
|
12 |
-
* Domain Path: /languages/
|
13 |
-
*
|
14 |
-
* @package WordPress
|
15 |
-
* @author Colorlib
|
16 |
-
* @since 1.0.0
|
17 |
-
*/
|
18 |
-
|
19 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
20 |
-
exit;
|
21 |
-
}
|
22 |
-
|
23 |
-
define( 'COLORLIB_LOGIN_CUSTOMIZER_BASE', plugin_dir_path( __FILE__ ) );
|
24 |
-
define( 'COLORLIB_LOGIN_CUSTOMIZER_URL', plugin_dir_url( __FILE__ ) );
|
25 |
-
define( 'COLORLIB_LOGIN_CUSTOMIZER_SITE', rtrim( ABSPATH, '\\/' ) );
|
26 |
-
|
27 |
-
// Load plugin class files
|
28 |
-
require_once 'includes/class-colorlib-login-customizer-autoloader.php';
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Returns the main instance of Colorlib_Login_Customizer to prevent the need to use globals.
|
32 |
-
*
|
33 |
-
* @since 1.0.0
|
34 |
-
* @return object Colorlib_Login_Customizer
|
35 |
-
*/
|
36 |
-
function colorlib_login_customizer() {
|
37 |
-
$instance = Colorlib_Login_Customizer::instance( __FILE__, '1.2.
|
38 |
-
|
39 |
-
if ( is_null( $instance->settings ) ) {
|
40 |
-
$instance->settings = Colorlib_Login_Customizer_Settings::instance( $instance );
|
41 |
-
}
|
42 |
-
|
43 |
-
return $instance;
|
44 |
-
}
|
45 |
-
|
46 |
-
colorlib_login_customizer();
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Plugin Name: Colorlib Login Customizer
|
4 |
+
* Version: 1.2.4
|
5 |
+
* Description: Colorlib Login Customizer is an awesome and intuitive plugin that helps you personalize your login form directly from the Customizer. The plugin fully supports the Live Customizer feature and you can see all the changes in real time and edit them.
|
6 |
+
* Author: Colorlib
|
7 |
+
* Author URI: https://colorlib.com/
|
8 |
+
* Requires at least: 4.0
|
9 |
+
* Tested up to: 5.0
|
10 |
+
*
|
11 |
+
* Text Domain: colorlib-login-customizer
|
12 |
+
* Domain Path: /languages/
|
13 |
+
*
|
14 |
+
* @package WordPress
|
15 |
+
* @author Colorlib
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
20 |
+
exit;
|
21 |
+
}
|
22 |
+
|
23 |
+
define( 'COLORLIB_LOGIN_CUSTOMIZER_BASE', plugin_dir_path( __FILE__ ) );
|
24 |
+
define( 'COLORLIB_LOGIN_CUSTOMIZER_URL', plugin_dir_url( __FILE__ ) );
|
25 |
+
define( 'COLORLIB_LOGIN_CUSTOMIZER_SITE', rtrim( ABSPATH, '\\/' ) );
|
26 |
+
|
27 |
+
// Load plugin class files
|
28 |
+
require_once 'includes/class-colorlib-login-customizer-autoloader.php';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Returns the main instance of Colorlib_Login_Customizer to prevent the need to use globals.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
* @return object Colorlib_Login_Customizer
|
35 |
+
*/
|
36 |
+
function colorlib_login_customizer() {
|
37 |
+
$instance = Colorlib_Login_Customizer::instance( __FILE__, '1.2.4' );
|
38 |
+
|
39 |
+
if ( is_null( $instance->settings ) ) {
|
40 |
+
$instance->settings = Colorlib_Login_Customizer_Settings::instance( $instance );
|
41 |
+
}
|
42 |
+
|
43 |
+
return $instance;
|
44 |
+
}
|
45 |
+
|
46 |
+
colorlib_login_customizer();
|
includes/class-colorlib-login-customizer-autoloader.php
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'WPINC' ) ) {
|
3 |
-
die;
|
4 |
-
}
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Class Colorlib_Login_Customizer_Autoloader
|
8 |
-
*/
|
9 |
-
class Colorlib_Login_Customizer_Autoloader {
|
10 |
-
/**
|
11 |
-
* Colorlib_Login_Customizer_Autoloader constructor.
|
12 |
-
*/
|
13 |
-
public function __construct() {
|
14 |
-
spl_autoload_register( array( $this, 'load' ) );
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @param $class
|
19 |
-
*/
|
20 |
-
public function load( $class ) {
|
21 |
-
$parts = explode( '_', $class );
|
22 |
-
$bind = implode( '-', $parts );
|
23 |
-
|
24 |
-
if ( 'Colorlib' == $parts[0] ) {
|
25 |
-
|
26 |
-
/*
|
27 |
-
* Core library autoload.
|
28 |
-
*/
|
29 |
-
$directories = array(
|
30 |
-
COLORLIB_LOGIN_CUSTOMIZER_BASE . '/includes',
|
31 |
-
COLORLIB_LOGIN_CUSTOMIZER_BASE . '/includes/lib',
|
32 |
-
COLORLIB_LOGIN_CUSTOMIZER_BASE . '/includes/lib/controls',
|
33 |
-
);
|
34 |
-
|
35 |
-
foreach ( $directories as $directory ) {
|
36 |
-
if ( file_exists( $directory . '/class-' . strtolower( $bind ) . '.php' ) ) {
|
37 |
-
require_once $directory . '/class-' . strtolower( $bind ) . '.php';
|
38 |
-
|
39 |
-
return;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
$autoloader = new Colorlib_Login_Customizer_Autoloader();
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WPINC' ) ) {
|
3 |
+
die;
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Colorlib_Login_Customizer_Autoloader
|
8 |
+
*/
|
9 |
+
class Colorlib_Login_Customizer_Autoloader {
|
10 |
+
/**
|
11 |
+
* Colorlib_Login_Customizer_Autoloader constructor.
|
12 |
+
*/
|
13 |
+
public function __construct() {
|
14 |
+
spl_autoload_register( array( $this, 'load' ) );
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @param $class
|
19 |
+
*/
|
20 |
+
public function load( $class ) {
|
21 |
+
$parts = explode( '_', $class );
|
22 |
+
$bind = implode( '-', $parts );
|
23 |
+
|
24 |
+
if ( 'Colorlib' == $parts[0] ) {
|
25 |
+
|
26 |
+
/*
|
27 |
+
* Core library autoload.
|
28 |
+
*/
|
29 |
+
$directories = array(
|
30 |
+
COLORLIB_LOGIN_CUSTOMIZER_BASE . '/includes',
|
31 |
+
COLORLIB_LOGIN_CUSTOMIZER_BASE . '/includes/lib',
|
32 |
+
COLORLIB_LOGIN_CUSTOMIZER_BASE . '/includes/lib/controls',
|
33 |
+
);
|
34 |
+
|
35 |
+
foreach ( $directories as $directory ) {
|
36 |
+
if ( file_exists( $directory . '/class-' . strtolower( $bind ) . '.php' ) ) {
|
37 |
+
require_once $directory . '/class-' . strtolower( $bind ) . '.php';
|
38 |
+
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
$autoloader = new Colorlib_Login_Customizer_Autoloader();
|
includes/class-colorlib-login-customizer-feedback.php
CHANGED
@@ -1,262 +1,262 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Colorlib_Login_Customizer_Feedback {
|
4 |
-
|
5 |
-
private $plugin_file = '';
|
6 |
-
private $plugin_name = '';
|
7 |
-
|
8 |
-
function __construct( $_plugin_file ) {
|
9 |
-
|
10 |
-
$this->plugin_file = $_plugin_file;
|
11 |
-
$this->plugin_name = basename( $this->plugin_file, '.php' );
|
12 |
-
|
13 |
-
// Deactivation
|
14 |
-
add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'filter_action_links' ) );
|
15 |
-
add_action( 'admin_footer-plugins.php', array( $this, 'goodbye_ajax' ) );
|
16 |
-
add_action( 'wp_ajax_epsilon_deactivate_plugin', array( $this, 'epsilon_deactivate_plugin_callback' ) );
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Filter the deactivation link to allow us to present a form when the user deactivates the plugin
|
22 |
-
* @since 1.0.0
|
23 |
-
*/
|
24 |
-
public function filter_action_links( $links ) {
|
25 |
-
|
26 |
-
if ( isset( $links['deactivate'] ) ) {
|
27 |
-
$deactivation_link = $links['deactivate'];
|
28 |
-
// Insert an onClick action to allow form before deactivating
|
29 |
-
$deactivation_link = str_replace( '<a ', '<div class="epsilon-deactivate-form-wrapper"><span class="epsilon-deactivate-form" id="epsilon-deactivate-form-' . esc_attr( $this->plugin_name ) . '"></span></div><a onclick="javascript:event.preventDefault();" id="epsilon-deactivate-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
|
30 |
-
$links['deactivate'] = $deactivation_link;
|
31 |
-
}
|
32 |
-
return $links;
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Form text strings
|
37 |
-
* These can be filtered
|
38 |
-
* @since 1.0.0
|
39 |
-
*/
|
40 |
-
public function goodbye_ajax() {
|
41 |
-
// Get our strings for the form
|
42 |
-
$form = $this->get_form_info();
|
43 |
-
|
44 |
-
// Build the HTML to go in the form
|
45 |
-
$html = '<div class="epsilon-deactivate-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
|
46 |
-
$html .= '<div class="epsilon-deactivate-form-body"><p>' . esc_html( $form['body'] ) . '</p>';
|
47 |
-
if ( is_array( $form['options'] ) ) {
|
48 |
-
$html .= '<div class="epsilon-deactivate-options"><p>';
|
49 |
-
foreach ( $form['options'] as $key => $option ) {
|
50 |
-
if ( 'no-reason' == $key ) {
|
51 |
-
$html .= '<input type="radio" name="epsilon-deactivate-reason" checked="checked" id="' . esc_attr( $key ) . '" value="' . esc_attr( $key ) . '"> <label for="' . esc_attr( $key ) . '">' . esc_attr( $option ) . '</label><br>';
|
52 |
-
} else {
|
53 |
-
$html .= '<input type="radio" name="epsilon-deactivate-reason" id="' . esc_attr( $key ) . '" value="' . esc_attr( $key ) . '"> <label for="' . esc_attr( $key ) . '">' . esc_attr( $option ) . '</label><br>';
|
54 |
-
}
|
55 |
-
}
|
56 |
-
$html .= '</p><label id="epsilon-deactivate-details-label" for="epsilon-deactivate-reasons"><strong>' . esc_html( $form['details'] ) . '</strong></label><textarea name="epsilon-deactivate-details" id="epsilon-deactivate-details" rows="2" style="width:100%"></textarea>';
|
57 |
-
$html .= '<input type="checkbox" name="epsilon-deactivate-tracking" checked="" id="allow-tracking" value="yes"> <label for="allow-tracking">' . esc_html__( 'Allow us to get more information in order to improve our plugin', 'colorlib-login-customizer' ) . '</label><br>';
|
58 |
-
$html .= '</div><!-- .epsilon-deactivate-options -->';
|
59 |
-
}
|
60 |
-
$html .= '</div><!-- .epsilon-deactivate-form-body -->';
|
61 |
-
$html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'colorlib-login-customizer' ) . '</p>';
|
62 |
-
$html .= '<div class="epsilon-deactivate-form-footer"><p><a id="epsilon-deactivate-plugin" href="#">' . __( 'Just Deactivate', 'colorlib-login-customizer' ) . '</a><a id="epsilon-deactivate-submit-form" class="button button-primary" href="#">' . __( 'Submit and Deactivate', 'colorlib-login-customizer' ) . '</a></p></div>'
|
63 |
-
?>
|
64 |
-
<div class="epsilon-deactivate-form-bg"></div>
|
65 |
-
<style type="text/css">
|
66 |
-
.epsilon-deactivate-form-active .epsilon-deactivate-form-bg {
|
67 |
-
background: rgba( 0, 0, 0, .5 );
|
68 |
-
position: fixed;
|
69 |
-
top: 0;
|
70 |
-
left: 0;
|
71 |
-
width: 100%;
|
72 |
-
height: 100%;
|
73 |
-
}
|
74 |
-
.epsilon-deactivate-form-wrapper {
|
75 |
-
position: relative;
|
76 |
-
z-index: 999;
|
77 |
-
display: none;
|
78 |
-
}
|
79 |
-
.epsilon-deactivate-form-active .epsilon-deactivate-form-wrapper {
|
80 |
-
display: block;
|
81 |
-
}
|
82 |
-
.epsilon-deactivate-form {
|
83 |
-
display: none;
|
84 |
-
}
|
85 |
-
.epsilon-deactivate-form-active .epsilon-deactivate-form {
|
86 |
-
position: absolute;
|
87 |
-
bottom: 30px;
|
88 |
-
left: 0;
|
89 |
-
width: 400px;
|
90 |
-
background: #fff;
|
91 |
-
white-space: normal;
|
92 |
-
}
|
93 |
-
.epsilon-deactivate-form-head {
|
94 |
-
background: #51AD31;
|
95 |
-
color: #fff;
|
96 |
-
padding: 8px 18px;
|
97 |
-
}
|
98 |
-
.epsilon-deactivate-form-body {
|
99 |
-
padding: 8px 18px;
|
100 |
-
color: #444;
|
101 |
-
}
|
102 |
-
.deactivating-spinner {
|
103 |
-
display: none;
|
104 |
-
}
|
105 |
-
.deactivating-spinner .spinner {
|
106 |
-
float: none;
|
107 |
-
margin: 4px 4px 0 18px;
|
108 |
-
vertical-align: bottom;
|
109 |
-
visibility: visible;
|
110 |
-
}
|
111 |
-
.epsilon-deactivate-form-footer {
|
112 |
-
padding: 8px 18px;
|
113 |
-
}
|
114 |
-
.epsilon-deactivate-form-footer p {
|
115 |
-
display: flex;
|
116 |
-
align-items: center;
|
117 |
-
justify-content: space-between;
|
118 |
-
}
|
119 |
-
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-body,
|
120 |
-
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-footer {
|
121 |
-
position: relative;
|
122 |
-
}
|
123 |
-
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-body:after,
|
124 |
-
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-footer:after {
|
125 |
-
content: "";
|
126 |
-
display: block;
|
127 |
-
position: absolute;
|
128 |
-
top: 0;
|
129 |
-
left: 0;
|
130 |
-
width: 100%;
|
131 |
-
height: 100%;
|
132 |
-
background-color: rgba( 255, 255, 255, .5 );
|
133 |
-
}
|
134 |
-
</style>
|
135 |
-
<script>
|
136 |
-
jQuery(document).ready(function($){
|
137 |
-
var deactivateURL = $("#epsilon-deactivate-link-<?php echo esc_attr( $this->plugin_name ); ?>"),
|
138 |
-
formContainer = $('#epsilon-deactivate-form-<?php echo esc_attr( $this->plugin_name ); ?>'),
|
139 |
-
detailsStrings = {
|
140 |
-
'no-reson' : '<?php echo __( 'How could we improve ?', 'colorlib-login-customizer' ); ?>',
|
141 |
-
'setup' : '<?php echo __( 'What was the dificult part ?', 'colorlib-login-customizer' ); ?>',
|
142 |
-
'documentation' : '<?php echo __( 'What can we describe more ?', 'colorlib-login-customizer' ); ?>',
|
143 |
-
'features' : '<?php echo __( 'How could we improve ?', 'colorlib-login-customizer' ); ?>',
|
144 |
-
'better-plugin' : '<?php echo __( 'Can you mention it ?', 'colorlib-login-customizer' ); ?>',
|
145 |
-
'incompatibility' : '<?php echo __( 'With what plugin or theme is incompatible ?', 'colorlib-login-customizer' ); ?>',
|
146 |
-
};
|
147 |
-
|
148 |
-
$( deactivateURL ).on("click",function(){
|
149 |
-
// We'll send the user to this deactivation link when they've completed or dismissed the form
|
150 |
-
var url = deactivateURL.attr( 'href' );
|
151 |
-
$('body').toggleClass('epsilon-deactivate-form-active');
|
152 |
-
formContainer.fadeIn( {
|
153 |
-
complete: function() {
|
154 |
-
var offset = formContainer.offset();
|
155 |
-
if( offset.top < 50 ) {
|
156 |
-
$(this).parent().css('top', (50 - offset.top) + 'px')
|
157 |
-
}
|
158 |
-
$( 'body' ).animate( { scrollTop: Math.max( 0, offset.top - 50 ) } );
|
159 |
-
}
|
160 |
-
} );
|
161 |
-
formContainer.html( '<?php echo $html; ?>');
|
162 |
-
|
163 |
-
formContainer.on( 'change', 'input[name="epsilon-deactivate-reason"]', function(){
|
164 |
-
var detailsLabel = formContainer.find( '#epsilon-deactivate-details-label strong' );
|
165 |
-
var value = formContainer.find( 'input[name="epsilon-deactivate-reason"]:checked' ).val();
|
166 |
-
detailsLabel.text( detailsStrings[ value ] );
|
167 |
-
});
|
168 |
-
|
169 |
-
formContainer.on('click', '#epsilon-deactivate-submit-form', function(e){
|
170 |
-
var data = {
|
171 |
-
'action': 'epsilon_deactivate_plugin',
|
172 |
-
'security': "<?php echo wp_create_nonce( 'epsilon_deactivate_plugin' ); ?>",
|
173 |
-
'dataType': "json"
|
174 |
-
};
|
175 |
-
e.preventDefault();
|
176 |
-
// As soon as we click, the body of the form should disappear
|
177 |
-
formContainer.addClass( 'process-response' );
|
178 |
-
// Fade in spinner
|
179 |
-
formContainer.find(".deactivating-spinner").fadeIn();
|
180 |
-
|
181 |
-
data['reason'] = formContainer.find( 'input[name="epsilon-deactivate-reason"]:checked' ).val();
|
182 |
-
data['details'] = formContainer.find('#epsilon-deactivate-details').val();
|
183 |
-
data['tracking'] = formContainer.find( '#allow-tracking:checked' ).length;
|
184 |
-
|
185 |
-
$.post(
|
186 |
-
ajaxurl,
|
187 |
-
data,
|
188 |
-
function(response){
|
189 |
-
// Redirect to original deactivation URL
|
190 |
-
window.location.href = url;
|
191 |
-
}
|
192 |
-
);
|
193 |
-
});
|
194 |
-
|
195 |
-
formContainer.on('click', '#epsilon-deactivate-plugin', function(e){
|
196 |
-
e.preventDefault();
|
197 |
-
window.location.href = url;
|
198 |
-
});
|
199 |
-
|
200 |
-
// If we click outside the form, the form will close
|
201 |
-
$('.epsilon-deactivate-form-bg').on('click',function(){
|
202 |
-
formContainer.fadeOut();
|
203 |
-
$('body').removeClass('epsilon-deactivate-form-active');
|
204 |
-
});
|
205 |
-
});
|
206 |
-
});
|
207 |
-
</script>
|
208 |
-
<?php
|
209 |
-
}
|
210 |
-
|
211 |
-
/*
|
212 |
-
* Form text strings
|
213 |
-
* These are non-filterable and used as fallback in case filtered strings aren't set correctly
|
214 |
-
* @since 1.0.0
|
215 |
-
*/
|
216 |
-
public function get_form_info() {
|
217 |
-
$form = array();
|
218 |
-
$form['heading'] = __( 'Sorry to see you go', 'colorlib-login-customizer' );
|
219 |
-
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'colorlib-login-customizer' );
|
220 |
-
$form['options'] = array(
|
221 |
-
'no-reason' => __( 'Without reason', 'colorlib-login-customizer' ),
|
222 |
-
'setup' => __( 'Set up is too difficult', 'colorlib-login-customizer' ),
|
223 |
-
'documentation' => __( 'Lack of documentation', 'colorlib-login-customizer' ),
|
224 |
-
'features' => __( 'Not the features I wanted', 'colorlib-login-customizer' ),
|
225 |
-
'better-plugin' => __( 'Found a better plugin', 'colorlib-login-customizer' ),
|
226 |
-
'incompatibility' => __( 'Incompatible with theme or plugin', 'colorlib-login-customizer' ),
|
227 |
-
);
|
228 |
-
$form['details'] = __( 'How could we improve ?', 'colorlib-login-customizer' );
|
229 |
-
return $form;
|
230 |
-
}
|
231 |
-
|
232 |
-
public function epsilon_deactivate_plugin_callback() {
|
233 |
-
|
234 |
-
check_ajax_referer( 'epsilon_deactivate_plugin', 'security' );
|
235 |
-
|
236 |
-
if ( isset( $_POST['reason'] ) && isset( $_POST['details'] ) && isset( $_POST['tracking'] ) ) {
|
237 |
-
$args = array(
|
238 |
-
'reason' => $_POST['reason'],
|
239 |
-
'details' => $_POST['details'],
|
240 |
-
'tracking' => $_POST['tracking'],
|
241 |
-
);
|
242 |
-
$request = new Colorlib_Login_Customizer_Plugin_Request( $this->plugin_file, $args );
|
243 |
-
if ( $request->request_successful ) {
|
244 |
-
echo json_encode( array(
|
245 |
-
'status' => 'ok',
|
246 |
-
) );
|
247 |
-
} else {
|
248 |
-
echo json_encode( array(
|
249 |
-
'status' => 'nok',
|
250 |
-
) );
|
251 |
-
}
|
252 |
-
} else {
|
253 |
-
echo json_encode( array(
|
254 |
-
'status' => 'ok',
|
255 |
-
) );
|
256 |
-
}
|
257 |
-
|
258 |
-
die();
|
259 |
-
|
260 |
-
}
|
261 |
-
|
262 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Colorlib_Login_Customizer_Feedback {
|
4 |
+
|
5 |
+
private $plugin_file = '';
|
6 |
+
private $plugin_name = '';
|
7 |
+
|
8 |
+
function __construct( $_plugin_file ) {
|
9 |
+
|
10 |
+
$this->plugin_file = $_plugin_file;
|
11 |
+
$this->plugin_name = basename( $this->plugin_file, '.php' );
|
12 |
+
|
13 |
+
// Deactivation
|
14 |
+
add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'filter_action_links' ) );
|
15 |
+
add_action( 'admin_footer-plugins.php', array( $this, 'goodbye_ajax' ) );
|
16 |
+
add_action( 'wp_ajax_epsilon_deactivate_plugin', array( $this, 'epsilon_deactivate_plugin_callback' ) );
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Filter the deactivation link to allow us to present a form when the user deactivates the plugin
|
22 |
+
* @since 1.0.0
|
23 |
+
*/
|
24 |
+
public function filter_action_links( $links ) {
|
25 |
+
|
26 |
+
if ( isset( $links['deactivate'] ) ) {
|
27 |
+
$deactivation_link = $links['deactivate'];
|
28 |
+
// Insert an onClick action to allow form before deactivating
|
29 |
+
$deactivation_link = str_replace( '<a ', '<div class="epsilon-deactivate-form-wrapper"><span class="epsilon-deactivate-form" id="epsilon-deactivate-form-' . esc_attr( $this->plugin_name ) . '"></span></div><a onclick="javascript:event.preventDefault();" id="epsilon-deactivate-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
|
30 |
+
$links['deactivate'] = $deactivation_link;
|
31 |
+
}
|
32 |
+
return $links;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Form text strings
|
37 |
+
* These can be filtered
|
38 |
+
* @since 1.0.0
|
39 |
+
*/
|
40 |
+
public function goodbye_ajax() {
|
41 |
+
// Get our strings for the form
|
42 |
+
$form = $this->get_form_info();
|
43 |
+
|
44 |
+
// Build the HTML to go in the form
|
45 |
+
$html = '<div class="epsilon-deactivate-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
|
46 |
+
$html .= '<div class="epsilon-deactivate-form-body"><p>' . esc_html( $form['body'] ) . '</p>';
|
47 |
+
if ( is_array( $form['options'] ) ) {
|
48 |
+
$html .= '<div class="epsilon-deactivate-options"><p>';
|
49 |
+
foreach ( $form['options'] as $key => $option ) {
|
50 |
+
if ( 'no-reason' == $key ) {
|
51 |
+
$html .= '<input type="radio" name="epsilon-deactivate-reason" checked="checked" id="' . esc_attr( $key ) . '" value="' . esc_attr( $key ) . '"> <label for="' . esc_attr( $key ) . '">' . esc_attr( $option ) . '</label><br>';
|
52 |
+
} else {
|
53 |
+
$html .= '<input type="radio" name="epsilon-deactivate-reason" id="' . esc_attr( $key ) . '" value="' . esc_attr( $key ) . '"> <label for="' . esc_attr( $key ) . '">' . esc_attr( $option ) . '</label><br>';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$html .= '</p><label id="epsilon-deactivate-details-label" for="epsilon-deactivate-reasons"><strong>' . esc_html( $form['details'] ) . '</strong></label><textarea name="epsilon-deactivate-details" id="epsilon-deactivate-details" rows="2" style="width:100%"></textarea>';
|
57 |
+
$html .= '<input type="checkbox" name="epsilon-deactivate-tracking" checked="" id="allow-tracking" value="yes"> <label for="allow-tracking">' . esc_html__( 'Allow us to get more information in order to improve our plugin', 'colorlib-login-customizer' ) . '</label><br>';
|
58 |
+
$html .= '</div><!-- .epsilon-deactivate-options -->';
|
59 |
+
}
|
60 |
+
$html .= '</div><!-- .epsilon-deactivate-form-body -->';
|
61 |
+
$html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'colorlib-login-customizer' ) . '</p>';
|
62 |
+
$html .= '<div class="epsilon-deactivate-form-footer"><p><a id="epsilon-deactivate-plugin" href="#">' . __( 'Just Deactivate', 'colorlib-login-customizer' ) . '</a><a id="epsilon-deactivate-submit-form" class="button button-primary" href="#">' . __( 'Submit and Deactivate', 'colorlib-login-customizer' ) . '</a></p></div>'
|
63 |
+
?>
|
64 |
+
<div class="epsilon-deactivate-form-bg"></div>
|
65 |
+
<style type="text/css">
|
66 |
+
.epsilon-deactivate-form-active .epsilon-deactivate-form-bg {
|
67 |
+
background: rgba( 0, 0, 0, .5 );
|
68 |
+
position: fixed;
|
69 |
+
top: 0;
|
70 |
+
left: 0;
|
71 |
+
width: 100%;
|
72 |
+
height: 100%;
|
73 |
+
}
|
74 |
+
.epsilon-deactivate-form-wrapper {
|
75 |
+
position: relative;
|
76 |
+
z-index: 999;
|
77 |
+
display: none;
|
78 |
+
}
|
79 |
+
.epsilon-deactivate-form-active .epsilon-deactivate-form-wrapper {
|
80 |
+
display: block;
|
81 |
+
}
|
82 |
+
.epsilon-deactivate-form {
|
83 |
+
display: none;
|
84 |
+
}
|
85 |
+
.epsilon-deactivate-form-active .epsilon-deactivate-form {
|
86 |
+
position: absolute;
|
87 |
+
bottom: 30px;
|
88 |
+
left: 0;
|
89 |
+
width: 400px;
|
90 |
+
background: #fff;
|
91 |
+
white-space: normal;
|
92 |
+
}
|
93 |
+
.epsilon-deactivate-form-head {
|
94 |
+
background: #51AD31;
|
95 |
+
color: #fff;
|
96 |
+
padding: 8px 18px;
|
97 |
+
}
|
98 |
+
.epsilon-deactivate-form-body {
|
99 |
+
padding: 8px 18px;
|
100 |
+
color: #444;
|
101 |
+
}
|
102 |
+
.deactivating-spinner {
|
103 |
+
display: none;
|
104 |
+
}
|
105 |
+
.deactivating-spinner .spinner {
|
106 |
+
float: none;
|
107 |
+
margin: 4px 4px 0 18px;
|
108 |
+
vertical-align: bottom;
|
109 |
+
visibility: visible;
|
110 |
+
}
|
111 |
+
.epsilon-deactivate-form-footer {
|
112 |
+
padding: 8px 18px;
|
113 |
+
}
|
114 |
+
.epsilon-deactivate-form-footer p {
|
115 |
+
display: flex;
|
116 |
+
align-items: center;
|
117 |
+
justify-content: space-between;
|
118 |
+
}
|
119 |
+
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-body,
|
120 |
+
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-footer {
|
121 |
+
position: relative;
|
122 |
+
}
|
123 |
+
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-body:after,
|
124 |
+
.epsilon-deactivate-form.process-response .epsilon-deactivate-form-footer:after {
|
125 |
+
content: "";
|
126 |
+
display: block;
|
127 |
+
position: absolute;
|
128 |
+
top: 0;
|
129 |
+
left: 0;
|
130 |
+
width: 100%;
|
131 |
+
height: 100%;
|
132 |
+
background-color: rgba( 255, 255, 255, .5 );
|
133 |
+
}
|
134 |
+
</style>
|
135 |
+
<script>
|
136 |
+
jQuery(document).ready(function($){
|
137 |
+
var deactivateURL = $("#epsilon-deactivate-link-<?php echo esc_attr( $this->plugin_name ); ?>"),
|
138 |
+
formContainer = $('#epsilon-deactivate-form-<?php echo esc_attr( $this->plugin_name ); ?>'),
|
139 |
+
detailsStrings = {
|
140 |
+
'no-reson' : '<?php echo __( 'How could we improve ?', 'colorlib-login-customizer' ); ?>',
|
141 |
+
'setup' : '<?php echo __( 'What was the dificult part ?', 'colorlib-login-customizer' ); ?>',
|
142 |
+
'documentation' : '<?php echo __( 'What can we describe more ?', 'colorlib-login-customizer' ); ?>',
|
143 |
+
'features' : '<?php echo __( 'How could we improve ?', 'colorlib-login-customizer' ); ?>',
|
144 |
+
'better-plugin' : '<?php echo __( 'Can you mention it ?', 'colorlib-login-customizer' ); ?>',
|
145 |
+
'incompatibility' : '<?php echo __( 'With what plugin or theme is incompatible ?', 'colorlib-login-customizer' ); ?>',
|
146 |
+
};
|
147 |
+
|
148 |
+
$( deactivateURL ).on("click",function(){
|
149 |
+
// We'll send the user to this deactivation link when they've completed or dismissed the form
|
150 |
+
var url = deactivateURL.attr( 'href' );
|
151 |
+
$('body').toggleClass('epsilon-deactivate-form-active');
|
152 |
+
formContainer.fadeIn( {
|
153 |
+
complete: function() {
|
154 |
+
var offset = formContainer.offset();
|
155 |
+
if( offset.top < 50 ) {
|
156 |
+
$(this).parent().css('top', (50 - offset.top) + 'px')
|
157 |
+
}
|
158 |
+
$( 'body' ).animate( { scrollTop: Math.max( 0, offset.top - 50 ) } );
|
159 |
+
}
|
160 |
+
} );
|
161 |
+
formContainer.html( '<?php echo $html; ?>');
|
162 |
+
|
163 |
+
formContainer.on( 'change', 'input[name="epsilon-deactivate-reason"]', function(){
|
164 |
+
var detailsLabel = formContainer.find( '#epsilon-deactivate-details-label strong' );
|
165 |
+
var value = formContainer.find( 'input[name="epsilon-deactivate-reason"]:checked' ).val();
|
166 |
+
detailsLabel.text( detailsStrings[ value ] );
|
167 |
+
});
|
168 |
+
|
169 |
+
formContainer.on('click', '#epsilon-deactivate-submit-form', function(e){
|
170 |
+
var data = {
|
171 |
+
'action': 'epsilon_deactivate_plugin',
|
172 |
+
'security': "<?php echo wp_create_nonce( 'epsilon_deactivate_plugin' ); ?>",
|
173 |
+
'dataType': "json"
|
174 |
+
};
|
175 |
+
e.preventDefault();
|
176 |
+
// As soon as we click, the body of the form should disappear
|
177 |
+
formContainer.addClass( 'process-response' );
|
178 |
+
// Fade in spinner
|
179 |
+
formContainer.find(".deactivating-spinner").fadeIn();
|
180 |
+
|
181 |
+
data['reason'] = formContainer.find( 'input[name="epsilon-deactivate-reason"]:checked' ).val();
|
182 |
+
data['details'] = formContainer.find('#epsilon-deactivate-details').val();
|
183 |
+
data['tracking'] = formContainer.find( '#allow-tracking:checked' ).length;
|
184 |
+
|
185 |
+
$.post(
|
186 |
+
ajaxurl,
|
187 |
+
data,
|
188 |
+
function(response){
|
189 |
+
// Redirect to original deactivation URL
|
190 |
+
window.location.href = url;
|
191 |
+
}
|
192 |
+
);
|
193 |
+
});
|
194 |
+
|
195 |
+
formContainer.on('click', '#epsilon-deactivate-plugin', function(e){
|
196 |
+
e.preventDefault();
|
197 |
+
window.location.href = url;
|
198 |
+
});
|
199 |
+
|
200 |
+
// If we click outside the form, the form will close
|
201 |
+
$('.epsilon-deactivate-form-bg').on('click',function(){
|
202 |
+
formContainer.fadeOut();
|
203 |
+
$('body').removeClass('epsilon-deactivate-form-active');
|
204 |
+
});
|
205 |
+
});
|
206 |
+
});
|
207 |
+
</script>
|
208 |
+
<?php
|
209 |
+
}
|
210 |
+
|
211 |
+
/*
|
212 |
+
* Form text strings
|
213 |
+
* These are non-filterable and used as fallback in case filtered strings aren't set correctly
|
214 |
+
* @since 1.0.0
|
215 |
+
*/
|
216 |
+
public function get_form_info() {
|
217 |
+
$form = array();
|
218 |
+
$form['heading'] = __( 'Sorry to see you go', 'colorlib-login-customizer' );
|
219 |
+
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'colorlib-login-customizer' );
|
220 |
+
$form['options'] = array(
|
221 |
+
'no-reason' => __( 'Without reason', 'colorlib-login-customizer' ),
|
222 |
+
'setup' => __( 'Set up is too difficult', 'colorlib-login-customizer' ),
|
223 |
+
'documentation' => __( 'Lack of documentation', 'colorlib-login-customizer' ),
|
224 |
+
'features' => __( 'Not the features I wanted', 'colorlib-login-customizer' ),
|
225 |
+
'better-plugin' => __( 'Found a better plugin', 'colorlib-login-customizer' ),
|
226 |
+
'incompatibility' => __( 'Incompatible with theme or plugin', 'colorlib-login-customizer' ),
|
227 |
+
);
|
228 |
+
$form['details'] = __( 'How could we improve ?', 'colorlib-login-customizer' );
|
229 |
+
return $form;
|
230 |
+
}
|
231 |
+
|
232 |
+
public function epsilon_deactivate_plugin_callback() {
|
233 |
+
|
234 |
+
check_ajax_referer( 'epsilon_deactivate_plugin', 'security' );
|
235 |
+
|
236 |
+
if ( isset( $_POST['reason'] ) && isset( $_POST['details'] ) && isset( $_POST['tracking'] ) ) {
|
237 |
+
$args = array(
|
238 |
+
'reason' => $_POST['reason'],
|
239 |
+
'details' => $_POST['details'],
|
240 |
+
'tracking' => $_POST['tracking'],
|
241 |
+
);
|
242 |
+
$request = new Colorlib_Login_Customizer_Plugin_Request( $this->plugin_file, $args );
|
243 |
+
if ( $request->request_successful ) {
|
244 |
+
echo json_encode( array(
|
245 |
+
'status' => 'ok',
|
246 |
+
) );
|
247 |
+
} else {
|
248 |
+
echo json_encode( array(
|
249 |
+
'status' => 'nok',
|
250 |
+
) );
|
251 |
+
}
|
252 |
+
} else {
|
253 |
+
echo json_encode( array(
|
254 |
+
'status' => 'ok',
|
255 |
+
) );
|
256 |
+
}
|
257 |
+
|
258 |
+
die();
|
259 |
+
|
260 |
+
}
|
261 |
+
|
262 |
+
}
|
includes/class-colorlib-login-customizer-plugin-request.php
CHANGED
@@ -1,225 +1,225 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Colorlib_Login_Customizer_Plugin_Request {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Url for the request
|
7 |
-
*
|
8 |
-
* @var string
|
9 |
-
*/
|
10 |
-
private $url = 'https://tamewp.com/';
|
11 |
-
/**
|
12 |
-
* Api endpoint
|
13 |
-
*
|
14 |
-
* @var string
|
15 |
-
*/
|
16 |
-
private $endpoint = 'wp-json/epsilon/v1/add-tracking-data';
|
17 |
-
/**
|
18 |
-
* Private data
|
19 |
-
*
|
20 |
-
* @var array
|
21 |
-
*/
|
22 |
-
private $data = array(
|
23 |
-
'server' => array(),
|
24 |
-
'user' => array(),
|
25 |
-
'wordpress' => array(
|
26 |
-
'deactivated_plugin' => array(),
|
27 |
-
),
|
28 |
-
);
|
29 |
-
/**
|
30 |
-
* Plugin file
|
31 |
-
*
|
32 |
-
* @var string
|
33 |
-
*/
|
34 |
-
private $plugin_file = '';
|
35 |
-
|
36 |
-
private $allow_tracking = 0;
|
37 |
-
|
38 |
-
public $request_successful = false;
|
39 |
-
|
40 |
-
function __construct( $_plugin_file, $args ) {
|
41 |
-
|
42 |
-
// Set variables
|
43 |
-
$this->allow_tracking = $args['tracking'];
|
44 |
-
$this->plugin_file = $_plugin_file;
|
45 |
-
$this->data['unique'] = md5( home_url() . get_bloginfo( 'admin_email' ) );
|
46 |
-
$this->data['wordpress']['deactivated_plugin']['uninstall_reason'] = $args['reason'];
|
47 |
-
$this->data['wordpress']['deactivated_plugin']['uninstall_details'] = $args['details'];
|
48 |
-
|
49 |
-
// Start collecting data
|
50 |
-
$this->_collect_data();
|
51 |
-
$this->_generate_url();
|
52 |
-
$this->request_successful = $this->_send_request();
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Collect all data for the request.
|
57 |
-
*
|
58 |
-
*/
|
59 |
-
private function _collect_data() {
|
60 |
-
|
61 |
-
$current_plugin = get_plugin_data( $this->plugin_file );
|
62 |
-
|
63 |
-
// Plugin data
|
64 |
-
$this->data['wordpress']['deactivated_plugin']['slug'] = $current_plugin['TextDomain'];
|
65 |
-
$this->data['wordpress']['deactivated_plugin']['name'] = $current_plugin['Name'];
|
66 |
-
$this->data['wordpress']['deactivated_plugin']['version'] = $current_plugin['Version'];
|
67 |
-
$this->data['wordpress']['deactivated_plugin']['author'] = $current_plugin['AuthorName'];
|
68 |
-
|
69 |
-
if ( $this->allow_tracking ) {
|
70 |
-
$this->_collect_wordpress_data();
|
71 |
-
$this->_collect_server_data();
|
72 |
-
$this->_collect_user_data();
|
73 |
-
}
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Collect WordPress data.
|
79 |
-
*
|
80 |
-
*/
|
81 |
-
private function _collect_wordpress_data() {
|
82 |
-
$this->data['wordpress']['locale'] = ( get_bloginfo( 'version' ) >= 4.7 ) ? get_user_locale() : get_locale();
|
83 |
-
$this->data['wordpress']['wp_version'] = get_bloginfo( 'version' );
|
84 |
-
$this->data['wordpress']['multisite'] = is_multisite();
|
85 |
-
|
86 |
-
$this->data['wordpress']['themes'] = $this->get_themes();
|
87 |
-
$this->data['wordpress']['plugins'] = $this->get_plugins();
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Collect server data.
|
92 |
-
*
|
93 |
-
*/
|
94 |
-
private function _collect_server_data() {
|
95 |
-
$this->data['server']['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
|
96 |
-
$this->data['server']['php_version'] = phpversion();
|
97 |
-
$this->data['server']['url'] = home_url();
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Collect user data.
|
102 |
-
*
|
103 |
-
*/
|
104 |
-
private function _collect_user_data() {
|
105 |
-
$admin = get_user_by( 'email', get_bloginfo( 'admin_email' ) );
|
106 |
-
if ( ! $admin ) {
|
107 |
-
$this->data['user']['email'] = '';
|
108 |
-
$this->data['user']['first_name'] = '';
|
109 |
-
$this->data['user']['last_name'] = '';
|
110 |
-
} else {
|
111 |
-
$this->data['user']['email'] = get_bloginfo( 'admin_email' );
|
112 |
-
$this->data['user']['first_name'] = $admin->first_name;
|
113 |
-
$this->data['user']['last_name'] = $admin->last_name;
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Get current themes
|
119 |
-
*
|
120 |
-
* @return array
|
121 |
-
*/
|
122 |
-
private function get_themes() {
|
123 |
-
$theme = wp_get_theme();
|
124 |
-
|
125 |
-
return array(
|
126 |
-
'installed' => $this->_get_installed_themes(),
|
127 |
-
'active' => array(
|
128 |
-
'slug' => get_stylesheet(),
|
129 |
-
'name' => $theme->get( 'Name' ),
|
130 |
-
'version' => $theme->get( 'Version' ),
|
131 |
-
'author' => $theme->get( 'Author' ),
|
132 |
-
),
|
133 |
-
);
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Get an array of installed themes
|
138 |
-
*/
|
139 |
-
private function _get_installed_themes() {
|
140 |
-
$installed = wp_get_themes();
|
141 |
-
$theme = get_stylesheet();
|
142 |
-
$arr = array();
|
143 |
-
|
144 |
-
foreach ( $installed as $slug => $info ) {
|
145 |
-
if ( $slug === $theme ) {
|
146 |
-
continue;
|
147 |
-
}
|
148 |
-
$arr[ $slug ] = array(
|
149 |
-
'slug' => $slug,
|
150 |
-
'name' => $info->get( 'Name' ),
|
151 |
-
'version' => $info->get( 'Version' ),
|
152 |
-
'author' => $info->get( 'Author' ),
|
153 |
-
);
|
154 |
-
};
|
155 |
-
|
156 |
-
return $arr;
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Get a list of installed plugins
|
161 |
-
*/
|
162 |
-
private function get_plugins() {
|
163 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
164 |
-
include ABSPATH . '/wp-admin/includes/plugin.php';
|
165 |
-
}
|
166 |
-
|
167 |
-
$plugins = get_plugins();
|
168 |
-
$option = get_option( 'active_plugins', array() );
|
169 |
-
$active = array();
|
170 |
-
$installed = array();
|
171 |
-
foreach ( $plugins as $id => $info ) {
|
172 |
-
if ( in_array( $id, $active ) ) {
|
173 |
-
continue;
|
174 |
-
}
|
175 |
-
|
176 |
-
$id = explode( '/', $id );
|
177 |
-
$id = ucwords( str_replace( '-', ' ', $id[0] ) );
|
178 |
-
|
179 |
-
$installed[] = $id;
|
180 |
-
}
|
181 |
-
|
182 |
-
foreach ( $option as $id ) {
|
183 |
-
$id = explode( '/', $id );
|
184 |
-
$id = ucwords( str_replace( '-', ' ', $id[0] ) );
|
185 |
-
|
186 |
-
$active[] = $id;
|
187 |
-
}
|
188 |
-
|
189 |
-
return array(
|
190 |
-
'installed' => $installed,
|
191 |
-
'active' => $active,
|
192 |
-
);
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Generate the url
|
197 |
-
*/
|
198 |
-
protected function _generate_url() {
|
199 |
-
$this->url = $this->url . $this->endpoint;
|
200 |
-
}
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Send dat to server.
|
204 |
-
*
|
205 |
-
*/
|
206 |
-
private function _send_request() {
|
207 |
-
|
208 |
-
$request = wp_remote_post( $this->url, array(
|
209 |
-
'method' => 'POST',
|
210 |
-
'timeout' => 20,
|
211 |
-
'redirection' => 5,
|
212 |
-
'httpversion' => '1.1',
|
213 |
-
'blocking' => true,
|
214 |
-
'body' => $this->data,
|
215 |
-
'user-agent' => 'MT/EPSILON-CUSTOMER-TRACKING/' . esc_url( home_url() ),
|
216 |
-
) );
|
217 |
-
|
218 |
-
if ( is_wp_error( $request ) ) {
|
219 |
-
return false;
|
220 |
-
}
|
221 |
-
|
222 |
-
return true;
|
223 |
-
|
224 |
-
}
|
225 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Colorlib_Login_Customizer_Plugin_Request {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Url for the request
|
7 |
+
*
|
8 |
+
* @var string
|
9 |
+
*/
|
10 |
+
private $url = 'https://tamewp.com/';
|
11 |
+
/**
|
12 |
+
* Api endpoint
|
13 |
+
*
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
private $endpoint = 'wp-json/epsilon/v1/add-tracking-data';
|
17 |
+
/**
|
18 |
+
* Private data
|
19 |
+
*
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
private $data = array(
|
23 |
+
'server' => array(),
|
24 |
+
'user' => array(),
|
25 |
+
'wordpress' => array(
|
26 |
+
'deactivated_plugin' => array(),
|
27 |
+
),
|
28 |
+
);
|
29 |
+
/**
|
30 |
+
* Plugin file
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
private $plugin_file = '';
|
35 |
+
|
36 |
+
private $allow_tracking = 0;
|
37 |
+
|
38 |
+
public $request_successful = false;
|
39 |
+
|
40 |
+
function __construct( $_plugin_file, $args ) {
|
41 |
+
|
42 |
+
// Set variables
|
43 |
+
$this->allow_tracking = $args['tracking'];
|
44 |
+
$this->plugin_file = $_plugin_file;
|
45 |
+
$this->data['unique'] = md5( home_url() . get_bloginfo( 'admin_email' ) );
|
46 |
+
$this->data['wordpress']['deactivated_plugin']['uninstall_reason'] = $args['reason'];
|
47 |
+
$this->data['wordpress']['deactivated_plugin']['uninstall_details'] = $args['details'];
|
48 |
+
|
49 |
+
// Start collecting data
|
50 |
+
$this->_collect_data();
|
51 |
+
$this->_generate_url();
|
52 |
+
$this->request_successful = $this->_send_request();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Collect all data for the request.
|
57 |
+
*
|
58 |
+
*/
|
59 |
+
private function _collect_data() {
|
60 |
+
|
61 |
+
$current_plugin = get_plugin_data( $this->plugin_file );
|
62 |
+
|
63 |
+
// Plugin data
|
64 |
+
$this->data['wordpress']['deactivated_plugin']['slug'] = $current_plugin['TextDomain'];
|
65 |
+
$this->data['wordpress']['deactivated_plugin']['name'] = $current_plugin['Name'];
|
66 |
+
$this->data['wordpress']['deactivated_plugin']['version'] = $current_plugin['Version'];
|
67 |
+
$this->data['wordpress']['deactivated_plugin']['author'] = $current_plugin['AuthorName'];
|
68 |
+
|
69 |
+
if ( $this->allow_tracking ) {
|
70 |
+
$this->_collect_wordpress_data();
|
71 |
+
$this->_collect_server_data();
|
72 |
+
$this->_collect_user_data();
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Collect WordPress data.
|
79 |
+
*
|
80 |
+
*/
|
81 |
+
private function _collect_wordpress_data() {
|
82 |
+
$this->data['wordpress']['locale'] = ( get_bloginfo( 'version' ) >= 4.7 ) ? get_user_locale() : get_locale();
|
83 |
+
$this->data['wordpress']['wp_version'] = get_bloginfo( 'version' );
|
84 |
+
$this->data['wordpress']['multisite'] = is_multisite();
|
85 |
+
|
86 |
+
$this->data['wordpress']['themes'] = $this->get_themes();
|
87 |
+
$this->data['wordpress']['plugins'] = $this->get_plugins();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Collect server data.
|
92 |
+
*
|
93 |
+
*/
|
94 |
+
private function _collect_server_data() {
|
95 |
+
$this->data['server']['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
|
96 |
+
$this->data['server']['php_version'] = phpversion();
|
97 |
+
$this->data['server']['url'] = home_url();
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Collect user data.
|
102 |
+
*
|
103 |
+
*/
|
104 |
+
private function _collect_user_data() {
|
105 |
+
$admin = get_user_by( 'email', get_bloginfo( 'admin_email' ) );
|
106 |
+
if ( ! $admin ) {
|
107 |
+
$this->data['user']['email'] = '';
|
108 |
+
$this->data['user']['first_name'] = '';
|
109 |
+
$this->data['user']['last_name'] = '';
|
110 |
+
} else {
|
111 |
+
$this->data['user']['email'] = get_bloginfo( 'admin_email' );
|
112 |
+
$this->data['user']['first_name'] = $admin->first_name;
|
113 |
+
$this->data['user']['last_name'] = $admin->last_name;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get current themes
|
119 |
+
*
|
120 |
+
* @return array
|
121 |
+
*/
|
122 |
+
private function get_themes() {
|
123 |
+
$theme = wp_get_theme();
|
124 |
+
|
125 |
+
return array(
|
126 |
+
'installed' => $this->_get_installed_themes(),
|
127 |
+
'active' => array(
|
128 |
+
'slug' => get_stylesheet(),
|
129 |
+
'name' => $theme->get( 'Name' ),
|
130 |
+
'version' => $theme->get( 'Version' ),
|
131 |
+
'author' => $theme->get( 'Author' ),
|
132 |
+
),
|
133 |
+
);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Get an array of installed themes
|
138 |
+
*/
|
139 |
+
private function _get_installed_themes() {
|
140 |
+
$installed = wp_get_themes();
|
141 |
+
$theme = get_stylesheet();
|
142 |
+
$arr = array();
|
143 |
+
|
144 |
+
foreach ( $installed as $slug => $info ) {
|
145 |
+
if ( $slug === $theme ) {
|
146 |
+
continue;
|
147 |
+
}
|
148 |
+
$arr[ $slug ] = array(
|
149 |
+
'slug' => $slug,
|
150 |
+
'name' => $info->get( 'Name' ),
|
151 |
+
'version' => $info->get( 'Version' ),
|
152 |
+
'author' => $info->get( 'Author' ),
|
153 |
+
);
|
154 |
+
};
|
155 |
+
|
156 |
+
return $arr;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get a list of installed plugins
|
161 |
+
*/
|
162 |
+
private function get_plugins() {
|
163 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
164 |
+
include ABSPATH . '/wp-admin/includes/plugin.php';
|
165 |
+
}
|
166 |
+
|
167 |
+
$plugins = get_plugins();
|
168 |
+
$option = get_option( 'active_plugins', array() );
|
169 |
+
$active = array();
|
170 |
+
$installed = array();
|
171 |
+
foreach ( $plugins as $id => $info ) {
|
172 |
+
if ( in_array( $id, $active ) ) {
|
173 |
+
continue;
|
174 |
+
}
|
175 |
+
|
176 |
+
$id = explode( '/', $id );
|
177 |
+
$id = ucwords( str_replace( '-', ' ', $id[0] ) );
|
178 |
+
|
179 |
+
$installed[] = $id;
|
180 |
+
}
|
181 |
+
|
182 |
+
foreach ( $option as $id ) {
|
183 |
+
$id = explode( '/', $id );
|
184 |
+
$id = ucwords( str_replace( '-', ' ', $id[0] ) );
|
185 |
+
|
186 |
+
$active[] = $id;
|
187 |
+
}
|
188 |
+
|
189 |
+
return array(
|
190 |
+
'installed' => $installed,
|
191 |
+
'active' => $active,
|
192 |
+
);
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Generate the url
|
197 |
+
*/
|
198 |
+
protected function _generate_url() {
|
199 |
+
$this->url = $this->url . $this->endpoint;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Send dat to server.
|
204 |
+
*
|
205 |
+
*/
|
206 |
+
private function _send_request() {
|
207 |
+
|
208 |
+
$request = wp_remote_post( $this->url, array(
|
209 |
+
'method' => 'POST',
|
210 |
+
'timeout' => 20,
|
211 |
+
'redirection' => 5,
|
212 |
+
'httpversion' => '1.1',
|
213 |
+
'blocking' => true,
|
214 |
+
'body' => $this->data,
|
215 |
+
'user-agent' => 'MT/EPSILON-CUSTOMER-TRACKING/' . esc_url( home_url() ),
|
216 |
+
) );
|
217 |
+
|
218 |
+
if ( is_wp_error( $request ) ) {
|
219 |
+
return false;
|
220 |
+
}
|
221 |
+
|
222 |
+
return true;
|
223 |
+
|
224 |
+
}
|
225 |
+
}
|
includes/class-colorlib-login-customizer.php
CHANGED
@@ -1,274 +1,274 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
-
exit;
|
4 |
-
};
|
5 |
-
|
6 |
-
class Colorlib_Login_Customizer {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* The single instance of Colorlib_Login_Customizer.
|
10 |
-
*
|
11 |
-
* @var object
|
12 |
-
* @access private
|
13 |
-
* @since 1.0.0
|
14 |
-
*/
|
15 |
-
private static $_instance = null;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Settings class object
|
19 |
-
*
|
20 |
-
* @var object
|
21 |
-
* @access public
|
22 |
-
* @since 1.0.0
|
23 |
-
*/
|
24 |
-
public $settings = null;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* The version number.
|
28 |
-
*
|
29 |
-
* @var string
|
30 |
-
* @access public
|
31 |
-
* @since 1.0.0
|
32 |
-
*/
|
33 |
-
public $_version;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* The token.
|
37 |
-
*
|
38 |
-
* @var string
|
39 |
-
* @access public
|
40 |
-
* @since 1.0.0
|
41 |
-
*/
|
42 |
-
public $_token;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* The main plugin file.
|
46 |
-
*
|
47 |
-
* @var string
|
48 |
-
* @access public
|
49 |
-
* @since 1.0.0
|
50 |
-
*/
|
51 |
-
public $file;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* The main plugin directory.
|
55 |
-
*
|
56 |
-
* @var string
|
57 |
-
* @access public
|
58 |
-
* @since 1.0.0
|
59 |
-
*/
|
60 |
-
public $dir;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* The plugin assets directory.
|
64 |
-
*
|
65 |
-
* @var string
|
66 |
-
* @access public
|
67 |
-
* @since 1.0.0
|
68 |
-
*/
|
69 |
-
public $assets_dir;
|
70 |
-
|
71 |
-
/**
|
72 |
-
* The plugin assets URL.
|
73 |
-
*
|
74 |
-
* @var string
|
75 |
-
* @access public
|
76 |
-
* @since 1.0.0
|
77 |
-
*/
|
78 |
-
public $assets_url;
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Suffix for Javascripts.
|
82 |
-
*
|
83 |
-
* @var string
|
84 |
-
* @access public
|
85 |
-
* @since 1.0.0
|
86 |
-
*/
|
87 |
-
public $script_suffix;
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Constructor function.
|
91 |
-
*
|
92 |
-
* @access public
|
93 |
-
* @since 1.0.0
|
94 |
-
*/
|
95 |
-
public function __construct( $file = '', $version = '1.0.0' ) {
|
96 |
-
$this->_version = $version;
|
97 |
-
$this->_token = 'colorlib-login-customizer';
|
98 |
-
$this->base = 'clc_';
|
99 |
-
$this->key_name = 'clc-options';
|
100 |
-
|
101 |
-
// Load plugin environment variables
|
102 |
-
$this->file = $file;
|
103 |
-
$this->dir = dirname( $this->file );
|
104 |
-
$this->assets_dir = trailingslashit( $this->dir ) . 'assets';
|
105 |
-
$this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $this->file ) ) );
|
106 |
-
|
107 |
-
$this->script_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
108 |
-
// Remove this after Grunt
|
109 |
-
$this->script_suffix = '';
|
110 |
-
|
111 |
-
if ( is_admin() ) {
|
112 |
-
// Plugin Deactivate Feedback
|
113 |
-
new Colorlib_Login_Customizer_Feedback( $file );
|
114 |
-
}
|
115 |
-
|
116 |
-
register_activation_hook( $this->file, array( $this, 'install' ) );
|
117 |
-
|
118 |
-
add_action( 'admin_init', array( $this, 'redirect_customizer' ) );
|
119 |
-
|
120 |
-
// Load customizer settings
|
121 |
-
add_action( 'customize_register', array( $this, 'load_customizer' ), 10, 1 );
|
122 |
-
|
123 |
-
add_filter( 'template_include', array( $this, 'change_template_if_necessary' ), 99 );
|
124 |
-
|
125 |
-
// Handle localisation
|
126 |
-
$this->load_plugin_textdomain();
|
127 |
-
add_action( 'init', array( $this, 'load_localisation' ), 0 );
|
128 |
-
|
129 |
-
// Generate plugins css
|
130 |
-
add_action( 'init', array( $this, 'load_customizer_css' ) );
|
131 |
-
|
132 |
-
} // End __construct ()
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Load the customizer controls
|
136 |
-
*
|
137 |
-
* @param $manager
|
138 |
-
*/
|
139 |
-
public function load_customizer( $manager ) {
|
140 |
-
new Colorlib_Login_Customizer_Customizer( $this, $manager );
|
141 |
-
}
|
142 |
-
|
143 |
-
public function load_customizer_css() {
|
144 |
-
new Colorlib_Login_Customizer_CSS_Customization();
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Hook to redirect the page for the Customizer.
|
149 |
-
*
|
150 |
-
* @access public
|
151 |
-
* @return void
|
152 |
-
*/
|
153 |
-
public function redirect_customizer() {
|
154 |
-
if ( ! empty( $_GET['page'] ) ) { // Input var okay.
|
155 |
-
if ( 'colorlib-login-customizer_settings' === $_GET['page'] ) { // Input var okay.
|
156 |
-
|
157 |
-
// Generate the redirect url.
|
158 |
-
$url = add_query_arg(
|
159 |
-
array(
|
160 |
-
'autofocus[panel]' => 'clc_main_panel',
|
161 |
-
),
|
162 |
-
admin_url( 'customize.php' )
|
163 |
-
);
|
164 |
-
|
165 |
-
wp_safe_redirect( $url );
|
166 |
-
}
|
167 |
-
}
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Load plugin localisation
|
172 |
-
*
|
173 |
-
* @access public
|
174 |
-
* @since 1.0.0
|
175 |
-
* @return void
|
176 |
-
*/
|
177 |
-
public function load_localisation() {
|
178 |
-
load_plugin_textdomain( 'colorlib-login-customizer', false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
|
179 |
-
} // End load_localisation ()
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Load plugin textdomain
|
183 |
-
*
|
184 |
-
* @access public
|
185 |
-
* @since 1.0.0
|
186 |
-
* @return void
|
187 |
-
*/
|
188 |
-
public function load_plugin_textdomain() {
|
189 |
-
$domain = 'colorlib-login-customizer';
|
190 |
-
|
191 |
-
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
192 |
-
|
193 |
-
load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
|
194 |
-
load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
|
195 |
-
} // End load_plugin_textdomain ()
|
196 |
-
|
197 |
-
/**
|
198 |
-
* Main Colorlib_Login_Customizer Instance
|
199 |
-
*
|
200 |
-
* Ensures only one instance of Colorlib_Login_Customizer is loaded or can be loaded.
|
201 |
-
*
|
202 |
-
* @since 1.0.0
|
203 |
-
* @static
|
204 |
-
* @see Colorlib_Login_Customizer()
|
205 |
-
* @return Main Colorlib_Login_Customizer instance
|
206 |
-
*/
|
207 |
-
public static function instance( $file = '', $version = '1.0.0' ) {
|
208 |
-
if ( is_null( self::$_instance ) ) {
|
209 |
-
self::$_instance = new self( $file, $version );
|
210 |
-
}
|
211 |
-
|
212 |
-
return self::$_instance;
|
213 |
-
} // End instance ()
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Cloning is forbidden.
|
217 |
-
*
|
218 |
-
* @since 1.0.0
|
219 |
-
*/
|
220 |
-
public function __clone() {
|
221 |
-
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->_version );
|
222 |
-
} // End __clone ()
|
223 |
-
|
224 |
-
/**
|
225 |
-
* Unserializing instances of this class is forbidden.
|
226 |
-
*
|
227 |
-
* @since 1.0.0
|
228 |
-
*/
|
229 |
-
public function __wakeup() {
|
230 |
-
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->_version );
|
231 |
-
} // End __wakeup ()
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Installation. Runs on activation.
|
235 |
-
*
|
236 |
-
* @access public
|
237 |
-
* @since 1.0.0
|
238 |
-
* @return void
|
239 |
-
*/
|
240 |
-
public function install() {
|
241 |
-
$this->_log_version_number();
|
242 |
-
|
243 |
-
// Backward compatibility
|
244 |
-
$options = get_option( $this->key_name, array() );
|
245 |
-
if ( isset( $options['templates'] ) && '01' == $options['templates'] ) {
|
246 |
-
$options['templates'] = 'default';
|
247 |
-
$options['columns'] = 2;
|
248 |
-
update_option( $this->key_name, $options );
|
249 |
-
}
|
250 |
-
} // End install ()
|
251 |
-
|
252 |
-
/**
|
253 |
-
* Log the plugin version number.
|
254 |
-
*
|
255 |
-
* @access public
|
256 |
-
* @since 1.0.0
|
257 |
-
* @return void
|
258 |
-
*/
|
259 |
-
private function _log_version_number() {
|
260 |
-
update_option( $this->_token . '_version', $this->_version );
|
261 |
-
} // End _log_version_number ()
|
262 |
-
|
263 |
-
|
264 |
-
// Let's hack a little bit
|
265 |
-
public function change_template_if_necessary( $template ) {
|
266 |
-
|
267 |
-
if ( is_customize_preview() && isset( $_REQUEST['colorlib-login-customizer-customization'] ) && is_user_logged_in() ) {
|
268 |
-
$new_template = plugin_dir_path( __FILE__ ) . 'login-template.php';
|
269 |
-
return $new_template;
|
270 |
-
}
|
271 |
-
|
272 |
-
return $template;
|
273 |
-
}
|
274 |
-
}
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
};
|
5 |
+
|
6 |
+
class Colorlib_Login_Customizer {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* The single instance of Colorlib_Login_Customizer.
|
10 |
+
*
|
11 |
+
* @var object
|
12 |
+
* @access private
|
13 |
+
* @since 1.0.0
|
14 |
+
*/
|
15 |
+
private static $_instance = null;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Settings class object
|
19 |
+
*
|
20 |
+
* @var object
|
21 |
+
* @access public
|
22 |
+
* @since 1.0.0
|
23 |
+
*/
|
24 |
+
public $settings = null;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The version number.
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
* @access public
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
public $_version;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The token.
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
* @access public
|
40 |
+
* @since 1.0.0
|
41 |
+
*/
|
42 |
+
public $_token;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The main plugin file.
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
* @access public
|
49 |
+
* @since 1.0.0
|
50 |
+
*/
|
51 |
+
public $file;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* The main plugin directory.
|
55 |
+
*
|
56 |
+
* @var string
|
57 |
+
* @access public
|
58 |
+
* @since 1.0.0
|
59 |
+
*/
|
60 |
+
public $dir;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* The plugin assets directory.
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
* @access public
|
67 |
+
* @since 1.0.0
|
68 |
+
*/
|
69 |
+
public $assets_dir;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* The plugin assets URL.
|
73 |
+
*
|
74 |
+
* @var string
|
75 |
+
* @access public
|
76 |
+
* @since 1.0.0
|
77 |
+
*/
|
78 |
+
public $assets_url;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Suffix for Javascripts.
|
82 |
+
*
|
83 |
+
* @var string
|
84 |
+
* @access public
|
85 |
+
* @since 1.0.0
|
86 |
+
*/
|
87 |
+
public $script_suffix;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Constructor function.
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @since 1.0.0
|
94 |
+
*/
|
95 |
+
public function __construct( $file = '', $version = '1.0.0' ) {
|
96 |
+
$this->_version = $version;
|
97 |
+
$this->_token = 'colorlib-login-customizer';
|
98 |
+
$this->base = 'clc_';
|
99 |
+
$this->key_name = 'clc-options';
|
100 |
+
|
101 |
+
// Load plugin environment variables
|
102 |
+
$this->file = $file;
|
103 |
+
$this->dir = dirname( $this->file );
|
104 |
+
$this->assets_dir = trailingslashit( $this->dir ) . 'assets';
|
105 |
+
$this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $this->file ) ) );
|
106 |
+
|
107 |
+
$this->script_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
108 |
+
// Remove this after Grunt
|
109 |
+
$this->script_suffix = '';
|
110 |
+
|
111 |
+
if ( is_admin() ) {
|
112 |
+
// Plugin Deactivate Feedback
|
113 |
+
new Colorlib_Login_Customizer_Feedback( $file );
|
114 |
+
}
|
115 |
+
|
116 |
+
register_activation_hook( $this->file, array( $this, 'install' ) );
|
117 |
+
|
118 |
+
add_action( 'admin_init', array( $this, 'redirect_customizer' ) );
|
119 |
+
|
120 |
+
// Load customizer settings
|
121 |
+
add_action( 'customize_register', array( $this, 'load_customizer' ), 10, 1 );
|
122 |
+
|
123 |
+
add_filter( 'template_include', array( $this, 'change_template_if_necessary' ), 99 );
|
124 |
+
|
125 |
+
// Handle localisation
|
126 |
+
$this->load_plugin_textdomain();
|
127 |
+
add_action( 'init', array( $this, 'load_localisation' ), 0 );
|
128 |
+
|
129 |
+
// Generate plugins css
|
130 |
+
add_action( 'init', array( $this, 'load_customizer_css' ) );
|
131 |
+
|
132 |
+
} // End __construct ()
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Load the customizer controls
|
136 |
+
*
|
137 |
+
* @param $manager
|
138 |
+
*/
|
139 |
+
public function load_customizer( $manager ) {
|
140 |
+
new Colorlib_Login_Customizer_Customizer( $this, $manager );
|
141 |
+
}
|
142 |
+
|
143 |
+
public function load_customizer_css() {
|
144 |
+
new Colorlib_Login_Customizer_CSS_Customization();
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Hook to redirect the page for the Customizer.
|
149 |
+
*
|
150 |
+
* @access public
|
151 |
+
* @return void
|
152 |
+
*/
|
153 |
+
public function redirect_customizer() {
|
154 |
+
if ( ! empty( $_GET['page'] ) ) { // Input var okay.
|
155 |
+
if ( 'colorlib-login-customizer_settings' === $_GET['page'] ) { // Input var okay.
|
156 |
+
|
157 |
+
// Generate the redirect url.
|
158 |
+
$url = add_query_arg(
|
159 |
+
array(
|
160 |
+
'autofocus[panel]' => 'clc_main_panel',
|
161 |
+
),
|
162 |
+
admin_url( 'customize.php' )
|
163 |
+
);
|
164 |
+
|
165 |
+
wp_safe_redirect( $url );
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Load plugin localisation
|
172 |
+
*
|
173 |
+
* @access public
|
174 |
+
* @since 1.0.0
|
175 |
+
* @return void
|
176 |
+
*/
|
177 |
+
public function load_localisation() {
|
178 |
+
load_plugin_textdomain( 'colorlib-login-customizer', false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
|
179 |
+
} // End load_localisation ()
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Load plugin textdomain
|
183 |
+
*
|
184 |
+
* @access public
|
185 |
+
* @since 1.0.0
|
186 |
+
* @return void
|
187 |
+
*/
|
188 |
+
public function load_plugin_textdomain() {
|
189 |
+
$domain = 'colorlib-login-customizer';
|
190 |
+
|
191 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
192 |
+
|
193 |
+
load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
|
194 |
+
load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
|
195 |
+
} // End load_plugin_textdomain ()
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Main Colorlib_Login_Customizer Instance
|
199 |
+
*
|
200 |
+
* Ensures only one instance of Colorlib_Login_Customizer is loaded or can be loaded.
|
201 |
+
*
|
202 |
+
* @since 1.0.0
|
203 |
+
* @static
|
204 |
+
* @see Colorlib_Login_Customizer()
|
205 |
+
* @return Main Colorlib_Login_Customizer instance
|
206 |
+
*/
|
207 |
+
public static function instance( $file = '', $version = '1.0.0' ) {
|
208 |
+
if ( is_null( self::$_instance ) ) {
|
209 |
+
self::$_instance = new self( $file, $version );
|
210 |
+
}
|
211 |
+
|
212 |
+
return self::$_instance;
|
213 |
+
} // End instance ()
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Cloning is forbidden.
|
217 |
+
*
|
218 |
+
* @since 1.0.0
|
219 |
+
*/
|
220 |
+
public function __clone() {
|
221 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->_version );
|
222 |
+
} // End __clone ()
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Unserializing instances of this class is forbidden.
|
226 |
+
*
|
227 |
+
* @since 1.0.0
|
228 |
+
*/
|
229 |
+
public function __wakeup() {
|
230 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->_version );
|
231 |
+
} // End __wakeup ()
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Installation. Runs on activation.
|
235 |
+
*
|
236 |
+
* @access public
|
237 |
+
* @since 1.0.0
|
238 |
+
* @return void
|
239 |
+
*/
|
240 |
+
public function install() {
|
241 |
+
$this->_log_version_number();
|
242 |
+
|
243 |
+
// Backward compatibility
|
244 |
+
$options = get_option( $this->key_name, array() );
|
245 |
+
if ( isset( $options['templates'] ) && '01' == $options['templates'] ) {
|
246 |
+
$options['templates'] = 'default';
|
247 |
+
$options['columns'] = 2;
|
248 |
+
update_option( $this->key_name, $options );
|
249 |
+
}
|
250 |
+
} // End install ()
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Log the plugin version number.
|
254 |
+
*
|
255 |
+
* @access public
|
256 |
+
* @since 1.0.0
|
257 |
+
* @return void
|
258 |
+
*/
|
259 |
+
private function _log_version_number() {
|
260 |
+
update_option( $this->_token . '_version', $this->_version );
|
261 |
+
} // End _log_version_number ()
|
262 |
+
|
263 |
+
|
264 |
+
// Let's hack a little bit
|
265 |
+
public function change_template_if_necessary( $template ) {
|
266 |
+
|
267 |
+
if ( is_customize_preview() && isset( $_REQUEST['colorlib-login-customizer-customization'] ) && is_user_logged_in() ) {
|
268 |
+
$new_template = plugin_dir_path( __FILE__ ) . 'login-template.php';
|
269 |
+
return $new_template;
|
270 |
+
}
|
271 |
+
|
272 |
+
return $template;
|
273 |
+
}
|
274 |
+
}
|
includes/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Silence is golden
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Silence is golden
|
includes/lib/class-colorlib-login-customizer-css-customization.php
CHANGED
@@ -1,875 +1,941 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
-
exit;
|
4 |
-
}
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Class Colorlib_Login_Customizer_Customization
|
8 |
-
*/
|
9 |
-
class Colorlib_Login_Customizer_CSS_Customization {
|
10 |
-
/**
|
11 |
-
* @var array
|
12 |
-
*/
|
13 |
-
private $options = array();
|
14 |
-
/**
|
15 |
-
* @var array
|
16 |
-
*/
|
17 |
-
private $selectors = array();
|
18 |
-
/**
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
private $base = '';
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Colorlib_Login_Customizer_CSS_Customization constructor.
|
25 |
-
*/
|
26 |
-
public function __construct() {
|
27 |
-
$plugin = Colorlib_Login_Customizer::instance();
|
28 |
-
$this->key_name = $plugin->key_name;
|
29 |
-
$this->set_options();
|
30 |
-
|
31 |
-
add_action( 'login_head', array( $this, 'check_labels' ) );
|
32 |
-
add_action( '
|
33 |
-
add_action( '
|
34 |
-
add_action( '
|
35 |
-
|
36 |
-
|
37 |
-
add_filter( '
|
38 |
-
add_filter( '
|
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 |
-
'columns
|
87 |
-
|
88 |
-
'
|
89 |
-
|
90 |
-
|
91 |
-
'form-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
'
|
97 |
-
'
|
98 |
-
'
|
99 |
-
'logo
|
100 |
-
'logo-text-
|
101 |
-
'logo-text-
|
102 |
-
'logo-
|
103 |
-
'logo-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
'custom-background
|
109 |
-
'custom-background-
|
110 |
-
'custom-background-color
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
'form-
|
116 |
-
'form-
|
117 |
-
'form-background-
|
118 |
-
'form-
|
119 |
-
'form-
|
120 |
-
'form-border
|
121 |
-
'form-
|
122 |
-
'form-
|
123 |
-
'form-field-
|
124 |
-
'form-field-
|
125 |
-
'form-field-border'
|
126 |
-
'form-field-
|
127 |
-
'form-field-
|
128 |
-
'
|
129 |
-
'
|
130 |
-
'
|
131 |
-
'
|
132 |
-
'
|
133 |
-
'
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
'button-
|
141 |
-
'button-
|
142 |
-
'button-
|
143 |
-
'button-color'
|
144 |
-
'
|
145 |
-
'
|
146 |
-
'
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
'
|
170 |
-
'
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
'
|
175 |
-
'
|
176 |
-
'
|
177 |
-
'
|
178 |
-
'
|
179 |
-
'
|
180 |
-
),
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
'
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
'
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
'
|
218 |
-
'
|
219 |
-
'
|
220 |
-
'
|
221 |
-
'
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
'
|
229 |
-
'
|
230 |
-
'
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
'
|
237 |
-
'
|
238 |
-
'
|
239 |
-
'
|
240 |
-
'
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
'
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
'background
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
'
|
276 |
-
'
|
277 |
-
)
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
'
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
'
|
286 |
-
'
|
287 |
-
'
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
/**
|
350 |
-
*
|
351 |
-
*/
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
$string
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
'
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
array(
|
388 |
-
'
|
389 |
-
'
|
390 |
-
'
|
391 |
-
'
|
392 |
-
'
|
393 |
-
)
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
'color',
|
400 |
-
)
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
array(
|
409 |
-
'color',
|
410 |
-
)
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
array(
|
419 |
-
'
|
420 |
-
)
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
$string
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
'
|
461 |
-
'
|
462 |
-
'
|
463 |
-
'
|
464 |
-
'
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
'
|
485 |
-
'
|
486 |
-
'
|
487 |
-
'
|
488 |
-
'
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
array(
|
509 |
-
'
|
510 |
-
)
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
$string
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
'background-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
'
|
574 |
-
'
|
575 |
-
'
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
'
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
'
|
595 |
-
)
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
array(
|
604 |
-
'
|
605 |
-
)
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
case 'background-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
case '
|
667 |
-
|
668 |
-
|
669 |
-
case '
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
if (
|
692 |
-
$classes[] = 'ml-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
$
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
$
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
echo '<
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
$
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
$
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
$
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Colorlib_Login_Customizer_Customization
|
8 |
+
*/
|
9 |
+
class Colorlib_Login_Customizer_CSS_Customization {
|
10 |
+
/**
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
private $options = array();
|
14 |
+
/**
|
15 |
+
* @var array
|
16 |
+
*/
|
17 |
+
private $selectors = array();
|
18 |
+
/**
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
private $base = '';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Colorlib_Login_Customizer_CSS_Customization constructor.
|
25 |
+
*/
|
26 |
+
public function __construct() {
|
27 |
+
$plugin = Colorlib_Login_Customizer::instance();
|
28 |
+
$this->key_name = $plugin->key_name;
|
29 |
+
$this->set_options();
|
30 |
+
|
31 |
+
add_action( 'login_head', array( $this, 'check_labels' ) );
|
32 |
+
add_action( 'login_head', array( $this, 'check_texts' ) );
|
33 |
+
add_action( 'login_header', array( $this, 'add_extra_div' ) );
|
34 |
+
add_action( 'login_head', array( $this, 'generate_css' ), 15 );
|
35 |
+
add_action( 'login_footer', array( $this, 'close_extra_div' ) );
|
36 |
+
|
37 |
+
add_filter( 'login_body_class', array( $this, 'body_class' ) );
|
38 |
+
add_filter( 'login_headerurl', array( $this, 'logo_url' ), 99 );
|
39 |
+
add_filter( 'login_headertitle', array( $this, 'logo_title' ), 99 );
|
40 |
+
|
41 |
+
//
|
42 |
+
add_action( 'customize_preview_init', array( $this, 'output_css_object' ), 26 );
|
43 |
+
}
|
44 |
+
|
45 |
+
private function generate_name( $id ) {
|
46 |
+
return $this->key_name . '[' . $id . ']';
|
47 |
+
}
|
48 |
+
|
49 |
+
public function output_css_object() {
|
50 |
+
|
51 |
+
$css_object = array(
|
52 |
+
'selectors' => array(),
|
53 |
+
'settings' => array(),
|
54 |
+
);
|
55 |
+
|
56 |
+
foreach ( $this->selectors as $selector => $settings ) {
|
57 |
+
$css_object['selectors'][ $selector ] = $settings['options'];
|
58 |
+
foreach ( $settings['options'] as $index => $setting ) {
|
59 |
+
$css_object['settings'][ $setting ] = array(
|
60 |
+
'name' => $this->generate_name( $setting ),
|
61 |
+
'value' => $this->options[ $setting ],
|
62 |
+
'attribute' => $settings['attributes'][ $index ],
|
63 |
+
);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
wp_localize_script( 'colorlib-login-customizer-preview', 'CLC', $css_object );
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Set the options array, it returns nothing
|
73 |
+
*/
|
74 |
+
public function set_options() {
|
75 |
+
|
76 |
+
$options = get_option( $this->key_name, array() );
|
77 |
+
|
78 |
+
$defaults = array(
|
79 |
+
/**
|
80 |
+
* Templates
|
81 |
+
*/
|
82 |
+
'templates' => 'default',
|
83 |
+
/**
|
84 |
+
* Layout
|
85 |
+
*/
|
86 |
+
'columns' => '1',
|
87 |
+
'columns-width' => array(
|
88 |
+
'left' => 6,
|
89 |
+
'right' => 6,
|
90 |
+
),
|
91 |
+
'form-column-align' => '3',
|
92 |
+
'form-vertical-align' => '2',
|
93 |
+
/**
|
94 |
+
* Logo section
|
95 |
+
*/
|
96 |
+
'hide-logo' => 0,
|
97 |
+
'use-text-logo' => 0,
|
98 |
+
'logo-url' => site_url(),
|
99 |
+
'custom-logo' => '',
|
100 |
+
'logo-text-color' => '#444',
|
101 |
+
'logo-text-size' => '20',
|
102 |
+
'logo-text-color-hover' => '#00a0d2',
|
103 |
+
'logo-width' => '',
|
104 |
+
'logo-height' => '',
|
105 |
+
/**
|
106 |
+
* Background section
|
107 |
+
*/
|
108 |
+
'custom-background' => '',
|
109 |
+
'custom-background-form' => '',
|
110 |
+
'custom-background-color' => '',
|
111 |
+
'custom-background-color-form' => '',
|
112 |
+
/**
|
113 |
+
* Form section
|
114 |
+
*/
|
115 |
+
'form-width' => '',
|
116 |
+
'form-height' => '',
|
117 |
+
'form-background-image' => '',
|
118 |
+
'form-background-color' => '#fff',
|
119 |
+
'form-padding' => '',
|
120 |
+
'form-border' => '',
|
121 |
+
'form-border-radius' => '',
|
122 |
+
'form-shadow' => '',
|
123 |
+
'form-field-width' => '',
|
124 |
+
'form-field-margin' => '',
|
125 |
+
'form-field-border-radius' => 'unset',
|
126 |
+
'form-field-border' => '1px solid #ddd',
|
127 |
+
'form-field-background' => '',
|
128 |
+
'form-field-color' => '',
|
129 |
+
'username-label' => 'Username or Email Address',
|
130 |
+
'password-label' => 'Password',
|
131 |
+
'rememberme-label' => 'Remember Me',
|
132 |
+
'lost-password-text' => 'Lost your password?',
|
133 |
+
'back-to-text' => '← Back to %s',
|
134 |
+
'login-label' => 'Log In',
|
135 |
+
'form-label-color' => '',
|
136 |
+
'hide-extra-links' => false,
|
137 |
+
/**
|
138 |
+
* Others section ( misc )
|
139 |
+
*/
|
140 |
+
'button-background' => '',
|
141 |
+
'button-background-hover' => '',
|
142 |
+
'button-border-color' => '',
|
143 |
+
'button-border-color-hover' => '',
|
144 |
+
'button-shadow' => '',
|
145 |
+
'button-text-shadow' => '',
|
146 |
+
'button-color' => '',
|
147 |
+
'link-color' => '',
|
148 |
+
'link-color-hover' => '',
|
149 |
+
'hide-rememberme' => false,
|
150 |
+
/**
|
151 |
+
* Custom CSS
|
152 |
+
*/
|
153 |
+
'custom-css' => '',
|
154 |
+
/**
|
155 |
+
* Reset value is not dynamic
|
156 |
+
*/
|
157 |
+
'initial' => 'initial',
|
158 |
+
);
|
159 |
+
|
160 |
+
$this->options = wp_parse_args( $options, $defaults );
|
161 |
+
|
162 |
+
$this->selectors = array(
|
163 |
+
'.wp-core-ui .button-primary.focus, .wp-core-ui .button-primary.hover, .wp-core-ui .button-primary:focus, .wp-core-ui .button-primary:hover' => array(
|
164 |
+
'attributes' => array(
|
165 |
+
'background',
|
166 |
+
'border-color',
|
167 |
+
),
|
168 |
+
'options' => array(
|
169 |
+
'button-background-hover',
|
170 |
+
'button-border-color-hover',
|
171 |
+
),
|
172 |
+
),
|
173 |
+
'.wp-core-ui .button-primary' => array(
|
174 |
+
'attributes' => array(
|
175 |
+
'background',
|
176 |
+
'border-color',
|
177 |
+
'box-shadow',
|
178 |
+
'text-shadow',
|
179 |
+
'color',
|
180 |
+
),
|
181 |
+
'options' => array(
|
182 |
+
'button-background',
|
183 |
+
'button-border-color',
|
184 |
+
'button-shadow',
|
185 |
+
'button-text-shadow',
|
186 |
+
'button-color',
|
187 |
+
),
|
188 |
+
),
|
189 |
+
'.login #backtoblog a, .login #nav a' => array(
|
190 |
+
'attributes' => array(
|
191 |
+
'color',
|
192 |
+
),
|
193 |
+
'options' => array(
|
194 |
+
'link-color',
|
195 |
+
),
|
196 |
+
),
|
197 |
+
'.login #backtoblog a:hover, .login #nav a:hover, .login h1 a:hover' => array(
|
198 |
+
'attributes' => array(
|
199 |
+
'color',
|
200 |
+
),
|
201 |
+
'options' => array(
|
202 |
+
'link-color-hover',
|
203 |
+
),
|
204 |
+
),
|
205 |
+
'.ml-container #login' => array(
|
206 |
+
'attributes' => array(
|
207 |
+
'max-width',
|
208 |
+
),
|
209 |
+
'options' => array(
|
210 |
+
'form-width',
|
211 |
+
),
|
212 |
+
),
|
213 |
+
'#loginform' => array(
|
214 |
+
'attributes' => array(
|
215 |
+
'height',
|
216 |
+
'background-image',
|
217 |
+
'background-color',
|
218 |
+
'padding',
|
219 |
+
'border',
|
220 |
+
'border-radius',
|
221 |
+
'box-shadow',
|
222 |
+
),
|
223 |
+
'options' => array(
|
224 |
+
'form-height',
|
225 |
+
'form-background-image',
|
226 |
+
'form-background-color',
|
227 |
+
'form-padding',
|
228 |
+
'form-border',
|
229 |
+
'form-border-radius',
|
230 |
+
'form-shadow',
|
231 |
+
),
|
232 |
+
),
|
233 |
+
'.login form .input, .login input[type="text"]' => array(
|
234 |
+
'attributes' => array(
|
235 |
+
'max-width',
|
236 |
+
'margin',
|
237 |
+
'border-radius',
|
238 |
+
'border',
|
239 |
+
'background',
|
240 |
+
'color',
|
241 |
+
),
|
242 |
+
'options' => array(
|
243 |
+
'form-field-width',
|
244 |
+
'form-field-margin',
|
245 |
+
'form-field-border-radius',
|
246 |
+
'form-field-border',
|
247 |
+
'form-field-background',
|
248 |
+
'form-field-color',
|
249 |
+
),
|
250 |
+
),
|
251 |
+
'.login label' => array(
|
252 |
+
'attributes' => array(
|
253 |
+
'color',
|
254 |
+
),
|
255 |
+
'options' => array(
|
256 |
+
'form-label-color',
|
257 |
+
),
|
258 |
+
),
|
259 |
+
'.ml-container .ml-extra-div' => array(
|
260 |
+
'attributes' => array(
|
261 |
+
'background-image',
|
262 |
+
'background-color',
|
263 |
+
),
|
264 |
+
'options' => array(
|
265 |
+
'custom-background',
|
266 |
+
'custom-background-color',
|
267 |
+
),
|
268 |
+
),
|
269 |
+
'.ml-container .ml-form-container' => array(
|
270 |
+
'attributes' => array(
|
271 |
+
'background-image',
|
272 |
+
'background-color',
|
273 |
+
),
|
274 |
+
'options' => array(
|
275 |
+
'custom-background-form',
|
276 |
+
'custom-background-color-form',
|
277 |
+
)
|
278 |
+
),
|
279 |
+
'.login h1 a' => array(
|
280 |
+
'attributes' => array(
|
281 |
+
'background-image',
|
282 |
+
'width',
|
283 |
+
'height',
|
284 |
+
),
|
285 |
+
'options' => array(
|
286 |
+
'custom-logo',
|
287 |
+
'logo-width',
|
288 |
+
'logo-height',
|
289 |
+
),
|
290 |
+
),
|
291 |
+
'.login.clc-text-logo h1 a' => array(
|
292 |
+
'attributes' => array(
|
293 |
+
'color',
|
294 |
+
'font-size',
|
295 |
+
),
|
296 |
+
'options' => array(
|
297 |
+
'logo-text-color',
|
298 |
+
'logo-text-size',
|
299 |
+
),
|
300 |
+
),
|
301 |
+
'.login.clc-text-logo h1 a:hover' => array(
|
302 |
+
'attributes' => array(
|
303 |
+
'color',
|
304 |
+
),
|
305 |
+
'options' => array(
|
306 |
+
'logo-text-color-hover',
|
307 |
+
),
|
308 |
+
),
|
309 |
+
'#login > h1' => array(
|
310 |
+
'attributes' => array(
|
311 |
+
'display',
|
312 |
+
),
|
313 |
+
'options' => array(
|
314 |
+
'hide-logo',
|
315 |
+
),
|
316 |
+
),
|
317 |
+
'#login > #nav,#login > #backtoblog' => array(
|
318 |
+
'attributes' => array(
|
319 |
+
'display',
|
320 |
+
),
|
321 |
+
'options' => array(
|
322 |
+
'hide-extra-links',
|
323 |
+
),
|
324 |
+
),
|
325 |
+
'#login form .forgetmenot' => array(
|
326 |
+
'attributes' => array(
|
327 |
+
'display',
|
328 |
+
),
|
329 |
+
'options' => array(
|
330 |
+
'hide-rememberme',
|
331 |
+
),
|
332 |
+
),
|
333 |
+
);
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Create the CSS string for output
|
339 |
+
*
|
340 |
+
* @return mixed|string
|
341 |
+
*/
|
342 |
+
public function create_css() {
|
343 |
+
/**
|
344 |
+
* Get an instance of the plugin so we can get the token
|
345 |
+
*/
|
346 |
+
//$instance = Colorlib_Login_Customizer::instance();
|
347 |
+
|
348 |
+
$string = '';
|
349 |
+
/**
|
350 |
+
* In case the array is empty, we return an empty string
|
351 |
+
*/
|
352 |
+
if ( empty( $this->options ) ) {
|
353 |
+
return $string;
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Start building the CSS file
|
358 |
+
*/
|
359 |
+
$string .= $this->_set_background_options();
|
360 |
+
$string .= $this->_set_logo_options();
|
361 |
+
$string .= $this->_set_form_options();
|
362 |
+
$string .= $this->_set_miscellaneous_options();
|
363 |
+
|
364 |
+
return $string;
|
365 |
+
}
|
366 |
+
|
367 |
+
/**
|
368 |
+
* @return string
|
369 |
+
*/
|
370 |
+
public function _set_miscellaneous_options() {
|
371 |
+
$string = '';
|
372 |
+
|
373 |
+
$string .= $this->create_css_lines(
|
374 |
+
'.wp-core-ui .button-primary.focus, .wp-core-ui .button-primary.hover, .wp-core-ui .button-primary:focus, .wp-core-ui .button-primary:hover',
|
375 |
+
array(
|
376 |
+
'background',
|
377 |
+
'border-color',
|
378 |
+
),
|
379 |
+
array(
|
380 |
+
'button-background-hover',
|
381 |
+
'button-border-color-hover',
|
382 |
+
)
|
383 |
+
);
|
384 |
+
|
385 |
+
$string .= $this->create_css_lines(
|
386 |
+
'.wp-core-ui .button-primary',
|
387 |
+
array(
|
388 |
+
'background',
|
389 |
+
'border-color',
|
390 |
+
'box-shadow',
|
391 |
+
'text-shadow',
|
392 |
+
'color',
|
393 |
+
),
|
394 |
+
array(
|
395 |
+
'button-background',
|
396 |
+
'button-border-color',
|
397 |
+
'button-shadow',
|
398 |
+
'button-text-shadow',
|
399 |
+
'button-color',
|
400 |
+
)
|
401 |
+
);
|
402 |
+
|
403 |
+
$string .= $this->create_css_lines(
|
404 |
+
'.login #backtoblog a, .login #nav a',
|
405 |
+
array(
|
406 |
+
'color',
|
407 |
+
),
|
408 |
+
array(
|
409 |
+
'link-color',
|
410 |
+
)
|
411 |
+
);
|
412 |
+
|
413 |
+
$string .= $this->create_css_lines(
|
414 |
+
'.login #backtoblog a:hover, .login #nav a:hover, .login h1 a:hover',
|
415 |
+
array(
|
416 |
+
'color',
|
417 |
+
),
|
418 |
+
array(
|
419 |
+
'link-color-hover',
|
420 |
+
)
|
421 |
+
);
|
422 |
+
|
423 |
+
$string .= $this->create_css_lines(
|
424 |
+
'#login form .forgetmenot',
|
425 |
+
array(
|
426 |
+
'display',
|
427 |
+
),
|
428 |
+
array(
|
429 |
+
'hide-rememberme',
|
430 |
+
)
|
431 |
+
);
|
432 |
+
|
433 |
+
return $string;
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* @return string
|
438 |
+
*/
|
439 |
+
public function _set_form_options() {
|
440 |
+
$string = '';
|
441 |
+
|
442 |
+
$string .= $this->create_css_lines(
|
443 |
+
'.ml-container #login',
|
444 |
+
array(
|
445 |
+
'max-width',
|
446 |
+
),
|
447 |
+
array(
|
448 |
+
'form-width',
|
449 |
+
)
|
450 |
+
);
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Set form variables
|
454 |
+
*/
|
455 |
+
$string .= $this->create_css_lines(
|
456 |
+
'#loginform',
|
457 |
+
array(
|
458 |
+
'height',
|
459 |
+
'background-image',
|
460 |
+
'background-color',
|
461 |
+
'padding',
|
462 |
+
'border',
|
463 |
+
'border-radius',
|
464 |
+
'box-shadow',
|
465 |
+
),
|
466 |
+
array(
|
467 |
+
'form-height',
|
468 |
+
'form-background-image',
|
469 |
+
'form-background-color',
|
470 |
+
'form-padding',
|
471 |
+
'form-border',
|
472 |
+
'form-border-radius',
|
473 |
+
'form-shadow',
|
474 |
+
)
|
475 |
+
);
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Set form field variables
|
479 |
+
*/
|
480 |
+
$string .= $this->create_css_lines(
|
481 |
+
'.login form .input, .login input[type="text"]',
|
482 |
+
array(
|
483 |
+
'max-width',
|
484 |
+
'margin',
|
485 |
+
'border-radius',
|
486 |
+
'border',
|
487 |
+
'background',
|
488 |
+
'color',
|
489 |
+
),
|
490 |
+
array(
|
491 |
+
'form-field-width',
|
492 |
+
'form-field-margin',
|
493 |
+
'form-field-border-radius',
|
494 |
+
'form-field-border',
|
495 |
+
'form-field-background',
|
496 |
+
'form-field-color',
|
497 |
+
)
|
498 |
+
);
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Set form field labels
|
502 |
+
*/
|
503 |
+
$string .= $this->create_css_lines(
|
504 |
+
'.login label',
|
505 |
+
array(
|
506 |
+
'color',
|
507 |
+
),
|
508 |
+
array(
|
509 |
+
'form-label-color',
|
510 |
+
)
|
511 |
+
);
|
512 |
+
|
513 |
+
$string .= $this->create_css_lines(
|
514 |
+
'#login > #nav,#login > #backtoblog',
|
515 |
+
array(
|
516 |
+
'display',
|
517 |
+
),
|
518 |
+
array(
|
519 |
+
'hide-extra-links',
|
520 |
+
)
|
521 |
+
);
|
522 |
+
|
523 |
+
return $string;
|
524 |
+
}
|
525 |
+
|
526 |
+
/**
|
527 |
+
* @return string
|
528 |
+
*/
|
529 |
+
public function _set_background_options() {
|
530 |
+
$string = '';
|
531 |
+
/**
|
532 |
+
* Set background-image
|
533 |
+
*/
|
534 |
+
$string .= $this->create_css_lines(
|
535 |
+
'.ml-container .ml-extra-div',
|
536 |
+
array(
|
537 |
+
'background-image',
|
538 |
+
'background-color',
|
539 |
+
),
|
540 |
+
array(
|
541 |
+
'custom-background',
|
542 |
+
'custom-background-color',
|
543 |
+
)
|
544 |
+
);
|
545 |
+
|
546 |
+
$string .= $this->create_css_lines(
|
547 |
+
'.ml-container .ml-form-container',
|
548 |
+
array(
|
549 |
+
'background-image',
|
550 |
+
'background-color',
|
551 |
+
),
|
552 |
+
array(
|
553 |
+
'custom-background-form',
|
554 |
+
'custom-background-color-form',
|
555 |
+
)
|
556 |
+
);
|
557 |
+
|
558 |
+
return $string;
|
559 |
+
|
560 |
+
}
|
561 |
+
|
562 |
+
/**
|
563 |
+
* @return string
|
564 |
+
*/
|
565 |
+
public function _set_logo_options() {
|
566 |
+
$string = '';
|
567 |
+
/**
|
568 |
+
* Set logo dimensions
|
569 |
+
*/
|
570 |
+
$string .= $this->create_css_lines(
|
571 |
+
'.login h1 a',
|
572 |
+
array(
|
573 |
+
'background-image',
|
574 |
+
'background-size',
|
575 |
+
'width',
|
576 |
+
'height',
|
577 |
+
),
|
578 |
+
array(
|
579 |
+
'custom-logo',
|
580 |
+
'logo-width',
|
581 |
+
'logo-width',
|
582 |
+
'logo-height',
|
583 |
+
)
|
584 |
+
);
|
585 |
+
|
586 |
+
$string .= $this->create_css_lines(
|
587 |
+
'.login.clc-text-logo h1 a',
|
588 |
+
array(
|
589 |
+
'color',
|
590 |
+
'font-size',
|
591 |
+
),
|
592 |
+
array(
|
593 |
+
'logo-text-color',
|
594 |
+
'logo-text-size',
|
595 |
+
)
|
596 |
+
);
|
597 |
+
|
598 |
+
$string .= $this->create_css_lines(
|
599 |
+
'.login.clc-text-logo h1 a:hover',
|
600 |
+
array(
|
601 |
+
'color',
|
602 |
+
),
|
603 |
+
array(
|
604 |
+
'logo-text-color-hover',
|
605 |
+
)
|
606 |
+
);
|
607 |
+
|
608 |
+
$string .= $this->create_css_lines(
|
609 |
+
'#login > h1',
|
610 |
+
array(
|
611 |
+
'display',
|
612 |
+
),
|
613 |
+
array(
|
614 |
+
'hide-logo',
|
615 |
+
)
|
616 |
+
);
|
617 |
+
|
618 |
+
return $string;
|
619 |
+
}
|
620 |
+
|
621 |
+
/**
|
622 |
+
* @param $selector
|
623 |
+
* @param $properties
|
624 |
+
* @param $options
|
625 |
+
*
|
626 |
+
* @return string
|
627 |
+
*/
|
628 |
+
private function create_css_lines( $selector, $properties, $options ) {
|
629 |
+
$string = '';
|
630 |
+
$valued = array();
|
631 |
+
|
632 |
+
$i = 0;
|
633 |
+
foreach ( $options as $option ) {
|
634 |
+
if ( ! empty( $this->options[ $option ] ) ) {
|
635 |
+
$valued[ $properties[ $i ] ] = $this->options[ $option ];
|
636 |
+
}
|
637 |
+
$i ++;
|
638 |
+
}
|
639 |
+
|
640 |
+
if ( ! empty( $valued ) ) {
|
641 |
+
$string .= $selector . '{' . "\n";
|
642 |
+
|
643 |
+
foreach ( $valued as $index => $value ) {
|
644 |
+
$string .= $index . ':' . esc_attr( $this->add_artifacts( $index, $value ) ) . ';' . "\n";
|
645 |
+
}
|
646 |
+
$string .= '}' . "\n";
|
647 |
+
}
|
648 |
+
|
649 |
+
return $string;
|
650 |
+
}
|
651 |
+
|
652 |
+
/**
|
653 |
+
*
|
654 |
+
*
|
655 |
+
* @param $property
|
656 |
+
* @param $value
|
657 |
+
*
|
658 |
+
* @return string
|
659 |
+
*/
|
660 |
+
private function add_artifacts( $property, $value ) {
|
661 |
+
switch ( $property ) {
|
662 |
+
case 'background-image':
|
663 |
+
$value = 'url(' . $value . ')';
|
664 |
+
break;
|
665 |
+
|
666 |
+
case 'width':
|
667 |
+
case 'min-width':
|
668 |
+
case 'max-width':
|
669 |
+
case 'background-size':
|
670 |
+
case 'height':
|
671 |
+
case 'min-height':
|
672 |
+
case 'max-height':
|
673 |
+
case 'font-size':
|
674 |
+
$value = $value . 'px';
|
675 |
+
break;
|
676 |
+
case 'display':
|
677 |
+
if ( ! $value ) {
|
678 |
+
$value = 'block';
|
679 |
+
}else{
|
680 |
+
$value = 'none';
|
681 |
+
}
|
682 |
+
default:
|
683 |
+
break;
|
684 |
+
}
|
685 |
+
|
686 |
+
return $value;
|
687 |
+
}
|
688 |
+
|
689 |
+
public function body_class( $classes ) {
|
690 |
+
|
691 |
+
if ( '2' == $this->options['columns'] ) {
|
692 |
+
$classes[] = 'ml-half-screen';
|
693 |
+
if ( isset( $this->options['form-column-align'] ) ) {
|
694 |
+
$classes[] = 'ml-login-align-' . esc_attr( $this->options['form-column-align'] );
|
695 |
+
}
|
696 |
+
}
|
697 |
+
|
698 |
+
if ( isset( $this->options['form-vertical-align'] ) ) {
|
699 |
+
$classes[] = 'ml-login-vertical-align-' . esc_attr( $this->options['form-vertical-align'] );
|
700 |
+
}
|
701 |
+
|
702 |
+
if ( isset( $this->options['form-horizontal-align'] ) ) {
|
703 |
+
$classes[] = 'ml-login-horizontal-align-' . esc_attr( $this->options['form-horizontal-align'] );
|
704 |
+
}
|
705 |
+
|
706 |
+
if ( isset( $this->options['use-text-logo'] ) && $this->options['use-text-logo'] ) {
|
707 |
+
$classes[] = 'clc-text-logo';
|
708 |
+
}
|
709 |
+
|
710 |
+
return $classes;
|
711 |
+
}
|
712 |
+
|
713 |
+
public function logo_url( $url ) {
|
714 |
+
if ( '' != $this->options['logo-url'] ) {
|
715 |
+
return esc_url( $this->options['logo-url'] );
|
716 |
+
}
|
717 |
+
|
718 |
+
return $url;
|
719 |
+
}
|
720 |
+
|
721 |
+
public function logo_title( $title ) {
|
722 |
+
if ( isset( $this->options['logo-title'] ) ) {
|
723 |
+
return wp_kses_post( $this->options['logo-title'] );
|
724 |
+
}
|
725 |
+
|
726 |
+
return $title;
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* Output the inline CSS
|
731 |
+
*/
|
732 |
+
public function generate_css() {
|
733 |
+
$instance = Colorlib_Login_Customizer::instance();
|
734 |
+
$css = $this->create_css();
|
735 |
+
$custom_css = $this->options['custom-css'];
|
736 |
+
$columns_css = '';
|
737 |
+
|
738 |
+
if ( 2 == $this->options['columns'] ) {
|
739 |
+
$widths = $this->options['columns-width'];
|
740 |
+
|
741 |
+
$left_width = ( 100 / 12 )*absint( $widths['left'] );
|
742 |
+
$right_width = ( 100 / 12 )*absint( $widths['right'] );
|
743 |
+
|
744 |
+
$columns_css .= '.ml-half-screen.ml-login-align-3 .ml-container .ml-extra-div,.ml-half-screen.ml-login-align-1 .ml-container .ml-form-container{ width:' . $left_width . '%; }';
|
745 |
+
$columns_css .= '.ml-half-screen.ml-login-align-4 .ml-container .ml-extra-div,.ml-half-screen.ml-login-align-2 .ml-container .ml-form-container{ flex-basis:' . $left_width . '%; }';
|
746 |
+
|
747 |
+
$columns_css .= '.ml-half-screen.ml-login-align-3 .ml-container .ml-form-container,.ml-half-screen.ml-login-align-1 .ml-container .ml-extra-div{ width:' . $right_width . '%; }';
|
748 |
+
$columns_css .= '.ml-half-screen.ml-login-align-4 .ml-container .ml-form-container,.ml-half-screen.ml-login-align-2 .ml-container .ml-extra-div{ flex-basis:' . $right_width . '%; }';
|
749 |
+
|
750 |
+
}
|
751 |
+
|
752 |
+
echo '<style type="text/css">.login.clc-text-logo h1 a{ background-image: none !important;text-indent: unset; }#login form p label br{display:none}body:not( .ml-half-screen ) .ml-form-container{background:transparent !important;}.login h1 a{background-position: center;background-size:contain !important;}.ml-container #login{ position:relative;padding: 0;width:100%;max-width:320px;margin:0;}#loginform{box-sizing: border-box;max-height: 100%;background-position: center;background-repeat: no-repeat;background-size: cover;}.ml-container{position:relative;min-height:100vh;display:flex;height:100%;min-width:100%;}.ml-container .ml-extra-div{background-position:center;background-size:cover;background-repeat:no-repeat}body .ml-form-container{display:flex;align-items:center;justify-content:center}body:not( .ml-half-screen ) .ml-container .ml-extra-div{position:absolute;top:0;left:0;width:100%;height:100%}body:not( .ml-half-screen ) .ml-container .ml-form-container{width:100%;min-height:100vh}body.ml-half-screen .ml-container{flex-wrap:wrap}body.ml-half-screen .ml-container>.ml-extra-div,body.ml-half-screen .ml-container>.ml-form-container{width:50%}body.ml-half-screen.ml-login-align-2 .ml-container>div,body.ml-half-screen.ml-login-align-4 .ml-container>div{width:100%;flex-basis:50%;}body.ml-half-screen.ml-login-align-2 .ml-container{flex-direction:column-reverse}body.ml-half-screen.ml-login-align-4 .ml-container{flex-direction:column}body.ml-half-screen.ml-login-align-1 .ml-container{flex-direction:row-reverse}body.ml-login-vertical-align-1 .ml-form-container{align-items:flex-start}body.ml-login-vertical-align-3 .ml-form-container{align-items:flex-end}body.ml-login-horizontal-align-1 .ml-form-container{justify-content:flex-start}body.ml-login-horizontal-align-3 .ml-form-container{justify-content:flex-end}@media only screen and (max-width: 768px) {body.ml-half-screen .ml-container > .ml-extra-div, body.ml-half-screen .ml-container > .ml-form-container{width:100%;}body .ml-container .ml-extra-div{position:absolute;top:0;left:0;width:100%;height:100%;}}.login input[type=text]:focus, .login input[type=search]:focus, .login input[type=radio]:focus, .login input[type=tel]:focus, .login input[type=time]:focus, .login input[type=url]:focus, .login input[type=week]:focus, .login input[type=password]:focus, .login input[type=checkbox]:focus, .login input[type=color]:focus, .login input[type=date]:focus, .login input[type=datetime]:focus, .login input[type=datetime-local]:focus, .login input[type=email]:focus, .login input[type=month]:focus, .login input[type=number]:focus, .login select:focus, .login textarea:focus{ box-shadow: none; }</style>';
|
753 |
+
echo '<style type="text/css" id="clc-style">' . $css . '</style>';
|
754 |
+
echo '<style type="text/css" id="clc-columns-style">' . $columns_css . '</style>';
|
755 |
+
echo '<style type="text/css" id="clc-custom-css">' . $custom_css . '</style>';
|
756 |
+
}
|
757 |
+
|
758 |
+
public function add_extra_div() {
|
759 |
+
echo '<div class="ml-container"><div class="ml-extra-div"></div><div class="ml-form-container">';
|
760 |
+
}
|
761 |
+
|
762 |
+
public function close_extra_div() {
|
763 |
+
echo '</div></div>';
|
764 |
+
}
|
765 |
+
|
766 |
+
public function check_labels() {
|
767 |
+
|
768 |
+
add_filter( 'gettext', array( $this, 'change_username_label' ), 99, 3 );
|
769 |
+
add_filter( 'gettext', array( $this, 'change_password_label' ), 99, 3 );
|
770 |
+
add_filter( 'gettext', array( $this, 'change_rememberme_label' ), 99, 3 );
|
771 |
+
add_filter( 'gettext', array( $this, 'change_login_label' ), 99, 3 );
|
772 |
+
|
773 |
+
}
|
774 |
+
|
775 |
+
public function check_texts() {
|
776 |
+
add_filter( 'gettext', array( $this, 'change_lost_password_text' ), 99, 3 );
|
777 |
+
add_filter( 'gettext_with_context', array( $this, 'change_back_to_text' ), 99, 4 );
|
778 |
+
}
|
779 |
+
|
780 |
+
/**
|
781 |
+
* Customizer output for custom username label.
|
782 |
+
*
|
783 |
+
* @param string|string $translated_text The translated text.
|
784 |
+
* @param string|string $text The label we want to replace.
|
785 |
+
* @param string|string $domain The text domain of the site.
|
786 |
+
* @return string
|
787 |
+
*/
|
788 |
+
public function change_username_label( $translated_text, $text, $domain ) {
|
789 |
+
$default = 'Username or Email Address';
|
790 |
+
$label = $this->options['username-label'];
|
791 |
+
|
792 |
+
// Check if is our text
|
793 |
+
if ( $default !== $text ) {
|
794 |
+
return $translated_text;
|
795 |
+
}
|
796 |
+
|
797 |
+
// Check if the label is changed
|
798 |
+
if ( $label === $text ) {
|
799 |
+
return $translated_text;
|
800 |
+
}else{
|
801 |
+
$translated_text = esc_html( $label );
|
802 |
+
}
|
803 |
+
|
804 |
+
return $translated_text;
|
805 |
+
}
|
806 |
+
/**
|
807 |
+
* Customizer output for custom password label.
|
808 |
+
*
|
809 |
+
* @param string|string $translated_text The translated text.
|
810 |
+
* @param string|string $text The label we want to replace.
|
811 |
+
* @param string|string $domain The text domain of the site.
|
812 |
+
* @return string
|
813 |
+
*/
|
814 |
+
public function change_password_label( $translated_text, $text, $domain ) {
|
815 |
+
$default = 'Password';
|
816 |
+
$label = $this->options['password-label'];
|
817 |
+
|
818 |
+
// Check if is our text
|
819 |
+
if ( $default !== $text ) {
|
820 |
+
return $translated_text;
|
821 |
+
}
|
822 |
+
|
823 |
+
// Check if the label is changed
|
824 |
+
if ( $label === $text ) {
|
825 |
+
return $translated_text;
|
826 |
+
}else{
|
827 |
+
$translated_text = esc_html( $label );
|
828 |
+
}
|
829 |
+
|
830 |
+
return $translated_text;
|
831 |
+
}
|
832 |
+
|
833 |
+
/**
|
834 |
+
* Customizer output for custom remember me text.
|
835 |
+
*
|
836 |
+
* @param string|string $translated_text The translated text.
|
837 |
+
* @param string|string $text The label we want to replace.
|
838 |
+
* @param string|string $domain The text domain of the site.
|
839 |
+
* @return string
|
840 |
+
*/
|
841 |
+
public function change_rememberme_label( $translated_text, $text, $domain ) {
|
842 |
+
$default = 'Remember Me';
|
843 |
+
$label = $this->options['rememberme-label'];
|
844 |
+
|
845 |
+
// Check if is our text
|
846 |
+
if ( $default !== $text ) {
|
847 |
+
return $translated_text;
|
848 |
+
}
|
849 |
+
|
850 |
+
// Check if the label is changed
|
851 |
+
if ( $label === $text ) {
|
852 |
+
return $translated_text;
|
853 |
+
} else {
|
854 |
+
$translated_text = esc_html( $label );
|
855 |
+
}
|
856 |
+
|
857 |
+
return $translated_text;
|
858 |
+
}
|
859 |
+
|
860 |
+
/**
|
861 |
+
* Customizer output for custom lost your password text.
|
862 |
+
*
|
863 |
+
* @param string|string $translated_text The translated text.
|
864 |
+
* @param string|string $text The label we want to replace.
|
865 |
+
* @param string|string $domain The text domain of the site.
|
866 |
+
* @return string
|
867 |
+
*/
|
868 |
+
public function change_lost_password_text( $translated_text, $text, $domain ) {
|
869 |
+
$default = 'Lost your password?';
|
870 |
+
$label = $this->options['lost-password-text'];
|
871 |
+
|
872 |
+
// Check if is our text
|
873 |
+
if ( $default !== $text ) {
|
874 |
+
return $translated_text;
|
875 |
+
}
|
876 |
+
|
877 |
+
// Check if the label is changed
|
878 |
+
if ( $label === $text ) {
|
879 |
+
return $translated_text;
|
880 |
+
}else{
|
881 |
+
$translated_text = esc_html( $label );
|
882 |
+
}
|
883 |
+
|
884 |
+
return $translated_text;
|
885 |
+
}
|
886 |
+
|
887 |
+
/**
|
888 |
+
* Customizer output for custom back to text.
|
889 |
+
*
|
890 |
+
* @param string|string $translated_text The translated text.
|
891 |
+
* @param string|string $text The label we want to replace.
|
892 |
+
* @param string|string $domain The text domain of the site.
|
893 |
+
* @return string
|
894 |
+
*/
|
895 |
+
public function change_back_to_text( $translated_text, $text, $context, $domain ) {
|
896 |
+
$default = '← Back to %s';
|
897 |
+
$label = $this->options['back-to-text'];
|
898 |
+
|
899 |
+
// Check if is our text
|
900 |
+
if ( $default !== $text ) {
|
901 |
+
return $translated_text;
|
902 |
+
}
|
903 |
+
|
904 |
+
// Check if the label is changed
|
905 |
+
if ( $label === $text ) {
|
906 |
+
return $translated_text;
|
907 |
+
}else{
|
908 |
+
$translated_text = '← ' . esc_html( $label ) . ' %s';
|
909 |
+
}
|
910 |
+
|
911 |
+
return $translated_text;
|
912 |
+
}
|
913 |
+
|
914 |
+
/**
|
915 |
+
* Customizer output for custom login text.
|
916 |
+
*
|
917 |
+
* @param string|string $translated_text The translated text.
|
918 |
+
* @param string|string $text The label we want to replace.
|
919 |
+
* @param string|string $domain The text domain of the site.
|
920 |
+
* @return string
|
921 |
+
*/
|
922 |
+
public function change_login_label( $translated_text, $text, $domain ) {
|
923 |
+
$default = 'Log In';
|
924 |
+
$label = $this->options['login-label'];
|
925 |
+
|
926 |
+
// Check if is our text
|
927 |
+
if ( $default !== $text ) {
|
928 |
+
return $translated_text;
|
929 |
+
}
|
930 |
+
|
931 |
+
// Check if the label is changed
|
932 |
+
if ( $label === $text ) {
|
933 |
+
return $translated_text;
|
934 |
+
} else {
|
935 |
+
$translated_text = esc_attr( $label );
|
936 |
+
}
|
937 |
+
|
938 |
+
return $translated_text;
|
939 |
+
}
|
940 |
+
|
941 |
+
}
|
includes/lib/class-colorlib-login-customizer-customizer.php
CHANGED
@@ -1,917 +1,940 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
exit;
|
5 |
-
};
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Class Colorlib_Login_Customizer_Customizer
|
9 |
-
*/
|
10 |
-
class Colorlib_Login_Customizer_Customizer {
|
11 |
-
/**
|
12 |
-
* @var
|
13 |
-
*/
|
14 |
-
public $settings;
|
15 |
-
/**
|
16 |
-
* The main plugin object.
|
17 |
-
*
|
18 |
-
* @var object
|
19 |
-
* @access public
|
20 |
-
* @since 1.0.0
|
21 |
-
*/
|
22 |
-
public $parent = null;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Colorlib_Login_Customizer_Customizer constructor.
|
26 |
-
*
|
27 |
-
* @param $parent
|
28 |
-
* @param $manager
|
29 |
-
*/
|
30 |
-
public function __construct( $parent, $manager ) {
|
31 |
-
//Plugin object
|
32 |
-
$this->parent = $parent;
|
33 |
-
// Initialise settings
|
34 |
-
$this->init_settings();
|
35 |
-
// Register plugin sections and settings
|
36 |
-
$this->register_settings( $manager );
|
37 |
-
// Load customizer assets
|
38 |
-
add_action( 'customize_controls_enqueue_scripts', array( $this, 'customizer_enqueue_scripts' ), 25 );
|
39 |
-
add_action( 'customize_preview_init', array( $this, 'customize_preview_styles' ), 25 );
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Initialise settings
|
44 |
-
*
|
45 |
-
* @return void
|
46 |
-
*/
|
47 |
-
public function init_settings() {
|
48 |
-
$this->settings = $this->settings_fields();
|
49 |
-
}
|
50 |
-
|
51 |
-
private function generate_name( $id ) {
|
52 |
-
return $this->parent->key_name . '[' . $id . ']';
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Build settings fields
|
57 |
-
*
|
58 |
-
* @return array Fields to be displayed on settings page
|
59 |
-
*/
|
60 |
-
private function settings_fields() {
|
61 |
-
$settings['templates'] = array(
|
62 |
-
'title' => esc_html__( 'Templates', 'colorlib-login-customizer' ),
|
63 |
-
'description' => '',
|
64 |
-
'fields' => array(
|
65 |
-
array(
|
66 |
-
'id' => 'templates',
|
67 |
-
'label' => esc_html__( 'Temapltes', 'colorlib-login-customizer' ),
|
68 |
-
'description' => '',
|
69 |
-
'type' => 'clc-templates',
|
70 |
-
'default' => 'default',
|
71 |
-
'choices' => array(
|
72 |
-
'default' => array(
|
73 |
-
'url' => esc_url( $this->parent->assets_url ) . 'img/default.jpg',
|
74 |
-
'options' => array(
|
75 |
-
/**
|
76 |
-
* Layout
|
77 |
-
*/
|
78 |
-
'columns' => '1',
|
79 |
-
'columns-width' => array(
|
80 |
-
'left' => 6,
|
81 |
-
'right' => 6,
|
82 |
-
),
|
83 |
-
'form-column-align' => '3',
|
84 |
-
'form-vertical-align' => '2',
|
85 |
-
/**
|
86 |
-
* Logo section
|
87 |
-
*/
|
88 |
-
'hide-logo' => 0,
|
89 |
-
'use-text-logo' => 0,
|
90 |
-
'logo-text' => '',
|
91 |
-
'
|
92 |
-
'custom-logo' => '',
|
93 |
-
'logo-text-color' => '#444',
|
94 |
-
'logo-text-size' => '20',
|
95 |
-
'logo-text-color-hover' => '#00a0d2',
|
96 |
-
'logo-width' => '84',
|
97 |
-
'logo-height' => '84',
|
98 |
-
/**
|
99 |
-
* Background section
|
100 |
-
*/
|
101 |
-
'custom-background' => '',
|
102 |
-
'custom-background-form' => '',
|
103 |
-
'custom-background-color' => '#f1f1f1',
|
104 |
-
'custom-background-color-form' => '#f1f1f1',
|
105 |
-
/**
|
106 |
-
* Form section
|
107 |
-
*/
|
108 |
-
'form-width' => '320',
|
109 |
-
'form-height' => '297',
|
110 |
-
'form-background-image' => '',
|
111 |
-
'form-background-color' => '#ffffff',
|
112 |
-
'form-padding' => '26px 24px',
|
113 |
-
'form-border' => '0 none',
|
114 |
-
'form-shadow' => '0 1px 3px rgba(0,0,0,.13)',
|
115 |
-
'form-border-radius' => 'unset',
|
116 |
-
'form-field-border-radius' => 'unset',
|
117 |
-
'form-field-border' => '1px solid #ddd',
|
118 |
-
'form-field-width' => '',
|
119 |
-
'form-field-margin' => '2px 6px 16px 0',
|
120 |
-
'form-field-background' => '#fbfbfb',
|
121 |
-
'form-field-color' => '#32373c',
|
122 |
-
'form-label-color' => '#72777c',
|
123 |
-
'hide-extra-links' => 0,
|
124 |
-
'username-label' => 'Username or Email Address',
|
125 |
-
'password-label' => 'Password',
|
126 |
-
/**
|
127 |
-
* Others section ( misc )
|
128 |
-
*/
|
129 |
-
'button-background' => '#0085ba',
|
130 |
-
'button-background-hover' => '#008ec2',
|
131 |
-
'button-border-color' => '#0073aa',
|
132 |
-
'button-border-color-hover' => '#006799',
|
133 |
-
'button-shadow' => '0 1px 0 #006799',
|
134 |
-
'button-text-shadow' => '0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799',
|
135 |
-
'button-color' => '#ffffff',
|
136 |
-
'link-color' => '#555d66',
|
137 |
-
'link-color-hover' => '#00a0d2',
|
138 |
-
'hide-rememberme' => false,
|
139 |
-
'custom-css'
|
140 |
-
),
|
141 |
-
),
|
142 |
-
'template-01' => array(
|
143 |
-
'url' => esc_url( $this->parent->assets_url ) . 'img/template-01.jpg',
|
144 |
-
'options' => array(
|
145 |
-
'columns' => '2',
|
146 |
-
'form-column-align' => '1',
|
147 |
-
'form-background-color' => 'rgba(255, 255, 255, 1)',
|
148 |
-
'custom-background' => esc_url( $this->parent->assets_url ) . 'img/background.jpg',
|
149 |
-
'custom-css' => '',
|
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 |
-
'form-
|
177 |
-
'
|
178 |
-
'
|
179 |
-
'
|
180 |
-
'
|
181 |
-
'
|
182 |
-
'
|
183 |
-
'
|
184 |
-
'form-
|
185 |
-
'
|
186 |
-
'
|
187 |
-
'button-
|
188 |
-
'button-
|
189 |
-
'
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
'logo
|
196 |
-
'
|
197 |
-
'
|
198 |
-
'logo-
|
199 |
-
'logo
|
200 |
-
'logo-text-color
|
201 |
-
'logo-
|
202 |
-
'logo-
|
203 |
-
'
|
204 |
-
'
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
'form-
|
213 |
-
'
|
214 |
-
'
|
215 |
-
'
|
216 |
-
'
|
217 |
-
'
|
218 |
-
'
|
219 |
-
'
|
220 |
-
'form-
|
221 |
-
'
|
222 |
-
'
|
223 |
-
'button-
|
224 |
-
'button-
|
225 |
-
'
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
'logo
|
232 |
-
'
|
233 |
-
'
|
234 |
-
'logo-
|
235 |
-
'logo
|
236 |
-
'logo-text-color
|
237 |
-
'logo-
|
238 |
-
'logo-
|
239 |
-
'
|
240 |
-
'
|
241 |
-
'
|
242 |
-
'
|
243 |
-
'form-
|
244 |
-
'
|
245 |
-
'form-field-border'
|
246 |
-
'
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
'
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
'
|
262 |
-
'
|
263 |
-
'
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
'
|
269 |
-
'
|
270 |
-
'
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
'
|
276 |
-
'
|
277 |
-
'
|
278 |
-
'
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
'
|
284 |
-
'
|
285 |
-
'
|
286 |
-
'
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
'
|
292 |
-
'
|
293 |
-
'
|
294 |
-
'
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
'
|
300 |
-
'
|
301 |
-
'
|
302 |
-
|
303 |
-
|
304 |
-
'
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
'
|
313 |
-
'
|
314 |
-
'
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
'
|
320 |
-
'
|
321 |
-
'
|
322 |
-
'
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
'
|
327 |
-
'
|
328 |
-
'
|
329 |
-
'
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
'
|
335 |
-
|
336 |
-
|
337 |
-
'
|
338 |
-
'
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
'
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
'
|
383 |
-
'
|
384 |
-
'
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
'
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
'
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
'
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
'
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
'
|
465 |
-
'
|
466 |
-
'
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
'
|
472 |
-
'
|
473 |
-
'
|
474 |
-
'
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
'
|
479 |
-
'
|
480 |
-
'
|
481 |
-
'
|
482 |
-
'
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
'
|
505 |
-
'
|
506 |
-
'
|
507 |
-
|
508 |
-
|
509 |
-
'
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
'
|
514 |
-
|
515 |
-
|
516 |
-
'
|
517 |
-
'
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
'
|
526 |
-
'
|
527 |
-
'
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
'
|
533 |
-
'
|
534 |
-
'
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
'
|
540 |
-
'
|
541 |
-
'
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
'
|
547 |
-
'
|
548 |
-
'
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
'
|
554 |
-
'
|
555 |
-
'
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
'
|
561 |
-
'
|
562 |
-
'
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
'
|
568 |
-
'
|
569 |
-
'
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
'
|
575 |
-
'
|
576 |
-
'
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
'
|
582 |
-
'
|
583 |
-
'
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
'
|
589 |
-
'
|
590 |
-
'
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
'
|
596 |
-
'
|
597 |
-
'
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
'
|
603 |
-
'
|
604 |
-
'
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
'
|
610 |
-
'
|
611 |
-
'
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
'
|
617 |
-
'
|
618 |
-
'
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
'
|
624 |
-
'
|
625 |
-
'
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
'
|
631 |
-
'
|
632 |
-
'
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
'
|
638 |
-
'
|
639 |
-
'
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
'
|
652 |
-
'
|
653 |
-
'
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
'
|
659 |
-
'
|
660 |
-
'
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
'
|
673 |
-
'
|
674 |
-
'
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
'
|
680 |
-
'
|
681 |
-
'
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
'
|
687 |
-
'
|
688 |
-
'
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
'
|
694 |
-
'
|
695 |
-
'
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
'
|
701 |
-
'
|
702 |
-
'
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
'
|
708 |
-
'
|
709 |
-
'
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
'
|
715 |
-
'
|
716 |
-
'
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
'
|
729 |
-
'
|
730 |
-
'
|
731 |
-
'
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
break;
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
);
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
};
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class Colorlib_Login_Customizer_Customizer
|
9 |
+
*/
|
10 |
+
class Colorlib_Login_Customizer_Customizer {
|
11 |
+
/**
|
12 |
+
* @var
|
13 |
+
*/
|
14 |
+
public $settings;
|
15 |
+
/**
|
16 |
+
* The main plugin object.
|
17 |
+
*
|
18 |
+
* @var object
|
19 |
+
* @access public
|
20 |
+
* @since 1.0.0
|
21 |
+
*/
|
22 |
+
public $parent = null;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Colorlib_Login_Customizer_Customizer constructor.
|
26 |
+
*
|
27 |
+
* @param $parent
|
28 |
+
* @param $manager
|
29 |
+
*/
|
30 |
+
public function __construct( $parent, $manager ) {
|
31 |
+
//Plugin object
|
32 |
+
$this->parent = $parent;
|
33 |
+
// Initialise settings
|
34 |
+
$this->init_settings();
|
35 |
+
// Register plugin sections and settings
|
36 |
+
$this->register_settings( $manager );
|
37 |
+
// Load customizer assets
|
38 |
+
add_action( 'customize_controls_enqueue_scripts', array( $this, 'customizer_enqueue_scripts' ), 25 );
|
39 |
+
add_action( 'customize_preview_init', array( $this, 'customize_preview_styles' ), 25 );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Initialise settings
|
44 |
+
*
|
45 |
+
* @return void
|
46 |
+
*/
|
47 |
+
public function init_settings() {
|
48 |
+
$this->settings = $this->settings_fields();
|
49 |
+
}
|
50 |
+
|
51 |
+
private function generate_name( $id ) {
|
52 |
+
return $this->parent->key_name . '[' . $id . ']';
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Build settings fields
|
57 |
+
*
|
58 |
+
* @return array Fields to be displayed on settings page
|
59 |
+
*/
|
60 |
+
private function settings_fields() {
|
61 |
+
$settings['templates'] = array(
|
62 |
+
'title' => esc_html__( 'Templates', 'colorlib-login-customizer' ),
|
63 |
+
'description' => '',
|
64 |
+
'fields' => array(
|
65 |
+
array(
|
66 |
+
'id' => 'templates',
|
67 |
+
'label' => esc_html__( 'Temapltes', 'colorlib-login-customizer' ),
|
68 |
+
'description' => '',
|
69 |
+
'type' => 'clc-templates',
|
70 |
+
'default' => 'default',
|
71 |
+
'choices' => array(
|
72 |
+
'default' => array(
|
73 |
+
'url' => esc_url( $this->parent->assets_url ) . 'img/default.jpg',
|
74 |
+
'options' => array(
|
75 |
+
/**
|
76 |
+
* Layout
|
77 |
+
*/
|
78 |
+
'columns' => '1',
|
79 |
+
'columns-width' => array(
|
80 |
+
'left' => 6,
|
81 |
+
'right' => 6,
|
82 |
+
),
|
83 |
+
'form-column-align' => '3',
|
84 |
+
'form-vertical-align' => '2',
|
85 |
+
/**
|
86 |
+
* Logo section
|
87 |
+
*/
|
88 |
+
'hide-logo' => 0,
|
89 |
+
'use-text-logo' => 0,
|
90 |
+
'logo-text' => '',
|
91 |
+
'logo-url' => site_url(),
|
92 |
+
'custom-logo' => '',
|
93 |
+
'logo-text-color' => '#444',
|
94 |
+
'logo-text-size' => '20',
|
95 |
+
'logo-text-color-hover' => '#00a0d2',
|
96 |
+
'logo-width' => '84',
|
97 |
+
'logo-height' => '84',
|
98 |
+
/**
|
99 |
+
* Background section
|
100 |
+
*/
|
101 |
+
'custom-background' => '',
|
102 |
+
'custom-background-form' => '',
|
103 |
+
'custom-background-color' => '#f1f1f1',
|
104 |
+
'custom-background-color-form' => '#f1f1f1',
|
105 |
+
/**
|
106 |
+
* Form section
|
107 |
+
*/
|
108 |
+
'form-width' => '320',
|
109 |
+
'form-height' => '297',
|
110 |
+
'form-background-image' => '',
|
111 |
+
'form-background-color' => '#ffffff',
|
112 |
+
'form-padding' => '26px 24px',
|
113 |
+
'form-border' => '0 none',
|
114 |
+
'form-shadow' => '0 1px 3px rgba(0,0,0,.13)',
|
115 |
+
'form-border-radius' => 'unset',
|
116 |
+
'form-field-border-radius' => 'unset',
|
117 |
+
'form-field-border' => '1px solid #ddd',
|
118 |
+
'form-field-width' => '',
|
119 |
+
'form-field-margin' => '2px 6px 16px 0',
|
120 |
+
'form-field-background' => '#fbfbfb',
|
121 |
+
'form-field-color' => '#32373c',
|
122 |
+
'form-label-color' => '#72777c',
|
123 |
+
'hide-extra-links' => 0,
|
124 |
+
'username-label' => 'Username or Email Address',
|
125 |
+
'password-label' => 'Password',
|
126 |
+
/**
|
127 |
+
* Others section ( misc )
|
128 |
+
*/
|
129 |
+
'button-background' => '#0085ba',
|
130 |
+
'button-background-hover' => '#008ec2',
|
131 |
+
'button-border-color' => '#0073aa',
|
132 |
+
'button-border-color-hover' => '#006799',
|
133 |
+
'button-shadow' => '0 1px 0 #006799',
|
134 |
+
'button-text-shadow' => '0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799',
|
135 |
+
'button-color' => '#ffffff',
|
136 |
+
'link-color' => '#555d66',
|
137 |
+
'link-color-hover' => '#00a0d2',
|
138 |
+
'hide-rememberme' => false,
|
139 |
+
'custom-css' => '',
|
140 |
+
),
|
141 |
+
),
|
142 |
+
'template-01' => array(
|
143 |
+
'url' => esc_url( $this->parent->assets_url ) . 'img/template-01.jpg',
|
144 |
+
'options' => array(
|
145 |
+
'columns' => '2',
|
146 |
+
'form-column-align' => '1',
|
147 |
+
'form-background-color' => 'rgba(255, 255, 255, 1)',
|
148 |
+
'custom-background' => esc_url( $this->parent->assets_url ) . 'img/background.jpg',
|
149 |
+
'custom-css' => '.ml-form-container .submit input[type=\'submit\']{box-shadow:none;}.ml-form-container input[type=\'text\'],.ml-form-container input[type=\'password\']{box-shadow:none;} ',
|
150 |
+
'lost-password-text' => 'Lost your password?',
|
151 |
+
'back-to-text' => 'Back to',
|
152 |
+
),
|
153 |
+
),
|
154 |
+
'template-02' => array(
|
155 |
+
'url' => esc_url( $this->parent->assets_url ) . 'img/template-02.jpg',
|
156 |
+
'options' => array(
|
157 |
+
'hide-logo' => '1',
|
158 |
+
'hide-extra-links' => '1',
|
159 |
+
'custom-background' => esc_url( $this->parent->assets_url ) . 'img/background-1.jpg',
|
160 |
+
'form-background-color' => 'rgba(255, 255, 255, 0)',
|
161 |
+
'form-shadow' => 'none',
|
162 |
+
'custom-css' => '.ml-form-container input[type=\'password\'],.ml-form-container input[type=\'text\']{box-shadow:none;}.ml-form-container .submit input[type=\'submit\']{box-shadow:none;}',
|
163 |
+
),
|
164 |
+
),
|
165 |
+
'template-03' => array(
|
166 |
+
'url' => esc_url( $this->parent->assets_url ) . 'img/tpl-03/screen.jpg',
|
167 |
+
'options' => array(
|
168 |
+
'columns' => '2',
|
169 |
+
'columns-width' => array(
|
170 |
+
'left' => 8,
|
171 |
+
'right' => 4,
|
172 |
+
),
|
173 |
+
/**
|
174 |
+
* Form section
|
175 |
+
*/
|
176 |
+
'form-width' => '430',
|
177 |
+
'form-height' => '350',
|
178 |
+
'form-column-align' => '3',
|
179 |
+
'hide-logo' => '1',
|
180 |
+
'hide-extra-links' => '1',
|
181 |
+
'custom-background-color' => '#f7f7f7',
|
182 |
+
'custom-background' => esc_url( $this->parent->assets_url ) . 'img/tpl-03/bg.jpg',
|
183 |
+
'form-background-color' => 'rgba(255,255,255,0)',
|
184 |
+
'form-shadow' => 'none',
|
185 |
+
'custom-css' => ".ml-form-container .submit input[type='submit'] {width: 100%; box-sizing: border-box;display: inline-block;text-align: center;border-radius: 30px;padding: 0 20px;height: 38px;line-height: 1;font-weight: bold;vertical-align: middle;box-shadow:none; }.ml-form-container input[type='password'],.ml-form-container input[type='text']{box-shadow:none;}",
|
186 |
+
'form-field-background' => '#f7f7f7',
|
187 |
+
'button-background' => '#6675df',
|
188 |
+
'button-background-hover' => '#333333',
|
189 |
+
'button-border-color' => '#6675df',
|
190 |
+
'button-border-color-hover' => '#333333',
|
191 |
+
'hide-rememberme' => '1',
|
192 |
+
/**
|
193 |
+
* Logo section
|
194 |
+
*/
|
195 |
+
'hide-logo' => 0,
|
196 |
+
'use-text-logo' => 1,
|
197 |
+
'logo-text' => 'Login to continue',
|
198 |
+
'logo-url' => site_url(),
|
199 |
+
'custom-logo' => '',
|
200 |
+
'logo-text-color' => '#333',
|
201 |
+
'logo-text-size' => '30',
|
202 |
+
'logo-text-color-hover' => '#00a0d2',
|
203 |
+
'logo-width' => '350',
|
204 |
+
'logo-height' => '0',
|
205 |
+
'username-label' => 'Username',
|
206 |
+
'password-label' => 'Password',
|
207 |
+
),
|
208 |
+
),
|
209 |
+
'template-04' => array(
|
210 |
+
'url' => esc_url( $this->parent->assets_url ) . 'img/tpl-04/screen.jpg',
|
211 |
+
'options' => array(
|
212 |
+
'form-width' => '350',
|
213 |
+
'form-height' => '350',
|
214 |
+
'form-padding' => '50px 30px',
|
215 |
+
'columns' => '1',
|
216 |
+
'hide-logo' => '1',
|
217 |
+
'hide-extra-links' => 0,
|
218 |
+
'custom-background-color' => '#e9faff',
|
219 |
+
'custom-background' => '',
|
220 |
+
'form-background-color' => 'rgba(255,255,255,1)',
|
221 |
+
'form-shadow' => 'none',
|
222 |
+
'form-field-background' => '#FFF',
|
223 |
+
'button-background' => '#4272d7',
|
224 |
+
'button-background-hover' => '#333333',
|
225 |
+
'button-border-color' => '#4272d7',
|
226 |
+
'button-border-color-hover' => '#333333',
|
227 |
+
'hide-rememberme' => 1,
|
228 |
+
/**
|
229 |
+
* Logo section
|
230 |
+
*/
|
231 |
+
'hide-logo' => 0,
|
232 |
+
'use-text-logo' => 1,
|
233 |
+
'logo-text' => 'Account Login',
|
234 |
+
'logo-url' => site_url(),
|
235 |
+
'custom-logo' => '',
|
236 |
+
'logo-text-color' => '#333',
|
237 |
+
'logo-text-size' => '20',
|
238 |
+
'logo-text-color-hover' => '#00a0d2',
|
239 |
+
'logo-width' => '350',
|
240 |
+
'logo-height' => '0',
|
241 |
+
'username-label' => '',
|
242 |
+
'password-label' => '',
|
243 |
+
'form-shadow' => '0 3px 20px 0px rgba(0, 0, 0, 0.1)',
|
244 |
+
'custom-css' => '',
|
245 |
+
'form-field-border-radius' => '0',
|
246 |
+
'form-field-margin' => '0',
|
247 |
+
'form-field-border' => '1px solid #eee',
|
248 |
+
'custom-css' => ".ml-form-container .submit input[type='submit'] {width: 100%; box-sizing: border-box;display: inline-block;text-align: center;padding: 0 20px;height: 38px;line-height: 1;font-weight: bold;vertical-align: middle; margin-top: 15px;box-shadow:none;} .ml-form-container input[type='text'], .ml-form-container input[type='password'] { height: 50px; } .login .ml-form-container #backtoblog,.login .ml-form-container #nav{position:absolute;left:0;right:0;margin-right:auto!important;bottom:50px;max-width:100%;text-align:center}.login .ml-form-container #nav{bottom:40px}.ml-form-container #login>h1{position:absolute;top:50px}.ml-form-container input[type='text'],.ml-form-container input[type='password']{box-shadow:none;}",
|
249 |
+
),
|
250 |
+
),
|
251 |
+
),
|
252 |
+
),
|
253 |
+
),
|
254 |
+
);
|
255 |
+
|
256 |
+
$settings['logo'] = array(
|
257 |
+
'title' => esc_html__( 'Logo options', 'colorlib-login-customizer' ),
|
258 |
+
'description' => '',
|
259 |
+
'fields' => array(
|
260 |
+
array(
|
261 |
+
'id' => 'hide-logo',
|
262 |
+
'label' => esc_html__( 'Hide Logo', 'colorlib-login-customizer' ),
|
263 |
+
'description' => esc_html__( 'Show/Hide the logo from login page', 'colorlib-login-customizer' ),
|
264 |
+
'type' => 'clc-toggle',
|
265 |
+
'default' => 0,
|
266 |
+
),
|
267 |
+
array(
|
268 |
+
'id' => 'use-text-logo',
|
269 |
+
'label' => esc_html__( 'Use Text Logo', 'colorlib-login-customizer' ),
|
270 |
+
'description' => esc_html__( 'Show/Hide the logo text from login page', 'colorlib-login-customizer' ),
|
271 |
+
'type' => 'clc-toggle',
|
272 |
+
'default' => 0,
|
273 |
+
),
|
274 |
+
array(
|
275 |
+
'id' => 'logo-text',
|
276 |
+
'label' => esc_html__( 'Logo text', 'colorlib-login-customizer' ),
|
277 |
+
'description' => esc_html__( 'This is will be your logo.', 'colorlib-login-customizer' ),
|
278 |
+
'type' => 'text',
|
279 |
+
'default' => '',
|
280 |
+
'active_callback' => array( $this, 'check_if_text_logo' ),
|
281 |
+
),
|
282 |
+
array(
|
283 |
+
'id' => 'logo-text-color',
|
284 |
+
'label' => esc_html__( 'Logo text color', 'colorlib-login-customizer' ),
|
285 |
+
'description' => esc_html__( 'This will change the color text property.', 'colorlib-login-customizer' ),
|
286 |
+
'type' => 'color',
|
287 |
+
'default' => '#444',
|
288 |
+
'active_callback' => array( $this, 'check_if_text_logo' ),
|
289 |
+
),
|
290 |
+
array(
|
291 |
+
'id' => 'logo-text-color-hover',
|
292 |
+
'label' => esc_html__( 'Logo text color hover', 'colorlib-login-customizer' ),
|
293 |
+
'description' => esc_html__( 'This will change the color text property on hover.', 'colorlib-login-customizer' ),
|
294 |
+
'type' => 'color',
|
295 |
+
'default' => '#00a0d2',
|
296 |
+
'active_callback' => array( $this, 'check_if_text_logo' ),
|
297 |
+
),
|
298 |
+
array(
|
299 |
+
'id' => 'logo-text-size',
|
300 |
+
'label' => esc_html__( 'Logo text size', 'colorlib-login-customizer' ),
|
301 |
+
'description' => esc_html__( 'This will change the text size of logo.', 'colorlib-login-customizer' ),
|
302 |
+
'default' => 20,
|
303 |
+
'choices' => array(
|
304 |
+
'min' => 10,
|
305 |
+
'max' => 120,
|
306 |
+
'step' => 1,
|
307 |
+
),
|
308 |
+
'type' => 'clc-range-slider',
|
309 |
+
'active_callback' => array( $this, 'check_if_text_logo' ),
|
310 |
+
),
|
311 |
+
array(
|
312 |
+
'id' => 'logo-url',
|
313 |
+
'label' => esc_html__( 'Logo URL', 'colorlib-login-customizer' ),
|
314 |
+
'description' => esc_html__( 'This is where the logo will link to.', 'colorlib-login-customizer' ),
|
315 |
+
'type' => 'text',
|
316 |
+
'default' => site_url(),
|
317 |
+
),
|
318 |
+
array(
|
319 |
+
'id' => 'logo-title',
|
320 |
+
'label' => esc_html__( 'Logo Title', 'colorlib-login-customizer' ),
|
321 |
+
'description' => esc_html__( 'The tooltip that will be displayed when hovering over the logo.', 'colorlib-login-customizer' ),
|
322 |
+
'type' => 'text',
|
323 |
+
'default' => 'Powered by WordPress',
|
324 |
+
),
|
325 |
+
array(
|
326 |
+
'id' => 'custom-logo',
|
327 |
+
'label' => esc_html__( 'Custom logo', 'colorlib-login-customizer' ),
|
328 |
+
'description' => esc_html__( 'This will upload an image to your media library and store the attachment ID in the option field. Once you have uploaded an imge the thumbnail will display above these buttons.', 'colorlib-login-customizer' ),
|
329 |
+
'type' => 'image',
|
330 |
+
'default' => '',
|
331 |
+
'active_callback' => array( $this, 'check_if_not_text_logo' ),
|
332 |
+
),
|
333 |
+
array(
|
334 |
+
'id' => 'logo-width',
|
335 |
+
'label' => esc_html__( 'Logo Width', 'colorlib-login-customizer' ),
|
336 |
+
'description' => esc_html__( 'Make sure you set the logo width to match your image.', 'colorlib-login-customizer' ),
|
337 |
+
'default' => 84,
|
338 |
+
'choices' => array(
|
339 |
+
'min' => 0,
|
340 |
+
'max' => 1000,
|
341 |
+
'step' => 5,
|
342 |
+
),
|
343 |
+
'type' => 'clc-range-slider',
|
344 |
+
),
|
345 |
+
array(
|
346 |
+
'id' => 'logo-height',
|
347 |
+
'label' => esc_html__( 'Logo Height', 'colorlib-login-customizer' ),
|
348 |
+
'description' => esc_html__( 'Make sure you set the logo height to match your image.', 'colorlib-login-customizer' ),
|
349 |
+
'default' => 20,
|
350 |
+
'choices' => array(
|
351 |
+
'min' => 0,
|
352 |
+
'max' => 1000,
|
353 |
+
'step' => 5,
|
354 |
+
),
|
355 |
+
'type' => 'clc-range-slider',
|
356 |
+
),
|
357 |
+
),
|
358 |
+
);
|
359 |
+
|
360 |
+
$settings['layout'] = array(
|
361 |
+
'title' => esc_html__( 'Layout options', 'colorlib-login-customizer' ),
|
362 |
+
'description' => '',
|
363 |
+
'fields' => array(
|
364 |
+
array(
|
365 |
+
'id' => 'columns',
|
366 |
+
'label' => esc_html__( 'Columns', 'colorlib-login-customizer' ),
|
367 |
+
'description' => '',
|
368 |
+
'default' => 1,
|
369 |
+
'choices' => array(
|
370 |
+
1 => array(
|
371 |
+
'value' => 1,
|
372 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/one-column.png',
|
373 |
+
),
|
374 |
+
2 => array(
|
375 |
+
'value' => 2,
|
376 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/two-column.png',
|
377 |
+
),
|
378 |
+
),
|
379 |
+
'type' => 'clc-button-group',
|
380 |
+
),
|
381 |
+
array(
|
382 |
+
'id' => 'columns-width',
|
383 |
+
'label' => esc_html__( 'Columns Width', 'colorlib-login-customizer' ),
|
384 |
+
'description' => '',
|
385 |
+
'type' => 'clc-column-width',
|
386 |
+
'active_callback' => array( $this, 'check_two_column_layout' ),
|
387 |
+
),
|
388 |
+
array(
|
389 |
+
'id' => 'form-column-align',
|
390 |
+
'label' => esc_html__( 'Form Column Alignment', 'colorlib-login-customizer' ),
|
391 |
+
'description' => '',
|
392 |
+
'default' => 3,
|
393 |
+
'choices' => array(
|
394 |
+
'left' => array(
|
395 |
+
'value' => 1,
|
396 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-align-left.jpg',
|
397 |
+
),
|
398 |
+
'top' => array(
|
399 |
+
'value' => 2,
|
400 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-align-top.jpg',
|
401 |
+
),
|
402 |
+
'right' => array(
|
403 |
+
'value' => 3,
|
404 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-align-right.jpg',
|
405 |
+
),
|
406 |
+
'bottom' => array(
|
407 |
+
'value' => 4,
|
408 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-align-bottom.jpg',
|
409 |
+
),
|
410 |
+
),
|
411 |
+
'type' => 'clc-button-group',
|
412 |
+
'active_callback' => array( $this, 'check_two_column_layout' ),
|
413 |
+
),
|
414 |
+
array(
|
415 |
+
'id' => 'form-vertical-align',
|
416 |
+
'label' => esc_html__( 'Form Vertical Alignment', 'colorlib-login-customizer' ),
|
417 |
+
'description' => '',
|
418 |
+
'default' => 2,
|
419 |
+
'choices' => array(
|
420 |
+
'top' => array(
|
421 |
+
'value' => 1,
|
422 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-vertical-align-top.png',
|
423 |
+
),
|
424 |
+
'middle' => array(
|
425 |
+
'value' => 2,
|
426 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-vertical-align-middle.png',
|
427 |
+
),
|
428 |
+
'bottom' => array(
|
429 |
+
'value' => 3,
|
430 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-vertical-align-bottom.png',
|
431 |
+
),
|
432 |
+
),
|
433 |
+
'type' => 'clc-button-group',
|
434 |
+
),
|
435 |
+
array(
|
436 |
+
'id' => 'form-horizontal-align',
|
437 |
+
'label' => esc_html__( 'Form Horizontal Alignment', 'colorlib-login-customizer' ),
|
438 |
+
'description' => '',
|
439 |
+
'default' => 2,
|
440 |
+
'choices' => array(
|
441 |
+
'left' => array(
|
442 |
+
'value' => 1,
|
443 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-horizontal-align-left.png',
|
444 |
+
),
|
445 |
+
'middle' => array(
|
446 |
+
'value' => 2,
|
447 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-vertical-align-middle.png',
|
448 |
+
),
|
449 |
+
'right' => array(
|
450 |
+
'value' => 3,
|
451 |
+
'png' => COLORLIB_LOGIN_CUSTOMIZER_URL . '/assets/img/form-horizontal-align-right.png',
|
452 |
+
),
|
453 |
+
),
|
454 |
+
'type' => 'clc-button-group',
|
455 |
+
),
|
456 |
+
),
|
457 |
+
);
|
458 |
+
|
459 |
+
$settings['background'] = array(
|
460 |
+
'title' => esc_html__( 'Background options', 'colorlib-login-customizer' ),
|
461 |
+
'description' => '',
|
462 |
+
'fields' => array(
|
463 |
+
array(
|
464 |
+
'id' => 'custom-background-color',
|
465 |
+
'label' => esc_html__( 'Custom background color', 'colorlib-login-customizer' ),
|
466 |
+
'description' => esc_html__( 'This will change the background color property.', 'colorlib-login-customizer' ),
|
467 |
+
'type' => 'color',
|
468 |
+
'default' => '#f1f1f1',
|
469 |
+
),
|
470 |
+
array(
|
471 |
+
'id' => 'custom-background',
|
472 |
+
'label' => esc_html__( 'Custom background', 'colorlib-login-customizer' ),
|
473 |
+
'description' => esc_html__( 'This will upload an image to your media library and store the attachment ID in the option field. Once you have uploaded an imge the thumbnail will display above these buttons.', 'colorlib-login-customizer' ),
|
474 |
+
'type' => 'image',
|
475 |
+
'default' => '',
|
476 |
+
),
|
477 |
+
array(
|
478 |
+
'id' => 'custom-background-color-form',
|
479 |
+
'label' => esc_html__( 'Form Column background color', 'colorlib-login-customizer' ),
|
480 |
+
'description' => esc_html__( 'This will change the background color property.', 'colorlib-login-customizer' ),
|
481 |
+
'type' => 'color',
|
482 |
+
'default' => '#f1f1f1',
|
483 |
+
'active_callback' => array( $this, 'check_two_column_layout' ),
|
484 |
+
),
|
485 |
+
array(
|
486 |
+
'id' => 'custom-background-form',
|
487 |
+
'label' => esc_html__( 'Form Column background', 'colorlib-login-customizer' ),
|
488 |
+
'description' => esc_html__( 'This will upload an image to your media library and store the attachment ID in the option field. Once you have uploaded an imge the thumbnail will display above these buttons.', 'colorlib-login-customizer' ),
|
489 |
+
'type' => 'image',
|
490 |
+
'default' => '',
|
491 |
+
'active_callback' => array( $this, 'check_two_column_layout' ),
|
492 |
+
),
|
493 |
+
),
|
494 |
+
);
|
495 |
+
|
496 |
+
$settings['form'] = array(
|
497 |
+
'title' => esc_html__( 'Form options', 'colorlib-login-customizer' ),
|
498 |
+
'description' => '',
|
499 |
+
'fields' => array(
|
500 |
+
array(
|
501 |
+
'id' => 'form-width',
|
502 |
+
'label' => esc_html__( 'Form Width', 'colorlib-login-customizer' ),
|
503 |
+
'description' => esc_html__( 'Please input the desired width for the login form in pixels. Example: 20', 'colorlib-login-customizer' ),
|
504 |
+
'default' => 320,
|
505 |
+
'type' => 'clc-range-slider',
|
506 |
+
'choices' => array(
|
507 |
+
'min' => 150,
|
508 |
+
'max' => 1000,
|
509 |
+
'step' => 5,
|
510 |
+
),
|
511 |
+
),
|
512 |
+
array(
|
513 |
+
'id' => 'form-height',
|
514 |
+
'label' => esc_html__( 'Form Height', 'colorlib-login-customizer' ),
|
515 |
+
'description' => esc_html__( 'Please input the desired height for the login form in pixels. Example: 20', 'colorlib-login-customizer' ),
|
516 |
+
'default' => 194,
|
517 |
+
'choices' => array(
|
518 |
+
'min' => 150,
|
519 |
+
'max' => 1000,
|
520 |
+
'step' => 5,
|
521 |
+
),
|
522 |
+
'type' => 'clc-range-slider',
|
523 |
+
),
|
524 |
+
array(
|
525 |
+
'id' => 'form-background-image',
|
526 |
+
'label' => esc_html__( 'Form background image', 'colorlib-login-customizer' ),
|
527 |
+
'description' => esc_html__( 'This will change the background image property of login form.', 'colorlib-login-customizer' ),
|
528 |
+
'type' => 'image',
|
529 |
+
'default' => '',
|
530 |
+
),
|
531 |
+
array(
|
532 |
+
'id' => 'form-background-color',
|
533 |
+
'label' => esc_html__( 'Form background color', 'colorlib-login-customizer' ),
|
534 |
+
'description' => esc_html__( 'This will change the background color property.', 'colorlib-login-customizer' ),
|
535 |
+
'type' => 'color',
|
536 |
+
'default' => '#ffffff',
|
537 |
+
),
|
538 |
+
array(
|
539 |
+
'id' => 'form-padding',
|
540 |
+
'label' => esc_html__( 'Form padding', 'colorlib-login-customizer' ),
|
541 |
+
'description' => esc_html__( 'This will change the padding property. Example: 26px 24px 46px 30px', 'colorlib-login-customizer' ),
|
542 |
+
'type' => 'text',
|
543 |
+
'default' => '26px 24px',
|
544 |
+
),
|
545 |
+
array(
|
546 |
+
'id' => 'form-border',
|
547 |
+
'label' => esc_html__( 'Form border', 'colorlib-login-customizer' ),
|
548 |
+
'description' => esc_html__( 'This will change the border property. Example: 2px dotted black', 'colorlib-login-customizer' ),
|
549 |
+
'type' => 'text',
|
550 |
+
'default' => '0 none',
|
551 |
+
),
|
552 |
+
array(
|
553 |
+
'id' => 'form-border-radius',
|
554 |
+
'label' => esc_html__( 'Form border radius', 'colorlib-login-customizer' ),
|
555 |
+
'description' => esc_html__( 'This will change the border radius property. Example: 2px 2px 2px 2px', 'colorlib-login-customizer' ),
|
556 |
+
'type' => 'text',
|
557 |
+
'default' => '0',
|
558 |
+
),
|
559 |
+
array(
|
560 |
+
'id' => 'form-shadow',
|
561 |
+
'label' => esc_html__( 'Form shadow', 'colorlib-login-customizer' ),
|
562 |
+
'description' => esc_html__( 'This will change the form\'s shadow property. Example: 0 1px 0 #006799', 'colorlib-login-customizer' ),
|
563 |
+
'type' => 'text',
|
564 |
+
'default' => '0 1px 3px rgba(0,0,0,.13)',
|
565 |
+
),
|
566 |
+
array(
|
567 |
+
'id' => 'form-field-width',
|
568 |
+
'label' => esc_html__( 'Form field width', 'colorlib-login-customizer' ),
|
569 |
+
'description' => esc_html__( 'Please input the desired width for the form field in pixels. Example: 20', 'colorlib-login-customizer' ),
|
570 |
+
'type' => 'text',
|
571 |
+
'default' => '100%',
|
572 |
+
),
|
573 |
+
array(
|
574 |
+
'id' => 'form-field-margin',
|
575 |
+
'label' => esc_html__( 'Form field margin', 'colorlib-login-customizer' ),
|
576 |
+
'description' => esc_html__( 'This will change the margin property. Example: 26px 24px 46px 30px', 'colorlib-login-customizer' ),
|
577 |
+
'type' => 'text',
|
578 |
+
'default' => '2px 6px 16px 0',
|
579 |
+
),
|
580 |
+
array(
|
581 |
+
'id' => 'form-field-border',
|
582 |
+
'label' => esc_html__( 'Form field border', 'colorlib-login-customizer' ),
|
583 |
+
'description' => esc_html__( 'Please input the desired border for the form field. Example: 2px dotted black', 'colorlib-login-customizer' ),
|
584 |
+
'type' => 'text',
|
585 |
+
'default' => '1px solid #ddd',
|
586 |
+
),
|
587 |
+
array(
|
588 |
+
'id' => 'form-field-border-radius',
|
589 |
+
'label' => esc_html__( 'Form field border radius', 'colorlib-login-customizer' ),
|
590 |
+
'description' => esc_html__( 'Please input the desired border radiuse for the form field. Example: 5px 5px 5px 5px', 'colorlib-login-customizer' ),
|
591 |
+
'type' => 'text',
|
592 |
+
'default' => 'unset',
|
593 |
+
),
|
594 |
+
array(
|
595 |
+
'id' => 'form-field-background',
|
596 |
+
'label' => esc_html__( 'Form field background', 'colorlib-login-customizer' ),
|
597 |
+
'description' => esc_html__( 'This will change the background color property.', 'colorlib-login-customizer' ),
|
598 |
+
'type' => 'color',
|
599 |
+
'default' => '#fbfbfb',
|
600 |
+
),
|
601 |
+
array(
|
602 |
+
'id' => 'form-field-color',
|
603 |
+
'label' => esc_html__( 'Form field color', 'colorlib-login-customizer' ),
|
604 |
+
'description' => esc_html__( 'This will change the text color property.', 'colorlib-login-customizer' ),
|
605 |
+
'type' => 'color',
|
606 |
+
'default' => '#32373c',
|
607 |
+
),
|
608 |
+
array(
|
609 |
+
'id' => 'form-label-color',
|
610 |
+
'label' => esc_html__( 'Form label color', 'colorlib-login-customizer' ),
|
611 |
+
'description' => esc_html__( 'This will change the label text color property.', 'colorlib-login-customizer' ),
|
612 |
+
'type' => 'color',
|
613 |
+
'default' => '#72777c',
|
614 |
+
),
|
615 |
+
array(
|
616 |
+
'id' => 'username-label',
|
617 |
+
'label' => esc_html__( 'Username label', 'colorlib-login-customizer' ),
|
618 |
+
'description' => esc_html__( 'You can change the default text for username label or just delete it.', 'colorlib-login-customizer' ),
|
619 |
+
'type' => 'text',
|
620 |
+
'default' => 'Username or Email Address',
|
621 |
+
),
|
622 |
+
array(
|
623 |
+
'id' => 'password-label',
|
624 |
+
'label' => esc_html__( 'Password label', 'colorlib-login-customizer' ),
|
625 |
+
'description' => esc_html__( 'You can change the default text for password label or just delete it.', 'colorlib-login-customizer' ),
|
626 |
+
'type' => 'text',
|
627 |
+
'default' => 'Password',
|
628 |
+
),
|
629 |
+
array(
|
630 |
+
'id' => 'rememberme-label',
|
631 |
+
'label' => esc_html__( 'Remember Me label', 'colorlib-login-customizer' ),
|
632 |
+
'description' => esc_html__( 'You can change the default remember me text.', 'colorlib-login-customizer' ),
|
633 |
+
'type' => 'text',
|
634 |
+
'default' => 'Remember Me',
|
635 |
+
),
|
636 |
+
array(
|
637 |
+
'id' => 'lost-password-text',
|
638 |
+
'label' => esc_html__( 'Lost Password Text', 'colorlib-login-customizer' ),
|
639 |
+
'description' => esc_html__( 'You can change the default text for "Lost your password" ', 'colorlib-login-customizer' ),
|
640 |
+
'type' => 'text',
|
641 |
+
'default' => 'Lost your password?',
|
642 |
+
),
|
643 |
+
array(
|
644 |
+
'id' => 'back-to-text',
|
645 |
+
'label' => esc_html__( 'Back to site text', 'colorlib-login-customizer' ),
|
646 |
+
'description' => esc_html__( 'You can change the default text for "Back to" site ', 'colorlib-login-customizer' ),
|
647 |
+
'type' => 'text',
|
648 |
+
'default' => 'Back to site',
|
649 |
+
),
|
650 |
+
array(
|
651 |
+
'id' => 'login-label',
|
652 |
+
'label' => esc_html__( 'Login label', 'colorlib-login-customizer' ),
|
653 |
+
'description' => esc_html__( 'You can change the default text for the log in button.', 'colorlib-login-customizer' ),
|
654 |
+
'type' => 'text',
|
655 |
+
'default' => 'Log In',
|
656 |
+
),
|
657 |
+
array(
|
658 |
+
'id' => 'hide-extra-links',
|
659 |
+
'label' => esc_html__( 'Hide Extra Links', 'colorlib-login-customizer' ),
|
660 |
+
'description' => esc_html__( 'Show/Hide the links under the login form', 'colorlib-login-customizer' ),
|
661 |
+
'type' => 'clc-toggle',
|
662 |
+
'default' => 0,
|
663 |
+
),
|
664 |
+
),
|
665 |
+
);
|
666 |
+
|
667 |
+
$settings['general'] = array(
|
668 |
+
'title' => esc_html__( 'Form Button & Links', 'colorlib-login-customizer' ),
|
669 |
+
'description' => '',
|
670 |
+
'fields' => array(
|
671 |
+
array(
|
672 |
+
'id' => 'button-background',
|
673 |
+
'label' => esc_html__( 'Button background', 'colorlib-login-customizer' ),
|
674 |
+
'description' => esc_html__( 'This will change the submit button\'s background property', 'colorlib-login-customizer' ),
|
675 |
+
'type' => 'color',
|
676 |
+
'default' => '#0085ba',
|
677 |
+
),
|
678 |
+
array(
|
679 |
+
'id' => 'button-background-hover',
|
680 |
+
'label' => esc_html__( 'Button background hover state', 'colorlib-login-customizer' ),
|
681 |
+
'description' => esc_html__( 'This will change the submit button\'s background property on hover', 'colorlib-login-customizer' ),
|
682 |
+
'type' => 'color',
|
683 |
+
'default' => '#008ec2',
|
684 |
+
),
|
685 |
+
array(
|
686 |
+
'id' => 'button-border-color',
|
687 |
+
'label' => esc_html__( 'Button border color', 'colorlib-login-customizer' ),
|
688 |
+
'description' => esc_html__( 'This will change the submit button\'s border color property', 'colorlib-login-customizer' ),
|
689 |
+
'type' => 'color',
|
690 |
+
'default' => '#0073aa',
|
691 |
+
),
|
692 |
+
array(
|
693 |
+
'id' => 'button-border-color-hover',
|
694 |
+
'label' => esc_html__( 'Button border hover state', 'colorlib-login-customizer' ),
|
695 |
+
'description' => esc_html__( 'This will change the submit button\'s border property on hover', 'colorlib-login-customizer' ),
|
696 |
+
'type' => 'color',
|
697 |
+
'default' => '#006799',
|
698 |
+
),
|
699 |
+
array(
|
700 |
+
'id' => 'button-shadow',
|
701 |
+
'label' => esc_html__( 'Button shadow', 'colorlib-login-customizer' ),
|
702 |
+
'description' => esc_html__( 'This will change the submit button\'s shadow property. Example: 0 1px 0 #006799', 'colorlib-login-customizer' ),
|
703 |
+
'type' => 'text',
|
704 |
+
'default' => '0 1px 0 #006799',
|
705 |
+
),
|
706 |
+
array(
|
707 |
+
'id' => 'button-text-shadow',
|
708 |
+
'label' => esc_html__( 'Button text shadow', 'colorlib-login-customizer' ),
|
709 |
+
'description' => esc_html__( 'This will change the submit button text\'s shadow property. Example: 0 -1px 1px #006799', 'colorlib-login-customizer' ),
|
710 |
+
'type' => 'text',
|
711 |
+
'default' => '0 -1px 1px #006799',
|
712 |
+
),
|
713 |
+
array(
|
714 |
+
'id' => 'button-color',
|
715 |
+
'label' => esc_html__( 'Button color', 'colorlib-login-customizer' ),
|
716 |
+
'description' => esc_html__( 'This will change the submit button\'s text color property', 'colorlib-login-customizer' ),
|
717 |
+
'type' => 'color',
|
718 |
+
'default' => '#ffffff',
|
719 |
+
),
|
720 |
+
array(
|
721 |
+
'id' => 'link-color',
|
722 |
+
'label' => esc_html__( 'Link color', 'colorlib-login-customizer' ),
|
723 |
+
'description' => esc_html__( 'This will change the text color of links that are underneath the login form', 'colorlib-login-customizer' ),
|
724 |
+
'type' => 'color',
|
725 |
+
'default' => '#555d66',
|
726 |
+
),
|
727 |
+
array(
|
728 |
+
'id' => 'link-color-hover',
|
729 |
+
'label' => esc_html__( 'Link color hover', 'colorlib-login-customizer' ),
|
730 |
+
'description' => esc_html__( 'This will change the text color of links, that are underneath the login form, on hover', 'colorlib-login-customizer' ),
|
731 |
+
'type' => 'color',
|
732 |
+
'default' => '#00a0d2',
|
733 |
+
),
|
734 |
+
array(
|
735 |
+
'id' => 'hide-rememberme',
|
736 |
+
'label' => esc_html__( 'Hide "Remember Me"', 'colorlib-login-customizer' ),
|
737 |
+
'description' => esc_html__( 'Show/Hide the "Remember Me" checkbox', 'colorlib-login-customizer' ),
|
738 |
+
'type' => 'clc-toggle',
|
739 |
+
'default' => 0,
|
740 |
+
),
|
741 |
+
),
|
742 |
+
);
|
743 |
+
|
744 |
+
$settings['clc-custom-css'] = array(
|
745 |
+
'title' => esc_html__( 'Custom CSS', 'colorlib-login-customizer' ),
|
746 |
+
'description' => '',
|
747 |
+
'fields' => array(
|
748 |
+
array(
|
749 |
+
'id' => 'custom-css',
|
750 |
+
'label' => __( 'CSS code', 'colorlib-login-customizer' ),
|
751 |
+
'description' => '',
|
752 |
+
'code_type' => 'text/css',
|
753 |
+
'type' => 'custom-css',
|
754 |
+
'input_attrs' => array(
|
755 |
+
'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4',
|
756 |
+
),
|
757 |
+
),
|
758 |
+
),
|
759 |
+
);
|
760 |
+
|
761 |
+
$settings = apply_filters( $this->parent->_token . '_settings_fields', $settings );
|
762 |
+
|
763 |
+
return $settings;
|
764 |
+
}
|
765 |
+
|
766 |
+
/**
|
767 |
+
* Register settings in the customizer
|
768 |
+
*/
|
769 |
+
public function register_settings( $manager ) {
|
770 |
+
$manager->add_panel(
|
771 |
+
'clc_main_panel',
|
772 |
+
array(
|
773 |
+
'capability' => 'edit_theme_options',
|
774 |
+
'theme_supports' => '',
|
775 |
+
'title' => esc_html__( 'Colorlib Login Customizer', 'colorlib-login-customizer' ),
|
776 |
+
)
|
777 |
+
);
|
778 |
+
|
779 |
+
foreach ( $this->settings as $section => $properties ) {
|
780 |
+
$manager->add_section(
|
781 |
+
'clc_' . $section,
|
782 |
+
array(
|
783 |
+
'title' => $properties['title'],
|
784 |
+
'description' => $properties['description'],
|
785 |
+
'panel' => 'clc_main_panel',
|
786 |
+
)
|
787 |
+
);
|
788 |
+
|
789 |
+
foreach ( $properties['fields'] as $setting ) {
|
790 |
+
$key_name = $this->generate_name( $setting['id'] );
|
791 |
+
$settings_args = array(
|
792 |
+
'type' => 'option',
|
793 |
+
'transport' => 'postMessage',
|
794 |
+
);
|
795 |
+
|
796 |
+
if ( isset( $setting['default'] ) ) {
|
797 |
+
$settings_args['default'] = $setting['default'];
|
798 |
+
}
|
799 |
+
|
800 |
+
$manager->add_setting( $key_name, $settings_args );
|
801 |
+
|
802 |
+
$control_args = array(
|
803 |
+
'label' => $setting['label'],
|
804 |
+
'description' => $setting['description'],
|
805 |
+
'section' => 'clc_' . $section,
|
806 |
+
);
|
807 |
+
|
808 |
+
if ( isset( $setting['active_callback'] ) ) {
|
809 |
+
$control_args['active_callback'] = $setting['active_callback'];
|
810 |
+
}
|
811 |
+
|
812 |
+
if ( isset( $setting['choices'] ) ) {
|
813 |
+
$control_args['choices'] = $setting['choices'];
|
814 |
+
}
|
815 |
+
|
816 |
+
if ( isset( $setting['code_type'] ) ) {
|
817 |
+
$control_args['code_type'] = $setting['code_type'];
|
818 |
+
}
|
819 |
+
|
820 |
+
if ( isset( $setting['input_attrs'] ) ) {
|
821 |
+
$control_args['input_attrs'] = $setting['input_attrs'];
|
822 |
+
}
|
823 |
+
|
824 |
+
switch ( $setting['type'] ) {
|
825 |
+
case 'image':
|
826 |
+
$manager->add_control(
|
827 |
+
new WP_Customize_Image_Control( $manager, $key_name, $control_args )
|
828 |
+
);
|
829 |
+
break;
|
830 |
+
case 'color':
|
831 |
+
$manager->add_control(
|
832 |
+
new Colorlib_Login_Customizer_Control_Color_Picker( $manager, $key_name, $control_args )
|
833 |
+
);
|
834 |
+
break;
|
835 |
+
case 'clc-range-slider':
|
836 |
+
$manager->add_control(
|
837 |
+
new Colorlib_Login_Customizer_Range_Slider_Control( $manager, $key_name, $control_args )
|
838 |
+
);
|
839 |
+
break;
|
840 |
+
case 'clc-templates':
|
841 |
+
$manager->add_control(
|
842 |
+
new Colorlib_Login_Customizer_Template_Control( $manager, $key_name, $control_args )
|
843 |
+
);
|
844 |
+
break;
|
845 |
+
case 'clc-button-group':
|
846 |
+
$manager->add_control(
|
847 |
+
new Colorlib_Login_Customizer_Button_Group_Control( $manager, $key_name, $control_args )
|
848 |
+
);
|
849 |
+
break;
|
850 |
+
case 'clc-column-width':
|
851 |
+
$manager->add_control(
|
852 |
+
new Colorlib_Login_Customizer_Column_Width( $manager, $key_name, $control_args )
|
853 |
+
);
|
854 |
+
break;
|
855 |
+
case 'clc-toggle':
|
856 |
+
$manager->add_control(
|
857 |
+
new Colorlib_Login_Customizer_Control_Toggle( $manager, $key_name, $control_args )
|
858 |
+
);
|
859 |
+
break;
|
860 |
+
case 'custom-css':
|
861 |
+
$manager->add_control(
|
862 |
+
new WP_Customize_Code_Editor_Control( $manager, $key_name, $control_args )
|
863 |
+
);
|
864 |
+
break;
|
865 |
+
default:
|
866 |
+
$manager->add_control( $key_name, $control_args );
|
867 |
+
break;
|
868 |
+
}
|
869 |
+
}
|
870 |
+
}
|
871 |
+
|
872 |
+
}
|
873 |
+
|
874 |
+
/**
|
875 |
+
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
876 |
+
*/
|
877 |
+
public function customize_preview_styles() {
|
878 |
+
wp_enqueue_style( 'colorlib-login-customizer-previewer', esc_url( $this->parent->assets_url ) . 'css/clc-customizer-previewer.css' );
|
879 |
+
wp_enqueue_script( 'colorlib-login-customizer-preview', esc_url( $this->parent->assets_url ) . 'js/clc-preview.js', array( 'customize-preview' ), false, true );
|
880 |
+
}
|
881 |
+
|
882 |
+
/*
|
883 |
+
* Our Customizer script
|
884 |
+
*
|
885 |
+
* Dependencies: Customizer Controls script (core)
|
886 |
+
*/
|
887 |
+
public function customizer_enqueue_scripts() {
|
888 |
+
wp_enqueue_style( 'colorlib-login-customizer-minicolors-styles', esc_url( $this->parent->assets_url ) . 'css/jquery.minicolors.css' );
|
889 |
+
wp_enqueue_style( 'colorlib-login-customizer-styles', esc_url( $this->parent->assets_url ) . 'css/clc-customizer.css' );
|
890 |
+
wp_enqueue_script(
|
891 |
+
'colorlib-login-customizer-minicolors-script', esc_url( $this->parent->assets_url ) . 'js/jquery.minicolors.js', array(
|
892 |
+
'jquery',
|
893 |
+
), false, true
|
894 |
+
);
|
895 |
+
wp_enqueue_script(
|
896 |
+
'colorlib-login-customizer-script', esc_url( $this->parent->assets_url ) . 'js/clc-customizer.js', array(
|
897 |
+
'jquery',
|
898 |
+
'customize-controls',
|
899 |
+
'colorlib-login-customizer-minicolors-script',
|
900 |
+
), false, true
|
901 |
+
);
|
902 |
+
|
903 |
+
wp_localize_script(
|
904 |
+
'colorlib-login-customizer-script', 'CLCUrls', array(
|
905 |
+
'siteurl' => get_option( 'siteurl' ),
|
906 |
+
)
|
907 |
+
);
|
908 |
+
}
|
909 |
+
|
910 |
+
// Active callbacks
|
911 |
+
public function check_two_column_layout( $control ) {
|
912 |
+
$options = get_option( 'clc-options', array() );
|
913 |
+
|
914 |
+
if ( '2' == $control->manager->get_setting( 'clc-options[columns]' )->value() ) {
|
915 |
+
return true;
|
916 |
+
}
|
917 |
+
|
918 |
+
return false;
|
919 |
+
}
|
920 |
+
|
921 |
+
public function check_if_text_logo( $control ) {
|
922 |
+
$options = get_option( 'clc-options', array() );
|
923 |
+
|
924 |
+
if ( 1 == $control->manager->get_setting( 'clc-options[use-text-logo]' )->value() ) {
|
925 |
+
return true;
|
926 |
+
}
|
927 |
+
|
928 |
+
return false;
|
929 |
+
}
|
930 |
+
|
931 |
+
public function check_if_not_text_logo( $control ) {
|
932 |
+
$options = get_option( 'clc-options', array() );
|
933 |
+
|
934 |
+
if ( 1 == $control->manager->get_setting( 'clc-options[use-text-logo]' )->value() ) {
|
935 |
+
return false;
|
936 |
+
}
|
937 |
+
|
938 |
+
return true;
|
939 |
+
}
|
940 |
+
}
|
includes/lib/class-colorlib-login-customizer-settings.php
CHANGED
@@ -1,142 +1,142 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
exit;
|
5 |
-
};
|
6 |
-
|
7 |
-
class Colorlib_Login_Customizer_Settings {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* The single instance of Colorlib_Login_Customizer_Settings.
|
11 |
-
*
|
12 |
-
* @var object
|
13 |
-
* @access private
|
14 |
-
* @since 1.0.0
|
15 |
-
*/
|
16 |
-
private static $_instance = null;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* The main plugin object.
|
20 |
-
*
|
21 |
-
* @var object
|
22 |
-
* @access public
|
23 |
-
* @since 1.0.0
|
24 |
-
*/
|
25 |
-
public $parent = null;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Prefix for plugin settings.
|
29 |
-
*
|
30 |
-
* @var string
|
31 |
-
* @access public
|
32 |
-
* @since 1.0.0
|
33 |
-
*/
|
34 |
-
public $base = '';
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Available settings for plugin.
|
38 |
-
*
|
39 |
-
* @var array
|
40 |
-
* @access public
|
41 |
-
* @since 1.0.0
|
42 |
-
*/
|
43 |
-
public $settings = array();
|
44 |
-
|
45 |
-
public function __construct( $parent ) {
|
46 |
-
$this->parent = $parent;
|
47 |
-
|
48 |
-
// Add settings page to menu
|
49 |
-
add_action( 'admin_menu', array( $this, 'add_menu_item' ) );
|
50 |
-
|
51 |
-
// Add settings link to plugins page
|
52 |
-
add_filter(
|
53 |
-
'plugin_action_links_' . plugin_basename( $this->parent->file ), array(
|
54 |
-
$this,
|
55 |
-
'add_settings_link',
|
56 |
-
)
|
57 |
-
);
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Add settings page to admin menu
|
63 |
-
*
|
64 |
-
* @return void
|
65 |
-
*/
|
66 |
-
public function add_menu_item() {
|
67 |
-
$page = add_menu_page(
|
68 |
-
esc_html__( 'Colorlib Login Customizer', 'colorlib-login-customizer' ), esc_html__( 'Login Customizer', 'colorlib-login-customizer' ), 'manage_options', $this->parent->_token . '_settings', array(
|
69 |
-
$this,
|
70 |
-
'settings_page',
|
71 |
-
), 'dashicons-share-alt'
|
72 |
-
);
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Add settings link to plugin list table
|
77 |
-
*
|
78 |
-
* @param array $links Existing links
|
79 |
-
*
|
80 |
-
* @return array Modified links
|
81 |
-
*/
|
82 |
-
public function add_settings_link( $links ) {
|
83 |
-
$settings_link = '<a href="options-general.php?page=' . $this->parent->_token . '_settings">' . __( 'Settings', 'colorlib-login-customizer' ) . '</a>';
|
84 |
-
array_push( $links, $settings_link );
|
85 |
-
|
86 |
-
return $links;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Load settings page content
|
91 |
-
*
|
92 |
-
* @return void
|
93 |
-
*/
|
94 |
-
public function settings_page() {
|
95 |
-
|
96 |
-
// Build page HTML
|
97 |
-
$html = '<div class="wrap" id="' . $this->parent->_token . '_settings">' . "\n";
|
98 |
-
$html .= '<h2>' . esc_html__( 'Colorlib Login Customizer', 'colorlib-login-customizer' ) . '</h2>' . "\n";
|
99 |
-
$html .= '<p>' . esc_html__( 'Login Customizer plugin allows you to easily customize your login page straight from your WordPress Customizer! You can preview your changes before you save them! Awesome, right?', 'colorlib-login-customizer' ) . '</p>';
|
100 |
-
$html .= '<a href="' . get_admin_url() . 'customize.php?url=' . wp_login_url() . '" id="submit" class="button button-primary">' . __( 'Start Customizing!', 'colorlib-login-customizer' ) . '</a>';
|
101 |
-
$html .= '</div>' . "\n";
|
102 |
-
|
103 |
-
echo $html;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Main Colorlib_Login_Customizer_Settings Instance
|
108 |
-
*
|
109 |
-
* Ensures only one instance of Colorlib_Login_Customizer_Settings is loaded or can be loaded.
|
110 |
-
*
|
111 |
-
* @since 1.0.0
|
112 |
-
* @static
|
113 |
-
* @see Colorlib_Login_Customizer()
|
114 |
-
* @return Main Colorlib_Login_Customizer_Settings instance
|
115 |
-
*/
|
116 |
-
public static function instance( $parent ) {
|
117 |
-
if ( is_null( self::$_instance ) ) {
|
118 |
-
self::$_instance = new self( $parent );
|
119 |
-
}
|
120 |
-
|
121 |
-
return self::$_instance;
|
122 |
-
} // End instance()
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Cloning is forbidden.
|
126 |
-
*
|
127 |
-
* @since 1.0.0
|
128 |
-
*/
|
129 |
-
public function __clone() {
|
130 |
-
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->parent->_version );
|
131 |
-
} // End __clone()
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Unserializing instances of this class is forbidden.
|
135 |
-
*
|
136 |
-
* @since 1.0.0
|
137 |
-
*/
|
138 |
-
public function __wakeup() {
|
139 |
-
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->parent->_version );
|
140 |
-
} // End __wakeup()
|
141 |
-
|
142 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
};
|
6 |
+
|
7 |
+
class Colorlib_Login_Customizer_Settings {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* The single instance of Colorlib_Login_Customizer_Settings.
|
11 |
+
*
|
12 |
+
* @var object
|
13 |
+
* @access private
|
14 |
+
* @since 1.0.0
|
15 |
+
*/
|
16 |
+
private static $_instance = null;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The main plugin object.
|
20 |
+
*
|
21 |
+
* @var object
|
22 |
+
* @access public
|
23 |
+
* @since 1.0.0
|
24 |
+
*/
|
25 |
+
public $parent = null;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Prefix for plugin settings.
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
* @access public
|
32 |
+
* @since 1.0.0
|
33 |
+
*/
|
34 |
+
public $base = '';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Available settings for plugin.
|
38 |
+
*
|
39 |
+
* @var array
|
40 |
+
* @access public
|
41 |
+
* @since 1.0.0
|
42 |
+
*/
|
43 |
+
public $settings = array();
|
44 |
+
|
45 |
+
public function __construct( $parent ) {
|
46 |
+
$this->parent = $parent;
|
47 |
+
|
48 |
+
// Add settings page to menu
|
49 |
+
add_action( 'admin_menu', array( $this, 'add_menu_item' ) );
|
50 |
+
|
51 |
+
// Add settings link to plugins page
|
52 |
+
add_filter(
|
53 |
+
'plugin_action_links_' . plugin_basename( $this->parent->file ), array(
|
54 |
+
$this,
|
55 |
+
'add_settings_link',
|
56 |
+
)
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Add settings page to admin menu
|
63 |
+
*
|
64 |
+
* @return void
|
65 |
+
*/
|
66 |
+
public function add_menu_item() {
|
67 |
+
$page = add_menu_page(
|
68 |
+
esc_html__( 'Colorlib Login Customizer', 'colorlib-login-customizer' ), esc_html__( 'Login Customizer', 'colorlib-login-customizer' ), 'manage_options', $this->parent->_token . '_settings', array(
|
69 |
+
$this,
|
70 |
+
'settings_page',
|
71 |
+
), 'dashicons-share-alt'
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Add settings link to plugin list table
|
77 |
+
*
|
78 |
+
* @param array $links Existing links
|
79 |
+
*
|
80 |
+
* @return array Modified links
|
81 |
+
*/
|
82 |
+
public function add_settings_link( $links ) {
|
83 |
+
$settings_link = '<a href="options-general.php?page=' . $this->parent->_token . '_settings">' . __( 'Settings', 'colorlib-login-customizer' ) . '</a>';
|
84 |
+
array_push( $links, $settings_link );
|
85 |
+
|
86 |
+
return $links;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Load settings page content
|
91 |
+
*
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
public function settings_page() {
|
95 |
+
|
96 |
+
// Build page HTML
|
97 |
+
$html = '<div class="wrap" id="' . $this->parent->_token . '_settings">' . "\n";
|
98 |
+
$html .= '<h2>' . esc_html__( 'Colorlib Login Customizer', 'colorlib-login-customizer' ) . '</h2>' . "\n";
|
99 |
+
$html .= '<p>' . esc_html__( 'Login Customizer plugin allows you to easily customize your login page straight from your WordPress Customizer! You can preview your changes before you save them! Awesome, right?', 'colorlib-login-customizer' ) . '</p>';
|
100 |
+
$html .= '<a href="' . get_admin_url() . 'customize.php?url=' . wp_login_url() . '" id="submit" class="button button-primary">' . __( 'Start Customizing!', 'colorlib-login-customizer' ) . '</a>';
|
101 |
+
$html .= '</div>' . "\n";
|
102 |
+
|
103 |
+
echo $html;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Main Colorlib_Login_Customizer_Settings Instance
|
108 |
+
*
|
109 |
+
* Ensures only one instance of Colorlib_Login_Customizer_Settings is loaded or can be loaded.
|
110 |
+
*
|
111 |
+
* @since 1.0.0
|
112 |
+
* @static
|
113 |
+
* @see Colorlib_Login_Customizer()
|
114 |
+
* @return Main Colorlib_Login_Customizer_Settings instance
|
115 |
+
*/
|
116 |
+
public static function instance( $parent ) {
|
117 |
+
if ( is_null( self::$_instance ) ) {
|
118 |
+
self::$_instance = new self( $parent );
|
119 |
+
}
|
120 |
+
|
121 |
+
return self::$_instance;
|
122 |
+
} // End instance()
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Cloning is forbidden.
|
126 |
+
*
|
127 |
+
* @since 1.0.0
|
128 |
+
*/
|
129 |
+
public function __clone() {
|
130 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->parent->_version );
|
131 |
+
} // End __clone()
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Unserializing instances of this class is forbidden.
|
135 |
+
*
|
136 |
+
* @since 1.0.0
|
137 |
+
*/
|
138 |
+
public function __wakeup() {
|
139 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'colorlib-login-customizer' ), $this->parent->_version );
|
140 |
+
} // End __wakeup()
|
141 |
+
|
142 |
+
}
|
includes/lib/controls/class-colorlib-login-customizer-background-control.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Colorlib_Login_Customizer_Background_Control extends WP_Customize_Image_Control {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* The type of customize control being rendered.
|
7 |
-
*
|
8 |
-
* @since 1.1.0
|
9 |
-
* @access public
|
10 |
-
* @var string
|
11 |
-
*/
|
12 |
-
public $type = 'clc-background';
|
13 |
-
|
14 |
-
public $default_backgrounds;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Colorlib_Login_Customizer_Background_Control constructor.
|
18 |
-
*
|
19 |
-
* @param WP_Customize_Manager $manager
|
20 |
-
* @param string $id
|
21 |
-
* @param array $args
|
22 |
-
*/
|
23 |
-
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
24 |
-
parent::__construct( $manager, $id, $args );
|
25 |
-
$manager->register_control_type( 'Colorlib_Login_Customizer_Background_Control' );
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Add custom parameters to pass to the JS via JSON.
|
30 |
-
*
|
31 |
-
* @since 1.1.0
|
32 |
-
* @access public
|
33 |
-
*/
|
34 |
-
public function json() {
|
35 |
-
$json = parent::json();
|
36 |
-
|
37 |
-
$json['id'] = $this->id;
|
38 |
-
$json['link'] = $this->get_link();
|
39 |
-
$json['gallery'] = $this->generate_gallery();
|
40 |
-
|
41 |
-
return $json;
|
42 |
-
}
|
43 |
-
|
44 |
-
private function generate_gallery() {
|
45 |
-
|
46 |
-
if ( ! is_array( $this->default_backgrounds ) ) {
|
47 |
-
return array();
|
48 |
-
}
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Colorlib_Login_Customizer_Background_Control extends WP_Customize_Image_Control {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The type of customize control being rendered.
|
7 |
+
*
|
8 |
+
* @since 1.1.0
|
9 |
+
* @access public
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
public $type = 'clc-background';
|
13 |
+
|
14 |
+
public $default_backgrounds;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Colorlib_Login_Customizer_Background_Control constructor.
|
18 |
+
*
|
19 |
+
* @param WP_Customize_Manager $manager
|
20 |
+
* @param string $id
|
21 |
+
* @param array $args
|
22 |
+
*/
|
23 |
+
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
24 |
+
parent::__construct( $manager, $id, $args );
|
25 |
+
$manager->register_control_type( 'Colorlib_Login_Customizer_Background_Control' );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Add custom parameters to pass to the JS via JSON.
|
30 |
+
*
|
31 |
+
* @since 1.1.0
|
32 |
+
* @access public
|
33 |
+
*/
|
34 |
+
public function json() {
|
35 |
+
$json = parent::json();
|
36 |
+
|
37 |
+
$json['id'] = $this->id;
|
38 |
+
$json['link'] = $this->get_link();
|
39 |
+
$json['gallery'] = $this->generate_gallery();
|
40 |
+
|
41 |
+
return $json;
|
42 |
+
}
|
43 |
+
|
44 |
+
private function generate_gallery() {
|
45 |
+
|
46 |
+
if ( ! is_array( $this->default_backgrounds ) ) {
|
47 |
+
return array();
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
}
|
includes/lib/controls/class-colorlib-login-customizer-button-group-control.php
CHANGED
@@ -1,117 +1,117 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'WPINC' ) ) {
|
3 |
-
die;
|
4 |
-
}
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Class Colorlib_Login_Customizer_Button_Group_Control
|
8 |
-
*/
|
9 |
-
class Colorlib_Login_Customizer_Button_Group_Control extends WP_Customize_Control {
|
10 |
-
/**
|
11 |
-
* The type of customize control being rendered.
|
12 |
-
*
|
13 |
-
* @since 1.1.0
|
14 |
-
* @access public
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
public $type = 'clc-button-group';
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var string
|
21 |
-
*/
|
22 |
-
public $default = '';
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @var array
|
26 |
-
*/
|
27 |
-
public $choices = array();
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Colorlib_Login_Customizer_Button_Group_Control constructor.
|
31 |
-
*
|
32 |
-
* @since 1.1.0
|
33 |
-
*
|
34 |
-
* @param WP_Customize_Manager $manager
|
35 |
-
* @param string $id
|
36 |
-
* @param array $args
|
37 |
-
*/
|
38 |
-
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
39 |
-
parent::__construct( $manager, $id, $args );
|
40 |
-
$manager->register_control_type( 'Colorlib_Login_Customizer_Button_Group_Control' );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Add custom parameters to pass to the JS via JSON.
|
45 |
-
*
|
46 |
-
* @since 1.1.0
|
47 |
-
* @access public
|
48 |
-
*/
|
49 |
-
public function json() {
|
50 |
-
$json = parent::json();
|
51 |
-
$json['id'] = $this->id;
|
52 |
-
$json['link'] = $this->get_link();
|
53 |
-
$json['value'] = $this->value();
|
54 |
-
$json['default'] = $this->default;
|
55 |
-
$json['choices'] = $this->choices;
|
56 |
-
$json['groupType'] = $this->set_group_type();
|
57 |
-
|
58 |
-
$this->json['inputAttrs'] = '';
|
59 |
-
foreach ( $this->input_attrs as $attr => $value ) {
|
60 |
-
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
61 |
-
}
|
62 |
-
|
63 |
-
return $json;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Set group type
|
68 |
-
*/
|
69 |
-
public function set_group_type() {
|
70 |
-
$arr = array(
|
71 |
-
0 => 'none',
|
72 |
-
1 => 'one',
|
73 |
-
2 => 'two',
|
74 |
-
3 => 'three',
|
75 |
-
4 => 'four',
|
76 |
-
);
|
77 |
-
|
78 |
-
return $arr[ count( $this->choices ) ];
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Display the control's content
|
83 |
-
*/
|
84 |
-
public function content_template() {
|
85 |
-
//@formatter:off ?>
|
86 |
-
<div class="colorlib-login-customizer-control-container">
|
87 |
-
<label>
|
88 |
-
<span class="customize-control-title">
|
89 |
-
{{{ data.label }}}
|
90 |
-
<# if( data.description ){ #>
|
91 |
-
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
92 |
-
<span class="mte-tooltip">
|
93 |
-
{{{ data.description }}}
|
94 |
-
</span>
|
95 |
-
</i>
|
96 |
-
<# } #>
|
97 |
-
</span>
|
98 |
-
</label>
|
99 |
-
<div class="colorlib-login-customizer-control-set">
|
100 |
-
<div class="colorlib-login-customizer-control-group colorlib-login-customizer-group-{{ data.groupType }}">
|
101 |
-
<# for( var i in data.choices ) { #>
|
102 |
-
<a href="#" data-value="{{ data.choices[i].value }}" <# if( data.value == data.choices[i].value ) { #> class="active" <# } #> >
|
103 |
-
<# if( ! _.isUndefined( data.choices[i].icon ) ) { #>
|
104 |
-
<i class="dashicons {{ data.choices[i].icon }}"/>
|
105 |
-
<# } #>
|
106 |
-
|
107 |
-
<# if( ! _.isUndefined( data.choices[i].png ) ) { #>
|
108 |
-
<img src="{{ data.choices[i].png }}" />
|
109 |
-
<# } #>
|
110 |
-
</a>
|
111 |
-
<# } #>
|
112 |
-
</div>
|
113 |
-
</div>
|
114 |
-
</div>
|
115 |
-
<?php //@formatter: on
|
116 |
-
}
|
117 |
-
}
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WPINC' ) ) {
|
3 |
+
die;
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Colorlib_Login_Customizer_Button_Group_Control
|
8 |
+
*/
|
9 |
+
class Colorlib_Login_Customizer_Button_Group_Control extends WP_Customize_Control {
|
10 |
+
/**
|
11 |
+
* The type of customize control being rendered.
|
12 |
+
*
|
13 |
+
* @since 1.1.0
|
14 |
+
* @access public
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
public $type = 'clc-button-group';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
public $default = '';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
public $choices = array();
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Colorlib_Login_Customizer_Button_Group_Control constructor.
|
31 |
+
*
|
32 |
+
* @since 1.1.0
|
33 |
+
*
|
34 |
+
* @param WP_Customize_Manager $manager
|
35 |
+
* @param string $id
|
36 |
+
* @param array $args
|
37 |
+
*/
|
38 |
+
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
39 |
+
parent::__construct( $manager, $id, $args );
|
40 |
+
$manager->register_control_type( 'Colorlib_Login_Customizer_Button_Group_Control' );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Add custom parameters to pass to the JS via JSON.
|
45 |
+
*
|
46 |
+
* @since 1.1.0
|
47 |
+
* @access public
|
48 |
+
*/
|
49 |
+
public function json() {
|
50 |
+
$json = parent::json();
|
51 |
+
$json['id'] = $this->id;
|
52 |
+
$json['link'] = $this->get_link();
|
53 |
+
$json['value'] = $this->value();
|
54 |
+
$json['default'] = $this->default;
|
55 |
+
$json['choices'] = $this->choices;
|
56 |
+
$json['groupType'] = $this->set_group_type();
|
57 |
+
|
58 |
+
$this->json['inputAttrs'] = '';
|
59 |
+
foreach ( $this->input_attrs as $attr => $value ) {
|
60 |
+
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
61 |
+
}
|
62 |
+
|
63 |
+
return $json;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Set group type
|
68 |
+
*/
|
69 |
+
public function set_group_type() {
|
70 |
+
$arr = array(
|
71 |
+
0 => 'none',
|
72 |
+
1 => 'one',
|
73 |
+
2 => 'two',
|
74 |
+
3 => 'three',
|
75 |
+
4 => 'four',
|
76 |
+
);
|
77 |
+
|
78 |
+
return $arr[ count( $this->choices ) ];
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Display the control's content
|
83 |
+
*/
|
84 |
+
public function content_template() {
|
85 |
+
//@formatter:off ?>
|
86 |
+
<div class="colorlib-login-customizer-control-container">
|
87 |
+
<label>
|
88 |
+
<span class="customize-control-title">
|
89 |
+
{{{ data.label }}}
|
90 |
+
<# if( data.description ){ #>
|
91 |
+
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
92 |
+
<span class="mte-tooltip">
|
93 |
+
{{{ data.description }}}
|
94 |
+
</span>
|
95 |
+
</i>
|
96 |
+
<# } #>
|
97 |
+
</span>
|
98 |
+
</label>
|
99 |
+
<div class="colorlib-login-customizer-control-set">
|
100 |
+
<div class="colorlib-login-customizer-control-group colorlib-login-customizer-group-{{ data.groupType }}">
|
101 |
+
<# for( var i in data.choices ) { #>
|
102 |
+
<a href="#" data-value="{{ data.choices[i].value }}" <# if( data.value == data.choices[i].value ) { #> class="active" <# } #> >
|
103 |
+
<# if( ! _.isUndefined( data.choices[i].icon ) ) { #>
|
104 |
+
<i class="dashicons {{ data.choices[i].icon }}"/>
|
105 |
+
<# } #>
|
106 |
+
|
107 |
+
<# if( ! _.isUndefined( data.choices[i].png ) ) { #>
|
108 |
+
<img src="{{ data.choices[i].png }}" />
|
109 |
+
<# } #>
|
110 |
+
</a>
|
111 |
+
<# } #>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
</div>
|
115 |
+
<?php //@formatter: on
|
116 |
+
}
|
117 |
+
}
|
includes/lib/controls/class-colorlib-login-customizer-column-width.php
CHANGED
@@ -1,93 +1,93 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'WPINC' ) ) {
|
3 |
-
die;
|
4 |
-
}
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Class Colorlib_Login_Customizer_Column_Width
|
8 |
-
*/
|
9 |
-
class Colorlib_Login_Customizer_Column_Width extends WP_Customize_Control {
|
10 |
-
/**
|
11 |
-
* The type of customize control being rendered.
|
12 |
-
*
|
13 |
-
* @since 1.1.0
|
14 |
-
* @access public
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
public $type = 'clc-column-width';
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Colorlib_Login_Customizer_Column_Width constructor.
|
21 |
-
*
|
22 |
-
* @since 1.1.0
|
23 |
-
*
|
24 |
-
* @param WP_Customize_Manager $manager
|
25 |
-
* @param string $id
|
26 |
-
* @param array $args
|
27 |
-
*/
|
28 |
-
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
29 |
-
parent::__construct( $manager, $id, $args );
|
30 |
-
$manager->register_control_type( 'Colorlib_Login_Customizer_Column_Width' );
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Add custom parameters to pass to the JS via JSON.
|
35 |
-
*
|
36 |
-
* @since 1.1.0
|
37 |
-
* @access public
|
38 |
-
*/
|
39 |
-
public function json() {
|
40 |
-
$json = parent::json();
|
41 |
-
$json['id'] = $this->id;
|
42 |
-
$json['link'] = $this->get_link();
|
43 |
-
$json['value'] = $this->get_columns();
|
44 |
-
|
45 |
-
return $json;
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Set value
|
50 |
-
*/
|
51 |
-
public function get_columns() {
|
52 |
-
$default = array(
|
53 |
-
'left' => 6,
|
54 |
-
'right' => 6
|
55 |
-
);
|
56 |
-
$current_columns = $this->value();
|
57 |
-
$current_columns = is_array( $current_columns ) ? $current_columns : array();
|
58 |
-
|
59 |
-
return wp_parse_args( $current_columns, $default );
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Display the control's content
|
64 |
-
*/
|
65 |
-
public function content_template() {
|
66 |
-
//@formatter:off ?>
|
67 |
-
<div class="colorlib-login-customizer-control-container">
|
68 |
-
<label>
|
69 |
-
<span class="customize-control-title">
|
70 |
-
{{{ data.label }}}
|
71 |
-
<# if( data.description ){ #>
|
72 |
-
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
73 |
-
<span class="mte-tooltip">
|
74 |
-
{{{ data.description }}}
|
75 |
-
</span>
|
76 |
-
</i>
|
77 |
-
<# } #>
|
78 |
-
</span>
|
79 |
-
</label>
|
80 |
-
<div class="clc-layouts-container-advanced">
|
81 |
-
<div class="clc-layouts-setup">
|
82 |
-
<div class="clc-column clc-column-left col{{data.value.left}}">
|
83 |
-
<a href="#" data-action="left"><span class="dashicons dashicons-arrow-right"></span></a>
|
84 |
-
</div>
|
85 |
-
<div class="clc-column clc-column-right col{{data.value.right}}">
|
86 |
-
<a href="#" data-action="right"><span class="dashicons dashicons-arrow-left"></span></a>
|
87 |
-
</div>
|
88 |
-
</div>
|
89 |
-
</div>
|
90 |
-
</div>
|
91 |
-
<?php //@formatter: on
|
92 |
-
}
|
93 |
-
}
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WPINC' ) ) {
|
3 |
+
die;
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Colorlib_Login_Customizer_Column_Width
|
8 |
+
*/
|
9 |
+
class Colorlib_Login_Customizer_Column_Width extends WP_Customize_Control {
|
10 |
+
/**
|
11 |
+
* The type of customize control being rendered.
|
12 |
+
*
|
13 |
+
* @since 1.1.0
|
14 |
+
* @access public
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
public $type = 'clc-column-width';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Colorlib_Login_Customizer_Column_Width constructor.
|
21 |
+
*
|
22 |
+
* @since 1.1.0
|
23 |
+
*
|
24 |
+
* @param WP_Customize_Manager $manager
|
25 |
+
* @param string $id
|
26 |
+
* @param array $args
|
27 |
+
*/
|
28 |
+
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
29 |
+
parent::__construct( $manager, $id, $args );
|
30 |
+
$manager->register_control_type( 'Colorlib_Login_Customizer_Column_Width' );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Add custom parameters to pass to the JS via JSON.
|
35 |
+
*
|
36 |
+
* @since 1.1.0
|
37 |
+
* @access public
|
38 |
+
*/
|
39 |
+
public function json() {
|
40 |
+
$json = parent::json();
|
41 |
+
$json['id'] = $this->id;
|
42 |
+
$json['link'] = $this->get_link();
|
43 |
+
$json['value'] = $this->get_columns();
|
44 |
+
|
45 |
+
return $json;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Set value
|
50 |
+
*/
|
51 |
+
public function get_columns() {
|
52 |
+
$default = array(
|
53 |
+
'left' => 6,
|
54 |
+
'right' => 6
|
55 |
+
);
|
56 |
+
$current_columns = $this->value();
|
57 |
+
$current_columns = is_array( $current_columns ) ? $current_columns : array();
|
58 |
+
|
59 |
+
return wp_parse_args( $current_columns, $default );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Display the control's content
|
64 |
+
*/
|
65 |
+
public function content_template() {
|
66 |
+
//@formatter:off ?>
|
67 |
+
<div class="colorlib-login-customizer-control-container">
|
68 |
+
<label>
|
69 |
+
<span class="customize-control-title">
|
70 |
+
{{{ data.label }}}
|
71 |
+
<# if( data.description ){ #>
|
72 |
+
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
73 |
+
<span class="mte-tooltip">
|
74 |
+
{{{ data.description }}}
|
75 |
+
</span>
|
76 |
+
</i>
|
77 |
+
<# } #>
|
78 |
+
</span>
|
79 |
+
</label>
|
80 |
+
<div class="clc-layouts-container-advanced">
|
81 |
+
<div class="clc-layouts-setup">
|
82 |
+
<div class="clc-column clc-column-left col{{data.value.left}}">
|
83 |
+
<a href="#" data-action="left"><span class="dashicons dashicons-arrow-right"></span></a>
|
84 |
+
</div>
|
85 |
+
<div class="clc-column clc-column-right col{{data.value.right}}">
|
86 |
+
<a href="#" data-action="right"><span class="dashicons dashicons-arrow-left"></span></a>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
<?php //@formatter: on
|
92 |
+
}
|
93 |
+
}
|
includes/lib/controls/class-colorlib-login-customizer-control-color-picker.php
CHANGED
@@ -1,92 +1,92 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'WPINC' ) ) {
|
3 |
-
die;
|
4 |
-
}
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Class Colorlib_Login_Customizer_Control_Color_Picker
|
8 |
-
*/
|
9 |
-
class Colorlib_Login_Customizer_Control_Color_Picker extends WP_Customize_Control {
|
10 |
-
/**
|
11 |
-
* @since 1.0.0
|
12 |
-
* @var string
|
13 |
-
*/
|
14 |
-
public $type = 'clc-color-picker';
|
15 |
-
/**
|
16 |
-
* @since 1.0.0
|
17 |
-
* @var string
|
18 |
-
*/
|
19 |
-
public $default = '';
|
20 |
-
/**
|
21 |
-
* @since 1.0.0
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
public $mode = '';
|
25 |
-
/**
|
26 |
-
* @since 1.3.4
|
27 |
-
* @var bool
|
28 |
-
*/
|
29 |
-
public $lite = false;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Colorlib_Login_Customizer_Control_Color_Picker constructor.
|
33 |
-
*
|
34 |
-
* @since 1.0.0
|
35 |
-
*
|
36 |
-
* @param WP_Customize_Manager $manager
|
37 |
-
* @param string $id
|
38 |
-
* @param array $args
|
39 |
-
*/
|
40 |
-
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
41 |
-
parent::__construct( $manager, $id, $args );
|
42 |
-
$manager->register_control_type( 'Colorlib_Login_Customizer_Control_Color_Picker' );
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Add custom parameters to pass to the JS via JSON.
|
47 |
-
*
|
48 |
-
* @since 1.2.0
|
49 |
-
* @access public
|
50 |
-
*/
|
51 |
-
public function json() {
|
52 |
-
$json = parent::json();
|
53 |
-
|
54 |
-
$json['id'] = $this->id;
|
55 |
-
$json['link'] = $this->get_link();
|
56 |
-
$json['value'] = $this->value();
|
57 |
-
$json['default'] = $this->setting->default;
|
58 |
-
$json['mode'] = '' !== $this->mode ? $this->mode : 'hex';
|
59 |
-
$json['lite'] = $this->lite;
|
60 |
-
|
61 |
-
return $json;
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Display the control's content
|
66 |
-
*/
|
67 |
-
public function content_template() {
|
68 |
-
//@formatter:off ?>
|
69 |
-
<label <# if( data.lite ) { #>class="lite"<# } #>>
|
70 |
-
<input class="clc-color-picker" type="text" <# if( data.default ){ #>placeholder="{{ data.default }}"<# } #> <# if(data.value){ #> value="{{ data.value }}" <# } #> />
|
71 |
-
<span class="customize-control-title clc-color-picker-title">
|
72 |
-
{{{ data.label }}}
|
73 |
-
<# if( data.default ){ #>
|
74 |
-
<a href="#" data-default="{{ data.default }}" class="clc-color-picker-default"><?php echo esc_html__( '(clear)', 'colorlib-login-customizer' ); ?></a>
|
75 |
-
<# } #>
|
76 |
-
|
77 |
-
<# if( data.description ){ #>
|
78 |
-
<span class="clc-color-picker-description">{{{ data.description }}}</span>
|
79 |
-
<# } #>
|
80 |
-
</span>
|
81 |
-
</label>
|
82 |
-
<?php //@formatter:on
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Empty, as it should be
|
87 |
-
*
|
88 |
-
* @since 1.0.0
|
89 |
-
*/
|
90 |
-
public function render_content() {
|
91 |
-
}
|
92 |
-
}
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WPINC' ) ) {
|
3 |
+
die;
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Colorlib_Login_Customizer_Control_Color_Picker
|
8 |
+
*/
|
9 |
+
class Colorlib_Login_Customizer_Control_Color_Picker extends WP_Customize_Control {
|
10 |
+
/**
|
11 |
+
* @since 1.0.0
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
public $type = 'clc-color-picker';
|
15 |
+
/**
|
16 |
+
* @since 1.0.0
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
public $default = '';
|
20 |
+
/**
|
21 |
+
* @since 1.0.0
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
public $mode = '';
|
25 |
+
/**
|
26 |
+
* @since 1.3.4
|
27 |
+
* @var bool
|
28 |
+
*/
|
29 |
+
public $lite = false;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Colorlib_Login_Customizer_Control_Color_Picker constructor.
|
33 |
+
*
|
34 |
+
* @since 1.0.0
|
35 |
+
*
|
36 |
+
* @param WP_Customize_Manager $manager
|
37 |
+
* @param string $id
|
38 |
+
* @param array $args
|
39 |
+
*/
|
40 |
+
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
41 |
+
parent::__construct( $manager, $id, $args );
|
42 |
+
$manager->register_control_type( 'Colorlib_Login_Customizer_Control_Color_Picker' );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Add custom parameters to pass to the JS via JSON.
|
47 |
+
*
|
48 |
+
* @since 1.2.0
|
49 |
+
* @access public
|
50 |
+
*/
|
51 |
+
public function json() {
|
52 |
+
$json = parent::json();
|
53 |
+
|
54 |
+
$json['id'] = $this->id;
|
55 |
+
$json['link'] = $this->get_link();
|
56 |
+
$json['value'] = $this->value();
|
57 |
+
$json['default'] = $this->setting->default;
|
58 |
+
$json['mode'] = '' !== $this->mode ? $this->mode : 'hex';
|
59 |
+
$json['lite'] = $this->lite;
|
60 |
+
|
61 |
+
return $json;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Display the control's content
|
66 |
+
*/
|
67 |
+
public function content_template() {
|
68 |
+
//@formatter:off ?>
|
69 |
+
<label <# if( data.lite ) { #>class="lite"<# } #>>
|
70 |
+
<input class="clc-color-picker" type="text" <# if( data.default ){ #>placeholder="{{ data.default }}"<# } #> <# if(data.value){ #> value="{{ data.value }}" <# } #> />
|
71 |
+
<span class="customize-control-title clc-color-picker-title">
|
72 |
+
{{{ data.label }}}
|
73 |
+
<# if( data.default ){ #>
|
74 |
+
<a href="#" data-default="{{ data.default }}" class="clc-color-picker-default"><?php echo esc_html__( '(clear)', 'colorlib-login-customizer' ); ?></a>
|
75 |
+
<# } #>
|
76 |
+
|
77 |
+
<# if( data.description ){ #>
|
78 |
+
<span class="clc-color-picker-description">{{{ data.description }}}</span>
|
79 |
+
<# } #>
|
80 |
+
</span>
|
81 |
+
</label>
|
82 |
+
<?php //@formatter:on
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Empty, as it should be
|
87 |
+
*
|
88 |
+
* @since 1.0.0
|
89 |
+
*/
|
90 |
+
public function render_content() {
|
91 |
+
}
|
92 |
+
}
|
includes/lib/controls/class-colorlib-login-customizer-control-toggle.php
CHANGED
@@ -1,81 +1,81 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'WPINC' ) ) {
|
3 |
-
die;
|
4 |
-
}
|
5 |
-
|
6 |
-
class Colorlib_Login_Customizer_Control_Toggle extends WP_Customize_Control {
|
7 |
-
/**
|
8 |
-
* The type of customize control being rendered.
|
9 |
-
*
|
10 |
-
* @since 1.0.0
|
11 |
-
* @access public
|
12 |
-
* @var string
|
13 |
-
*/
|
14 |
-
public $type = 'clc-toggle';
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Colorlib_Login_Customizer_Control_Toggle constructor.
|
18 |
-
*
|
19 |
-
* @param WP_Customize_Manager $manager
|
20 |
-
* @param string $id
|
21 |
-
* @param array $args
|
22 |
-
*/
|
23 |
-
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
24 |
-
parent::__construct( $manager, $id, $args );
|
25 |
-
$manager->register_control_type( 'Colorlib_Login_Customizer_Control_Toggle' );
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Add custom parameters to pass to the JS via JSON.
|
30 |
-
*
|
31 |
-
* @since 1.0.0
|
32 |
-
* @access public
|
33 |
-
*/
|
34 |
-
public function json() {
|
35 |
-
$json = parent::json();
|
36 |
-
|
37 |
-
$json['id'] = $this->id;
|
38 |
-
$json['link'] = $this->get_link();
|
39 |
-
$json['value'] = $this->value();
|
40 |
-
|
41 |
-
return $json;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Empty, as it should.
|
46 |
-
*
|
47 |
-
* @since 1.0.0
|
48 |
-
* @access public
|
49 |
-
* @return void
|
50 |
-
*/
|
51 |
-
public function render_content() {}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @since 1.0.0
|
55 |
-
* @access public
|
56 |
-
*/
|
57 |
-
public function content_template() {
|
58 |
-
//@formatter:off
|
59 |
-
?>
|
60 |
-
<div class="checkbox_switch">
|
61 |
-
<span class="customize-control-title onoffswitch_label">
|
62 |
-
{{{ data.label }}}
|
63 |
-
<# if( data.description ){ #>
|
64 |
-
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
65 |
-
<span class="clc-tooltip">
|
66 |
-
{{{ data.description }}}
|
67 |
-
</span>
|
68 |
-
</i>
|
69 |
-
<# } #>
|
70 |
-
</span>
|
71 |
-
<div class="onoffswitch">
|
72 |
-
<input type="checkbox" id="{{{ data.id }}}" name="{{{ data.id }}}" class="onoffswitch-checkbox" value="{{{ data.value }}}" {{{ data.link }}} <# if( data.value ) { #> checked="checked" <# } #> >
|
73 |
-
<label class="onoffswitch-label" for="{{{ data.id }}}"></label>
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
<?php
|
77 |
-
//@formatter:on
|
78 |
-
}
|
79 |
-
|
80 |
-
}
|
81 |
-
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WPINC' ) ) {
|
3 |
+
die;
|
4 |
+
}
|
5 |
+
|
6 |
+
class Colorlib_Login_Customizer_Control_Toggle extends WP_Customize_Control {
|
7 |
+
/**
|
8 |
+
* The type of customize control being rendered.
|
9 |
+
*
|
10 |
+
* @since 1.0.0
|
11 |
+
* @access public
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
public $type = 'clc-toggle';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Colorlib_Login_Customizer_Control_Toggle constructor.
|
18 |
+
*
|
19 |
+
* @param WP_Customize_Manager $manager
|
20 |
+
* @param string $id
|
21 |
+
* @param array $args
|
22 |
+
*/
|
23 |
+
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
24 |
+
parent::__construct( $manager, $id, $args );
|
25 |
+
$manager->register_control_type( 'Colorlib_Login_Customizer_Control_Toggle' );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Add custom parameters to pass to the JS via JSON.
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
* @access public
|
33 |
+
*/
|
34 |
+
public function json() {
|
35 |
+
$json = parent::json();
|
36 |
+
|
37 |
+
$json['id'] = $this->id;
|
38 |
+
$json['link'] = $this->get_link();
|
39 |
+
$json['value'] = $this->value();
|
40 |
+
|
41 |
+
return $json;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Empty, as it should.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
* @access public
|
49 |
+
* @return void
|
50 |
+
*/
|
51 |
+
public function render_content() {}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @since 1.0.0
|
55 |
+
* @access public
|
56 |
+
*/
|
57 |
+
public function content_template() {
|
58 |
+
//@formatter:off
|
59 |
+
?>
|
60 |
+
<div class="checkbox_switch">
|
61 |
+
<span class="customize-control-title onoffswitch_label">
|
62 |
+
{{{ data.label }}}
|
63 |
+
<# if( data.description ){ #>
|
64 |
+
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
65 |
+
<span class="clc-tooltip">
|
66 |
+
{{{ data.description }}}
|
67 |
+
</span>
|
68 |
+
</i>
|
69 |
+
<# } #>
|
70 |
+
</span>
|
71 |
+
<div class="onoffswitch">
|
72 |
+
<input type="checkbox" id="{{{ data.id }}}" name="{{{ data.id }}}" class="onoffswitch-checkbox" value="{{{ data.value }}}" {{{ data.link }}} <# if( data.value ) { #> checked="checked" <# } #> >
|
73 |
+
<label class="onoffswitch-label" for="{{{ data.id }}}"></label>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
<?php
|
77 |
+
//@formatter:on
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
81 |
+
|
includes/lib/controls/class-colorlib-login-customizer-range-slider-control.php
CHANGED
@@ -1,112 +1,112 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'WPINC' ) ) {
|
3 |
-
die;
|
4 |
-
}
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Slider control
|
8 |
-
*
|
9 |
-
* @since 1.0.0
|
10 |
-
* @access public
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Colorlib_Login_Customizer_Range_Slider_Control extends WP_Customize_Control {
|
14 |
-
/**
|
15 |
-
* The type of customize control being rendered.
|
16 |
-
*
|
17 |
-
* @since 1.0.0
|
18 |
-
* @access public
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
public $type = 'clc-range-slider';
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Provide a default
|
25 |
-
*
|
26 |
-
* @var string
|
27 |
-
*/
|
28 |
-
public $default = '';
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Epsilon_Control_Slider constructor.
|
32 |
-
*
|
33 |
-
* @param WP_Customize_Manager $manager
|
34 |
-
* @param string $id
|
35 |
-
* @param array $args
|
36 |
-
*/
|
37 |
-
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
38 |
-
$manager->register_section_type( 'Colorlib_Login_Customizer_Range_Slider_Control' );
|
39 |
-
parent::__construct( $manager, $id, $args );
|
40 |
-
if ( isset( $args['default'] ) ) {
|
41 |
-
$this->default = $args['default'];
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Enqueue scripts/styles.
|
47 |
-
*
|
48 |
-
* @since 1.0.0
|
49 |
-
* @access public
|
50 |
-
* @return void
|
51 |
-
*/
|
52 |
-
public function enqueue() {
|
53 |
-
wp_enqueue_script( 'jquery-ui' );
|
54 |
-
wp_enqueue_script( 'jquery-ui-slider' );
|
55 |
-
}
|
56 |
-
|
57 |
-
public function get_value() {
|
58 |
-
$value = $this->value();
|
59 |
-
if ( ! $value && isset( $this->default ) ) {
|
60 |
-
return $this->default;
|
61 |
-
}
|
62 |
-
|
63 |
-
return $value;
|
64 |
-
}
|
65 |
-
|
66 |
-
public function to_json() {
|
67 |
-
|
68 |
-
$default_choices = array(
|
69 |
-
'min' => 1,
|
70 |
-
'max' => 10,
|
71 |
-
'step' => 1,
|
72 |
-
);
|
73 |
-
|
74 |
-
$this->choices = wp_parse_args( $this->choices, $default_choices );
|
75 |
-
|
76 |
-
parent::to_json();
|
77 |
-
$this->json['value'] = $this->get_value();
|
78 |
-
$this->json['id'] = $this->id;
|
79 |
-
$this->json['link'] = $this->get_link();
|
80 |
-
$this->json['choices'] = $this->choices;
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Displays the control content.
|
85 |
-
*
|
86 |
-
* @since 1.0.0
|
87 |
-
* @access public
|
88 |
-
* @return void
|
89 |
-
*/
|
90 |
-
public function render_content() {
|
91 |
-
}
|
92 |
-
|
93 |
-
public function content_template() {
|
94 |
-
?>
|
95 |
-
<label>
|
96 |
-
<span class="customize-control-title">
|
97 |
-
<# if ( data.label != '' ){ #>
|
98 |
-
{{ data.label }}
|
99 |
-
<# } #>
|
100 |
-
<# if ( data.description != '' ){ #>
|
101 |
-
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
102 |
-
<span class="clc-tooltip">{{ data.description }}</span>
|
103 |
-
</i>
|
104 |
-
<# } #>
|
105 |
-
</span>
|
106 |
-
<input type="text" class="clc-slider" id="input_{{ data.id }}" value="{{ data.value }}"/>
|
107 |
-
</label>
|
108 |
-
<div id="slider_{{ data.id }}" class="clc-slider"></div>
|
109 |
-
<?php
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WPINC' ) ) {
|
3 |
+
die;
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Slider control
|
8 |
+
*
|
9 |
+
* @since 1.0.0
|
10 |
+
* @access public
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Colorlib_Login_Customizer_Range_Slider_Control extends WP_Customize_Control {
|
14 |
+
/**
|
15 |
+
* The type of customize control being rendered.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
+
* @access public
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
public $type = 'clc-range-slider';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Provide a default
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $default = '';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Epsilon_Control_Slider constructor.
|
32 |
+
*
|
33 |
+
* @param WP_Customize_Manager $manager
|
34 |
+
* @param string $id
|
35 |
+
* @param array $args
|
36 |
+
*/
|
37 |
+
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
38 |
+
$manager->register_section_type( 'Colorlib_Login_Customizer_Range_Slider_Control' );
|
39 |
+
parent::__construct( $manager, $id, $args );
|
40 |
+
if ( isset( $args['default'] ) ) {
|
41 |
+
$this->default = $args['default'];
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Enqueue scripts/styles.
|
47 |
+
*
|
48 |
+
* @since 1.0.0
|
49 |
+
* @access public
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
public function enqueue() {
|
53 |
+
wp_enqueue_script( 'jquery-ui' );
|
54 |
+
wp_enqueue_script( 'jquery-ui-slider' );
|
55 |
+
}
|
56 |
+
|
57 |
+
public function get_value() {
|
58 |
+
$value = $this->value();
|
59 |
+
if ( ! $value && isset( $this->default ) ) {
|
60 |
+
return $this->default;
|
61 |
+
}
|
62 |
+
|
63 |
+
return $value;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function to_json() {
|
67 |
+
|
68 |
+
$default_choices = array(
|
69 |
+
'min' => 1,
|
70 |
+
'max' => 10,
|
71 |
+
'step' => 1,
|
72 |
+
);
|
73 |
+
|
74 |
+
$this->choices = wp_parse_args( $this->choices, $default_choices );
|
75 |
+
|
76 |
+
parent::to_json();
|
77 |
+
$this->json['value'] = $this->get_value();
|
78 |
+
$this->json['id'] = $this->id;
|
79 |
+
$this->json['link'] = $this->get_link();
|
80 |
+
$this->json['choices'] = $this->choices;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Displays the control content.
|
85 |
+
*
|
86 |
+
* @since 1.0.0
|
87 |
+
* @access public
|
88 |
+
* @return void
|
89 |
+
*/
|
90 |
+
public function render_content() {
|
91 |
+
}
|
92 |
+
|
93 |
+
public function content_template() {
|
94 |
+
?>
|
95 |
+
<label>
|
96 |
+
<span class="customize-control-title">
|
97 |
+
<# if ( data.label != '' ){ #>
|
98 |
+
{{ data.label }}
|
99 |
+
<# } #>
|
100 |
+
<# if ( data.description != '' ){ #>
|
101 |
+
<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom; position: relative;">
|
102 |
+
<span class="clc-tooltip">{{ data.description }}</span>
|
103 |
+
</i>
|
104 |
+
<# } #>
|
105 |
+
</span>
|
106 |
+
<input type="text" class="clc-slider" id="input_{{ data.id }}" value="{{ data.value }}"/>
|
107 |
+
</label>
|
108 |
+
<div id="slider_{{ data.id }}" class="clc-slider"></div>
|
109 |
+
<?php
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
includes/lib/controls/class-colorlib-login-customizer-template-control.php
CHANGED
@@ -1,137 +1,137 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Exit if accessed directly.
|
4 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
-
exit;
|
6 |
-
}
|
7 |
-
|
8 |
-
// Exit if WP_Customize_Control does not exsist.
|
9 |
-
if ( ! class_exists( 'WP_Customize_Control' ) ) {
|
10 |
-
return null;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* This class is for the gallery selector in the Customizer.
|
15 |
-
*
|
16 |
-
* @access public
|
17 |
-
*/
|
18 |
-
class Colorlib_Login_Customizer_Template_Control extends WP_Customize_Control {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* The control type.
|
22 |
-
*
|
23 |
-
* @access public
|
24 |
-
* @var string
|
25 |
-
*/
|
26 |
-
public $type = 'clc-templates';
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Colorlib_Login_Customizer_Template_Control constructor.
|
30 |
-
*
|
31 |
-
* @param WP_Customize_Manager $manager
|
32 |
-
* @param string $id
|
33 |
-
* @param array $args
|
34 |
-
*/
|
35 |
-
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
36 |
-
$manager->register_section_type( 'Colorlib_Login_Customizer_Template_Control' );
|
37 |
-
parent::__construct( $manager, $id, $args );
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Add custom parameters to pass to the JS via JSON.
|
42 |
-
*
|
43 |
-
* @access public
|
44 |
-
* @since 1.1.7
|
45 |
-
* @return void
|
46 |
-
*/
|
47 |
-
public function to_json() {
|
48 |
-
parent::to_json();
|
49 |
-
|
50 |
-
$arrays = $this->generate_arrays();
|
51 |
-
|
52 |
-
// The setting value.
|
53 |
-
$this->json['id'] = $this->id;
|
54 |
-
$this->json['value'] = $this->value();
|
55 |
-
$this->json['link'] = $this->get_link();
|
56 |
-
$this->json['choices'] = $arrays['choices'];
|
57 |
-
$this->json['options'] = $arrays['options'];
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
private function generate_name( $id ) {
|
62 |
-
return 'clc-options[' . $id . ']';
|
63 |
-
}
|
64 |
-
|
65 |
-
public function generate_arrays() {
|
66 |
-
$arrays = array(
|
67 |
-
'choices' => array(),
|
68 |
-
'options' => array(),
|
69 |
-
);
|
70 |
-
|
71 |
-
foreach ( $this->choices as $key => $choice ) {
|
72 |
-
$arrays['choices'][ $key ] = $choice['url'];
|
73 |
-
$arrays['options'][ $key ] = array();
|
74 |
-
foreach ( $choice['options'] as $option_key => $option_value ) {
|
75 |
-
$name = $this->generate_name( $option_key );
|
76 |
-
$arrays['options'][ $key ][ $option_key ] = array(
|
77 |
-
'name' => $name,
|
78 |
-
'value' => $option_value
|
79 |
-
);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
return $arrays;
|
84 |
-
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Don't render the content via PHP. This control is handled with a JS template.
|
89 |
-
*
|
90 |
-
* @access public
|
91 |
-
* @since 1.0.0
|
92 |
-
* @return void
|
93 |
-
*/
|
94 |
-
public function render_content() {}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* An Underscore (JS) template for this control's content.
|
98 |
-
*
|
99 |
-
* Class variables for this control class are available in the `data` JS object;
|
100 |
-
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
101 |
-
*
|
102 |
-
* @see WP_Customize_Control::print_template()
|
103 |
-
*
|
104 |
-
* @access protected
|
105 |
-
* @since 1.1.7
|
106 |
-
* @return void
|
107 |
-
*/
|
108 |
-
protected function content_template() {
|
109 |
-
?>
|
110 |
-
|
111 |
-
<# if ( ! data.choices ) {
|
112 |
-
return;
|
113 |
-
} #>
|
114 |
-
|
115 |
-
<# if ( data.description ) { #>
|
116 |
-
<span class="customize-control-description">{{ data.description }}</span>
|
117 |
-
<# } #>
|
118 |
-
|
119 |
-
<div id="colorlib-login-customizer-templates" class="colorlib-login-customizer-templates">
|
120 |
-
|
121 |
-
<# for ( choice in data.choices ) { #>
|
122 |
-
|
123 |
-
<input type="radio" value="{{ choice }}" name="_customize-{{ data.id }}" id="{{ data.id }}{{ choice }}" class="colorlib-login-customizer-templates__input" />
|
124 |
-
|
125 |
-
<label for="{{ data.id }}{{ choice }}" class="colorlib-login-customizer-templates__label">
|
126 |
-
<div class="colorlib-login-customizer-templates__intrinsic">
|
127 |
-
<div class="colorlib-login-customizer-templates__screenshot" style="background-image: url( {{ data.choices[ choice ] }} );"></div>
|
128 |
-
</div>
|
129 |
-
</label>
|
130 |
-
|
131 |
-
<# } #>
|
132 |
-
|
133 |
-
</div>
|
134 |
-
|
135 |
-
<?php
|
136 |
-
}
|
137 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Exit if accessed directly.
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
// Exit if WP_Customize_Control does not exsist.
|
9 |
+
if ( ! class_exists( 'WP_Customize_Control' ) ) {
|
10 |
+
return null;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* This class is for the gallery selector in the Customizer.
|
15 |
+
*
|
16 |
+
* @access public
|
17 |
+
*/
|
18 |
+
class Colorlib_Login_Customizer_Template_Control extends WP_Customize_Control {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* The control type.
|
22 |
+
*
|
23 |
+
* @access public
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
public $type = 'clc-templates';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Colorlib_Login_Customizer_Template_Control constructor.
|
30 |
+
*
|
31 |
+
* @param WP_Customize_Manager $manager
|
32 |
+
* @param string $id
|
33 |
+
* @param array $args
|
34 |
+
*/
|
35 |
+
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
36 |
+
$manager->register_section_type( 'Colorlib_Login_Customizer_Template_Control' );
|
37 |
+
parent::__construct( $manager, $id, $args );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Add custom parameters to pass to the JS via JSON.
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @since 1.1.7
|
45 |
+
* @return void
|
46 |
+
*/
|
47 |
+
public function to_json() {
|
48 |
+
parent::to_json();
|
49 |
+
|
50 |
+
$arrays = $this->generate_arrays();
|
51 |
+
|
52 |
+
// The setting value.
|
53 |
+
$this->json['id'] = $this->id;
|
54 |
+
$this->json['value'] = $this->value();
|
55 |
+
$this->json['link'] = $this->get_link();
|
56 |
+
$this->json['choices'] = $arrays['choices'];
|
57 |
+
$this->json['options'] = $arrays['options'];
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
private function generate_name( $id ) {
|
62 |
+
return 'clc-options[' . $id . ']';
|
63 |
+
}
|
64 |
+
|
65 |
+
public function generate_arrays() {
|
66 |
+
$arrays = array(
|
67 |
+
'choices' => array(),
|
68 |
+
'options' => array(),
|
69 |
+
);
|
70 |
+
|
71 |
+
foreach ( $this->choices as $key => $choice ) {
|
72 |
+
$arrays['choices'][ $key ] = $choice['url'];
|
73 |
+
$arrays['options'][ $key ] = array();
|
74 |
+
foreach ( $choice['options'] as $option_key => $option_value ) {
|
75 |
+
$name = $this->generate_name( $option_key );
|
76 |
+
$arrays['options'][ $key ][ $option_key ] = array(
|
77 |
+
'name' => $name,
|
78 |
+
'value' => $option_value
|
79 |
+
);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
return $arrays;
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Don't render the content via PHP. This control is handled with a JS template.
|
89 |
+
*
|
90 |
+
* @access public
|
91 |
+
* @since 1.0.0
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
public function render_content() {}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* An Underscore (JS) template for this control's content.
|
98 |
+
*
|
99 |
+
* Class variables for this control class are available in the `data` JS object;
|
100 |
+
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
101 |
+
*
|
102 |
+
* @see WP_Customize_Control::print_template()
|
103 |
+
*
|
104 |
+
* @access protected
|
105 |
+
* @since 1.1.7
|
106 |
+
* @return void
|
107 |
+
*/
|
108 |
+
protected function content_template() {
|
109 |
+
?>
|
110 |
+
|
111 |
+
<# if ( ! data.choices ) {
|
112 |
+
return;
|
113 |
+
} #>
|
114 |
+
|
115 |
+
<# if ( data.description ) { #>
|
116 |
+
<span class="customize-control-description">{{ data.description }}</span>
|
117 |
+
<# } #>
|
118 |
+
|
119 |
+
<div id="colorlib-login-customizer-templates" class="colorlib-login-customizer-templates">
|
120 |
+
|
121 |
+
<# for ( choice in data.choices ) { #>
|
122 |
+
|
123 |
+
<input type="radio" value="{{ choice }}" name="_customize-{{ data.id }}" id="{{ data.id }}{{ choice }}" class="colorlib-login-customizer-templates__input" />
|
124 |
+
|
125 |
+
<label for="{{ data.id }}{{ choice }}" class="colorlib-login-customizer-templates__label">
|
126 |
+
<div class="colorlib-login-customizer-templates__intrinsic">
|
127 |
+
<div class="colorlib-login-customizer-templates__screenshot" style="background-image: url( {{ data.choices[ choice ] }} );"></div>
|
128 |
+
</div>
|
129 |
+
</label>
|
130 |
+
|
131 |
+
<# } #>
|
132 |
+
|
133 |
+
</div>
|
134 |
+
|
135 |
+
<?php
|
136 |
+
}
|
137 |
+
}
|
includes/login-template.php
CHANGED
@@ -1,217 +1,221 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Template Name: Colorlib Login Customizer Template
|
4 |
-
*
|
5 |
-
* Template to display the WordPress login form in the Customizer.
|
6 |
-
* This is essentially a stripped down version of wp-login.php, though not accessible from outside the Customizer.
|
7 |
-
*
|
8 |
-
*/
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Output the login page header.
|
13 |
-
*
|
14 |
-
* @param string $title Optional. WordPress login Page title to display in the `<title>` element.
|
15 |
-
* Default 'Log In'.
|
16 |
-
* @param string $message Optional. Message to display in header. Default empty.
|
17 |
-
* @param WP_Error $wp_error Optional. The error to pass. Default empty.
|
18 |
-
*/
|
19 |
-
function clc_login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
|
20 |
-
|
21 |
-
global $error, $action;
|
22 |
-
|
23 |
-
if ( empty( $wp_error ) ) {
|
24 |
-
$wp_error = new WP_Error();
|
25 |
-
}
|
26 |
-
|
27 |
-
$login_title = get_bloginfo( 'name', 'display' );
|
28 |
-
|
29 |
-
/* translators: Login screen title. 1: Login screen name, 2: Network or site name */
|
30 |
-
$login_title = sprintf( __( '%1$s ‹ %2$s — WordPress', 'colorlib-login-customizer' ), $title, $login_title );
|
31 |
-
/**
|
32 |
-
* Filters the title tag content for login page.
|
33 |
-
*
|
34 |
-
* @since 4.9.0
|
35 |
-
*
|
36 |
-
* @param string $login_title The page title, with extra context added.
|
37 |
-
* @param string $title The original page title.
|
38 |
-
*/
|
39 |
-
$login_title = apply_filters( 'login_title', $login_title, $title );
|
40 |
-
?><!DOCTYPE html>
|
41 |
-
<head>
|
42 |
-
<title><?php echo esc_attr( $login_title ); ?></title>
|
43 |
-
<?php
|
44 |
-
wp_enqueue_style( 'login' );
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Enqueue scripts and styles for the login page.
|
48 |
-
*
|
49 |
-
* @since 3.1.0
|
50 |
-
*/
|
51 |
-
do_action( 'login_enqueue_scripts' );
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Fires in the login page header after scripts are enqueued.
|
55 |
-
*
|
56 |
-
* @since 2.1.0
|
57 |
-
*/
|
58 |
-
do_action( 'login_head' );
|
59 |
-
?>
|
60 |
-
</head>
|
61 |
-
|
62 |
-
<?php
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Fires when the login form is initialized.
|
67 |
-
*
|
68 |
-
* @since 3.2.0
|
69 |
-
*/
|
70 |
-
do_action( 'login_init' );
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Fires before a specified login form action.
|
74 |
-
*
|
75 |
-
* The dynamic portion of the hook name, `$action`, refers to the action
|
76 |
-
* that brought the visitor to the login form. Actions include 'postpass',
|
77 |
-
* 'logout', 'lostpassword', etc.
|
78 |
-
*
|
79 |
-
* @since 2.8.0
|
80 |
-
*/
|
81 |
-
do_action( 'login_form_login' );
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Filters the separator used between login form navigation links.
|
85 |
-
*/
|
86 |
-
$login_link_separator = apply_filters( 'login_link_separator', ' | ' );
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Filters the login page errors.
|
90 |
-
*
|
91 |
-
* @since 3.6.0
|
92 |
-
*
|
93 |
-
* @param object $errors WP Error object.
|
94 |
-
* @param string $redirect_to Redirect destination URL.
|
95 |
-
*/
|
96 |
-
clc_login_header( __( 'Log In', 'colorlib-login-customizer' ), '', '' );
|
97 |
-
|
98 |
-
$login_header_url = __( 'https://wordpress.org/', 'colorlib-login-customizer' );
|
99 |
-
$login_header_title = __( 'Powered by WordPress', 'colorlib-login-customizer' );
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Filters link URL of the header logo above login form.
|
103 |
-
*
|
104 |
-
* @since 2.1.0
|
105 |
-
*
|
106 |
-
* @param string $login_header_url Login header logo URL.
|
107 |
-
*/
|
108 |
-
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Filters the title attribute of the header logo above login form.
|
112 |
-
*
|
113 |
-
* @since 2.1.0
|
114 |
-
*
|
115 |
-
* @param string $login_header_title Login header logo title attribute.
|
116 |
-
*/
|
117 |
-
$login_header_title = apply_filters( 'login_headertitle', $login_header_title );
|
118 |
-
|
119 |
-
/*
|
120 |
-
* To match the URL/title set above, Multisite sites have the blog name,
|
121 |
-
* while single sites get the header title.
|
122 |
-
*/
|
123 |
-
if ( is_multisite() ) {
|
124 |
-
$login_header_text = get_bloginfo( 'name', 'display' );
|
125 |
-
} else {
|
126 |
-
$login_header_text = $login_header_title;
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Filters the login page body classes.
|
131 |
-
*
|
132 |
-
* @since 3.5.0
|
133 |
-
*
|
134 |
-
* @param array $classes An array of body classes.
|
135 |
-
* @param string $action The action that brought the visitor to the login page.
|
136 |
-
*/
|
137 |
-
$classes = array( 'login-action-login', 'wp-core-ui' );
|
138 |
-
$classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
|
139 |
-
$classes = apply_filters( 'login_body_class', $classes, 'login' );
|
140 |
-
?>
|
141 |
-
|
142 |
-
<body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
|
143 |
-
<div class="clc-general-actions">
|
144 |
-
<div id="clc-templates" class="clc-preview-event" data-section="clc_templates"><span class="dashicons dashicons-tagcloud"></span></div>
|
145 |
-
<div id="clc-layout" class="clc-preview-event" data-section="clc_layout"><span class="dashicons dashicons-layout"></span></div>
|
146 |
-
<div id="clc-background" class="clc-preview-event" data-section="clc_background"><span class="dashicons dashicons-admin-customizer"></span></div>
|
147 |
-
</div>
|
148 |
-
<?php
|
149 |
-
/**
|
150 |
-
* Fires in the login page header after the body tag is opened.
|
151 |
-
*
|
152 |
-
* @since 4.6.0
|
153 |
-
*/
|
154 |
-
do_action( 'login_header' );
|
155 |
-
?>
|
156 |
-
|
157 |
-
<div id="login">
|
158 |
-
|
159 |
-
<h1>
|
160 |
-
<a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1">
|
161 |
-
<span id="clc-logo" class="clc-preview-event" data-section="clc_logo"><span class="dashicons dashicons-edit"></span></span>
|
162 |
-
<span id="logo-text"><?php echo $login_header_text ?></span>
|
163 |
-
</a>
|
164 |
-
</h1>
|
165 |
-
|
166 |
-
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
|
167 |
-
<div id="clc-loginform" class="clc-preview-event" data-section="clc_form"><span class="dashicons dashicons-edit"></span></div>
|
168 |
-
<p>
|
169 |
-
<label for="user_login"><span id="clc-username-label"><?php _e( 'Username or Email Address', 'colorlib-login-customizer' ); ?></span><br />
|
170 |
-
<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" /></label>
|
171 |
-
</p>
|
172 |
-
<p>
|
173 |
-
<label for="user_pass"><span id="clc-password-label"><?php _e( 'Password', 'colorlib-login-customizer' ); ?></span><br />
|
174 |
-
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
|
175 |
-
</p>
|
176 |
-
<?php
|
177 |
-
/**
|
178 |
-
* Fires following the 'Password' field in the login form.
|
179 |
-
*
|
180 |
-
* @since 2.1.0
|
181 |
-
*/
|
182 |
-
do_action( 'login_form' );
|
183 |
-
?>
|
184 |
-
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span id="clc-rememberme-label"><?php esc_html_e( 'Remember Me', 'colorlib-login-customizer' ); ?></span></label></p>
|
185 |
-
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In', 'colorlib-login-customizer' ); ?>" /></p>
|
186 |
-
</form>
|
187 |
-
<p id="nav">
|
188 |
-
<?php
|
189 |
-
if ( get_option( 'users_can_register' ) ) :
|
190 |
-
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register', 'colorlib-login-customizer' ) );
|
191 |
-
|
192 |
-
/** This filter is documented in wp-includes/general-template.php */
|
193 |
-
echo apply_filters( 'register', $registration_url );
|
194 |
-
|
195 |
-
echo esc_html( $login_link_separator );
|
196 |
-
endif;
|
197 |
-
?>
|
198 |
-
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'colorlib-login-customizer' ); ?></a>
|
199 |
-
</p>
|
200 |
-
<p id="backtoblog">
|
201 |
-
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
?>
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Template Name: Colorlib Login Customizer Template
|
4 |
+
*
|
5 |
+
* Template to display the WordPress login form in the Customizer.
|
6 |
+
* This is essentially a stripped down version of wp-login.php, though not accessible from outside the Customizer.
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Output the login page header.
|
13 |
+
*
|
14 |
+
* @param string $title Optional. WordPress login Page title to display in the `<title>` element.
|
15 |
+
* Default 'Log In'.
|
16 |
+
* @param string $message Optional. Message to display in header. Default empty.
|
17 |
+
* @param WP_Error $wp_error Optional. The error to pass. Default empty.
|
18 |
+
*/
|
19 |
+
function clc_login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
|
20 |
+
|
21 |
+
global $error, $action;
|
22 |
+
|
23 |
+
if ( empty( $wp_error ) ) {
|
24 |
+
$wp_error = new WP_Error();
|
25 |
+
}
|
26 |
+
|
27 |
+
$login_title = get_bloginfo( 'name', 'display' );
|
28 |
+
|
29 |
+
/* translators: Login screen title. 1: Login screen name, 2: Network or site name */
|
30 |
+
$login_title = sprintf( __( '%1$s ‹ %2$s — WordPress', 'colorlib-login-customizer' ), $title, $login_title );
|
31 |
+
/**
|
32 |
+
* Filters the title tag content for login page.
|
33 |
+
*
|
34 |
+
* @since 4.9.0
|
35 |
+
*
|
36 |
+
* @param string $login_title The page title, with extra context added.
|
37 |
+
* @param string $title The original page title.
|
38 |
+
*/
|
39 |
+
$login_title = apply_filters( 'login_title', $login_title, $title );
|
40 |
+
?><!DOCTYPE html>
|
41 |
+
<head>
|
42 |
+
<title><?php echo esc_attr( $login_title ); ?></title>
|
43 |
+
<?php
|
44 |
+
wp_enqueue_style( 'login' );
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Enqueue scripts and styles for the login page.
|
48 |
+
*
|
49 |
+
* @since 3.1.0
|
50 |
+
*/
|
51 |
+
do_action( 'login_enqueue_scripts' );
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Fires in the login page header after scripts are enqueued.
|
55 |
+
*
|
56 |
+
* @since 2.1.0
|
57 |
+
*/
|
58 |
+
do_action( 'login_head' );
|
59 |
+
?>
|
60 |
+
</head>
|
61 |
+
|
62 |
+
<?php
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Fires when the login form is initialized.
|
67 |
+
*
|
68 |
+
* @since 3.2.0
|
69 |
+
*/
|
70 |
+
do_action( 'login_init' );
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Fires before a specified login form action.
|
74 |
+
*
|
75 |
+
* The dynamic portion of the hook name, `$action`, refers to the action
|
76 |
+
* that brought the visitor to the login form. Actions include 'postpass',
|
77 |
+
* 'logout', 'lostpassword', etc.
|
78 |
+
*
|
79 |
+
* @since 2.8.0
|
80 |
+
*/
|
81 |
+
do_action( 'login_form_login' );
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Filters the separator used between login form navigation links.
|
85 |
+
*/
|
86 |
+
$login_link_separator = apply_filters( 'login_link_separator', ' | ' );
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Filters the login page errors.
|
90 |
+
*
|
91 |
+
* @since 3.6.0
|
92 |
+
*
|
93 |
+
* @param object $errors WP Error object.
|
94 |
+
* @param string $redirect_to Redirect destination URL.
|
95 |
+
*/
|
96 |
+
clc_login_header( __( 'Log In', 'colorlib-login-customizer' ), '', '' );
|
97 |
+
|
98 |
+
$login_header_url = __( 'https://wordpress.org/', 'colorlib-login-customizer' );
|
99 |
+
$login_header_title = __( 'Powered by WordPress', 'colorlib-login-customizer' );
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Filters link URL of the header logo above login form.
|
103 |
+
*
|
104 |
+
* @since 2.1.0
|
105 |
+
*
|
106 |
+
* @param string $login_header_url Login header logo URL.
|
107 |
+
*/
|
108 |
+
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Filters the title attribute of the header logo above login form.
|
112 |
+
*
|
113 |
+
* @since 2.1.0
|
114 |
+
*
|
115 |
+
* @param string $login_header_title Login header logo title attribute.
|
116 |
+
*/
|
117 |
+
$login_header_title = apply_filters( 'login_headertitle', $login_header_title );
|
118 |
+
|
119 |
+
/*
|
120 |
+
* To match the URL/title set above, Multisite sites have the blog name,
|
121 |
+
* while single sites get the header title.
|
122 |
+
*/
|
123 |
+
if ( is_multisite() ) {
|
124 |
+
$login_header_text = get_bloginfo( 'name', 'display' );
|
125 |
+
} else {
|
126 |
+
$login_header_text = $login_header_title;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Filters the login page body classes.
|
131 |
+
*
|
132 |
+
* @since 3.5.0
|
133 |
+
*
|
134 |
+
* @param array $classes An array of body classes.
|
135 |
+
* @param string $action The action that brought the visitor to the login page.
|
136 |
+
*/
|
137 |
+
$classes = array( 'login-action-login', 'wp-core-ui' );
|
138 |
+
$classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
|
139 |
+
$classes = apply_filters( 'login_body_class', $classes, 'login' );
|
140 |
+
?>
|
141 |
+
|
142 |
+
<body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
|
143 |
+
<div class="clc-general-actions">
|
144 |
+
<div id="clc-templates" class="clc-preview-event" data-section="clc_templates"><span class="dashicons dashicons-tagcloud"></span></div>
|
145 |
+
<div id="clc-layout" class="clc-preview-event" data-section="clc_layout"><span class="dashicons dashicons-layout"></span></div>
|
146 |
+
<div id="clc-background" class="clc-preview-event" data-section="clc_background"><span class="dashicons dashicons-admin-customizer"></span></div>
|
147 |
+
</div>
|
148 |
+
<?php
|
149 |
+
/**
|
150 |
+
* Fires in the login page header after the body tag is opened.
|
151 |
+
*
|
152 |
+
* @since 4.6.0
|
153 |
+
*/
|
154 |
+
do_action( 'login_header' );
|
155 |
+
?>
|
156 |
+
|
157 |
+
<div id="login">
|
158 |
+
|
159 |
+
<h1>
|
160 |
+
<a id="clc-logo-link" href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1">
|
161 |
+
<span id="clc-logo" class="clc-preview-event" data-section="clc_logo"><span class="dashicons dashicons-edit"></span></span>
|
162 |
+
<span id="logo-text"><?php echo $login_header_text ?></span>
|
163 |
+
</a>
|
164 |
+
</h1>
|
165 |
+
|
166 |
+
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
|
167 |
+
<div id="clc-loginform" class="clc-preview-event" data-section="clc_form"><span class="dashicons dashicons-edit"></span></div>
|
168 |
+
<p>
|
169 |
+
<label for="user_login"><span id="clc-username-label"><?php _e( 'Username or Email Address', 'colorlib-login-customizer' ); ?></span><br />
|
170 |
+
<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" /></label>
|
171 |
+
</p>
|
172 |
+
<p>
|
173 |
+
<label for="user_pass"><span id="clc-password-label"><?php _e( 'Password', 'colorlib-login-customizer' ); ?></span><br />
|
174 |
+
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
|
175 |
+
</p>
|
176 |
+
<?php
|
177 |
+
/**
|
178 |
+
* Fires following the 'Password' field in the login form.
|
179 |
+
*
|
180 |
+
* @since 2.1.0
|
181 |
+
*/
|
182 |
+
do_action( 'login_form' );
|
183 |
+
?>
|
184 |
+
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span id="clc-rememberme-label"><?php esc_html_e( 'Remember Me', 'colorlib-login-customizer' ); ?></span></label></p>
|
185 |
+
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In', 'colorlib-login-customizer' ); ?>" /></p>
|
186 |
+
</form>
|
187 |
+
<p id="nav">
|
188 |
+
<?php
|
189 |
+
if ( get_option( 'users_can_register' ) ) :
|
190 |
+
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register', 'colorlib-login-customizer' ) );
|
191 |
+
|
192 |
+
/** This filter is documented in wp-includes/general-template.php */
|
193 |
+
echo apply_filters( 'register', $registration_url );
|
194 |
+
|
195 |
+
echo esc_html( $login_link_separator );
|
196 |
+
endif;
|
197 |
+
?>
|
198 |
+
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" id="clc-lost-password-text"><?php _e( 'Lost your password?', 'colorlib-login-customizer' ); ?></a>
|
199 |
+
</p>
|
200 |
+
<p id="backtoblog">
|
201 |
+
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
202 |
+
<span id="clc-back-to-text">
|
203 |
+
<?php
|
204 |
+
echo '← '; _e('Back to','colorlib-login-customizer');
|
205 |
+
?>
|
206 |
+
</span>
|
207 |
+
<?php
|
208 |
+
echo esc_html( get_bloginfo( 'title', 'display' ) );
|
209 |
+
?>
|
210 |
+
</a>
|
211 |
+
</p>
|
212 |
+
</div>
|
213 |
+
|
214 |
+
<?php do_action( 'login_footer' ); ?>
|
215 |
+
<div class="clear"></div>
|
216 |
+
<?php
|
217 |
+
wp_footer();
|
218 |
+
?>
|
219 |
+
</body>
|
220 |
+
|
221 |
+
</html>
|
readme.txt
CHANGED
@@ -1,123 +1,121 @@
|
|
1 |
-
=== Custom Login Page Customizer by Colorlib ===
|
2 |
-
Contributors: colorlibplugins, silkalns
|
3 |
-
Tags: customize login, login, custom login, customize wordpress login, wordpress login, customizer, custom admin, login logo, logo, login customizer, custom wp-login
|
4 |
-
Requires at least: 4.7
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 1.2.
|
7 |
-
License: GPLv2 or later
|
8 |
-
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
-
|
10 |
-
Colorlib Login Customizer by Colorlib is a plugin that helps you personalize your login form directly from the Customizer.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
All this plugin’s tools and options can be found by going to
|
17 |
-
|
18 |
-
Custom Login Page Customizer is without doubt one of the
|
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 |
-
- Customize login form
|
46 |
-
-
|
47 |
-
- Customize background color
|
48 |
-
-
|
49 |
-
- Customize login form
|
50 |
-
-
|
51 |
-
- Customize login form
|
52 |
-
- Customize login form
|
53 |
-
-
|
54 |
-
- Customize
|
55 |
-
- Customize login form
|
56 |
-
- Customize login form
|
57 |
-
- Customize login form
|
58 |
-
-
|
59 |
-
- Customize login form
|
60 |
-
- Customize login form
|
61 |
-
- Customize login form
|
62 |
-
- Customize login form
|
63 |
-
- Customize login form
|
64 |
-
- Customize login form
|
65 |
-
-
|
66 |
-
- Customize login form
|
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 |
-
3
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
*
|
118 |
-
*
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
= 1.0 =
|
123 |
-
* Initial release
|
1 |
+
=== Custom Login Page Customizer by Colorlib ===
|
2 |
+
Contributors: colorlibplugins, silkalns
|
3 |
+
Tags: customize login, login, custom login, customize wordpress login, wordpress login, customizer, custom admin, login logo, logo, login customizer, custom wp-login
|
4 |
+
Requires at least: 4.7
|
5 |
+
Tested up to: 5.0
|
6 |
+
Stable tag: 1.2.4
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
|
10 |
+
Colorlib Login Customizer by Colorlib is a plugin that helps you personalize your login form directly from the Customizer.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Custom Login Page Customizer by Colorlib is an awesome and intuitive login page plugin that helps you personalize your login page and login form directly from the Customizer. Custom Login Page Customizer fully supports the Live Customizer feature and you can see all the changes in real time on your login page and edit them.
|
15 |
+
|
16 |
+
All this plugin’s tools and options can be found by going to Appearance > Customize > Custom Login Page Customizer. There you have templates you can use on your login page, custom login page logo, custom login page background options, custom login page form customizations, login form custom width, login form padding and borders, and more all leading to you having a brand new and custom login page.
|
17 |
+
|
18 |
+
Custom Login Page Customizer is without doubt one of the easiest to use WordPress plugins that allows the customization of the login page and login form. It was designed and developed to be powerful and user friendly so it can be enjoyed by both beginner and advanced developers. With Custom Login Page Customizer you can build a custom login page and custom login form in a matter of seconds, unlike some other login customizer plugins. Custom Login Page Customizer marks the end of a boring and bland login page and login form as you will be able to fine tune every aspect of the form to match your style and view and create a unique and custom login page.
|
19 |
+
|
20 |
+
Build and personalize your WordPress login page and login form from start to finish. Custom Login Page Customizer has the following features:
|
21 |
+
|
22 |
+
• Custom login page logo options: you can add a custom login page logo and set up its height and weight.
|
23 |
+
• Custom login page and login form background options: from here you can upload a background image or change the background’s color.
|
24 |
+
• Custom login form options: you can change the login form’s width and height, add a background image, change the background color, add padding and borders, and change the login form’s field background color, width, and margin.
|
25 |
+
• Miscellaneous: in here you will find the options to change the login form button’s background, color, hover state, border, shadow, and the link’s color and hover color.
|
26 |
+
|
27 |
+
Custom Login Page Customizer by Colorlib detailed features:
|
28 |
+
|
29 |
+
- Custom login page templates
|
30 |
+
- Hide/show login logo from login page
|
31 |
+
- Show/hide the logo text from login page
|
32 |
+
- Custom logo on login page
|
33 |
+
- Change logo width on login page
|
34 |
+
- Change logo height on login page
|
35 |
+
- Change number of columns on your login page
|
36 |
+
- Customize width of the columns on your login page
|
37 |
+
- Change login form column alignment
|
38 |
+
- Customize login form vertical alignment
|
39 |
+
- Customize login form horizontal alignment
|
40 |
+
- Customize background color on the login page
|
41 |
+
- Add a custom background image on login page
|
42 |
+
- Customize login form column background color
|
43 |
+
- Add a custom background image for login form column
|
44 |
+
- Customize login form width
|
45 |
+
- Customize login form width
|
46 |
+
- Add custom background image for login form
|
47 |
+
- Customize the background color for login form
|
48 |
+
- Customize login form border radius
|
49 |
+
- Customize login form fields’ width
|
50 |
+
- Customize login form fields’ margin
|
51 |
+
- Customize login form fields’ border
|
52 |
+
- Customize login form fields’ border radius
|
53 |
+
- Customize login form fields’ background color
|
54 |
+
- Customize login form fields’ text color
|
55 |
+
- Customize login form fields’ label color
|
56 |
+
- Customize login form username label
|
57 |
+
- Customize login form password label
|
58 |
+
- Show/hide the links on login page under the login form
|
59 |
+
- Customize login form button background color
|
60 |
+
- Customize login form button hover background color
|
61 |
+
- Customize login form button border color
|
62 |
+
- Customize login form button border color on hover
|
63 |
+
- Customize login form button shadow
|
64 |
+
- Customize login form button text shadow
|
65 |
+
- Customize login form links color
|
66 |
+
- Customize login form links color on hover
|
67 |
+
- Hide/Show ‘Remember me?’ option on login form
|
68 |
+
- Custom CSS option to customize further the login form and login page
|
69 |
+
|
70 |
+
Build and personalize your WordPress login form from start to finish. Colorlib Login Customizer has the following features:
|
71 |
+
|
72 |
+
- Logo options: you can add a custom logo and set up its height and weight.
|
73 |
+
- Background options: from here you can upload a background image or change the background’s color.
|
74 |
+
- Form options: you can change the form’s width and height, add a background image, change the background color, add padding and borders, and change the form’s field background color, width, and margin.
|
75 |
+
- Miscellaneous: in here you will find the options to change the button’s background, color, hover state, border, shadow, and the link’s color and hover color.
|
76 |
+
|
77 |
+
= Further Reading =
|
78 |
+
|
79 |
+
This plugin is developed and maintained by Colorlib. Which is well know for their free <a href="https://colorlib.com/wp/themes/" target="_blank"></a>WordPress themes. However, now they are looking to extend their presence in plugin development and believe that Colorlib Login Customizer is a great way to start.
|
80 |
+
|
81 |
+
If you are new to WordPress and want to learn more we have got you covered. Colorlib will teach you how to <a href="https://colorlib.com/">start a blog</a> or <a href="https://colorlib.com/wp/how-to-make-a-website/">create a website</a> and much more. If you are already familiar with WordPress you likely want to learn how to make it faster and more reliable. That's when you want to look into hosting and more specifically <a href="http://colorlib.com/wp/wordpress-hosting">WordPress hosting</a>.
|
82 |
+
|
83 |
+
If you enjoy using Colorlib Login Customizer for WordPress please leave a [positive feedback](https://wordpress.org/support/plugin/colorlib-login-customiezr/reviews/?filter=5). We are committed to make it the best Login Customizer plugin for WordPress.
|
84 |
+
|
85 |
+
|
86 |
+
== Installation ==
|
87 |
+
|
88 |
+
1. Download the plugin (.zip file) on your hard drive.
|
89 |
+
2. Unzip the zip file contents.
|
90 |
+
3. Upload the `colorlib-login-customizer` folder to the `/wp-content/plugins/` directory.
|
91 |
+
4. Activate the plugin through the 'Plugins' menu in WordPress.
|
92 |
+
5. A new sub menu item `Colorlib Login Customizer` will appear in your main Settings menu.
|
93 |
+
|
94 |
+
== Changelog ==
|
95 |
+
|
96 |
+
= 1.2.4 =
|
97 |
+
* Fixed https://github.com/ColorlibHQ/colorlib-login-customizer/issues/30
|
98 |
+
* Fixed https://github.com/ColorlibHQ/colorlib-login-customizer/issues/41
|
99 |
+
* Added https://github.com/ColorlibHQ/colorlib-login-customizer/issues/27
|
100 |
+
|
101 |
+
= 1.2.3 =
|
102 |
+
* Fixed `Logo Url` setting
|
103 |
+
* Added `Logo Title` setting
|
104 |
+
|
105 |
+
= 1.2.2 =
|
106 |
+
* Added the possibility to change the `Remember Me` and `Log In` texts
|
107 |
+
|
108 |
+
= 1.2.1 =
|
109 |
+
* Minor tweaks & version bump
|
110 |
+
|
111 |
+
= 1.2.0 =
|
112 |
+
* Implemented everything from here: https://github.com/puikinsh/colorlib-login-customizer/milestone/1?closed=1
|
113 |
+
|
114 |
+
= 1.1 =
|
115 |
+
* Changed templates functionality
|
116 |
+
* Added new layout options
|
117 |
+
* Fixed live preview editing
|
118 |
+
* Fixed minor bugs
|
119 |
+
|
120 |
+
= 1.0 =
|
121 |
+
* Initial release
|
|
|
|
uninstall.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
* This file runs when the plugin in uninstalled (deleted).
|
6 |
-
* This will not run when the plugin is deactivated.
|
7 |
-
* Ideally you will add all your clean-up scripts here
|
8 |
-
* that will clean-up unused meta, options, etc. in the database.
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
|
12 |
-
// If plugin is not being uninstalled, exit (do nothing)
|
13 |
-
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
// Do something here if plugin is being uninstalled.
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* This file runs when the plugin in uninstalled (deleted).
|
6 |
+
* This will not run when the plugin is deactivated.
|
7 |
+
* Ideally you will add all your clean-up scripts here
|
8 |
+
* that will clean-up unused meta, options, etc. in the database.
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
|
12 |
+
// If plugin is not being uninstalled, exit (do nothing)
|
13 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
// Do something here if plugin is being uninstalled.
|