Version Description
Download this release
Release Info
Developer | thehappymonster |
Plugin | Happy Addons for Elementor (Mega Menu, Post Grid, Woocommerce Product Grid, Table, Event Calendar, Slider Elementor Widget) |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- LICENSE.txt +339 -0
- addons/class-addon-base.php +70 -0
- addons/class-blurb.php +655 -0
- addons/class-card.php +895 -0
- addons/class-cf7.php +544 -0
- addons/class-icon-box.php +349 -0
- assets/css/main.css +292 -0
- assets/css/main.min.css +1 -0
- base.php +200 -0
- inc/functions.php +86 -0
- plugin.php +39 -0
- readme.txt +42 -0
LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
addons/class-addon-base.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Addon base
|
4 |
+
*
|
5 |
+
* @package Happy_Addons
|
6 |
+
*/
|
7 |
+
namespace Happy_Addons\Elementor\Addons;
|
8 |
+
|
9 |
+
use Elementor\Widget_Base;
|
10 |
+
|
11 |
+
defined( 'ABSPATH' ) || die();
|
12 |
+
|
13 |
+
abstract class Addon_Base extends Widget_Base {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get widget name.
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
* @access public
|
20 |
+
*
|
21 |
+
* @return string Widget name.
|
22 |
+
*/
|
23 |
+
public function get_name() {
|
24 |
+
/**
|
25 |
+
* Automatically generate widget name from class
|
26 |
+
*
|
27 |
+
* Card will be card
|
28 |
+
* Blog_Card will be blog-card
|
29 |
+
*/
|
30 |
+
$name = str_replace( __NAMESPACE__, '', $this->get_class_name() );
|
31 |
+
$name = str_replace( '_', '-', $name );
|
32 |
+
$name = ltrim( $name, '\\' );
|
33 |
+
$name = strtolower( $name );
|
34 |
+
return 'ha-' . $name;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get widget categories.
|
39 |
+
*
|
40 |
+
* @since 1.0.0
|
41 |
+
* @access public
|
42 |
+
*
|
43 |
+
* @return array Widget categories.
|
44 |
+
*/
|
45 |
+
public function get_categories() {
|
46 |
+
return [ 'happy_addons' ];
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Override from addon to add custom wrapper class.
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
protected function get_custom_wrapper_class() {
|
55 |
+
return '';
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Overriding default function to add custom html class.
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function get_html_wrapper_class() {
|
64 |
+
$html_class = parent::get_html_wrapper_class();
|
65 |
+
$html_class .= ' happy-addon';
|
66 |
+
$html_class .= ' ' . $this->get_name();
|
67 |
+
$html_class .= ' ' . $this->get_custom_wrapper_class();
|
68 |
+
return rtrim( $html_class );
|
69 |
+
}
|
70 |
+
}
|
addons/class-blurb.php
ADDED
@@ -0,0 +1,655 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Blurb addon class
|
4 |
+
*
|
5 |
+
* @package Happy_Addons
|
6 |
+
*/
|
7 |
+
namespace Happy_Addons\Elementor\Addons;
|
8 |
+
|
9 |
+
use Elementor\Control_Media;
|
10 |
+
use Elementor\Group_Control_Border;
|
11 |
+
use Elementor\Group_Control_Box_Shadow;
|
12 |
+
use Elementor\Group_Control_Image_Size;
|
13 |
+
use Elementor\Group_Control_Typography;
|
14 |
+
use Elementor\Controls_Manager;
|
15 |
+
use Elementor\Utils;
|
16 |
+
|
17 |
+
defined( 'ABSPATH' ) || die();
|
18 |
+
|
19 |
+
class Blurb extends Addon_Base {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get widget title.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
* @access public
|
26 |
+
*
|
27 |
+
* @return string Widget title.
|
28 |
+
*/
|
29 |
+
public function get_title() {
|
30 |
+
return __( 'Happy Blurb', 'happy_addons' );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get widget icon.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
* @access public
|
38 |
+
*
|
39 |
+
* @return string Widget icon.
|
40 |
+
*/
|
41 |
+
public function get_icon() {
|
42 |
+
return 'fa fa-smile-o';
|
43 |
+
}
|
44 |
+
|
45 |
+
public function get_keywords() {
|
46 |
+
return [ 'info', 'blub', 'box', 'text', 'content' ];
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function _register_controls() {
|
50 |
+
$this->start_controls_section(
|
51 |
+
'media_section',
|
52 |
+
[
|
53 |
+
'label' => __( 'Media (Icon/Image)', 'happy_addons' ),
|
54 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
55 |
+
]
|
56 |
+
);
|
57 |
+
|
58 |
+
$this->add_control(
|
59 |
+
'type',
|
60 |
+
[
|
61 |
+
'label' => __( 'Type', 'happy_addons' ),
|
62 |
+
'type' => Controls_Manager::CHOOSE,
|
63 |
+
'options' => [
|
64 |
+
'icon' => [
|
65 |
+
'title' => __( 'Icon', 'happy_addons' ),
|
66 |
+
'icon' => 'fa fa-font-awesome',
|
67 |
+
],
|
68 |
+
'image' => [
|
69 |
+
'title' => __( 'Image', 'happy_addons' ),
|
70 |
+
'icon' => 'fa fa-image',
|
71 |
+
],
|
72 |
+
],
|
73 |
+
'default' => 'icon',
|
74 |
+
'toggle' => false,
|
75 |
+
]
|
76 |
+
);
|
77 |
+
|
78 |
+
$this->add_control(
|
79 |
+
'image',
|
80 |
+
[
|
81 |
+
'label' => __( 'Image', 'happy_addons' ),
|
82 |
+
'type' => Controls_Manager::MEDIA,
|
83 |
+
'default' => [
|
84 |
+
'url' => Utils::get_placeholder_image_src(),
|
85 |
+
],
|
86 |
+
'condition' => [
|
87 |
+
'type' => 'image'
|
88 |
+
]
|
89 |
+
]
|
90 |
+
);
|
91 |
+
|
92 |
+
$this->add_group_control(
|
93 |
+
Group_Control_Image_Size::get_type(),
|
94 |
+
[
|
95 |
+
'name' => 'image',
|
96 |
+
'default' => 'thumbnail',
|
97 |
+
'separator' => 'none',
|
98 |
+
'exclude' => [
|
99 |
+
'full',
|
100 |
+
'custom',
|
101 |
+
'large',
|
102 |
+
'shop_catalog',
|
103 |
+
'shop_single',
|
104 |
+
'shop_thumbnail'
|
105 |
+
],
|
106 |
+
'condition' => [
|
107 |
+
'type' => 'image'
|
108 |
+
]
|
109 |
+
]
|
110 |
+
);
|
111 |
+
|
112 |
+
$this->add_control(
|
113 |
+
'icon',
|
114 |
+
[
|
115 |
+
'label' => __( 'Icon', 'happy_addons' ),
|
116 |
+
'type' => Controls_Manager::ICON,
|
117 |
+
'default' => 'fa fa-smile-o',
|
118 |
+
'condition' => [
|
119 |
+
'type' => 'icon'
|
120 |
+
]
|
121 |
+
]
|
122 |
+
);
|
123 |
+
|
124 |
+
$this->end_controls_section();
|
125 |
+
|
126 |
+
$this->start_controls_section(
|
127 |
+
'title_section',
|
128 |
+
[
|
129 |
+
'label' => __( 'Title & Description', 'happy_addons' ),
|
130 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
131 |
+
]
|
132 |
+
);
|
133 |
+
|
134 |
+
$this->add_control(
|
135 |
+
'title',
|
136 |
+
[
|
137 |
+
'label' => __( 'Title', 'happy_addons' ),
|
138 |
+
'label_block' => true,
|
139 |
+
'type' => Controls_Manager::TEXT,
|
140 |
+
'default' => __( 'Default title', 'happy_addons' ),
|
141 |
+
'placeholder' => __( 'Type your blurb title', 'happy_addons' ),
|
142 |
+
]
|
143 |
+
);
|
144 |
+
|
145 |
+
$this->add_control(
|
146 |
+
'description',
|
147 |
+
[
|
148 |
+
'label' => __( 'Description', 'happy_addons' ),
|
149 |
+
'type' => Controls_Manager::TEXTAREA,
|
150 |
+
'default' => __( 'Default description', 'happy_addons' ),
|
151 |
+
'placeholder' => __( 'Type your blurb description', 'happy_addons' ),
|
152 |
+
'rows' => 5
|
153 |
+
]
|
154 |
+
);
|
155 |
+
|
156 |
+
$this->add_control(
|
157 |
+
'title_tag',
|
158 |
+
[
|
159 |
+
'label' => __( 'Title HTML Tag', 'happy_addons' ),
|
160 |
+
'type' => Controls_Manager::SELECT,
|
161 |
+
'options' => [
|
162 |
+
'h1' => __( 'H1', 'happy_addons' ),
|
163 |
+
'h2' => __( 'H2', 'happy_addons' ),
|
164 |
+
'h3' => __( 'H3', 'happy_addons' ),
|
165 |
+
'h4' => __( 'H4', 'happy_addons' ),
|
166 |
+
'h5' => __( 'H5', 'happy_addons' ),
|
167 |
+
'h6' => __( 'H6', 'happy_addons' ),
|
168 |
+
],
|
169 |
+
'default' => 'h2',
|
170 |
+
]
|
171 |
+
);
|
172 |
+
|
173 |
+
$this->add_responsive_control(
|
174 |
+
'align',
|
175 |
+
[
|
176 |
+
'label' => __( 'Alignment', 'happy_addons' ),
|
177 |
+
'type' => Controls_Manager::CHOOSE,
|
178 |
+
'options' => [
|
179 |
+
'left' => [
|
180 |
+
'title' => __( 'Left', 'happy_addons' ),
|
181 |
+
'icon' => 'fa fa-align-left',
|
182 |
+
],
|
183 |
+
'center' => [
|
184 |
+
'title' => __( 'Center', 'happy_addons' ),
|
185 |
+
'icon' => 'fa fa-align-center',
|
186 |
+
],
|
187 |
+
'right' => [
|
188 |
+
'title' => __( 'Right', 'happy_addons' ),
|
189 |
+
'icon' => 'fa fa-align-right',
|
190 |
+
],
|
191 |
+
],
|
192 |
+
'desktop_default' => 'left',
|
193 |
+
'toggle' => false,
|
194 |
+
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
195 |
+
'prefix_class' => 'ha-text--%s'
|
196 |
+
]
|
197 |
+
);
|
198 |
+
|
199 |
+
$this->end_controls_section();
|
200 |
+
|
201 |
+
$this->start_controls_section(
|
202 |
+
'link_section',
|
203 |
+
[
|
204 |
+
'label' => __( 'Link', 'happy_addons' ),
|
205 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
206 |
+
]
|
207 |
+
);
|
208 |
+
|
209 |
+
$this->add_control(
|
210 |
+
'link_text',
|
211 |
+
[
|
212 |
+
'label' => __( 'Text', 'happy_addons' ),
|
213 |
+
'type' => Controls_Manager::TEXT,
|
214 |
+
'default' => __( 'Default text', 'happy_addons' ),
|
215 |
+
'placeholder' => __( 'Type your link text', 'happy_addons' ),
|
216 |
+
]
|
217 |
+
);
|
218 |
+
|
219 |
+
$this->add_control(
|
220 |
+
'link_url',
|
221 |
+
[
|
222 |
+
'label' => __( 'URL', 'happy_addons' ),
|
223 |
+
'type' => Controls_Manager::URL,
|
224 |
+
'placeholder' => __( 'https://example.com/', 'happy_addons' ),
|
225 |
+
'default' => [
|
226 |
+
'url' => '#',
|
227 |
+
],
|
228 |
+
]
|
229 |
+
);
|
230 |
+
|
231 |
+
$this->end_controls_section();
|
232 |
+
|
233 |
+
$this->start_controls_section(
|
234 |
+
'media_style',
|
235 |
+
[
|
236 |
+
'label' => __( 'Media (Icon/Image)', 'happy_addons' ),
|
237 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
238 |
+
]
|
239 |
+
);
|
240 |
+
|
241 |
+
$this->add_responsive_control(
|
242 |
+
'media_size',
|
243 |
+
[
|
244 |
+
'label' => __( 'Size', 'happy_addons' ),
|
245 |
+
'type' => Controls_Manager::SLIDER,
|
246 |
+
'default' => [
|
247 |
+
'unit' => 'px',
|
248 |
+
],
|
249 |
+
'tablet_default' => [
|
250 |
+
'unit' => 'px',
|
251 |
+
],
|
252 |
+
'mobile_default' => [
|
253 |
+
'unit' => 'px',
|
254 |
+
],
|
255 |
+
'size_units' => [ 'px', 'em', '%'],
|
256 |
+
'range' => [
|
257 |
+
'%' => [
|
258 |
+
'min' => 1,
|
259 |
+
'max' => 40,
|
260 |
+
],
|
261 |
+
'px' => [
|
262 |
+
'min' => 1,
|
263 |
+
'max' => 250,
|
264 |
+
],
|
265 |
+
'em' => [
|
266 |
+
'min' => 1,
|
267 |
+
'max' => 20,
|
268 |
+
],
|
269 |
+
],
|
270 |
+
'selectors' => [
|
271 |
+
'{{WRAPPER}} .ha-blurb-figure--image' => 'width: {{SIZE}}{{UNIT}};',
|
272 |
+
'{{WRAPPER}} .ha-blurb-figure--icon > i' => 'font-size: {{SIZE}}{{UNIT}};',
|
273 |
+
],
|
274 |
+
]
|
275 |
+
);
|
276 |
+
|
277 |
+
$this->add_responsive_control(
|
278 |
+
'media_offset',
|
279 |
+
[
|
280 |
+
'label' => __( 'Offset', 'happy_addons' ),
|
281 |
+
'type' => Controls_Manager::DIMENSIONS,
|
282 |
+
'size_units' => [ 'px', '%' ],
|
283 |
+
'allowed_dimensions' => ['top', 'left'],
|
284 |
+
'selectors' => [
|
285 |
+
'{{WRAPPER}} .ha-blurb-figure' => '-ms-transform: translate({{LEFT}}{{UNIT}}, {{TOP}}{{UNIT}}); -webkit-transform: translate({{LEFT}}{{UNIT}}, {{TOP}}{{UNIT}}); transform: translate({{LEFT}}{{UNIT}}, {{TOP}}{{UNIT}});',
|
286 |
+
'{{WRAPPER}} .ha-blurb-body' => 'margin-top: {{TOP}}{{UNIT}};',
|
287 |
+
],
|
288 |
+
'default' => [
|
289 |
+
'isLinked' => false,
|
290 |
+
]
|
291 |
+
]
|
292 |
+
);
|
293 |
+
|
294 |
+
$this->add_responsive_control(
|
295 |
+
'media_padding',
|
296 |
+
[
|
297 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
298 |
+
'type' => Controls_Manager::DIMENSIONS,
|
299 |
+
'size_units' => [ 'px', 'em', '%' ],
|
300 |
+
'selectors' => [
|
301 |
+
'{{WRAPPER}} .ha-blurb-figure--image > img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
302 |
+
'{{WRAPPER}} .ha-blurb-figure--icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
303 |
+
],
|
304 |
+
]
|
305 |
+
);
|
306 |
+
|
307 |
+
$this->add_group_control(
|
308 |
+
Group_Control_Border::get_type(),
|
309 |
+
[
|
310 |
+
'name' => 'media_border',
|
311 |
+
'selector' => '{{WRAPPER}} .ha-blurb-figure--image > img, {{WRAPPER}} .ha-blurb-figure--icon'
|
312 |
+
]
|
313 |
+
);
|
314 |
+
|
315 |
+
$this->add_responsive_control(
|
316 |
+
'media_border_radius',
|
317 |
+
[
|
318 |
+
'label' => __( 'Border Radius', 'happy_addons' ),
|
319 |
+
'type' => Controls_Manager::DIMENSIONS,
|
320 |
+
'size_units' => [ 'px', '%' ],
|
321 |
+
'selectors' => [
|
322 |
+
'{{WRAPPER}} .ha-blurb-figure--image > img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
323 |
+
'{{WRAPPER}} .ha-blurb-figure--icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
324 |
+
],
|
325 |
+
]
|
326 |
+
);
|
327 |
+
|
328 |
+
$this->add_group_control(
|
329 |
+
Group_Control_Box_Shadow::get_type(),
|
330 |
+
[
|
331 |
+
'name' => 'media_box_shadow',
|
332 |
+
'exclude' => [
|
333 |
+
'box_shadow_position',
|
334 |
+
],
|
335 |
+
'selector' => '{{WRAPPER}} .ha-blurb-figure--image > img, {{WRAPPER}} .ha-blurb-figure--icon'
|
336 |
+
]
|
337 |
+
);
|
338 |
+
|
339 |
+
$this->add_control(
|
340 |
+
'icon_color',
|
341 |
+
[
|
342 |
+
'label' => __( 'Color', 'happy_addons' ),
|
343 |
+
'type' => Controls_Manager::COLOR,
|
344 |
+
'selectors' => [
|
345 |
+
'{{WRAPPER}} .ha-blurb-figure--icon' => 'color: {{VALUE}}',
|
346 |
+
],
|
347 |
+
'condition' => [
|
348 |
+
'type' => 'icon'
|
349 |
+
]
|
350 |
+
]
|
351 |
+
);
|
352 |
+
|
353 |
+
$this->add_control(
|
354 |
+
'icon_bg_color',
|
355 |
+
[
|
356 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
357 |
+
'type' => Controls_Manager::COLOR,
|
358 |
+
'selectors' => [
|
359 |
+
'{{WRAPPER}} .ha-blurb-figure--icon' => 'background-color: {{VALUE}}',
|
360 |
+
],
|
361 |
+
'condition' => [
|
362 |
+
'type' => 'icon'
|
363 |
+
]
|
364 |
+
]
|
365 |
+
);
|
366 |
+
|
367 |
+
$this->end_controls_section();
|
368 |
+
|
369 |
+
$this->start_controls_section(
|
370 |
+
'content_style',
|
371 |
+
[
|
372 |
+
'label' => __( 'Title & Description', 'happy_addons' ),
|
373 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
374 |
+
]
|
375 |
+
);
|
376 |
+
|
377 |
+
$this->add_responsive_control(
|
378 |
+
'content_padding',
|
379 |
+
[
|
380 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
381 |
+
'type' => Controls_Manager::DIMENSIONS,
|
382 |
+
'size_units' => [ 'px', 'em', '%' ],
|
383 |
+
'selectors' => [
|
384 |
+
'{{WRAPPER}} .ha-blurb-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
385 |
+
],
|
386 |
+
]
|
387 |
+
);
|
388 |
+
|
389 |
+
$this->add_control(
|
390 |
+
'title_heading',
|
391 |
+
[
|
392 |
+
'type' => Controls_Manager::HEADING,
|
393 |
+
'label' => __( 'Title', 'happy_addons' ),
|
394 |
+
'separator' => 'before'
|
395 |
+
]
|
396 |
+
);
|
397 |
+
|
398 |
+
$this->add_responsive_control(
|
399 |
+
'title_margin',
|
400 |
+
[
|
401 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
402 |
+
'type' => Controls_Manager::DIMENSIONS,
|
403 |
+
'size_units' => [ 'px', '%' ],
|
404 |
+
'selectors' => [
|
405 |
+
'{{WRAPPER}} .ha-blurb-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
406 |
+
],
|
407 |
+
]
|
408 |
+
);
|
409 |
+
|
410 |
+
$this->add_control(
|
411 |
+
'title_color',
|
412 |
+
[
|
413 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
414 |
+
'type' => Controls_Manager::COLOR,
|
415 |
+
'selectors' => [
|
416 |
+
'{{WRAPPER}} .ha-blurb-title' => 'color: {{VALUE}}',
|
417 |
+
],
|
418 |
+
]
|
419 |
+
);
|
420 |
+
|
421 |
+
$this->add_group_control(
|
422 |
+
Group_Control_Typography::get_type(),
|
423 |
+
[
|
424 |
+
'name' => 'title_typography',
|
425 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
426 |
+
'selector' => '{{WRAPPER}} .ha-blurb-title',
|
427 |
+
]
|
428 |
+
);
|
429 |
+
|
430 |
+
$this->add_control(
|
431 |
+
'description_heading',
|
432 |
+
[
|
433 |
+
'type' => Controls_Manager::HEADING,
|
434 |
+
'label' => __( 'Description', 'happy_addons' ),
|
435 |
+
'separator' => 'before'
|
436 |
+
]
|
437 |
+
);
|
438 |
+
|
439 |
+
$this->add_responsive_control(
|
440 |
+
'description_margin',
|
441 |
+
[
|
442 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
443 |
+
'type' => Controls_Manager::DIMENSIONS,
|
444 |
+
'size_units' => [ 'px', '%' ],
|
445 |
+
'selectors' => [
|
446 |
+
'{{WRAPPER}} .ha-blurb-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
447 |
+
],
|
448 |
+
]
|
449 |
+
);
|
450 |
+
|
451 |
+
$this->add_control(
|
452 |
+
'description_color',
|
453 |
+
[
|
454 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
455 |
+
'type' => Controls_Manager::COLOR,
|
456 |
+
'selectors' => [
|
457 |
+
'{{WRAPPER}} .ha-blurb-text' => 'color: {{VALUE}}',
|
458 |
+
],
|
459 |
+
]
|
460 |
+
);
|
461 |
+
|
462 |
+
$this->add_group_control(
|
463 |
+
Group_Control_Typography::get_type(),
|
464 |
+
[
|
465 |
+
'name' => 'description_typography',
|
466 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
467 |
+
'selector' => '{{WRAPPER}} .ha-blurb-text',
|
468 |
+
]
|
469 |
+
);
|
470 |
+
|
471 |
+
$this->end_controls_section();
|
472 |
+
|
473 |
+
$this->start_controls_section(
|
474 |
+
'link_style',
|
475 |
+
[
|
476 |
+
'label' => __( 'Link', 'happy_addons' ),
|
477 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
478 |
+
]
|
479 |
+
);
|
480 |
+
|
481 |
+
$this->add_responsive_control(
|
482 |
+
'link_padding',
|
483 |
+
[
|
484 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
485 |
+
'type' => Controls_Manager::DIMENSIONS,
|
486 |
+
'size_units' => [ 'px', 'em', '%' ],
|
487 |
+
'selectors' => [
|
488 |
+
'{{WRAPPER}} .ha-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
489 |
+
],
|
490 |
+
]
|
491 |
+
);
|
492 |
+
|
493 |
+
$this->add_group_control(
|
494 |
+
Group_Control_Typography::get_type(),
|
495 |
+
[
|
496 |
+
'name' => 'btn_typography',
|
497 |
+
'selector' => '{{WRAPPER}} .ha-link',
|
498 |
+
]
|
499 |
+
);
|
500 |
+
|
501 |
+
$this->start_controls_tabs( 'tabs_link_style' );
|
502 |
+
|
503 |
+
$this->start_controls_tab(
|
504 |
+
'tab_link_normal',
|
505 |
+
[
|
506 |
+
'label' => __( 'Normal', 'happy_addons' ),
|
507 |
+
]
|
508 |
+
);
|
509 |
+
|
510 |
+
$this->add_control(
|
511 |
+
'link_color',
|
512 |
+
[
|
513 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
514 |
+
'type' => Controls_Manager::COLOR,
|
515 |
+
'default' => '',
|
516 |
+
'selectors' => [
|
517 |
+
'{{WRAPPER}} .ha-link' => 'color: {{VALUE}};',
|
518 |
+
],
|
519 |
+
]
|
520 |
+
);
|
521 |
+
|
522 |
+
$this->end_controls_tab();
|
523 |
+
|
524 |
+
$this->start_controls_tab(
|
525 |
+
'tab_link_hover',
|
526 |
+
[
|
527 |
+
'label' => __( 'Hover', 'happy_addons' ),
|
528 |
+
]
|
529 |
+
);
|
530 |
+
|
531 |
+
$this->add_control(
|
532 |
+
'link_hover_color',
|
533 |
+
[
|
534 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
535 |
+
'type' => Controls_Manager::COLOR,
|
536 |
+
'selectors' => [
|
537 |
+
'{{WRAPPER}} .ha-link:hover, {{WRAPPER}} .ha-link:focus' => 'color: {{VALUE}};',
|
538 |
+
],
|
539 |
+
]
|
540 |
+
);
|
541 |
+
|
542 |
+
$this->end_controls_tab();
|
543 |
+
$this->end_controls_tabs();
|
544 |
+
|
545 |
+
$this->end_controls_section();
|
546 |
+
}
|
547 |
+
|
548 |
+
protected function render() {
|
549 |
+
$settings = $this->get_settings_for_display();
|
550 |
+
|
551 |
+
$this->add_inline_editing_attributes( 'title', 'none' );
|
552 |
+
$this->add_render_attribute( 'title', 'class', 'ha-blurb-title' );
|
553 |
+
|
554 |
+
$this->add_inline_editing_attributes( 'description', 'basic' );
|
555 |
+
$this->add_render_attribute( 'description', 'class', 'ha-blurb-text' );
|
556 |
+
|
557 |
+
$this->add_inline_editing_attributes( 'link_text', 'none' );
|
558 |
+
$this->add_render_attribute( 'link_text', 'class', 'ha-link' );
|
559 |
+
|
560 |
+
$this->add_render_attribute( 'link_text', 'href', esc_url( $settings['link_url']['url'] ) );
|
561 |
+
if ( ! empty( $settings['link_url']['is_external'] ) ) {
|
562 |
+
$this->add_render_attribute( 'link_text', 'target', '_blank' );
|
563 |
+
}
|
564 |
+
if ( ! empty( $settings['link_url']['nofollow'] ) ) {
|
565 |
+
$this->set_render_attribute( 'link_text', 'rel', 'nofollow' );
|
566 |
+
}
|
567 |
+
?>
|
568 |
+
|
569 |
+
<?php if ( $settings['type'] === 'image' ) : ?>
|
570 |
+
<?php if ( ! empty( $settings['image']['url'] ) ) :
|
571 |
+
$this->add_render_attribute( 'image', 'src', $settings['image']['url'] );
|
572 |
+
$this->add_render_attribute( 'image', 'alt', Control_Media::get_image_alt( $settings['image'] ) );
|
573 |
+
$this->add_render_attribute( 'image', 'title', Control_Media::get_image_title( $settings['image'] ) );
|
574 |
+
$settings['hover_animation'] = 'disable-animation'; // hack to prevent image hover animation
|
575 |
+
?>
|
576 |
+
<figure class="ha-blurb-figure ha-blurb-figure--image">
|
577 |
+
<?php echo Group_Control_Image_Size::get_attachment_image_html( $settings, 'image', 'image' ); ?>
|
578 |
+
</figure>
|
579 |
+
<?php endif; ?>
|
580 |
+
<?php else: ?>
|
581 |
+
<figure class="ha-blurb-figure ha-blurb-figure--icon">
|
582 |
+
<i aria-hidden="true" class="<?php echo esc_attr( $settings['icon'] ); ?>"></i>
|
583 |
+
</figure>
|
584 |
+
<?php endif; ?>
|
585 |
+
|
586 |
+
<div class="ha-blurb-body">
|
587 |
+
<?php printf( '<%1$s %2$s>%3$s</%1$s>',
|
588 |
+
tag_escape( $settings['title_tag'] ),
|
589 |
+
$this->get_render_attribute_string( 'title' ),
|
590 |
+
esc_html( $settings['title' ] )
|
591 |
+
); ?>
|
592 |
+
<div <?php echo $this->get_render_attribute_string( 'description' ); ?>>
|
593 |
+
<p><?php echo wp_kses_data( $settings['description'] ); ?></p>
|
594 |
+
</div>
|
595 |
+
<?php
|
596 |
+
if ( $settings['link_text'] ):
|
597 |
+
printf( '<a %1$s>%2$s</a>',
|
598 |
+
$this->get_render_attribute_string( 'link_text' ),
|
599 |
+
esc_html( $settings['link_text'] )
|
600 |
+
);
|
601 |
+
endif;
|
602 |
+
?>
|
603 |
+
</div>
|
604 |
+
<?php
|
605 |
+
}
|
606 |
+
|
607 |
+
public function _content_template() {
|
608 |
+
?>
|
609 |
+
<#
|
610 |
+
view.addInlineEditingAttributes( 'title', 'none' );
|
611 |
+
view.addRenderAttribute( 'title', 'class', 'ha-blurb-title' );
|
612 |
+
|
613 |
+
view.addInlineEditingAttributes( 'description', 'basic' );
|
614 |
+
view.addRenderAttribute( 'description', 'class', 'ha-blurb-text' );
|
615 |
+
|
616 |
+
view.addInlineEditingAttributes( 'link_text', 'none' );
|
617 |
+
view.addRenderAttribute( 'link_text', 'class', 'ha-link' );
|
618 |
+
view.addRenderAttribute( 'link_text', 'href', settings.link_url.url );
|
619 |
+
|
620 |
+
if ( settings.type === 'image' ) {
|
621 |
+
if ( settings.image.url ) {
|
622 |
+
var image = {
|
623 |
+
id: settings.image.id,
|
624 |
+
url: settings.image.url,
|
625 |
+
size: settings.image_size,
|
626 |
+
dimension: settings.image_custom_dimension,
|
627 |
+
model: view.getEditModel()
|
628 |
+
};
|
629 |
+
|
630 |
+
var image_url = elementor.imagesManager.getImageUrl( image );
|
631 |
+
#>
|
632 |
+
<figure class="ha-blurb-figure ha-blurb-figure--image">
|
633 |
+
<img src="{{ image_url }}">
|
634 |
+
</figure>
|
635 |
+
<# }
|
636 |
+
} else { #>
|
637 |
+
<figure class="ha-blurb-figure ha-blurb-figure--icon">
|
638 |
+
<i aria-hidden="true" class="{{ settings.icon }}"></i>
|
639 |
+
</figure>
|
640 |
+
<# } #>
|
641 |
+
|
642 |
+
<div class="ha-blurb-body">
|
643 |
+
<{{ settings.title_tag }} {{{ view.getRenderAttributeString( 'title' ) }}}>{{ settings.title }}</{{ settings.title_tag }}>
|
644 |
+
|
645 |
+
<div {{{ view.getRenderAttributeString( 'description' ) }}}>
|
646 |
+
<p>{{{ settings.description }}}</p>
|
647 |
+
</div>
|
648 |
+
|
649 |
+
<# if ( settings.link_text ) { #>
|
650 |
+
<a {{{ view.getRenderAttributeString( 'link_text' ) }}}>{{ settings.link_text }}</a>
|
651 |
+
<# } #>
|
652 |
+
</div>
|
653 |
+
<?php
|
654 |
+
}
|
655 |
+
}
|
addons/class-card.php
ADDED
@@ -0,0 +1,895 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Card addon class
|
4 |
+
*
|
5 |
+
* @package Happy_Addons
|
6 |
+
*/
|
7 |
+
namespace Happy_Addons\Elementor\Addons;
|
8 |
+
|
9 |
+
use Elementor\Control_Media;
|
10 |
+
use Elementor\Group_Control_Border;
|
11 |
+
use Elementor\Group_Control_Box_Shadow;
|
12 |
+
use Elementor\Group_Control_Image_Size;
|
13 |
+
use Elementor\Group_Control_Typography;
|
14 |
+
use Elementor\Controls_Manager;
|
15 |
+
use Elementor\Utils;
|
16 |
+
|
17 |
+
defined( 'ABSPATH' ) || die();
|
18 |
+
|
19 |
+
class Card extends Addon_Base {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get widget title.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
* @access public
|
26 |
+
*
|
27 |
+
* @return string Widget title.
|
28 |
+
*/
|
29 |
+
public function get_title() {
|
30 |
+
return __( 'Happy Card', 'happy_addons' );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get widget icon.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
* @access public
|
38 |
+
*
|
39 |
+
* @return string Widget icon.
|
40 |
+
*/
|
41 |
+
public function get_icon() {
|
42 |
+
return 'fa fa-smile-o';
|
43 |
+
}
|
44 |
+
|
45 |
+
public function get_keywords() {
|
46 |
+
return [ 'card', 'blurb', 'content', 'block', 'box' ];
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function _register_controls() {
|
50 |
+
$this->start_controls_section(
|
51 |
+
'image_section',
|
52 |
+
[
|
53 |
+
'label' => __( 'Image & Label', 'happy_addons' ),
|
54 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
55 |
+
]
|
56 |
+
);
|
57 |
+
|
58 |
+
$this->add_control(
|
59 |
+
'image',
|
60 |
+
[
|
61 |
+
'label' => __( 'Image', 'happy_addons' ),
|
62 |
+
'type' => Controls_Manager::MEDIA,
|
63 |
+
'default' => [
|
64 |
+
'url' => Utils::get_placeholder_image_src(),
|
65 |
+
],
|
66 |
+
]
|
67 |
+
);
|
68 |
+
|
69 |
+
$this->add_group_control(
|
70 |
+
Group_Control_Image_Size::get_type(),
|
71 |
+
[
|
72 |
+
'name' => 'image',
|
73 |
+
'default' => 'large',
|
74 |
+
'separator' => 'none',
|
75 |
+
]
|
76 |
+
);
|
77 |
+
|
78 |
+
$this->add_responsive_control(
|
79 |
+
'image_position',
|
80 |
+
[
|
81 |
+
'label' => __( 'Image Position', 'happy_addons' ),
|
82 |
+
'type' => Controls_Manager::CHOOSE,
|
83 |
+
'options' => [
|
84 |
+
'left' => [
|
85 |
+
'title' => __( 'Left', 'happy_addons' ),
|
86 |
+
'icon' => 'fa fa-align-left',
|
87 |
+
],
|
88 |
+
'top' => [
|
89 |
+
'title' => __( 'Top', 'happy_addons' ),
|
90 |
+
'icon' => 'fa fa-align-center',
|
91 |
+
],
|
92 |
+
'right' => [
|
93 |
+
'title' => __( 'Right', 'happy_addons' ),
|
94 |
+
'icon' => 'fa fa-align-right',
|
95 |
+
],
|
96 |
+
],
|
97 |
+
'desktop_default' => 'top',
|
98 |
+
'toggle' => false,
|
99 |
+
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
100 |
+
'prefix_class' => 'ha-card--%s'
|
101 |
+
]
|
102 |
+
);
|
103 |
+
|
104 |
+
$this->add_control(
|
105 |
+
'label',
|
106 |
+
[
|
107 |
+
'label' => __( 'Label', 'happy_addons' ),
|
108 |
+
'type' => Controls_Manager::TEXT,
|
109 |
+
'default' => __( 'Default label', 'happy_addons' ),
|
110 |
+
'placeholder' => __( 'Type your label text here', 'happy_addons' ),
|
111 |
+
'separator' => 'before'
|
112 |
+
]
|
113 |
+
);
|
114 |
+
|
115 |
+
$this->add_control(
|
116 |
+
'label_position',
|
117 |
+
[
|
118 |
+
'label' => __( 'Label Position', 'happy_addons' ),
|
119 |
+
'type' => Controls_Manager::SELECT,
|
120 |
+
'options' => [
|
121 |
+
'top-left' => __( 'Top Left', 'happy_addons' ),
|
122 |
+
'top-center' => __( 'Top Center', 'happy_addons' ),
|
123 |
+
'top-right' => __( 'Top Right', 'happy_addons' ),
|
124 |
+
'middle-left' => __( 'Middle Left', 'happy_addons' ),
|
125 |
+
'middle-center' => __( 'Middle Center', 'happy_addons' ),
|
126 |
+
'middle-right' => __( 'Middle Right', 'happy_addons' ),
|
127 |
+
'bottom-left' => __( 'Bottom Left', 'happy_addons' ),
|
128 |
+
'bottom-center' => __( 'Bottom Center', 'happy_addons' ),
|
129 |
+
'bottom-right' => __( 'Bottom Right', 'happy_addons' ),
|
130 |
+
],
|
131 |
+
'default' => 'top-right',
|
132 |
+
]
|
133 |
+
);
|
134 |
+
|
135 |
+
$this->end_controls_section();
|
136 |
+
|
137 |
+
$this->start_controls_section(
|
138 |
+
'title_section',
|
139 |
+
[
|
140 |
+
'label' => __( 'Title & Description', 'happy_addons' ),
|
141 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
142 |
+
]
|
143 |
+
);
|
144 |
+
|
145 |
+
$this->add_control(
|
146 |
+
'title',
|
147 |
+
[
|
148 |
+
'label' => __( 'Title', 'happy_addons' ),
|
149 |
+
'label_block' => true,
|
150 |
+
'type' => Controls_Manager::TEXT,
|
151 |
+
'default' => __( 'Default title', 'happy_addons' ),
|
152 |
+
'placeholder' => __( 'Type your card title here', 'happy_addons' ),
|
153 |
+
]
|
154 |
+
);
|
155 |
+
|
156 |
+
$this->add_control(
|
157 |
+
'description',
|
158 |
+
[
|
159 |
+
'label' => __( 'Description', 'happy_addons' ),
|
160 |
+
'type' => Controls_Manager::TEXTAREA,
|
161 |
+
'default' => __( 'Default description', 'happy_addons' ),
|
162 |
+
'placeholder' => __( 'Type your card description here', 'happy_addons' ),
|
163 |
+
'rows' => 5
|
164 |
+
]
|
165 |
+
);
|
166 |
+
|
167 |
+
$this->add_control(
|
168 |
+
'title_tag',
|
169 |
+
[
|
170 |
+
'label' => __( 'Title HTML Tag', 'happy_addons' ),
|
171 |
+
'type' => Controls_Manager::SELECT,
|
172 |
+
'options' => [
|
173 |
+
'h1' => __( 'H1', 'happy_addons' ),
|
174 |
+
'h2' => __( 'H2', 'happy_addons' ),
|
175 |
+
'h3' => __( 'H3', 'happy_addons' ),
|
176 |
+
'h4' => __( 'H4', 'happy_addons' ),
|
177 |
+
'h5' => __( 'H5', 'happy_addons' ),
|
178 |
+
'h6' => __( 'H6', 'happy_addons' ),
|
179 |
+
],
|
180 |
+
'default' => 'h2',
|
181 |
+
]
|
182 |
+
);
|
183 |
+
|
184 |
+
$this->add_responsive_control(
|
185 |
+
'align',
|
186 |
+
[
|
187 |
+
'label' => __( 'Alignment', 'happy_addons' ),
|
188 |
+
'type' => Controls_Manager::CHOOSE,
|
189 |
+
'options' => [
|
190 |
+
'left' => [
|
191 |
+
'title' => __( 'Left', 'happy_addons' ),
|
192 |
+
'icon' => 'fa fa-align-left',
|
193 |
+
],
|
194 |
+
'center' => [
|
195 |
+
'title' => __( 'Center', 'happy_addons' ),
|
196 |
+
'icon' => 'fa fa-align-center',
|
197 |
+
],
|
198 |
+
'right' => [
|
199 |
+
'title' => __( 'Right', 'happy_addons' ),
|
200 |
+
'icon' => 'fa fa-align-right',
|
201 |
+
],
|
202 |
+
],
|
203 |
+
'desktop_default' => 'left',
|
204 |
+
'toggle' => false,
|
205 |
+
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
206 |
+
'prefix_class' => 'ha-text--%s'
|
207 |
+
]
|
208 |
+
);
|
209 |
+
|
210 |
+
$this->end_controls_section();
|
211 |
+
|
212 |
+
$this->start_controls_section(
|
213 |
+
'button_section',
|
214 |
+
[
|
215 |
+
'label' => __( 'Button', 'happy_addons' ),
|
216 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
217 |
+
]
|
218 |
+
);
|
219 |
+
|
220 |
+
$this->add_control(
|
221 |
+
'btn_text',
|
222 |
+
[
|
223 |
+
'label' => __( 'Text', 'happy_addons' ),
|
224 |
+
'type' => Controls_Manager::TEXT,
|
225 |
+
'default' => __( 'Default text', 'happy_addons' ),
|
226 |
+
'placeholder' => __( 'Type your button text here', 'happy_addons' ),
|
227 |
+
]
|
228 |
+
);
|
229 |
+
|
230 |
+
$this->add_control(
|
231 |
+
'btn_link',
|
232 |
+
[
|
233 |
+
'label' => __( 'Link', 'happy_addons' ),
|
234 |
+
'type' => Controls_Manager::URL,
|
235 |
+
'placeholder' => __( 'https://example.com/', 'happy_addons' ),
|
236 |
+
'default' => [
|
237 |
+
'url' => '#',
|
238 |
+
],
|
239 |
+
]
|
240 |
+
);
|
241 |
+
|
242 |
+
$this->add_control(
|
243 |
+
'btn_icon',
|
244 |
+
[
|
245 |
+
'label' => __( 'Icon', 'happy_addons' ),
|
246 |
+
'type' => Controls_Manager::ICON,
|
247 |
+
'label_block' => true,
|
248 |
+
'default' => '',
|
249 |
+
]
|
250 |
+
);
|
251 |
+
|
252 |
+
$this->add_control(
|
253 |
+
'btn_icon_position',
|
254 |
+
[
|
255 |
+
'label' => __( 'Icon Position', 'happy_addons' ),
|
256 |
+
'type' => Controls_Manager::SELECT,
|
257 |
+
'default' => 'before',
|
258 |
+
'options' => [
|
259 |
+
'before' => __( 'Before', 'happy_addons' ),
|
260 |
+
'after' => __( 'After', 'happy_addons' ),
|
261 |
+
],
|
262 |
+
'condition' => [
|
263 |
+
'btn_icon!' => '',
|
264 |
+
],
|
265 |
+
]
|
266 |
+
);
|
267 |
+
|
268 |
+
$this->add_control(
|
269 |
+
'icon_indent',
|
270 |
+
[
|
271 |
+
'label' => __( 'Icon Spacing', 'happy_addons' ),
|
272 |
+
'type' => Controls_Manager::SLIDER,
|
273 |
+
'range' => [
|
274 |
+
'px' => [
|
275 |
+
'max' => 50,
|
276 |
+
],
|
277 |
+
],
|
278 |
+
'condition' => [
|
279 |
+
'btn_icon!' => '',
|
280 |
+
],
|
281 |
+
'selectors' => [
|
282 |
+
'{{WRAPPER}} .ha-btn--icon-before .ha-btn-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
|
283 |
+
'{{WRAPPER}} .ha-btn--icon-after .ha-btn-icon' => 'margin-left: {{SIZE}}{{UNIT}};',
|
284 |
+
],
|
285 |
+
]
|
286 |
+
);
|
287 |
+
|
288 |
+
$this->end_controls_section();
|
289 |
+
|
290 |
+
$this->start_controls_section(
|
291 |
+
'image_style',
|
292 |
+
[
|
293 |
+
'label' => __( 'Image', 'happy_addons' ),
|
294 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
295 |
+
]
|
296 |
+
);
|
297 |
+
|
298 |
+
$this->add_responsive_control(
|
299 |
+
'width',
|
300 |
+
[
|
301 |
+
'label' => __( 'Width', 'happy_addons' ),
|
302 |
+
'type' => Controls_Manager::SLIDER,
|
303 |
+
'default' => [
|
304 |
+
'unit' => '%',
|
305 |
+
],
|
306 |
+
'tablet_default' => [
|
307 |
+
'unit' => '%',
|
308 |
+
],
|
309 |
+
'mobile_default' => [
|
310 |
+
'unit' => '%',
|
311 |
+
],
|
312 |
+
'size_units' => [ '%', 'px' ],
|
313 |
+
'range' => [
|
314 |
+
'%' => [
|
315 |
+
'min' => 1,
|
316 |
+
'max' => 100,
|
317 |
+
],
|
318 |
+
'px' => [
|
319 |
+
'min' => 1,
|
320 |
+
'max' => 1000,
|
321 |
+
],
|
322 |
+
],
|
323 |
+
'selectors' => [
|
324 |
+
'{{WRAPPER}} .ha-card-figure' => 'max-width: {{SIZE}}{{UNIT}};',
|
325 |
+
],
|
326 |
+
]
|
327 |
+
);
|
328 |
+
|
329 |
+
$this->add_responsive_control(
|
330 |
+
'image_offset',
|
331 |
+
[
|
332 |
+
'label' => __( 'Offset', 'happy_addons' ),
|
333 |
+
'type' => Controls_Manager::DIMENSIONS,
|
334 |
+
'size_units' => [ 'px', '%' ],
|
335 |
+
'allowed_dimensions' => ['top', 'left'],
|
336 |
+
'selectors' => [
|
337 |
+
'{{WRAPPER}} .ha-card-figure' => '-ms-transform: translate({{LEFT}}{{UNIT}}, {{TOP}}{{UNIT}}); -webkit-transform: translate({{LEFT}}{{UNIT}}, {{TOP}}{{UNIT}}); transform: translate({{LEFT}}{{UNIT}}, {{TOP}}{{UNIT}});',
|
338 |
+
'{{WRAPPER}} .ha-card-body' => 'margin-top: {{TOP}}{{UNIT}};',
|
339 |
+
],
|
340 |
+
'default' => [
|
341 |
+
'isLinked' => false,
|
342 |
+
]
|
343 |
+
]
|
344 |
+
);
|
345 |
+
|
346 |
+
$this->add_responsive_control(
|
347 |
+
'image_padding',
|
348 |
+
[
|
349 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
350 |
+
'type' => Controls_Manager::DIMENSIONS,
|
351 |
+
'size_units' => [ 'px', 'em', '%' ],
|
352 |
+
'selectors' => [
|
353 |
+
'{{WRAPPER}} .ha-card-figure > img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
354 |
+
],
|
355 |
+
]
|
356 |
+
);
|
357 |
+
|
358 |
+
$this->add_group_control(
|
359 |
+
Group_Control_Border::get_type(),
|
360 |
+
[
|
361 |
+
'name' => 'image_border',
|
362 |
+
'selector' => '{{WRAPPER}} .ha-card-figure > img',
|
363 |
+
]
|
364 |
+
);
|
365 |
+
|
366 |
+
$this->add_responsive_control(
|
367 |
+
'image_border_radius',
|
368 |
+
[
|
369 |
+
'label' => __( 'Border Radius', 'happy_addons' ),
|
370 |
+
'type' => Controls_Manager::DIMENSIONS,
|
371 |
+
'size_units' => [ 'px', '%' ],
|
372 |
+
'selectors' => [
|
373 |
+
'{{WRAPPER}} .ha-card-figure > img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
374 |
+
],
|
375 |
+
]
|
376 |
+
);
|
377 |
+
|
378 |
+
$this->add_group_control(
|
379 |
+
Group_Control_Box_Shadow::get_type(),
|
380 |
+
[
|
381 |
+
'name' => 'image_box_shadow',
|
382 |
+
'exclude' => [
|
383 |
+
'box_shadow_position',
|
384 |
+
],
|
385 |
+
'selector' => '{{WRAPPER}} .ha-card-figure > img',
|
386 |
+
]
|
387 |
+
);
|
388 |
+
|
389 |
+
$this->end_controls_section();
|
390 |
+
|
391 |
+
$this->start_controls_section(
|
392 |
+
'label_style',
|
393 |
+
[
|
394 |
+
'label' => __( 'Label', 'happy_addons' ),
|
395 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
396 |
+
]
|
397 |
+
);
|
398 |
+
|
399 |
+
$this->add_responsive_control(
|
400 |
+
'label_margin',
|
401 |
+
[
|
402 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
403 |
+
'type' => Controls_Manager::DIMENSIONS,
|
404 |
+
'size_units' => [ 'px', '%' ],
|
405 |
+
'selectors' => [
|
406 |
+
'{{WRAPPER}} .ha-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
407 |
+
],
|
408 |
+
]
|
409 |
+
);
|
410 |
+
|
411 |
+
$this->add_responsive_control(
|
412 |
+
'label_padding',
|
413 |
+
[
|
414 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
415 |
+
'type' => Controls_Manager::DIMENSIONS,
|
416 |
+
'size_units' => [ 'px', 'em', '%' ],
|
417 |
+
'selectors' => [
|
418 |
+
'{{WRAPPER}} .ha-label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
419 |
+
],
|
420 |
+
]
|
421 |
+
);
|
422 |
+
|
423 |
+
$this->add_control(
|
424 |
+
'label_color',
|
425 |
+
[
|
426 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
427 |
+
'type' => Controls_Manager::COLOR,
|
428 |
+
'selectors' => [
|
429 |
+
'{{WRAPPER}} .ha-label' => 'color: {{VALUE}}',
|
430 |
+
],
|
431 |
+
]
|
432 |
+
);
|
433 |
+
|
434 |
+
$this->add_control(
|
435 |
+
'label_bg_color',
|
436 |
+
[
|
437 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
438 |
+
'type' => Controls_Manager::COLOR,
|
439 |
+
'selectors' => [
|
440 |
+
'{{WRAPPER}} .ha-label' => 'background-color: {{VALUE}}',
|
441 |
+
],
|
442 |
+
]
|
443 |
+
);
|
444 |
+
|
445 |
+
$this->add_group_control(
|
446 |
+
Group_Control_Border::get_type(),
|
447 |
+
[
|
448 |
+
'name' => 'label_border',
|
449 |
+
'selector' => '{{WRAPPER}} .ha-label',
|
450 |
+
]
|
451 |
+
);
|
452 |
+
|
453 |
+
$this->add_responsive_control(
|
454 |
+
'label_border_radius',
|
455 |
+
[
|
456 |
+
'label' => __( 'Border Radius', 'happy_addons' ),
|
457 |
+
'type' => Controls_Manager::DIMENSIONS,
|
458 |
+
'size_units' => [ 'px', '%' ],
|
459 |
+
'selectors' => [
|
460 |
+
'{{WRAPPER}} .ha-label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
461 |
+
],
|
462 |
+
]
|
463 |
+
);
|
464 |
+
|
465 |
+
$this->add_group_control(
|
466 |
+
Group_Control_Box_Shadow::get_type(),
|
467 |
+
[
|
468 |
+
'name' => 'label_box_shadow',
|
469 |
+
'exclude' => [
|
470 |
+
'box_shadow_position',
|
471 |
+
],
|
472 |
+
'selector' => '{{WRAPPER}} .ha-label',
|
473 |
+
]
|
474 |
+
);
|
475 |
+
|
476 |
+
$this->add_group_control(
|
477 |
+
Group_Control_Typography::get_type(),
|
478 |
+
[
|
479 |
+
'name' => 'label_typography',
|
480 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
481 |
+
'exclude' => [
|
482 |
+
'font_family',
|
483 |
+
'line_height'
|
484 |
+
],
|
485 |
+
'selector' => '{{WRAPPER}} .ha-label',
|
486 |
+
]
|
487 |
+
);
|
488 |
+
|
489 |
+
$this->end_controls_section();
|
490 |
+
|
491 |
+
$this->start_controls_section(
|
492 |
+
'content_style',
|
493 |
+
[
|
494 |
+
'label' => __( 'Content', 'happy_addons' ),
|
495 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
496 |
+
]
|
497 |
+
);
|
498 |
+
|
499 |
+
$this->add_responsive_control(
|
500 |
+
'content_padding',
|
501 |
+
[
|
502 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
503 |
+
'type' => Controls_Manager::DIMENSIONS,
|
504 |
+
'size_units' => [ 'px', 'em', '%' ],
|
505 |
+
'selectors' => [
|
506 |
+
'{{WRAPPER}} .ha-card-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
507 |
+
],
|
508 |
+
]
|
509 |
+
);
|
510 |
+
|
511 |
+
$this->add_control(
|
512 |
+
'title_heading',
|
513 |
+
[
|
514 |
+
'type' => Controls_Manager::HEADING,
|
515 |
+
'label' => __( 'Title', 'happy_addons' ),
|
516 |
+
'separator' => 'before'
|
517 |
+
]
|
518 |
+
);
|
519 |
+
|
520 |
+
$this->add_responsive_control(
|
521 |
+
'title_margin',
|
522 |
+
[
|
523 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
524 |
+
'type' => Controls_Manager::DIMENSIONS,
|
525 |
+
'size_units' => [ 'px', '%' ],
|
526 |
+
'selectors' => [
|
527 |
+
'{{WRAPPER}} .ha-card-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
528 |
+
],
|
529 |
+
]
|
530 |
+
);
|
531 |
+
|
532 |
+
$this->add_control(
|
533 |
+
'title_color',
|
534 |
+
[
|
535 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
536 |
+
'type' => Controls_Manager::COLOR,
|
537 |
+
'selectors' => [
|
538 |
+
'{{WRAPPER}} .ha-card-title' => 'color: {{VALUE}}',
|
539 |
+
],
|
540 |
+
]
|
541 |
+
);
|
542 |
+
|
543 |
+
$this->add_group_control(
|
544 |
+
Group_Control_Typography::get_type(),
|
545 |
+
[
|
546 |
+
'name' => 'title_typography',
|
547 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
548 |
+
'selector' => '{{WRAPPER}} .ha-card-title',
|
549 |
+
]
|
550 |
+
);
|
551 |
+
|
552 |
+
$this->add_control(
|
553 |
+
'description_heading',
|
554 |
+
[
|
555 |
+
'type' => Controls_Manager::HEADING,
|
556 |
+
'label' => __( 'Description', 'happy_addons' ),
|
557 |
+
'separator' => 'before'
|
558 |
+
]
|
559 |
+
);
|
560 |
+
|
561 |
+
$this->add_responsive_control(
|
562 |
+
'description_margin',
|
563 |
+
[
|
564 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
565 |
+
'type' => Controls_Manager::DIMENSIONS,
|
566 |
+
'size_units' => [ 'px', '%' ],
|
567 |
+
'selectors' => [
|
568 |
+
'{{WRAPPER}} .ha-card-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
569 |
+
],
|
570 |
+
]
|
571 |
+
);
|
572 |
+
|
573 |
+
$this->add_control(
|
574 |
+
'description_color',
|
575 |
+
[
|
576 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
577 |
+
'type' => Controls_Manager::COLOR,
|
578 |
+
'selectors' => [
|
579 |
+
'{{WRAPPER}} .ha-card-text' => 'color: {{VALUE}}',
|
580 |
+
],
|
581 |
+
]
|
582 |
+
);
|
583 |
+
|
584 |
+
$this->add_group_control(
|
585 |
+
Group_Control_Typography::get_type(),
|
586 |
+
[
|
587 |
+
'name' => 'description_typography',
|
588 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
589 |
+
'selector' => '{{WRAPPER}} .ha-card-text',
|
590 |
+
]
|
591 |
+
);
|
592 |
+
|
593 |
+
$this->end_controls_section();
|
594 |
+
|
595 |
+
$this->start_controls_section(
|
596 |
+
'btn_style',
|
597 |
+
[
|
598 |
+
'label' => __( 'Button', 'happy_addons' ),
|
599 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
600 |
+
]
|
601 |
+
);
|
602 |
+
|
603 |
+
$this->add_responsive_control(
|
604 |
+
'btn_padding',
|
605 |
+
[
|
606 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
607 |
+
'type' => Controls_Manager::DIMENSIONS,
|
608 |
+
'size_units' => [ 'px', 'em', '%' ],
|
609 |
+
'selectors' => [
|
610 |
+
'{{WRAPPER}} .ha-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
611 |
+
],
|
612 |
+
]
|
613 |
+
);
|
614 |
+
|
615 |
+
$this->add_group_control(
|
616 |
+
Group_Control_Typography::get_type(),
|
617 |
+
[
|
618 |
+
'name' => 'btn_typography',
|
619 |
+
'selector' => '{{WRAPPER}} .ha-btn',
|
620 |
+
]
|
621 |
+
);
|
622 |
+
|
623 |
+
$this->add_group_control(
|
624 |
+
Group_Control_Border::get_type(),
|
625 |
+
[
|
626 |
+
'name' => 'btn_border',
|
627 |
+
'selector' => '{{WRAPPER}} .ha-btn',
|
628 |
+
]
|
629 |
+
);
|
630 |
+
|
631 |
+
$this->add_control(
|
632 |
+
'btn_border_radius',
|
633 |
+
[
|
634 |
+
'label' => __( 'Border Radius', 'happy_addons' ),
|
635 |
+
'type' => Controls_Manager::DIMENSIONS,
|
636 |
+
'size_units' => [ 'px', '%' ],
|
637 |
+
'selectors' => [
|
638 |
+
'{{WRAPPER}} .ha-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
639 |
+
],
|
640 |
+
]
|
641 |
+
);
|
642 |
+
|
643 |
+
$this->add_group_control(
|
644 |
+
Group_Control_Box_Shadow::get_type(),
|
645 |
+
[
|
646 |
+
'name' => 'btn_box_shadow',
|
647 |
+
'selector' => '{{WRAPPER}} .ha-btn',
|
648 |
+
]
|
649 |
+
);
|
650 |
+
|
651 |
+
$this->add_control(
|
652 |
+
'hr',
|
653 |
+
[
|
654 |
+
'type' => Controls_Manager::DIVIDER,
|
655 |
+
'style' => 'thick',
|
656 |
+
]
|
657 |
+
);
|
658 |
+
|
659 |
+
$this->start_controls_tabs( 'tabs_button_style' );
|
660 |
+
|
661 |
+
$this->start_controls_tab(
|
662 |
+
'tab_button_normal',
|
663 |
+
[
|
664 |
+
'label' => __( 'Normal', 'happy_addons' ),
|
665 |
+
]
|
666 |
+
);
|
667 |
+
|
668 |
+
$this->add_control(
|
669 |
+
'btn_color',
|
670 |
+
[
|
671 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
672 |
+
'type' => Controls_Manager::COLOR,
|
673 |
+
'default' => '',
|
674 |
+
'selectors' => [
|
675 |
+
'{{WRAPPER}} .ha-btn' => 'color: {{VALUE}};',
|
676 |
+
],
|
677 |
+
]
|
678 |
+
);
|
679 |
+
|
680 |
+
$this->add_control(
|
681 |
+
'btn_bg_color',
|
682 |
+
[
|
683 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
684 |
+
'type' => Controls_Manager::COLOR,
|
685 |
+
'selectors' => [
|
686 |
+
'{{WRAPPER}} .ha-btn' => 'background-color: {{VALUE}};',
|
687 |
+
],
|
688 |
+
]
|
689 |
+
);
|
690 |
+
|
691 |
+
$this->end_controls_tab();
|
692 |
+
|
693 |
+
$this->start_controls_tab(
|
694 |
+
'tab_button_hover',
|
695 |
+
[
|
696 |
+
'label' => __( 'Hover', 'happy_addons' ),
|
697 |
+
]
|
698 |
+
);
|
699 |
+
|
700 |
+
$this->add_control(
|
701 |
+
'btn_hover_color',
|
702 |
+
[
|
703 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
704 |
+
'type' => Controls_Manager::COLOR,
|
705 |
+
'selectors' => [
|
706 |
+
'{{WRAPPER}} .ha-btn:hover, {{WRAPPER}} .ha-btn:focus' => 'color: {{VALUE}};',
|
707 |
+
],
|
708 |
+
]
|
709 |
+
);
|
710 |
+
|
711 |
+
$this->add_control(
|
712 |
+
'btn_hover_bg_color',
|
713 |
+
[
|
714 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
715 |
+
'type' => Controls_Manager::COLOR,
|
716 |
+
'selectors' => [
|
717 |
+
'{{WRAPPER}} .ha-btn:hover, {{WRAPPER}} .ha-btn:focus' => 'background-color: {{VALUE}};',
|
718 |
+
],
|
719 |
+
]
|
720 |
+
);
|
721 |
+
|
722 |
+
$this->add_control(
|
723 |
+
'btn_hover_border_color',
|
724 |
+
[
|
725 |
+
'label' => __( 'Border Color', 'happy_addons' ),
|
726 |
+
'type' => Controls_Manager::COLOR,
|
727 |
+
'condition' => [
|
728 |
+
'btn_border_border!' => '',
|
729 |
+
],
|
730 |
+
'selectors' => [
|
731 |
+
'{{WRAPPER}} .ha-btn:hover, {{WRAPPER}} .ha-btn:focus' => 'border-color: {{VALUE}};',
|
732 |
+
],
|
733 |
+
]
|
734 |
+
);
|
735 |
+
|
736 |
+
$this->end_controls_tab();
|
737 |
+
$this->end_controls_tabs();
|
738 |
+
|
739 |
+
$this->end_controls_section();
|
740 |
+
}
|
741 |
+
|
742 |
+
public function get_custom_wrapper_class() {
|
743 |
+
return 'ha-card';
|
744 |
+
}
|
745 |
+
|
746 |
+
protected function render() {
|
747 |
+
$settings = $this->get_settings_for_display();
|
748 |
+
|
749 |
+
$this->add_inline_editing_attributes( 'label', 'none' );
|
750 |
+
$this->add_render_attribute(
|
751 |
+
'label',
|
752 |
+
'class',
|
753 |
+
['ha-label', sprintf( 'ha-label--%s', esc_attr( $settings['label_position'] ) )]
|
754 |
+
);
|
755 |
+
|
756 |
+
$this->add_inline_editing_attributes( 'title', 'none' );
|
757 |
+
$this->add_render_attribute( 'title', 'class', 'ha-card-title' );
|
758 |
+
|
759 |
+
$this->add_inline_editing_attributes( 'description', 'basic' );
|
760 |
+
$this->add_render_attribute( 'description', 'class', 'ha-card-text' );
|
761 |
+
|
762 |
+
$this->add_inline_editing_attributes( 'btn_text', 'none' );
|
763 |
+
$this->add_render_attribute( 'btn_text', 'class', 'ha-btn-text' );
|
764 |
+
|
765 |
+
$this->add_render_attribute( 'btn', 'class', 'ha-btn' );
|
766 |
+
$this->add_render_attribute( 'btn', 'href', esc_url( $settings['btn_link']['url'] ) );
|
767 |
+
if ( ! empty( $settings['btn_link']['is_external'] ) ) {
|
768 |
+
$this->add_render_attribute( 'btn', 'target', '_blank' );
|
769 |
+
}
|
770 |
+
if ( ! empty( $settings['btn_link']['nofollow'] ) ) {
|
771 |
+
$this->set_render_attribute( 'btn', 'rel', 'nofollow' );
|
772 |
+
}
|
773 |
+
?>
|
774 |
+
|
775 |
+
<?php if ( ! empty( $settings['image']['url'] ) ) :
|
776 |
+
$this->add_render_attribute( 'image', 'src', $settings['image']['url'] );
|
777 |
+
$this->add_render_attribute( 'image', 'alt', Control_Media::get_image_alt( $settings['image'] ) );
|
778 |
+
$this->add_render_attribute( 'image', 'title', Control_Media::get_image_title( $settings['image'] ) );
|
779 |
+
$settings['hover_animation'] = 'disable-animation'; // hack to prevent image hover animation
|
780 |
+
?>
|
781 |
+
<figure class="ha-card-figure">
|
782 |
+
<?php echo Group_Control_Image_Size::get_attachment_image_html( $settings, 'image', 'image' ); ?>
|
783 |
+
<div <?php echo $this->get_render_attribute_string( 'label' ); ?>><?php echo esc_html( $settings['label'] ); ?></div>
|
784 |
+
</figure>
|
785 |
+
<?php endif; ?>
|
786 |
+
|
787 |
+
<div class="ha-card-body">
|
788 |
+
<?php printf( '<%1$s %2$s>%3$s</%1$s>',
|
789 |
+
tag_escape( $settings['title_tag'] ),
|
790 |
+
$this->get_render_attribute_string( 'title' ),
|
791 |
+
esc_html( $settings['title' ] )
|
792 |
+
); ?>
|
793 |
+
<div <?php echo $this->get_render_attribute_string( 'description' ); ?>>
|
794 |
+
<p><?php echo wp_kses_data( $settings['description'] ); ?></p>
|
795 |
+
</div>
|
796 |
+
<?php
|
797 |
+
if ( $settings['btn_text'] && empty( $settings['btn_icon'] ) ) :
|
798 |
+
printf( '<a %1$s>%2$s</a>',
|
799 |
+
$this->get_render_attribute_string( 'btn' ),
|
800 |
+
sprintf( '<span %1$s>%2$s</span>', $this->get_render_attribute_string( 'btn_text' ), esc_html( $settings['btn_text'] ) )
|
801 |
+
);
|
802 |
+
elseif ( empty( $settings['btn_text'] ) && $settings['btn_icon'] ) :
|
803 |
+
printf( '<a %1$s>%2$s</a>',
|
804 |
+
$this->get_render_attribute_string( 'btn' ),
|
805 |
+
sprintf( '<i class="%1$s"></i>', esc_attr( $settings['btn_icon'] ) )
|
806 |
+
);
|
807 |
+
elseif ( $settings['btn_text'] && $settings['btn_icon'] ) :
|
808 |
+
if ( $settings['btn_icon_position'] === 'before' ) :
|
809 |
+
$this->add_render_attribute( 'btn', 'class', 'ha-btn--icon-before' );
|
810 |
+
$btn_before = sprintf( '<i class="ha-btn-icon %1$s"></i>', esc_attr( $settings['btn_icon'] ) );
|
811 |
+
$btn_after = sprintf( '<span %1$s>%2$s</span>', $this->get_render_attribute_string( 'btn_text' ), esc_html( $settings['btn_text'] ) );
|
812 |
+
else :
|
813 |
+
$this->add_render_attribute( 'btn', 'class', 'ha-btn--icon-after' );
|
814 |
+
$btn_before = sprintf( '<span %1$s>%2$s</span>', $this->get_render_attribute_string( 'btn_text' ), esc_html( $settings['btn_text'] ) );
|
815 |
+
$btn_after = sprintf( '<i class="ha-btn-icon %1$s"></i>', esc_attr( $settings['btn_icon'] ) );
|
816 |
+
endif;
|
817 |
+
printf( '<a %1$s>%2$s %3$s</a>',
|
818 |
+
$this->get_render_attribute_string( 'btn' ),
|
819 |
+
$btn_before,
|
820 |
+
$btn_after
|
821 |
+
);
|
822 |
+
endif;
|
823 |
+
?>
|
824 |
+
</div>
|
825 |
+
<?php
|
826 |
+
}
|
827 |
+
|
828 |
+
public function _content_template() {
|
829 |
+
?>
|
830 |
+
<#
|
831 |
+
view.addInlineEditingAttributes( 'label', 'none' );
|
832 |
+
view.addRenderAttribute(
|
833 |
+
'label',
|
834 |
+
'class',
|
835 |
+
['ha-label', 'ha-label--' + settings.label_position]
|
836 |
+
);
|
837 |
+
|
838 |
+
view.addInlineEditingAttributes( 'title', 'none' );
|
839 |
+
view.addRenderAttribute( 'title', 'class', 'ha-card-title' );
|
840 |
+
|
841 |
+
view.addInlineEditingAttributes( 'description', 'basic' );
|
842 |
+
view.addRenderAttribute( 'description', 'class', 'ha-card-text' );
|
843 |
+
|
844 |
+
view.addInlineEditingAttributes( 'btn_text', 'none' );
|
845 |
+
view.addRenderAttribute( 'btn_text', 'class', 'ha-btn-text' );
|
846 |
+
|
847 |
+
view.addRenderAttribute( 'btn', 'class', 'ha-btn' );
|
848 |
+
view.addRenderAttribute( 'btn', 'href', settings.btn_link.url );
|
849 |
+
|
850 |
+
if ( settings.image.url ) {
|
851 |
+
var image = {
|
852 |
+
id: settings.image.id,
|
853 |
+
url: settings.image.url,
|
854 |
+
size: settings.image_size,
|
855 |
+
dimension: settings.image_custom_dimension,
|
856 |
+
model: view.getEditModel()
|
857 |
+
};
|
858 |
+
|
859 |
+
var image_url = elementor.imagesManager.getImageUrl( image );
|
860 |
+
#>
|
861 |
+
<figure class="ha-card-figure">
|
862 |
+
<img src="{{ image_url }}">
|
863 |
+
<div {{{ view.getRenderAttributeString( 'label' ) }}}>{{ settings.label }}</div>
|
864 |
+
</figure>
|
865 |
+
<# } #>
|
866 |
+
|
867 |
+
<div class="ha-card-body">
|
868 |
+
<{{ settings.title_tag }} {{{ view.getRenderAttributeString( 'title' ) }}}>{{ settings.title }}</{{ settings.title_tag }}>
|
869 |
+
|
870 |
+
<div {{{ view.getRenderAttributeString( 'description' ) }}}>
|
871 |
+
<p>{{{ settings.description }}}</p>
|
872 |
+
</div>
|
873 |
+
|
874 |
+
<# if ( settings.btn_text && ! settings.btn_icon ) { #>
|
875 |
+
<a {{{ view.getRenderAttributeString( 'btn' ) }}}><span {{{ view.getRenderAttributeString( 'btn_text' ) }}}>{{ settings.btn_text }}</span></a>
|
876 |
+
<# } else if ( ! settings.btn_text && settings.btn_icon ) { #>
|
877 |
+
<a {{{ view.getRenderAttributeString( 'btn' ) }}}><i class="{{ settings.btn_icon }}"></i></a>
|
878 |
+
<# } else if ( settings.btn_text && settings.btn_icon ) { #>
|
879 |
+
<#
|
880 |
+
if ( settings.btn_icon_position === 'before' ) {
|
881 |
+
view.addRenderAttribute( 'btn', 'class', 'ha-btn--icon-before' );
|
882 |
+
var btn_before = '<i class="ha-btn-icon ' + settings.btn_icon + '"></i>';
|
883 |
+
var btn_after = '<span ' + view.getRenderAttributeString( 'btn_text' ) + '>' + settings.btn_text + '</span>';
|
884 |
+
} else {
|
885 |
+
view.addRenderAttribute( 'btn', 'class', 'ha-btn--icon-after' );
|
886 |
+
var btn_after = '<i class="ha-btn-icon ' + settings.btn_icon + '"></i>';
|
887 |
+
var btn_before = '<span ' + view.getRenderAttributeString( 'btn_text' ) + '>' + settings.btn_text + '</span>';
|
888 |
+
}
|
889 |
+
#>
|
890 |
+
<a {{{ view.getRenderAttributeString( 'btn' ) }}}>{{{ btn_before }}} {{{ btn_after }}}</a>
|
891 |
+
<# } #>
|
892 |
+
</div>
|
893 |
+
<?php
|
894 |
+
}
|
895 |
+
}
|
addons/class-cf7.php
ADDED
@@ -0,0 +1,544 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contact form 7 addon class
|
4 |
+
*
|
5 |
+
* @package Happy_Addons
|
6 |
+
*/
|
7 |
+
namespace Happy_Addons\Elementor\Addons;
|
8 |
+
|
9 |
+
use Elementor\Controls_Manager;
|
10 |
+
use Elementor\Group_Control_Border;
|
11 |
+
use Elementor\Group_Control_Box_Shadow;
|
12 |
+
use Elementor\Group_Control_Typography;
|
13 |
+
|
14 |
+
defined( 'ABSPATH' ) || die();
|
15 |
+
|
16 |
+
class CF7 extends Addon_Base {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get widget title.
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
* @access public
|
23 |
+
*
|
24 |
+
* @return string Widget title.
|
25 |
+
*/
|
26 |
+
public function get_title() {
|
27 |
+
return __( 'Happy CF7', 'happy_addons' );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Get widget icon.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
* @access public
|
35 |
+
*
|
36 |
+
* @return string Widget icon.
|
37 |
+
*/
|
38 |
+
public function get_icon() {
|
39 |
+
return 'fa fa-smile-o';
|
40 |
+
}
|
41 |
+
|
42 |
+
public function get_keywords() {
|
43 |
+
return [ 'form', 'contact', 'cf7', 'contact form', 'gravity', 'ninja' ];
|
44 |
+
}
|
45 |
+
|
46 |
+
protected function _register_controls() {
|
47 |
+
$this->start_controls_section(
|
48 |
+
'cf7',
|
49 |
+
[
|
50 |
+
'label' => ha_is_cf7_activated() ? __( 'Contact Form 7', 'happy_addons' ) : __( 'Notice', 'happy_addons' ),
|
51 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
52 |
+
]
|
53 |
+
);
|
54 |
+
|
55 |
+
if ( ! ha_is_cf7_activated() ) {
|
56 |
+
$this->add_control(
|
57 |
+
'cf7_missing_notice',
|
58 |
+
[
|
59 |
+
'type' => Controls_Manager::RAW_HTML,
|
60 |
+
'raw' => sprintf(
|
61 |
+
__( 'Hi, it seems %1$s is missing in your site. Please install and activate %1$s first.', 'happy_addons' ),
|
62 |
+
'<a href="https://wordpress.org/plugins/contact-form-7/" target="_blank" rel="noopener">Contact Form 7</a>'
|
63 |
+
)
|
64 |
+
]
|
65 |
+
);
|
66 |
+
$this->end_controls_section();
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->add_control(
|
71 |
+
'id',
|
72 |
+
[
|
73 |
+
'label' => __( 'Select Your Form', 'happy_addons' ),
|
74 |
+
'type' => Controls_Manager::SELECT,
|
75 |
+
'label_block' => true,
|
76 |
+
'options' => ['' => __( '', 'happy_addons' ) ] + \ha_get_cf7_forms(),
|
77 |
+
]
|
78 |
+
);
|
79 |
+
|
80 |
+
$this->add_control(
|
81 |
+
'html_class',
|
82 |
+
[
|
83 |
+
'label' => __( 'HTML Class', 'happy_addons' ),
|
84 |
+
'type' => Controls_Manager::TEXT,
|
85 |
+
'label_block' => true,
|
86 |
+
'description' => __( 'Add CSS custom class to the form.', 'happy_addons' ),
|
87 |
+
]
|
88 |
+
);
|
89 |
+
|
90 |
+
$this->end_controls_section();
|
91 |
+
|
92 |
+
$this->start_controls_section(
|
93 |
+
'cf7-form-fields',
|
94 |
+
[
|
95 |
+
'label' => __( 'Form Fields (Regular Style)', 'happy_addons' ),
|
96 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
97 |
+
]
|
98 |
+
);
|
99 |
+
|
100 |
+
$this->add_responsive_control(
|
101 |
+
'field_width',
|
102 |
+
[
|
103 |
+
'label' => __( 'Width', 'happy_addons' ),
|
104 |
+
'type' => Controls_Manager::SLIDER,
|
105 |
+
'default' => [
|
106 |
+
'unit' => '%',
|
107 |
+
],
|
108 |
+
'tablet_default' => [
|
109 |
+
'unit' => '%',
|
110 |
+
],
|
111 |
+
'mobile_default' => [
|
112 |
+
'unit' => '%',
|
113 |
+
],
|
114 |
+
'size_units' => [ '%', 'px' ],
|
115 |
+
'range' => [
|
116 |
+
'%' => [
|
117 |
+
'min' => 1,
|
118 |
+
'max' => 100,
|
119 |
+
],
|
120 |
+
'px' => [
|
121 |
+
'min' => 1,
|
122 |
+
'max' => 500,
|
123 |
+
],
|
124 |
+
],
|
125 |
+
'selectors' => [
|
126 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)' => 'width: {{SIZE}}{{UNIT}};',
|
127 |
+
],
|
128 |
+
]
|
129 |
+
);
|
130 |
+
|
131 |
+
$this->add_responsive_control(
|
132 |
+
'field_margin',
|
133 |
+
[
|
134 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
135 |
+
'type' => Controls_Manager::DIMENSIONS,
|
136 |
+
'size_units' => [ 'px', '%' ],
|
137 |
+
'selectors' => [
|
138 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
139 |
+
],
|
140 |
+
]
|
141 |
+
);
|
142 |
+
|
143 |
+
$this->add_responsive_control(
|
144 |
+
'field_padding',
|
145 |
+
[
|
146 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
147 |
+
'type' => Controls_Manager::DIMENSIONS,
|
148 |
+
'size_units' => [ 'px', 'em', '%' ],
|
149 |
+
'selectors' => [
|
150 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
151 |
+
],
|
152 |
+
]
|
153 |
+
);
|
154 |
+
|
155 |
+
$this->add_group_control(
|
156 |
+
Group_Control_Border::get_type(),
|
157 |
+
[
|
158 |
+
'name' => 'field_border',
|
159 |
+
'selector' => '{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)',
|
160 |
+
]
|
161 |
+
);
|
162 |
+
|
163 |
+
$this->add_responsive_control(
|
164 |
+
'field_border_radius',
|
165 |
+
[
|
166 |
+
'label' => __( 'Border Radius', 'happy_addons' ),
|
167 |
+
'type' => Controls_Manager::DIMENSIONS,
|
168 |
+
'size_units' => [ 'px', '%' ],
|
169 |
+
'selectors' => [
|
170 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
171 |
+
],
|
172 |
+
]
|
173 |
+
);
|
174 |
+
|
175 |
+
$this->add_group_control(
|
176 |
+
Group_Control_Box_Shadow::get_type(),
|
177 |
+
[
|
178 |
+
'name' => 'field_box_shadow',
|
179 |
+
'selector' => '{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)',
|
180 |
+
]
|
181 |
+
);
|
182 |
+
|
183 |
+
$this->add_control(
|
184 |
+
'hr',
|
185 |
+
[
|
186 |
+
'type' => Controls_Manager::DIVIDER,
|
187 |
+
'style' => 'thick',
|
188 |
+
]
|
189 |
+
);
|
190 |
+
|
191 |
+
$this->add_group_control(
|
192 |
+
Group_Control_Typography::get_type(),
|
193 |
+
[
|
194 |
+
'name' => 'field_typography',
|
195 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
196 |
+
'selector' => '{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)',
|
197 |
+
]
|
198 |
+
);
|
199 |
+
|
200 |
+
$this->add_control(
|
201 |
+
'field_color',
|
202 |
+
[
|
203 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
204 |
+
'type' => Controls_Manager::COLOR,
|
205 |
+
'selectors' => [
|
206 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)' => 'color: {{VALUE}}',
|
207 |
+
],
|
208 |
+
]
|
209 |
+
);
|
210 |
+
|
211 |
+
$this->add_control(
|
212 |
+
'field_placeholder_color',
|
213 |
+
[
|
214 |
+
'label' => __( 'Placeholder Text Color', 'happy_addons' ),
|
215 |
+
'type' => Controls_Manager::COLOR,
|
216 |
+
'selectors' => [
|
217 |
+
'{{WRAPPER}} ::-webkit-input-placeholder' => 'color: {{VALUE}};',
|
218 |
+
'{{WRAPPER}} ::-moz-placeholder' => 'color: {{VALUE}};',
|
219 |
+
'{{WRAPPER}} ::-ms-input-placeholder' => 'color: {{VALUE}};',
|
220 |
+
],
|
221 |
+
]
|
222 |
+
);
|
223 |
+
|
224 |
+
$this->add_control(
|
225 |
+
'field_bg_color',
|
226 |
+
[
|
227 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
228 |
+
'type' => Controls_Manager::COLOR,
|
229 |
+
'selectors' => [
|
230 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit)' => 'background-color: {{VALUE}}',
|
231 |
+
],
|
232 |
+
]
|
233 |
+
);
|
234 |
+
|
235 |
+
$this->end_controls_section();
|
236 |
+
|
237 |
+
$this->start_controls_section(
|
238 |
+
'cf7-form-fields-focus',
|
239 |
+
[
|
240 |
+
'label' => __( 'Form Fields (Focus Style)', 'happy_addons' ),
|
241 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
242 |
+
]
|
243 |
+
);
|
244 |
+
|
245 |
+
$this->add_group_control(
|
246 |
+
Group_Control_Border::get_type(),
|
247 |
+
[
|
248 |
+
'name' => 'field_focus_border',
|
249 |
+
'selector' => '{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit):focus',
|
250 |
+
]
|
251 |
+
);
|
252 |
+
|
253 |
+
$this->add_group_control(
|
254 |
+
Group_Control_Box_Shadow::get_type(),
|
255 |
+
[
|
256 |
+
'name' => 'field_focus_box_shadow',
|
257 |
+
'exclude' => [
|
258 |
+
'box_shadow_position',
|
259 |
+
],
|
260 |
+
'selector' => '{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit):focus',
|
261 |
+
]
|
262 |
+
);
|
263 |
+
|
264 |
+
$this->add_control(
|
265 |
+
'hr2',
|
266 |
+
[
|
267 |
+
'type' => Controls_Manager::DIVIDER,
|
268 |
+
'style' => 'thick',
|
269 |
+
]
|
270 |
+
);
|
271 |
+
|
272 |
+
$this->add_control(
|
273 |
+
'field_focus_color',
|
274 |
+
[
|
275 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
276 |
+
'type' => Controls_Manager::COLOR,
|
277 |
+
'selectors' => [
|
278 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit):focus' => 'color: {{VALUE}}',
|
279 |
+
],
|
280 |
+
]
|
281 |
+
);
|
282 |
+
|
283 |
+
$this->add_control(
|
284 |
+
'field_focus_placeholder_color',
|
285 |
+
[
|
286 |
+
'label' => __( 'Placeholder Text Color', 'happy_addons' ),
|
287 |
+
'type' => Controls_Manager::COLOR,
|
288 |
+
'selectors' => [
|
289 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit):focus::-webkit-input-placeholder' => 'color: {{VALUE}};',
|
290 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit):focus::-moz-placeholder' => 'color: {{VALUE}};',
|
291 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit):focus::-ms-input-placeholder' => 'color: {{VALUE}};',
|
292 |
+
],
|
293 |
+
]
|
294 |
+
);
|
295 |
+
|
296 |
+
$this->add_control(
|
297 |
+
'field_focus_bg_color',
|
298 |
+
[
|
299 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
300 |
+
'type' => Controls_Manager::COLOR,
|
301 |
+
'selectors' => [
|
302 |
+
'{{WRAPPER}} .wpcf7-form-control:not(.wpcf7-submit):focus' => 'background-color: {{VALUE}}',
|
303 |
+
],
|
304 |
+
]
|
305 |
+
);
|
306 |
+
|
307 |
+
$this->end_controls_section();
|
308 |
+
|
309 |
+
$this->start_controls_section(
|
310 |
+
'cf7-form-label',
|
311 |
+
[
|
312 |
+
'label' => __( 'Form Fields Label', 'happy_addons' ),
|
313 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
314 |
+
]
|
315 |
+
);
|
316 |
+
|
317 |
+
$this->add_responsive_control(
|
318 |
+
'label_margin',
|
319 |
+
[
|
320 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
321 |
+
'type' => Controls_Manager::DIMENSIONS,
|
322 |
+
'size_units' => [ 'px', '%' ],
|
323 |
+
'selectors' => [
|
324 |
+
'{{WRAPPER}} label' => 'display: inline-block; padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
325 |
+
],
|
326 |
+
]
|
327 |
+
);
|
328 |
+
|
329 |
+
$this->add_responsive_control(
|
330 |
+
'label_padding',
|
331 |
+
[
|
332 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
333 |
+
'type' => Controls_Manager::DIMENSIONS,
|
334 |
+
'size_units' => [ 'px', 'em', '%' ],
|
335 |
+
'selectors' => [
|
336 |
+
'{{WRAPPER}} label' => 'display: inline-block; padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
337 |
+
],
|
338 |
+
]
|
339 |
+
);
|
340 |
+
|
341 |
+
$this->add_control(
|
342 |
+
'hr3',
|
343 |
+
[
|
344 |
+
'type' => Controls_Manager::DIVIDER,
|
345 |
+
'style' => 'thick',
|
346 |
+
]
|
347 |
+
);
|
348 |
+
|
349 |
+
$this->add_group_control(
|
350 |
+
Group_Control_Typography::get_type(),
|
351 |
+
[
|
352 |
+
'name' => 'label_typography',
|
353 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
354 |
+
'selector' => '{{WRAPPER}} label',
|
355 |
+
]
|
356 |
+
);
|
357 |
+
|
358 |
+
$this->add_control(
|
359 |
+
'label_color',
|
360 |
+
[
|
361 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
362 |
+
'type' => Controls_Manager::COLOR,
|
363 |
+
'selectors' => [
|
364 |
+
'{{WRAPPER}} label' => 'color: {{VALUE}}',
|
365 |
+
],
|
366 |
+
]
|
367 |
+
);
|
368 |
+
|
369 |
+
$this->end_controls_section();
|
370 |
+
|
371 |
+
$this->start_controls_section(
|
372 |
+
'submit',
|
373 |
+
[
|
374 |
+
'label' => __( 'Submit Button', 'happy_addons' ),
|
375 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
376 |
+
]
|
377 |
+
);
|
378 |
+
|
379 |
+
$this->add_responsive_control(
|
380 |
+
'submit_margin',
|
381 |
+
[
|
382 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
383 |
+
'type' => Controls_Manager::DIMENSIONS,
|
384 |
+
'size_units' => [ 'px', '%' ],
|
385 |
+
'selectors' => [
|
386 |
+
'{{WRAPPER}} .wpcf7-submit' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
387 |
+
],
|
388 |
+
]
|
389 |
+
);
|
390 |
+
|
391 |
+
$this->add_responsive_control(
|
392 |
+
'submit_padding',
|
393 |
+
[
|
394 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
395 |
+
'type' => Controls_Manager::DIMENSIONS,
|
396 |
+
'size_units' => [ 'px', 'em', '%' ],
|
397 |
+
'selectors' => [
|
398 |
+
'{{WRAPPER}} .wpcf7-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
399 |
+
],
|
400 |
+
]
|
401 |
+
);
|
402 |
+
|
403 |
+
$this->add_group_control(
|
404 |
+
Group_Control_Typography::get_type(),
|
405 |
+
[
|
406 |
+
'name' => 'submit_typography',
|
407 |
+
'selector' => '{{WRAPPER}} .wpcf7-submit',
|
408 |
+
]
|
409 |
+
);
|
410 |
+
|
411 |
+
$this->add_group_control(
|
412 |
+
Group_Control_Border::get_type(),
|
413 |
+
[
|
414 |
+
'name' => 'submit_border',
|
415 |
+
'selector' => '{{WRAPPER}} .wpcf7-submit',
|
416 |
+
]
|
417 |
+
);
|
418 |
+
|
419 |
+
$this->add_control(
|
420 |
+
'submit_border_radius',
|
421 |
+
[
|
422 |
+
'label' => __( 'Border Radius', 'happy_addons' ),
|
423 |
+
'type' => Controls_Manager::DIMENSIONS,
|
424 |
+
'size_units' => [ 'px', '%' ],
|
425 |
+
'selectors' => [
|
426 |
+
'{{WRAPPER}} .wpcf7-submit' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
427 |
+
],
|
428 |
+
]
|
429 |
+
);
|
430 |
+
|
431 |
+
$this->add_group_control(
|
432 |
+
Group_Control_Box_Shadow::get_type(),
|
433 |
+
[
|
434 |
+
'name' => 'submit_box_shadow',
|
435 |
+
'selector' => '{{WRAPPER}} .wpcf7-submit',
|
436 |
+
]
|
437 |
+
);
|
438 |
+
|
439 |
+
$this->add_control(
|
440 |
+
'hr4',
|
441 |
+
[
|
442 |
+
'type' => Controls_Manager::DIVIDER,
|
443 |
+
'style' => 'thick',
|
444 |
+
]
|
445 |
+
);
|
446 |
+
|
447 |
+
$this->start_controls_tabs( 'tabs_button_style' );
|
448 |
+
|
449 |
+
$this->start_controls_tab(
|
450 |
+
'tab_button_normal',
|
451 |
+
[
|
452 |
+
'label' => __( 'Normal', 'happy_addons' ),
|
453 |
+
]
|
454 |
+
);
|
455 |
+
|
456 |
+
$this->add_control(
|
457 |
+
'submit_color',
|
458 |
+
[
|
459 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
460 |
+
'type' => Controls_Manager::COLOR,
|
461 |
+
'default' => '',
|
462 |
+
'selectors' => [
|
463 |
+
'{{WRAPPER}} .wpcf7-submit' => 'color: {{VALUE}};',
|
464 |
+
],
|
465 |
+
]
|
466 |
+
);
|
467 |
+
|
468 |
+
$this->add_control(
|
469 |
+
'submit_bg_color',
|
470 |
+
[
|
471 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
472 |
+
'type' => Controls_Manager::COLOR,
|
473 |
+
'selectors' => [
|
474 |
+
'{{WRAPPER}} .wpcf7-submit' => 'background-color: {{VALUE}};',
|
475 |
+
],
|
476 |
+
]
|
477 |
+
);
|
478 |
+
|
479 |
+
$this->end_controls_tab();
|
480 |
+
|
481 |
+
$this->start_controls_tab(
|
482 |
+
'tab_button_hover',
|
483 |
+
[
|
484 |
+
'label' => __( 'Hover', 'happy_addons' ),
|
485 |
+
]
|
486 |
+
);
|
487 |
+
|
488 |
+
$this->add_control(
|
489 |
+
'submit_hover_color',
|
490 |
+
[
|
491 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
492 |
+
'type' => Controls_Manager::COLOR,
|
493 |
+
'selectors' => [
|
494 |
+
'{{WRAPPER}} .wpcf7-submit:hover, {{WRAPPER}} .wpcf7-submit:focus' => 'color: {{VALUE}};',
|
495 |
+
],
|
496 |
+
]
|
497 |
+
);
|
498 |
+
|
499 |
+
$this->add_control(
|
500 |
+
'submit_hover_bg_color',
|
501 |
+
[
|
502 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
503 |
+
'type' => Controls_Manager::COLOR,
|
504 |
+
'selectors' => [
|
505 |
+
'{{WRAPPER}} .wpcf7-submit:hover, {{WRAPPER}} .wpcf7-submit:focus' => 'background-color: {{VALUE}};',
|
506 |
+
],
|
507 |
+
]
|
508 |
+
);
|
509 |
+
|
510 |
+
$this->add_control(
|
511 |
+
'submit_hover_border_color',
|
512 |
+
[
|
513 |
+
'label' => __( 'Border Color', 'happy_addons' ),
|
514 |
+
'type' => Controls_Manager::COLOR,
|
515 |
+
'condition' => [
|
516 |
+
'btn_border_border!' => '',
|
517 |
+
],
|
518 |
+
'selectors' => [
|
519 |
+
'{{WRAPPER}} .wpcf7-submit:hover, {{WRAPPER}} .wpcf7-submit:focus' => 'border-color: {{VALUE}};',
|
520 |
+
],
|
521 |
+
]
|
522 |
+
);
|
523 |
+
|
524 |
+
$this->end_controls_tab();
|
525 |
+
$this->end_controls_tabs();
|
526 |
+
|
527 |
+
$this->end_controls_section();
|
528 |
+
}
|
529 |
+
|
530 |
+
protected function render() {
|
531 |
+
if ( ! ha_is_cf7_activated() ) {
|
532 |
+
return;
|
533 |
+
}
|
534 |
+
|
535 |
+
$settings = $this->get_settings_for_display();
|
536 |
+
|
537 |
+
if ( ! empty( $settings['id'] ) ) {
|
538 |
+
echo ha_do_shortcode( 'contact-form-7', [
|
539 |
+
'id' => $settings['id'],
|
540 |
+
'html_class' => 'ha-cf7-form ' . ha_sanitize_html_class_param( $settings['html_class'] ),
|
541 |
+
] );
|
542 |
+
}
|
543 |
+
}
|
544 |
+
}
|
addons/class-icon-box.php
ADDED
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Icon Box addon class
|
4 |
+
*
|
5 |
+
* @package Happy_Addons
|
6 |
+
*/
|
7 |
+
namespace Happy_Addons\Elementor\Addons;
|
8 |
+
|
9 |
+
use Elementor\Group_Control_Border;
|
10 |
+
use Elementor\Group_Control_Box_Shadow;
|
11 |
+
use Elementor\Group_Control_Typography;
|
12 |
+
use Elementor\Controls_Manager;
|
13 |
+
|
14 |
+
defined( 'ABSPATH' ) || die();
|
15 |
+
|
16 |
+
class Icon_Box extends Addon_Base {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get widget title.
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
* @access public
|
23 |
+
*
|
24 |
+
* @return string Widget title.
|
25 |
+
*/
|
26 |
+
public function get_title() {
|
27 |
+
return __( 'Happy Icon Box', 'happy_addons' );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Get widget icon.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
* @access public
|
35 |
+
*
|
36 |
+
* @return string Widget icon.
|
37 |
+
*/
|
38 |
+
public function get_icon() {
|
39 |
+
return 'fa fa-smile-o';
|
40 |
+
}
|
41 |
+
|
42 |
+
public function get_keywords() {
|
43 |
+
return [ 'info', 'box', 'icon' ];
|
44 |
+
}
|
45 |
+
|
46 |
+
protected function _register_controls() {
|
47 |
+
$this->start_controls_section(
|
48 |
+
'content',
|
49 |
+
[
|
50 |
+
'label' => __( 'Icon & Title', 'happy_addons' ),
|
51 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
52 |
+
]
|
53 |
+
);
|
54 |
+
|
55 |
+
$this->add_control(
|
56 |
+
'icon',
|
57 |
+
[
|
58 |
+
'label' => __( 'Icon', 'happy_addons' ),
|
59 |
+
'type' => Controls_Manager::ICON,
|
60 |
+
'default' => 'fa fa-smile-o',
|
61 |
+
]
|
62 |
+
);
|
63 |
+
|
64 |
+
$this->add_control(
|
65 |
+
'title',
|
66 |
+
[
|
67 |
+
'label' => __( 'Title', 'happy_addons' ),
|
68 |
+
'label_block' => true,
|
69 |
+
'type' => Controls_Manager::TEXT,
|
70 |
+
'default' => __( 'Default title', 'happy_addons' ),
|
71 |
+
'placeholder' => __( 'Type your blurb title', 'happy_addons' ),
|
72 |
+
]
|
73 |
+
);
|
74 |
+
|
75 |
+
$this->add_control(
|
76 |
+
'title_tag',
|
77 |
+
[
|
78 |
+
'label' => __( 'Title HTML Tag', 'happy_addons' ),
|
79 |
+
'type' => Controls_Manager::SELECT,
|
80 |
+
'options' => [
|
81 |
+
'h1' => __( 'H1', 'happy_addons' ),
|
82 |
+
'h2' => __( 'H2', 'happy_addons' ),
|
83 |
+
'h3' => __( 'H3', 'happy_addons' ),
|
84 |
+
'h4' => __( 'H4', 'happy_addons' ),
|
85 |
+
'h5' => __( 'H5', 'happy_addons' ),
|
86 |
+
'h6' => __( 'H6', 'happy_addons' ),
|
87 |
+
],
|
88 |
+
'default' => 'h2',
|
89 |
+
]
|
90 |
+
);
|
91 |
+
|
92 |
+
$this->add_responsive_control(
|
93 |
+
'align',
|
94 |
+
[
|
95 |
+
'label' => __( 'Alignment', 'happy_addons' ),
|
96 |
+
'type' => Controls_Manager::CHOOSE,
|
97 |
+
'options' => [
|
98 |
+
'left' => [
|
99 |
+
'title' => __( 'Left', 'happy_addons' ),
|
100 |
+
'icon' => 'fa fa-align-left',
|
101 |
+
],
|
102 |
+
'center' => [
|
103 |
+
'title' => __( 'Center', 'happy_addons' ),
|
104 |
+
'icon' => 'fa fa-align-center',
|
105 |
+
],
|
106 |
+
'right' => [
|
107 |
+
'title' => __( 'Right', 'happy_addons' ),
|
108 |
+
'icon' => 'fa fa-align-right',
|
109 |
+
],
|
110 |
+
],
|
111 |
+
'desktop_default' => 'left',
|
112 |
+
'toggle' => false,
|
113 |
+
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
114 |
+
'prefix_class' => 'ha-text--%s'
|
115 |
+
]
|
116 |
+
);
|
117 |
+
|
118 |
+
$this->add_control(
|
119 |
+
'has_link',
|
120 |
+
[
|
121 |
+
'label' => __( 'Add Link?', 'plugin-domain' ),
|
122 |
+
'type' => Controls_Manager::SWITCHER,
|
123 |
+
'label_on' => __( 'Yes', 'your-plugin' ),
|
124 |
+
'label_off' => __( 'No', 'your-plugin' ),
|
125 |
+
'return_value' => 'yes',
|
126 |
+
'default' => 'no',
|
127 |
+
]
|
128 |
+
);
|
129 |
+
|
130 |
+
$this->add_control(
|
131 |
+
'link',
|
132 |
+
[
|
133 |
+
'label' => __( 'Link', 'happy_addons' ),
|
134 |
+
'type' => Controls_Manager::URL,
|
135 |
+
'placeholder' => __( 'https://example.com/', 'happy_addons' ),
|
136 |
+
'condition' => [
|
137 |
+
'has_link' => 'yes',
|
138 |
+
],
|
139 |
+
'default' => [
|
140 |
+
'url' => '#',
|
141 |
+
],
|
142 |
+
]
|
143 |
+
);
|
144 |
+
|
145 |
+
$this->end_controls_section();
|
146 |
+
|
147 |
+
$this->start_controls_section(
|
148 |
+
'Icon',
|
149 |
+
[
|
150 |
+
'label' => __( 'Icon', 'happy_addons' ),
|
151 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
152 |
+
]
|
153 |
+
);
|
154 |
+
|
155 |
+
$this->add_responsive_control(
|
156 |
+
'icon_size',
|
157 |
+
[
|
158 |
+
'label' => __( 'Size', 'happy_addons' ),
|
159 |
+
'type' => Controls_Manager::SLIDER,
|
160 |
+
'default' => [
|
161 |
+
'unit' => 'px',
|
162 |
+
],
|
163 |
+
'tablet_default' => [
|
164 |
+
'unit' => 'px',
|
165 |
+
],
|
166 |
+
'mobile_default' => [
|
167 |
+
'unit' => 'px',
|
168 |
+
],
|
169 |
+
'size_units' => [ 'px', 'em' ],
|
170 |
+
'range' => [
|
171 |
+
'px' => [
|
172 |
+
'min' => 1,
|
173 |
+
'max' => 250,
|
174 |
+
],
|
175 |
+
'em' => [
|
176 |
+
'min' => 1,
|
177 |
+
'max' => 20,
|
178 |
+
],
|
179 |
+
],
|
180 |
+
'selectors' => [
|
181 |
+
'{{WRAPPER}} .ha-icon-box-icon > i' => 'font-size: {{SIZE}}{{UNIT}};',
|
182 |
+
],
|
183 |
+
]
|
184 |
+
);
|
185 |
+
|
186 |
+
$this->add_responsive_control(
|
187 |
+
'icon_padding',
|
188 |
+
[
|
189 |
+
'label' => __( 'Padding', 'happy_addons' ),
|
190 |
+
'type' => Controls_Manager::DIMENSIONS,
|
191 |
+
'size_units' => [ 'px', 'em', '%' ],
|
192 |
+
'selectors' => [
|
193 |
+
'{{WRAPPER}} .ha-icon-box-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
194 |
+
],
|
195 |
+
]
|
196 |
+
);
|
197 |
+
|
198 |
+
$this->add_group_control(
|
199 |
+
Group_Control_Border::get_type(),
|
200 |
+
[
|
201 |
+
'name' => 'icon_border',
|
202 |
+
'selector' => '{{WRAPPER}} .ha-icon-box-icon'
|
203 |
+
]
|
204 |
+
);
|
205 |
+
|
206 |
+
$this->add_responsive_control(
|
207 |
+
'icon_border_radius',
|
208 |
+
[
|
209 |
+
'label' => __( 'Border Radius', 'happy_addons' ),
|
210 |
+
'type' => Controls_Manager::DIMENSIONS,
|
211 |
+
'size_units' => [ 'px', '%' ],
|
212 |
+
'selectors' => [
|
213 |
+
'{{WRAPPER}} .ha-icon-box-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
214 |
+
],
|
215 |
+
]
|
216 |
+
);
|
217 |
+
|
218 |
+
$this->add_group_control(
|
219 |
+
Group_Control_Box_Shadow::get_type(),
|
220 |
+
[
|
221 |
+
'name' => 'icon_box_shadow',
|
222 |
+
'exclude' => [
|
223 |
+
'box_shadow_position',
|
224 |
+
],
|
225 |
+
'selector' => '{{WRAPPER}} .ha-icon-box-icon'
|
226 |
+
]
|
227 |
+
);
|
228 |
+
|
229 |
+
$this->add_control(
|
230 |
+
'icon_color',
|
231 |
+
[
|
232 |
+
'label' => __( 'Color', 'happy_addons' ),
|
233 |
+
'type' => Controls_Manager::COLOR,
|
234 |
+
'selectors' => [
|
235 |
+
'{{WRAPPER}} .ha-icon-box-icon' => 'color: {{VALUE}}',
|
236 |
+
],
|
237 |
+
]
|
238 |
+
);
|
239 |
+
|
240 |
+
$this->add_control(
|
241 |
+
'icon_bg_color',
|
242 |
+
[
|
243 |
+
'label' => __( 'Background Color', 'happy_addons' ),
|
244 |
+
'type' => Controls_Manager::COLOR,
|
245 |
+
'selectors' => [
|
246 |
+
'{{WRAPPER}} .ha-icon-box-icon' => 'background-color: {{VALUE}}',
|
247 |
+
],
|
248 |
+
]
|
249 |
+
);
|
250 |
+
|
251 |
+
$this->end_controls_section();
|
252 |
+
|
253 |
+
$this->start_controls_section(
|
254 |
+
'content_style',
|
255 |
+
[
|
256 |
+
'label' => __( 'Title', 'happy_addons' ),
|
257 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
258 |
+
]
|
259 |
+
);
|
260 |
+
|
261 |
+
$this->add_responsive_control(
|
262 |
+
'title_margin',
|
263 |
+
[
|
264 |
+
'label' => __( 'Margin', 'happy_addons' ),
|
265 |
+
'type' => Controls_Manager::DIMENSIONS,
|
266 |
+
'size_units' => [ 'px', '%' ],
|
267 |
+
'selectors' => [
|
268 |
+
'{{WRAPPER}} .ha-icon-box-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
269 |
+
],
|
270 |
+
]
|
271 |
+
);
|
272 |
+
|
273 |
+
$this->add_control(
|
274 |
+
'title_color',
|
275 |
+
[
|
276 |
+
'label' => __( 'Text Color', 'happy_addons' ),
|
277 |
+
'type' => Controls_Manager::COLOR,
|
278 |
+
'selectors' => [
|
279 |
+
'{{WRAPPER}} .ha-icon-box-title' => 'color: {{VALUE}}',
|
280 |
+
],
|
281 |
+
]
|
282 |
+
);
|
283 |
+
|
284 |
+
$this->add_group_control(
|
285 |
+
Group_Control_Typography::get_type(),
|
286 |
+
[
|
287 |
+
'name' => 'title_typography',
|
288 |
+
'label' => __( 'Typography', 'happy_addons' ),
|
289 |
+
'selector' => '{{WRAPPER}} .ha-icon-box-title',
|
290 |
+
]
|
291 |
+
);
|
292 |
+
|
293 |
+
$this->end_controls_section();
|
294 |
+
}
|
295 |
+
|
296 |
+
protected function render() {
|
297 |
+
$settings = $this->get_settings_for_display();
|
298 |
+
|
299 |
+
$this->add_inline_editing_attributes( 'title', 'none' );
|
300 |
+
$this->add_render_attribute( 'title', 'class', 'ha-icon-box-title' );
|
301 |
+
|
302 |
+
if ( $settings['has_link'] === 'yes' ) :
|
303 |
+
$this->add_render_attribute( 'link', 'class', 'ha-icon-box-link' );
|
304 |
+
$this->add_render_attribute( 'link', 'href', esc_url( $settings['link']['url'] ) );
|
305 |
+
if ( ! empty( $settings['link']['is_external'] ) ) {
|
306 |
+
$this->add_render_attribute( 'link', 'target', '_blank' );
|
307 |
+
}
|
308 |
+
if ( ! empty( $settings['link']['nofollow'] ) ) {
|
309 |
+
$this->set_render_attribute( 'link', 'rel', 'nofollow' );
|
310 |
+
}
|
311 |
+
printf( '<a %1$s>', $this->get_render_attribute_string( 'link' ) );
|
312 |
+
endif;
|
313 |
+
?>
|
314 |
+
<span class="ha-icon-box-icon">
|
315 |
+
<i aria-hidden="true" class="<?php echo esc_attr( $settings['icon'] ); ?>"></i>
|
316 |
+
</span>
|
317 |
+
<?php printf( '<%1$s %2$s>%3$s</%1$s>',
|
318 |
+
tag_escape( $settings['title_tag'] ),
|
319 |
+
$this->get_render_attribute_string( 'title' ),
|
320 |
+
esc_html( $settings['title' ] )
|
321 |
+
);
|
322 |
+
if ( $settings['has_link'] === 'yes' ) :
|
323 |
+
echo '</a>';
|
324 |
+
endif;
|
325 |
+
}
|
326 |
+
|
327 |
+
public function _content_template() {
|
328 |
+
?>
|
329 |
+
<#
|
330 |
+
view.addInlineEditingAttributes( 'title', 'none' );
|
331 |
+
view.addRenderAttribute( 'title', 'class', 'ha-icon-box-title' );
|
332 |
+
|
333 |
+
if ( settings.has_link === 'yes' ) {
|
334 |
+
view.addRenderAttribute( 'link', 'class', 'ha-icon-box-link' );
|
335 |
+
view.addRenderAttribute( 'link', 'href', settings.link.url );
|
336 |
+
|
337 |
+
print( '<a ' + view.getRenderAttributeString( 'link' ) + '>' );
|
338 |
+
} #>
|
339 |
+
<span class="ha-icon-box-icon">
|
340 |
+
<i class="{{ settings.icon }}"></i>
|
341 |
+
</span>
|
342 |
+
<{{ settings.title_tag }} {{{ view.getRenderAttributeString( 'title' ) }}}>{{ settings.title }}</{{ settings.title_tag }}>
|
343 |
+
<#
|
344 |
+
if ( settings.has_link === 'yes' ) {
|
345 |
+
print( '</a>' );
|
346 |
+
} #>
|
347 |
+
<?php
|
348 |
+
}
|
349 |
+
}
|
assets/css/main.css
ADDED
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.happy-addon,
|
2 |
+
.happy-addon * {
|
3 |
+
box-sizing: border-box;
|
4 |
+
}
|
5 |
+
|
6 |
+
.ha-text--left {
|
7 |
+
text-align: left;
|
8 |
+
}
|
9 |
+
|
10 |
+
.ha-text--center {
|
11 |
+
text-align: center;
|
12 |
+
}
|
13 |
+
|
14 |
+
.ha-text--right {
|
15 |
+
text-align: right;
|
16 |
+
}
|
17 |
+
|
18 |
+
.ha-btn {
|
19 |
+
display: inline-block;
|
20 |
+
padding: .575rem 1.3rem;
|
21 |
+
border-radius: .25rem;
|
22 |
+
background-color: #8c8c8c;
|
23 |
+
color: #fff;
|
24 |
+
vertical-align: middle;
|
25 |
+
text-align: center;
|
26 |
+
text-decoration: none;
|
27 |
+
font-weight: bold;
|
28 |
+
font-size: 14px;
|
29 |
+
line-height: 1.5;
|
30 |
+
-webkit-transition: all .3s;
|
31 |
+
transition: all .3s;
|
32 |
+
}
|
33 |
+
.ha-btn:hover,
|
34 |
+
.ha-btn:focus {
|
35 |
+
background-color: #242424;
|
36 |
+
}
|
37 |
+
.ha-btn--block {
|
38 |
+
display: block;
|
39 |
+
}
|
40 |
+
|
41 |
+
.ha-link {
|
42 |
+
position: relative;
|
43 |
+
display: inline-block;
|
44 |
+
margin-right: 15px;
|
45 |
+
color: #3ca6ff;
|
46 |
+
text-decoration: none;
|
47 |
+
}
|
48 |
+
.ha-link:after {
|
49 |
+
position: absolute;
|
50 |
+
top: 2px;
|
51 |
+
right: -15px;
|
52 |
+
content: "\f105";
|
53 |
+
font-size: 15px;
|
54 |
+
font-family: "FontAwesome";
|
55 |
+
-webkit-transition: all .3s;
|
56 |
+
transition: all .3s;
|
57 |
+
}
|
58 |
+
.ha-link:hover:after {
|
59 |
+
right: -25px;
|
60 |
+
}
|
61 |
+
|
62 |
+
.ha-card .elementor-widget-container {
|
63 |
+
border-radius: .5rem;
|
64 |
+
background-color: #fff;
|
65 |
+
word-wrap: break-word;
|
66 |
+
|
67 |
+
overflow-wrap: break-word;
|
68 |
+
}
|
69 |
+
|
70 |
+
.ha-card-figure {
|
71 |
+
position: relative;
|
72 |
+
display: inline-block;
|
73 |
+
}
|
74 |
+
.ha-card-figure > img {
|
75 |
+
width: 100%;
|
76 |
+
border-top-left-radius: calc(.5rem - 1px);
|
77 |
+
border-top-right-radius: calc(.5rem - 1px);
|
78 |
+
vertical-align: bottom;
|
79 |
+
|
80 |
+
-o-object-fit: cover;
|
81 |
+
object-fit: cover;
|
82 |
+
}
|
83 |
+
|
84 |
+
.ha-card-body {
|
85 |
+
padding: 1.5rem;
|
86 |
+
}
|
87 |
+
|
88 |
+
.ha-card-title {
|
89 |
+
margin-top: 0;
|
90 |
+
margin-bottom: .75rem;
|
91 |
+
color: #151515;
|
92 |
+
font-size: 24px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.ha-card-text {
|
96 |
+
margin-bottom: 2rem;
|
97 |
+
color: #616161;
|
98 |
+
font-size: 16px;
|
99 |
+
line-height: 1.7;
|
100 |
+
}
|
101 |
+
.ha-card-text > p {
|
102 |
+
margin-top: 0;
|
103 |
+
margin-bottom: 0;
|
104 |
+
}
|
105 |
+
|
106 |
+
.ha-card--right .elementor-widget-container,
|
107 |
+
.ha-card--left .elementor-widget-container {
|
108 |
+
display: -webkit-box;
|
109 |
+
display: -webkit-flex;
|
110 |
+
display: -ms-flexbox;
|
111 |
+
display: flex;
|
112 |
+
-webkit-box-align: center;
|
113 |
+
-webkit-align-items: center;
|
114 |
+
align-items: center;
|
115 |
+
-ms-flex-align: center;
|
116 |
+
-webkit-box-orient: horizontal;
|
117 |
+
-webkit-box-direction: normal;
|
118 |
+
-webkit-flex-direction: row;
|
119 |
+
-ms-flex-direction: row;
|
120 |
+
flex-direction: row;
|
121 |
+
}
|
122 |
+
|
123 |
+
.ha-card--right .ha-card-figure,
|
124 |
+
.ha-card--right .ha-card-body,
|
125 |
+
.ha-card--left .ha-card-figure,
|
126 |
+
.ha-card--left .ha-card-body {
|
127 |
+
-webkit-box-flex: 1;
|
128 |
+
-webkit-flex-grow: 1;
|
129 |
+
-ms-flex-positive: 1;
|
130 |
+
flex-grow: 1;
|
131 |
+
}
|
132 |
+
|
133 |
+
.ha-card--right .ha-card-figure,
|
134 |
+
.ha-card--left .ha-card-figure {
|
135 |
+
max-width: 50%;
|
136 |
+
}
|
137 |
+
|
138 |
+
.ha-card--right .ha-card-body,
|
139 |
+
.ha-card--left .ha-card-body {
|
140 |
+
padding: 2.5rem;
|
141 |
+
}
|
142 |
+
|
143 |
+
.ha-card--left .ha-card-figure > img {
|
144 |
+
border-radius: calc(.5rem - 1px) 0 0 calc(.5rem - 1px);
|
145 |
+
}
|
146 |
+
|
147 |
+
.ha-card--right .elementor-widget-container {
|
148 |
+
-webkit-box-orient: horizontal;
|
149 |
+
-webkit-box-direction: reverse;
|
150 |
+
-webkit-flex-direction: row-reverse;
|
151 |
+
-ms-flex-direction: row-reverse;
|
152 |
+
flex-direction: row-reverse;
|
153 |
+
}
|
154 |
+
|
155 |
+
.ha-card--right .ha-card-figure > img {
|
156 |
+
border-radius: 0 calc(.5rem - 1px) calc(.5rem - 1px) 0;
|
157 |
+
}
|
158 |
+
|
159 |
+
.ha-card .ha-label {
|
160 |
+
position: absolute;
|
161 |
+
}
|
162 |
+
|
163 |
+
.ha-label {
|
164 |
+
padding: .475rem 1.1rem;
|
165 |
+
border-radius: 50px;
|
166 |
+
background-color: #fff;
|
167 |
+
font-weight: bold;
|
168 |
+
font-size: 14px;
|
169 |
+
}
|
170 |
+
.ha-label--top-left {
|
171 |
+
top: 1rem;
|
172 |
+
left: 1rem;
|
173 |
+
}
|
174 |
+
.ha-label--top-center {
|
175 |
+
top: 1rem;
|
176 |
+
left: 50%;
|
177 |
+
-webkit-transform: translateX(-50%);
|
178 |
+
-ms-transform: translateX(-50%);
|
179 |
+
transform: translateX(-50%);
|
180 |
+
}
|
181 |
+
.ha-label--top-right {
|
182 |
+
top: 1rem;
|
183 |
+
right: 1rem;
|
184 |
+
}
|
185 |
+
.ha-label--middle-left {
|
186 |
+
top: 50%;
|
187 |
+
left: 1rem;
|
188 |
+
-webkit-transform: translateY(-50%);
|
189 |
+
-ms-transform: translateY(-50%);
|
190 |
+
transform: translateY(-50%);
|
191 |
+
}
|
192 |
+
.ha-label--middle-center {
|
193 |
+
top: 50%;
|
194 |
+
left: 50%;
|
195 |
+
-webkit-transform: translate(-50%, -50%);
|
196 |
+
-ms-transform: translate(-50%, -50%);
|
197 |
+
transform: translate(-50%, -50%);
|
198 |
+
}
|
199 |
+
.ha-label--middle-right {
|
200 |
+
top: 50%;
|
201 |
+
right: 1rem;
|
202 |
+
-webkit-transform: translateY(-50%);
|
203 |
+
-ms-transform: translateY(-50%);
|
204 |
+
transform: translateY(-50%);
|
205 |
+
}
|
206 |
+
.ha-label--bottom-left {
|
207 |
+
bottom: 1rem;
|
208 |
+
left: 1rem;
|
209 |
+
}
|
210 |
+
.ha-label--bottom-center {
|
211 |
+
bottom: 1rem;
|
212 |
+
left: 50%;
|
213 |
+
-webkit-transform: translateX(-50%);
|
214 |
+
-ms-transform: translateX(-50%);
|
215 |
+
transform: translateX(-50%);
|
216 |
+
}
|
217 |
+
.ha-label--bottom-right {
|
218 |
+
right: 1rem;
|
219 |
+
bottom: 1rem;
|
220 |
+
}
|
221 |
+
|
222 |
+
.ha-blurb .elementor-widget-container {
|
223 |
+
padding: 1.5rem;
|
224 |
+
word-wrap: break-word;
|
225 |
+
|
226 |
+
overflow-wrap: break-word;
|
227 |
+
}
|
228 |
+
|
229 |
+
.ha-blurb-title {
|
230 |
+
margin-top: 0;
|
231 |
+
margin-bottom: 1rem;
|
232 |
+
color: #151515;
|
233 |
+
font-size: 24px;
|
234 |
+
}
|
235 |
+
|
236 |
+
.ha-blurb-figure {
|
237 |
+
display: inline-block;
|
238 |
+
margin: 0 0 1.5rem !important;
|
239 |
+
}
|
240 |
+
.ha-blurb-figure > i {
|
241 |
+
font-size: 3rem;
|
242 |
+
line-height: .86;
|
243 |
+
}
|
244 |
+
.ha-blurb-figure > img {
|
245 |
+
width: 100%;
|
246 |
+
height: auto;
|
247 |
+
|
248 |
+
-o-object-fit: cover;
|
249 |
+
object-fit: cover;
|
250 |
+
}
|
251 |
+
.ha-blurb-figure--image {
|
252 |
+
max-width: 250px;
|
253 |
+
width: 250px;
|
254 |
+
}
|
255 |
+
|
256 |
+
.ha-blurb-text + .ha-link {
|
257 |
+
margin-top: 1rem;
|
258 |
+
}
|
259 |
+
|
260 |
+
.ha-blurb-text > p {
|
261 |
+
margin-top: 0;
|
262 |
+
margin-bottom: 0;
|
263 |
+
}
|
264 |
+
|
265 |
+
.ha-icon-box .elementor-widget-container {
|
266 |
+
word-wrap: break-word;
|
267 |
+
|
268 |
+
overflow-wrap: break-word;
|
269 |
+
}
|
270 |
+
|
271 |
+
.ha-icon-box-title {
|
272 |
+
margin-top: 0;
|
273 |
+
margin-bottom: 1rem;
|
274 |
+
color: #151515;
|
275 |
+
font-size: 24px;
|
276 |
+
}
|
277 |
+
|
278 |
+
.ha-icon-box-icon {
|
279 |
+
display: inline-block;
|
280 |
+
margin-bottom: 1.5rem;
|
281 |
+
}
|
282 |
+
.ha-icon-box-icon i {
|
283 |
+
color: inherit;
|
284 |
+
font-size: 3rem;
|
285 |
+
line-height: .86;
|
286 |
+
}
|
287 |
+
|
288 |
+
.ha-icon-box-link {
|
289 |
+
display: block;
|
290 |
+
color: #151515;
|
291 |
+
text-decoration: none;
|
292 |
+
}
|
assets/css/main.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.happy-addon,.happy-addon *{box-sizing:border-box}.ha-text--left{text-align:left}.ha-text--center{text-align:center}.ha-text--right{text-align:right}.ha-btn{display:inline-block;padding:.575rem 1.3rem;border-radius:.25rem;background-color:#8c8c8c;color:#fff;vertical-align:middle;text-align:center;text-decoration:none;font-weight:700;font-size:14px;line-height:1.5;-webkit-transition:all .3s;transition:all .3s}.ha-btn:focus,.ha-btn:hover{background-color:#242424}.ha-btn--block{display:block}.ha-link{margin-right:15px;color:#3ca6ff;text-decoration:none}.ha-link:after{position:absolute;top:2px;right:-15px;content:"\f105";font-size:15px;font-family:"FontAwesome";-webkit-transition:all .3s;transition:all .3s}.ha-link:hover:after{right:-25px}.ha-card .elementor-widget-container{border-radius:.5rem;background-color:#fff;word-wrap:break-word;overflow-wrap:break-word}.ha-card-figure,.ha-link{position:relative;display:inline-block}.ha-blurb-figure>img,.ha-card-figure>img{width:100%;-o-object-fit:cover;object-fit:cover}.ha-card-figure>img{border-top-left-radius:calc(.5rem - 1px);border-top-right-radius:calc(.5rem - 1px);vertical-align:bottom}.ha-card-body{padding:1.5rem}.ha-card-title{margin-top:0;margin-bottom:.75rem;color:#151515;font-size:24px}.ha-card-text{margin-bottom:2rem;color:#616161;font-size:16px;line-height:1.7}.ha-blurb-text>p,.ha-card-text>p{margin-top:0;margin-bottom:0}.ha-card--left .elementor-widget-container,.ha-card--right .elementor-widget-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-ms-flex-align:center}.ha-card--left .elementor-widget-container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row}.ha-card--left .ha-card-body,.ha-card--left .ha-card-figure,.ha-card--right .ha-card-body,.ha-card--right .ha-card-figure{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.ha-card--left .ha-card-figure,.ha-card--right .ha-card-figure{max-width:50%}.ha-card--left .ha-card-body,.ha-card--right .ha-card-body{padding:2.5rem}.ha-card--left .ha-card-figure>img{border-radius:calc(.5rem - 1px) 0 0 calc(.5rem - 1px)}.ha-card--right .elementor-widget-container{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.ha-card--right .ha-card-figure>img{border-radius:0 calc(.5rem - 1px) calc(.5rem - 1px) 0}.ha-card .ha-label{position:absolute}.ha-label{padding:.475rem 1.1rem;border-radius:50px;background-color:#fff;font-weight:700;font-size:14px}.ha-label--top-left{top:1rem;left:1rem}.ha-label--top-center{top:1rem;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%)}.ha-label--top-right{top:1rem;right:1rem}.ha-label--middle-left{top:50%;left:1rem;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.ha-label--middle-center{top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.ha-label--middle-right{top:50%;right:1rem;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.ha-label--bottom-left{bottom:1rem;left:1rem}.ha-label--bottom-center{bottom:1rem;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%)}.ha-label--bottom-right{right:1rem;bottom:1rem}.ha-blurb .elementor-widget-container{padding:1.5rem;word-wrap:break-word;overflow-wrap:break-word}.ha-blurb-title{margin-top:0;margin-bottom:1rem;color:#151515;font-size:24px}.ha-blurb-figure{display:inline-block;margin:0 0 1.5rem!important}.ha-blurb-figure>i,.ha-icon-box-icon i{font-size:3rem;line-height:.86}.ha-blurb-figure>img{height:auto}.ha-blurb-figure--image{max-width:250px;width:250px}.ha-blurb-text+.ha-link{margin-top:1rem}.ha-icon-box .elementor-widget-container{word-wrap:break-word;overflow-wrap:break-word}.ha-icon-box-title{margin-top:0;margin-bottom:1rem;color:#151515;font-size:24px}.ha-icon-box-icon{display:inline-block;margin-bottom:1.5rem}.ha-icon-box-icon i{color:inherit}.ha-icon-box-link{display:block;color:#151515;text-decoration:none}
|
base.php
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin base class
|
4 |
+
*
|
5 |
+
* @package Happy_Addons
|
6 |
+
*/
|
7 |
+
namespace Happy_Addons\Elementor;
|
8 |
+
|
9 |
+
use Elementor\Plugin as Elementor;
|
10 |
+
|
11 |
+
defined( 'ABSPATH' ) || die();
|
12 |
+
|
13 |
+
class Base {
|
14 |
+
|
15 |
+
const VERSION = '0.0.1';
|
16 |
+
|
17 |
+
const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
|
18 |
+
|
19 |
+
const MINIMUM_PHP_VERSION = '5.4';
|
20 |
+
|
21 |
+
private static $instance = null;
|
22 |
+
|
23 |
+
public static function instance() {
|
24 |
+
if ( is_null( self::$instance ) ) {
|
25 |
+
self::$instance = new self();
|
26 |
+
}
|
27 |
+
return self::$instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
private function __construct() {
|
31 |
+
add_action( 'init', [ $this, 'i18n' ] );
|
32 |
+
add_action( 'plugins_loaded', [ $this, 'init' ] );
|
33 |
+
}
|
34 |
+
|
35 |
+
public function i18n() {
|
36 |
+
load_plugin_textdomain( 'happy_addons' );
|
37 |
+
}
|
38 |
+
|
39 |
+
public function init() {
|
40 |
+
// Check if Elementor installed and activated
|
41 |
+
if ( ! did_action( 'elementor/loaded' ) ) {
|
42 |
+
add_action( 'admin_notices', [ $this, 'admin_notice_missing_elementor' ] );
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
// Check for required Elementor version
|
47 |
+
if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
|
48 |
+
add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] );
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
|
52 |
+
// Check for required PHP version
|
53 |
+
if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
|
54 |
+
add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
|
58 |
+
$this->include_files();
|
59 |
+
|
60 |
+
// Register custom category
|
61 |
+
add_action( 'elementor/elements/categories_registered', [ $this, 'add_category' ] );
|
62 |
+
|
63 |
+
// Add Plugin actions
|
64 |
+
add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] );
|
65 |
+
|
66 |
+
// Frontend scripts
|
67 |
+
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
|
68 |
+
}
|
69 |
+
|
70 |
+
public function include_files() {
|
71 |
+
require( __DIR__ . '/inc/functions.php' );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Enqueue frontend scripts
|
76 |
+
*/
|
77 |
+
public function enqueue_scripts() {
|
78 |
+
$suffix = ( ! ha_is_script_debug_enabled() ) ? '.min' : '';
|
79 |
+
wp_enqueue_style(
|
80 |
+
'happy-addons-elementor',
|
81 |
+
plugin_dir_url( __FILE__ ) . 'assets/css/main' . $suffix . '.css',
|
82 |
+
['elementor-frontend'],
|
83 |
+
self::VERSION
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Add custom category.
|
89 |
+
*
|
90 |
+
* @param $elements_manager
|
91 |
+
*/
|
92 |
+
public function add_category( $elements_manager ) {
|
93 |
+
$elements_manager->add_category(
|
94 |
+
'happy_addons',
|
95 |
+
[
|
96 |
+
'title' => __( 'Happy Addons', 'happy_addons' ),
|
97 |
+
'icon' => 'fa fa-smile-o',
|
98 |
+
]
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Admin notice.
|
104 |
+
*
|
105 |
+
* Warning when the site doesn't have Elementor installed or activated.
|
106 |
+
*
|
107 |
+
* @since 1.0.0
|
108 |
+
* @access public
|
109 |
+
*/
|
110 |
+
public function admin_notice_missing_elementor() {
|
111 |
+
if ( isset( $_GET['activate'] ) ) {
|
112 |
+
unset( $_GET['activate'] );
|
113 |
+
}
|
114 |
+
|
115 |
+
$message = sprintf(
|
116 |
+
/* translators: 1: Plugin name 2: Elementor */
|
117 |
+
esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'happy_addons' ),
|
118 |
+
'<strong>' . esc_html__( 'Happy Elementor Card', 'happy_addons' ) . '</strong>',
|
119 |
+
'<strong>' . esc_html__( 'Elementor', 'happy_addons' ) . '</strong>'
|
120 |
+
);
|
121 |
+
|
122 |
+
printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Admin notice
|
127 |
+
*
|
128 |
+
* Warning when the site doesn't have a minimum required Elementor version.
|
129 |
+
*
|
130 |
+
* @since 1.0.0
|
131 |
+
* @access public
|
132 |
+
*/
|
133 |
+
public function admin_notice_minimum_elementor_version() {
|
134 |
+
if ( isset( $_GET['activate'] ) ) {
|
135 |
+
unset( $_GET['activate'] );
|
136 |
+
}
|
137 |
+
|
138 |
+
$message = sprintf(
|
139 |
+
/* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
|
140 |
+
esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'happy_addons' ),
|
141 |
+
'<strong>' . esc_html__( 'Happy Elementor Card', 'happy_addons' ) . '</strong>',
|
142 |
+
'<strong>' . esc_html__( 'Elementor', 'happy_addons' ) . '</strong>',
|
143 |
+
self::MINIMUM_ELEMENTOR_VERSION
|
144 |
+
);
|
145 |
+
|
146 |
+
printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Admin notice
|
151 |
+
*
|
152 |
+
* Warning when the site doesn't have a minimum required PHP version.
|
153 |
+
*
|
154 |
+
* @since 1.0.0
|
155 |
+
* @access public
|
156 |
+
*/
|
157 |
+
public function admin_notice_minimum_php_version() {
|
158 |
+
if ( isset( $_GET['activate'] ) ) {
|
159 |
+
unset( $_GET['activate'] );
|
160 |
+
}
|
161 |
+
|
162 |
+
$message = sprintf(
|
163 |
+
/* translators: 1: Plugin name 2: PHP 3: Required PHP version */
|
164 |
+
esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'happy_addons' ),
|
165 |
+
'<strong>' . esc_html__( 'Happy Elementor Card', 'happy_addons' ) . '</strong>',
|
166 |
+
'<strong>' . esc_html__( 'PHP', 'happy_addons' ) . '</strong>',
|
167 |
+
self::MINIMUM_PHP_VERSION
|
168 |
+
);
|
169 |
+
|
170 |
+
printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Init Widgets
|
175 |
+
*
|
176 |
+
* Include widgets files and register them
|
177 |
+
*
|
178 |
+
* @since 1.0.0
|
179 |
+
*
|
180 |
+
* @access public
|
181 |
+
*/
|
182 |
+
public function init_widgets() {
|
183 |
+
require( __DIR__ . '/addons/class-addon-base.php' );
|
184 |
+
|
185 |
+
$addons = [
|
186 |
+
'blurb',
|
187 |
+
'card',
|
188 |
+
'cf7',
|
189 |
+
'icon-box',
|
190 |
+
];
|
191 |
+
|
192 |
+
foreach ( $addons as $addon ) {
|
193 |
+
require( __DIR__ . '/addons/class-' . $addon . '.php' );
|
194 |
+
|
195 |
+
$class_name = str_replace( '-', '_', $addon );
|
196 |
+
$class_name = __NAMESPACE__ . '\Addons\\' . $class_name;
|
197 |
+
Elementor::instance()->widgets_manager->register_widget_type( new $class_name() );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
inc/functions.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Helper functions
|
4 |
+
*
|
5 |
+
* @package Happy_Addons
|
6 |
+
*/
|
7 |
+
defined( 'ABSPATH' ) || die();
|
8 |
+
|
9 |
+
if ( ! function_exists( 'ha_do_shortcode' ) ) {
|
10 |
+
/**
|
11 |
+
* Call a shortcode function by tag name.
|
12 |
+
*
|
13 |
+
* @since 1.0.0
|
14 |
+
*
|
15 |
+
* @param string $tag The shortcode whose function to call.
|
16 |
+
* @param array $atts The attributes to pass to the shortcode function. Optional.
|
17 |
+
* @param array $content The shortcode's content. Default is null (none).
|
18 |
+
*
|
19 |
+
* @return string|bool False on failure, the result of the shortcode on success.
|
20 |
+
*/
|
21 |
+
function ha_do_shortcode( $tag, array $atts = array(), $content = null ) {
|
22 |
+
global $shortcode_tags;
|
23 |
+
if ( ! isset( $shortcode_tags[ $tag ] ) ) {
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( ! function_exists( 'ha_get_cf7_forms' ) ) {
|
31 |
+
/**
|
32 |
+
* Get a list of all CF7 forms
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
*/
|
36 |
+
function ha_get_cf7_forms() {
|
37 |
+
$forms = get_posts( [
|
38 |
+
'post_type' => 'wpcf7_contact_form',
|
39 |
+
'post_status' => 'publish',
|
40 |
+
'posts_per_page' => -1,
|
41 |
+
'orderby' => 'title',
|
42 |
+
'order' => 'ASC',
|
43 |
+
] );
|
44 |
+
|
45 |
+
if ( ! empty( $forms ) ) {
|
46 |
+
return wp_list_pluck( $forms, 'post_title', 'ID' );
|
47 |
+
}
|
48 |
+
return [];
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( ! function_exists( 'ha_sanitize_html_class_param' ) ) {
|
53 |
+
/**
|
54 |
+
* Sanitize html class string
|
55 |
+
*
|
56 |
+
* @param $class
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
function ha_sanitize_html_class_param( $class ) {
|
60 |
+
$classes = ! empty( $class ) ? explode( ' ', $class ) : [];
|
61 |
+
$sanitized = [];
|
62 |
+
if ( ! empty( $classes ) ) {
|
63 |
+
$sanitized = array_map( function( $cls ) {
|
64 |
+
return sanitize_html_class( $cls );
|
65 |
+
}, $classes );
|
66 |
+
}
|
67 |
+
return implode( ' ', $sanitized );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( ! function_exists( 'ha_is_cf7_activated' ) ) {
|
72 |
+
/**
|
73 |
+
* Check if contact form 7 is activated
|
74 |
+
*
|
75 |
+
* @return bool
|
76 |
+
*/
|
77 |
+
function ha_is_cf7_activated() {
|
78 |
+
return class_exists( 'WPCF7' );
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( ! function_exists( 'ha_is_script_debug_enabled' ) ) {
|
83 |
+
function ha_is_script_debug_enabled() {
|
84 |
+
return ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG );
|
85 |
+
}
|
86 |
+
}
|
plugin.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Happy Elementor Addons
|
4 |
+
* Plugin URI: http://happymonster.me/plugins/happy-addons-elementor
|
5 |
+
* Description: Best Addons for Elementor
|
6 |
+
* Version: 0.0.1
|
7 |
+
* Author: HappyMonster.me
|
8 |
+
* Author URI: http://happymonster.me/
|
9 |
+
* License: GPLv2
|
10 |
+
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
* Text Domain: happy_addons
|
12 |
+
* Domain Path: /languages/
|
13 |
+
*
|
14 |
+
* @package Happy_Addons
|
15 |
+
*/
|
16 |
+
|
17 |
+
/*
|
18 |
+
This program is free software; you can redistribute it and/or
|
19 |
+
modify it under the terms of the GNU General Public License
|
20 |
+
as published by the Free Software Foundation; either version 2
|
21 |
+
of the License, or (at your option) any later version.
|
22 |
+
|
23 |
+
This program is distributed in the hope that it will be useful,
|
24 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
+
GNU General Public License for more details.
|
27 |
+
|
28 |
+
You should have received a copy of the GNU General Public License
|
29 |
+
along with this program; if not, write to the Free Software
|
30 |
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
31 |
+
|
32 |
+
Copyright 2019 HappyMonster <http://happymonster.me>
|
33 |
+
*/
|
34 |
+
|
35 |
+
defined( 'ABSPATH' ) || die();
|
36 |
+
|
37 |
+
require plugin_dir_path( __FILE__ ) . 'base.php';
|
38 |
+
|
39 |
+
\Happy_Addons\Elementor\Base::instance();
|
readme.txt
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Happy Addons For Elementor - Best Free Widgets ===
|
2 |
+
Plugin Name: Happy Addons For Elementor - Best Free Widgets
|
3 |
+
Version: 0.0.1
|
4 |
+
Author: HappyMonster
|
5 |
+
Author URI: http://happymonster.me/
|
6 |
+
Contributors: thehappymonster, happyaddons, obiplabon
|
7 |
+
Tags: elementor, card, blurb, contact form 7, icon box, widget, page builder
|
8 |
+
Requires at least: 4.5
|
9 |
+
Tested up to: 5.0.3
|
10 |
+
Requires PHP: 5.4
|
11 |
+
Stable tag: 0.0.1
|
12 |
+
License: GPLv2
|
13 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
14 |
+
|
15 |
+
Most advanced, highly customizable, flexible and easy-to-use widgets for Elementor with lots of options and possibilities.
|
16 |
+
|
17 |
+
== Description ==
|
18 |
+
|
19 |
+
Most advanced, highly customizable, flexible and easy-to-use FREE widgets for Elementor with lots of options and possibilities.
|
20 |
+
|
21 |
+
### Included Free Widgets
|
22 |
+
|
23 |
+
- Blurb
|
24 |
+
- Card - [Get Standalone Version](https://wordpress.org/plugins/happy-elementor-card/)
|
25 |
+
- Icon Box
|
26 |
+
- Contact Form 7 - [Get Standalone Version](https://wordpress.org/plugins/happy-elementor-cf7/)
|
27 |
+
- More free widgets are coming in every week
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
It's really easy and super simple to install **Happy Elementor Addons** plugin but before installing **Happy Elementor Addons** make sure you've installed [Elementor](https://wordpress.org/plugins/elementor/ "Install Elementor"). **Elementor** is the only dependency.
|
32 |
+
|
33 |
+
= Automatic Installation =
|
34 |
+
1. Go to `Plugins > Add New` screen in WordPress.
|
35 |
+
2. Search for `Happy Addons For Elementor`.
|
36 |
+
3. Install and activate the plugin, that's it.
|
37 |
+
|
38 |
+
= Manual Installation =
|
39 |
+
1. Download [Happy Elementor Addons](https://downloads.wordpress.org/plugin/happy-elementor-addons.zip "Download Happy Elementor Addons").
|
40 |
+
2. Extract the `happy-elementor-addons.zip` file. You'll get plugin files inside `happy-elementor-addons` directory.
|
41 |
+
3. Upload the plugin files to the `/wp-content/plugins/happy-elementor-addons` directory.
|
42 |
+
4. Activate the plugin through the 'Plugins' screen in WordPress.
|