first commit
This commit is contained in:
359
wp-content/plugins/lordicon/LICENSE.txt
Normal file
359
wp-content/plugins/lordicon/LICENSE.txt
Normal file
@@ -0,0 +1,359 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Please note that the icons themselves are not covered by the GNU license. They are licensed separately under the Lordicon License Terms and Conditions.
|
||||
Learn more: https://lordicon.com/licenses
|
||||
|
||||
===================================
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
70
wp-content/plugins/lordicon/README.md
Normal file
70
wp-content/plugins/lordicon/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Lordicon – Animated Icons for WordPress
|
||||
|
||||
Effortlessly enhance your Gutenberg pages with beautifully animated icons from the Lordicon library. Add motion and style without compromising performance.
|
||||
|
||||
Lordicon offers a unique library of modern, animated icons designed to bring life and interactivity to your WordPress site. With this plugin, you can seamlessly browse, customize, and insert Lordicon icons directly into the Gutenberg editor.
|
||||
|
||||
Built to be fast, lightweight, and easy to use, the Lordicon plugin helps you enrich your content with motion graphics that stay performance-friendly. Whether you need subtle interactions or eye-catching animations, Lordicon provides the flexibility to match your brand and design style.
|
||||
|
||||
## Features
|
||||
|
||||
- Extensive free icon set (with attribution)
|
||||
- Full icon library available in PRO version (no attribution)
|
||||
- Insert icons directly as Gutenberg blocks
|
||||
- Customize colors, stroke, animation type, and triggers
|
||||
- Optimized for performance with image fallbacks and lazy loading
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Is Lordicon free to use?
|
||||
Yes, the plugin and a curated set of icons are free for personal, non-commercial use with required attribution.
|
||||
|
||||
To unlock the full icon library, remove attribution, and gain commercial rights, you'll need to subscribe to a PRO plan.
|
||||
|
||||
### Do I need a Lordicon account to use this plugin?
|
||||
No, you can use the free icons without creating a Lordicon account.
|
||||
|
||||
A Lordicon account is only required to access the PRO icon library. You can log in via **Settings → Lordicon** in your WordPress admin dashboard.
|
||||
|
||||
**Note:** Subscription management (upgrading to PRO, payment, or account settings) is handled on the Lordicon website.
|
||||
|
||||
### Do I need a PRO plan?
|
||||
You only need the PRO plan if:
|
||||
|
||||
- You're using icons for commercial purposes
|
||||
- You need attribution-free use
|
||||
- You want access to the entire icon library
|
||||
- You require advanced customization and multiple downloads
|
||||
|
||||
[Explore our pricing](https://lordicon.com/pricing)
|
||||
|
||||
## License
|
||||
|
||||
- Plugin code: [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html)
|
||||
- Icons: [Lordicon License Terms](https://lordicon.com/licenses)
|
||||
|
||||
## Development
|
||||
|
||||
This plugin includes a frontend build step for its Gutenberg block UI.
|
||||
|
||||
- Source files: `/ui` directory (JavaScript/TypeScript, styles, etc.)
|
||||
- Build tool: [Vite](https://vitejs.dev/)
|
||||
- Build output: `/dist` directory (included in the distributed plugin)
|
||||
- PHP files: top-level plugin files – no build process required
|
||||
|
||||
### Build instructions
|
||||
|
||||
Clone the repository and run:
|
||||
|
||||
```bash
|
||||
cd ui
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
This will generate the production-ready frontend assets in /dist.
|
||||
|
||||
## Links
|
||||
|
||||
- [Lordicon Website](https://lordicon.com)
|
||||
- [Pricing](https://lordicon.com/pricing)
|
||||
BIN
wp-content/plugins/lordicon/assets/cover.png
Normal file
BIN
wp-content/plugins/lordicon/assets/cover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
BIN
wp-content/plugins/lordicon/assets/lordicon-icon.png
Normal file
BIN
wp-content/plugins/lordicon/assets/lordicon-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 969 B |
96
wp-content/plugins/lordicon/dist/block.css
vendored
Normal file
96
wp-content/plugins/lordicon/dist/block.css
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
:root {
|
||||
--li-color-text: var(--figma-color-text, #121330);
|
||||
--li-color-text-brand: #08C18A;
|
||||
--li-color-text-on-brand: #fff;
|
||||
--li-color-text-secondary: var(--figma-color-text-secondary, #717181);
|
||||
--li-color-text-selected: var(--figma-color-text-selected, #08C18A);
|
||||
--li-color-text-selection: var(--figma-color-text-onselected, #121330);
|
||||
--li-color-text-tooltip: #fff;
|
||||
--li-color-bg: var(--figma-color-bg, #fff);
|
||||
--li-color-bg-brand: #08C18A;
|
||||
--li-color-bg-brand-hover: #0fa564;
|
||||
--li-color-bg-brand-pressed: #097f52;
|
||||
--li-color-bg-danger: #f44336;
|
||||
--li-color-bg-secondary: var(--figma-color-bg-secondary, #fafafb);
|
||||
--li-color-bg-selection: var(--figma-color-bg-onselected, #eee8fb);
|
||||
--li-color-bg-tooltip: #121330;
|
||||
--li-color-border: var(--figma-color-border, #e7e7ea);
|
||||
--li-color-border-hover: #cef3e8;
|
||||
--li-color-border-pressed: #08C18A;
|
||||
--li-color-border-danger: #f44336;
|
||||
--li-color-busy-bg: rgba(255, 255, 255, 0.75);
|
||||
--li-shadow: 0 4px 18px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
:root {
|
||||
--li-font-family: 'Inter', system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
--li-font-size-xs: 12px;
|
||||
--li-font-size-sm: 13px;
|
||||
--li-font-size-md: 14px;
|
||||
--li-font-size-lg: 20px;
|
||||
--li-font-weight: 400;
|
||||
|
||||
--li-space-xs: 5px;
|
||||
--li-space-sm: 10px;
|
||||
--li-space-md: 20px;
|
||||
--li-space-lg: 30px;
|
||||
|
||||
--li-icon-size-sm: 18px;
|
||||
--li-icon-size-md: 24px;
|
||||
|
||||
--li-size-field-xs: 30px;
|
||||
--li-size-field-sm: 40px;
|
||||
--li-size-field-md: 50px;
|
||||
|
||||
--li-radius: 6px;
|
||||
--li-radius-big: 16px;
|
||||
|
||||
--li-line-height: 1.4;
|
||||
|
||||
--li-container-width-sm: 380px;
|
||||
--li-container-width-md: 480px;
|
||||
--li-container-width-lg: 700px;
|
||||
|
||||
--li-shadow: 0 4px 18px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
.lordicon-wrapper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.lordicon-wrapper li-icon {
|
||||
display: block;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.lordicon-wrapper li-icon:not(:defined) {
|
||||
svg,
|
||||
img {
|
||||
display: block;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.lordicon-wrapper-inline-block {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.lordicon-info {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.lordicon-info p {
|
||||
border: 2px dashed #ccc;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.lordicon-busy {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
2369
wp-content/plugins/lordicon/dist/block.js
vendored
Normal file
2369
wp-content/plugins/lordicon/dist/block.js
vendored
Normal file
File diff suppressed because one or more lines are too long
41
wp-content/plugins/lordicon/dist/block.json
vendored
Normal file
41
wp-content/plugins/lordicon/dist/block.json
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"apiVersion": 2,
|
||||
"name": "lordicon/block",
|
||||
"title": "Lordicon",
|
||||
"category": "widgets",
|
||||
"description": "Animated Icon Block.",
|
||||
"supports": {
|
||||
"html": false,
|
||||
"alignWide": false,
|
||||
"anchor": true,
|
||||
"customClassName": true,
|
||||
"multiple": true,
|
||||
"reusable": true
|
||||
},
|
||||
"textdomain": "lordicon",
|
||||
"attributes": {
|
||||
"icon": {
|
||||
"type": "object",
|
||||
"default": null
|
||||
},
|
||||
"jsonAttachmentId": {
|
||||
"type": "number",
|
||||
"default": 0
|
||||
},
|
||||
"svgAttachmentId": {
|
||||
"type": "number",
|
||||
"default": 0
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"default": null
|
||||
},
|
||||
"anchor": {
|
||||
"type": "string"
|
||||
},
|
||||
"className": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"editorScript": "lordicon-block-js"
|
||||
}
|
||||
34
wp-content/plugins/lordicon/dist/element.css
vendored
Normal file
34
wp-content/plugins/lordicon/dist/element.css
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
.lordicon-wrapper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.lordicon-wrapper lord-icon {
|
||||
display: block;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.lordicon-wrapper lord-icon:not(:defined) {
|
||||
svg,
|
||||
img {
|
||||
display: block;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.lordicon-wrapper-inline-block {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.lordicon-info {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.lordicon-info p {
|
||||
border: 2px dashed #ccc;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
52
wp-content/plugins/lordicon/dist/element.js
vendored
Normal file
52
wp-content/plugins/lordicon/dist/element.js
vendored
Normal file
File diff suppressed because one or more lines are too long
55
wp-content/plugins/lordicon/dist/settings.css
vendored
Normal file
55
wp-content/plugins/lordicon/dist/settings.css
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
:root {
|
||||
--li-color-text: var(--figma-color-text, #121330);
|
||||
--li-color-text-brand: #08C18A;
|
||||
--li-color-text-on-brand: #fff;
|
||||
--li-color-text-secondary: var(--figma-color-text-secondary, #717181);
|
||||
--li-color-text-selected: var(--figma-color-text-selected, #08C18A);
|
||||
--li-color-text-selection: var(--figma-color-text-onselected, #121330);
|
||||
--li-color-text-tooltip: #fff;
|
||||
--li-color-bg: var(--figma-color-bg, #fff);
|
||||
--li-color-bg-brand: #08C18A;
|
||||
--li-color-bg-brand-hover: #0fa564;
|
||||
--li-color-bg-brand-pressed: #097f52;
|
||||
--li-color-bg-danger: #f44336;
|
||||
--li-color-bg-secondary: var(--figma-color-bg-secondary, #fafafb);
|
||||
--li-color-bg-selection: var(--figma-color-bg-onselected, #eee8fb);
|
||||
--li-color-bg-tooltip: #121330;
|
||||
--li-color-border: var(--figma-color-border, #e7e7ea);
|
||||
--li-color-border-hover: #cef3e8;
|
||||
--li-color-border-pressed: #08C18A;
|
||||
--li-color-border-danger: #f44336;
|
||||
--li-color-busy-bg: rgba(255, 255, 255, 0.75);
|
||||
--li-shadow: 0 4px 18px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
:root {
|
||||
--li-font-family: 'Inter', system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
--li-font-size-xs: 12px;
|
||||
--li-font-size-sm: 13px;
|
||||
--li-font-size-md: 14px;
|
||||
--li-font-size-lg: 20px;
|
||||
--li-font-weight: 400;
|
||||
|
||||
--li-space-xs: 5px;
|
||||
--li-space-sm: 10px;
|
||||
--li-space-md: 20px;
|
||||
--li-space-lg: 30px;
|
||||
|
||||
--li-icon-size-sm: 18px;
|
||||
--li-icon-size-md: 24px;
|
||||
|
||||
--li-size-field-xs: 30px;
|
||||
--li-size-field-sm: 40px;
|
||||
--li-size-field-md: 50px;
|
||||
|
||||
--li-radius: 6px;
|
||||
--li-radius-big: 16px;
|
||||
|
||||
--li-line-height: 1.4;
|
||||
|
||||
--li-container-width-sm: 380px;
|
||||
--li-container-width-md: 480px;
|
||||
--li-container-width-lg: 700px;
|
||||
|
||||
--li-shadow: 0 4px 18px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
2341
wp-content/plugins/lordicon/dist/settings.js
vendored
Normal file
2341
wp-content/plugins/lordicon/dist/settings.js
vendored
Normal file
File diff suppressed because one or more lines are too long
373
wp-content/plugins/lordicon/includes/class-ajax-handler.php
Normal file
373
wp-content/plugins/lordicon/includes/class-ajax-handler.php
Normal file
@@ -0,0 +1,373 @@
|
||||
<?php
|
||||
namespace Lordicon;
|
||||
|
||||
class AjaxHandler {
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
public function run() {
|
||||
add_action('wp_ajax_lordicon_request', array($this, 'handle_request'));
|
||||
}
|
||||
|
||||
public function handle_request() {
|
||||
check_ajax_referer('lordicon_action', 'nonce');
|
||||
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_die('Unauthorized');
|
||||
}
|
||||
|
||||
// Check if valid POST request
|
||||
if ( ! isset( $_POST['endpoint'] ) ) {
|
||||
wp_send_json_error('Invalid request.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanitize endpoint
|
||||
$endpoint = sanitize_text_field( wp_unslash( $_POST['endpoint'] ) );
|
||||
|
||||
switch ($endpoint) {
|
||||
case 'auth_start':
|
||||
$this->auth_start();
|
||||
break;
|
||||
case 'auth_check':
|
||||
$this->auth_check();
|
||||
break;
|
||||
case 'logout':
|
||||
$this->logout();
|
||||
break;
|
||||
case 'status':
|
||||
$this->status();
|
||||
break;
|
||||
case 'variants':
|
||||
$this->variants();
|
||||
break;
|
||||
case 'icons':
|
||||
$this->icons();
|
||||
break;
|
||||
case 'track':
|
||||
$this->track();
|
||||
break;
|
||||
case 'upload':
|
||||
$this->upload();
|
||||
break;
|
||||
default:
|
||||
wp_send_json_error('Unknown action');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function icons() {
|
||||
$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
|
||||
if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'lordicon_action' ) ) {
|
||||
wp_send_json_error('Security check failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
$family = sanitize_text_field( wp_unslash( $_POST['family'] ?? '' ) );
|
||||
$style = sanitize_text_field( wp_unslash( $_POST['style'] ?? '' ) );
|
||||
$search = sanitize_text_field( wp_unslash( $_POST['search'] ?? '' ) );
|
||||
$index = sanitize_text_field( wp_unslash( $_POST['index'] ?? '' ) );
|
||||
$page = isset( $_POST['page'] ) ? intval( wp_unslash( $_POST['page'] ) ) : 1;
|
||||
$per_page = isset( $_POST['per_page'] ) ? intval( wp_unslash( $_POST['per_page'] ) ) : 100;
|
||||
|
||||
$result = API::get_instance()->icons([
|
||||
'family' => $family,
|
||||
'style' => $style,
|
||||
'search' => $search,
|
||||
'index' => $index,
|
||||
'page' => $page,
|
||||
'per_page' => $per_page,
|
||||
]);
|
||||
|
||||
if ( isset( $result['error'] ) ) {
|
||||
wp_send_json_error( $result['error'] );
|
||||
}
|
||||
|
||||
wp_send_json_success([
|
||||
'icons' => $result['data'] ?? [],
|
||||
'params' => [
|
||||
'link' => $result['headers']['link'] ?? '',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
private function track() {
|
||||
$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
|
||||
if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'lordicon_action' ) ) {
|
||||
wp_send_json_error('Security check failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
$family = sanitize_text_field( wp_unslash( $_POST['family'] ?? '' ) );
|
||||
$style = sanitize_text_field( wp_unslash( $_POST['style'] ?? '' ) );
|
||||
$index = isset( $_POST['index'] ) ? intval( wp_unslash( $_POST['index'] ) ) : 0;
|
||||
|
||||
$params = [
|
||||
'family' => $family,
|
||||
'style' => $style,
|
||||
'index' => $index,
|
||||
];
|
||||
|
||||
$result = API::get_instance()->track( $params );
|
||||
|
||||
if ( isset( $result['error'] ) ) {
|
||||
wp_send_json_error( $result['error'] );
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
private function status() {
|
||||
$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
|
||||
if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'lordicon_action' ) ) {
|
||||
wp_send_json_error('Security check failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
$result = API::get_instance()->status();
|
||||
|
||||
if (isset($result['error'])) {
|
||||
wp_send_json_error($result['error']);
|
||||
} else {
|
||||
wp_send_json_success($result['data']);
|
||||
}
|
||||
}
|
||||
|
||||
private function variants() {
|
||||
$cache_key = 'lordicon_variants';
|
||||
$cached_result = get_transient($cache_key);
|
||||
|
||||
if ($cached_result !== false) {
|
||||
wp_send_json_success($cached_result);
|
||||
return;
|
||||
}
|
||||
|
||||
$result = API::get_instance()->variants();
|
||||
|
||||
if (isset($result['error'])) {
|
||||
wp_send_json_error($result['error']);
|
||||
} else {
|
||||
set_transient($cache_key, $result['data'], HOUR_IN_SECONDS);
|
||||
wp_send_json_success($result['data']);
|
||||
}
|
||||
}
|
||||
|
||||
private function auth_start() {
|
||||
$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
|
||||
if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'lordicon_action' ) ) {
|
||||
wp_send_json_error('Security check failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
$email = sanitize_email( wp_unslash( $_POST['email'] ?? '' ) );
|
||||
|
||||
if ( empty( $email ) ) {
|
||||
wp_send_json_error( 'Email is required' );
|
||||
return;
|
||||
}
|
||||
|
||||
$result = API::get_instance()->auth_start( $email );
|
||||
|
||||
if ( isset( $result['error'] ) ) {
|
||||
wp_send_json_error( $result['error'] );
|
||||
}
|
||||
|
||||
wp_send_json_success( $result['data'] ?? [] );
|
||||
}
|
||||
|
||||
private function auth_check() {
|
||||
$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
|
||||
if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'lordicon_action' ) ) {
|
||||
wp_send_json_error('Security check failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
$email = sanitize_email( wp_unslash( $_POST['email'] ?? '' ) );
|
||||
$code = sanitize_text_field( wp_unslash( $_POST['code'] ?? '' ) );
|
||||
|
||||
if ( empty( $email ) || empty( $code ) ) {
|
||||
wp_send_json_error( 'Email and code are required' );
|
||||
return;
|
||||
}
|
||||
|
||||
$result = API::get_instance()->auth_check( $email, $code );
|
||||
|
||||
if ( isset( $result['error'] ) ) {
|
||||
wp_send_json_error( $result['error'] );
|
||||
}
|
||||
|
||||
$data = $result['data'] ?? [];
|
||||
|
||||
if ( isset( $data['token'] ) ) {
|
||||
$settings_json = get_option( 'lordicon_settings', '{}' );
|
||||
$settings = json_decode( $settings_json );
|
||||
|
||||
if ( ! is_object( $settings ) ) {
|
||||
$settings = new \stdClass();
|
||||
}
|
||||
|
||||
$settings->token = $data['token'];
|
||||
update_option( 'lordicon_settings', wp_json_encode( $settings ) );
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
private function logout() {
|
||||
$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
|
||||
if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'lordicon_action' ) ) {
|
||||
wp_send_json_error('Security check failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
delete_option('lordicon_settings');
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
private function upload() {
|
||||
$nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : '';
|
||||
if (empty($nonce) || ! wp_verify_nonce($nonce, 'lordicon_action')) {
|
||||
wp_send_json_error('Security check failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the current user has permission to upload files
|
||||
if (!current_user_can('upload_files')) {
|
||||
wp_send_json_error('Insufficient permissions');
|
||||
}
|
||||
|
||||
// Sanitize input fields from POST to prevent malicious input
|
||||
$post_id = isset($_POST['post_id']) ? intval(wp_unslash($_POST['post_id'])) : 0;
|
||||
$family = sanitize_text_field(wp_unslash($_POST['family'] ?? ''));
|
||||
$style = sanitize_text_field(wp_unslash($_POST['style'] ?? ''));
|
||||
$index = sanitize_text_field(wp_unslash($_POST['index'] ?? ''));
|
||||
$name = sanitize_text_field(wp_unslash($_POST['name'] ?? ''));
|
||||
$hash = sanitize_text_field(wp_unslash($_POST['hash'] ?? ''));
|
||||
|
||||
// Ensure required fields are provided before proceeding
|
||||
if (empty($family) || empty($style) || empty($index) || empty($name)) {
|
||||
wp_send_json_error('Family, style, index, and name are required');
|
||||
}
|
||||
|
||||
// Include WordPress media functions
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/media.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||
|
||||
$result = [
|
||||
'svgAttachmentId' => 0,
|
||||
'jsonAttachmentId' => 0,
|
||||
];
|
||||
|
||||
// Check existing attachments
|
||||
$existing_svg = $this->find_existing_attachment('svg', $family, $style, $index, $name, $post_id, $hash);
|
||||
$existing_json = $this->find_existing_attachment('json', $family, $style, $index, $name, $post_id);
|
||||
|
||||
if ($existing_svg) $result['svgAttachmentId'] = $existing_svg->ID;
|
||||
if ($existing_json) $result['jsonAttachmentId'] = $existing_json->ID;
|
||||
|
||||
// Handle SVG and JSON file uploads in a loop for cleaner code
|
||||
foreach ([
|
||||
'svg_file' => ['type' => 'svg', 'mime' => 'image/svg+xml'],
|
||||
'json_file' => ['type' => 'json', 'mime' => 'application/json']
|
||||
] as $input_name => $props) {
|
||||
// Proceed only if a file is uploaded and there is no existing attachment
|
||||
if (isset($_FILES[$input_name], $_FILES[$input_name]['tmp_name']) && $result[$props['type'].'AttachmentId'] <= 0) {
|
||||
// Sanitize file name
|
||||
$filename = isset($_FILES[$input_name]['name']) ? sanitize_file_name(wp_unslash($_FILES[$input_name]['name'])) : '';
|
||||
$_FILES[$input_name]['name'] = $filename;
|
||||
|
||||
$tmp_name = isset($_FILES[$input_name]['tmp_name']) ? wp_normalize_path(sanitize_text_field($_FILES[$input_name]['tmp_name'])) : '';
|
||||
|
||||
if (
|
||||
$tmp_name &&
|
||||
isset($_FILES[$input_name]['error']) &&
|
||||
$_FILES[$input_name]['error'] === UPLOAD_ERR_OK &&
|
||||
is_uploaded_file($tmp_name)
|
||||
) {
|
||||
// Verify file type and extension to match expected type
|
||||
$filetype = wp_check_filetype_and_ext($tmp_name, $filename);
|
||||
|
||||
if ($filetype['ext'] !== $props['type'] || $filetype['type'] !== $props['mime']) {
|
||||
wp_send_json_error('Invalid ' . strtoupper($props['type']) . ' file type.');
|
||||
}
|
||||
|
||||
// Use WordPress media handling to store the uploaded file properly
|
||||
$attachment_id = media_handle_upload($input_name, $post_id);
|
||||
if (is_wp_error($attachment_id)) {
|
||||
wp_send_json_error($attachment_id->get_error_message());
|
||||
}
|
||||
|
||||
// Update post title for easier identification in Media Library
|
||||
$title = sprintf('%s-%s-%s-%s', $family, $style, $index, $name);
|
||||
wp_update_post(['ID' => $attachment_id, 'post_title' => $title]);
|
||||
|
||||
// Store custom meta for later identification of uploaded icons
|
||||
foreach ([
|
||||
'_lordicon_type' => $props['type'],
|
||||
'_lordicon_family' => $family,
|
||||
'_lordicon_style' => $style,
|
||||
'_lordicon_index' => $index,
|
||||
'_lordicon_name' => $name,
|
||||
'_lordicon_hash' => $hash,
|
||||
] as $meta_key => $meta_value) {
|
||||
update_post_meta($attachment_id, $meta_key, $meta_value);
|
||||
}
|
||||
|
||||
// Store attachment ID in result for response
|
||||
$result[$props['type'].'AttachmentId'] = $attachment_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wp_send_json_success($result);
|
||||
}
|
||||
|
||||
private function find_existing_attachment($type, $family, $style, $index, $name, $post_id = 0, $hash = null) {
|
||||
$meta_query = array(
|
||||
array(
|
||||
'key' => '_lordicon_type',
|
||||
'value' => $type
|
||||
),
|
||||
array(
|
||||
'key' => '_lordicon_family',
|
||||
'value' => $family
|
||||
),
|
||||
array(
|
||||
'key' => '_lordicon_style',
|
||||
'value' => $style
|
||||
),
|
||||
array(
|
||||
'key' => '_lordicon_index',
|
||||
'value' => $index
|
||||
),
|
||||
array(
|
||||
'key' => '_lordicon_name',
|
||||
'value' => $name
|
||||
)
|
||||
);
|
||||
|
||||
if (!empty($hash)) {
|
||||
$meta_query[] = array(
|
||||
'key' => '_lordicon_hash',
|
||||
'value' => $hash
|
||||
);
|
||||
}
|
||||
|
||||
// We use a meta query here to find attachments that match specific metadata fields.
|
||||
// Each Lordicon file (SVG or JSON) is stored as a WordPress attachment with custom meta
|
||||
// describing its type, family, style, index, name, and optionally hash. By querying
|
||||
// these meta fields, we can reliably locate the exact attachment corresponding to
|
||||
// the uploaded icon without relying solely on file names or post titles.
|
||||
$args = array(
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'inherit',
|
||||
'post_parent' => $post_id,
|
||||
'meta_query' => $meta_query
|
||||
);
|
||||
|
||||
$attachments = get_posts($args);
|
||||
return !empty($attachments) ? $attachments[0] : null;
|
||||
}
|
||||
}
|
||||
222
wp-content/plugins/lordicon/includes/class-api.php
Normal file
222
wp-content/plugins/lordicon/includes/class-api.php
Normal file
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
namespace Lordicon;
|
||||
|
||||
class API {
|
||||
private static $instance = null;
|
||||
|
||||
private $api_base_url = 'https://api.lordicon.com/v1/';
|
||||
private $settings;
|
||||
|
||||
public function __construct() {
|
||||
$this->settings = json_decode(get_option('lordicon_settings', '{}'));
|
||||
}
|
||||
|
||||
public static function get_instance() {
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function autologin() {
|
||||
// jeśli mamy token w ustawieniach, zwracamy go
|
||||
if (!empty($this->settings->token)) {
|
||||
return array('token' => $this->settings->token);
|
||||
}
|
||||
|
||||
// jeśli brak tokena - próbujemy zalogować jako guest
|
||||
$response = $this->auth_guest();
|
||||
|
||||
if (!empty($response['data']['token'])) {
|
||||
// zapisz nowy token w ustawieniach WP
|
||||
$this->settings->token = $response['data']['token'];
|
||||
update_option('lordicon_settings', json_encode($this->settings));
|
||||
return array('token' => $this->settings->token);
|
||||
}
|
||||
|
||||
// jeśli nie udało się pobrać tokena
|
||||
return array('error' => $response['error'] ?? 'Autologin failed');
|
||||
}
|
||||
|
||||
public function auth_guest() {
|
||||
$url = $this->api_base_url . 'auth/' . Constants::app_name();
|
||||
|
||||
$args = array(
|
||||
'headers' => array('Content-Type' => 'application/json'),
|
||||
'body' => null,
|
||||
'method' => 'POST',
|
||||
'timeout' => 15,
|
||||
);
|
||||
|
||||
$response = wp_remote_request($url, $args);
|
||||
|
||||
return $this->handle_response($response);
|
||||
}
|
||||
|
||||
public function auth_start($email) {
|
||||
$url = $this->api_base_url . 'auth/' . Constants::app_name();
|
||||
|
||||
$args = array(
|
||||
'headers' => array('Content-Type' => 'application/json'),
|
||||
'body' => json_encode(array('email' => $email)),
|
||||
'method' => 'POST',
|
||||
'timeout' => 15,
|
||||
);
|
||||
|
||||
$response = wp_remote_request($url, $args);
|
||||
|
||||
return $this->handle_response($response);
|
||||
}
|
||||
|
||||
public function auth_check($email, $code) {
|
||||
$url = $this->api_base_url . 'auth/' . Constants::app_name();
|
||||
|
||||
$args = array(
|
||||
'headers' => array('Content-Type' => 'application/json'),
|
||||
'body' => json_encode(array('email' => $email, 'code' => $code)),
|
||||
'method' => 'PATCH',
|
||||
'timeout' => 15,
|
||||
);
|
||||
|
||||
$response = wp_remote_request($url, $args);
|
||||
|
||||
return $this->handle_response($response);
|
||||
}
|
||||
|
||||
public function status() {
|
||||
$this->autologin();
|
||||
|
||||
$url = $this->api_base_url . 'status';
|
||||
$token = $this->token;
|
||||
|
||||
if (!$token) {
|
||||
return array('error' => 'Unauthorized');
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Bearer ' . ($token),
|
||||
),
|
||||
'method' => 'GET',
|
||||
'timeout' => 5,
|
||||
);
|
||||
|
||||
$response = wp_remote_request($url, $args);
|
||||
|
||||
return $this->handle_response($response);
|
||||
}
|
||||
|
||||
public function variants() {
|
||||
$this->autologin();
|
||||
|
||||
$url = $this->api_base_url . 'variants';
|
||||
$token = $this->token;
|
||||
|
||||
if (!$token) {
|
||||
return array('error' => 'Unauthorized');
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Bearer ' . ($token),
|
||||
),
|
||||
'method' => 'GET',
|
||||
'timeout' => 5,
|
||||
);
|
||||
|
||||
$response = wp_remote_request($url, $args);
|
||||
|
||||
return $this->handle_response($response);
|
||||
}
|
||||
|
||||
public function icons($params) {
|
||||
$this->autologin();
|
||||
|
||||
$url = $this->api_base_url . 'icons';
|
||||
if (!empty($params)) {
|
||||
$query_string = http_build_query($params);
|
||||
$url .= '?' . $query_string;
|
||||
}
|
||||
|
||||
$token = $this->token;
|
||||
|
||||
if (!$token) {
|
||||
return array('error' => 'Unauthorized');
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Bearer ' . ($token),
|
||||
),
|
||||
'method' => 'GET',
|
||||
'timeout' => 5,
|
||||
);
|
||||
|
||||
$response = wp_remote_request($url, $args);
|
||||
|
||||
return $this->handle_response($response);
|
||||
}
|
||||
|
||||
public function track($params) {
|
||||
$this->autologin();
|
||||
|
||||
$url = $this->api_base_url . 'download/track';
|
||||
|
||||
$token = $this->token;
|
||||
|
||||
if (!$token) {
|
||||
return array('error' => 'Unauthorized');
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Bearer ' . ($token),
|
||||
),
|
||||
'body' => json_encode($params),
|
||||
'method' => 'POST',
|
||||
'timeout' => 15,
|
||||
);
|
||||
|
||||
$response = wp_remote_request($url, $args);
|
||||
|
||||
return $this->handle_response($response);
|
||||
}
|
||||
|
||||
private function handle_response($response) {
|
||||
if (is_wp_error($response)) {
|
||||
return array('error' => $response->get_error_message());
|
||||
}
|
||||
|
||||
$body_raw = wp_remote_retrieve_body($response);
|
||||
$headers = wp_remote_retrieve_headers($response)->getAll();
|
||||
$status_code = wp_remote_retrieve_response_code($response);
|
||||
$body = json_decode($body_raw, true);
|
||||
|
||||
if (isset($body['error']) || isset($body['message'])) {
|
||||
return array('error' => $body['message'] ?? $body['error']);
|
||||
}
|
||||
|
||||
return array(
|
||||
'data' => $body,
|
||||
'headers' => $headers,
|
||||
'status_code' => $status_code,
|
||||
);
|
||||
}
|
||||
|
||||
private function __clone() {}
|
||||
|
||||
public function __wakeup() {
|
||||
throw new \Exception("Cannot unserialize singleton");
|
||||
}
|
||||
|
||||
public function __get($property) {
|
||||
if ($property === 'token') {
|
||||
return $this->settings->token ?? null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
29
wp-content/plugins/lordicon/includes/class-constants.php
Normal file
29
wp-content/plugins/lordicon/includes/class-constants.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace Lordicon;
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Constants {
|
||||
const PLUGIN_VERSION = '1.0.0';
|
||||
const PLUGIN_NAME = 'lordicon';
|
||||
const PLUGIN_BASENAME = 'lordicon/lordicon.php';
|
||||
const APP_NAME = 'wp';
|
||||
|
||||
public static function plugin_version() {
|
||||
return self::PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
public static function plugin_name() {
|
||||
return self::PLUGIN_NAME;
|
||||
}
|
||||
|
||||
public static function plugin_basename() {
|
||||
return self::PLUGIN_BASENAME;
|
||||
}
|
||||
|
||||
public static function app_name() {
|
||||
return self::APP_NAME;
|
||||
}
|
||||
}
|
||||
60
wp-content/plugins/lordicon/includes/class-loader.php
Normal file
60
wp-content/plugins/lordicon/includes/class-loader.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace Lordicon;
|
||||
|
||||
if (!defined('ABSPATH') ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Loader {
|
||||
protected $actions;
|
||||
protected $filters;
|
||||
protected $shortcodes;
|
||||
|
||||
public function __construct() {
|
||||
$this->actions = array();
|
||||
$this->filters = array();
|
||||
$this->shortcodes = array();
|
||||
}
|
||||
|
||||
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->actions[] = array(
|
||||
'hook' => $hook,
|
||||
'component' => $component,
|
||||
'callback' => $callback,
|
||||
'priority' => $priority,
|
||||
'accepted_args' => $accepted_args
|
||||
);
|
||||
}
|
||||
|
||||
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->filters[] = array(
|
||||
'hook' => $hook,
|
||||
'component' => $component,
|
||||
'callback' => $callback,
|
||||
'priority' => $priority,
|
||||
'accepted_args' => $accepted_args
|
||||
);
|
||||
}
|
||||
|
||||
public function add_shortcode( $tag, $component, $callback ) {
|
||||
$this->shortcodes[] = array(
|
||||
'tag' => $tag,
|
||||
'component' => $component,
|
||||
'callback' => $callback,
|
||||
);
|
||||
}
|
||||
|
||||
public function run() {
|
||||
foreach ($this->filters as $hook) {
|
||||
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
foreach ($this->actions as $hook) {
|
||||
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
foreach ($this->shortcodes as $shortcode) {
|
||||
add_shortcode( $shortcode['tag'], array( $shortcode['component'], $shortcode['callback'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
416
wp-content/plugins/lordicon/includes/class-plugin.php
Normal file
416
wp-content/plugins/lordicon/includes/class-plugin.php
Normal file
@@ -0,0 +1,416 @@
|
||||
<?php
|
||||
namespace Lordicon;
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function is_settings() {
|
||||
$screen = get_current_screen();
|
||||
if (!$screen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if this screen is a settings page of our plugin
|
||||
// Matches either top-level or submenu pages
|
||||
$menu_slug = 'lordicon-settings';
|
||||
return str_ends_with($screen->id, $menu_slug);
|
||||
}
|
||||
|
||||
class Plugin {
|
||||
private $loader;
|
||||
private $handler;
|
||||
|
||||
public function __construct() {
|
||||
$this->load_dependencies();
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function run() {
|
||||
$this->loader->run();
|
||||
$this->handler->run();
|
||||
}
|
||||
|
||||
private function load_dependencies() {
|
||||
require_once plugin_dir_path(dirname(__FILE__)).'includes/class-constants.php';
|
||||
require_once plugin_dir_path(dirname(__FILE__)).'includes/class-loader.php';
|
||||
require_once plugin_dir_path(dirname(__FILE__)).'includes/class-api.php';
|
||||
require_once plugin_dir_path(dirname(__FILE__)).'includes/class-ajax-handler.php';
|
||||
}
|
||||
|
||||
private function init() {
|
||||
$this->loader = new Loader();
|
||||
$this->loader->add_filter('upload_mimes', $this, 'allow_lordicon_mimes');
|
||||
$this->loader->add_filter('wp_check_filetype_and_ext', $this, 'check_lordicon_filetype', 10, 4);
|
||||
$this->loader->add_filter('post_mime_types', $this, 'add_json_mime_types');
|
||||
$this->loader->add_filter('wp_prepare_attachment_for_js', $this, 'prepare_json_attachment_for_js', 10, 3);
|
||||
|
||||
if (is_admin()) {
|
||||
$this->loader->add_action('admin_enqueue_scripts', $this, 'enqueue_admin_assets');
|
||||
$this->loader->add_action('enqueue_block_editor_assets', $this, 'enqueue_block_editor_assets');
|
||||
$this->loader->add_action('admin_menu', $this, 'settings_init_menu');
|
||||
$this->loader->add_action('admin_init', $this, 'settings_handle_form_submission');
|
||||
|
||||
$this->loader->add_filter('plugin_row_meta', $this, 'plugin_links', 10, 3);
|
||||
} else {
|
||||
$define_element = apply_filters('lordicon_define_element', true);
|
||||
|
||||
if ($define_element) {
|
||||
$this->loader->add_action('wp_enqueue_scripts', $this, 'enqueue_frontend_assets');
|
||||
}
|
||||
}
|
||||
|
||||
// Block registration (both admin and frontend)
|
||||
$this->loader->add_action('init', $this, 'register_block_type');
|
||||
|
||||
$this->handler = new AjaxHandler();
|
||||
}
|
||||
|
||||
public function enqueue_admin_assets() {
|
||||
if (is_settings()) {
|
||||
wp_enqueue_script(
|
||||
'lordicon-settings-script',
|
||||
plugins_url('/dist/settings.js', dirname(__FILE__)),
|
||||
array(),
|
||||
Constants::plugin_version(),
|
||||
false,
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'lordicon-settings-css',
|
||||
plugins_url('/dist/settings.css', dirname(__FILE__)),
|
||||
array(),
|
||||
Constants::plugin_version()
|
||||
);
|
||||
|
||||
$this->patch_module('lordicon-settings-script', 'settings');
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue_block_editor_assets() {
|
||||
wp_enqueue_script(
|
||||
'lordicon-block-js',
|
||||
plugins_url('/dist/block.js', dirname(__FILE__)),
|
||||
array('wp-blocks', 'wp-element', 'wp-components', 'wp-block-editor', 'wp-i18n'),
|
||||
Constants::plugin_version(),
|
||||
false,
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'lordicon-block-css',
|
||||
plugins_url('/dist/block.css', dirname(__FILE__)),
|
||||
array('wp-edit-blocks'),
|
||||
Constants::plugin_version()
|
||||
);
|
||||
|
||||
$this->patch_module('lordicon-block-js', 'editor');
|
||||
}
|
||||
|
||||
public function enqueue_frontend_assets() {
|
||||
wp_enqueue_style(
|
||||
'lordicon-element-style',
|
||||
plugins_url('/dist/element.css', dirname(__FILE__)),
|
||||
array(),
|
||||
Constants::plugin_version()
|
||||
);
|
||||
|
||||
wp_enqueue_script_module(
|
||||
'lordicon-element-script',
|
||||
plugins_url('/dist/element.js', dirname(__FILE__)),
|
||||
array(),
|
||||
Constants::plugin_version(),
|
||||
);
|
||||
}
|
||||
|
||||
private function patch_module(string $scriptHandle, string $context) {
|
||||
$url = admin_url('admin-ajax.php');
|
||||
$nonce = wp_create_nonce('lordicon_action');
|
||||
$status = API::get_instance()->status()['data'];
|
||||
$variants = $status ? API::get_instance()->variants()['data'] : [];
|
||||
|
||||
// Safely get post ID without using $_GET
|
||||
$post_id = 0;
|
||||
if ($context === 'editor') {
|
||||
$post = get_post();
|
||||
if ($post && $post->ID) {
|
||||
$post_id = $post->ID;
|
||||
}
|
||||
}
|
||||
|
||||
$config = [
|
||||
'url' => $url,
|
||||
'nonce' => $nonce,
|
||||
'status' => $status,
|
||||
'variants' => $variants,
|
||||
'postId' => $post_id,
|
||||
'context' => $context,
|
||||
];
|
||||
|
||||
wp_add_inline_script(
|
||||
$scriptHandle,
|
||||
'window.__LORDICON__ = ' . wp_json_encode($config) . ';',
|
||||
'after'
|
||||
);
|
||||
|
||||
// Patch the script tag to use type="module"
|
||||
add_filter('script_loader_tag', function ($tag, $handle, $src) use ($scriptHandle) {
|
||||
if ($scriptHandle !== $handle) return $tag;
|
||||
|
||||
$search = sprintf('id="%s-js"', $scriptHandle);
|
||||
$replace = $search . ' type="module"';
|
||||
return str_replace($search, $replace, $tag);
|
||||
}, 10, 3);
|
||||
}
|
||||
|
||||
public function register_block_type() {
|
||||
register_block_type(dirname(__DIR__) . '/dist/block.json', array(
|
||||
'render_callback' => array($this, 'render_block'),
|
||||
));
|
||||
}
|
||||
|
||||
public function settings_init_menu() {
|
||||
add_options_page(
|
||||
'Lordicon Settings',
|
||||
'Lordicon',
|
||||
'manage_options',
|
||||
'lordicon-settings',
|
||||
array($this, 'render_settings'),
|
||||
);
|
||||
}
|
||||
|
||||
public function settings_handle_form_submission() {
|
||||
// Check if form is submitted
|
||||
if ( ! isset( $_POST['lordicon_settings'], $_POST['lordicon_nonce'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanitize nonce
|
||||
$nonce = sanitize_text_field( wp_unslash( $_POST['lordicon_nonce'] ) );
|
||||
if ( ! wp_verify_nonce( $nonce, 'lordicon_settings_action' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanitize settings
|
||||
$settings = array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['lordicon_settings'] ) );
|
||||
|
||||
// Save settings
|
||||
update_option( 'lordicon_settings', $settings );
|
||||
|
||||
// Message
|
||||
add_settings_error(
|
||||
'lordicon_settings',
|
||||
'settings_updated',
|
||||
'Settings saved.',
|
||||
'updated'
|
||||
);
|
||||
}
|
||||
|
||||
public function plugin_links($plugin_links, $plugin_file, $plugin_data) {
|
||||
$links = array();
|
||||
if (isset($plugin_data['AuthorName']) && $plugin_data['AuthorName'] == 'Lordicon') {
|
||||
$links = array(
|
||||
'<a href="' . admin_url('options-general.php?page=lordicon-settings') . '">Settings</a>',
|
||||
);
|
||||
}
|
||||
return array_merge($plugin_links, $links);
|
||||
}
|
||||
|
||||
public function allow_lordicon_mimes($mimes) {
|
||||
if (!isset($mimes['json'])) {
|
||||
$mimes['json'] = 'application/json';
|
||||
}
|
||||
if (!isset($mimes['svg'])) {
|
||||
$mimes['svg'] = 'image/svg+xml';
|
||||
}
|
||||
return $mimes;
|
||||
}
|
||||
|
||||
public function add_json_mime_types($mime_types) {
|
||||
$mime_types['application/json'] = array(
|
||||
__('Lordicon Files', 'lordicon'),
|
||||
__('Manage Lordicon Files', 'lordicon'),
|
||||
// translators: %s is the number of Lordicon files
|
||||
_n_noop('Lordicon File <span class="count">(%s)</span>', 'Lordicon Files <span class="count">(%s)</span>', 'lordicon'),
|
||||
);
|
||||
|
||||
return $mime_types;
|
||||
}
|
||||
|
||||
public function prepare_json_attachment_for_js($response, $attachment, $meta) {
|
||||
if ($response['mime'] === 'application/json') {
|
||||
$response['icon'] = plugins_url('assets/lordicon-icon.png', dirname(__FILE__));
|
||||
|
||||
if (get_post_meta($attachment->ID, '_lordicon_type', true) === 'json') {
|
||||
$response['subtype'] = 'lordicon-json';
|
||||
$response['title'] = $response['title'];
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function check_lordicon_filetype($data, $file, $filename, $mimes) {
|
||||
if (substr($filename, -5) === '.json') {
|
||||
$data['ext'] = 'json';
|
||||
$data['type'] = 'application/json';
|
||||
}
|
||||
if (substr($filename, -4) === '.svg') {
|
||||
$data['ext'] = 'svg';
|
||||
$data['type'] = 'image/svg+xml';
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function render_block( $attributes, $content ) {
|
||||
$icon = $attributes['icon'] ?? null;
|
||||
$json_attachment_id = isset( $attributes['jsonAttachmentId'] ) ? intval( $attributes['jsonAttachmentId'] ) : 0;
|
||||
$svg_attachment_id = isset( $attributes['svgAttachmentId'] ) ? intval( $attributes['svgAttachmentId'] ) : 0;
|
||||
$anchor = $attributes['anchor'] ?? '';
|
||||
$class_name = $attributes['className'] ?? '';
|
||||
$display = $attributes['properties']['display'] ?? 'block';
|
||||
$format = $attributes['properties']['format'] ?? 'json';
|
||||
|
||||
if ( ! $icon ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$json_src = $json_attachment_id ? wp_get_attachment_url( $json_attachment_id ) : '';
|
||||
$svg_src = $svg_attachment_id ? wp_get_attachment_url( $svg_attachment_id ) : '';
|
||||
|
||||
// Classes
|
||||
$css_classes = [ 'lordicon-wrapper' ];
|
||||
if ( 'block' !== $display ) {
|
||||
$css_classes[] = 'lordicon-wrapper-' . sanitize_html_class( $display );
|
||||
}
|
||||
if ( ! empty( $class_name ) ) {
|
||||
$css_classes[] = sanitize_html_class( $class_name );
|
||||
}
|
||||
$class_attr = esc_attr( implode( ' ', $css_classes ) );
|
||||
|
||||
// ID (anchor)
|
||||
$id_attr = '';
|
||||
if ( ! empty( $anchor ) ) {
|
||||
$id_attr = ' id="' . esc_attr( $anchor ) . '"';
|
||||
}
|
||||
|
||||
// Prepare <lord-icon> attributes as key => value (value true means boolean attr)
|
||||
$lord_icon_attrs = [];
|
||||
|
||||
if ( $json_src ) {
|
||||
$lord_icon_attrs['src'] = esc_url( $json_src );
|
||||
|
||||
// trigger
|
||||
$allowed_triggers = [ 'in', 'hover', 'click', 'loop', 'morph' ];
|
||||
$trigger = 'hover';
|
||||
if ( ! empty( $attributes['properties']['state'] ) ) {
|
||||
$state_parts = explode( '-', $attributes['properties']['state'] );
|
||||
$potential_trigger = $state_parts[0] ?? '';
|
||||
if ( in_array( $potential_trigger, $allowed_triggers, true ) ) {
|
||||
$trigger = $potential_trigger;
|
||||
}
|
||||
}
|
||||
$lord_icon_attrs['trigger'] = $trigger;
|
||||
|
||||
// size -> style attribute
|
||||
if ( ! empty( $attributes['properties']['size'] ) && intval( $attributes['properties']['size'] ) > 0 ) {
|
||||
$size_val = intval( $attributes['properties']['size'] );
|
||||
$lord_icon_attrs['style'] = "width:{$size_val}px;height:{$size_val}px;";
|
||||
}
|
||||
|
||||
// stroke
|
||||
if ( isset( $attributes['properties']['stroke'] ) && $attributes['properties']['stroke'] !== 2 ) {
|
||||
$lord_icon_attrs['stroke'] = (string) $attributes['properties']['stroke'];
|
||||
}
|
||||
|
||||
// colors (name:value,name:value)
|
||||
if ( ! empty( $attributes['properties']['colors'] ) && is_array( $attributes['properties']['colors'] ) ) {
|
||||
$color_pairs = [];
|
||||
foreach ( $attributes['properties']['colors'] as $name => $value ) {
|
||||
$color_pairs[] = sanitize_key( (string) $name ) . ':' . sanitize_text_field( (string) $value );
|
||||
}
|
||||
$lord_icon_attrs['colors'] = implode( ',', $color_pairs );
|
||||
}
|
||||
|
||||
// state
|
||||
if ( ! empty( $attributes['properties']['state'] ) ) {
|
||||
$lord_icon_attrs['state'] = sanitize_text_field( $attributes['properties']['state'] );
|
||||
}
|
||||
|
||||
// speed (float with dot)
|
||||
if ( isset( $attributes['properties']['speed'] ) ) {
|
||||
$lord_icon_attrs['speed'] = number_format( floatval( $attributes['properties']['speed'] ), 2, '.', '' );
|
||||
}
|
||||
|
||||
// target
|
||||
if ( ! empty( $attributes['properties']['target'] ) ) {
|
||||
$lord_icon_attrs['target'] = sanitize_text_field( $attributes['properties']['target'] );
|
||||
}
|
||||
|
||||
// sequence (forces trigger=sequence)
|
||||
if ( ! empty( $attributes['properties']['sequence'] ) ) {
|
||||
$lord_icon_attrs['sequence'] = sanitize_text_field( $attributes['properties']['sequence'] );
|
||||
$lord_icon_attrs['trigger'] = 'sequence';
|
||||
}
|
||||
|
||||
// intro (boolean attribute)
|
||||
$has_intro = ! empty( $attributes['properties']['intro'] ) && true === $attributes['properties']['intro'];
|
||||
|
||||
// loading policy
|
||||
$lord_icon_attrs['loading'] = ( ! empty( $svg_src ) && ! $has_intro ) ? 'interaction' : 'lazy';
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="<?php echo esc_attr( implode( ' ', $css_classes ) ); ?>"<?php echo ! empty( $anchor ) ? ' id="' . esc_attr( $anchor ) . '"' : ''; ?>>
|
||||
<?php if ( $json_src ) : ?>
|
||||
<lord-icon
|
||||
<?php foreach ( $lord_icon_attrs as $attr => $value ) : ?>
|
||||
<?php
|
||||
if ( is_bool( $value ) && $value ) {
|
||||
echo ' ' . esc_attr( $attr );
|
||||
} else {
|
||||
echo ' ' . esc_attr( $attr ) . '="' . esc_attr( (string) $value ) . '"';
|
||||
}
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ( $has_intro ) : ?>
|
||||
<?php echo ' ' . esc_attr( 'intro' ); ?>
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php if ( $svg_src && ! $has_intro ) : ?>
|
||||
<img src="<?php echo esc_url( $svg_src ); ?>" alt="" loading="lazy" />
|
||||
<?php endif; ?>
|
||||
</lord-icon>
|
||||
<?php elseif ( 'svg' === $format && $svg_src ) : ?>
|
||||
<img src="<?php echo esc_url( $svg_src ); ?>"
|
||||
<?php if ( ! empty( $attributes['properties']['size'] ) && intval( $attributes['properties']['size'] ) > 0 ) : ?>
|
||||
style="width:<?php echo intval( $attributes['properties']['size'] ); ?>px;height:<?php echo intval( $attributes['properties']['size'] ); ?>px;"
|
||||
<?php endif; ?>
|
||||
/>
|
||||
<?php else : ?>
|
||||
<div class="lordicon-info">
|
||||
<p>
|
||||
<?php
|
||||
$label = sprintf(
|
||||
'%s-%s-%s-%s',
|
||||
$icon['family'] ?? '',
|
||||
$icon['style'] ?? '',
|
||||
$icon['index'] ?? '',
|
||||
$icon['name'] ?? ''
|
||||
);
|
||||
echo esc_html( sprintf( 'Icon unavailable: %s. Edit this block and choose a new icon.', $label ) );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
public function render_settings() {
|
||||
?>
|
||||
<div id="lordicon"></div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
2
wp-content/plugins/lordicon/index.php
Normal file
2
wp-content/plugins/lordicon/index.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
# Silence is golden.
|
||||
26
wp-content/plugins/lordicon/lordicon.php
Normal file
26
wp-content/plugins/lordicon/lordicon.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Lordicon
|
||||
* Plugin URI: https://lordicon.com/wordpress-plugin
|
||||
* Description: Insert and customize interactive, animated icons.
|
||||
* Version: 1.0
|
||||
* Author: Lordicon
|
||||
* Author URI: https://lordicon.com/
|
||||
* License: GPLv2 or later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Text Domain: lordicon
|
||||
* Domain Path: /languages
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
require plugin_dir_path( __FILE__ ) . 'includes/class-plugin.php';
|
||||
|
||||
function run_lordicon_plugin() {
|
||||
$plugin = new \Lordicon\Plugin();
|
||||
$plugin->run();
|
||||
}
|
||||
|
||||
run_lordicon_plugin();
|
||||
121
wp-content/plugins/lordicon/readme.txt
Normal file
121
wp-content/plugins/lordicon/readme.txt
Normal file
@@ -0,0 +1,121 @@
|
||||
=== Lordicon ===
|
||||
Contributors: lordicon
|
||||
Tags: lordicon, lottie, animation, icons, animated icons
|
||||
Stable tag: 1.0
|
||||
Requires at least: 6.7
|
||||
Tested up to: 6.8
|
||||
Requires PHP: 7.2
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Enhance Gutenberg pages with animated icons from Lordicon. Add motion and style with high performance.
|
||||
|
||||
== Description ==
|
||||
|
||||
Lordicon offers a unique library of modern, animated icons designed to bring life and interactivity to your WordPress site. With this plugin, you can seamlessly browse, customize, and insert Lordicon icons directly into the Gutenberg editor.
|
||||
|
||||
Built to be fast, lightweight, and easy to use, the Lordicon plugin helps you enrich your content with motion graphics that stay performance-friendly. Whether you need subtle interactions or eye-catching animations, Lordicon provides the flexibility to match your brand and design style.
|
||||
|
||||
== Features ==
|
||||
|
||||
- Extensive free icon set (with attribution)
|
||||
- Full icon library available in PRO version (no attribution)
|
||||
- Insert icons directly into Gutenberg blocks
|
||||
- Customize color, stroke, animation type, and trigger
|
||||
- Optimized rendering with image fallbacks and lazy-loading for performance
|
||||
|
||||
== Why Choose Lordicon? ==
|
||||
|
||||
**Fully Customizable**
|
||||
|
||||
Modify icons directly within WordPress: choose colors, animation triggers (hover, click, loop), and more.
|
||||
|
||||
**Peak Performance**
|
||||
|
||||
Icons are rendered using image fallbacks on initial load and transition to animated formats only when users interact with them—keeping your pages fast and smooth.
|
||||
|
||||
**License-Friendly**
|
||||
|
||||
Stay compliant with free personal or commercial use through clearly defined licensing plans.
|
||||
|
||||
== Installation ==
|
||||
|
||||
= Automatic Installation =
|
||||
|
||||
1. Navigate to **Plugins > Add New** in your WordPress dashboard.
|
||||
2. Search for **Lordicon**.
|
||||
3. Click **Install Now**, then **Activate** the plugin.
|
||||
4. Go to any Gutenberg page or post and insert a **Lordicon** block to get started.
|
||||
|
||||
= Manual Installation =
|
||||
|
||||
1. Download the plugin from the WordPress plugin repository.
|
||||
2. Upload the contents to the `/wp-content/plugins/lordicon/` directory.
|
||||
3. Activate the plugin via the **Plugins** menu.
|
||||
4. Insert Lordicon blocks into your Gutenberg content as needed.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Is Lordicon free to use? =
|
||||
|
||||
Yes, the plugin and a curated set of icons are free for personal, non-commercial use with required attribution.
|
||||
|
||||
To unlock the full icon library, remove attribution, and gain commercial rights, you'll need to subscribe to a PRO plan.
|
||||
|
||||
= Do I need a Lordicon account to use this plugin? =
|
||||
|
||||
No, you can use the free icons without creating a Lordicon account.
|
||||
|
||||
A Lordicon account is only required to access the PRO icon library. You can log in via Settings → Lordicon in your WordPress admin dashboard.
|
||||
|
||||
Note: Subscription management (upgrading to PRO, payment, or account settings) is handled on the Lordicon website.
|
||||
|
||||
= Do I need a PRO plan? =
|
||||
|
||||
You only need the PRO plan if:
|
||||
|
||||
- You're using icons for commercial purposes
|
||||
- You need attribution-free use
|
||||
- You want access to the entire icon library
|
||||
- You require advanced customization and multiple downloads
|
||||
|
||||
[Explore our pricing](https://lordicon.com/pricing)
|
||||
|
||||
== License ==
|
||||
The plugin code is licensed under GPLv2 or later.
|
||||
However, the Lordicon icons themselves are licensed separately under the [Lordicon License Terms and Conditions](https://lordicon.com/licenses).
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. Insert the Lordicon block directly in the Gutenberg editor to begin.
|
||||
2. Select from three icon families: Wired, Doodle, or System — each crafted to suit different design needs.
|
||||
3. Quickly find the icon you need with an intuitive search experience.
|
||||
4. Tweak colors, stroke width, animation type, and more — all from within the Gutenberg editor.
|
||||
5. Add HTML anchors, extra CSS classes, display options, and animation controls for deeper customization.
|
||||
6. Preview your results in real time.
|
||||
|
||||
== Changelog ==
|
||||
= 1.0 =
|
||||
* Initial release.
|
||||
|
||||
== Development ==
|
||||
|
||||
Source code is available on GitHub:
|
||||
https://github.com/lordicondev/plugin-wordpress
|
||||
|
||||
This plugin includes a frontend build step for its Gutenberg block UI.
|
||||
|
||||
- Source files: `/ui` directory (JavaScript/TypeScript, styles, etc.)
|
||||
- Build tool: [Vite](https://vitejs.dev/)
|
||||
- Build output: `/dist` directory (included in the distributed plugin)
|
||||
- PHP files: top-level plugin files – no build process required
|
||||
|
||||
### Build instructions
|
||||
|
||||
Clone the repository and run:
|
||||
|
||||
cd ui
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
This will generate the production-ready frontend assets in `/dist`.
|
||||
Reference in New Issue
Block a user