Initial commit: WordPress wp-content (themes, plugins, languages)
- Theme: momentry (custom theme with REST API routes) - Plugins: code-snippets (contains all API proxies) - Languages: zh_TW translations - Excludes: cache, backups, uploads, logs
This commit is contained in:
34
plugins/akismet/.htaccess
Normal file
34
plugins/akismet/.htaccess
Normal file
@@ -0,0 +1,34 @@
|
||||
# Only allow direct access to specific Web-available files.
|
||||
|
||||
# Apache 2.2
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</IfModule>
|
||||
|
||||
# Apache 2.4
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
|
||||
# Akismet CSS and JS
|
||||
<FilesMatch "^(form\.js|akismet(-frontend|-admin)?\.js|akismet(-admin)?(-rtl)?\.css|inter\.css)$">
|
||||
<IfModule !mod_authz_core.c>
|
||||
Allow from all
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all granted
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
|
||||
# Akismet images
|
||||
<FilesMatch "^(logo-a-2x\.png|akismet-refresh-logo\.svg|akismet-refresh-logo@2x\.png|arrow-left\.svg|akismet-activation-banner-elements\.png|copy\.svg)$">
|
||||
<IfModule !mod_authz_core.c>
|
||||
Allow from all
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all granted
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
339
plugins/akismet/LICENSE.txt
Normal file
339
plugins/akismet/LICENSE.txt
Normal file
@@ -0,0 +1,339 @@
|
||||
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.
|
||||
797
plugins/akismet/_inc/akismet-admin.css
Normal file
797
plugins/akismet/_inc/akismet-admin.css
Normal file
@@ -0,0 +1,797 @@
|
||||
body {
|
||||
--akismet-color-charcoal: #272635;
|
||||
--akismet-color-light-grey: #f6f7f7;
|
||||
--akismet-color-mid-grey: #a7aaad;
|
||||
--akismet-color-dark-grey: #646970;
|
||||
--akismet-color-grey-80: #2c3338;
|
||||
--akismet-color-grey-100: #101517;
|
||||
--akismet-color-grey-border: #dcdcde;
|
||||
--akismet-color-white: #fff;
|
||||
--akismet-color-dark-green: #2d6a40;
|
||||
--akismet-color-mid-green: #357b49;
|
||||
--akismet-color-light-green: #4eb26a;
|
||||
--akismet-color-mid-red: #e82c3f;
|
||||
--akismet-color-light-blue: #256eff;
|
||||
--akismet-color-notice-light-green: #dbf0e1;
|
||||
--akismet-color-notice-dark-green: #69bf82;
|
||||
--akismet-color-notice-light-red: #ffdbde;
|
||||
--akismet-color-notice-dark-red: #ff6676;
|
||||
--akismet-color-notice-yellow: #e5c133;
|
||||
--akismet-color-page-bg: #fcfcfc;
|
||||
--akismet-color-border: #e0e0e0;
|
||||
--akismet-color-border-light: #f0f0f0;
|
||||
--akismet-color-near-black: #1e1e1e;
|
||||
--akismet-color-text-grey: #757575;
|
||||
--akismet-color-icon: #666666;
|
||||
--akismet-color-icon-hover: #333333;
|
||||
}
|
||||
|
||||
/* UI components */
|
||||
#akismet-plugin-container {
|
||||
background-color: var(--akismet-color-page-bg);
|
||||
border: 1px solid var(--akismet-color-border);
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
#akismet-plugin-container a {
|
||||
color: var(--akismet-color-mid-green);
|
||||
}
|
||||
|
||||
#akismet-plugin-container a.akismet-button {
|
||||
background-color: var(--akismet-color-mid-green);
|
||||
color: var(--akismet-color-white);
|
||||
}
|
||||
|
||||
#akismet-plugin-container button:focus-visible,
|
||||
#akismet-plugin-container input:focus-visible {
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
outline: 2px solid var(--akismet-color-light-blue);
|
||||
}
|
||||
|
||||
#akismet-plugin-container a:focus-visible {
|
||||
box-shadow: none;
|
||||
outline: 2px solid var(--akismet-color-light-blue);
|
||||
}
|
||||
|
||||
.akismet-masthead {
|
||||
border-bottom: 1px solid var(--akismet-color-border-light);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.akismet-masthead__logo {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.akismet-section-header {
|
||||
box-shadow: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.akismet-section-header__label {
|
||||
color: var(--akismet-color-charcoal);
|
||||
font-weight: 600;
|
||||
padding-left: 0.2em;
|
||||
}
|
||||
|
||||
.akismet-button,
|
||||
.akismet-button:hover {
|
||||
border: 0;
|
||||
color: var(--akismet-color-white);
|
||||
}
|
||||
|
||||
.akismet-button {
|
||||
background-color: var(--akismet-color-mid-green);
|
||||
}
|
||||
|
||||
.akismet-button:hover {
|
||||
background-color: var(--akismet-color-dark-green);
|
||||
}
|
||||
|
||||
.akismet-external-link {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.akismet-external-link::after {
|
||||
content: "↗";
|
||||
display: inline-block;
|
||||
padding-left: 2px;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Need this specificity to override the existing header rule */
|
||||
.akismet-new-snapshot h3.akismet-new-snapshot__header {
|
||||
background: none;
|
||||
font-size: 13px;
|
||||
color: var(--akismet-color-charcoal);
|
||||
text-align: left;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__number {
|
||||
color: var(--akismet-color-charcoal);
|
||||
display: block;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
letter-spacing: -1px;
|
||||
line-height: 1.5em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot li.akismet-new-snapshot__item {
|
||||
color: var(--akismet-color-dark-grey);
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.akismet-masthead__logo-link {
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
.akismet-masthead__back-link-container {
|
||||
margin-top: 16px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
/* Need this specificity to override the existing link rule */
|
||||
#akismet-plugin-container a.akismet-masthead__back-link {
|
||||
background-image: url(img/arrow-left.svg);
|
||||
background-position: left;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 16px;
|
||||
color: var(--akismet-color-charcoal);
|
||||
font-weight: 400;
|
||||
padding-left: 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#akismet-plugin-container a.akismet-masthead__back-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__item {
|
||||
border-top: 1px solid var(--akismet-color-border-light);
|
||||
border-left: 1px solid var(--akismet-color-border-light);
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot li:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__list {
|
||||
display: flex;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__item {
|
||||
flex: 1 0 33.33%;
|
||||
margin-bottom: 0;
|
||||
padding-left: 1.5em;
|
||||
padding-right: 1.5em;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__chart {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.akismet-stats-footer {
|
||||
align-items: center;
|
||||
border-radius: 0 0 7px 7px;
|
||||
border-top: 1px solid var(--akismet-color-border-light);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
outline-offset: -2px;
|
||||
padding: 1em 1.5em;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.akismet-stats-footer:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.akismet-stats-footer:focus {
|
||||
border-radius: 0 0 7px 7px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.akismet-stats-footer:focus-visible {
|
||||
box-shadow: none;
|
||||
outline: 2px solid var(--akismet-color-light-blue);
|
||||
}
|
||||
|
||||
.akismet-box {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.akismet-box:not(:first-child) {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.akismet-box,
|
||||
.akismet-card {
|
||||
border: 1px solid var(--akismet-color-border);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.akismet-card {
|
||||
margin: 16px auto 0 auto;
|
||||
}
|
||||
|
||||
.akismet-lower {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.akismet-lower .inside {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.akismet-section-header__label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-settings__row {
|
||||
border-bottom: 1px solid var(--akismet-color-border-light);
|
||||
display: block;
|
||||
padding: 1em 1.5em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-input {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.akismet-settings__row-title {
|
||||
font-weight: 500;
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-description {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
.akismet-card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.akismet-card-actions__secondary-action {
|
||||
align-self: center;
|
||||
margin-inline-end: auto;
|
||||
margin-inline-start: 6px;
|
||||
}
|
||||
|
||||
.akismet-settings__row label {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-note {
|
||||
font-size: 0.9em;
|
||||
margin-top: 0.4em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-note abbr {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"],
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
accent-color: var(--akismet-color-mid-green);
|
||||
box-shadow: none;
|
||||
flex-shrink: 0;
|
||||
margin: 2px 0 0 0;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"] {
|
||||
margin-top: 1px;
|
||||
vertical-align: top;
|
||||
-webkit-appearance: checkbox;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
-webkit-appearance: radio;
|
||||
}
|
||||
|
||||
/* Fix up misbehaving wp-admin styles in Chrome (from forms and colors stylesheets) */
|
||||
.akismet-settings__row input[type="checkbox"]:checked:before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="radio"]:checked:before {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"]:checked:hover,
|
||||
.akismet-settings__row input[type="radio"]:checked:hover {
|
||||
accent-color: var(--akismet-color-mid-green);
|
||||
}
|
||||
|
||||
.akismet-button:disabled {
|
||||
background-color: var(--akismet-color-mid-grey);
|
||||
color: var(--akismet-color-white);
|
||||
cursor: arrow;
|
||||
}
|
||||
|
||||
.akismet-awaiting-stats,
|
||||
.akismet-account {
|
||||
padding: 0 1rem 1rem 1rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-account {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
margin-inline-start: 2px;
|
||||
margin-top: 0.25em;
|
||||
padding-bottom: 0;
|
||||
row-gap: 0.25em;
|
||||
}
|
||||
|
||||
.akismet-account__label {
|
||||
font-weight: 500;
|
||||
padding-bottom: 1em;
|
||||
padding-inline-end: 1em;
|
||||
}
|
||||
|
||||
.akismet-account__value {
|
||||
margin: 0;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-input-label {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.akismet-settings__row-label-text {
|
||||
padding-left: 0.5em;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.akismet-alert {
|
||||
border-left: 8px solid;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
padding: 0.2em 1em;
|
||||
}
|
||||
|
||||
.akismet-alert__heading {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.akismet-alert.is-good {
|
||||
background-color: var(--akismet-color-notice-light-green);
|
||||
border-left-color: var(--akismet-color-notice-dark-green);
|
||||
}
|
||||
|
||||
.akismet-alert.is-neutral {
|
||||
background-color: var(--akismet-color-white);
|
||||
border-left-color: var(--akismet-color-dark-grey);
|
||||
}
|
||||
|
||||
.akismet-alert.is-bad {
|
||||
background-color: var(--akismet-color-notice-light-red);
|
||||
border-left-color: var(--akismet-color-notice-dark-red);
|
||||
}
|
||||
|
||||
.akismet-alert.is-commercial {
|
||||
background-color: var(--akismet-color-white);
|
||||
border-color: var(--akismet-color-mid-grey);
|
||||
border-bottom-width: 1px;
|
||||
border-left-color: var(--akismet-color-notice-yellow);
|
||||
display: flex;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
#akismet-plugin-container .akismet-alert.is-good a,
|
||||
#akismet-plugin-container .akismet-alert.is-bad a {
|
||||
/* For better contrast - green isn't great */
|
||||
color: var(--akismet-color-grey-80);
|
||||
}
|
||||
|
||||
.akismet-alert-header {
|
||||
font-size: 16px;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.akismet-alert-button-wrapper {
|
||||
align-self: center;
|
||||
margin-left: 2em;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.akismet-alert-info {
|
||||
text-wrap: pretty;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
/* Setup */
|
||||
.akismet-setup-instructions__heading {
|
||||
font-size: 1.375rem;
|
||||
font-weight: 700;
|
||||
padding-block-end: 0;
|
||||
}
|
||||
|
||||
h3.akismet-setup-instructions__subheading {
|
||||
color: var(--akismet-color-dark-grey);
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
margin: 0 0 1.25rem;
|
||||
padding-block-start: 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__feature-list {
|
||||
list-style: none;
|
||||
margin: 1rem 0.5rem 1.5rem;
|
||||
max-width: 640px;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__feature {
|
||||
align-items: start;
|
||||
display: flex;
|
||||
margin-block-end: 1rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__icon {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__body {
|
||||
flex: 1;
|
||||
padding-inline-start: 0.5rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__title {
|
||||
color: #1d2327;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
p.akismet-setup-instructions__text {
|
||||
color: var(--akismet-color-grey-80);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
margin: 0.25rem 0 0;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__button,
|
||||
.akismet-setup-instructions__button:hover,
|
||||
.akismet-setup-instructions__button:visited {
|
||||
font-size: 1rem;
|
||||
margin-inline-start: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-setup__connection {
|
||||
background: var(--akismet-color-light-grey);
|
||||
border: 1px solid var(--akismet-color-grey-border);
|
||||
border-radius: 8px;
|
||||
margin: 1rem 1rem 2rem 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-action:not(:last-child) {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-user {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-avatar {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-avatar-image {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-account-name {
|
||||
color: var(--akismet-color-charcoal);
|
||||
font-size: 0.9rem;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-account-email {
|
||||
margin-top: 0.1rem;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-action {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-button {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
p.akismet-setup__connection-action-intro,
|
||||
p.akismet-setup__connection-action-description {
|
||||
color: var(--akismet-color-dark-grey);
|
||||
font-size: 0.875rem;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
p.akismet-setup__connection-action-intro {
|
||||
margin: 0 0 1rem 0;
|
||||
}
|
||||
|
||||
p.akismet-setup__connection-action-description {
|
||||
margin: 1rem 0 0;
|
||||
}
|
||||
|
||||
/* API key field with copy button */
|
||||
.akismet-api-key-wrapper {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-api-key-wrapper input {
|
||||
padding-right: 36px;
|
||||
}
|
||||
|
||||
.akismet-api-key-copy {
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
color: var(--akismet-color-icon);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-api-key-copy:hover {
|
||||
color: var(--akismet-color-icon-hover);
|
||||
}
|
||||
|
||||
/* Setup - API key input */
|
||||
.akismet-enter-api-key-box {
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__reveal {
|
||||
background: none;
|
||||
border: 0;
|
||||
color: var(--akismet-color-mid-green);
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__form-wrapper {
|
||||
display: none;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__input-wrapper {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
padding: 0 1.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__key-input {
|
||||
flex-grow: 1;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
h3.akismet-enter-api-key-box__header {
|
||||
padding-top: 0;
|
||||
padding-bottom: 1em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Notices > Activation (shown on edit-comments.php) */
|
||||
#akismet-setup-prompt {
|
||||
background: none;
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.akismet-activate {
|
||||
align-items: center;
|
||||
/* background-image is defined via an inline style in class.akismet-admin.php */
|
||||
background-color: var(--akismet-color-light-grey);
|
||||
background-position: calc(100% - 1em) center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 140px;
|
||||
border: 1px solid var(--akismet-color-mid-green);
|
||||
border-left-width: 4px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 15px 0;
|
||||
min-height: 60px;
|
||||
overflow: hidden;
|
||||
padding: 5px 160px 5px 5px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.akismet-activate__button,
|
||||
.akismet-activate__button:hover,
|
||||
.akismet-activate__button:visited {
|
||||
margin: 0 1em;
|
||||
}
|
||||
|
||||
.akismet-activate__description {
|
||||
color: var(--akismet-color-charcoal);
|
||||
flex-grow: 1;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
/* Compatible plugins section */
|
||||
.akismet-compatible-plugins__content {
|
||||
padding: 0 1.5em 1.5em 1.5em;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__intro {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__section-header-label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__section-header-label-text {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__list {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
margin: 1.5em 0 1em 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card {
|
||||
border: 1px solid var(--akismet-color-border-light);
|
||||
border-radius: 4px;
|
||||
padding: 1em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card-logo {
|
||||
padding: 0 1.5em 0 0;
|
||||
object-fit: contain;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card-detail {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card-title {
|
||||
font-size: 1.2em;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__docs {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__show-more {
|
||||
all: unset;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Generates the show/hide chevron */
|
||||
.akismet-compatible-plugins__show-more::after {
|
||||
align-self: center;
|
||||
border-bottom: 2px solid black;
|
||||
border-right: 2px solid black;
|
||||
content: "";
|
||||
height: 8px;
|
||||
transform: rotate(45deg);
|
||||
transition: transform 0.2s ease;
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__list.is-expanded + .akismet-compatible-plugins__show-more::after {
|
||||
align-self: end;
|
||||
transform: rotate(225deg);
|
||||
}
|
||||
|
||||
/* Gutenberg medium breakpoint */
|
||||
@media screen and (max-width: 782px) {
|
||||
.akismet-new-snapshot__list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__number {
|
||||
float: right;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-top: -16px;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__header {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"],
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.akismet-settings__row-label-text {
|
||||
padding-left: 0.8em;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"],
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.akismet-activate {
|
||||
background-size: 120px;
|
||||
padding-right: 134px;
|
||||
}
|
||||
|
||||
.akismet-activate__button {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.akismet-activate__description {
|
||||
font-size: 14px;
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
/* Gutenberg small breakpoint */
|
||||
@media screen and (max-width: 600px) {
|
||||
.akismet-compatible-plugins__list {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.akismet-activate__button,
|
||||
.akismet-activate__button:hover {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.akismet-activate__description {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
69
plugins/akismet/_inc/akismet-admin.js
Normal file
69
plugins/akismet/_inc/akismet-admin.js
Normal file
@@ -0,0 +1,69 @@
|
||||
document.addEventListener( 'DOMContentLoaded', function() {
|
||||
// Prevent aggressive iframe caching in Firefox
|
||||
var statsIframe = document.getElementById( 'stats-iframe' );
|
||||
if ( statsIframe ) {
|
||||
statsIframe.contentWindow.location.href = statsIframe.src;
|
||||
}
|
||||
|
||||
initCompatiblePluginsShowMoreToggle();
|
||||
initApiKeyCopyButton();
|
||||
} );
|
||||
|
||||
function initApiKeyCopyButton() {
|
||||
const button = document.querySelector( '.akismet-api-key-copy' );
|
||||
if ( ! button ) {
|
||||
return;
|
||||
}
|
||||
|
||||
button.addEventListener( 'click', function() {
|
||||
const input = document.getElementById( 'key' );
|
||||
if ( ! input || ! input.value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( navigator.clipboard && navigator.clipboard.writeText ) {
|
||||
navigator.clipboard.writeText( input.value ).then( function() {
|
||||
const svg = button.querySelector( 'svg' );
|
||||
const original = svg.innerHTML;
|
||||
svg.innerHTML = '<polyline points="20 6 9 17 4 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>';
|
||||
setTimeout( function() {
|
||||
svg.innerHTML = original;
|
||||
}, 2000 );
|
||||
} ).catch( function() {
|
||||
input.select();
|
||||
document.execCommand( 'copy' );
|
||||
} );
|
||||
} else {
|
||||
input.select();
|
||||
document.execCommand( 'copy' );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function initCompatiblePluginsShowMoreToggle() {
|
||||
const section = document.querySelector( '.akismet-compatible-plugins' );
|
||||
const list = document.querySelector( '.akismet-compatible-plugins__list' );
|
||||
const button = document.querySelector( '.akismet-compatible-plugins__show-more' );
|
||||
|
||||
if ( ! section || ! list || ! button ) {
|
||||
return;
|
||||
}
|
||||
|
||||
function isElementInViewport( element ) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return rect.top >= 0 && rect.bottom <= window.innerHeight;
|
||||
}
|
||||
|
||||
function toggleCards() {
|
||||
list.classList.toggle( 'is-expanded' );
|
||||
const isExpanded = list.classList.contains( 'is-expanded' );
|
||||
button.textContent = isExpanded ? button.dataset.labelOpen : button.dataset.labelClosed;
|
||||
button.setAttribute( 'aria-expanded', isExpanded.toString() );
|
||||
|
||||
if ( ! isExpanded && ! isElementInViewport( section ) ) {
|
||||
section.scrollIntoView( { block: 'start' } );
|
||||
}
|
||||
}
|
||||
|
||||
button.addEventListener( 'click', toggleCards );
|
||||
}
|
||||
393
plugins/akismet/_inc/akismet-frontend.js
Normal file
393
plugins/akismet/_inc/akismet-frontend.js
Normal file
@@ -0,0 +1,393 @@
|
||||
/**
|
||||
* Observe how the user enters content into the comment form in order to determine whether it's a bot or not.
|
||||
*
|
||||
* Note that no actual input is being saved here, only counts and timings between events.
|
||||
*/
|
||||
|
||||
( function() {
|
||||
// Passive event listeners are guaranteed to never call e.preventDefault(),
|
||||
// but they're not supported in all browsers. Use this feature detection
|
||||
// to determine whether they're available for use.
|
||||
var supportsPassive = false;
|
||||
|
||||
try {
|
||||
var opts = Object.defineProperty( {}, 'passive', {
|
||||
get : function() {
|
||||
supportsPassive = true;
|
||||
}
|
||||
} );
|
||||
|
||||
window.addEventListener( 'testPassive', null, opts );
|
||||
window.removeEventListener( 'testPassive', null, opts );
|
||||
} catch ( e ) {}
|
||||
|
||||
function init() {
|
||||
var input_begin = '';
|
||||
|
||||
var keydowns = {};
|
||||
var lastKeyup = null;
|
||||
var lastKeydown = null;
|
||||
var keypresses = [];
|
||||
|
||||
var modifierKeys = [];
|
||||
var correctionKeys = [];
|
||||
|
||||
var lastMouseup = null;
|
||||
var lastMousedown = null;
|
||||
var mouseclicks = [];
|
||||
var mouseclickCoordinates = [];
|
||||
|
||||
var mousemoveTimer = null;
|
||||
var lastMousemoveX = null;
|
||||
var lastMousemoveY = null;
|
||||
var mousemoveStart = null;
|
||||
var mousemoves = [];
|
||||
|
||||
var touchmoveCountTimer = null;
|
||||
var touchmoveCount = 0;
|
||||
|
||||
var lastTouchEnd = null;
|
||||
var lastTouchStart = null;
|
||||
var touchEvents = [];
|
||||
|
||||
var scrollCountTimer = null;
|
||||
var scrollCount = 0;
|
||||
|
||||
var correctionKeyCodes = [ 'Backspace', 'Delete', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown' ];
|
||||
var modifierKeyCodes = [ 'Shift', 'CapsLock' ];
|
||||
|
||||
var forms = document.querySelectorAll( 'form[method=post]' );
|
||||
|
||||
for ( var i = 0; i < forms.length; i++ ) {
|
||||
var form = forms[i];
|
||||
|
||||
var formAction = form.getAttribute( 'action' );
|
||||
|
||||
// Ignore forms that POST directly to other domains; these could be things like payment forms.
|
||||
if ( formAction ) {
|
||||
// Check that the form is posting to an external URL, not a path.
|
||||
if ( formAction.indexOf( 'http://' ) == 0 || formAction.indexOf( 'https://' ) == 0 ) {
|
||||
if ( formAction.indexOf( 'http://' + window.location.hostname + '/' ) != 0 && formAction.indexOf( 'https://' + window.location.hostname + '/' ) != 0 ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
form.addEventListener( 'submit', function () {
|
||||
var ak_bkp = prepare_array_for_request( keypresses );
|
||||
var ak_bmc = prepare_array_for_request( mouseclicks );
|
||||
var ak_bte = prepare_array_for_request( touchEvents );
|
||||
var ak_bmm = prepare_array_for_request( mousemoves );
|
||||
var ak_bcc = prepare_array_for_request( mouseclickCoordinates );
|
||||
|
||||
var input_fields = {
|
||||
// When did the user begin entering any input?
|
||||
'bib': input_begin,
|
||||
|
||||
// When was the form submitted?
|
||||
'bfs': Date.now(),
|
||||
|
||||
// How many keypresses did they make?
|
||||
'bkpc': keypresses.length,
|
||||
|
||||
// How quickly did they press a sample of keys, and how long between them?
|
||||
'bkp': ak_bkp,
|
||||
|
||||
// How quickly did they click the mouse, and how long between clicks?
|
||||
'bmc': ak_bmc,
|
||||
|
||||
// How many mouseclicks did they make?
|
||||
'bmcc': mouseclicks.length,
|
||||
|
||||
// When did they press modifier keys (like Shift or Capslock)?
|
||||
'bmk': modifierKeys.join( ';' ),
|
||||
|
||||
// When did they correct themselves? e.g., press Backspace, or use the arrow keys to move the cursor back
|
||||
'bck': correctionKeys.join( ';' ),
|
||||
|
||||
// How many times did they move the mouse?
|
||||
'bmmc': mousemoves.length,
|
||||
|
||||
// How many times did they move around using a touchscreen?
|
||||
'btmc': touchmoveCount,
|
||||
|
||||
// How many times did they scroll?
|
||||
'bsc': scrollCount,
|
||||
|
||||
// How quickly did they perform touch events, and how long between them?
|
||||
'bte': ak_bte,
|
||||
|
||||
// How many touch events were there?
|
||||
'btec' : touchEvents.length,
|
||||
|
||||
// How quickly did they move the mouse, and how long between moves?
|
||||
'bmm' : ak_bmm,
|
||||
|
||||
// Click coordinates
|
||||
'bcc' : ak_bcc
|
||||
};
|
||||
|
||||
var akismet_field_prefix = 'ak_';
|
||||
|
||||
if ( this.getElementsByClassName ) {
|
||||
// Check to see if we've used an alternate field name prefix. We store this as an attribute of the container around some of the Akismet fields.
|
||||
var possible_akismet_containers = this.getElementsByClassName( 'akismet-fields-container' );
|
||||
|
||||
for ( var containerIndex = 0; containerIndex < possible_akismet_containers.length; containerIndex++ ) {
|
||||
var container = possible_akismet_containers.item( containerIndex );
|
||||
|
||||
if ( container.getAttribute( 'data-prefix' ) ) {
|
||||
akismet_field_prefix = container.getAttribute( 'data-prefix' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( var field_name in input_fields ) {
|
||||
var field = document.createElement( 'input' );
|
||||
field.setAttribute( 'type', 'hidden' );
|
||||
field.setAttribute( 'name', akismet_field_prefix + field_name );
|
||||
field.setAttribute( 'value', input_fields[ field_name ] );
|
||||
this.appendChild( field );
|
||||
}
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
form.addEventListener( 'keydown', function ( e ) {
|
||||
// If you hold a key down, some browsers send multiple keydown events in a row.
|
||||
// Ignore any keydown events for a key that hasn't come back up yet.
|
||||
if ( e.key in keydowns ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var keydownTime = ( new Date() ).getTime();
|
||||
keydowns[ e.key ] = [ keydownTime ];
|
||||
|
||||
if ( ! input_begin ) {
|
||||
input_begin = keydownTime;
|
||||
}
|
||||
|
||||
// In some situations, we don't want to record an interval since the last keypress -- for example,
|
||||
// on the first keypress, or on a keypress after focus has changed to another element. Normally,
|
||||
// we want to record the time between the last keyup and this keydown. But if they press a
|
||||
// key while already pressing a key, we want to record the time between the two keydowns.
|
||||
|
||||
var lastKeyEvent = Math.max( lastKeydown, lastKeyup );
|
||||
|
||||
if ( lastKeyEvent ) {
|
||||
keydowns[ e.key ].push( keydownTime - lastKeyEvent );
|
||||
}
|
||||
|
||||
lastKeydown = keydownTime;
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
form.addEventListener( 'keyup', function ( e ) {
|
||||
if ( ! ( e.key in keydowns ) ) {
|
||||
// This key was pressed before this script was loaded, or a mouseclick happened during the keypress, or...
|
||||
return;
|
||||
}
|
||||
|
||||
var keyupTime = ( new Date() ).getTime();
|
||||
|
||||
if ( 'TEXTAREA' === e.target.nodeName || 'INPUT' === e.target.nodeName ) {
|
||||
if ( -1 !== modifierKeyCodes.indexOf( e.key ) ) {
|
||||
modifierKeys.push( keypresses.length - 1 );
|
||||
} else if ( -1 !== correctionKeyCodes.indexOf( e.key ) ) {
|
||||
correctionKeys.push( keypresses.length - 1 );
|
||||
} else {
|
||||
// ^ Don't record timings for keys like Shift or backspace, since they
|
||||
// typically get held down for longer than regular typing.
|
||||
|
||||
var keydownTime = keydowns[ e.key ][0];
|
||||
|
||||
var keypress = [];
|
||||
|
||||
// Keypress duration.
|
||||
keypress.push( keyupTime - keydownTime );
|
||||
|
||||
// Amount of time between this keypress and the previous keypress.
|
||||
if ( keydowns[ e.key ].length > 1 ) {
|
||||
keypress.push( keydowns[ e.key ][1] );
|
||||
}
|
||||
|
||||
keypresses.push( keypress );
|
||||
}
|
||||
}
|
||||
|
||||
delete keydowns[ e.key ];
|
||||
|
||||
lastKeyup = keyupTime;
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
form.addEventListener( "focusin", function ( e ) {
|
||||
lastKeydown = null;
|
||||
lastKeyup = null;
|
||||
keydowns = {};
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
form.addEventListener( "focusout", function ( e ) {
|
||||
lastKeydown = null;
|
||||
lastKeyup = null;
|
||||
keydowns = {};
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
}
|
||||
|
||||
document.addEventListener( 'mousedown', function ( e ) {
|
||||
lastMousedown = ( new Date() ).getTime();
|
||||
|
||||
var mouseclickCoordinate = [];
|
||||
|
||||
var rect = e.target.getBoundingClientRect();
|
||||
var relativeX = e.clientX - rect.left;
|
||||
var relativeY = e.clientY - rect.top;
|
||||
|
||||
// Pixel offset of the click within the target element.
|
||||
mouseclickCoordinate.push( Math.round( relativeX ) );
|
||||
mouseclickCoordinate.push( Math.round( relativeY ) );
|
||||
|
||||
// Percentage offset of the click within the target element.
|
||||
mouseclickCoordinate.push( rect.width > 0 ? Math.round( relativeX / rect.width * 100 ) : 0 );
|
||||
mouseclickCoordinate.push( rect.height > 0 ? Math.round( relativeY / rect.height * 100 ) : 0 );
|
||||
|
||||
mouseclickCoordinates.push( mouseclickCoordinate );
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
document.addEventListener( 'mouseup', function ( e ) {
|
||||
if ( ! lastMousedown ) {
|
||||
// If the mousedown happened before this script was loaded, but the mouseup happened after...
|
||||
return;
|
||||
}
|
||||
|
||||
var now = ( new Date() ).getTime();
|
||||
|
||||
var mouseclick = [];
|
||||
mouseclick.push( now - lastMousedown );
|
||||
|
||||
if ( lastMouseup ) {
|
||||
mouseclick.push( lastMousedown - lastMouseup );
|
||||
}
|
||||
|
||||
mouseclicks.push( mouseclick );
|
||||
|
||||
lastMouseup = now;
|
||||
|
||||
// If the mouse has been clicked, don't record this time as an interval between keypresses.
|
||||
lastKeydown = null;
|
||||
lastKeyup = null;
|
||||
keydowns = {};
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
document.addEventListener( 'mousemove', function ( e ) {
|
||||
if ( mousemoveTimer ) {
|
||||
clearTimeout( mousemoveTimer );
|
||||
mousemoveTimer = null;
|
||||
}
|
||||
else {
|
||||
mousemoveStart = ( new Date() ).getTime();
|
||||
lastMousemoveX = e.offsetX;
|
||||
lastMousemoveY = e.offsetY;
|
||||
}
|
||||
|
||||
mousemoveTimer = setTimeout( function ( theEvent, originalMousemoveStart ) {
|
||||
var now = ( new Date() ).getTime() - 500; // To account for the timer delay.
|
||||
|
||||
var mousemove = [];
|
||||
mousemove.push( now - originalMousemoveStart );
|
||||
mousemove.push(
|
||||
Math.round(
|
||||
Math.sqrt(
|
||||
Math.pow( theEvent.offsetX - lastMousemoveX, 2 ) +
|
||||
Math.pow( theEvent.offsetY - lastMousemoveY, 2 )
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ( mousemove[1] > 0 ) {
|
||||
// If there was no measurable distance, then it wasn't really a move.
|
||||
mousemoves.push( mousemove );
|
||||
}
|
||||
|
||||
mousemoveStart = null;
|
||||
mousemoveTimer = null;
|
||||
}, 500, e, mousemoveStart );
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
document.addEventListener( 'touchmove', function ( e ) {
|
||||
if ( touchmoveCountTimer ) {
|
||||
clearTimeout( touchmoveCountTimer );
|
||||
}
|
||||
|
||||
touchmoveCountTimer = setTimeout( function () {
|
||||
touchmoveCount++;
|
||||
}, 500 );
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
document.addEventListener( 'touchstart', function ( e ) {
|
||||
lastTouchStart = ( new Date() ).getTime();
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
document.addEventListener( 'touchend', function ( e ) {
|
||||
if ( ! lastTouchStart ) {
|
||||
// If the touchstart happened before this script was loaded, but the touchend happened after...
|
||||
return;
|
||||
}
|
||||
|
||||
var now = ( new Date() ).getTime();
|
||||
|
||||
var touchEvent = [];
|
||||
touchEvent.push( now - lastTouchStart );
|
||||
|
||||
if ( lastTouchEnd ) {
|
||||
touchEvent.push( lastTouchStart - lastTouchEnd );
|
||||
}
|
||||
|
||||
touchEvents.push( touchEvent );
|
||||
|
||||
lastTouchEnd = now;
|
||||
|
||||
// Don't record this time as an interval between keypresses.
|
||||
lastKeydown = null;
|
||||
lastKeyup = null;
|
||||
keydowns = {};
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
|
||||
document.addEventListener( 'scroll', function ( e ) {
|
||||
if ( scrollCountTimer ) {
|
||||
clearTimeout( scrollCountTimer );
|
||||
}
|
||||
|
||||
scrollCountTimer = setTimeout( function () {
|
||||
scrollCount++;
|
||||
}, 500 );
|
||||
}, supportsPassive ? { passive: true } : false );
|
||||
}
|
||||
|
||||
/**
|
||||
* For the timing/coordinate data that is collected, don't send more than `limit` data points in the request.
|
||||
* Choose a random slice and send those, with each batch separated by semicolons and the items in each batch
|
||||
* separated by commas.
|
||||
*/
|
||||
function prepare_array_for_request( a, limit ) {
|
||||
if ( ! limit ) {
|
||||
limit = 100;
|
||||
}
|
||||
|
||||
var rv = '';
|
||||
|
||||
if ( a.length > 0 ) {
|
||||
var random_starting_point = Math.max( 0, Math.floor( Math.random() * a.length - limit ) );
|
||||
|
||||
for ( var i = 0; i < limit && i < a.length; i++ ) {
|
||||
var entry = a[ random_starting_point + i ];
|
||||
rv += entry.join( ',' ) + ';';
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
if ( document.readyState !== 'loading' ) {
|
||||
init();
|
||||
} else {
|
||||
document.addEventListener( 'DOMContentLoaded', init );
|
||||
}
|
||||
})();
|
||||
462
plugins/akismet/_inc/akismet.css
Normal file
462
plugins/akismet/_inc/akismet.css
Normal file
@@ -0,0 +1,462 @@
|
||||
.wp-admin.jetpack_page_akismet-key-config, .wp-admin.settings_page_akismet-key-config {
|
||||
background-color:#f3f6f8;
|
||||
}
|
||||
|
||||
#submitted-on {
|
||||
position: relative;
|
||||
}
|
||||
#the-comment-list .author .akismet-user-comment-count {
|
||||
display: inline;
|
||||
}
|
||||
#the-comment-list .author a span {
|
||||
text-decoration: none;
|
||||
color: #999;
|
||||
}
|
||||
#the-comment-list .author a span.akismet-span-link {
|
||||
text-decoration: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
#the-comment-list .akismet_remove_url {
|
||||
margin-left: 3px;
|
||||
color: #999;
|
||||
padding: 2px 3px 2px 0;
|
||||
}
|
||||
#the-comment-list .akismet_remove_url:hover {
|
||||
color: #A7301F;
|
||||
font-weight: bold;
|
||||
padding: 2px 2px 2px 0;
|
||||
}
|
||||
#dashboard_recent_comments .akismet-status {
|
||||
display: none;
|
||||
}
|
||||
.akismet-status {
|
||||
float: right;
|
||||
}
|
||||
.akismet-status a {
|
||||
color: #AAA;
|
||||
font-style: italic;
|
||||
}
|
||||
table.comments td.comment p a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
table.comments td.comment p a:after {
|
||||
content: attr(href);
|
||||
color: #aaa;
|
||||
display: inline-block; /* Show the URL without the link's underline extending under it. */
|
||||
padding: 0 1ex; /* Because it's inline block, we can't just use spaces in the content: attribute to separate it from the link text. */
|
||||
}
|
||||
.mshot-arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 10px solid transparent;
|
||||
border-bottom: 10px solid transparent;
|
||||
border-right: 10px solid #5C5C5C;
|
||||
position: absolute;
|
||||
left: -6px;
|
||||
top: 91px;
|
||||
}
|
||||
.mshot-container {
|
||||
background: #5C5C5C;
|
||||
position: absolute;
|
||||
top: -94px;
|
||||
padding: 7px;
|
||||
width: 450px;
|
||||
height: 338px;
|
||||
z-index: 20000;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.akismet-mshot {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
}
|
||||
.akismet-mshot .mshot-image {
|
||||
margin: 0;
|
||||
height: 338px;
|
||||
width: 450px;
|
||||
}
|
||||
.checkforspam {
|
||||
display: inline-block !important;
|
||||
}
|
||||
|
||||
.checkforspam-spinner {
|
||||
display: inline-block;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.akismet-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.akismet-card .akismet-right {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot {
|
||||
margin-top: 1em;
|
||||
text-align: center;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot h3 {
|
||||
background: #f5f5f5;
|
||||
color: #888;
|
||||
font-size: 11px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot ul li {
|
||||
color: #999;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
.akismet-settings th:first-child {
|
||||
vertical-align: top;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.akismet-settings th.akismet-api-key {
|
||||
vertical-align: middle;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.akismet-settings span.akismet-note {
|
||||
float: left;
|
||||
padding-left: 23px;
|
||||
font-size: 75%;
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.jetpack_page_akismet-key-config #wpcontent, .settings_page_akismet-key-config #wpcontent {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.akismet-masthead {
|
||||
background-color:#fff;
|
||||
text-align:center;
|
||||
box-shadow:0 1px 0 rgba(200,215,225,0.5),0 1px 2px #e9eff3
|
||||
}
|
||||
|
||||
@media (max-width: 45rem) {
|
||||
.akismet-masthead {
|
||||
padding:0 1.25rem
|
||||
}
|
||||
}
|
||||
|
||||
.akismet-masthead__inside-container {
|
||||
padding:.375rem 0;
|
||||
margin:0 auto;
|
||||
width:100%;
|
||||
max-width:45rem;
|
||||
text-align: left;
|
||||
}
|
||||
.akismet-masthead__logo-container {
|
||||
padding:.3125rem 0 0
|
||||
}
|
||||
.akismet-masthead__logo-link {
|
||||
display:inline-block;
|
||||
outline:none;
|
||||
vertical-align:middle
|
||||
}
|
||||
.akismet-masthead__logo-link:focus {
|
||||
line-height:0;
|
||||
box-shadow:0 0 0 2px #78dcfa
|
||||
}
|
||||
.akismet-masthead__logo-link+code {
|
||||
margin:0 10px;
|
||||
padding:5px 9px;
|
||||
border-radius:2px;
|
||||
background:#e6ecf1;
|
||||
color:#647a88
|
||||
}
|
||||
.akismet-masthead__links {
|
||||
display:flex;
|
||||
flex-flow:row wrap;
|
||||
flex:2 50%;
|
||||
justify-content:flex-end;
|
||||
margin:0
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.akismet-masthead__links {
|
||||
padding-right:.625rem
|
||||
}
|
||||
}
|
||||
.akismet-masthead__link-li {
|
||||
margin:0;
|
||||
padding:0
|
||||
}
|
||||
.akismet-masthead__link {
|
||||
font-style:normal;
|
||||
color:#0087be;
|
||||
padding:.625rem;
|
||||
display:inline-block
|
||||
}
|
||||
.akismet-masthead__link:visited {
|
||||
color:#0087be
|
||||
}
|
||||
.akismet-masthead__link:active,.akismet-masthead__link:hover {
|
||||
color:#00aadc
|
||||
}
|
||||
.akismet-masthead__link:hover {
|
||||
text-decoration:underline
|
||||
}
|
||||
.akismet-masthead__link .dashicons {
|
||||
display:none
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.akismet-masthead__link:hover,.akismet-masthead__link:active {
|
||||
text-decoration:none
|
||||
}
|
||||
.akismet-masthead__link .dashicons {
|
||||
display:block;
|
||||
font-size:1.75rem
|
||||
}
|
||||
.akismet-masthead__link span+span {
|
||||
display:none
|
||||
}
|
||||
}
|
||||
.akismet-masthead__link-li:last-of-type .akismet-masthead__link {
|
||||
padding-right:0
|
||||
}
|
||||
|
||||
.akismet-lower {
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
max-width: 45rem;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-lower .notice {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.akismet-card {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.akismet-card:after, .akismet-card .inside:after, .akismet-masthead__logo-container:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.akismet-card .inside {
|
||||
padding: 1.5rem;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.akismet-card .akismet-card-actions {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.jetpack_page_akismet-key-config .update-nag, .settings_page_akismet-key-config .update-nag {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.akismet-masthead .akismet-right {
|
||||
line-height: 2.125rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.akismet-box {
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
border: 1px solid rgba(200, 215, 225, 0.5);
|
||||
}
|
||||
|
||||
.akismet-box h2, .akismet-box h3 {
|
||||
padding: 1.5rem 1.5rem .5rem 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-box p {
|
||||
padding: 0 1.5rem 1.5rem 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-box p:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.akismet-box .akismet-right {
|
||||
padding-right: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box {
|
||||
margin-bottom: 0;
|
||||
padding: 0;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box:last-child {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box:first-child {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-box .centered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.akismet-button, .akismet-button:hover, .akismet-button:visited {
|
||||
background: white;
|
||||
border-color: #c8d7e1;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 2px;
|
||||
color: #2e4453;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
outline: 0;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-overflow: ellipsis;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
line-height: 21px;
|
||||
border-radius: 4px;
|
||||
padding: 7px 14px 9px;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.akismet-button:hover {
|
||||
border-color: #a8bece;
|
||||
}
|
||||
|
||||
.akismet-button:active {
|
||||
border-width: 2px 1px 1px;
|
||||
}
|
||||
|
||||
.akismet-is-primary, .akismet-is-primary:hover, .akismet-is-primary:visited {
|
||||
background: #00aadc;
|
||||
border-color: #0087be;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.akismet-is-primary:hover, .akismet-is-primary:focus {
|
||||
border-color: #005082;
|
||||
}
|
||||
|
||||
.akismet-is-primary:hover {
|
||||
border-color: #005082;
|
||||
}
|
||||
|
||||
.akismet-section-header {
|
||||
position: relative;
|
||||
margin: 0 auto 0.625rem auto;
|
||||
padding: 1rem;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
padding-top: 0.6875rem;
|
||||
padding-bottom: 0.6875rem;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.akismet-section-header__label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
line-height: 1.75rem;
|
||||
position: relative;
|
||||
font-size: 0.875rem;
|
||||
color: #4f748e;
|
||||
}
|
||||
|
||||
.akismet-section-header__actions {
|
||||
line-height: 1.75rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions form {
|
||||
padding-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions > a.akismet-button {
|
||||
display: inline-block;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
div.error.akismet-usage-limit-alert {
|
||||
padding: 25px 45px 25px 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#akismet-plugin-container .akismet-usage-limit-alert {
|
||||
margin: 0 auto 0.625rem auto;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
|
||||
border: none;
|
||||
border-left: 4px solid #d63638;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-logo {
|
||||
width: 38px;
|
||||
min-width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 20px;
|
||||
margin-right: 18px;
|
||||
background: black;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-logo img {
|
||||
position: absolute;
|
||||
width: 22px;
|
||||
left: 8px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-text {
|
||||
flex-grow: 1;
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert h3 {
|
||||
line-height: 1.3;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-cta {
|
||||
border-color: none;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#akismet-plugin-container .akismet-usage-limit-cta a {
|
||||
color: #d63638;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
@media (max-width: 550px) {
|
||||
div.error.akismet-usage-limit-alert {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-logo,
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-text {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-cta {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
397
plugins/akismet/_inc/akismet.js
Normal file
397
plugins/akismet/_inc/akismet.js
Normal file
@@ -0,0 +1,397 @@
|
||||
jQuery( function ( $ ) {
|
||||
var mshotRemovalTimer = null;
|
||||
var mshotRetryTimer = null;
|
||||
var mshotTries = 0;
|
||||
var mshotRetryInterval = 1000;
|
||||
var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a';
|
||||
|
||||
var preloadedMshotURLs = [];
|
||||
|
||||
$('.akismet-status').each(function () {
|
||||
var thisId = $(this).attr('commentid');
|
||||
$(this).prependTo('#comment-' + thisId + ' .column-comment');
|
||||
});
|
||||
$('.akismet-user-comment-count').each(function () {
|
||||
var thisId = $(this).attr('commentid');
|
||||
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
|
||||
});
|
||||
|
||||
akismet_enable_comment_author_url_removal();
|
||||
|
||||
$( '#the-comment-list' ).on( 'click', '.akismet_remove_url', function () {
|
||||
var thisId = $(this).attr('commentid');
|
||||
var data = {
|
||||
action: 'comment_author_deurl',
|
||||
_wpnonce: WPAkismet.comment_author_url_nonce,
|
||||
id: thisId
|
||||
};
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
beforeSend: function () {
|
||||
// Removes "x" link
|
||||
$("a[commentid='"+ thisId +"']").hide();
|
||||
// Show temp status
|
||||
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) );
|
||||
},
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
// Show status/undo link
|
||||
$("#author_comment_url_"+ thisId)
|
||||
.attr('cid', thisId)
|
||||
.addClass('akismet_undo_link_removal')
|
||||
.html(
|
||||
$( '<span/>' ).text( WPAkismet.strings['URL removed'] )
|
||||
)
|
||||
.append( ' ' )
|
||||
.append(
|
||||
$( '<span/>' )
|
||||
.text( WPAkismet.strings['(undo)'] )
|
||||
.addClass( 'akismet-span-link' )
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}).on( 'click', '.akismet_undo_link_removal', function () {
|
||||
var thisId = $(this).attr('cid');
|
||||
var thisUrl = $(this).attr('href');
|
||||
var data = {
|
||||
action: 'comment_author_reurl',
|
||||
_wpnonce: WPAkismet.comment_author_url_nonce,
|
||||
id: thisId,
|
||||
url: thisUrl
|
||||
};
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
beforeSend: function () {
|
||||
// Show temp status
|
||||
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) );
|
||||
},
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
// Add "x" link
|
||||
$("a[commentid='"+ thisId +"']").show();
|
||||
// Show link. Core strips leading http://, so let's do that too.
|
||||
$("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments.
|
||||
if ( "enable_mshots" in WPAkismet && WPAkismet.enable_mshots ) {
|
||||
$( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () {
|
||||
clearTimeout( mshotRemovalTimer );
|
||||
|
||||
if ( $( '.akismet-mshot' ).length > 0 ) {
|
||||
if ( $( '.akismet-mshot:first' ).data( 'link' ) == this ) {
|
||||
// The preview is already showing for this link.
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// A new link is being hovered, so remove the old preview.
|
||||
$( '.akismet-mshot' ).remove();
|
||||
}
|
||||
}
|
||||
|
||||
clearTimeout( mshotRetryTimer );
|
||||
|
||||
var linkUrl = $( this ).attr( 'href' );
|
||||
|
||||
if ( preloadedMshotURLs.indexOf( linkUrl ) !== -1 ) {
|
||||
// This preview image was already preloaded, so begin with a retry URL so the user doesn't see the placeholder image for the first second.
|
||||
mshotTries = 2;
|
||||
}
|
||||
else {
|
||||
mshotTries = 1;
|
||||
}
|
||||
|
||||
var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="' + akismet_mshot_url( linkUrl, mshotTries ) + '" width="450" height="338" class="mshot-image" /></div>' );
|
||||
mShot.data( 'link', this );
|
||||
mShot.data( 'url', linkUrl );
|
||||
|
||||
mShot.find( 'img' ).on( 'load', function () {
|
||||
$( '.akismet-mshot' ).data( 'pending-request', false );
|
||||
} );
|
||||
|
||||
var offset = $( this ).offset();
|
||||
|
||||
mShot.offset( {
|
||||
left : Math.min( $( window ).width() - 475, offset.left + $( this ).width() + 10 ), // Keep it on the screen if the link is near the edge of the window.
|
||||
top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness
|
||||
} );
|
||||
|
||||
$( 'body' ).append( mShot );
|
||||
|
||||
mshotRetryTimer = setTimeout( retryMshotUntilLoaded, mshotRetryInterval );
|
||||
} ).on( 'mouseout', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () {
|
||||
mshotRemovalTimer = setTimeout( function () {
|
||||
clearTimeout( mshotRetryTimer );
|
||||
|
||||
$( '.akismet-mshot' ).remove();
|
||||
}, 200 );
|
||||
} );
|
||||
|
||||
var preloadDelayTimer = null;
|
||||
|
||||
$( window ).on( 'scroll resize', function () {
|
||||
clearTimeout( preloadDelayTimer );
|
||||
|
||||
preloadDelayTimer = setTimeout( preloadMshotsInViewport, 500 );
|
||||
} );
|
||||
|
||||
preloadMshotsInViewport();
|
||||
}
|
||||
|
||||
/**
|
||||
* The way mShots works is if there was no screenshot already recently generated for the URL,
|
||||
* it returns a "loading..." image for the first request. Then, some subsequent request will
|
||||
* receive the actual screenshot, but it's unknown how long it will take. So, what we do here
|
||||
* is continually re-request the mShot, waiting a second after every response until we get the
|
||||
* actual screenshot.
|
||||
*/
|
||||
function retryMshotUntilLoaded() {
|
||||
clearTimeout( mshotRetryTimer );
|
||||
|
||||
var imageWidth = $( '.akismet-mshot img' ).get(0).naturalWidth;
|
||||
|
||||
if ( imageWidth == 0 ) {
|
||||
// It hasn't finished loading yet the first time. Check again shortly.
|
||||
setTimeout( retryMshotUntilLoaded, mshotRetryInterval );
|
||||
}
|
||||
else if ( imageWidth == 400 ) {
|
||||
// It loaded the preview image.
|
||||
|
||||
if ( mshotTries == 20 ) {
|
||||
// Give up if we've requested the mShot 20 times already.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $( '.akismet-mshot' ).data( 'pending-request' ) ) {
|
||||
$( '.akismet-mshot' ).data( 'pending-request', true );
|
||||
|
||||
mshotTries++;
|
||||
|
||||
$( '.akismet-mshot .mshot-image' ).attr( 'src', akismet_mshot_url( $( '.akismet-mshot' ).data( 'url' ), mshotTries ) );
|
||||
}
|
||||
|
||||
mshotRetryTimer = setTimeout( retryMshotUntilLoaded, mshotRetryInterval );
|
||||
}
|
||||
else {
|
||||
// All done.
|
||||
}
|
||||
}
|
||||
|
||||
function preloadMshotsInViewport() {
|
||||
var windowWidth = $( window ).width();
|
||||
var windowHeight = $( window ).height();
|
||||
|
||||
$( '#the-comment-list' ).find( mshotEnabledLinkSelector ).each( function ( index, element ) {
|
||||
var linkUrl = $( this ).attr( 'href' );
|
||||
|
||||
// Don't attempt to preload an mshot for a single link twice.
|
||||
if ( preloadedMshotURLs.indexOf( linkUrl ) !== -1 ) {
|
||||
// The URL is already preloaded.
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( typeof element.getBoundingClientRect !== 'function' ) {
|
||||
// The browser is too old. Return false to stop this preloading entirely.
|
||||
return false;
|
||||
}
|
||||
|
||||
var rect = element.getBoundingClientRect();
|
||||
|
||||
if ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= windowHeight && rect.right <= windowWidth ) {
|
||||
akismet_preload_mshot( linkUrl );
|
||||
$( this ).data( 'akismet-mshot-preloaded', true );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
$( '.checkforspam.enable-on-load' ).on( 'click', function( e ) {
|
||||
if ( $( this ).hasClass( 'ajax-disabled' ) ) {
|
||||
// Akismet hasn't been configured yet. Allow the user to proceed to the button's link.
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if ( $( this ).hasClass( 'button-disabled' ) ) {
|
||||
window.location.href = $( this ).data( 'success-url' ).replace( '__recheck_count__', 0 ).replace( '__spam_count__', 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
$('.checkforspam').addClass('button-disabled').addClass( 'checking' );
|
||||
$('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
|
||||
|
||||
akismet_check_for_spam(0, 100);
|
||||
}).removeClass( 'button-disabled' );
|
||||
|
||||
var spam_count = 0;
|
||||
var recheck_count = 0;
|
||||
|
||||
function akismet_check_for_spam(offset, limit) {
|
||||
var check_for_spam_buttons = $( '.checkforspam' );
|
||||
|
||||
var nonce = check_for_spam_buttons.data( 'nonce' );
|
||||
|
||||
// We show the percentage complete down to one decimal point so even queues with 100k
|
||||
// pending comments will show some progress pretty quickly.
|
||||
var percentage_complete = Math.round( ( recheck_count / check_for_spam_buttons.data( 'pending-comment-count' ) ) * 1000 ) / 10;
|
||||
|
||||
// Update the progress counter on the "Check for Spam" button.
|
||||
$( '.checkforspam' ).text( check_for_spam_buttons.data( 'progress-label' ).replace( '%1$s', percentage_complete ) );
|
||||
|
||||
$.post(
|
||||
ajaxurl,
|
||||
{
|
||||
'action': 'akismet_recheck_queue',
|
||||
'offset': offset,
|
||||
'limit': limit,
|
||||
'nonce': nonce
|
||||
},
|
||||
function(result) {
|
||||
if ( 'error' in result ) {
|
||||
// An error is only returned in the case of a missing nonce, so we don't need the actual error message.
|
||||
window.location.href = check_for_spam_buttons.data( 'failure-url' );
|
||||
return;
|
||||
}
|
||||
|
||||
recheck_count += result.counts.processed;
|
||||
spam_count += result.counts.spam;
|
||||
|
||||
if (result.counts.processed < limit) {
|
||||
window.location.href = check_for_spam_buttons.data( 'success-url' ).replace( '__recheck_count__', recheck_count ).replace( '__spam_count__', spam_count );
|
||||
}
|
||||
else {
|
||||
// Account for comments that were caught as spam and moved out of the queue.
|
||||
akismet_check_for_spam(offset + limit - result.counts.spam, limit);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if ( "start_recheck" in WPAkismet && WPAkismet.start_recheck ) {
|
||||
$( '.checkforspam:first' ).click();
|
||||
}
|
||||
|
||||
if ( typeof MutationObserver !== 'undefined' ) {
|
||||
// Dynamically add the "X" next the the author URL links when a comment is quick-edited.
|
||||
var comment_list_container = document.getElementById( 'the-comment-list' );
|
||||
|
||||
if ( comment_list_container ) {
|
||||
var observer = new MutationObserver( function ( mutations ) {
|
||||
for ( var i = 0, _len = mutations.length; i < _len; i++ ) {
|
||||
if ( mutations[i].addedNodes.length > 0 ) {
|
||||
akismet_enable_comment_author_url_removal();
|
||||
|
||||
// Once we know that we'll have to check for new author links, skip the rest of the mutations.
|
||||
break;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
observer.observe( comment_list_container, { attributes: true, childList: true, characterData: true } );
|
||||
}
|
||||
}
|
||||
|
||||
function akismet_enable_comment_author_url_removal() {
|
||||
$( '#the-comment-list' )
|
||||
.find( 'tr.comment, tr[id ^= "comment-"]' )
|
||||
.find( '.column-author a[href^="http"]:first' ) // Ignore mailto: links, which would be the comment author's email.
|
||||
.each(function () {
|
||||
if ( $( this ).parent().find( '.akismet_remove_url' ).length > 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var linkHref = $(this).attr( 'href' );
|
||||
|
||||
// Ignore any links to the current domain, which are diagnostic tools, like the IP address link
|
||||
// or any other links another plugin might add.
|
||||
var currentHostParts = document.location.href.split( '/' );
|
||||
var currentHost = currentHostParts[0] + '//' + currentHostParts[2] + '/';
|
||||
|
||||
if ( linkHref.indexOf( currentHost ) != 0 ) {
|
||||
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
|
||||
|
||||
$(this)
|
||||
.attr("id", "author_comment_url_"+ thisCommentId[1])
|
||||
.after(
|
||||
$( '<a href="#" class="akismet_remove_url">x</a>' )
|
||||
.attr( 'commentid', thisCommentId[1] )
|
||||
.attr( 'title', WPAkismet.strings['Remove this URL'] )
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an mShot URL if given a link URL.
|
||||
*
|
||||
* @param string linkUrl
|
||||
* @param int retry If retrying a request, the number of the retry.
|
||||
* @return string The mShot URL;
|
||||
*/
|
||||
function akismet_mshot_url( linkUrl, retry ) {
|
||||
var mshotUrl = '//s0.wp.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900';
|
||||
|
||||
if ( retry > 1 ) {
|
||||
mshotUrl += '&r=' + encodeURIComponent( retry );
|
||||
}
|
||||
|
||||
mshotUrl += '&source=akismet';
|
||||
|
||||
return mshotUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin loading an mShot preview of a link.
|
||||
*
|
||||
* @param string linkUrl
|
||||
*/
|
||||
function akismet_preload_mshot( linkUrl ) {
|
||||
var img = new Image();
|
||||
img.src = akismet_mshot_url( linkUrl );
|
||||
|
||||
preloadedMshotURLs.push( linkUrl );
|
||||
}
|
||||
|
||||
$( '.akismet-could-be-primary' ).each( function () {
|
||||
var form = $( this ).closest( 'form' );
|
||||
|
||||
form.data( 'initial-state', form.serialize() );
|
||||
|
||||
form.on( 'change keyup', function () {
|
||||
var self = $( this );
|
||||
var submit_button = self.find( '.akismet-could-be-primary' );
|
||||
|
||||
if ( self.serialize() != self.data( 'initial-state' ) ) {
|
||||
submit_button.addClass( 'akismet-is-primary' );
|
||||
}
|
||||
else {
|
||||
submit_button.removeClass( 'akismet-is-primary' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Shows the Enter API key form
|
||||
*/
|
||||
$( '.akismet-enter-api-key-box__reveal' ).on( 'click', function ( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var div = $( '.akismet-enter-api-key-box__form-wrapper' );
|
||||
div.show();
|
||||
div.find( 'input[name=key]' ).focus();
|
||||
|
||||
$( this ).hide();
|
||||
} );
|
||||
});
|
||||
68
plugins/akismet/_inc/fonts/inter.css
Normal file
68
plugins/akismet/_inc/fonts/inter.css
Normal file
@@ -0,0 +1,68 @@
|
||||
/* NOAUTORTL */
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-Regular.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-Regular.woff?v=3.19") format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-Italic.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-Italic.woff?v=3.19") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-Medium.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-Medium.woff?v=3.19") format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: italic;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-MediumItalic.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-MediumItalic.woff?v=3.19") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-SemiBold.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-SemiBold.woff?v=3.19") format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: italic;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-SemiBoldItalic.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-SemiBoldItalic.woff?v=3.19") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-Bold.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-Bold.woff?v=3.19") format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url("https://s0.wp.com/i/fonts/inter/Inter-BoldItalic.woff2?v=3.19") format("woff2"),
|
||||
url("https://s0.wp.com/i/fonts/inter/Inter-BoldItalic.woff?v=3.19") format("woff");
|
||||
}
|
||||
BIN
plugins/akismet/_inc/img/akismet-activation-banner-elements.png
Normal file
BIN
plugins/akismet/_inc/img/akismet-activation-banner-elements.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
1
plugins/akismet/_inc/img/akismet-refresh-logo.svg
Normal file
1
plugins/akismet/_inc/img/akismet-refresh-logo.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.4 KiB |
BIN
plugins/akismet/_inc/img/akismet-refresh-logo@2x.png
Normal file
BIN
plugins/akismet/_inc/img/akismet-refresh-logo@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
1
plugins/akismet/_inc/img/arrow-left.svg
Normal file
1
plugins/akismet/_inc/img/arrow-left.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"></path></svg>
|
||||
|
After Width: | Height: | Size: 199 B |
3
plugins/akismet/_inc/img/copy.svg
Normal file
3
plugins/akismet/_inc/img/copy.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 418 B |
BIN
plugins/akismet/_inc/img/logo-a-2x.png
Normal file
BIN
plugins/akismet/_inc/img/logo-a-2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 904 B |
799
plugins/akismet/_inc/rtl/akismet-admin-rtl.css
Normal file
799
plugins/akismet/_inc/rtl/akismet-admin-rtl.css
Normal file
@@ -0,0 +1,799 @@
|
||||
/* This file was automatically generated on Apr 09 2026 23:28:55 */
|
||||
|
||||
body {
|
||||
--akismet-color-charcoal: #272635;
|
||||
--akismet-color-light-grey: #f6f7f7;
|
||||
--akismet-color-mid-grey: #a7aaad;
|
||||
--akismet-color-dark-grey: #646970;
|
||||
--akismet-color-grey-80: #2c3338;
|
||||
--akismet-color-grey-100: #101517;
|
||||
--akismet-color-grey-border: #dcdcde;
|
||||
--akismet-color-white: #fff;
|
||||
--akismet-color-dark-green: #2d6a40;
|
||||
--akismet-color-mid-green: #357b49;
|
||||
--akismet-color-light-green: #4eb26a;
|
||||
--akismet-color-mid-red: #e82c3f;
|
||||
--akismet-color-light-blue: #256eff;
|
||||
--akismet-color-notice-light-green: #dbf0e1;
|
||||
--akismet-color-notice-dark-green: #69bf82;
|
||||
--akismet-color-notice-light-red: #ffdbde;
|
||||
--akismet-color-notice-dark-red: #ff6676;
|
||||
--akismet-color-notice-yellow: #e5c133;
|
||||
--akismet-color-page-bg: #fcfcfc;
|
||||
--akismet-color-border: #e0e0e0;
|
||||
--akismet-color-border-light: #f0f0f0;
|
||||
--akismet-color-near-black: #1e1e1e;
|
||||
--akismet-color-text-grey: #757575;
|
||||
--akismet-color-icon: #666666;
|
||||
--akismet-color-icon-hover: #333333;
|
||||
}
|
||||
|
||||
/* UI components */
|
||||
#akismet-plugin-container {
|
||||
background-color: var(--akismet-color-page-bg);
|
||||
border: 1px solid var(--akismet-color-border);
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
#akismet-plugin-container a {
|
||||
color: var(--akismet-color-mid-green);
|
||||
}
|
||||
|
||||
#akismet-plugin-container a.akismet-button {
|
||||
background-color: var(--akismet-color-mid-green);
|
||||
color: var(--akismet-color-white);
|
||||
}
|
||||
|
||||
#akismet-plugin-container button:focus-visible,
|
||||
#akismet-plugin-container input:focus-visible {
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
outline: 2px solid var(--akismet-color-light-blue);
|
||||
}
|
||||
|
||||
#akismet-plugin-container a:focus-visible {
|
||||
box-shadow: none;
|
||||
outline: 2px solid var(--akismet-color-light-blue);
|
||||
}
|
||||
|
||||
.akismet-masthead {
|
||||
border-bottom: 1px solid var(--akismet-color-border-light);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.akismet-masthead__logo {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.akismet-section-header {
|
||||
box-shadow: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.akismet-section-header__label {
|
||||
color: var(--akismet-color-charcoal);
|
||||
font-weight: 600;
|
||||
padding-right: 0.2em;
|
||||
}
|
||||
|
||||
.akismet-button,
|
||||
.akismet-button:hover {
|
||||
border: 0;
|
||||
color: var(--akismet-color-white);
|
||||
}
|
||||
|
||||
.akismet-button {
|
||||
background-color: var(--akismet-color-mid-green);
|
||||
}
|
||||
|
||||
.akismet-button:hover {
|
||||
background-color: var(--akismet-color-dark-green);
|
||||
}
|
||||
|
||||
.akismet-external-link {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.akismet-external-link::after {
|
||||
content: "↗";
|
||||
display: inline-block;
|
||||
padding-right: 2px;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Need this specificity to override the existing header rule */
|
||||
.akismet-new-snapshot h3.akismet-new-snapshot__header {
|
||||
background: none;
|
||||
font-size: 13px;
|
||||
color: var(--akismet-color-charcoal);
|
||||
text-align: right;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__number {
|
||||
color: var(--akismet-color-charcoal);
|
||||
display: block;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
letter-spacing: -1px;
|
||||
line-height: 1.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot li.akismet-new-snapshot__item {
|
||||
color: var(--akismet-color-dark-grey);
|
||||
font-size: 13px;
|
||||
text-align: right;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.akismet-masthead__logo-link {
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
.akismet-masthead__back-link-container {
|
||||
margin-top: 16px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
/* Need this specificity to override the existing link rule */
|
||||
#akismet-plugin-container a.akismet-masthead__back-link {
|
||||
background-image: url(../img/arrow-left.svg);
|
||||
background-position: right;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 16px;
|
||||
color: var(--akismet-color-charcoal);
|
||||
font-weight: 400;
|
||||
padding-right: 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#akismet-plugin-container a.akismet-masthead__back-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__item {
|
||||
border-top: 1px solid var(--akismet-color-border-light);
|
||||
border-right: 1px solid var(--akismet-color-border-light);
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot li:first-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__list {
|
||||
display: flex;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__item {
|
||||
flex: 1 0 33.33%;
|
||||
margin-bottom: 0;
|
||||
padding-right: 1.5em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__chart {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.akismet-stats-footer {
|
||||
align-items: center;
|
||||
border-radius: 0 0 7px 7px;
|
||||
border-top: 1px solid var(--akismet-color-border-light);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
outline-offset: -2px;
|
||||
padding: 1em 1.5em;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.akismet-stats-footer:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.akismet-stats-footer:focus {
|
||||
border-radius: 0 0 7px 7px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.akismet-stats-footer:focus-visible {
|
||||
box-shadow: none;
|
||||
outline: 2px solid var(--akismet-color-light-blue);
|
||||
}
|
||||
|
||||
.akismet-box {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.akismet-box:not(:first-child) {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.akismet-box,
|
||||
.akismet-card {
|
||||
border: 1px solid var(--akismet-color-border);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.akismet-card {
|
||||
margin: 16px auto 0 auto;
|
||||
}
|
||||
|
||||
.akismet-lower {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.akismet-lower .inside {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.akismet-section-header__label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-settings__row {
|
||||
border-bottom: 1px solid var(--akismet-color-border-light);
|
||||
display: block;
|
||||
padding: 1em 1.5em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-input {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.akismet-settings__row-title {
|
||||
font-weight: 500;
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-description {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
.akismet-card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.akismet-card-actions__secondary-action {
|
||||
align-self: center;
|
||||
margin-inline-end: auto;
|
||||
margin-inline-start: 6px;
|
||||
}
|
||||
|
||||
.akismet-settings__row label {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-note {
|
||||
font-size: 0.9em;
|
||||
margin-top: 0.4em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-note abbr {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"],
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
accent-color: var(--akismet-color-mid-green);
|
||||
box-shadow: none;
|
||||
flex-shrink: 0;
|
||||
margin: 2px 0 0 0;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"] {
|
||||
margin-top: 1px;
|
||||
vertical-align: top;
|
||||
-webkit-appearance: checkbox;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
-webkit-appearance: radio;
|
||||
}
|
||||
|
||||
/* Fix up misbehaving wp-admin styles in Chrome (from forms and colors stylesheets) */
|
||||
.akismet-settings__row input[type="checkbox"]:checked:before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="radio"]:checked:before {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"]:checked:hover,
|
||||
.akismet-settings__row input[type="radio"]:checked:hover {
|
||||
accent-color: var(--akismet-color-mid-green);
|
||||
}
|
||||
|
||||
.akismet-button:disabled {
|
||||
background-color: var(--akismet-color-mid-grey);
|
||||
color: var(--akismet-color-white);
|
||||
cursor: arrow;
|
||||
}
|
||||
|
||||
.akismet-awaiting-stats,
|
||||
.akismet-account {
|
||||
padding: 0 1rem 1rem 1rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-account {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
margin-inline-start: 2px;
|
||||
margin-top: 0.25em;
|
||||
padding-bottom: 0;
|
||||
row-gap: 0.25em;
|
||||
}
|
||||
|
||||
.akismet-account__label {
|
||||
font-weight: 500;
|
||||
padding-bottom: 1em;
|
||||
padding-inline-end: 1em;
|
||||
}
|
||||
|
||||
.akismet-account__value {
|
||||
margin: 0;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.akismet-settings__row-input-label {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.akismet-settings__row-label-text {
|
||||
padding-right: 0.5em;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.akismet-alert {
|
||||
border-right: 8px solid;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
padding: 0.2em 1em;
|
||||
}
|
||||
|
||||
.akismet-alert__heading {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.akismet-alert.is-good {
|
||||
background-color: var(--akismet-color-notice-light-green);
|
||||
border-right-color: var(--akismet-color-notice-dark-green);
|
||||
}
|
||||
|
||||
.akismet-alert.is-neutral {
|
||||
background-color: var(--akismet-color-white);
|
||||
border-right-color: var(--akismet-color-dark-grey);
|
||||
}
|
||||
|
||||
.akismet-alert.is-bad {
|
||||
background-color: var(--akismet-color-notice-light-red);
|
||||
border-right-color: var(--akismet-color-notice-dark-red);
|
||||
}
|
||||
|
||||
.akismet-alert.is-commercial {
|
||||
background-color: var(--akismet-color-white);
|
||||
border-color: var(--akismet-color-mid-grey);
|
||||
border-bottom-width: 1px;
|
||||
border-right-color: var(--akismet-color-notice-yellow);
|
||||
display: flex;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
#akismet-plugin-container .akismet-alert.is-good a,
|
||||
#akismet-plugin-container .akismet-alert.is-bad a {
|
||||
/* For better contrast - green isn't great */
|
||||
color: var(--akismet-color-grey-80);
|
||||
}
|
||||
|
||||
.akismet-alert-header {
|
||||
font-size: 16px;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.akismet-alert-button-wrapper {
|
||||
align-self: center;
|
||||
margin-right: 2em;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.akismet-alert-info {
|
||||
text-wrap: pretty;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
/* Setup */
|
||||
.akismet-setup-instructions__heading {
|
||||
font-size: 1.375rem;
|
||||
font-weight: 700;
|
||||
padding-block-end: 0;
|
||||
}
|
||||
|
||||
h3.akismet-setup-instructions__subheading {
|
||||
color: var(--akismet-color-dark-grey);
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
margin: 0 0 1.25rem;
|
||||
padding-block-start: 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__feature-list {
|
||||
list-style: none;
|
||||
margin: 1rem 0.5rem 1.5rem;
|
||||
max-width: 640px;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__feature {
|
||||
align-items: start;
|
||||
display: flex;
|
||||
margin-block-end: 1rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__icon {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__body {
|
||||
flex: 1;
|
||||
padding-inline-start: 0.5rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__title {
|
||||
color: #1d2327;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
p.akismet-setup-instructions__text {
|
||||
color: var(--akismet-color-grey-80);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
margin: 0.25rem 0 0;
|
||||
padding: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions__button,
|
||||
.akismet-setup-instructions__button:hover,
|
||||
.akismet-setup-instructions__button:visited {
|
||||
font-size: 1rem;
|
||||
margin-inline-start: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-setup__connection {
|
||||
background: var(--akismet-color-light-grey);
|
||||
border: 1px solid var(--akismet-color-grey-border);
|
||||
border-radius: 8px;
|
||||
margin: 1rem 1rem 2rem 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-action:not(:last-child) {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-user {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-avatar {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-avatar-image {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-account-name {
|
||||
color: var(--akismet-color-charcoal);
|
||||
font-size: 0.9rem;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-account-email {
|
||||
margin-top: 0.1rem;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-action {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.akismet-setup__connection-button {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
p.akismet-setup__connection-action-intro,
|
||||
p.akismet-setup__connection-action-description {
|
||||
color: var(--akismet-color-dark-grey);
|
||||
font-size: 0.875rem;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
p.akismet-setup__connection-action-intro {
|
||||
margin: 0 0 1rem 0;
|
||||
}
|
||||
|
||||
p.akismet-setup__connection-action-description {
|
||||
margin: 1rem 0 0;
|
||||
}
|
||||
|
||||
/* API key field with copy button */
|
||||
.akismet-api-key-wrapper {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-api-key-wrapper input {
|
||||
padding-left: 36px;
|
||||
}
|
||||
|
||||
.akismet-api-key-copy {
|
||||
position: absolute;
|
||||
left: 4px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
color: var(--akismet-color-icon);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-api-key-copy:hover {
|
||||
color: var(--akismet-color-icon-hover);
|
||||
}
|
||||
|
||||
/* Setup - API key input */
|
||||
.akismet-enter-api-key-box {
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__reveal {
|
||||
background: none;
|
||||
border: 0;
|
||||
color: var(--akismet-color-mid-green);
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__form-wrapper {
|
||||
display: none;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__input-wrapper {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
padding: 0 1.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.akismet-enter-api-key-box__key-input {
|
||||
flex-grow: 1;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
h3.akismet-enter-api-key-box__header {
|
||||
padding-top: 0;
|
||||
padding-bottom: 1em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Notices > Activation (shown on edit-comments.php) */
|
||||
#akismet-setup-prompt {
|
||||
background: none;
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.akismet-activate {
|
||||
align-items: center;
|
||||
/* background-image is defined via an inline style in class.akismet-admin.php */
|
||||
background-color: var(--akismet-color-light-grey);
|
||||
background-position: calc(100% - (100% - 1em)) center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 140px;
|
||||
border: 1px solid var(--akismet-color-mid-green);
|
||||
border-right-width: 4px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 15px 0;
|
||||
min-height: 60px;
|
||||
overflow: hidden;
|
||||
padding: 5px 5px 5px 160px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.akismet-activate__button,
|
||||
.akismet-activate__button:hover,
|
||||
.akismet-activate__button:visited {
|
||||
margin: 0 1em;
|
||||
}
|
||||
|
||||
.akismet-activate__description {
|
||||
color: var(--akismet-color-charcoal);
|
||||
flex-grow: 1;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
/* Compatible plugins section */
|
||||
.akismet-compatible-plugins__content {
|
||||
padding: 0 1.5em 1.5em 1.5em;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__intro {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__section-header-label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__section-header-label-text {
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__list {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
margin: 1.5em 0 1em 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card {
|
||||
border: 1px solid var(--akismet-color-border-light);
|
||||
border-radius: 4px;
|
||||
padding: 1em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card-logo {
|
||||
padding: 0 0 0 1.5em;
|
||||
object-fit: contain;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card-detail {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__card-title {
|
||||
font-size: 1.2em;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__docs {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__show-more {
|
||||
all: unset;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Generates the show/hide chevron */
|
||||
.akismet-compatible-plugins__show-more::after {
|
||||
align-self: center;
|
||||
border-bottom: 2px solid black;
|
||||
border-left: 2px solid black;
|
||||
content: "";
|
||||
height: 8px;
|
||||
transform: rotate(-45deg);
|
||||
transition: transform 0.2s ease;
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.akismet-compatible-plugins__list.is-expanded + .akismet-compatible-plugins__show-more::after {
|
||||
align-self: end;
|
||||
transform: rotate(-225deg);
|
||||
}
|
||||
|
||||
/* Gutenberg medium breakpoint */
|
||||
@media screen and (max-width: 782px) {
|
||||
.akismet-new-snapshot__list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__number {
|
||||
float: left;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-top: -16px;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__header {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot__text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"],
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.akismet-settings__row-label-text {
|
||||
padding-right: 0.8em;
|
||||
}
|
||||
|
||||
.akismet-settings__row input[type="checkbox"],
|
||||
.akismet-settings__row input[type="radio"] {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.akismet-activate {
|
||||
background-size: 120px;
|
||||
padding-left: 134px;
|
||||
}
|
||||
|
||||
.akismet-activate__button {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.akismet-activate__description {
|
||||
font-size: 14px;
|
||||
margin-left: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
/* Gutenberg small breakpoint */
|
||||
@media screen and (max-width: 600px) {
|
||||
.akismet-compatible-plugins__list {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.akismet-activate__button,
|
||||
.akismet-activate__button:hover {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.akismet-activate__description {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
464
plugins/akismet/_inc/rtl/akismet-rtl.css
Normal file
464
plugins/akismet/_inc/rtl/akismet-rtl.css
Normal file
@@ -0,0 +1,464 @@
|
||||
/* This file was automatically generated on Oct 30 2025 21:26:42 */
|
||||
|
||||
.wp-admin.jetpack_page_akismet-key-config, .wp-admin.settings_page_akismet-key-config {
|
||||
background-color:#f3f6f8;
|
||||
}
|
||||
|
||||
#submitted-on {
|
||||
position: relative;
|
||||
}
|
||||
#the-comment-list .author .akismet-user-comment-count {
|
||||
display: inline;
|
||||
}
|
||||
#the-comment-list .author a span {
|
||||
text-decoration: none;
|
||||
color: #999;
|
||||
}
|
||||
#the-comment-list .author a span.akismet-span-link {
|
||||
text-decoration: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
#the-comment-list .akismet_remove_url {
|
||||
margin-right: 3px;
|
||||
color: #999;
|
||||
padding: 2px 0 2px 3px;
|
||||
}
|
||||
#the-comment-list .akismet_remove_url:hover {
|
||||
color: #A7301F;
|
||||
font-weight: bold;
|
||||
padding: 2px 0 2px 2px;
|
||||
}
|
||||
#dashboard_recent_comments .akismet-status {
|
||||
display: none;
|
||||
}
|
||||
.akismet-status {
|
||||
float: left;
|
||||
}
|
||||
.akismet-status a {
|
||||
color: #AAA;
|
||||
font-style: italic;
|
||||
}
|
||||
table.comments td.comment p a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
table.comments td.comment p a:after {
|
||||
content: attr(href);
|
||||
color: #aaa;
|
||||
display: inline-block; /* Show the URL without the link's underline extending under it. */
|
||||
padding: 0 1ex; /* Because it's inline block, we can't just use spaces in the content: attribute to separate it from the link text. */
|
||||
}
|
||||
.mshot-arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 10px solid transparent;
|
||||
border-bottom: 10px solid transparent;
|
||||
border-left: 10px solid #5C5C5C;
|
||||
position: absolute;
|
||||
right: -6px;
|
||||
top: 91px;
|
||||
}
|
||||
.mshot-container {
|
||||
background: #5C5C5C;
|
||||
position: absolute;
|
||||
top: -94px;
|
||||
padding: 7px;
|
||||
width: 450px;
|
||||
height: 338px;
|
||||
z-index: 20000;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.akismet-mshot {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
}
|
||||
.akismet-mshot .mshot-image {
|
||||
margin: 0;
|
||||
height: 338px;
|
||||
width: 450px;
|
||||
}
|
||||
.checkforspam {
|
||||
display: inline-block !important;
|
||||
}
|
||||
|
||||
.checkforspam-spinner {
|
||||
display: inline-block;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.akismet-right {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.akismet-card .akismet-right {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot {
|
||||
margin-top: 1em;
|
||||
text-align: center;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot h3 {
|
||||
background: #f5f5f5;
|
||||
color: #888;
|
||||
font-size: 11px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot ul li {
|
||||
color: #999;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
.akismet-settings th:first-child {
|
||||
vertical-align: top;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.akismet-settings th.akismet-api-key {
|
||||
vertical-align: middle;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.akismet-settings span.akismet-note {
|
||||
float: right;
|
||||
padding-right: 23px;
|
||||
font-size: 75%;
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.jetpack_page_akismet-key-config #wpcontent, .settings_page_akismet-key-config #wpcontent {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.akismet-masthead {
|
||||
background-color:#fff;
|
||||
text-align:center;
|
||||
box-shadow:0 1px 0 rgba(200,215,225,0.5),0 1px 2px #e9eff3
|
||||
}
|
||||
|
||||
@media (max-width: 45rem) {
|
||||
.akismet-masthead {
|
||||
padding:0 1.25rem
|
||||
}
|
||||
}
|
||||
|
||||
.akismet-masthead__inside-container {
|
||||
padding:.375rem 0;
|
||||
margin:0 auto;
|
||||
width:100%;
|
||||
max-width:45rem;
|
||||
text-align: right;
|
||||
}
|
||||
.akismet-masthead__logo-container {
|
||||
padding:.3125rem 0 0
|
||||
}
|
||||
.akismet-masthead__logo-link {
|
||||
display:inline-block;
|
||||
outline:none;
|
||||
vertical-align:middle
|
||||
}
|
||||
.akismet-masthead__logo-link:focus {
|
||||
line-height:0;
|
||||
box-shadow:0 0 0 2px #78dcfa
|
||||
}
|
||||
.akismet-masthead__logo-link+code {
|
||||
margin:0 10px;
|
||||
padding:5px 9px;
|
||||
border-radius:2px;
|
||||
background:#e6ecf1;
|
||||
color:#647a88
|
||||
}
|
||||
.akismet-masthead__links {
|
||||
display:flex;
|
||||
flex-flow:row wrap;
|
||||
flex:2 50%;
|
||||
justify-content:flex-end;
|
||||
margin:0
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.akismet-masthead__links {
|
||||
padding-left:.625rem
|
||||
}
|
||||
}
|
||||
.akismet-masthead__link-li {
|
||||
margin:0;
|
||||
padding:0
|
||||
}
|
||||
.akismet-masthead__link {
|
||||
font-style:normal;
|
||||
color:#0087be;
|
||||
padding:.625rem;
|
||||
display:inline-block
|
||||
}
|
||||
.akismet-masthead__link:visited {
|
||||
color:#0087be
|
||||
}
|
||||
.akismet-masthead__link:active,.akismet-masthead__link:hover {
|
||||
color:#00aadc
|
||||
}
|
||||
.akismet-masthead__link:hover {
|
||||
text-decoration:underline
|
||||
}
|
||||
.akismet-masthead__link .dashicons {
|
||||
display:none
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.akismet-masthead__link:hover,.akismet-masthead__link:active {
|
||||
text-decoration:none
|
||||
}
|
||||
.akismet-masthead__link .dashicons {
|
||||
display:block;
|
||||
font-size:1.75rem
|
||||
}
|
||||
.akismet-masthead__link span+span {
|
||||
display:none
|
||||
}
|
||||
}
|
||||
.akismet-masthead__link-li:last-of-type .akismet-masthead__link {
|
||||
padding-left:0
|
||||
}
|
||||
|
||||
.akismet-lower {
|
||||
margin: 0 auto;
|
||||
text-align: right;
|
||||
max-width: 45rem;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-lower .notice {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.akismet-card {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.akismet-card:after, .akismet-card .inside:after, .akismet-masthead__logo-container:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.akismet-card .inside {
|
||||
padding: 1.5rem;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.akismet-card .akismet-card-actions {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.jetpack_page_akismet-key-config .update-nag, .settings_page_akismet-key-config .update-nag {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.akismet-masthead .akismet-right {
|
||||
line-height: 2.125rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.akismet-box {
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
border: 1px solid rgba(200, 215, 225, 0.5);
|
||||
}
|
||||
|
||||
.akismet-box h2, .akismet-box h3 {
|
||||
padding: 1.5rem 1.5rem .5rem 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-box p {
|
||||
padding: 0 1.5rem 1.5rem 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-box p:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.akismet-box .akismet-right {
|
||||
padding-left: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box {
|
||||
margin-bottom: 0;
|
||||
padding: 0;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box:last-child {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box:first-child {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-box .centered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.akismet-button, .akismet-button:hover, .akismet-button:visited {
|
||||
background: white;
|
||||
border-color: #c8d7e1;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 2px;
|
||||
color: #2e4453;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
outline: 0;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-overflow: ellipsis;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
line-height: 21px;
|
||||
border-radius: 4px;
|
||||
padding: 7px 14px 9px;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.akismet-button:hover {
|
||||
border-color: #a8bece;
|
||||
}
|
||||
|
||||
.akismet-button:active {
|
||||
border-width: 2px 1px 1px;
|
||||
}
|
||||
|
||||
.akismet-is-primary, .akismet-is-primary:hover, .akismet-is-primary:visited {
|
||||
background: #00aadc;
|
||||
border-color: #0087be;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.akismet-is-primary:hover, .akismet-is-primary:focus {
|
||||
border-color: #005082;
|
||||
}
|
||||
|
||||
.akismet-is-primary:hover {
|
||||
border-color: #005082;
|
||||
}
|
||||
|
||||
.akismet-section-header {
|
||||
position: relative;
|
||||
margin: 0 auto 0.625rem auto;
|
||||
padding: 1rem;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
padding-top: 0.6875rem;
|
||||
padding-bottom: 0.6875rem;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.akismet-section-header__label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
line-height: 1.75rem;
|
||||
position: relative;
|
||||
font-size: 0.875rem;
|
||||
color: #4f748e;
|
||||
}
|
||||
|
||||
.akismet-section-header__actions {
|
||||
line-height: 1.75rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions form {
|
||||
padding-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-setup-instructions > a.akismet-button {
|
||||
display: inline-block;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
div.error.akismet-usage-limit-alert {
|
||||
padding: 25px 15px 25px 45px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#akismet-plugin-container .akismet-usage-limit-alert {
|
||||
margin: 0 auto 0.625rem auto;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
|
||||
border: none;
|
||||
border-right: 4px solid #d63638;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-logo {
|
||||
width: 38px;
|
||||
min-width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 20px;
|
||||
margin-left: 18px;
|
||||
background: black;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-logo img {
|
||||
position: absolute;
|
||||
width: 22px;
|
||||
right: 8px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-text {
|
||||
flex-grow: 1;
|
||||
margin-left: 18px;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert h3 {
|
||||
line-height: 1.3;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-cta {
|
||||
border-color: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#akismet-plugin-container .akismet-usage-limit-cta a {
|
||||
color: #d63638;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
@media (max-width: 550px) {
|
||||
div.error.akismet-usage-limit-alert {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-logo,
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-text {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.akismet-usage-limit-alert .akismet-usage-limit-cta {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
/**
|
||||
* Comment Check ability for Akismet.
|
||||
*
|
||||
* @package Akismet
|
||||
* @since 5.7
|
||||
*/
|
||||
|
||||
declare( strict_types = 1 );
|
||||
|
||||
/**
|
||||
* Class Akismet_Ability_Comment_Check
|
||||
*
|
||||
* Registers and handles the ability to check comments for spam.
|
||||
*/
|
||||
class Akismet_Ability_Comment_Check extends Akismet_Ability implements Akismet_Ability_Interface {
|
||||
|
||||
/**
|
||||
* Get the ability name.
|
||||
*
|
||||
* @return string The ability name.
|
||||
*/
|
||||
protected function get_ability_name(): string {
|
||||
return 'akismet/comment-check';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-readable label.
|
||||
*
|
||||
* @return string The label.
|
||||
*/
|
||||
protected function get_label(): string {
|
||||
return __( 'Check comment for spam', 'akismet' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ability description.
|
||||
*
|
||||
* @return string The description.
|
||||
*/
|
||||
protected function get_description(): string {
|
||||
return __( 'Checks a comment against the Akismet spam filter to determine if it is spam or legitimate content.', 'akismet' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the input schema.
|
||||
*
|
||||
* @return array The input schema.
|
||||
*/
|
||||
protected function get_input_schema(): array {
|
||||
return array(
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'comment_author' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Name of the comment author.', 'akismet' ),
|
||||
),
|
||||
'comment_author_email' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Email address of the comment author.', 'akismet' ),
|
||||
'format' => 'email',
|
||||
),
|
||||
'comment_author_url' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'URL/website of the comment author.', 'akismet' ),
|
||||
'format' => 'uri',
|
||||
),
|
||||
'comment_content' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'The comment content/text.', 'akismet' ),
|
||||
),
|
||||
'comment_type' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'The comment type (e.g., "comment", "trackback", "pingback").', 'akismet' ),
|
||||
'default' => 'comment',
|
||||
),
|
||||
'comment_post_ID' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'The ID of the post the comment is being submitted to.', 'akismet' ),
|
||||
),
|
||||
'permalink' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'The permanent link to the post or page.', 'akismet' ),
|
||||
'format' => 'uri',
|
||||
),
|
||||
'user_ip' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'IP address of the commenter.', 'akismet' ),
|
||||
),
|
||||
'user_agent' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'User agent string of the web browser submitting the comment.', 'akismet' ),
|
||||
),
|
||||
'referrer' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'The HTTP_REFERER header.', 'akismet' ),
|
||||
),
|
||||
'user_role' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'The user role of the comment author if logged in.', 'akismet' ),
|
||||
),
|
||||
),
|
||||
'additionalProperties' => false,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output schema.
|
||||
*
|
||||
* @return array The output schema.
|
||||
*/
|
||||
protected function get_output_schema(): array {
|
||||
return array(
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'success' => array(
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Whether the check was successfully performed.', 'akismet' ),
|
||||
),
|
||||
'is_spam' => array(
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Whether the comment is identified as spam.', 'akismet' ),
|
||||
),
|
||||
'pro_tip' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Optional recommendation from Akismet (e.g., "discard" for obvious spam).', 'akismet' ),
|
||||
),
|
||||
'guid' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Unique identifier for this check, used for webhooks and updates.', 'akismet' ),
|
||||
),
|
||||
'error' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Error message if the check could not be completed.', 'akismet' ),
|
||||
),
|
||||
'debug_help' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Debug information to help troubleshoot issues.', 'akismet' ),
|
||||
),
|
||||
),
|
||||
'additionalProperties' => false,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ability configuration.
|
||||
*
|
||||
* @return array The ability configuration.
|
||||
*/
|
||||
public function get_config(): array {
|
||||
return array(
|
||||
'label' => $this->get_label(),
|
||||
'description' => $this->get_description(),
|
||||
'category' => Akismet_Abilities::CATEGORY_SLUG,
|
||||
'input_schema' => $this->get_input_schema(),
|
||||
'output_schema' => $this->get_output_schema(),
|
||||
'execute_callback' => array( $this, 'execute' ),
|
||||
'permission_callback' => array( $this, 'current_user_has_permission' ),
|
||||
'meta' => array(
|
||||
'annotations' => array(
|
||||
'readonly' => true,
|
||||
'destructive' => false,
|
||||
'idempotent' => false,
|
||||
),
|
||||
'mcp' => array(
|
||||
'public' => ( get_option( 'akismet_enable_mcp_access' ) === '1' ),
|
||||
'type' => 'tool',
|
||||
),
|
||||
'show_in_rest' => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute callback for the comment-check ability.
|
||||
*
|
||||
* @param array|null $input The comment data to check.
|
||||
* @return array|WP_Error The spam check result or error.
|
||||
*/
|
||||
public function execute( ?array $input = null ) {
|
||||
// Check for required API key.
|
||||
if ( ! Akismet::get_api_key() ) {
|
||||
return new WP_Error(
|
||||
'akismet_not_configured',
|
||||
__( 'Akismet is not configured. Please enter an API key.', 'akismet' )
|
||||
);
|
||||
}
|
||||
|
||||
// Perform the comment check.
|
||||
$result = Akismet::comment_check( $input );
|
||||
|
||||
if ( ! $result ) {
|
||||
return new WP_Error(
|
||||
'comment_check_failed',
|
||||
__( 'Failed to check comment with Akismet API.', 'akismet' )
|
||||
);
|
||||
}
|
||||
|
||||
// Build response array.
|
||||
$response = array(
|
||||
'success' => true,
|
||||
'is_spam' => $result->is_spam,
|
||||
);
|
||||
|
||||
// Include optional fields if present.
|
||||
if ( isset( $result->pro_tip ) ) {
|
||||
$response['pro_tip'] = $result->pro_tip;
|
||||
}
|
||||
|
||||
if ( isset( $result->guid ) ) {
|
||||
$response['guid'] = $result->guid;
|
||||
}
|
||||
|
||||
if ( isset( $result->error ) ) {
|
||||
$response['error'] = $result->error;
|
||||
}
|
||||
|
||||
if ( isset( $result->debug_help ) ) {
|
||||
$response['debug_help'] = $result->debug_help;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
202
plugins/akismet/abilities/class-akismet-ability-get-stats.php
Normal file
202
plugins/akismet/abilities/class-akismet-ability-get-stats.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* Get Stats ability for Akismet.
|
||||
*
|
||||
* @package Akismet
|
||||
* @since 5.7
|
||||
*/
|
||||
|
||||
declare( strict_types = 1 );
|
||||
|
||||
/**
|
||||
* Class Akismet_Ability_Get_Stats
|
||||
*
|
||||
* Registers and handles the ability to retrieve Akismet statistics.
|
||||
*/
|
||||
class Akismet_Ability_Get_Stats extends Akismet_Ability implements Akismet_Ability_Interface {
|
||||
|
||||
/**
|
||||
* Get the ability name.
|
||||
*
|
||||
* @return string The ability name.
|
||||
*/
|
||||
protected function get_ability_name(): string {
|
||||
return 'akismet/get-stats';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-readable label.
|
||||
*
|
||||
* @return string The label.
|
||||
*/
|
||||
protected function get_label(): string {
|
||||
return __( 'Get Akismet statistics', 'akismet' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ability description.
|
||||
*
|
||||
* @return string The description.
|
||||
*/
|
||||
protected function get_description(): string {
|
||||
return __( 'Retrieves Akismet spam protection statistics including spam blocked count, accuracy percentage, and other key metrics.', 'akismet' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the input schema.
|
||||
*
|
||||
* @return array The input schema.
|
||||
*/
|
||||
protected function get_input_schema(): array {
|
||||
return array(
|
||||
'type' => array( 'object', 'null' ),
|
||||
'properties' => array(
|
||||
'interval' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'The time interval for stats. Options: "6-months", "all", or "60-days".', 'akismet' ),
|
||||
'enum' => array( '6-months', 'all', '60-days' ),
|
||||
'default' => '6-months',
|
||||
),
|
||||
),
|
||||
'additionalProperties' => false,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output schema.
|
||||
*
|
||||
* @return array The output schema.
|
||||
*/
|
||||
protected function get_output_schema(): array {
|
||||
return array(
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'success' => array(
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Whether the stats were successfully retrieved.', 'akismet' ),
|
||||
),
|
||||
'spam' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Total number of spam comments blocked.', 'akismet' ),
|
||||
),
|
||||
'ham' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Total number of legitimate comments approved.', 'akismet' ),
|
||||
),
|
||||
'missed_spam' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Number of spam comments that were missed.', 'akismet' ),
|
||||
),
|
||||
'false_positives' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Number of legitimate comments incorrectly marked as spam.', 'akismet' ),
|
||||
),
|
||||
'accuracy' => array(
|
||||
'type' => 'number',
|
||||
'description' => __( 'Accuracy percentage of spam detection.', 'akismet' ),
|
||||
),
|
||||
'time_saved' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Estimated time saved by Akismet blocking spam, in seconds.', 'akismet' ),
|
||||
),
|
||||
'breakdown' => array(
|
||||
'type' => 'object',
|
||||
'description' => __( 'Monthly breakdown of statistics.', 'akismet' ),
|
||||
'additionalProperties' => array(
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'spam' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Total number of spam comments blocked in this period.', 'akismet' ),
|
||||
),
|
||||
'ham' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Total number of legitimate comments approved in this period.', 'akismet' ),
|
||||
),
|
||||
'missed_spam' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Number of spam comments that were missed in this period.', 'akismet' ),
|
||||
),
|
||||
'false_positives' => array(
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Number of legitimate comments incorrectly marked as spam in this period.', 'akismet' ),
|
||||
),
|
||||
'da' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Date for this period.', 'akismet' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'interval' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'The time interval for these stats.', 'akismet' ),
|
||||
),
|
||||
'error' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Error message if the operation could not be completed.', 'akismet' ),
|
||||
),
|
||||
),
|
||||
'additionalProperties' => false,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ability configuration.
|
||||
*
|
||||
* @return array The ability configuration.
|
||||
*/
|
||||
public function get_config(): array {
|
||||
return array(
|
||||
'label' => $this->get_label(),
|
||||
'description' => $this->get_description(),
|
||||
'category' => Akismet_Abilities::CATEGORY_SLUG,
|
||||
'input_schema' => $this->get_input_schema(),
|
||||
'output_schema' => $this->get_output_schema(),
|
||||
'execute_callback' => array( $this, 'execute' ),
|
||||
'permission_callback' => array( $this, 'current_user_has_permission' ),
|
||||
'meta' => array(
|
||||
'annotations' => array(
|
||||
'readonly' => true,
|
||||
'destructive' => false,
|
||||
'idempotent' => true,
|
||||
),
|
||||
'mcp' => array(
|
||||
'public' => ( get_option( 'akismet_enable_mcp_access' ) === '1' ),
|
||||
'type' => 'tool',
|
||||
),
|
||||
'show_in_rest' => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute callback for the get-stats ability.
|
||||
*
|
||||
* @param array|null $input The input parameters with optional interval.
|
||||
* @return array|WP_Error The stats data or error.
|
||||
*/
|
||||
public function execute( ?array $input = null ) {
|
||||
// Get interval from input or use default.
|
||||
$interval = isset( $input['interval'] ) ? $input['interval'] : '6-months';
|
||||
|
||||
// Fetch stats from Akismet API.
|
||||
$data = Akismet::get_stats( $interval );
|
||||
|
||||
if ( ! $data ) {
|
||||
return new WP_Error(
|
||||
'stats_fetch_failed',
|
||||
__( 'Failed to retrieve stats from Akismet API.', 'akismet' )
|
||||
);
|
||||
}
|
||||
|
||||
// Build response with data from API (already properly typed by get_stats).
|
||||
return array_merge(
|
||||
array(
|
||||
'success' => true,
|
||||
'interval' => $interval,
|
||||
),
|
||||
(array) $data
|
||||
);
|
||||
}
|
||||
}
|
||||
60
plugins/akismet/abilities/class-akismet-ability.php
Normal file
60
plugins/akismet/abilities/class-akismet-ability.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Represents a Base Ability.
|
||||
*
|
||||
* This class holds a default constructor to register the ability and a default permission.
|
||||
*
|
||||
* @package Akismet
|
||||
* @since 5.7
|
||||
*/
|
||||
|
||||
declare( strict_types = 1 );
|
||||
|
||||
/**
|
||||
* Base class for Akismet abilities.
|
||||
*
|
||||
* @package Akismet
|
||||
* @since 5.7
|
||||
*/
|
||||
abstract class Akismet_Ability implements Akismet_Ability_Interface {
|
||||
|
||||
/**
|
||||
* Get the ability name.
|
||||
*
|
||||
* Classes extending this must implement this method to provide the ability name into the registration.
|
||||
*
|
||||
* @return string The ability name.
|
||||
*/
|
||||
abstract protected function get_ability_name(): string;
|
||||
|
||||
/**
|
||||
* Get the config.
|
||||
*
|
||||
* Classes extending this must implement this method to provide the ability configuration into the registration.
|
||||
*
|
||||
* @return array The ability configuration array.
|
||||
*/
|
||||
abstract public function get_config(): array;
|
||||
|
||||
/**
|
||||
* Constructor - registers the ability.
|
||||
*/
|
||||
public function __construct() {
|
||||
wp_register_ability(
|
||||
$this->get_ability_name(),
|
||||
$this->get_config()
|
||||
);
|
||||
}
|
||||
|
||||
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Base class default, subclasses use $input.
|
||||
/**
|
||||
* Permission callback for any ability that uses this trait.
|
||||
*
|
||||
* @param array|null $input The input parameters (unused).
|
||||
* @return bool Whether the current user can use this ability.
|
||||
*/
|
||||
public function current_user_has_permission( ?array $input = null ): bool {
|
||||
// phpcs:enable Generic.CodeAnalysis.UnusedFunctionParameter.Found
|
||||
return current_user_can( 'moderate_comments' );
|
||||
}
|
||||
}
|
||||
62
plugins/akismet/abilities/interface-akismet-ability.php
Normal file
62
plugins/akismet/abilities/interface-akismet-ability.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Interface for Akismet abilities.
|
||||
*
|
||||
* @package Akismet
|
||||
* @since 5.7
|
||||
*/
|
||||
|
||||
declare( strict_types = 1 );
|
||||
|
||||
/**
|
||||
* Interface Akismet_Ability_Interface
|
||||
*/
|
||||
interface Akismet_Ability_Interface {
|
||||
|
||||
/**
|
||||
* Get the ability configuration array.
|
||||
*
|
||||
* Returns the configuration array used to register the ability with wp_register_ability().
|
||||
*
|
||||
* @return array {
|
||||
* The ability configuration array.
|
||||
*
|
||||
* @type string $label A human-readable name for the ability. Used for display purposes. Should be translatable.
|
||||
* @type string $description A detailed description of what the ability does, its purpose, and its parameters or return values.
|
||||
* This is crucial for AI agents to understand how and when to use the ability.
|
||||
* @type string $category The slug of the category this ability belongs to. The category must be registered before
|
||||
* registering the ability.
|
||||
* @type array $output_schema A JSON Schema definition describing the expected format of the data returned by the ability.
|
||||
* Used for validation and documentation.
|
||||
* @type callable $execute_callback The PHP function or method to execute when this ability is called. Receives optional input
|
||||
* argument matching the input schema type.
|
||||
* @type callable $permission_callback A callback function to check if the current user has permission to execute this ability.
|
||||
* Returns boolean or WP_Error.
|
||||
* @type array $input_schema Optional. JSON Schema defining expected input parameters. Required when the ability accepts inputs.
|
||||
* @type array $meta Optional. An associative array for storing arbitrary additional metadata about the ability,
|
||||
* including 'annotations' (readonly, destructive, idempotent flags) and 'show_in_rest'.
|
||||
* @type string $ability_class Optional. Custom class name extending WP_Ability for behavior customization.
|
||||
* }
|
||||
*/
|
||||
public function get_config(): array;
|
||||
|
||||
/**
|
||||
* Execute callback for the ability.
|
||||
*
|
||||
* Runs the main functionality of the ability.
|
||||
*
|
||||
* @param array|null $input The input parameters for the ability. Null when no input provided.
|
||||
* @return array|WP_Error The result of the execution or a WP_Error on failure.
|
||||
*/
|
||||
public function execute( ?array $input = null );
|
||||
|
||||
/**
|
||||
* Permission callback for the ability.
|
||||
*
|
||||
* Checks if the current user has permission to execute the ability.
|
||||
*
|
||||
* @param array|null $input The input parameters for the ability. Null when no input provided.
|
||||
* @return bool Whether the current user has permission.
|
||||
*/
|
||||
public function current_user_has_permission( ?array $input = null ): bool;
|
||||
}
|
||||
93
plugins/akismet/akismet.php
Normal file
93
plugins/akismet/akismet.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Akismet
|
||||
*/
|
||||
/*
|
||||
Plugin Name: Akismet Anti-spam: Spam Protection
|
||||
Plugin URI: https://akismet.com/
|
||||
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
|
||||
Version: 5.7
|
||||
Requires at least: 5.8
|
||||
Requires PHP: 7.2
|
||||
Author: Automattic - Anti-spam Team
|
||||
Author URI: https://automattic.com/wordpress-plugins/
|
||||
License: GPLv2 or later
|
||||
Text Domain: akismet
|
||||
*/
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
Copyright 2005-2025 Automattic, Inc.
|
||||
*/
|
||||
|
||||
// Make sure we don't expose any info if called directly
|
||||
if ( ! function_exists( 'add_action' ) ) {
|
||||
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'AKISMET_VERSION', '5.7' );
|
||||
define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' );
|
||||
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'AKISMET_DELETE_LIMIT', 10000 );
|
||||
|
||||
register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) );
|
||||
register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) );
|
||||
|
||||
require_once AKISMET__PLUGIN_DIR . 'class.akismet.php';
|
||||
require_once AKISMET__PLUGIN_DIR . 'class.akismet-widget.php';
|
||||
require_once AKISMET__PLUGIN_DIR . 'class.akismet-rest-api.php';
|
||||
require_once AKISMET__PLUGIN_DIR . 'class-akismet-compatible-plugins.php';
|
||||
|
||||
add_action( 'init', array( 'Akismet', 'init' ) );
|
||||
|
||||
add_action( 'rest_api_init', array( 'Akismet_REST_API', 'init' ) );
|
||||
|
||||
add_action( 'init', array( 'Akismet_Compatible_Plugins', 'init' ) );
|
||||
|
||||
if ( function_exists( 'wp_get_connectors' ) ) {
|
||||
require_once AKISMET__PLUGIN_DIR . 'class-akismet-connector.php';
|
||||
add_action( 'init', array( 'Akismet_Connector', 'init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally loads for a WordPress 6.9+ installation, which has
|
||||
* access to the core Abilities API. Only register abilities if Akismet
|
||||
* is set up with an API key (either predefined or configured).
|
||||
*/
|
||||
if ( function_exists( 'wp_register_ability' ) ) {
|
||||
require_once AKISMET__PLUGIN_DIR . 'class-akismet-abilities.php';
|
||||
add_action(
|
||||
'init',
|
||||
function () {
|
||||
if ( Akismet::get_api_key() ) {
|
||||
Akismet_Abilities::init();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
||||
require_once AKISMET__PLUGIN_DIR . 'class.akismet-admin.php';
|
||||
add_action( 'init', array( 'Akismet_Admin', 'init' ) );
|
||||
}
|
||||
|
||||
// add wrapper class around deprecated akismet functions that are referenced elsewhere
|
||||
require_once AKISMET__PLUGIN_DIR . 'wrapper.php';
|
||||
|
||||
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
||||
require_once AKISMET__PLUGIN_DIR . 'class.akismet-cli.php';
|
||||
}
|
||||
550
plugins/akismet/changelog.txt
Normal file
550
plugins/akismet/changelog.txt
Normal file
@@ -0,0 +1,550 @@
|
||||
=== Akismet Anti-spam ===
|
||||
|
||||
== Archived Changelog Entries ==
|
||||
|
||||
This file contains older changelog entries, so we can keep the size of the standard WordPress readme.txt file reasonable.
|
||||
For the latest changes, please see the "Changelog" section of the [readme.txt file](https://plugins.svn.wordpress.org/akismet/trunk/readme.txt).
|
||||
|
||||
= 4.2.5 =
|
||||
*Release Date - 11 July 2022*
|
||||
|
||||
* Fixed a bug that added unnecessary comment history entries after comment rechecks.
|
||||
* Added a notice that displays when WP-Cron is disabled and might be affecting comment rechecks.
|
||||
|
||||
= 4.2.4 =
|
||||
*Release Date - 20 May 2022*
|
||||
|
||||
* Improved translator instructions for comment history.
|
||||
* Bumped the "Tested up to" tag to WP 6.0.
|
||||
|
||||
= 4.2.3 =
|
||||
*Release Date - 25 April 2022*
|
||||
|
||||
* Improved compatibility with Fluent Forms
|
||||
* Fixed missing translation domains
|
||||
* Updated stats URL.
|
||||
* Improved accessibility of elements on the config page.
|
||||
|
||||
= 4.2.2 =
|
||||
*Release Date - 24 January 2022*
|
||||
|
||||
* Improved compatibility with Formidable Forms
|
||||
* Fixed a bug that could cause issues when multiple contact forms appear on one page.
|
||||
* Updated delete_comment and deleted_comment actions to pass two arguments to match WordPress core since 4.9.0.
|
||||
* Added a filter that allows comment types to be excluded when counting users' approved comments.
|
||||
|
||||
= 4.2.1 =
|
||||
*Release Date - 1 October 2021*
|
||||
|
||||
* Fixed a bug causing AMP validation to fail on certain pages with forms.
|
||||
|
||||
= 4.2 =
|
||||
*Release Date - 30 September 2021*
|
||||
|
||||
* Added links to additional information on API usage notifications.
|
||||
* Reduced the number of network requests required for a comment page when running Akismet.
|
||||
* Improved compatibility with the most popular contact form plugins.
|
||||
* Improved API usage buttons for clarity on what upgrade is needed.
|
||||
|
||||
= 4.1.12 =
|
||||
*Release Date - 3 September 2021*
|
||||
|
||||
* Fixed "Use of undefined constant" notice.
|
||||
* Improved styling of alert notices.
|
||||
|
||||
= 4.1.11 =
|
||||
*Release Date - 23 August 2021*
|
||||
|
||||
* Added support for Akismet API usage notifications on Akismet settings and edit-comments admin pages.
|
||||
* Added support for the deleted_comment action when bulk-deleting comments from Spam.
|
||||
|
||||
= 4.1.10 =
|
||||
*Release Date - 6 July 2021*
|
||||
|
||||
* Simplified the code around checking comments in REST API and XML-RPC requests.
|
||||
* Updated Plus plan terminology in notices to match current subscription names.
|
||||
* Added `rel="noopener"` to the widget link to avoid warnings in Google Lighthouse.
|
||||
* Set the Akismet JavaScript as deferred instead of async to improve responsiveness.
|
||||
* Improved the preloading of screenshot popups on the edit comments admin page.
|
||||
|
||||
= 4.1.9 =
|
||||
*Release Date - 2 March 2021*
|
||||
|
||||
* Improved handling of pingbacks in XML-RPC multicalls
|
||||
|
||||
= 4.1.8 =
|
||||
*Release Date - 6 January 2021*
|
||||
|
||||
* Fixed missing fields in submit-spam and submit-ham calls that could lead to reduced accuracy.
|
||||
* Fixed usage of deprecated jQuery function.
|
||||
|
||||
= 4.1.7 =
|
||||
*Release Date - 22 October 2020*
|
||||
|
||||
* Show the "Set up your Akismet account" banner on the comments admin screen, where it's relevant to mention if Akismet hasn't been configured.
|
||||
* Don't use wp_blacklist_check when the new wp_check_comment_disallowed_list function is available.
|
||||
|
||||
= 4.1.6 =
|
||||
*Release Date - 4 June 2020*
|
||||
|
||||
* Disable "Check for Spam" button until the page is loaded to avoid errors with clicking through to queue recheck endpoint directly.
|
||||
* Added filter "akismet_enable_mshots" to allow disabling screenshot popups on the edit comments admin page.
|
||||
|
||||
= 4.1.5 =
|
||||
*Release Date - 29 April 2020*
|
||||
|
||||
* Based on user feedback, we have dropped the in-admin notice explaining the availability of the "privacy notice" option in the AKismet settings screen. The option itself is available, but after displaying the notice for the last 2 years, it is now considered a known fact.
|
||||
* Updated the "Requires at least" to WP 4.6, based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet
|
||||
* Moved older changelog entries to a separate file to keep the size of this readme reasonable, also based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet
|
||||
|
||||
= 4.1.4 =
|
||||
*Release Date - 17 March 2020*
|
||||
|
||||
* Only redirect to the Akismet setup screen upon plugin activation if the plugin was activated manually from within the plugin-related screens, to help users with non-standard install workflows, like WP-CLI.
|
||||
* Update the layout of the initial setup screen to be more readable on small screens.
|
||||
* If no API key has been entered, don't run code that expects an API key.
|
||||
* Improve the readability of the comment history entries.
|
||||
* Don't modify the comment form HTML if no API key has been set.
|
||||
|
||||
= 4.1.3 =
|
||||
*Release Date - 31 October 2019*
|
||||
|
||||
* Prevented an attacker from being able to cause a user to unknowingly recheck their Pending comments for spam.
|
||||
* Improved compatibility with Jetpack 7.7+.
|
||||
* Updated the plugin activation page to use consistent language and markup.
|
||||
* Redirecting users to the Akismet connnection/settings screen upon plugin activation, in an effort to make it easier for people to get setup.
|
||||
|
||||
= 4.1.2 =
|
||||
*Release Date - 14 May 2019*
|
||||
|
||||
* Fixed a conflict between the Akismet setup banner and other plugin notices.
|
||||
* Reduced the number of API requests made by the plugin when attempting to verify the API key.
|
||||
* Include additional data in the pingback pre-check API request to help make the stats more accurate.
|
||||
* Fixed a bug that was enabling the "Check for Spam" button when no comments were eligible to be checked.
|
||||
* Improved Akismet's AMP compatibility.
|
||||
|
||||
= 4.1.1 =
|
||||
*Release Date - 31 January 2019*
|
||||
|
||||
* Fixed the "Setup Akismet" notice so it resizes responsively.
|
||||
* Only highlight the "Save Changes" button in the Akismet config when changes have been made.
|
||||
* The count of comments in your spam queue shown on the dashboard show now always be up-to-date.
|
||||
|
||||
= 4.1 =
|
||||
*Release Date - 12 November 2018*
|
||||
|
||||
* Added a WP-CLI method for retrieving stats.
|
||||
* Hooked into the new "Personal Data Eraser" functionality from WordPress 4.9.6.
|
||||
* Added functionality to clear outdated alerts from Akismet.com.
|
||||
|
||||
= 4.0.8 =
|
||||
*Release Date - 19 June 2018*
|
||||
|
||||
* Improved the grammar and consistency of the in-admin privacy related notes (notice and config).
|
||||
* Revised in-admin explanation of the comment form privacy notice to make its usage clearer.
|
||||
* Added `rel="nofollow noopener"` to the comment form privacy notice to improve SEO and security.
|
||||
|
||||
= 4.0.7 =
|
||||
*Release Date - 28 May 2018*
|
||||
|
||||
* Based on user feedback, the link on "Learn how your comment data is processed." in the optional privacy notice now has a `target` of `_blank` and opens in a new tab/window.
|
||||
* Updated the in-admin privacy notice to use the term "comment" instead of "contact" in "Akismet can display a notice to your users under your comment forms."
|
||||
* Only show in-admin privacy notice if Akismet has an API Key configured
|
||||
|
||||
= 4.0.6 =
|
||||
*Release Date - 26 May 2018*
|
||||
|
||||
* Moved away from using `empty( get_option() )` to instantiating a variable to be compatible with older versions of PHP (5.3, 5.4, etc).
|
||||
|
||||
= 4.0.5 =
|
||||
*Release Date - 26 May 2018*
|
||||
|
||||
* Corrected version number after tagging. Sorry...
|
||||
|
||||
= 4.0.4 =
|
||||
*Release Date - 26 May 2018*
|
||||
|
||||
* Added a hook to provide Akismet-specific privacy information for a site's privacy policy.
|
||||
* Added tools to control the display of a privacy related notice under comment forms.
|
||||
* Fixed HTML in activation failure message to close META and HEAD tag properly.
|
||||
* Fixed a bug that would sometimes prevent Akismet from being correctly auto-configured.
|
||||
|
||||
= 4.0.3 =
|
||||
*Release Date - 19 February 2018*
|
||||
|
||||
* Added a scheduled task to remove entries in wp_commentmeta that no longer have corresponding comments in wp_comments.
|
||||
* Added a new `akismet_batch_delete_count` action to the batch delete methods for people who'd like to keep track of the numbers of records being processed by those methods.
|
||||
|
||||
= 4.0.2 =
|
||||
*Release Date - 18 December 2017*
|
||||
|
||||
* Fixed a bug that could cause Akismet to recheck a comment that has already been manually approved or marked as spam.
|
||||
* Fixed a bug that could cause Akismet to claim that some comments are still waiting to be checked when no comments are waiting to be checked.
|
||||
|
||||
= 4.0.1 =
|
||||
*Release Date - 6 November 2017*
|
||||
|
||||
* Fixed a bug that could prevent some users from connecting Akismet via their Jetpack connection.
|
||||
* Ensured that any pending Akismet-related events are unscheduled if the plugin is deactivated.
|
||||
* Allow some JavaScript to be run asynchronously to avoid affecting page render speeds.
|
||||
|
||||
= 4.0 =
|
||||
*Release Date - 19 September 2017*
|
||||
|
||||
* Added REST API endpoints for configuring Akismet and retrieving stats.
|
||||
* Increased the minimum supported WordPress version to 4.0.
|
||||
* Added compatibility with comments submitted via the REST API.
|
||||
* Improved the progress indicator on the "Check for Spam" button.
|
||||
|
||||
= 3.3.4 =
|
||||
*Release Date - 3 August 2017*
|
||||
|
||||
* Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined.
|
||||
* URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin.
|
||||
* When a comment is caught by the Comment Blacklist, Akismet will always allow it to stay in the trash even if it is spam as well.
|
||||
* Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers.
|
||||
|
||||
= 3.3.3 =
|
||||
*Release Date - 13 July 2017*
|
||||
|
||||
* Reduced amount of bandwidth used by the URL Preview feature.
|
||||
* Improved the admin UI when the API key is manually pre-defined for the site.
|
||||
* Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins.
|
||||
* The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently.
|
||||
* Fixed a bug in the Akismet widget that could cause PHP warnings.
|
||||
|
||||
= 3.3.2 =
|
||||
*Release Date - 10 May 2017*
|
||||
|
||||
* Fixed a bug causing JavaScript errors in some browsers.
|
||||
|
||||
= 3.3.1 =
|
||||
*Release Date - 2 May 2017*
|
||||
|
||||
* Improve performance by only requesting the akismet_comment_nonce option when absolutely necessary.
|
||||
* Fixed two bugs that could cause PHP warnings.
|
||||
* Fixed a bug that was preventing the "Remove author URL" feature from working after a comment was edited using "Quick Edit."
|
||||
* Fixed a bug that was preventing the URL preview feature from working after a comment was edited using "Quick Edit."
|
||||
|
||||
= 3.3 =
|
||||
*Release Date - 23 February 2017*
|
||||
|
||||
* Updated the Akismet admin pages with a new clean design.
|
||||
* Fixed bugs preventing the `akismet_add_comment_nonce` and `akismet_update_alert` wrapper functions from working properly.
|
||||
* Fixed bug preventing the loading indicator from appearing when re-checking all comments for spam.
|
||||
* Added a progress indicator to the "Check for Spam" button.
|
||||
* Added a success message after manually rechecking the Pending queue for spam.
|
||||
|
||||
= 3.2 =
|
||||
*Release Date - 6 September 2016*
|
||||
|
||||
* Added a WP-CLI module. You can now check comments and recheck the moderation queue from the command line.
|
||||
* Stopped using the deprecated jQuery function `.live()`.
|
||||
* Fixed a bug in `remove_comment_author_url()` and `add_comment_author_url()` that could generate PHP notices.
|
||||
* Fixed a bug that could cause an infinite loop for sites with very very very large comment IDs.
|
||||
* Fixed a bug that could cause the Akismet widget title to be blank.
|
||||
|
||||
= 3.1.11 =
|
||||
*Release Date - 12 May 2016*
|
||||
|
||||
* Fixed a bug that could cause the "Check for Spam" button to skip some comments.
|
||||
* Fixed a bug that could prevent some spam submissions from being sent to Akismet.
|
||||
* Updated all links to use https:// when possible.
|
||||
* Disabled Akismet debug logging unless WP_DEBUG and WP_DEBUG_LOG are both enabled.
|
||||
|
||||
= 3.1.10 =
|
||||
*Release Date - 1 April 2016*
|
||||
|
||||
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
|
||||
* Fixed a bug that could have resulted in comments that were caught by the core WordPress comment blacklist not to have a corresponding History entry.
|
||||
* Fixed a bug that could have caused avoidable PHP warnings in the error log.
|
||||
|
||||
= 3.1.9 =
|
||||
*Release Date - 28 March 2016*
|
||||
|
||||
* Add compatibility with Jetpack so that Jetpack can automatically configure Akismet settings when appropriate.
|
||||
* Fixed a bug preventing some comment data from being sent to Akismet.
|
||||
|
||||
= 3.1.8 =
|
||||
*Release Date - 4 March 2016*
|
||||
|
||||
* Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs.
|
||||
* Reduced the amount of bandwidth used on Akismet API calls
|
||||
* Reduced the amount of space Akismet uses in the database
|
||||
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
|
||||
|
||||
= 3.1.7 =
|
||||
*Release Date - 4 January 2016*
|
||||
|
||||
* Added documentation for the 'akismet_comment_nonce' filter.
|
||||
* The post-install activation button is now accessible to screen readers and keyboard-only users.
|
||||
* Fixed a bug that was preventing the "Remove author URL" feature from working in WordPress 4.4
|
||||
|
||||
= 3.1.6 =
|
||||
*Release Date - 14 December 2015*
|
||||
|
||||
* Improve the notices shown after activating Akismet.
|
||||
* Update some strings to allow for the proper plural forms in all languages.
|
||||
|
||||
= 3.1.5 =
|
||||
*Release Date - 13 October 2015*
|
||||
|
||||
* Closes a potential XSS vulnerability.
|
||||
|
||||
= 3.1.4 =
|
||||
*Release Date - 24 September 2015*
|
||||
|
||||
* Fixed a bug that was preventing some users from automatically connecting using Jetpack if they didn't have a current Akismet subscription.
|
||||
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
|
||||
* Error messages and instructions have been simplified to be more understandable.
|
||||
* Link previews are enabled for all links inside comments, not just the author's website link.
|
||||
|
||||
= 3.1.3 =
|
||||
*Release Date - 6 July 2015*
|
||||
|
||||
* Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens.
|
||||
|
||||
= 3.1.2 =
|
||||
*Release Date - 7 June 2015*
|
||||
|
||||
* Reduced the amount of space Akismet uses in the commentmeta table.
|
||||
* Fixed a bug where some comments with quotes in the author name weren't getting history entries
|
||||
* Pre-emptive security improvements to ensure that the Akismet plugin can't be used by attackers to compromise a WordPress installation.
|
||||
* Better UI for the key entry field: allow whitespace to be included at the beginning or end of the key and strip it out automatically when the form is submitted.
|
||||
* When deactivating the plugin, notify the Akismet API so the site can be marked as inactive.
|
||||
* Clearer error messages.
|
||||
|
||||
= 3.1.1 =
|
||||
*Release Date - 17th March, 2015*
|
||||
|
||||
* Improvements to the "Remove comment author URL" JavaScript
|
||||
* Include the pingback pre-check from the 2.6 branch.
|
||||
|
||||
= 3.1 =
|
||||
*Release Date - 11th March, 2015*
|
||||
|
||||
* Use HTTPS by default for all requests to Akismet.
|
||||
* Fix for a situation where Akismet might strip HTML from a comment.
|
||||
|
||||
= 3.0.4 =
|
||||
*Release Date - 11th December, 2014*
|
||||
|
||||
* Fix to make .htaccess compatible with Apache 2.4.
|
||||
* Fix to allow removal of https author URLs.
|
||||
* Fix to avoid stripping part of the author URL when removing and re-adding.
|
||||
* Removed the "Check for Spam" button from the "Trash" and "Approved" queues, where it would have no effect.
|
||||
* Allow automatic API key configuration when Jetpack is installed and connected to a WordPress.com account
|
||||
|
||||
= 3.0.3 =
|
||||
*Release Date - 3rd November, 2014*
|
||||
|
||||
* Fix for sending the wrong data to delete_comment action that could have prevented old spam comments from being deleted.
|
||||
* Added a filter to disable logging of Akismet debugging information.
|
||||
* Added a filter for the maximum comment age when deleting old spam comments.
|
||||
* Added a filter for the number per batch when deleting old spam comments.
|
||||
* Removed the "Check for Spam" button from the Spam folder.
|
||||
|
||||
= 3.0.2 =
|
||||
*Release Date - 18th August, 2014*
|
||||
|
||||
* Performance improvements.
|
||||
* Fixed a bug that could truncate the comment data being sent to Akismet for checking.
|
||||
|
||||
= 3.0.1 =
|
||||
*Release Date - 9th July, 2014*
|
||||
|
||||
* Removed dependency on PHP's fsockopen function
|
||||
* Fix spam/ham reports to work when reported outside of the WP dashboard, e.g., from Notifications or the WP app
|
||||
* Remove jQuery dependency for comment form JavaScript
|
||||
* Remove unnecessary data from some Akismet comment meta
|
||||
* Suspended keys will now result in all comments being put in moderation, not spam.
|
||||
|
||||
= 3.0.0 =
|
||||
*Release Date - 15th April, 2014*
|
||||
|
||||
* Move Akismet to Settings menu
|
||||
* Drop Akismet Stats menu
|
||||
* Add stats snapshot to Akismet settings
|
||||
* Add Akismet subscription details and status to Akismet settings
|
||||
* Add contextual help for each page
|
||||
* Improve Akismet setup to use Jetpack to automate plugin setup
|
||||
* Fix "Check for Spam" to use AJAX to avoid page timing out
|
||||
* Fix Akismet settings page to be responsive
|
||||
* Drop legacy code
|
||||
* Tidy up CSS and Javascript
|
||||
* Replace the old discard setting with a new "discard pervasive spam" feature.
|
||||
|
||||
= 2.6.0 =
|
||||
*Release Date - 18th March, 2014*
|
||||
|
||||
* Add ajax paging to the check for spam button to handle large volumes of comments
|
||||
* Optimize javascript and add localization support
|
||||
* Fix bug in link to spam comments from right now dashboard widget
|
||||
* Fix bug with deleting old comments to avoid timeouts dealing with large volumes of comments
|
||||
* Include X-Pingback-Forwarded-For header in outbound WordPress pingback verifications
|
||||
* Add pre-check for pingbacks, to stop spam before an outbound verification request is made
|
||||
|
||||
= 2.5.9 =
|
||||
*Release Date - 1st August, 2013*
|
||||
|
||||
* Update 'Already have a key' link to redirect page rather than depend on javascript
|
||||
* Fix some non-translatable strings to be translatable
|
||||
* Update Activation banner in plugins page to redirect user to Akismet config page
|
||||
|
||||
= 2.5.8 =
|
||||
*Release Date - 20th January, 2013*
|
||||
|
||||
* Simplify the activation process for new users
|
||||
* Remove the reporter_ip parameter
|
||||
* Minor preventative security improvements
|
||||
|
||||
= 2.5.7 =
|
||||
*Release Date - 13th December, 2012*
|
||||
|
||||
* FireFox Stats iframe preview bug
|
||||
* Fix mshots preview when using https
|
||||
* Add .htaccess to block direct access to files
|
||||
* Prevent some PHP notices
|
||||
* Fix Check For Spam return location when referrer is empty
|
||||
* Fix Settings links for network admins
|
||||
* Fix prepare() warnings in WP 3.5
|
||||
|
||||
= 2.5.6 =
|
||||
*Release Date - 26th April, 2012*
|
||||
|
||||
* Prevent retry scheduling problems on sites where wp_cron is misbehaving
|
||||
* Preload mshot previews
|
||||
* Modernize the widget code
|
||||
* Fix a bug where comments were not held for moderation during an error condition
|
||||
* Improve the UX and display when comments are temporarily held due to an error
|
||||
* Make the Check For Spam button force a retry when comments are held due to an error
|
||||
* Handle errors caused by an invalid key
|
||||
* Don't retry comments that are too old
|
||||
* Improve error messages when verifying an API key
|
||||
|
||||
= 2.5.5 =
|
||||
*Release Date - 11th January, 2012*
|
||||
|
||||
* Add nonce check for comment author URL remove action
|
||||
* Fix the settings link
|
||||
|
||||
= 2.5.4 =
|
||||
*Release Date - 5th January, 2012*
|
||||
|
||||
* Limit Akismet CSS and Javascript loading in wp-admin to just the pages that need it
|
||||
* Added author URL quick removal functionality
|
||||
* Added mShot preview on Author URL hover
|
||||
* Added empty index.php to prevent directory listing
|
||||
* Move wp-admin menu items under Jetpack, if it is installed
|
||||
* Purge old Akismet comment meta data, default of 15 days
|
||||
|
||||
= 2.5.3 =
|
||||
*Release Date - 8th Febuary, 2011*
|
||||
|
||||
* Specify the license is GPL v2 or later
|
||||
* Fix a bug that could result in orphaned commentmeta entries
|
||||
* Include hotfix for WordPress 3.0.5 filter issue
|
||||
|
||||
= 2.5.2 =
|
||||
*Release Date - 14th January, 2011*
|
||||
|
||||
* Properly format the comment count for author counts
|
||||
* Look for super admins on multisite installs when looking up user roles
|
||||
* Increase the HTTP request timeout
|
||||
* Removed padding for author approved count
|
||||
* Fix typo in function name
|
||||
* Set Akismet stats iframe height to fixed 2500px. Better to have one tall scroll bar than two side by side.
|
||||
|
||||
= 2.5.1 =
|
||||
*Release Date - 17th December, 2010*
|
||||
|
||||
* Fix a bug that caused the "Auto delete" option to fail to discard comments correctly
|
||||
* Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce
|
||||
* Fixed padding bug in "author" column of posts screen
|
||||
* Added margin-top to "cleared by ..." badges on dashboard
|
||||
* Fix possible error when calling akismet_cron_recheck()
|
||||
* Fix more PHP warnings
|
||||
* Clean up XHTML warnings for comment nonce
|
||||
* Fix for possible condition where scheduled comment re-checks could get stuck
|
||||
* Clean up the comment meta details after deleting a comment
|
||||
* Only show the status badge if the comment status has been changed by someone/something other than Akismet
|
||||
* Show a 'History' link in the row-actions
|
||||
* Translation fixes
|
||||
* Reduced font-size on author name
|
||||
* Moved "flagged by..." notification to top right corner of comment container and removed heavy styling
|
||||
* Hid "flagged by..." notification while on dashboard
|
||||
|
||||
= 2.5.0 =
|
||||
*Release Date - 7th December, 2010*
|
||||
|
||||
* Track comment actions under 'Akismet Status' on the edit comment screen
|
||||
* Fix a few remaining deprecated function calls ( props Mike Glendinning )
|
||||
* Use HTTPS for the stats IFRAME when wp-admin is using HTTPS
|
||||
* Use the WordPress HTTP class if available
|
||||
* Move the admin UI code to a separate file, only loaded when needed
|
||||
* Add cron retry feature, to replace the old connectivity check
|
||||
* Display Akismet status badge beside each comment
|
||||
* Record history for each comment, and display it on the edit page
|
||||
* Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham
|
||||
* Highlight links in comment content
|
||||
* New option, "Show the number of comments you've approved beside each comment author."
|
||||
* New option, "Use a nonce on the comment form."
|
||||
|
||||
= 2.4.0 =
|
||||
*Release Date - 23rd August, 2010*
|
||||
|
||||
* Spell out that the license is GPLv2
|
||||
* Fix PHP warnings
|
||||
* Fix WordPress deprecated function calls
|
||||
* Fire the delete_comment action when deleting comments
|
||||
* Move code specific for older WP versions to legacy.php
|
||||
* General code clean up
|
||||
|
||||
= 2.3.0 =
|
||||
*Release Date - 5th June, 2010*
|
||||
|
||||
* Fix "Are you sure" nonce message on config screen in WPMU
|
||||
* Fix XHTML compliance issue in sidebar widget
|
||||
* Change author link; remove some old references to WordPress.com accounts
|
||||
* Localize the widget title (core ticket #13879)
|
||||
|
||||
= 2.2.9 =
|
||||
*Release Date - 2nd June, 2010*
|
||||
|
||||
* Eliminate a potential conflict with some plugins that may cause spurious reports
|
||||
|
||||
= 2.2.8 =
|
||||
*Release Date - 27th May, 2010*
|
||||
|
||||
* Fix bug in initial comment check for ipv6 addresses
|
||||
* Report comments as ham when they are moved from spam to moderation
|
||||
* Report comments as ham when clicking undo after spam
|
||||
* Use transition_comment_status action when available instead of older actions for spam/ham submissions
|
||||
* Better diagnostic messages when PHP network functions are unavailable
|
||||
* Better handling of comments by logged-in users
|
||||
|
||||
= 2.2.7 =
|
||||
*Release Date - 17th December, 2009*
|
||||
|
||||
* Add a new AKISMET_VERSION constant
|
||||
* Reduce the possibility of over-counting spam when another spam filter plugin is in use
|
||||
* Disable the connectivity check when the API key is hard-coded for WPMU
|
||||
|
||||
= 2.2.6 =
|
||||
*Release Date - 20th July, 2009*
|
||||
|
||||
* Fix a global warning introduced in 2.2.5
|
||||
* Add changelog and additional readme.txt tags
|
||||
* Fix an array conversion warning in some versions of PHP
|
||||
* Support a new WPCOM_API_KEY constant for easier use with WordPress MU
|
||||
|
||||
= 2.2.5 =
|
||||
*Release Date - 13th July, 2009*
|
||||
|
||||
* Include a new Server Connectivity diagnostic check, to detect problems caused by firewalls
|
||||
|
||||
= 2.2.4 =
|
||||
*Release Date - 3rd June, 2009*
|
||||
|
||||
* Fixed a key problem affecting the stats feature in WordPress MU
|
||||
* Provide additional blog information in Akismet API calls
|
||||
91
plugins/akismet/class-akismet-abilities.php
Normal file
91
plugins/akismet/class-akismet-abilities.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Registers Akismet abilities with the WordPress Abilities API.
|
||||
*
|
||||
* @package Akismet
|
||||
* @since 5.7
|
||||
*/
|
||||
|
||||
declare( strict_types = 1 );
|
||||
|
||||
// Load ability interface and classes.
|
||||
require_once __DIR__ . '/abilities/interface-akismet-ability.php';
|
||||
require_once __DIR__ . '/abilities/class-akismet-ability.php';
|
||||
require_once __DIR__ . '/abilities/class-akismet-ability-get-stats.php';
|
||||
require_once __DIR__ . '/abilities/class-akismet-ability-comment-check.php';
|
||||
|
||||
/**
|
||||
* Class Akismet_Abilities
|
||||
*
|
||||
* Registers Akismet abilities with the WordPress Abilities API.
|
||||
* Provides abilities for spam detection and comment moderation.
|
||||
*/
|
||||
class Akismet_Abilities {
|
||||
|
||||
/**
|
||||
* The category slug for Akismet abilities.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const CATEGORY_SLUG = 'akismet';
|
||||
|
||||
/**
|
||||
* Initialize the ability registration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
// Register category.
|
||||
if ( did_action( 'wp_abilities_api_categories_init' ) ) {
|
||||
self::register_category();
|
||||
} else {
|
||||
add_action( 'wp_abilities_api_categories_init', array( __CLASS__, 'register_category' ) );
|
||||
}
|
||||
|
||||
// Register abilities.
|
||||
if ( did_action( 'wp_abilities_api_init' ) ) {
|
||||
self::register_abilities();
|
||||
} else {
|
||||
add_action( 'wp_abilities_api_init', array( __CLASS__, 'register_abilities' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Akismet ability category.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_category() {
|
||||
if ( ! function_exists( 'wp_register_ability_category' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_register_ability_category(
|
||||
self::CATEGORY_SLUG,
|
||||
array(
|
||||
'label' => 'Akismet',
|
||||
'description' => __( 'Abilities for spam protection and comment moderation with Akismet.', 'akismet' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all Akismet abilities.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_abilities() {
|
||||
if ( ! function_exists( 'wp_register_ability' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$abilities = array(
|
||||
Akismet_Ability_Get_Stats::class,
|
||||
Akismet_Ability_Comment_Check::class,
|
||||
);
|
||||
|
||||
foreach ( $abilities as $ability_class ) {
|
||||
new $ability_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
309
plugins/akismet/class-akismet-compatible-plugins.php
Normal file
309
plugins/akismet/class-akismet-compatible-plugins.php
Normal file
@@ -0,0 +1,309 @@
|
||||
<?php
|
||||
/**
|
||||
* Handles compatibility checks for Akismet with other plugins.
|
||||
*
|
||||
* @package Akismet
|
||||
* @since 5.4.0
|
||||
*/
|
||||
|
||||
declare( strict_types = 1 );
|
||||
|
||||
// Following existing Akismet convention for file naming.
|
||||
// phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase
|
||||
|
||||
/**
|
||||
* Class for managing compatibility checks for Akismet with other plugins.
|
||||
*
|
||||
* This class includes methods for determining whether specific plugins are
|
||||
* installed and active relative to the ability to work with Akismet.
|
||||
*/
|
||||
class Akismet_Compatible_Plugins {
|
||||
/**
|
||||
* The endpoint for the compatible plugins API.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected const COMPATIBLE_PLUGIN_ENDPOINT = 'https://rest.akismet.com/1.2/compatible-plugins';
|
||||
|
||||
/**
|
||||
* The error key for the compatible plugins API error.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected const COMPATIBLE_PLUGIN_API_ERROR = 'akismet_compatible_plugins_api_error';
|
||||
|
||||
/**
|
||||
* The valid fields for a compatible plugin object.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected const COMPATIBLE_PLUGIN_FIELDS = array(
|
||||
'slug',
|
||||
'name',
|
||||
'logo',
|
||||
'help_url',
|
||||
'path',
|
||||
);
|
||||
|
||||
/**
|
||||
* The cache key for the compatible plugins.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected const CACHE_KEY = 'akismet_compatible_plugin_list';
|
||||
|
||||
|
||||
/**
|
||||
* How many plugins should be visible by default?
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public const DEFAULT_VISIBLE_PLUGIN_COUNT = 2;
|
||||
|
||||
/**
|
||||
* Get the list of active, installed compatible plugins.
|
||||
*
|
||||
* @param bool $bypass_cache Whether to bypass the cache and fetch fresh data.
|
||||
* @return WP_Error|array {
|
||||
* Array of active, installed compatible plugins with their metadata.
|
||||
* @type string $name The display name of the plugin
|
||||
* @type string $help_url URL to the plugin's help documentation
|
||||
* @type string $logo URL or path to the plugin's logo
|
||||
* }
|
||||
*/
|
||||
public static function get_installed_compatible_plugins( bool $bypass_cache = false ) {
|
||||
// Retrieve and validate the full compatible plugins list.
|
||||
$compatible_plugins = static::get_compatible_plugins( $bypass_cache );
|
||||
|
||||
if ( empty( $compatible_plugins ) ) {
|
||||
return new WP_Error(
|
||||
self::COMPATIBLE_PLUGIN_API_ERROR,
|
||||
__( 'Error getting compatible plugins.', 'akismet' )
|
||||
);
|
||||
}
|
||||
|
||||
// Retrieve all installed plugins once.
|
||||
$all_plugins = get_plugins();
|
||||
|
||||
// Build list of compatible plugins that are both installed and active.
|
||||
$active_compatible_plugins = array();
|
||||
|
||||
foreach ( $compatible_plugins as $slug => $data ) {
|
||||
$path = $data['path'];
|
||||
// Skip if not installed.
|
||||
if ( ! isset( $all_plugins[ $path ] ) ) {
|
||||
continue;
|
||||
}
|
||||
// Check activation: per-site or network-wide (multisite).
|
||||
$site_active = is_plugin_active( $path );
|
||||
$network_active = is_multisite() && is_plugin_active_for_network( $path );
|
||||
if ( $site_active || $network_active ) {
|
||||
$active_compatible_plugins[ $slug ] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
return $active_compatible_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes action hooks for the class.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init(): void {
|
||||
add_action( 'activated_plugin', array( static::class, 'handle_plugin_change' ), true );
|
||||
add_action( 'deactivated_plugin', array( static::class, 'handle_plugin_change' ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles plugin activation and deactivation events.
|
||||
*
|
||||
* @param string $plugin The path to the main plugin file from plugins directory.
|
||||
* @return void
|
||||
*/
|
||||
public static function handle_plugin_change( string $plugin ): void {
|
||||
$cached_plugins = static::get_cached_plugins();
|
||||
|
||||
/**
|
||||
* Terminate if nothing's cached.
|
||||
*/
|
||||
if ( false === $cached_plugins ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$plugin_change_should_invalidate_cache = in_array( $plugin, array_column( $cached_plugins, 'path' ) );
|
||||
|
||||
/**
|
||||
* Purge the cache if the plugin is activated or deactivated.
|
||||
*/
|
||||
if ( $plugin_change_should_invalidate_cache ) {
|
||||
static::purge_cache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets plugins that are compatible with Akismet from the Akismet API.
|
||||
*
|
||||
* @param bool $bypass_cache Whether to bypass the cache and fetch fresh data.
|
||||
* @return array
|
||||
*/
|
||||
private static function get_compatible_plugins( bool $bypass_cache = false ): array {
|
||||
// Return cached result if present (false => cache miss; empty array is valid).
|
||||
$cached_plugins = static::get_cached_plugins();
|
||||
|
||||
if ( false !== $cached_plugins && ! $bypass_cache ) {
|
||||
return $cached_plugins;
|
||||
}
|
||||
|
||||
$response = wp_remote_get(
|
||||
self::COMPATIBLE_PLUGIN_ENDPOINT
|
||||
);
|
||||
|
||||
$sanitized = static::validate_compatible_plugin_response( $response );
|
||||
|
||||
if ( false === $sanitized ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets local static associative array of plugin data keyed by plugin slug.
|
||||
*/
|
||||
$compatible_plugins = array();
|
||||
|
||||
foreach ( $sanitized as $plugin ) {
|
||||
$compatible_plugins[ $plugin['slug'] ] = $plugin;
|
||||
}
|
||||
|
||||
static::set_cached_plugins( $compatible_plugins );
|
||||
|
||||
return $compatible_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a response object from the Compatible Plugins API.
|
||||
*
|
||||
* @param array|WP_Error $response
|
||||
* @return array|false
|
||||
*/
|
||||
private static function validate_compatible_plugin_response( $response ) {
|
||||
/**
|
||||
* Terminates the function if the response is a WP_Error object.
|
||||
*/
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The response returned is an array of header + body string data.
|
||||
* This pops off the body string for processing.
|
||||
*/
|
||||
$response_body = wp_remote_retrieve_body( $response );
|
||||
|
||||
if ( empty( $response_body ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$plugins = json_decode( $response_body, true );
|
||||
|
||||
if ( false === is_array( $plugins ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $plugins as $plugin ) {
|
||||
if ( ! is_array( $plugin ) ) {
|
||||
/**
|
||||
* Skips to the next iteration if for some reason the plugin is not an array.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ensure that the plugin config read in from the API has all the required fields.
|
||||
$plugin_key_count = count(
|
||||
array_intersect_key( $plugin, array_flip( static::COMPATIBLE_PLUGIN_FIELDS ) )
|
||||
);
|
||||
|
||||
$does_not_have_all_required_fields = ! (
|
||||
$plugin_key_count === count( static::COMPATIBLE_PLUGIN_FIELDS )
|
||||
);
|
||||
|
||||
if ( $does_not_have_all_required_fields ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( false === static::has_valid_plugin_path( $plugin['path'] ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return static::sanitize_compatible_plugin_response( $plugins );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a plugin path format.
|
||||
*
|
||||
* The path should be in the format of 'plugin-name/plugin-name.php'.
|
||||
* Allows alphanumeric characters, dashes, underscores, and optional dots in folder names.
|
||||
*
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
private static function has_valid_plugin_path( string $path ): bool {
|
||||
return preg_match( '/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9_-]+\.php$/', $path ) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a response object from the Compatible Plugins API.
|
||||
*
|
||||
* @param array $plugins
|
||||
* @return array
|
||||
*/
|
||||
private static function sanitize_compatible_plugin_response( array $plugins = array() ): array {
|
||||
foreach ( $plugins as $key => $plugin ) {
|
||||
$plugins[ $key ] = array_map( 'sanitize_text_field', $plugin );
|
||||
$plugins[ $key ]['help_url'] = sanitize_url( $plugins[ $key ]['help_url'] );
|
||||
$plugins[ $key ]['logo'] = sanitize_url( $plugins[ $key ]['logo'] );
|
||||
}
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $plugins
|
||||
* @return bool
|
||||
*/
|
||||
private static function set_cached_plugins( array $plugins ): bool {
|
||||
$_blog_id = (int) get_current_blog_id();
|
||||
|
||||
return set_transient(
|
||||
static::CACHE_KEY . "_$_blog_id",
|
||||
$plugins,
|
||||
DAY_IN_SECONDS
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to get cached compatible plugins.
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
private static function get_cached_plugins() {
|
||||
$_blog_id = (int) get_current_blog_id();
|
||||
|
||||
return get_transient(
|
||||
static::CACHE_KEY . "_$_blog_id"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges the cache for the compatible plugins.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function purge_cache(): bool {
|
||||
$_blog_id = (int) get_current_blog_id();
|
||||
|
||||
return delete_transient(
|
||||
static::CACHE_KEY . "_$_blog_id"
|
||||
);
|
||||
}
|
||||
}
|
||||
147
plugins/akismet/class-akismet-connector.php
Normal file
147
plugins/akismet/class-akismet-connector.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* Akismet Connector integration.
|
||||
*
|
||||
* @package Akismet
|
||||
*/
|
||||
|
||||
declare( strict_types = 1 );
|
||||
|
||||
/**
|
||||
* Integrates Akismet with the WordPress Connectors framework,
|
||||
* handling API key validation and connection status reporting.
|
||||
*/
|
||||
class Akismet_Connector {
|
||||
|
||||
/**
|
||||
* Register hooks for the WordPress Connectors integration.
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'wp_connectors_init', array( 'Akismet_Connector', 'register_connector' ) );
|
||||
|
||||
// Priority 9 so we validate the real key before core's connector masking filter at priority 10.
|
||||
add_filter( 'rest_post_dispatch', array( 'Akismet_Connector', 'validate_api_key' ), 9, 3 );
|
||||
add_filter( 'script_module_data_options-connectors-wp-admin', array( 'Akismet_Connector', 'set_connected_status' ), 11 );
|
||||
|
||||
// Invalidate the connector key status cache on any key change.
|
||||
foreach ( array( 'add', 'update', 'delete' ) as $action ) {
|
||||
add_action( "{$action}_option_wordpress_api_key", array( 'Akismet_Connector', 'invalidate_key_status_cache' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Akismet API key when saved via the connectors REST settings endpoint.
|
||||
* If the key is invalid, revert it to an empty string.
|
||||
*
|
||||
* @param WP_REST_Response $response The response object.
|
||||
* @param WP_REST_Server $server The server instance.
|
||||
* @param WP_REST_Request $request The request object.
|
||||
* @return WP_REST_Response
|
||||
*/
|
||||
public static function validate_api_key( $response, $server, $request ) {
|
||||
if ( '/wp/v2/settings' !== $request->get_route() ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
if ( 'POST' !== $request->get_method() && 'PUT' !== $request->get_method() ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$data = $response->get_data();
|
||||
if ( ! is_array( $data ) || ! array_key_exists( 'wordpress_api_key', $data ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$key = $data['wordpress_api_key'];
|
||||
if ( ! is_string( $key ) || '' === $key ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
if ( Akismet::KEY_STATUS_INVALID === Akismet::verify_key( $key ) ) {
|
||||
update_option( 'wordpress_api_key', '' );
|
||||
$data['wordpress_api_key'] = '';
|
||||
$response->set_data( $data );
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the isConnected status for the Akismet connector based on actual key validity.
|
||||
*
|
||||
* @param array $data Script module data.
|
||||
* @return array
|
||||
*/
|
||||
public static function set_connected_status( $data ) {
|
||||
if ( ! isset( $data['connectors']['akismet']['authentication'] ) ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$key = Akismet::get_api_key();
|
||||
|
||||
if ( empty( $key ) ) {
|
||||
$data['connectors']['akismet']['authentication']['isConnected'] = false;
|
||||
return $data;
|
||||
}
|
||||
|
||||
$is_connected = get_transient( 'akismet_connector_key_status' );
|
||||
|
||||
if ( false === $is_connected ) {
|
||||
$is_connected = Akismet::verify_key( $key );
|
||||
|
||||
// Don't cache failures (e.g. network timeouts) so we retry on the next page load.
|
||||
if ( Akismet::KEY_STATUS_FAILED !== $is_connected ) {
|
||||
set_transient( 'akismet_connector_key_status', $is_connected, DAY_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
|
||||
$data['connectors']['akismet']['authentication']['isConnected'] = ( Akismet::KEY_STATUS_VALID === $is_connected );
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the connector key status cache so it doesn't serve stale data.
|
||||
*/
|
||||
public static function invalidate_key_status_cache() {
|
||||
delete_transient( 'akismet_connector_key_status' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Akismet connector with an is_active callback so the
|
||||
* connectors page can detect Akismet as active when installed as a mu-plugin.
|
||||
*
|
||||
* We re-register the full connector rather than patching the core one
|
||||
* so that Akismet still has a connector even if core removes its own.
|
||||
*
|
||||
* @see https://github.com/WordPress/gutenberg/pull/76994
|
||||
*
|
||||
* @param WP_Connector_Registry $registry Connector registry instance.
|
||||
*/
|
||||
public static function register_connector( $registry ) {
|
||||
if ( method_exists( $registry, 'is_registered' ) && $registry->is_registered( 'akismet' ) ) {
|
||||
$registry->unregister( 'akismet' );
|
||||
}
|
||||
|
||||
$registry->register(
|
||||
'akismet',
|
||||
array(
|
||||
'name' => __( 'Akismet Anti-spam', 'akismet' ),
|
||||
'description' => __( 'Protect your site from spam.', 'akismet' ),
|
||||
'type' => 'spam_filtering',
|
||||
'plugin' => array(
|
||||
'file' => 'akismet/akismet.php',
|
||||
'is_active' => function () {
|
||||
return defined( 'AKISMET_VERSION' );
|
||||
},
|
||||
),
|
||||
'authentication' => array(
|
||||
'method' => 'api_key',
|
||||
'credentials_url' => 'https://akismet.com/get/',
|
||||
'setting_name' => 'wordpress_api_key',
|
||||
'constant_name' => 'WPCOM_API_KEY',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
1657
plugins/akismet/class.akismet-admin.php
Normal file
1657
plugins/akismet/class.akismet-admin.php
Normal file
File diff suppressed because it is too large
Load Diff
186
plugins/akismet/class.akismet-cli.php
Normal file
186
plugins/akismet/class.akismet-cli.php
Normal file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
WP_CLI::add_command( 'akismet', 'Akismet_CLI' );
|
||||
|
||||
/**
|
||||
* Filter spam comments.
|
||||
*/
|
||||
class Akismet_CLI extends WP_CLI_Command {
|
||||
/**
|
||||
* Checks one or more comments against the Akismet API.
|
||||
*
|
||||
* ## OPTIONS
|
||||
* <comment_id>...
|
||||
* : The ID(s) of the comment(s) to check.
|
||||
*
|
||||
* [--noaction]
|
||||
* : Don't change the status of the comment. Just report what Akismet thinks it is.
|
||||
*
|
||||
* ## EXAMPLES
|
||||
*
|
||||
* wp akismet check 12345
|
||||
*
|
||||
* @alias comment-check
|
||||
*/
|
||||
public function check( $args, $assoc_args ) {
|
||||
foreach ( $args as $comment_id ) {
|
||||
if ( isset( $assoc_args['noaction'] ) ) {
|
||||
// Check the comment, but don't reclassify it.
|
||||
$api_response = Akismet::check_db_comment( $comment_id, 'wp-cli' );
|
||||
} else {
|
||||
$api_response = Akismet::recheck_comment( $comment_id, 'wp-cli' );
|
||||
}
|
||||
|
||||
if ( 'true' === $api_response ) {
|
||||
/* translators: %d: Comment ID. */
|
||||
WP_CLI::line( sprintf( __( 'Comment #%d is spam.', 'akismet' ), $comment_id ) );
|
||||
} elseif ( 'false' === $api_response ) {
|
||||
/* translators: %d: Comment ID. */
|
||||
WP_CLI::line( sprintf( __( 'Comment #%d is not spam.', 'akismet' ), $comment_id ) );
|
||||
} elseif ( false === $api_response ) {
|
||||
/* translators: %d: Comment ID. */
|
||||
WP_CLI::error( __( 'Failed to connect to Akismet.', 'akismet' ) );
|
||||
} elseif ( is_wp_error( $api_response ) ) {
|
||||
/* translators: %d: Comment ID. */
|
||||
WP_CLI::warning( sprintf( __( 'Comment #%d could not be checked.', 'akismet' ), $comment_id ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recheck all comments in the Pending queue.
|
||||
*
|
||||
* ## EXAMPLES
|
||||
*
|
||||
* wp akismet recheck_queue
|
||||
*
|
||||
* @alias recheck-queue
|
||||
*/
|
||||
public function recheck_queue() {
|
||||
$batch_size = 100;
|
||||
$start = 0;
|
||||
|
||||
$total_counts = array();
|
||||
|
||||
do {
|
||||
$result_counts = Akismet_Admin::recheck_queue_portion( $start, $batch_size );
|
||||
|
||||
if ( $result_counts['processed'] > 0 ) {
|
||||
foreach ( $result_counts as $key => $count ) {
|
||||
if ( ! isset( $total_counts[ $key ] ) ) {
|
||||
$total_counts[ $key ] = $count;
|
||||
} else {
|
||||
$total_counts[ $key ] += $count;
|
||||
}
|
||||
}
|
||||
$start += $batch_size;
|
||||
$start -= $result_counts['spam']; // These comments will have been removed from the queue.
|
||||
}
|
||||
} while ( $result_counts['processed'] > 0 );
|
||||
|
||||
/* translators: %d: Number of comments. */
|
||||
WP_CLI::line( sprintf( _n( 'Processed %d comment.', 'Processed %d comments.', $total_counts['processed'], 'akismet' ), number_format( $total_counts['processed'] ) ) );
|
||||
|
||||
/* translators: %d: Number of comments. */
|
||||
WP_CLI::line( sprintf( _n( '%d comment moved to Spam.', '%d comments moved to Spam.', $total_counts['spam'], 'akismet' ), number_format( $total_counts['spam'] ) ) );
|
||||
|
||||
if ( $total_counts['error'] ) {
|
||||
/* translators: %d: Number of comments. */
|
||||
WP_CLI::line( sprintf( _n( '%d comment could not be checked.', '%d comments could not be checked.', $total_counts['error'], 'akismet' ), number_format( $total_counts['error'] ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches stats from the Akismet API.
|
||||
*
|
||||
* ## OPTIONS
|
||||
*
|
||||
* [<interval>]
|
||||
* : The time period for which to retrieve stats.
|
||||
* ---
|
||||
* default: all
|
||||
* options:
|
||||
* - days
|
||||
* - months
|
||||
* - all
|
||||
* ---
|
||||
*
|
||||
* [--format=<format>]
|
||||
* : Allows overriding the output of the command when listing connections.
|
||||
* ---
|
||||
* default: table
|
||||
* options:
|
||||
* - table
|
||||
* - json
|
||||
* - csv
|
||||
* - yaml
|
||||
* - count
|
||||
* ---
|
||||
*
|
||||
* [--summary]
|
||||
* : When set, will display a summary of the stats.
|
||||
*
|
||||
* ## EXAMPLES
|
||||
*
|
||||
* wp akismet stats
|
||||
* wp akismet stats all
|
||||
* wp akismet stats days
|
||||
* wp akismet stats months
|
||||
* wp akismet stats all --summary
|
||||
*/
|
||||
public function stats( $args, $assoc_args ) {
|
||||
$api_key = Akismet::get_api_key();
|
||||
|
||||
if ( empty( $api_key ) ) {
|
||||
WP_CLI::error( __( 'API key must be set to fetch stats.', 'akismet' ) );
|
||||
}
|
||||
|
||||
switch ( $args[0] ) {
|
||||
case 'days':
|
||||
$interval = '60-days';
|
||||
break;
|
||||
case 'months':
|
||||
$interval = '6-months';
|
||||
break;
|
||||
default:
|
||||
$interval = 'all';
|
||||
break;
|
||||
}
|
||||
|
||||
$request_args = array(
|
||||
'blog' => get_option( 'home' ),
|
||||
'key' => $api_key,
|
||||
'from' => $interval,
|
||||
);
|
||||
|
||||
$request_args = apply_filters( 'akismet_request_args', $request_args, 'get-stats' );
|
||||
|
||||
$response = Akismet::http_post( Akismet::build_query( $request_args ), 'get-stats' );
|
||||
|
||||
if ( empty( $response[1] ) ) {
|
||||
WP_CLI::error( __( 'Currently unable to fetch stats. Please try again.', 'akismet' ) );
|
||||
}
|
||||
|
||||
$response_body = json_decode( $response[1], true );
|
||||
|
||||
if ( is_null( $response_body ) ) {
|
||||
WP_CLI::error( __( 'Stats response could not be decoded.', 'akismet' ) );
|
||||
}
|
||||
|
||||
if ( isset( $assoc_args['summary'] ) ) {
|
||||
$keys = array(
|
||||
'spam',
|
||||
'ham',
|
||||
'missed_spam',
|
||||
'false_positives',
|
||||
'accuracy',
|
||||
'time_saved',
|
||||
);
|
||||
|
||||
WP_CLI\Utils\format_items( $assoc_args['format'], array( $response_body ), $keys );
|
||||
} else {
|
||||
$stats = $response_body['breakdown'];
|
||||
WP_CLI\Utils\format_items( $assoc_args['format'], $stats, array_keys( end( $stats ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
623
plugins/akismet/class.akismet-rest-api.php
Normal file
623
plugins/akismet/class.akismet-rest-api.php
Normal file
@@ -0,0 +1,623 @@
|
||||
<?php
|
||||
|
||||
class Akismet_REST_API {
|
||||
/**
|
||||
* Register the REST API routes.
|
||||
*/
|
||||
public static function init() {
|
||||
if ( ! function_exists( 'register_rest_route' ) ) {
|
||||
// The REST API wasn't integrated into core until 4.4, and we support 4.0+ (for now).
|
||||
return false;
|
||||
}
|
||||
|
||||
register_rest_route(
|
||||
'akismet/v1',
|
||||
'/key',
|
||||
array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_key' ),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'set_key' ),
|
||||
'args' => array(
|
||||
'key' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
|
||||
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/account', 'akismet' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::DELETABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'delete_key' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
'akismet/v1',
|
||||
'/settings/',
|
||||
array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_settings' ),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'set_boolean_settings' ),
|
||||
'args' => array(
|
||||
'akismet_strictness' => array(
|
||||
'required' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'If true, Akismet will automatically discard the worst spam automatically rather than putting it in the spam folder.', 'akismet' ),
|
||||
),
|
||||
'akismet_show_user_comments_approved' => array(
|
||||
'required' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'If true, show the number of approved comments beside each comment author in the comments list page.', 'akismet' ),
|
||||
),
|
||||
'akismet_enable_mcp_access' => array(
|
||||
'required' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'If true, allow MCP clients to access Akismet data and functionality.', 'akismet' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
'akismet/v1',
|
||||
'/stats',
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
|
||||
'args' => array(
|
||||
'interval' => array(
|
||||
'required' => false,
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_interval' ),
|
||||
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
|
||||
'default' => 'all',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
'akismet/v1',
|
||||
'/stats/(?P<interval>[\w+])',
|
||||
array(
|
||||
'args' => array(
|
||||
'interval' => array(
|
||||
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
'akismet/v1',
|
||||
'/alert',
|
||||
array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_alert' ),
|
||||
'args' => array(
|
||||
'key' => array(
|
||||
'required' => false,
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
|
||||
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/account', 'akismet' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'set_alert' ),
|
||||
'args' => array(
|
||||
'key' => array(
|
||||
'required' => false,
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
|
||||
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/account', 'akismet' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::DELETABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'delete_alert' ),
|
||||
'args' => array(
|
||||
'key' => array(
|
||||
'required' => false,
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
|
||||
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/account', 'akismet' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
'akismet/v1',
|
||||
'/webhook',
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
'callback' => array( 'Akismet_REST_API', 'receive_webhook' ),
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current Akismet API key.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function get_key( $request = null ) {
|
||||
return rest_ensure_response( Akismet::get_api_key() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API key, if possible.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function set_key( $request ) {
|
||||
if ( defined( 'WPCOM_API_KEY' ) ) {
|
||||
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be changed via the API.', 'akismet' ), array( 'status' => 409 ) ) );
|
||||
}
|
||||
|
||||
$new_api_key = $request->get_param( 'key' );
|
||||
|
||||
if ( ! self::key_is_valid( $new_api_key ) ) {
|
||||
return rest_ensure_response( new WP_Error( 'invalid_key', __( 'The value provided is not a valid and registered API key.', 'akismet' ), array( 'status' => 400 ) ) );
|
||||
}
|
||||
|
||||
update_option( 'wordpress_api_key', $new_api_key );
|
||||
|
||||
return self::get_key();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the API key, if possible.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function delete_key( $request ) {
|
||||
if ( defined( 'WPCOM_API_KEY' ) ) {
|
||||
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be deleted.', 'akismet' ), array( 'status' => 409 ) ) );
|
||||
}
|
||||
|
||||
delete_option( 'wordpress_api_key' );
|
||||
|
||||
return rest_ensure_response( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Akismet settings.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function get_settings( $request = null ) {
|
||||
return rest_ensure_response(
|
||||
array(
|
||||
'akismet_strictness' => ( get_option( 'akismet_strictness', '1' ) === '1' ),
|
||||
'akismet_show_user_comments_approved' => ( get_option( 'akismet_show_user_comments_approved', '1' ) === '1' ),
|
||||
'akismet_enable_mcp_access' => ( get_option( 'akismet_enable_mcp_access', '0' ) === '1' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Akismet settings.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function set_boolean_settings( $request ) {
|
||||
foreach ( array(
|
||||
'akismet_strictness',
|
||||
'akismet_show_user_comments_approved',
|
||||
'akismet_enable_mcp_access',
|
||||
) as $setting_key ) {
|
||||
|
||||
$setting_value = $request->get_param( $setting_key );
|
||||
if ( is_null( $setting_value ) ) {
|
||||
// This setting was not specified.
|
||||
continue;
|
||||
}
|
||||
|
||||
// From 4.7+, WP core will ensure that these are always boolean
|
||||
// values because they are registered with 'type' => 'boolean',
|
||||
// but we need to do this ourselves for prior versions.
|
||||
$setting_value = self::parse_boolean( $setting_value );
|
||||
|
||||
update_option( $setting_key, $setting_value ? '1' : '0' );
|
||||
}
|
||||
|
||||
return self::get_settings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a numeric or string boolean value into a boolean.
|
||||
*
|
||||
* @param mixed $value The value to convert into a boolean.
|
||||
* @return bool The converted value.
|
||||
*/
|
||||
public static function parse_boolean( $value ) {
|
||||
switch ( $value ) {
|
||||
case true:
|
||||
case 'true':
|
||||
case '1':
|
||||
case 1:
|
||||
return true;
|
||||
|
||||
case false:
|
||||
case 'false':
|
||||
case '0':
|
||||
case 0:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return (bool) $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Akismet stats for a given time period.
|
||||
*
|
||||
* Possible `interval` values:
|
||||
* - all
|
||||
* - 60-days
|
||||
* - 6-months
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function get_stats( $request ) {
|
||||
$api_key = Akismet::get_api_key();
|
||||
|
||||
$interval = $request->get_param( 'interval' );
|
||||
|
||||
$stat_totals = array();
|
||||
|
||||
$request_args = array(
|
||||
'blog' => get_option( 'home' ),
|
||||
'key' => $api_key,
|
||||
'from' => $interval,
|
||||
);
|
||||
|
||||
$request_args = apply_filters( 'akismet_request_args', $request_args, 'get-stats' );
|
||||
|
||||
$response = Akismet::http_post( Akismet::build_query( $request_args ), 'get-stats' );
|
||||
|
||||
if ( ! empty( $response[1] ) ) {
|
||||
$stat_totals[ $interval ] = json_decode( $response[1] );
|
||||
}
|
||||
|
||||
return rest_ensure_response( $stat_totals );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current alert code and message. Alert codes are used to notify the site owner
|
||||
* if there's a problem, like a connection issue between their site and the Akismet API,
|
||||
* invalid requests being sent, etc.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function get_alert( $request ) {
|
||||
return rest_ensure_response(
|
||||
array(
|
||||
'code' => get_option( 'akismet_alert_code' ),
|
||||
'message' => get_option( 'akismet_alert_msg' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current alert code and message by triggering a call to the Akismet server.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function set_alert( $request ) {
|
||||
delete_option( 'akismet_alert_code' );
|
||||
delete_option( 'akismet_alert_msg' );
|
||||
|
||||
// Make a request so the most recent alert code and message are retrieved.
|
||||
Akismet::verify_key( Akismet::get_api_key() );
|
||||
|
||||
return self::get_alert( $request );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the current alert code and message.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function delete_alert( $request ) {
|
||||
delete_option( 'akismet_alert_code' );
|
||||
delete_option( 'akismet_alert_msg' );
|
||||
|
||||
return self::get_alert( $request );
|
||||
}
|
||||
|
||||
private static function key_is_valid( $key ) {
|
||||
$request_args = array(
|
||||
'key' => $key,
|
||||
'blog' => get_option( 'home' ),
|
||||
);
|
||||
|
||||
$request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-key' );
|
||||
|
||||
$response = Akismet::http_post( Akismet::build_query( $request_args ), 'verify-key' );
|
||||
|
||||
if ( $response[1] == 'valid' ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function privileged_permission_callback() {
|
||||
return current_user_can( 'manage_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* For calls that Akismet.com makes to the site to clear outdated alert codes, use the API key for authorization.
|
||||
*/
|
||||
public static function remote_call_permission_callback( $request ) {
|
||||
$local_key = Akismet::get_api_key();
|
||||
|
||||
return $local_key && ( strtolower( $request->get_param( 'key' ) ?? '' ) === strtolower( $local_key ) );
|
||||
}
|
||||
|
||||
public static function sanitize_interval( $interval, $request, $param ) {
|
||||
$interval = trim( $interval );
|
||||
|
||||
$valid_intervals = array( '60-days', '6-months', 'all' );
|
||||
|
||||
if ( ! in_array( $interval, $valid_intervals ) ) {
|
||||
$interval = 'all';
|
||||
}
|
||||
|
||||
return $interval;
|
||||
}
|
||||
|
||||
public static function sanitize_key( $key, $request, $param ) {
|
||||
return trim( $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a webhook request from the Akismet servers.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function receive_webhook( $request ) {
|
||||
Akismet::log( array( 'Webhook request received', $request->get_body() ) );
|
||||
|
||||
/**
|
||||
* The request body should look like this:
|
||||
* array(
|
||||
* 'key' => '1234567890abcd',
|
||||
* 'endpoint' => '[comment-check|submit-ham|submit-spam]',
|
||||
* 'comments' => array(
|
||||
* array(
|
||||
* 'guid' => '[...]',
|
||||
* 'result' => '[true|false]',
|
||||
* 'comment_author' => '[...]',
|
||||
* [...]
|
||||
* ),
|
||||
* array(
|
||||
* 'guid' => '[...]',
|
||||
* [...],
|
||||
* ),
|
||||
* [...]
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* Multiple comments can be included in each request, and the only truly required
|
||||
* field for each is the guid, although it would be friendly to include also
|
||||
* comment_post_ID, comment_parent, and comment_author_email, if possible to make
|
||||
* searching easier.
|
||||
*/
|
||||
|
||||
// The response will include statuses for the result of each comment that was supplied.
|
||||
$response = array(
|
||||
'comments' => array(),
|
||||
);
|
||||
|
||||
$endpoint = $request->get_param( 'endpoint' );
|
||||
|
||||
switch ( $endpoint ) {
|
||||
case 'comment-check':
|
||||
$webhook_comments = $request->get_param( 'comments' );
|
||||
|
||||
if ( ! is_array( $webhook_comments ) ) {
|
||||
return rest_ensure_response( new WP_Error( 'malformed_request', __( 'The \'comments\' parameter must be an array.', 'akismet' ), array( 'status' => 400 ) ) );
|
||||
}
|
||||
|
||||
foreach ( $webhook_comments as $webhook_comment ) {
|
||||
$guid = $webhook_comment['guid'];
|
||||
|
||||
if ( ! $guid ) {
|
||||
// Without the GUID, we can't be sure that we're matching the right comment.
|
||||
// We'll make it a rule that any comment without a GUID is ignored intentionally.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Search on the fields that are indexed in the comments table, plus the GUID.
|
||||
// The GUID is the only thing we really need to search on, but comment_meta
|
||||
// is not indexed in a useful way if there are many many comments. This
|
||||
// should help narrow it down first.
|
||||
$queryable_fields = array(
|
||||
'comment_post_ID' => 'post_id',
|
||||
'comment_parent' => 'parent',
|
||||
'comment_author_email' => 'author_email',
|
||||
);
|
||||
|
||||
$query_args = array();
|
||||
$query_args['status'] = 'any';
|
||||
$query_args['meta_key'] = 'akismet_guid';
|
||||
$query_args['meta_value'] = $guid;
|
||||
|
||||
foreach ( $queryable_fields as $queryable_field => $wp_comment_query_field ) {
|
||||
if ( isset( $webhook_comment[ $queryable_field ] ) ) {
|
||||
$query_args[ $wp_comment_query_field ] = $webhook_comment[ $queryable_field ];
|
||||
}
|
||||
}
|
||||
|
||||
$comments_query = new WP_Comment_Query( $query_args );
|
||||
$comments = $comments_query->comments;
|
||||
|
||||
if ( ! $comments ) {
|
||||
// Unexpected, although the comment could have been deleted since being submitted.
|
||||
Akismet::log( 'Webhook failed: no matching comment found.' );
|
||||
|
||||
$response['comments'][ $guid ] = array(
|
||||
'status' => 'error',
|
||||
'message' => __( 'Could not find matching comment.', 'akismet' ),
|
||||
);
|
||||
|
||||
continue;
|
||||
} if ( count( $comments ) > 1 ) {
|
||||
// Two comments shouldn't be able to match the same GUID.
|
||||
Akismet::log( 'Webhook failed: multiple matching comments found.', $comments );
|
||||
|
||||
$response['comments'][ $guid ] = array(
|
||||
'status' => 'error',
|
||||
'message' => __( 'Multiple comments matched request.', 'akismet' ),
|
||||
);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
// We have one single match, as hoped for.
|
||||
Akismet::log( 'Found matching comment.', $comments );
|
||||
|
||||
$comment = $comments[0];
|
||||
|
||||
$current_status = wp_get_comment_status( $comment );
|
||||
|
||||
$result = $webhook_comment['result'];
|
||||
|
||||
if ( 'true' == $result ) {
|
||||
Akismet::log( 'Comment should be spam' );
|
||||
|
||||
// The comment should be classified as spam.
|
||||
if ( 'spam' != $current_status ) {
|
||||
// The comment is not classified as spam. If Akismet was the one to act on it, move it to spam.
|
||||
if ( Akismet::last_comment_status_change_came_from_akismet( $comment->comment_ID ) ) {
|
||||
Akismet::log( 'Comment is not spam; marking as spam.' );
|
||||
|
||||
wp_spam_comment( $comment );
|
||||
Akismet::update_comment_history( $comment->comment_ID, '', 'webhook-spam' );
|
||||
} else {
|
||||
Akismet::log( 'Comment is not spam, but it has already been manually handled by some other process.' );
|
||||
Akismet::update_comment_history( $comment->comment_ID, '', 'webhook-spam-noaction' );
|
||||
}
|
||||
}
|
||||
} elseif ( 'false' == $result ) {
|
||||
Akismet::log( 'Comment should be ham' );
|
||||
|
||||
// The comment should be classified as ham.
|
||||
if ( 'spam' == $current_status ) {
|
||||
Akismet::log( 'Comment is spam.' );
|
||||
|
||||
// The comment is classified as spam. If Akismet was the one to label it as spam, unspam it.
|
||||
if ( Akismet::last_comment_status_change_came_from_akismet( $comment->comment_ID ) ) {
|
||||
Akismet::log( 'Akismet marked it as spam; unspamming.' );
|
||||
|
||||
wp_unspam_comment( $comment );
|
||||
|
||||
akismet::update_comment_history( $comment->comment_ID, '', 'webhook-ham' );
|
||||
} else {
|
||||
Akismet::log( 'Comment is not spam, but it has already been manually handled by some other process.' );
|
||||
Akismet::update_comment_history( $comment->comment_ID, '', 'webhook-ham-noaction' );
|
||||
}
|
||||
} else if ( 'unapproved' == $current_status ) {
|
||||
Akismet::log( 'Comment is pending.' );
|
||||
|
||||
// The comment is in Pending. If Akismet was the one to put it there, approve it (but only if the site
|
||||
// settings dictate that).
|
||||
if ( Akismet::last_comment_status_change_came_from_akismet( $comment->comment_ID ) ) {
|
||||
Akismet::log( 'Akismet marked it as Pending; approving.' );
|
||||
|
||||
if ( check_comment( $comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent, $comment->comment_type ) ) {
|
||||
wp_set_comment_status( $comment->comment_ID, 1 );
|
||||
}
|
||||
|
||||
akismet::update_comment_history( $comment->comment_ID, '', 'webhook-ham' );
|
||||
} else {
|
||||
Akismet::log( 'Comment is not spam, but it has already been manually handled by some other process.' );
|
||||
Akismet::update_comment_history( $comment->comment_ID, '', 'webhook-ham-noaction' );
|
||||
}
|
||||
}
|
||||
|
||||
$moderation_email_was_delayed = get_comment_meta( $comment->comment_ID, 'akismet_delayed_moderation_email', true );
|
||||
|
||||
if ( $moderation_email_was_delayed ) {
|
||||
Akismet::log( 'Moderation email was delayed for comment #' . $comment->comment_ID . '; sending now.' );
|
||||
|
||||
delete_comment_meta( $comment->comment_ID, 'akismet_delayed_moderation_email' );
|
||||
wp_new_comment_notify_moderator( $comment->comment_ID );
|
||||
wp_new_comment_notify_postauthor( $comment->comment_ID );
|
||||
}
|
||||
|
||||
delete_comment_meta( $comment->comment_ID, 'akismet_delay_moderation_email' );
|
||||
}
|
||||
|
||||
$response['comments'][ $guid ] = array( 'status' => 'success' );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'submit-ham':
|
||||
case 'submit-spam':
|
||||
// Nothing to do for submit-ham or submit-spam.
|
||||
break;
|
||||
default:
|
||||
// Unsupported endpoint.
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow plugins to do things with a successfully processed webhook request, like logging.
|
||||
*
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param WP_REST_Request $request The REST request object.
|
||||
*/
|
||||
do_action( 'akismet_webhook_received', $request );
|
||||
|
||||
Akismet::log( 'Done processing webhook.' );
|
||||
|
||||
return rest_ensure_response( $response );
|
||||
}
|
||||
}
|
||||
177
plugins/akismet/class.akismet-widget.php
Normal file
177
plugins/akismet/class.akismet-widget.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Akismet
|
||||
*/
|
||||
|
||||
// We plan to gradually remove all of the disabled lint rules below.
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Akismet Widget Class
|
||||
*/
|
||||
class Akismet_Widget extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct() {
|
||||
parent::__construct(
|
||||
'akismet_widget',
|
||||
__( 'Akismet Widget', 'akismet' ),
|
||||
array( 'description' => __( 'Display the number of spam comments Akismet has caught', 'akismet' ) )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the widget settings form
|
||||
*
|
||||
* @param array $instance The widget options
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
if ( $instance && isset( $instance['title'] ) ) {
|
||||
$title = $instance['title'];
|
||||
} else {
|
||||
$title = __( 'Spam Blocked', 'akismet' );
|
||||
}
|
||||
?>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'akismet' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the widget settings
|
||||
*
|
||||
* @param array $new_instance New widget instance
|
||||
* @param array $old_instance Old widget instance
|
||||
* @return array Updated widget instance
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
$instance = array();
|
||||
$instance['title'] = sanitize_text_field( $new_instance['title'] );
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the widget content
|
||||
*
|
||||
* @param array $args Widget arguments
|
||||
* @param array $instance Widget instance
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
$count = get_option( 'akismet_spam_count' );
|
||||
|
||||
if ( ! isset( $instance['title'] ) ) {
|
||||
$instance['title'] = __( 'Spam Blocked', 'akismet' );
|
||||
}
|
||||
|
||||
echo $args['before_widget'];
|
||||
if ( ! empty( $instance['title'] ) ) {
|
||||
echo $args['before_title'];
|
||||
echo esc_html( $instance['title'] );
|
||||
echo $args['after_title'];
|
||||
}
|
||||
?>
|
||||
|
||||
<style>
|
||||
.a-stats {
|
||||
--akismet-color-mid-green: #357b49;
|
||||
--akismet-color-white: #fff;
|
||||
--akismet-color-light-grey: #f6f7f7;
|
||||
|
||||
max-width: 350px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.a-stats * {
|
||||
all: unset;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.a-stats strong {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.a-stats a.a-stats__link,
|
||||
.a-stats a.a-stats__link:visited,
|
||||
.a-stats a.a-stats__link:active {
|
||||
background: var(--akismet-color-mid-green);
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
border-radius: 8px;
|
||||
color: var(--akismet-color-white);
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
|
||||
font-weight: 500;
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
/* Extra specificity to deal with TwentyTwentyOne focus style */
|
||||
.widget .a-stats a.a-stats__link:focus {
|
||||
background: var(--akismet-color-mid-green);
|
||||
color: var(--akismet-color-white);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.a-stats a.a-stats__link:hover {
|
||||
filter: brightness(110%);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 0 2px rgba(0, 0, 0, 0.16);
|
||||
}
|
||||
|
||||
.a-stats .count {
|
||||
color: var(--akismet-color-white);
|
||||
display: block;
|
||||
font-size: 1.5em;
|
||||
line-height: 1.4;
|
||||
padding: 0 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="a-stats">
|
||||
<a href="https://akismet.com?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=widget_stats" class="a-stats__link" target="_blank" rel="noopener" style="background-color: var(--akismet-color-mid-green); color: var(--akismet-color-white);">
|
||||
<?php
|
||||
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
/* translators: The placeholder is the number of pieces of spam blocked by Akismet. */
|
||||
_n(
|
||||
'<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>',
|
||||
'<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>',
|
||||
$count,
|
||||
'akismet'
|
||||
),
|
||||
number_format_i18n( $count )
|
||||
),
|
||||
array(
|
||||
'strong' => array(
|
||||
'class' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
echo $args['after_widget'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Akismet widget
|
||||
*/
|
||||
function akismet_register_widgets() {
|
||||
register_widget( 'Akismet_Widget' );
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'akismet_register_widgets' );
|
||||
2419
plugins/akismet/class.akismet.php
Normal file
2419
plugins/akismet/class.akismet.php
Normal file
File diff suppressed because it is too large
Load Diff
4
plugins/akismet/index.php
Normal file
4
plugins/akismet/index.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
declare( strict_types = 1 );
|
||||
|
||||
// Silence is golden.
|
||||
160
plugins/akismet/readme.txt
Normal file
160
plugins/akismet/readme.txt
Normal file
@@ -0,0 +1,160 @@
|
||||
=== Akismet Anti-spam: Spam Protection ===
|
||||
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau, kbrownkd, bluefuton, derekspringer, lschuyler, andyperdomo, akismetantispam
|
||||
Tags: comments, spam, antispam, anti-spam, contact form
|
||||
Requires at least: 5.8
|
||||
Tested up to: 7.0
|
||||
Stable tag: 5.7
|
||||
License: GPLv2 or later
|
||||
|
||||
The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce.
|
||||
|
||||
== Description ==
|
||||
|
||||
The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce.
|
||||
|
||||
Akismet checks your comments and contact form submissions against our global database of spam to prevent your site from publishing malicious content. You can review the comment spam it catches on your blog's "Comments" admin screen.
|
||||
|
||||
Major features in Akismet include:
|
||||
|
||||
* Automatically checks all comments and filters out the ones that look like spam.
|
||||
* Each comment has a status history, so you can easily see which comments were caught or cleared by Akismet and which were spammed or unspammed by a moderator.
|
||||
* URLs are shown in the comment body to reveal hidden or misleading links.
|
||||
* Moderators can see the number of approved comments for each user.
|
||||
* A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site.
|
||||
|
||||
PS: You'll be prompted to get an Akismet.com API key to use it, once activated. Keys are free for personal blogs; paid subscriptions are available for businesses and commercial sites.
|
||||
|
||||
== Installation ==
|
||||
|
||||
Upload the Akismet plugin to your blog, activate it, and then enter your Akismet.com API key.
|
||||
|
||||
1, 2, 3: You're done!
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 5.7 =
|
||||
*Release Date - 23 April 2026*
|
||||
|
||||
* Add Abilities API support for stats and comment checking, including MCP tool integration.
|
||||
* Add support for the new Connectors page in the upcoming WordPress 7.0.
|
||||
* Improve detection of automated spam submissions on the front end.
|
||||
* Make comment history sorting more resilient when called with invalid data.
|
||||
* Use wp_get_inline_script_tag() for safer inline script output, and other small security enhancements.
|
||||
* Add action hooks to allow customization of the admin page header and footer.
|
||||
* Accessibility improvements.
|
||||
|
||||
= 5.6 =
|
||||
*Release Date - 12 November 2025*
|
||||
|
||||
* Improve caching of compatible plugins.
|
||||
* Explain the key features of Akismet more clearly on the setup page.
|
||||
* Improve the configuration process to better explain errors when they occur.
|
||||
* Setup UI cleanup and refresh.
|
||||
* Improve messaging related to usage limits.
|
||||
|
||||
= 5.5 =
|
||||
*Release Date - 15 July 2025*
|
||||
|
||||
* Enable webhooks so that Akismet can process comments asynchronously to detect more types of spam.
|
||||
* Only include the Akismet widget CSS when the Akismet widget is present
|
||||
* Improve contrast/readability for certain UI elements
|
||||
|
||||
= 5.4 =
|
||||
*Release Date - 7 May 2025*
|
||||
|
||||
* The stats pages now use the user's locale instead of the site's locale if they're different.
|
||||
* Adds a 'Compatible plugins' section that will show installed and active plugins that are compatible with Akismet.
|
||||
* Akismet now requires PHP version 7.2 or above.
|
||||
|
||||
= 5.3.7 =
|
||||
*Release Date - 14 February 2025*
|
||||
|
||||
* Simplify the logic used during a comment-check request to compare comments.
|
||||
|
||||
= 5.3.6 =
|
||||
*Release Date - 4 February 2025*
|
||||
|
||||
* Improve the utility of submit-spam and submit-ham requests.
|
||||
* Modernize styles for the Akismet classic widget.
|
||||
|
||||
= 5.3.5 =
|
||||
*Release Date - 18 November 2024*
|
||||
|
||||
* Address compatibility issues with < PHP 7.3 in v5.3.4 release.
|
||||
|
||||
= 5.3.4 =
|
||||
*Release Date - 18 November 2024*
|
||||
|
||||
* Improve activation notice on Comments for users who haven't set up their API key yet.
|
||||
* Improve notice about commercial site status.
|
||||
|
||||
= 5.3.3 =
|
||||
*Release Date - 10 July 2024*
|
||||
|
||||
* Make setup step clearer for new users.
|
||||
* Remove the stats section from the configuration page if the site has been revoked from the key.
|
||||
* Skip the Akismet comment check when the comment matches something in the disallowed list.
|
||||
* Prompt users on legacy plans to contact Akismet support for upgrades.
|
||||
|
||||
= 5.3.2 =
|
||||
*Release Date - 21 March 2024*
|
||||
|
||||
* Improve the empty state shown to new users when no spam has been caught yet.
|
||||
* Update the message shown to users without a current subscription.
|
||||
* Add foundations for future webhook support.
|
||||
|
||||
= 5.3.1 =
|
||||
*Release Date - 17 January 2024*
|
||||
|
||||
* Make the plugin more resilient when asset files are missing (as seen in WordPress Playground).
|
||||
* Add a link to the 'Account overview' page on akismet.com.
|
||||
* Fix a minor error that occurs when another plugin removes all comment actions from the dashboard.
|
||||
* Add the akismet_request_args filter to allow request args in Akismet API requests to be filtered.
|
||||
* Fix a bug that causes some contact forms to include unnecessary data in the comment_content parameter.
|
||||
|
||||
= 5.3 =
|
||||
*Release Date - 14 September 2023*
|
||||
|
||||
* Improve display of user notices.
|
||||
* Add stylesheets for RTL languages.
|
||||
* Remove initial disabled state from 'Save changes' button.
|
||||
* Improve accessibility of API key entry form.
|
||||
* Add new filter hooks for Fluent Forms.
|
||||
* Fix issue with PHP 8.1 compatibility.
|
||||
|
||||
= 5.2 =
|
||||
*Release Date - 21 June 2023*
|
||||
|
||||
* Visual refresh of Akismet stats.
|
||||
* Improve PHP 8.1 compatibility.
|
||||
* Improve appearance of plugin to match updated stats.
|
||||
* Change minimum supported PHP version to 5.6 to match WordPress.
|
||||
* Drop IE11 support and update minimum WordPress version to 5.8 (where IE11 support was removed from WP Core).
|
||||
|
||||
= 5.1 =
|
||||
*Release Date - 20 March 2023*
|
||||
|
||||
* Removed unnecessary limit notices from admin page.
|
||||
* Improved spam detection by including post taxonomies in the comment-check call.
|
||||
* Removed API keys from stats iframes to avoid possible inadvertent exposure.
|
||||
|
||||
= 5.0.2 =
|
||||
*Release Date - 1 December 2022*
|
||||
|
||||
* Improved compatibility with themes that hide or show UI elements based on mouse movements.
|
||||
* Increased security of API keys by sending them in request bodies instead of subdomains.
|
||||
|
||||
= 5.0.1 =
|
||||
*Release Date - 28 September 2022*
|
||||
|
||||
* Added an empty state for the Statistics section on the admin page.
|
||||
* Fixed a bug that broke some admin page links when Jetpack plugins are active.
|
||||
* Marked some event listeners as passive to improve performance in newer browsers.
|
||||
* Disabled interaction observation on forms that post to other domains.
|
||||
|
||||
= 5.0 =
|
||||
*Release Date - 26 July 2022*
|
||||
|
||||
* Added a new feature to catch spammers by observing how they interact with the page.
|
||||
|
||||
For older changelog entries, please see the [additional changelog.txt file](https://plugins.svn.wordpress.org/akismet/trunk/changelog.txt) delivered with the plugin.
|
||||
7
plugins/akismet/views/activate.php
Normal file
7
plugins/akismet/views/activate.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="akismet-box">
|
||||
<?php Akismet::view( 'setup' ); ?>
|
||||
</div>
|
||||
|
||||
<div class="akismet-box">
|
||||
<?php Akismet::view( 'enter' ); ?>
|
||||
</div>
|
||||
125
plugins/akismet/views/compatible-plugins.php
Normal file
125
plugins/akismet/views/compatible-plugins.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
/** @var array|WP_Error $compatible_plugins */
|
||||
$bypass_cache = ! empty( $_GET['akismet_refresh_compatible_plugins'] );
|
||||
$compatible_plugins = Akismet_Compatible_Plugins::get_installed_compatible_plugins( $bypass_cache );
|
||||
if ( is_array( $compatible_plugins ) ) :
|
||||
|
||||
$compatible_plugin_count = count( $compatible_plugins );
|
||||
?>
|
||||
<div class="akismet-card akismet-compatible-plugins">
|
||||
<div class="akismet-section-header">
|
||||
<h2 class="akismet-section-header__label akismet-compatible-plugins__section-header-label">
|
||||
<?php esc_html_e( 'Compatible plugins', 'akismet' ); ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="akismet-compatible-plugins__content">
|
||||
<?php
|
||||
|
||||
echo '<p>';
|
||||
echo esc_html( __( 'Akismet works with other plugins to keep spam away.', 'akismet' ) );
|
||||
echo '</p>';
|
||||
|
||||
echo '<p>';
|
||||
|
||||
if ( 0 === $compatible_plugin_count ) {
|
||||
echo '<a class="akismet-external-link" href="https://akismet.com/developers/plugins-and-libraries/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=compatible_plugins">';
|
||||
echo esc_html( __( 'See supported integrations', 'akismet' ) );
|
||||
echo '</a>';
|
||||
} else {
|
||||
echo esc_html(
|
||||
_n(
|
||||
"This plugin you've installed is compatible. Follow the documentation link to get started.",
|
||||
"These plugins you've installed are compatible. Follow the documentation links to get started.",
|
||||
$compatible_plugin_count,
|
||||
'akismet'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
echo '</p>';
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( ! empty( $compatible_plugins ) ) : ?>
|
||||
<ul class="akismet-compatible-plugins__list" id="akismet-compatible-plugins__list">
|
||||
<?php
|
||||
|
||||
foreach ( $compatible_plugins as $compatible_plugin ) :
|
||||
if ( empty( $compatible_plugin['help_url'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="akismet-compatible-plugins__card">
|
||||
<?php if ( strlen( $compatible_plugin['logo'] ) > 0 ) : ?>
|
||||
<?php
|
||||
|
||||
$logo_alt = sprintf(
|
||||
/* translators: The placeholder is the name of a plugin, like "Jetpack" . */
|
||||
__( '%s logo', 'akismet' ),
|
||||
$compatible_plugin['name']
|
||||
);
|
||||
|
||||
?>
|
||||
<img
|
||||
src="<?php echo esc_url( $compatible_plugin['logo'] ); ?>"
|
||||
alt="<?php echo esc_attr( $logo_alt ); ?>"
|
||||
class="akismet-compatible-plugins__card-logo"
|
||||
width="36"
|
||||
height="36"
|
||||
/>
|
||||
<?php endif ?>
|
||||
<div class="akismet-compatible-plugins__card-detail">
|
||||
<h3 class="akismet-compatible-plugins__card-title"><?php echo esc_html( $compatible_plugin['name'] ); ?></h3>
|
||||
<div class="akismet-compatible-plugins__docs">
|
||||
<a
|
||||
class="akismet-external-link"
|
||||
href="<?php echo esc_url( $compatible_plugin['help_url'] ); ?>"
|
||||
aria-label="
|
||||
<?php
|
||||
|
||||
echo esc_attr(
|
||||
sprintf(
|
||||
/* translators: The placeholder is the name of a plugin, like "Jetpack" . */
|
||||
__( 'Documentation for %s', 'akismet' ),
|
||||
$compatible_plugin['name']
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
"><?php esc_html_e( 'View documentation', 'akismet' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php if ( $compatible_plugin_count > Akismet_Compatible_Plugins::DEFAULT_VISIBLE_PLUGIN_COUNT ) : ?>
|
||||
<button class="akismet-compatible-plugins__show-more"
|
||||
aria-expanded="false"
|
||||
aria-controls="akismet-compatible-plugins__list"
|
||||
data-label-closed="
|
||||
<?php
|
||||
|
||||
/* translators: %d: number of compatible plugins, which is guaranteed to be more than 1. */
|
||||
echo esc_attr( sprintf( __( 'Show all %d plugins', 'akismet' ), $compatible_plugin_count ) );
|
||||
|
||||
?>
|
||||
"
|
||||
data-label-open="<?php echo esc_attr( __( 'Show less', 'akismet' ) ); ?>">
|
||||
<?php
|
||||
|
||||
/* translators: %d: number of compatible plugins, which is guaranteed to be more than 1. */
|
||||
echo esc_html( sprintf( __( 'Show all %d plugins', 'akismet' ), $compatible_plugin_count ) );
|
||||
|
||||
?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
353
plugins/akismet/views/config.php
Normal file
353
plugins/akismet/views/config.php
Normal file
@@ -0,0 +1,353 @@
|
||||
<?php
|
||||
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
$kses_allow_link_href = array(
|
||||
'a' => array(
|
||||
'href' => true,
|
||||
),
|
||||
);
|
||||
?>
|
||||
<div id="akismet-plugin-container">
|
||||
<?php if ( has_action( 'akismet_header' ) ) : ?>
|
||||
<?php do_action( 'akismet_header' ); ?>
|
||||
<?php else : ?>
|
||||
<div class="akismet-masthead">
|
||||
<div class="akismet-masthead__inside-container">
|
||||
<?php Akismet::view( 'logo' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="akismet-lower">
|
||||
<?php if ( Akismet::get_api_key() ) { ?>
|
||||
<?php Akismet_Admin::display_status(); ?>
|
||||
<?php } ?>
|
||||
<?php if ( ! empty( $notices ) ) { ?>
|
||||
<?php foreach ( $notices as $notice ) { ?>
|
||||
<?php Akismet::view( 'notice', array_merge( $notice, array( 'parent_view' => $name ) ) ); ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( isset( $stat_totals['all'] ) && isset( $stat_totals['6-months'] ) ) : ?>
|
||||
<div class="akismet-card">
|
||||
<div class="akismet-section-header">
|
||||
<h2 class="akismet-section-header__label">
|
||||
<span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span>
|
||||
</h2>
|
||||
</div> <!-- close akismet-section-header -->
|
||||
|
||||
<div class="akismet-new-snapshot">
|
||||
<?php /* name attribute on iframe is used as a cache-buster here to force Firefox to load the new style charts: https://bugzilla.mozilla.org/show_bug.cgi?id=356558 */ ?>
|
||||
<div class="akismet-new-snapshot__chart">
|
||||
<iframe id="stats-iframe" allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/snapshot.php?blog=%s&token=%s&height=200&locale=%s&is_redecorated=1', rawurlencode( get_option( 'home' ) ), rawurlencode( Akismet::get_access_token() ), get_user_locale() ) ); ?>" name="<?php echo esc_attr( 'snapshot-' . filemtime( __FILE__ ) ); ?>" title="<?php echo esc_attr__( 'Akismet stats', 'akismet' ); ?>"></iframe>
|
||||
</div>
|
||||
|
||||
<ul class="akismet-new-snapshot__list">
|
||||
<li class="akismet-new-snapshot__item">
|
||||
<h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3>
|
||||
<span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span>
|
||||
<span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span>
|
||||
</li>
|
||||
<li class="akismet-new-snapshot__item">
|
||||
<h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3>
|
||||
<span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span>
|
||||
<span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span>
|
||||
</li>
|
||||
<li class="akismet-new-snapshot__item">
|
||||
<h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3>
|
||||
<span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
|
||||
<span class="akismet-new-snapshot__text">
|
||||
<?php
|
||||
/* translators: %s: number of spam missed by Akismet */
|
||||
echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', ';
|
||||
/* translators: %s: number of false positive spam flagged by Akismet */
|
||||
echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) );
|
||||
?>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- close akismet-new-snapshot -->
|
||||
|
||||
<a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>" class="akismet-stats-footer">
|
||||
<?php esc_html_e( 'View detailed stats', 'akismet' ); ?>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<polyline points="9 18 15 12 9 6"/>
|
||||
</svg>
|
||||
</a>
|
||||
</div> <!-- close akismet-card -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( apply_filters( 'akismet_show_compatible_plugins', true ) ) : ?>
|
||||
<?php Akismet::view( 'compatible-plugins' ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $akismet_user ) : ?>
|
||||
<div class="akismet-card">
|
||||
<div class="akismet-section-header">
|
||||
<h2 class="akismet-section-header__label">
|
||||
<span><?php esc_html_e( 'Settings', 'akismet' ); ?></span>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="inside">
|
||||
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" autocomplete="off" method="POST" id="akismet-settings-form">
|
||||
|
||||
<div class="akismet-settings">
|
||||
<?php if ( ! Akismet::predefined_api_key() ) : ?>
|
||||
<div class="akismet-settings__row">
|
||||
<h3 class="akismet-settings__row-title">
|
||||
<label class="akismet-settings__row-label" for="key"><?php esc_html_e( 'API key', 'akismet' ); ?></label>
|
||||
</h3>
|
||||
<div class="akismet-settings__row-input">
|
||||
<div class="akismet-api-key-wrapper">
|
||||
<input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option( 'wordpress_api_key' ) ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>">
|
||||
<button type="button" class="akismet-api-key-copy" aria-label="<?php esc_attr_e( 'Copy API key', 'akismet' ); ?>">
|
||||
<?php include plugin_dir_path( __FILE__ ) . '../_inc/img/copy.svg'; ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_GET['ssl_status'] ) ) :
|
||||
?>
|
||||
<div class="akismet-settings__row">
|
||||
<div class="akismet-settings__row-text">
|
||||
<h3 class="akismet-settings__row-title"><?php esc_html_e( 'SSL status', 'akismet' ); ?></h3>
|
||||
<div class="akismet-settings__row-description">
|
||||
<?php if ( ! wp_http_supports( array( 'ssl' ) ) ) : ?>
|
||||
<strong><?php esc_html_e( 'Disabled.', 'akismet' ); ?></strong>
|
||||
<?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?>
|
||||
<?php else : ?>
|
||||
<?php $ssl_disabled = get_option( 'akismet_ssl_disabled' ); ?>
|
||||
|
||||
<?php if ( $ssl_disabled ) : ?>
|
||||
<strong><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></strong>
|
||||
<?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?>
|
||||
<?php else : ?>
|
||||
<strong><?php esc_html_e( 'Enabled.', 'akismet' ); ?></strong>
|
||||
<?php esc_html_e( 'All systems functional.', 'akismet' ); ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="akismet-settings__row">
|
||||
<div class="akismet-settings__row-text">
|
||||
<h3 class="akismet-settings__row-title"><?php esc_html_e( 'Comments', 'akismet' ); ?></h3>
|
||||
</div>
|
||||
<div class="akismet-settings__row-input">
|
||||
<label class="akismet-settings__row-input-label" for="akismet_show_user_comments_approved">
|
||||
<input
|
||||
name="akismet_show_user_comments_approved"
|
||||
id="akismet_show_user_comments_approved"
|
||||
value="1"
|
||||
type="checkbox"
|
||||
<?php
|
||||
// If the option isn't set, or if it's enabled ('1'), or if it was enabled a long time ago ('true'), check the checkbox.
|
||||
checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
|
||||
?>
|
||||
/>
|
||||
<span class="akismet-settings__row-label-text">
|
||||
<?php esc_html_e( 'Show the number of approved comments beside each comment author.', 'akismet' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="akismet-settings__row is-radio">
|
||||
<div class="akismet-settings__row-text">
|
||||
<h3 class="akismet-settings__row-title"><?php esc_html_e( 'Spam filtering', 'akismet' ); ?></h3>
|
||||
</div>
|
||||
<div class="akismet-settings__row-input">
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span><?php esc_html_e( 'Akismet Anti-spam strictness', 'akismet' ); ?></span>
|
||||
</legend>
|
||||
<div>
|
||||
<label class="akismet-settings__row-input-label" for="akismet_strictness_1">
|
||||
<input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked( '1', get_option( 'akismet_strictness' ) ); ?> />
|
||||
<span class="akismet-settings__row-label-text">
|
||||
<?php esc_html_e( 'Silently discard the worst and most pervasive spam so I never see it.', 'akismet' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label class="akismet-settings__row-input-label" for="akismet_strictness_0">
|
||||
<input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked( true, get_option( 'akismet_strictness' ) !== '1' ); ?> />
|
||||
<span class="akismet-settings__row-label-text">
|
||||
<?php esc_html_e( 'Always put spam in the Spam folder for review.', 'akismet' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="akismet-settings__row-note">
|
||||
<strong><?php esc_html_e( 'Note:', 'akismet' ); ?></strong>
|
||||
<?php
|
||||
$delete_interval = max( 1, intval( apply_filters( 'akismet_delete_comment_interval', 15 ) ) );
|
||||
|
||||
$spam_folder_link = sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( admin_url( 'edit-comments.php?comment_status=spam' ) ),
|
||||
esc_html__( 'spam folder', 'akismet' )
|
||||
);
|
||||
|
||||
// The _n() needs to be on one line so the i18n tooling can extract the translator comment.
|
||||
/* translators: %1$s: spam folder link, %2$d: delete interval in days */
|
||||
$delete_message = _n( 'Spam in the %1$s older than %2$d day is deleted automatically.', 'Spam in the %1$s older than %2$d days is deleted automatically.', $delete_interval, 'akismet' );
|
||||
|
||||
printf(
|
||||
wp_kses( $delete_message, $kses_allow_link_href ),
|
||||
wp_kses( $spam_folder_link, $kses_allow_link_href ),
|
||||
esc_html( $delete_interval )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="akismet-settings__row is-radio">
|
||||
<div class="akismet-settings__row-text">
|
||||
<h3 class="akismet-settings__row-title"><?php esc_html_e( 'Privacy', 'akismet' ); ?></h3>
|
||||
</div>
|
||||
<div class="akismet-settings__row-input">
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span><?php esc_html_e( 'Akismet privacy notice', 'akismet' ); ?></span>
|
||||
</legend>
|
||||
<div>
|
||||
<label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_display">
|
||||
<input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked( 'display', get_option( 'akismet_comment_form_privacy_notice' ) ); ?> />
|
||||
<span class="akismet-settings__row-label-text">
|
||||
<?php esc_html_e( 'Display a privacy notice under your comment forms.', 'akismet' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_hide">
|
||||
<input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option( 'akismet_comment_form_privacy_notice' ), array( 'display', 'hide' ), true ) ? checked( 'hide', get_option( 'akismet_comment_form_privacy_notice' ), false ) : 'checked="checked"'; ?> />
|
||||
<span class="akismet-settings__row-label-text">
|
||||
<?php esc_html_e( 'Do not display privacy notice.', 'akismet' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="akismet-settings__row-note">
|
||||
<?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms.', 'akismet' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( apply_filters( 'akismet_show_mcp_setting', true ) ) : ?>
|
||||
<div class="akismet-settings__row">
|
||||
<div class="akismet-settings__row-text">
|
||||
<h3 class="akismet-settings__row-title">
|
||||
<?php esc_html_e( 'Tool access', 'akismet' ); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="akismet-settings__row-input">
|
||||
<label class="akismet-settings__row-input-label" for="akismet_enable_mcp_access">
|
||||
<input
|
||||
name="akismet_enable_mcp_access"
|
||||
id="akismet_enable_mcp_access"
|
||||
value="1"
|
||||
type="checkbox"
|
||||
<?php checked( '1', get_option( 'akismet_enable_mcp_access' ) ); ?>
|
||||
/>
|
||||
<span class="akismet-settings__row-label-text">
|
||||
<?php esc_html_e( 'Allow ', 'akismet' ); ?><abbr title="<?php esc_attr_e( 'Model Context Protocol', 'akismet' ); ?>"><?php esc_html_e( 'MCP', 'akismet' ); ?></abbr><?php esc_html_e( ' clients to access Akismet data and functionality', 'akismet' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
<div class="akismet-settings__row-note">
|
||||
<?php esc_html_e( 'MCP (Model Context Protocol) allows AI assistants to access Akismet statistics and spam checking features.', 'akismet' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="akismet-card-actions">
|
||||
<?php if ( ! Akismet::predefined_api_key() ) : ?>
|
||||
<div id="delete-action" class="akismet-card-actions__secondary-action">
|
||||
<a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e( 'Disconnect this account', 'akismet' ); ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
|
||||
|
||||
<div id="publishing-action">
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<input type="submit" name="submit" id="submit" class="akismet-button akismet-could-be-primary" value="<?php esc_attr_e( 'Save changes', 'akismet' ); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( ! Akismet::predefined_api_key() ) : ?>
|
||||
<div class="akismet-card">
|
||||
<div class="akismet-section-header">
|
||||
<h2 class="akismet-section-header__label">
|
||||
<span><?php esc_html_e( 'Account', 'akismet' ); ?></span>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="inside">
|
||||
<dl class="akismet-account">
|
||||
<dt class="akismet-account__label"><?php esc_html_e( 'Subscription type', 'akismet' ); ?></dt>
|
||||
<dd class="akismet-account__value"><?php echo esc_html( $akismet_user->account_name ); ?></dd>
|
||||
|
||||
<dt class="akismet-account__label"><?php esc_html_e( 'Status', 'akismet' ); ?></dt>
|
||||
<dd class="akismet-account__value">
|
||||
<?php
|
||||
if ( Akismet::USER_STATUS_CANCELLED === $akismet_user->status ) :
|
||||
esc_html_e( 'Cancelled', 'akismet' );
|
||||
elseif ( Akismet::USER_STATUS_SUSPENDED === $akismet_user->status ) :
|
||||
esc_html_e( 'Suspended', 'akismet' );
|
||||
elseif ( Akismet::USER_STATUS_MISSING === $akismet_user->status ) :
|
||||
esc_html_e( 'Missing', 'akismet' );
|
||||
elseif ( Akismet::USER_STATUS_NO_SUB === $akismet_user->status ) :
|
||||
esc_html_e( 'No subscription found', 'akismet' );
|
||||
else :
|
||||
esc_html_e( 'Active', 'akismet' );
|
||||
endif;
|
||||
?>
|
||||
</dd>
|
||||
|
||||
<?php if ( $akismet_user->next_billing_date ) : ?>
|
||||
<dt class="akismet-account__label"><?php esc_html_e( 'Next billing date', 'akismet' ); ?></dt>
|
||||
<dd class="akismet-account__value"><?php echo esc_html( gmdate( 'F j, Y', $akismet_user->next_billing_date ) ); ?></dd>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
<div class="akismet-card-actions">
|
||||
<?php if ( $akismet_user->status === Akismet::USER_STATUS_ACTIVE ) : ?>
|
||||
<div class="akismet-card-actions__secondary-action">
|
||||
<a href="https://akismet.com/account?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=account_overview" class="akismet-external-link" aria-label="Account overview on akismet.com"><?php esc_html_e( 'Account overview', 'akismet' ); ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="publishing-action">
|
||||
<?php
|
||||
Akismet::view(
|
||||
'get',
|
||||
array(
|
||||
'text' => ( $akismet_user->account_type === 'free-api-key' && $akismet_user->status === Akismet::USER_STATUS_ACTIVE ? __( 'Upgrade', 'akismet' ) : __( 'Change', 'akismet' ) ),
|
||||
'redirect' => 'upgrade',
|
||||
'utm_content' => ( $akismet_user->account_type === 'free-api-key' && $akismet_user->status === Akismet::USER_STATUS_ACTIVE ? 'config_upgrade' : 'config_change' ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php Akismet::view( 'footer' ); ?>
|
||||
</div>
|
||||
14
plugins/akismet/views/connect-jp.php
Normal file
14
plugins/akismet/views/connect-jp.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare( strict_types = 1 );
|
||||
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
?>
|
||||
<div class="akismet-box">
|
||||
<?php Akismet::view( 'setup', array( 'use_jetpack_connection' => true ) ); ?>
|
||||
<?php Akismet::view( 'setup-jetpack', array( 'akismet_user' => $akismet_user ) ); ?>
|
||||
</div>
|
||||
|
||||
<div class="akismet-box">
|
||||
<?php Akismet::view( 'enter' ); ?>
|
||||
</div>
|
||||
14
plugins/akismet/views/enter.php
Normal file
14
plugins/akismet/views/enter.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<div class="akismet-enter-api-key-box centered">
|
||||
<button class="akismet-enter-api-key-box__reveal"><?php esc_html_e( 'Manually enter an API key', 'akismet' ); ?></button>
|
||||
<div class="akismet-enter-api-key-box__form-wrapper">
|
||||
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
|
||||
<?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<h3 class="akismet-enter-api-key-box__header" id="akismet-enter-api-key-box__header"><?php esc_html_e( 'Enter your API key', 'akismet' ); ?></h3>
|
||||
<div class="akismet-enter-api-key-box__input-wrapper">
|
||||
<input id="key" name="key" type="text" size="15" value="" placeholder="<?php esc_attr_e( 'API key', 'akismet' ); ?>" class="akismet-enter-api-key-box__key-input regular-text code" aria-labelledby="akismet-enter-api-key-box__header">
|
||||
<input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' ); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
9
plugins/akismet/views/footer.php
Normal file
9
plugins/akismet/views/footer.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Akismet footer template.
|
||||
*
|
||||
* Renders the akismet_footer action hook.
|
||||
*/
|
||||
declare( strict_types = 1 );
|
||||
|
||||
do_action( 'akismet_footer' );
|
||||
32
plugins/akismet/views/get.php
Normal file
32
plugins/akismet/views/get.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
|
||||
$submit_classes_attr = 'akismet-button';
|
||||
|
||||
if ( isset( $classes ) && ( is_countable( $classes ) ? count( $classes ) : 0 ) > 0 ) {
|
||||
$submit_classes_attr = implode( ' ', $classes );
|
||||
}
|
||||
|
||||
$query_args = array(
|
||||
'passback_url' => Akismet_Admin::get_page_url(),
|
||||
'redirect' => isset( $redirect ) ? $redirect : 'plugin-signup',
|
||||
);
|
||||
|
||||
// Set default UTM parameters, overriding with any provided values.
|
||||
$utm_args = array(
|
||||
'utm_source' => isset( $utm_source ) ? $utm_source : 'akismet_plugin',
|
||||
'utm_medium' => isset( $utm_medium ) ? $utm_medium : 'in_plugin',
|
||||
'utm_campaign' => isset( $utm_campaign ) ? $utm_campaign : 'plugin_static_link',
|
||||
'utm_content' => isset( $utm_content ) ? $utm_content : 'get_view_link',
|
||||
);
|
||||
|
||||
$query_args = array_merge( $query_args, $utm_args );
|
||||
|
||||
$url = add_query_arg( $query_args, 'https://akismet.com/get/' );
|
||||
?>
|
||||
<a href="<?php echo esc_url( $url ); ?>" class="<?php echo esc_attr( $submit_classes_attr ); ?>" target="_blank">
|
||||
<?php echo esc_html( is_string( $text ) ? $text : '' ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( '(opens in a new tab)', 'akismet' ); ?></span>
|
||||
</a>
|
||||
13
plugins/akismet/views/logo.php
Normal file
13
plugins/akismet/views/logo.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
?>
|
||||
<div class="akismet-masthead__logo-container">
|
||||
<?php if ( isset( $include_logo_link ) && $include_logo_link === true ) : ?>
|
||||
<a href="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" class="akismet-masthead__logo-link">
|
||||
<?php endif; ?>
|
||||
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/akismet-refresh-logo@2x.png', __FILE__ ) ); ?>" srcset="<?php echo esc_url( plugins_url( '../_inc/img/akismet-refresh-logo.svg', __FILE__ ) ); ?>" alt="Akismet logo" />
|
||||
<?php if ( isset( $include_logo_link ) && $include_logo_link === true ) : ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
368
plugins/akismet/views/notice.php
Normal file
368
plugins/akismet/views/notice.php
Normal file
@@ -0,0 +1,368 @@
|
||||
<?php
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
$kses_allow_link = array(
|
||||
'a' => array(
|
||||
'href' => true,
|
||||
'target' => true,
|
||||
'class' => true,
|
||||
),
|
||||
);
|
||||
$kses_allow_strong = array( 'strong' => true );
|
||||
|
||||
if ( ! isset( $type ) ) {
|
||||
$type = false; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
}
|
||||
|
||||
/*
|
||||
* Some notices (plugin, spam-check, spam-check-cron-disabled, alert and usage-limit) are also shown elsewhere in wp-admin, so have different classes applied so that they match the standard WordPress notice format.
|
||||
*/
|
||||
?>
|
||||
<?php if ( $type === 'plugin' ) : ?>
|
||||
<?php // Displayed on edit-comments.php to users who have not set up Akismet yet. ?>
|
||||
<div class="updated" id="akismet-setup-prompt">
|
||||
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
|
||||
<div class="akismet-activate">
|
||||
<input type="submit" class="akismet-activate__button akismet-button" value="<?php esc_attr_e( 'Set up your Akismet account', 'akismet' ); ?>" />
|
||||
<div class="akismet-activate__description">
|
||||
<?php esc_html_e( 'Almost done! Configure Akismet and say goodbye to spam', 'akismet' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php elseif ( $type === 'spam-check' ) : ?>
|
||||
<?php // This notice is only displayed on edit-comments.php. ?>
|
||||
<div class="notice notice-warning">
|
||||
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p>
|
||||
<p><?php esc_html_e( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ); ?></p>
|
||||
<?php if ( ! empty( $link_text ) ) : ?>
|
||||
<p><?php echo wp_kses( $link_text, $kses_allow_link ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'spam-check-cron-disabled' ) : ?>
|
||||
<?php // This notice is only displayed on edit-comments.php. ?>
|
||||
<div class="notice notice-warning">
|
||||
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p>
|
||||
<p><?php esc_html_e( 'WP-Cron has been disabled using the DISABLE_WP_CRON constant. Comment rechecks may not work properly.', 'akismet' ); ?></p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'alert' && $code === Akismet::ALERT_CODE_COMMERCIAL && isset( $parent_view ) && $parent_view === 'config' ) : ?>
|
||||
<?php // Display a different commercial warning alert on the config page ?>
|
||||
<div class="akismet-card akismet-alert is-commercial">
|
||||
<div>
|
||||
<h3 class="akismet-alert-header"><?php esc_html_e( 'We detected commercial activity on your site', 'akismet' ); ?></h3>
|
||||
<p class="akismet-alert-info">
|
||||
<?php
|
||||
/* translators: The placeholder is a URL. */
|
||||
echo wp_kses( sprintf( __( 'Your current subscription is for <a class="akismet-external-link" href="%s">personal, non-commercial use</a>. Please upgrade your plan to continue using Akismet.', 'akismet' ), esc_url( 'https://akismet.com/support/getting-started/free-or-paid/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=commercial_support' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
<p class="akismet-alert-info">
|
||||
<?php
|
||||
/* translators: The placeholder is a URL to the contact form. */
|
||||
echo wp_kses( sprintf( __( 'If you believe your site should not be classified as commercial, <a class="akismet-external-link" href="%s">please get in touch</a>', 'akismet' ), esc_url( 'https://akismet.com/contact/?purpose=commercial&utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=commercial_contact' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="akismet-alert-button-wrapper">
|
||||
<?php
|
||||
Akismet::view(
|
||||
'get',
|
||||
array(
|
||||
'text' => __( 'Upgrade plan', 'akismet' ),
|
||||
'classes' => array( 'akismet-alert-button', 'akismet-button' ),
|
||||
'redirect' => 'upgrade',
|
||||
'utm_content' => 'commercial_upgrade',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'alert' ) : ?>
|
||||
<div class="<?php echo isset( $parent_view ) && $parent_view === 'config' ? 'akismet-alert is-bad' : 'error'; ?>">
|
||||
<?php /* translators: The placeholder is an error code returned by Akismet. */ ?>
|
||||
<p><strong><?php printf( esc_html__( 'Akismet error code: %s', 'akismet' ), esc_html( $code ) ); ?></strong></p>
|
||||
<p><?php echo isset( $msg ) ? esc_html( $msg ) : ''; ?></p>
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
/* translators: the placeholder is a clickable URL that leads to more information regarding an error code. */
|
||||
__( 'For more information, see the <a class="akismet-external-link" href="%s">error documentation on akismet.com</a>', 'akismet' ),
|
||||
esc_url( 'https://akismet.com/developers/detailed-docs/errors/akismet-error-' . absint( $code ) . '?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=error_info' )
|
||||
),
|
||||
$kses_allow_link
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'notice' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php echo wp_kses( $notice_header, Akismet_Admin::get_notice_kses_allowed_elements() ); ?></h3>
|
||||
<p>
|
||||
<?php echo wp_kses( $notice_text, Akismet_Admin::get_notice_kses_allowed_elements() ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'missing-functions' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php esc_html_e( 'Network functions are disabled.', 'akismet' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses( __( 'Your web host or server administrator has disabled PHP’s <code>gethostbynamel</code> function.', 'akismet' ), array_merge( $kses_allow_link, $kses_allow_strong, array( 'code' => true ) ) );
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: The placeholder is a URL. */
|
||||
echo wp_kses( sprintf( __( 'Please contact your web host or firewall administrator and give them <a class="akismet-external-link" href="%s" target="_blank">this information about Akismet’s system requirements</a>', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=hosting_faq_php' ) ), array_merge( $kses_allow_link, $kses_allow_strong, array( 'code' => true ) ) );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'servers-be-down' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php esc_html_e( 'Your site can’t connect to the Akismet servers.', 'akismet' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: The placeholder is a URL. */
|
||||
echo wp_kses( sprintf( __( 'Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a class="akismet-external-link" href="%s" target="_blank">our guide about firewalls</a>', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=hosting_faq_firewall' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'cancelled' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet plan has been cancelled.', 'akismet' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: The placeholder is a URL. */
|
||||
echo wp_kses( sprintf( __( 'Please visit <a class="akismet-external-link" href="%s" target="_blank">Akismet.com</a> to purchase a new subscription.', 'akismet' ), esc_url( 'https://akismet.com/pricing/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=pricing_cancelled' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'suspended' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet subscription is suspended.', 'akismet' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: The placeholder is a URL. */
|
||||
echo wp_kses( sprintf( __( 'Please contact <a class="akismet-external-link" href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=support_suspended' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'active-notice' && $time_saved ) : ?>
|
||||
<div class="akismet-alert is-neutral">
|
||||
<h3 class="akismet-alert__heading"><?php echo esc_html( $time_saved ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: the placeholder is a clickable URL to the Akismet account upgrade page. */
|
||||
echo wp_kses( sprintf( __( 'You can help us fight spam and upgrade your account by <a class="akismet-external-link" href="%s" target="_blank">contributing a token amount</a>', 'akismet' ), esc_url( 'https://akismet.com/pricing?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=upgrade_contribution' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'missing' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php esc_html_e( 'There is a problem with your API key.', 'akismet' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: The placeholder is a URL to the Akismet contact form. */
|
||||
echo wp_kses( sprintf( __( 'Please contact <a class="akismet-external-link" href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=support_missing' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'no-sub' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php esc_html_e( 'You don’t have an Akismet plan.', 'akismet' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: the placeholder is the URL to the Akismet pricing page. */
|
||||
echo wp_kses( sprintf( __( 'Please <a class="akismet-external-link" href="%s" target="_blank">choose a free or paid plan</a> so Akismet can protect your site from spam.', 'akismet' ), esc_url( 'https://akismet.com/pricing?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=choose_plan' ) ), $kses_allow_link );
|
||||
?>
|
||||
</p>
|
||||
<p><?php echo esc_html__( 'Once you\'ve chosen a plan, return here to complete your setup.', 'akismet' ); ?></p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'new-key-valid' ) : ?>
|
||||
<?php
|
||||
global $wpdb;
|
||||
|
||||
$check_pending_link = false;
|
||||
|
||||
$at_least_one_comment_in_moderation = ! ! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" );
|
||||
|
||||
if ( $at_least_one_comment_in_moderation ) {
|
||||
$check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
|
||||
}
|
||||
?>
|
||||
<div class="akismet-alert is-good">
|
||||
<p><?php esc_html_e( 'Akismet is now protecting your site from spam.', 'akismet' ); ?></p>
|
||||
<?php if ( $check_pending_link ) : ?>
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
/* translators: The placeholder is a URL for checking pending comments. */
|
||||
__( 'Would you like to <a href="%s">scan pending comments for spam</a>?', 'akismet' ),
|
||||
esc_url( $check_pending_link )
|
||||
),
|
||||
$kses_allow_link
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'new-key-invalid' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<p><?php esc_html_e( 'The key you entered is invalid. Please double-check it.', 'akismet' ); ?></p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === Akismet_Admin::NOTICE_EXISTING_KEY_INVALID ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
/* translators: The placeholder is a URL to the Akismet contact form. */
|
||||
__( 'Please enter a new key or <a class="akismet-external-link" href="%s" target="_blank">contact Akismet support</a>', 'akismet' ),
|
||||
'https://akismet.com/contact/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=support_invalid_key'
|
||||
),
|
||||
$kses_allow_link
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'new-key-failed' ) : ?>
|
||||
<div class="akismet-alert is-bad">
|
||||
<h3 class="akismet-alert__heading"><?php esc_html_e( 'The API key you entered could not be verified.', 'akismet' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
/* translators: The placeholder is a URL. */
|
||||
__( 'The connection to akismet.com could not be established. Please refer to <a class="akismet-external-link" href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet' ),
|
||||
'https://akismet.com/akismet-hosting-faq/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=hosting_faq'
|
||||
),
|
||||
$kses_allow_link
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $type === 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?>
|
||||
<div class="error akismet-usage-limit-alert">
|
||||
<div class="akismet-usage-limit-logo">
|
||||
<img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet logo" />
|
||||
</div>
|
||||
<div class="akismet-usage-limit-text">
|
||||
<h3>
|
||||
<?php
|
||||
switch ( Akismet::$limit_notices[ $code ] ) {
|
||||
case 'FIRST_MONTH_OVER_LIMIT':
|
||||
case 'SECOND_MONTH_OVER_LIMIT':
|
||||
esc_html_e( 'Your Akismet account usage is over your plan’s limit', 'akismet' );
|
||||
break;
|
||||
case 'THIRD_MONTH_APPROACHING_LIMIT':
|
||||
esc_html_e( 'Your Akismet account usage is approaching your plan’s limit', 'akismet' );
|
||||
break;
|
||||
case 'THIRD_MONTH_OVER_LIMIT':
|
||||
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
|
||||
esc_html_e( 'Your account has been restricted', 'akismet' );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php
|
||||
switch ( Akismet::$limit_notices[ $code ] ) {
|
||||
case 'FIRST_MONTH_OVER_LIMIT':
|
||||
echo esc_html(
|
||||
sprintf(
|
||||
/* translators: The first placeholder is a date, the second is a (formatted) number, the third is another formatted number. */
|
||||
__( 'Since %1$s, your account made %2$s API calls, compared to your plan’s limit of %3$s.', 'akismet' ),
|
||||
esc_html( gmdate( 'F' ) . ' 1' ),
|
||||
number_format( $api_calls ),
|
||||
number_format( $usage_limit )
|
||||
)
|
||||
);
|
||||
echo ' ';
|
||||
echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">';
|
||||
echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
|
||||
echo '</a>';
|
||||
|
||||
break;
|
||||
case 'SECOND_MONTH_OVER_LIMIT':
|
||||
echo esc_html( __( 'Your Akismet usage has been over your plan’s limit for two consecutive months. Next month, we will restrict your account after you reach the limit. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) );
|
||||
echo ' ';
|
||||
echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">';
|
||||
echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
|
||||
echo '</a>';
|
||||
|
||||
break;
|
||||
case 'THIRD_MONTH_APPROACHING_LIMIT':
|
||||
echo esc_html( __( 'Your Akismet usage is nearing your plan’s limit for the third consecutive month. We will restrict your account after you reach the limit. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) );
|
||||
echo ' ';
|
||||
echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">';
|
||||
echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
|
||||
echo '</a>';
|
||||
|
||||
break;
|
||||
case 'THIRD_MONTH_OVER_LIMIT':
|
||||
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
|
||||
echo esc_html( __( 'Your Akismet usage has been over your plan’s limit for three consecutive months. We have restricted your account for the rest of the month. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) );
|
||||
echo ' ';
|
||||
echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">';
|
||||
echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
|
||||
echo '</a>';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="akismet-usage-limit-cta">
|
||||
<a href="<?php echo esc_url( $upgrade_url . ( strpos( $upgrade_url, '?' ) !== false ? '&' : '?' ) . 'utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_upgrade' ); ?>" class="button" target="_blank">
|
||||
<?php
|
||||
if ( isset( $upgrade_via_support ) && $upgrade_via_support ) {
|
||||
// Direct user to contact support.
|
||||
esc_html_e( 'Contact Akismet support', 'akismet' );
|
||||
} elseif ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) {
|
||||
// If a qty upgrade is required, use recommended plan name if available.
|
||||
if ( ! empty( $recommended_plan_name ) && is_string( $recommended_plan_name ) ) {
|
||||
echo esc_html(
|
||||
sprintf(
|
||||
/* translators: The placeholder is the name of an Akismet subscription plan, like "Akismet Pro" or "Akismet Business" . */
|
||||
__( 'Add an %s subscription', 'akismet' ),
|
||||
$recommended_plan_name
|
||||
)
|
||||
);
|
||||
} else {
|
||||
esc_html_e( 'Increase your limit', 'akismet' );
|
||||
}
|
||||
} else {
|
||||
echo esc_html(
|
||||
sprintf(
|
||||
/* translators: The placeholder is the name of a subscription level, like "Akismet Business" or "Akismet Enterprise" . */
|
||||
__( 'Upgrade to %s', 'akismet' ),
|
||||
$upgrade_plan
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
11
plugins/akismet/views/predefined.php
Normal file
11
plugins/akismet/views/predefined.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="akismet-box">
|
||||
<h2><?php esc_html_e( 'Manual configuration', 'akismet' ); ?></h2>
|
||||
<p>
|
||||
<?php
|
||||
|
||||
/* translators: %s is the wp-config.php file */
|
||||
printf( esc_html__( 'An Akismet API key has been defined in the %s file for this site.', 'akismet' ), '<code>wp-config.php</code>' );
|
||||
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
97
plugins/akismet/views/setup-jetpack.php
Normal file
97
plugins/akismet/views/setup-jetpack.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
declare( strict_types = 1 );
|
||||
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
|
||||
$user_status = $akismet_user->status ?? null;
|
||||
?>
|
||||
<div class="akismet-setup__connection">
|
||||
<?php if ( ! empty( $akismet_user->user_email ) && ! empty( $akismet_user->user_login ) ) : ?>
|
||||
<div class="akismet-setup__connection-user">
|
||||
<div class="akismet-setup__connection-avatar">
|
||||
<?php
|
||||
// Decorative avatar; empty alt for screen readers.
|
||||
echo get_avatar(
|
||||
$akismet_user->user_email,
|
||||
48,
|
||||
'',
|
||||
'',
|
||||
array(
|
||||
'class' => 'akismet-setup__connection-avatar-image',
|
||||
'alt' => '',
|
||||
)
|
||||
);
|
||||
?>
|
||||
<div class="akismet-setup__connection-account">
|
||||
<div class="akismet-setup__connection-account-name">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s is the WordPress.com username */
|
||||
esc_html__( 'Signed in as %s', 'akismet' ),
|
||||
'<strong>' . esc_html( $akismet_user->user_login ) . '</strong>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div class="akismet-setup__connection-account-email"><?php echo esc_html( $akismet_user->user_email ); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="akismet-setup__connection-action">
|
||||
<?php if ( in_array( $user_status, array( Akismet::USER_STATUS_CANCELLED, Akismet::USER_STATUS_MISSING, Akismet::USER_STATUS_NO_SUB ) ) ) : ?>
|
||||
|
||||
<p class="akismet-setup__connection-action-intro">
|
||||
<?php esc_html_e( "Your Jetpack account is connected, but it doesn't have an active Akismet subscription yet. To continue, please choose a plan on Akismet.com.", 'akismet' ); ?>
|
||||
</p>
|
||||
|
||||
<a href="https://akismet.com/get?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=jetpack_flow_<?php echo esc_attr( str_replace( '-', '_', $user_status ) ); ?>" class="akismet-setup__connection-button akismet-button">
|
||||
<?php esc_html_e( 'Choose a plan on Akismet.com', 'akismet' ); ?>
|
||||
</a>
|
||||
|
||||
<p class="akismet-setup__connection-action-description">
|
||||
<?php esc_html_e( "Once you've chosen a plan, return here to complete your setup.", 'akismet' ); ?>
|
||||
</p>
|
||||
|
||||
<?php elseif ( $user_status === Akismet::USER_STATUS_SUSPENDED ) : ?>
|
||||
<p class="akismet-setup__connection-action-intro">
|
||||
<?php esc_html_e( "Your Akismet account appears to be suspended. This sometimes happens if there's a billing or verification issue. Please contact our support team so we can help you get it sorted.", 'akismet' ); ?>
|
||||
</p>
|
||||
|
||||
<a href="https://akismet.com/contact?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=jetpack_flow_suspended" class="akismet-setup__connection-button akismet-button">
|
||||
<?php esc_html_e( 'Contact support', 'akismet' ); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate">
|
||||
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key ); ?>"/>
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
|
||||
<input type="submit" class="akismet-setup__connection-button akismet-button" value="<?php esc_attr_e( 'Connect with Jetpack', 'akismet' ); ?>"/>
|
||||
</form>
|
||||
|
||||
<p class="akismet-setup__connection-action-description">
|
||||
<?php esc_html_e( "By connecting, we'll use your Jetpack account to activate Akismet on this site.", 'akismet' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! in_array( $user_status, array( Akismet::USER_STATUS_CANCELLED, Akismet::USER_STATUS_MISSING, Akismet::USER_STATUS_NO_SUB ) ) ) : ?>
|
||||
<p class="akismet-setup__connection-action-description">
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
/* translators: The placeholder is a URL. */
|
||||
__( 'Want to use a different account? <a href="%s" class="akismet-external-link">Visit akismet.com</a> to set it up and get your API key.', 'akismet' ),
|
||||
esc_url( 'https://akismet.com/get?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=jetpack_flow_different_account' )
|
||||
),
|
||||
array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
78
plugins/akismet/views/setup.php
Normal file
78
plugins/akismet/views/setup.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
declare( strict_types = 1 );
|
||||
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
|
||||
$tick_icon = '<svg class="akismet-setup-instructions__icon" width="48" height="48" viewBox="0 0 48 48" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="24" cy="24" r="22" fill="#2E7D32"/>
|
||||
<path d="M16 24l6 6 12-14" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>';
|
||||
?>
|
||||
<section class="akismet-setup-instructions">
|
||||
<h2 class="akismet-setup-instructions__heading"><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
|
||||
|
||||
<h3 class="akismet-setup-instructions__subheading">
|
||||
<?php echo esc_html__( 'Protect your site from comment spam and contact form spam — automatically.', 'akismet' ); ?>
|
||||
</h3>
|
||||
|
||||
<ul class="akismet-setup-instructions__feature-list">
|
||||
<li class="akismet-setup-instructions__feature">
|
||||
<?php echo $tick_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<div class="akismet-setup-instructions__body">
|
||||
<h4 class="akismet-setup-instructions__title">
|
||||
<?php echo esc_html__( 'Machine learning accuracy', 'akismet' ); ?>
|
||||
</h4>
|
||||
<p class="akismet-setup-instructions__text">
|
||||
<?php echo esc_html__( 'Learns from billions of spam signals across the web to stop junk before it reaches you.', 'akismet' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="akismet-setup-instructions__feature">
|
||||
<?php echo $tick_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<div class="akismet-setup-instructions__body">
|
||||
<h4 class="akismet-setup-instructions__title">
|
||||
<?php echo esc_html__( 'Zero effort', 'akismet' ); ?>
|
||||
</h4>
|
||||
<p class="akismet-setup-instructions__text">
|
||||
<?php echo esc_html__( 'Akismet runs quietly in the background, saving you hours of manual moderation.', 'akismet' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="akismet-setup-instructions__feature">
|
||||
<?php echo $tick_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<div class="akismet-setup-instructions__body">
|
||||
<h4 class="akismet-setup-instructions__title">
|
||||
<?php echo esc_html__( 'Works with popular contact forms', 'akismet' ); ?>
|
||||
</h4>
|
||||
<p class="akismet-setup-instructions__text">
|
||||
<?php echo esc_html__( 'Seamlessly integrates with plugins like Elementor, Contact Form 7, Jetpack and WPForms.', 'akismet' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="akismet-setup-instructions__feature">
|
||||
<?php echo $tick_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<div class="akismet-setup-instructions__body">
|
||||
<h4 class="akismet-setup-instructions__title">
|
||||
<?php echo esc_html__( 'Flexible pricing', 'akismet' ); ?>
|
||||
</h4>
|
||||
<p class="akismet-setup-instructions__text">
|
||||
<?php echo esc_html__( 'Name your own price for personal sites. Businesses start on a paid plan.', 'akismet' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
if ( empty( $use_jetpack_connection ) ) :
|
||||
Akismet::view(
|
||||
'get',
|
||||
array(
|
||||
'text' => __( 'Get started', 'akismet' ),
|
||||
'classes' => array( 'akismet-button', 'akismet-is-primary', 'akismet-setup-instructions__button' ),
|
||||
'utm_content' => 'setup_instructions',
|
||||
)
|
||||
);
|
||||
endif;
|
||||
?>
|
||||
</section>
|
||||
31
plugins/akismet/views/start.php
Normal file
31
plugins/akismet/views/start.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
//phpcs:disable VariableAnalysis
|
||||
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
||||
?>
|
||||
<div id="akismet-plugin-container">
|
||||
<?php if ( has_action( 'akismet_header' ) ) : ?>
|
||||
<?php do_action( 'akismet_header' ); ?>
|
||||
<?php else : ?>
|
||||
<div class="akismet-masthead">
|
||||
<div class="akismet-masthead__inside-container">
|
||||
<?php Akismet::view( 'logo' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="akismet-lower">
|
||||
<?php Akismet_Admin::display_status(); ?>
|
||||
<div class="akismet-boxes">
|
||||
<?php
|
||||
if ( Akismet::predefined_api_key() ) {
|
||||
Akismet::view( 'predefined' );
|
||||
} elseif ( $akismet_user && in_array( $akismet_user->status, array( Akismet::USER_STATUS_ACTIVE, Akismet::USER_STATUS_NO_SUB, Akismet::USER_STATUS_MISSING, Akismet::USER_STATUS_CANCELLED, Akismet::USER_STATUS_SUSPENDED ) ) ) {
|
||||
Akismet::view( 'connect-jp', compact( 'akismet_user' ) );
|
||||
} else {
|
||||
Akismet::view( 'activate' );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php Akismet::view( 'footer' ); ?>
|
||||
</div>
|
||||
17
plugins/akismet/views/stats.php
Normal file
17
plugins/akismet/views/stats.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<div id="akismet-plugin-container">
|
||||
<?php if ( has_action( 'akismet_header' ) ) : ?>
|
||||
<?php do_action( 'akismet_header' ); ?>
|
||||
<?php else : ?>
|
||||
<div class="akismet-masthead">
|
||||
<div class="akismet-masthead__inside-container">
|
||||
<?php Akismet::view( 'logo', array( 'include_logo_link' => true ) ); ?>
|
||||
<div class="akismet-masthead__back-link-container">
|
||||
<a class="akismet-masthead__back-link" href="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"><?php esc_html_e( 'Back to settings', 'akismet' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php /* name attribute on iframe is used as a cache-buster here to force Firefox to load the new style charts: https://bugzilla.mozilla.org/show_bug.cgi?id=356558 */ ?>
|
||||
<iframe id="stats-iframe" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/user-stats.php?blog=%s&token=%s&locale=%s&is_redecorated=1', urlencode( get_option( 'home' ) ), urlencode( Akismet::get_access_token() ), esc_attr( get_user_locale() ) ) ); ?>" name="<?php echo esc_attr( 'user-stats- ' . filemtime( __FILE__ ) ); ?>" width="100%" height="2500px" frameborder="0" title="<?php echo esc_attr__( 'Akismet detailed stats', 'akismet' ); ?>"></iframe>
|
||||
<?php Akismet::view( 'footer' ); ?>
|
||||
</div>
|
||||
215
plugins/akismet/wrapper.php
Normal file
215
plugins/akismet/wrapper.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
global $wpcom_api_key, $akismet_api_host, $akismet_api_port;
|
||||
|
||||
$wpcom_api_key = defined( 'WPCOM_API_KEY' ) ? constant( 'WPCOM_API_KEY' ) : '';
|
||||
$akismet_api_host = Akismet::get_api_key() . '.rest.akismet.com';
|
||||
$akismet_api_port = 80;
|
||||
|
||||
function akismet_test_mode() {
|
||||
return Akismet::is_test_mode();
|
||||
}
|
||||
|
||||
function akismet_http_post( $request, $host, $path, $port = 80, $ip = null ) {
|
||||
$path = str_replace( '/1.1/', '', $path );
|
||||
|
||||
return Akismet::http_post( $request, $path, $ip );
|
||||
}
|
||||
|
||||
function akismet_microtime() {
|
||||
return Akismet::_get_microtime();
|
||||
}
|
||||
|
||||
function akismet_delete_old() {
|
||||
return Akismet::delete_old_comments();
|
||||
}
|
||||
|
||||
function akismet_delete_old_metadata() {
|
||||
return Akismet::delete_old_comments_meta();
|
||||
}
|
||||
|
||||
function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) {
|
||||
return Akismet::check_db_comment( $id, $recheck_reason );
|
||||
}
|
||||
|
||||
function akismet_rightnow() {
|
||||
if ( ! class_exists( 'Akismet_Admin' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Akismet_Admin::rightnow_stats();
|
||||
}
|
||||
|
||||
function akismet_admin_init() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_version_warning() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_load_js_and_css() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_nonce_field( $action = -1 ) {
|
||||
return wp_nonce_field( $action );
|
||||
}
|
||||
function akismet_plugin_action_links( $links, $file ) {
|
||||
return Akismet_Admin::plugin_action_links( $links, $file );
|
||||
}
|
||||
function akismet_conf() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_stats_display() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_stats() {
|
||||
return Akismet_Admin::dashboard_stats();
|
||||
}
|
||||
function akismet_admin_warnings() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_comment_row_action( $a, $comment ) {
|
||||
return Akismet_Admin::comment_row_actions( $a, $comment );
|
||||
}
|
||||
function akismet_comment_status_meta_box( $comment ) {
|
||||
return Akismet_Admin::comment_status_meta_box( $comment );
|
||||
}
|
||||
function akismet_comments_columns( $columns ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return $columns;
|
||||
}
|
||||
function akismet_comment_column_row( $column, $comment_id ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_text_add_link_callback( $m ) {
|
||||
return Akismet_Admin::text_add_link_callback( $m );
|
||||
}
|
||||
function akismet_text_add_link_class( $comment_text ) {
|
||||
return Akismet_Admin::text_add_link_class( $comment_text );
|
||||
}
|
||||
function akismet_check_for_spam_button( $comment_status ) {
|
||||
return Akismet_Admin::check_for_spam_button( $comment_status );
|
||||
}
|
||||
function akismet_submit_nonspam_comment( $comment_id ) {
|
||||
return Akismet::submit_nonspam_comment( $comment_id );
|
||||
}
|
||||
function akismet_submit_spam_comment( $comment_id ) {
|
||||
return Akismet::submit_spam_comment( $comment_id );
|
||||
}
|
||||
function akismet_transition_comment_status( $new_status, $old_status, $comment ) {
|
||||
return Akismet::transition_comment_status( $new_status, $old_status, $comment );
|
||||
}
|
||||
function akismet_spam_count( $type = false ) {
|
||||
return Akismet_Admin::get_spam_count( $type );
|
||||
}
|
||||
function akismet_recheck_queue() {
|
||||
return Akismet_Admin::recheck_queue();
|
||||
}
|
||||
function akismet_remove_comment_author_url() {
|
||||
return Akismet_Admin::remove_comment_author_url();
|
||||
}
|
||||
function akismet_add_comment_author_url() {
|
||||
return Akismet_Admin::add_comment_author_url();
|
||||
}
|
||||
function akismet_check_server_connectivity() {
|
||||
return Akismet_Admin::check_server_connectivity();
|
||||
}
|
||||
function akismet_get_server_connectivity( $cache_timeout = 86400 ) {
|
||||
return Akismet_Admin::get_server_connectivity( $cache_timeout );
|
||||
}
|
||||
function akismet_server_connectivity_ok() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return true;
|
||||
}
|
||||
function akismet_admin_menu() {
|
||||
return Akismet_Admin::admin_menu();
|
||||
}
|
||||
function akismet_load_menu() {
|
||||
return Akismet_Admin::load_menu();
|
||||
}
|
||||
function akismet_init() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_get_key() {
|
||||
return Akismet::get_api_key();
|
||||
}
|
||||
function akismet_check_key_status( $key, $ip = null ) {
|
||||
return Akismet::check_key_status( $key, $ip );
|
||||
}
|
||||
function akismet_update_alert( $response ) {
|
||||
return Akismet::update_alert( $response );
|
||||
}
|
||||
function akismet_verify_key( $key, $ip = null ) {
|
||||
return Akismet::verify_key( $key, $ip );
|
||||
}
|
||||
function akismet_get_user_roles( $user_id ) {
|
||||
return Akismet::get_user_roles( $user_id );
|
||||
}
|
||||
function akismet_result_spam( $approved ) {
|
||||
return Akismet::comment_is_spam( $approved );
|
||||
}
|
||||
function akismet_result_hold( $approved ) {
|
||||
return Akismet::comment_needs_moderation( $approved );
|
||||
}
|
||||
function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
|
||||
return Akismet::get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url );
|
||||
}
|
||||
function akismet_update_comment_history( $comment_id, $message, $event = null ) {
|
||||
return Akismet::update_comment_history( $comment_id, $message, $event );
|
||||
}
|
||||
function akismet_get_comment_history( $comment_id ) {
|
||||
return Akismet::get_comment_history( $comment_id );
|
||||
}
|
||||
function akismet_cmp_time( $a, $b ) {
|
||||
return Akismet::_cmp_time( $a, $b );
|
||||
}
|
||||
function akismet_auto_check_update_meta( $id, $comment ) {
|
||||
return Akismet::auto_check_update_meta( $id, $comment );
|
||||
}
|
||||
function akismet_auto_check_comment( $commentdata ) {
|
||||
return Akismet::auto_check_comment( $commentdata );
|
||||
}
|
||||
function akismet_get_ip_address() {
|
||||
return Akismet::get_ip_address();
|
||||
}
|
||||
function akismet_cron_recheck() {
|
||||
return Akismet::cron_recheck();
|
||||
}
|
||||
function akismet_add_comment_nonce( $post_id ) {
|
||||
return Akismet::add_comment_nonce( $post_id );
|
||||
}
|
||||
function akismet_fix_scheduled_recheck() {
|
||||
return Akismet::fix_scheduled_recheck();
|
||||
}
|
||||
function akismet_spam_comments() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return array();
|
||||
}
|
||||
function akismet_spam_totals() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return array();
|
||||
}
|
||||
function akismet_manage_page() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_caught() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function redirect_old_akismet_urls() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_kill_proxy_check( $option ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return 0;
|
||||
}
|
||||
function akismet_pingback_forwarded_for( $r, $url ) {
|
||||
// This functionality is now in core.
|
||||
return false;
|
||||
}
|
||||
function akismet_pre_check_pingback( $method ) {
|
||||
return Akismet::pre_check_pingback( $method );
|
||||
}
|
||||
675
plugins/all-in-one-wp-migration/LICENSE
Normal file
675
plugins/all-in-one-wp-migration/LICENSE
Normal file
@@ -0,0 +1,675 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
76
plugins/all-in-one-wp-migration/all-in-one-wp-migration.php
Normal file
76
plugins/all-in-one-wp-migration/all-in-one-wp-migration.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: All-in-One WP Migration and Backup
|
||||
* Plugin URI: https://servmask.com/
|
||||
* Description: All-in-One WP Migration makes moving your entire WordPress site simple. Export or import your database, media, plugins, and themes with just a few clicks.
|
||||
* Author: ServMask
|
||||
* Author URI: https://servmask.com/
|
||||
* Version: 7.105
|
||||
* Text Domain: all-in-one-wp-migration
|
||||
* Domain Path: /languages
|
||||
* Network: True
|
||||
* License: GPLv3
|
||||
*
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
// Check SSL mode
|
||||
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && ( $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) ) {
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
}
|
||||
|
||||
// Plugin basename
|
||||
define( 'AI1WM_PLUGIN_BASENAME', basename( __DIR__ ) . '/' . basename( __FILE__ ) );
|
||||
|
||||
// Plugin path
|
||||
define( 'AI1WM_PATH', __DIR__ );
|
||||
|
||||
// Plugin URL
|
||||
define( 'AI1WM_URL', plugins_url( '', AI1WM_PLUGIN_BASENAME ) );
|
||||
|
||||
// Plugin storage URL
|
||||
define( 'AI1WM_STORAGE_URL', plugins_url( 'storage', AI1WM_PLUGIN_BASENAME ) );
|
||||
|
||||
// Include functions
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'functions.php';
|
||||
|
||||
// Include constants
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'constants.php';
|
||||
|
||||
// Include deprecated
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'deprecated.php';
|
||||
|
||||
// Include exceptions
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'exceptions.php';
|
||||
|
||||
// Include loader
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'loader.php';
|
||||
|
||||
// Plugin initialization
|
||||
$main_controller = new Ai1wm_Main_Controller();
|
||||
442
plugins/all-in-one-wp-migration/changelog.txt
Normal file
442
plugins/all-in-one-wp-migration/changelog.txt
Normal file
@@ -0,0 +1,442 @@
|
||||
= 7.75 =
|
||||
* Custom backups path on database import step
|
||||
|
||||
= 7.74 =
|
||||
* Resolved an ongoing issue with the compatibility of the plugin with servers running Imunify360. The file "wp-content/plugins/all-in-one-wp-migration/functions.php" was being falsely flagged and deleted due to a detection error. This update includes small changes to the "functions.php" file to modify its checksum and prevent the false flag by Imunify360
|
||||
* Imunify360 has updated its signatures, which should prevent this issue from occurring on servers running the updated version. However, this plugin update serves as an additional measure to ensure that the issue is resolved for all users
|
||||
|
||||
= 7.73 =
|
||||
* Better support for PHP 8.1
|
||||
|
||||
= 7.72 =
|
||||
* Backups time based on selected WordPress time zone
|
||||
|
||||
= 7.71 =
|
||||
* Removed the AI1WM_MAX_FILE_SIZE constant. This constant is no longer necessary
|
||||
|
||||
= 7.70 =
|
||||
* Hooks that allow excluding specific database tables on export
|
||||
|
||||
= 7.69 =
|
||||
* Improved support for custom backups location
|
||||
|
||||
= 7.68 =
|
||||
* Better support for PHP 8.1
|
||||
|
||||
= 7.67 =
|
||||
* Backups with a modified wp-content path cannot be downloaded
|
||||
|
||||
= 7.66 =
|
||||
* Better support for WordPress v6.0.2
|
||||
|
||||
= 7.65 =
|
||||
* Improved support for single-letter prefixed databases
|
||||
|
||||
= 7.64 =
|
||||
* Better support for database binary fields
|
||||
|
||||
= 7.63 =
|
||||
* CSRF and XSS issue in the plugin. Thank you, WPScan, for reporting it
|
||||
|
||||
= 7.62 =
|
||||
* Password-protect and encrypt backups
|
||||
|
||||
= 7.61 =
|
||||
* Issue with 7.60 release
|
||||
|
||||
= 7.60 =
|
||||
* What's new page - easy way to get up to speed with the newest features
|
||||
* List of all the items in a backup file, then select and download archived files
|
||||
* Support for WordPress v6
|
||||
|
||||
= 7.59 =
|
||||
* Fix a flaw in which the admin user has the ability to remove files other than backups
|
||||
|
||||
= 7.58 =
|
||||
* Hide the backups count if there are no backups
|
||||
|
||||
= 7.57 =
|
||||
* Improved UX on backups page
|
||||
|
||||
= 7.56 =
|
||||
* Better support for PHP 8.1
|
||||
|
||||
= 7.55 =
|
||||
* When importing or restoring across various PHP versions, the notice has been improved
|
||||
|
||||
= 7.54 =
|
||||
* Improved YouTube and Twitter buttons
|
||||
|
||||
= 7.53 =
|
||||
* Total number of backups in the plugin menu
|
||||
|
||||
= 7.52 =
|
||||
* Out of disk space when exporting database.sql
|
||||
|
||||
= 7.51 =
|
||||
* Link to YouTube Channel
|
||||
|
||||
= 7.50 =
|
||||
* Improved reliability for scheduling events
|
||||
|
||||
= 7.49 =
|
||||
* Better error handling when making HTTP requests
|
||||
* Store a list of site files as CSV
|
||||
* Filter to change the request method
|
||||
|
||||
= 7.48 =
|
||||
* Support for BuddyPress plugin
|
||||
|
||||
= 7.47 =
|
||||
* Improved database migration
|
||||
|
||||
= 7.46 =
|
||||
* Support custom themes directory
|
||||
|
||||
= 7.45 =
|
||||
* Support custom plugins directory
|
||||
|
||||
= 7.44 =
|
||||
* Better support for MySQL <= 5.5
|
||||
* Support for BuddyBoss plugin
|
||||
* Report issue button
|
||||
|
||||
= 7.43 =
|
||||
* Improved reliability
|
||||
|
||||
= 7.42 =
|
||||
* Better support for WooCommerce plugin
|
||||
|
||||
= 7.41 =
|
||||
* Improved free disk space checking
|
||||
* Improved backup validation
|
||||
* Improved path replacement on import
|
||||
* Horizontal scrollbar on MacOS (Backups Page)
|
||||
|
||||
= 7.40 =
|
||||
* Better support for WP Cerber plugin
|
||||
* Backup page style issues on narrow screens
|
||||
|
||||
= 7.39 =
|
||||
* Remove deprecated jQuery methods
|
||||
|
||||
= 5.56 =
|
||||
* Fix an issue with WP_Hook class introcuded in WP 4.7
|
||||
|
||||
= 5.55 =
|
||||
* Fix an issue with resolving URL on export/import when using non-blocking streams client
|
||||
|
||||
= 5.54 =
|
||||
* Fix an issue with resolving URL on export/import
|
||||
|
||||
= 5.53 =
|
||||
* Send HTTP basic authorization header on upload (fetch method)
|
||||
* Add Accept-Encoding, Accept-Charset and Accept-Language on export/import
|
||||
* Do not replace already replaced values on database import/export
|
||||
* Set silent mode when activating sidewide plugins
|
||||
* Replace old media style URLs with the new media style URLs on database import
|
||||
* Replace user_level and capabilities user meta keys if tables have empty prefix on export
|
||||
* Create separate action for extracting must-use plugins
|
||||
* Add option "Do not export must-use plugins" in advanced settings
|
||||
* Fix an issue with SSL that produces "Unable to resolve URL..."
|
||||
|
||||
= 5.52 =
|
||||
* Simplify the text on import page
|
||||
* Fix an issue with special characters on export and import
|
||||
* Fix an issue with export and import of large files
|
||||
|
||||
= 5.51 =
|
||||
* Add support for utf8mb4_unicode_520_ci database collation
|
||||
|
||||
= 5.50 =
|
||||
* Improve database export process
|
||||
* Simplify export and import cron
|
||||
* Fix an issue with export and import progress status
|
||||
|
||||
= 5.49 =
|
||||
* Test plugin up to WordPress 4.6
|
||||
|
||||
= 5.48 =
|
||||
* Improve support for large databases on export
|
||||
* Add support for Box cloud storage
|
||||
* Fix an issue with status on export/import
|
||||
* Fix an issue with asynchronous requests on export/import
|
||||
|
||||
= 5.47 =
|
||||
* Fix an issue with incorrect file size on export
|
||||
|
||||
= 5.46 =
|
||||
* Add "Restore from Backups" video in readme file
|
||||
* Display message if backups are inaccessible
|
||||
|
||||
= 5.45 =
|
||||
* Fix an issue with blogs.dir path replacement
|
||||
|
||||
= 5.44 =
|
||||
* Add "Do not replace email domain" option in advanced settings
|
||||
* Add "ai1wm_exclude_content_from_export" WordPress hook on export
|
||||
* Add HTML5 uploader
|
||||
|
||||
= 5.43 =
|
||||
* Fix an issue when archiving dynamic files on export
|
||||
* Support custom upload path for multisites
|
||||
* Add support for various cache plugins
|
||||
|
||||
= 5.42 =
|
||||
* Catch E_PARSE error on mu-plugins import
|
||||
* Fix an issue with stop export that doesn't clean up the storage directory
|
||||
* Initialize new cache instead of flushing the existing one on import/export
|
||||
|
||||
= 5.41 =
|
||||
* Fix an issue when replacing serialized values on import
|
||||
* List files in chunks
|
||||
* Convert svg images to png
|
||||
* Check if backups are readable before displaying them on "Backups" page
|
||||
* Display version incompatibility notification on export/import/restore screen
|
||||
* Fix double port issue on Bitnami
|
||||
* Fix an issue on multisite export with cloud extensions
|
||||
|
||||
= 5.40 =
|
||||
* Test plugin up to WordPress 4.5
|
||||
|
||||
= 5.39 =
|
||||
* Fix a bug in uploads path replacement
|
||||
|
||||
= 5.38 =
|
||||
* Deactivate mu-plugins if fatal error appears on import
|
||||
|
||||
= 5.37 =
|
||||
* Validate the archive before import
|
||||
|
||||
= 5.36 =
|
||||
* Add OneDrive to readme.txt
|
||||
* Fix a typo on import
|
||||
|
||||
= 5.35 =
|
||||
* Add OneDrive to export/import pages
|
||||
* Fix a bug when WordPress was used without a db prefix
|
||||
* Fix a problem when downloading wpress files
|
||||
* Improve the log system
|
||||
|
||||
= 4.19 =
|
||||
* Fixed an issue with options cache
|
||||
|
||||
= 4.18 =
|
||||
* Fixed an issue with large media files
|
||||
* Fixed an issue with status file being cached
|
||||
|
||||
= 4.17 =
|
||||
* Set "Tested up to" WordPress 4.4
|
||||
|
||||
= 4.16 =
|
||||
* Fix an issue with the transport layer on export/import
|
||||
|
||||
= 4.15 =
|
||||
* Fix an issue with resovling mechanism on export/import
|
||||
|
||||
= 4.14 =
|
||||
* Fix an issue with database import
|
||||
|
||||
= 4.13 =
|
||||
* Add new mechanism for resolving HTTP requests
|
||||
|
||||
= 4.12 =
|
||||
* Fix an issue with Google Drive extension
|
||||
|
||||
= 4.11 =
|
||||
* Fix content filters on export
|
||||
|
||||
= 4.10 =
|
||||
* Add HTTPS URL replacement
|
||||
* Fix an issue when PDO is not available
|
||||
|
||||
= 4.6 =
|
||||
* Fix an issue when the plugin was getting stuck on "Done creating an empty archive"
|
||||
* Fix an issue when the plugin was getting stuck during import
|
||||
|
||||
= 4.3 =
|
||||
* Add URL extension support
|
||||
* Filter "mu-plugins" directory if "Do not export plugins (files)" is checked
|
||||
* Fix utf8mb4 issue
|
||||
* Fix translation issue
|
||||
|
||||
= 4.2 =
|
||||
* Fix .wpress.bin format
|
||||
|
||||
= 4.1 =
|
||||
* Add port to the host header on export/import
|
||||
* Rename .wpress file to .wpress.bin file
|
||||
|
||||
= 4.0 =
|
||||
* Fix file permission checks
|
||||
|
||||
= 3.9 =
|
||||
* Fix could not resolve domain name on export/import
|
||||
|
||||
= 3.8 =
|
||||
* Fix undefined method on Backups page if PHP version is < 5.3.6
|
||||
|
||||
= 3.7 =
|
||||
* Add IPv6 support on export/import
|
||||
|
||||
= 3.6 =
|
||||
* Fixed undefined constant warnings
|
||||
|
||||
= 3.5 =
|
||||
* Exclude core plugin and extensions on export if they have custom names
|
||||
|
||||
= 3.4 =
|
||||
* Made export/import processes more reliable
|
||||
* Allow the plugin to work with non-default name
|
||||
* Preserve backups during plugin updates
|
||||
* Improved find & replace functionality on the serialized data
|
||||
* Removed backup file name restrictions
|
||||
|
||||
= 3.3 =
|
||||
* Fixed a bug when retrieving export/import status progress
|
||||
* Fixed a bug when database encoding utf8mb4_unicode_ci is not available
|
||||
|
||||
= 3.2.2 =
|
||||
* Fixed plugin incompatibility during export/import that was reporting that the process could not be started
|
||||
|
||||
= 3.2.1 =
|
||||
* Added username/password settings for WordPress sites behind HTTP basic authentication
|
||||
* Fixed a bug when exporting/importing without public DNS record
|
||||
* Fixed a bug when exporting/importing media files
|
||||
|
||||
= 3.2.0 =
|
||||
* Added advanced settings on export page
|
||||
|
||||
= 3.1.1 =
|
||||
* Fixed secret key issue on upgrade of the plugin
|
||||
|
||||
= 3.0.0 =
|
||||
* Added export to File, [Dropbox](https://servmask.com/products/dropbox-extension), [Amazon S3](https://servmask.com/products/amazon-s3-extension), [Google Drive](https://servmask.com/products/google-drive-extension)
|
||||
* Added import from File, [Dropbox](https://servmask.com/products/dropbox-extension), [Amazon S3](https://servmask.com/products/amazon-s3-extension), [Google Drive](https://servmask.com/products/google-drive-extension)
|
||||
* Implemented our own archiving format that reduces export and import by a factor of 10
|
||||
* One-click export with the new simplified export page
|
||||
* Improved upload functionality with auto-recognizing chunk size on import
|
||||
* New **Backups** page for storing all WordPress site exports
|
||||
* Easy restore WordPress site from **Backups** page
|
||||
* Monitoring availability of the disk space on the server
|
||||
* Both export and import happen in time chunks of 3 seconds
|
||||
* Plugin works behind HTTP basic authentication
|
||||
|
||||
= 2.0.4 =
|
||||
* Updated readme to reflect that the plugin is not multisite compatible
|
||||
|
||||
= 2.0.3 =
|
||||
* Fixed a security issue while importing site using regular users
|
||||
|
||||
= 2.0.2 =
|
||||
* Added support for WordPress v4.0
|
||||
|
||||
= 2.0.1 =
|
||||
* Fixed a bug when all user permissions are lost on import
|
||||
|
||||
= 2.0.0 =
|
||||
* Added support for migration of WordPress in Network Mode (Multi Site)
|
||||
* New improved UI and UX
|
||||
* New improved language translations on the menu items and help texts
|
||||
* Better error handling and notifications
|
||||
* Fixed a bug while exporting comments and associated comments meta data
|
||||
* Fixed a bug while using find/replace functionality
|
||||
* Fixed a bug with storage directory permissions and search indexation
|
||||
|
||||
= 1.9.2 =
|
||||
* Added PHP <= v5.2.7 compatibility
|
||||
|
||||
= 1.9.1 =
|
||||
* Fixed an issue with earlier versions of PHP
|
||||
|
||||
= 1.9.0 =
|
||||
* New improved design on the export/import page
|
||||
* Added an option for gathering user experience statistics
|
||||
* Added a message box with important notifications about the plugin
|
||||
* Fixed a bug while exporting database with multiple WordPress sites
|
||||
* Fixed a bug while exporting database with table constraints
|
||||
* Fixed a bug with auto recognizing zip archiver
|
||||
|
||||
= 1.8.1 =
|
||||
* Added "Get Support" link in the plugin list page
|
||||
* Removed "All-in-One WP Migration Beta" link from the readme file
|
||||
|
||||
= 1.8.0 =
|
||||
* Added support for dynamically recognizing Site URL and Home URL on the import page
|
||||
* Fixed a bug when maximum uploaded size is exceeded
|
||||
* Fixed a bug while exporting big database tables
|
||||
|
||||
= 1.7.2 =
|
||||
* Added support for automatically switching database adapters for better performance and optimization
|
||||
* Fixed a bug while using host:port syntax with MySQL PDO
|
||||
* Fixed a bug while using find/replace functionality
|
||||
|
||||
= 1.7.1 =
|
||||
* Fixed a bug while exporting WordPress plugins directory
|
||||
|
||||
= 1.7.0 =
|
||||
* Added storage layer to avoid permission issues with OS's directory used for temporary storage
|
||||
* Added additional checks to verify the consistency of the imported archive
|
||||
* Fixed a bug that caused the database to be exported without data
|
||||
* Removed unused variables from package.json file
|
||||
|
||||
= 1.6.0 =
|
||||
* Added additional check for directory's permissions
|
||||
* Added additional check for output buffering when exporting a file
|
||||
* Fixed a bug when the archive was exported or imported with old version of Zlib library
|
||||
* Fixed a bug with permalinks and flushing the rules
|
||||
|
||||
= 1.5.0 =
|
||||
* Added support for additional errors and exceptions handling
|
||||
* Added support for reporting a problem in better and easier way
|
||||
* Improved support process in ZenDesk system for faster response time
|
||||
* Fixed typos on the import page. Thanks to Terry Heenan
|
||||
|
||||
= 1.4.0 =
|
||||
* Added a Twitter and Facebook share buttons to the sidebar on import and export pages
|
||||
|
||||
= 1.3.1 =
|
||||
* Fixed a bug when the user was unable to import site archive
|
||||
* Optimized and speeded up import process
|
||||
|
||||
= 1.3.0 =
|
||||
* Added support for mysql connection to happen over sockets or TCP
|
||||
* Added support for Windows OS and fully tested the plugin on IIS
|
||||
* Added support for limited memory_limit - 1MB - The plugin now requires only 1MB to operate properly
|
||||
* Added support for multisite
|
||||
* Used mysql_unbuffered_query instead of mysql_query to overcome any memory problems
|
||||
* Fixed a deprecated warning for mysql_pconnect when php 5.5 and above is used
|
||||
* Fixed memory_limit problem with PCLZIP library
|
||||
* Fixed a bug when the archive is exported with zero size when using PCLZIP
|
||||
* Fixed a bug when the archive was exported broken on some servers
|
||||
* Fixed a deprecated usage of preg_replace \e in php v5.5 and above
|
||||
|
||||
= 1.2.1 =
|
||||
* Fixed an issue when HTTP Error was shown on some hosts after import, credit to Michael Simon
|
||||
* Fixed an issue when exporting databases with different prefix than wp_, credit to najtrox
|
||||
* Fixed an issue when PDO is avalable but mysql driver for PDO is not, credit to Jaydesain69
|
||||
* Deleted a plugin specific option when uninstalling the plugin (clean after itself)
|
||||
* Support is done via Zendesk
|
||||
* Included WP Version and Plugin version in the feedback form
|
||||
|
||||
= 1.2.0 =
|
||||
* Increased upload limit of files from 128MB to 512MB
|
||||
* Used ZipArchive with fallback to PclZip (a few users notified us that they don't have ZipArchive enabled on their servers)
|
||||
* Used PDO with fallback to mysql (a few users notified us that they dont have PDO enabled on their servers, mysql is deprecated as of PHP v5.5 but we are supporting PHP v5.2.17)
|
||||
* Supported PHP v5.2.17 and WordPress v3.3 and above
|
||||
* Fixed a bug during export that causes plugins to not be exported on some hosts (the problem that you are experiencing)
|
||||
|
||||
= 1.1.0 =
|
||||
* Importing files using chunks to overcome any webserver upload size restriction
|
||||
* Fixed a bug where HTTP code error was shown to some users
|
||||
|
||||
= 1.0.0 =
|
||||
* Export database as SQL file
|
||||
* Export media files
|
||||
* Export themes files
|
||||
* Export installed plugins
|
||||
* Unlimited find/replace actions
|
||||
* Option to exclude spam comments
|
||||
* Option to apply find/replace to GUIDs
|
||||
* Option to exclude post revisions
|
||||
* Option to exclude tables data
|
||||
1537
plugins/all-in-one-wp-migration/constants.php
Normal file
1537
plugins/all-in-one-wp-migration/constants.php
Normal file
File diff suppressed because it is too large
Load Diff
32
plugins/all-in-one-wp-migration/deprecated.php
Normal file
32
plugins/all-in-one-wp-migration/deprecated.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
function ai1wm_progress_path( $params ) {}
|
||||
55
plugins/all-in-one-wp-migration/exceptions.php
Normal file
55
plugins/all-in-one-wp-migration/exceptions.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Archive_Exception extends Exception {}
|
||||
class Ai1wm_Backups_Exception extends Exception {}
|
||||
class Ai1wm_Export_Exception extends Exception {}
|
||||
class Ai1wm_Http_Exception extends Exception {}
|
||||
class Ai1wm_Import_Exception extends Exception {}
|
||||
class Ai1wm_CRC_Exception extends Exception {}
|
||||
class Ai1wm_Upload_Exception extends Exception {}
|
||||
class Ai1wm_Not_Accessible_Exception extends Exception {}
|
||||
class Ai1wm_Not_Seekable_Exception extends Exception {}
|
||||
class Ai1wm_Not_Tellable_Exception extends Exception {}
|
||||
class Ai1wm_Not_Readable_Exception extends Exception {}
|
||||
class Ai1wm_Not_Writable_Exception extends Exception {}
|
||||
class Ai1wm_Not_Truncatable_Exception extends Exception {}
|
||||
class Ai1wm_Not_Closable_Exception extends Exception {}
|
||||
class Ai1wm_Not_Found_Exception extends Exception {}
|
||||
class Ai1wm_Not_Directory_Exception extends Exception {}
|
||||
class Ai1wm_Not_Valid_Secret_Key_Exception extends Exception {}
|
||||
class Ai1wm_Quota_Exceeded_Exception extends Exception {}
|
||||
class Ai1wm_Storage_Exception extends Exception {}
|
||||
class Ai1wm_Compatibility_Exception extends Exception {}
|
||||
class Ai1wm_Feedback_Exception extends Exception {}
|
||||
class Ai1wm_Database_Exception extends Exception {}
|
||||
class Ai1wm_Not_Encryptable_Exception extends Exception {}
|
||||
class Ai1wm_Not_Decryptable_Exception extends Exception {}
|
||||
2573
plugins/all-in-one-wp-migration/functions.php
Normal file
2573
plugins/all-in-one-wp-migration/functions.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,444 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Backups_Controller {
|
||||
|
||||
public static function index() {
|
||||
Ai1wm_Template::render(
|
||||
'backups/index',
|
||||
array(
|
||||
'backups' => Ai1wm_Backups::get_files(),
|
||||
'labels' => Ai1wm_Backups::get_labels(),
|
||||
'downloadable' => Ai1wm_Backups::are_downloadable(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function clean( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Delete storage files
|
||||
Ai1wm_Directory::delete( ai1wm_storage_path( $params ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function delete( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set archive
|
||||
$archive = null;
|
||||
if ( isset( $params['archive'] ) ) {
|
||||
$archive = trim( $params['archive'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access delete action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
Ai1wm_Backups::delete_file( $archive );
|
||||
Ai1wm_Backups::delete_label( $archive );
|
||||
} catch ( Ai1wm_Backups_Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function add_label( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set archive
|
||||
$archive = null;
|
||||
if ( isset( $params['archive'] ) ) {
|
||||
$archive = trim( $params['archive'] );
|
||||
}
|
||||
|
||||
// Set backup label
|
||||
$label = null;
|
||||
if ( isset( $params['label'] ) ) {
|
||||
$label = trim( $params['label'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access add label action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
Ai1wm_Backups::set_label( $archive, $label );
|
||||
} catch ( Ai1wm_Backups_Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_list( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_GET );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
Ai1wm_Template::render(
|
||||
'backups/backups-list',
|
||||
array(
|
||||
'backups' => Ai1wm_Backups::get_files(),
|
||||
'labels' => Ai1wm_Backups::get_labels(),
|
||||
'downloadable' => Ai1wm_Backups::are_downloadable(),
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_get_config( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// Open the archive file for reading
|
||||
$archive = new Ai1wm_Extractor( ai1wm_backup_path( $params ) );
|
||||
$archive->extract_by_files_array( ai1wm_storage_path( $params ), array( AI1WM_PACKAGE_NAME ) );
|
||||
$archive->close();
|
||||
} catch ( Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_check_encryption( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Read package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
|
||||
|
||||
// Parse package.json file
|
||||
$package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
|
||||
$package = json_decode( $package, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// No encryption provided
|
||||
if ( empty( $package['Encrypted'] ) || empty( $package['EncryptedSignature'] ) ) {
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check decryption support
|
||||
if ( ! ai1wm_can_decrypt() ) {
|
||||
ai1wm_json_response( array( 'errors' => array( __( 'Download a file from encrypted backup is not supported on this server. The process cannot continue. <a href="https://help.servmask.com/knowledgebase/unable-to-encrypt-and-decrypt-backups/" target="_blank">Technical details</a>', 'all-in-one-wp-migration' ) ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Validate decryption password
|
||||
if ( ! empty( $params['decryption_password'] ) ) {
|
||||
if ( ! ai1wm_is_decryption_password_valid( $package['EncryptedSignature'], $params['decryption_password'] ) ) {
|
||||
ai1wm_json_response( array( 'errors' => array( __( 'The decryption password is not valid. The process cannot continue.', 'all-in-one-wp-migration' ) ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'check' => true, 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_list_content( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$files = array();
|
||||
|
||||
try {
|
||||
$archive = new Ai1wm_Extractor( ai1wm_backup_path( $params ) );
|
||||
if ( ! $archive->is_valid() ) {
|
||||
throw new Ai1wm_Backups_Exception(
|
||||
__( 'Could not list the backup content. Please ensure the backup file is accessible and not corrupted.', 'all-in-one-wp-migration' )
|
||||
);
|
||||
}
|
||||
|
||||
$files = $archive->list_files();
|
||||
$archive->close();
|
||||
} catch ( Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => $e->getMessage() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( $files );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function download_file( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set decryption password
|
||||
$decryption_password = null;
|
||||
if ( isset( $params['decryption_password'] ) ) {
|
||||
$decryption_password = $params['decryption_password'];
|
||||
}
|
||||
|
||||
// Set file name
|
||||
$file_name = null;
|
||||
if ( isset( $params['file_name'] ) ) {
|
||||
$file_name = trim( $params['file_name'] );
|
||||
}
|
||||
|
||||
// Set file offset
|
||||
if ( isset( $params['file_offset'] ) ) {
|
||||
$file_offset = (int) $params['file_offset'];
|
||||
} else {
|
||||
$file_offset = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Read package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
|
||||
|
||||
// Parse package.json file
|
||||
$config = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
|
||||
$config = json_decode( $config, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// Get compression type
|
||||
$compression_type = null;
|
||||
if ( ! empty( $config['Compression']['Enabled'] ) ) {
|
||||
$compression_type = $config['Compression']['Type'];
|
||||
}
|
||||
|
||||
// Open the archive file for reading
|
||||
$archive = new Ai1wm_Extractor( ai1wm_backup_path( $params ), $decryption_password, $compression_type );
|
||||
$archive->set_file_pointer( $file_offset );
|
||||
$archive->extract_one_file_to( ai1wm_storage_path( $params ) );
|
||||
$archive->close();
|
||||
|
||||
try {
|
||||
// Validate file name and file path for directory traversal
|
||||
if ( path_is_absolute( $file_name ) || validate_file( $file_name ) !== 0 ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Download file
|
||||
if ( ( $file_handle = ai1wm_open( ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . $file_name, 'rb' ) ) ) {
|
||||
while ( ! feof( $file_handle ) ) {
|
||||
$file_buffer = ai1wm_read( $file_handle, 1024 * 1024 );
|
||||
echo $file_buffer;
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
ai1wm_close( $file_handle );
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function download_backup( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// Download file
|
||||
if ( ( $file_handle = ai1wm_open( ai1wm_backup_path( $params ), 'rb' ) ) ) {
|
||||
while ( ! feof( $file_handle ) ) {
|
||||
$file_buffer = ai1wm_read( $file_handle, 1024 * 1024 );
|
||||
echo $file_buffer;
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
ai1wm_close( $file_handle );
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Controller {
|
||||
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'export/index' );
|
||||
}
|
||||
|
||||
public static function export( $params = array() ) {
|
||||
global $ai1wm_params;
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( array_merge( $_GET, $_POST ) );
|
||||
}
|
||||
|
||||
// Set priority
|
||||
if ( ! isset( $params['priority'] ) ) {
|
||||
$params['priority'] = 5;
|
||||
}
|
||||
|
||||
$ai1wm_params = $params;
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
ai1wm_setup_environment();
|
||||
ai1wm_setup_errors();
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access export action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Loop over filters
|
||||
if ( ( $filters = ai1wm_get_filters( 'ai1wm_export' ) ) ) {
|
||||
while ( $hooks = current( $filters ) ) {
|
||||
if ( intval( $params['priority'] ) === key( $filters ) ) {
|
||||
foreach ( $hooks as $hook ) {
|
||||
try {
|
||||
|
||||
// Run function hook
|
||||
$params = call_user_func_array( $hook['function'], array( $params ) );
|
||||
|
||||
} catch ( Ai1wm_Database_Exception $e ) {
|
||||
do_action( 'ai1wm_status_export_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error code, 2: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Export failed (database error). Code: %1$s. Message: %2$s', 'all-in-one-wp-migration' ), $e->getCode(), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
status_header( $e->getCode() );
|
||||
ai1wm_json_response( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
|
||||
exit;
|
||||
} catch ( Exception $e ) {
|
||||
do_action( 'ai1wm_status_export_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Export failed: %s', 'all-in-one-wp-migration' ), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
Ai1wm_Status::error( __( 'Export failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
Ai1wm_Notification::error( __( 'Export failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Set completed
|
||||
$completed = true;
|
||||
if ( isset( $params['completed'] ) ) {
|
||||
$completed = (bool) $params['completed'];
|
||||
}
|
||||
|
||||
// Do request
|
||||
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
if ( ! defined( 'DOING_CRON' ) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $params['ai1wm_manual_export'] ) ) {
|
||||
ai1wm_json_response( $params );
|
||||
exit;
|
||||
}
|
||||
|
||||
wp_remote_request(
|
||||
apply_filters( 'ai1wm_http_export_url', add_query_arg( array( 'ai1wm_import' => 1 ), admin_url( 'admin-ajax.php?action=ai1wm_export' ) ) ),
|
||||
array(
|
||||
'method' => apply_filters( 'ai1wm_http_export_method', 'POST' ),
|
||||
'timeout' => apply_filters( 'ai1wm_http_export_timeout', 10 ),
|
||||
'blocking' => apply_filters( 'ai1wm_http_export_blocking', false ),
|
||||
'sslverify' => apply_filters( 'ai1wm_http_export_sslverify', false ),
|
||||
'headers' => apply_filters( 'ai1wm_http_export_headers', array() ),
|
||||
'body' => apply_filters( 'ai1wm_http_export_body', $params ),
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
next( $filters );
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public static function buttons() {
|
||||
$active_filters = array();
|
||||
$static_filters = array();
|
||||
|
||||
// All-in-One WP Migration
|
||||
if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_file', Ai1wm_Template::get_content( 'export/button-file' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_file', Ai1wm_Template::get_content( 'export/button-file' ) );
|
||||
}
|
||||
|
||||
// Add Google Drive Extension
|
||||
if ( defined( 'AI1WMGE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_gdrive', Ai1wm_Template::get_content( 'export/button-gdrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_gdrive', Ai1wm_Template::get_content( 'export/button-gdrive' ) );
|
||||
}
|
||||
|
||||
// Add FTP Extension
|
||||
if ( defined( 'AI1WMFE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_ftp', Ai1wm_Template::get_content( 'export/button-ftp' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_ftp', Ai1wm_Template::get_content( 'export/button-ftp' ) );
|
||||
}
|
||||
|
||||
// Add Dropbox Extension
|
||||
if ( defined( 'AI1WMDE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_dropbox', Ai1wm_Template::get_content( 'export/button-dropbox' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_dropbox', Ai1wm_Template::get_content( 'export/button-dropbox' ) );
|
||||
}
|
||||
|
||||
// Add Amazon S3 Extension
|
||||
if ( defined( 'AI1WMSE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_s3', Ai1wm_Template::get_content( 'export/button-s3' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_s3', Ai1wm_Template::get_content( 'export/button-s3' ) );
|
||||
}
|
||||
|
||||
// Add OneDrive Extension
|
||||
if ( defined( 'AI1WMOE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_onedrive', Ai1wm_Template::get_content( 'export/button-onedrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_onedrive', Ai1wm_Template::get_content( 'export/button-onedrive' ) );
|
||||
}
|
||||
|
||||
// Add pCloud Extension
|
||||
if ( defined( 'AI1WMPE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_pcloud', Ai1wm_Template::get_content( 'export/button-pcloud' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_pcloud', Ai1wm_Template::get_content( 'export/button-pcloud' ) );
|
||||
}
|
||||
|
||||
// Add S3 Client Extension
|
||||
if ( defined( 'AI1WMNE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_s3_client', Ai1wm_Template::get_content( 'export/button-s3-client' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_s3_client', Ai1wm_Template::get_content( 'export/button-s3-client' ) );
|
||||
}
|
||||
|
||||
// Add Google Cloud Storage Extension
|
||||
if ( defined( 'AI1WMCE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_gcloud_storage', Ai1wm_Template::get_content( 'export/button-gcloud-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_gcloud_storage', Ai1wm_Template::get_content( 'export/button-gcloud-storage' ) );
|
||||
}
|
||||
|
||||
// Add DigitalOcean Spaces Extension
|
||||
if ( defined( 'AI1WMIE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_digitalocean', Ai1wm_Template::get_content( 'export/button-digitalocean' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_digitalocean', Ai1wm_Template::get_content( 'export/button-digitalocean' ) );
|
||||
}
|
||||
|
||||
// Add Mega Extension
|
||||
if ( defined( 'AI1WMEE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_mega', Ai1wm_Template::get_content( 'export/button-mega' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_mega', Ai1wm_Template::get_content( 'export/button-mega' ) );
|
||||
}
|
||||
|
||||
// Add Backblaze B2 Extension
|
||||
if ( defined( 'AI1WMAE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_b2', Ai1wm_Template::get_content( 'export/button-b2' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_b2', Ai1wm_Template::get_content( 'export/button-b2' ) );
|
||||
}
|
||||
|
||||
// Add Box Extension
|
||||
if ( defined( 'AI1WMBE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_box', Ai1wm_Template::get_content( 'export/button-box' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_box', Ai1wm_Template::get_content( 'export/button-box' ) );
|
||||
}
|
||||
|
||||
// Add Microsoft Azure Extension
|
||||
if ( defined( 'AI1WMZE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_azure_storage', Ai1wm_Template::get_content( 'export/button-azure-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_azure_storage', Ai1wm_Template::get_content( 'export/button-azure-storage' ) );
|
||||
}
|
||||
|
||||
// Add WebDAV Extension
|
||||
if ( defined( 'AI1WMWE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_webdav', Ai1wm_Template::get_content( 'export/button-webdav' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_webdav', Ai1wm_Template::get_content( 'export/button-webdav' ) );
|
||||
}
|
||||
|
||||
// Add Amazon Glacier Extension
|
||||
if ( defined( 'AI1WMRE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_glacier', Ai1wm_Template::get_content( 'export/button-glacier' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_glacier', Ai1wm_Template::get_content( 'export/button-glacier' ) );
|
||||
}
|
||||
|
||||
return array_merge( $active_filters, $static_filters );
|
||||
}
|
||||
|
||||
public static function cleanup() {
|
||||
try {
|
||||
// Iterate over storage directory
|
||||
$iterator = new Ai1wm_Recursive_Directory_Iterator( AI1WM_STORAGE_PATH );
|
||||
|
||||
// Exclude index.php
|
||||
$iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, array( 'index.php', 'index.html' ) );
|
||||
|
||||
// Loop over folders and files
|
||||
foreach ( $iterator as $item ) {
|
||||
try {
|
||||
if ( $item->isFile() && $item->getExtension() === 'log' ) {
|
||||
if ( $item->getMTime() < ( time() - AI1WM_MAX_LOG_CLEANUP ) ) {
|
||||
Ai1wm_File::delete( $item->getPathname() );
|
||||
}
|
||||
} elseif ( $item->getMTime() < ( time() - AI1WM_MAX_STORAGE_CLEANUP ) ) {
|
||||
if ( $item->isDir() ) {
|
||||
Ai1wm_Directory::delete( $item->getPathname() );
|
||||
} else {
|
||||
Ai1wm_File::delete( $item->getPathname() );
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Feedback_Controller {
|
||||
|
||||
public static function feedback( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set type
|
||||
$type = null;
|
||||
if ( isset( $params['ai1wm_type'] ) ) {
|
||||
$type = trim( $params['ai1wm_type'] );
|
||||
}
|
||||
|
||||
// Set e-mail
|
||||
$email = null;
|
||||
if ( isset( $params['ai1wm_email'] ) ) {
|
||||
$email = trim( $params['ai1wm_email'] );
|
||||
}
|
||||
|
||||
// Set message
|
||||
$message = null;
|
||||
if ( isset( $params['ai1wm_message'] ) ) {
|
||||
$message = trim( $params['ai1wm_message'] );
|
||||
}
|
||||
|
||||
// Set terms
|
||||
$terms = false;
|
||||
if ( isset( $params['ai1wm_terms'] ) ) {
|
||||
$terms = (bool) $params['ai1wm_terms'];
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access feedback action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$extensions = Ai1wm_Extensions::get();
|
||||
|
||||
// Exclude File Extension
|
||||
if ( defined( 'AI1WMTE_PLUGIN_NAME' ) ) {
|
||||
unset( $extensions[ AI1WMTE_PLUGIN_NAME ] );
|
||||
}
|
||||
|
||||
$purchases = array();
|
||||
foreach ( $extensions as $extension ) {
|
||||
$purchases[] = $extension['key'];
|
||||
}
|
||||
|
||||
try {
|
||||
Ai1wm_Feedback::add( $type, $email, $message, $terms, implode( PHP_EOL, $purchases ) );
|
||||
} catch ( Ai1wm_Feedback_Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Controller {
|
||||
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'import/index' );
|
||||
}
|
||||
|
||||
public static function import( $params = array() ) {
|
||||
global $ai1wm_params;
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( array_merge( $_GET, $_POST ) );
|
||||
}
|
||||
|
||||
// Set priority
|
||||
if ( ! isset( $params['priority'] ) ) {
|
||||
$params['priority'] = 10;
|
||||
}
|
||||
|
||||
$ai1wm_params = $params;
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
ai1wm_setup_environment();
|
||||
ai1wm_setup_errors();
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access import action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Loop over filters
|
||||
if ( ( $filters = ai1wm_get_filters( 'ai1wm_import' ) ) ) {
|
||||
while ( $hooks = current( $filters ) ) {
|
||||
if ( intval( $params['priority'] ) === key( $filters ) ) {
|
||||
foreach ( $hooks as $hook ) {
|
||||
try {
|
||||
|
||||
// Run function hook
|
||||
$params = call_user_func_array( $hook['function'], array( $params ) );
|
||||
|
||||
} catch ( Ai1wm_Upload_Exception $e ) {
|
||||
do_action( 'ai1wm_status_upload_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error code, 2: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Import failed. Code: %1$s. %2$s', 'all-in-one-wp-migration' ), $e->getCode(), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
status_header( $e->getCode() );
|
||||
ai1wm_json_response( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
|
||||
exit;
|
||||
} catch ( Ai1wm_Database_Exception $e ) {
|
||||
do_action( 'ai1wm_status_import_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error code, 2: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Import failed (database error). Code: %1$s. %2$s', 'all-in-one-wp-migration' ), $e->getCode(), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
status_header( $e->getCode() );
|
||||
ai1wm_json_response( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
|
||||
exit;
|
||||
} catch ( Exception $e ) {
|
||||
do_action( 'ai1wm_status_import_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Import failed: %s', 'all-in-one-wp-migration' ), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
if ( $e instanceof Ai1wm_CRC_Exception ) {
|
||||
Ai1wm_Status::left_error( __( 'Import failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
} else {
|
||||
Ai1wm_Status::error( __( 'Import failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
}
|
||||
|
||||
Ai1wm_Notification::error( __( 'Import failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Set completed
|
||||
$completed = true;
|
||||
if ( isset( $params['completed'] ) ) {
|
||||
$completed = (bool) $params['completed'];
|
||||
}
|
||||
|
||||
// Do request
|
||||
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
if ( ! defined( 'DOING_CRON' ) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $params['ai1wm_manual_import'] ) || isset( $params['ai1wm_manual_restore'] ) ) {
|
||||
ai1wm_json_response( $params );
|
||||
exit;
|
||||
}
|
||||
|
||||
wp_remote_request(
|
||||
apply_filters( 'ai1wm_http_import_url', add_query_arg( array( 'ai1wm_import' => 1 ), admin_url( 'admin-ajax.php?action=ai1wm_import' ) ) ),
|
||||
array(
|
||||
'method' => apply_filters( 'ai1wm_http_import_method', 'POST' ),
|
||||
'timeout' => apply_filters( 'ai1wm_http_import_timeout', 10 ),
|
||||
'blocking' => apply_filters( 'ai1wm_http_import_blocking', false ),
|
||||
'sslverify' => apply_filters( 'ai1wm_http_import_sslverify', false ),
|
||||
'headers' => apply_filters( 'ai1wm_http_import_headers', array() ),
|
||||
'body' => apply_filters( 'ai1wm_http_import_body', $params ),
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
next( $filters );
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public static function buttons() {
|
||||
$active_filters = array();
|
||||
$static_filters = array();
|
||||
|
||||
// All-in-One WP Migration
|
||||
if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_file', Ai1wm_Template::get_content( 'import/button-file' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_file', Ai1wm_Template::get_content( 'import/button-file' ) );
|
||||
}
|
||||
|
||||
// Add Google Drive Extension
|
||||
if ( defined( 'AI1WMGE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_gdrive', Ai1wm_Template::get_content( 'import/button-gdrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_gdrive', Ai1wm_Template::get_content( 'import/button-gdrive' ) );
|
||||
}
|
||||
|
||||
// Add FTP Extension
|
||||
if ( defined( 'AI1WMFE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_ftp', Ai1wm_Template::get_content( 'import/button-ftp' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_ftp', Ai1wm_Template::get_content( 'import/button-ftp' ) );
|
||||
}
|
||||
|
||||
// Add Dropbox Extension
|
||||
if ( defined( 'AI1WMDE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_dropbox', Ai1wm_Template::get_content( 'import/button-dropbox' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_dropbox', Ai1wm_Template::get_content( 'import/button-dropbox' ) );
|
||||
}
|
||||
|
||||
// Add URL Extension
|
||||
if ( defined( 'AI1WMLE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_url', Ai1wm_Template::get_content( 'import/button-url' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_url', Ai1wm_Template::get_content( 'import/button-url' ) );
|
||||
}
|
||||
|
||||
// Add Amazon S3 Extension
|
||||
if ( defined( 'AI1WMSE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_s3', Ai1wm_Template::get_content( 'import/button-s3' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_s3', Ai1wm_Template::get_content( 'import/button-s3' ) );
|
||||
}
|
||||
|
||||
// Add OneDrive Extension
|
||||
if ( defined( 'AI1WMOE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_onedrive', Ai1wm_Template::get_content( 'import/button-onedrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_onedrive', Ai1wm_Template::get_content( 'import/button-onedrive' ) );
|
||||
}
|
||||
|
||||
// Add pCloud Extension
|
||||
if ( defined( 'AI1WMPE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_pcloud', Ai1wm_Template::get_content( 'import/button-pcloud' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_pcloud', Ai1wm_Template::get_content( 'import/button-pcloud' ) );
|
||||
}
|
||||
|
||||
// Add S3 Client Extension
|
||||
if ( defined( 'AI1WMNE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_s3_client', Ai1wm_Template::get_content( 'import/button-s3-client' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_s3_client', Ai1wm_Template::get_content( 'import/button-s3-client' ) );
|
||||
}
|
||||
|
||||
// Add Google Cloud Storage Extension
|
||||
if ( defined( 'AI1WMCE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_gcloud_storage', Ai1wm_Template::get_content( 'import/button-gcloud-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_gcloud_storage', Ai1wm_Template::get_content( 'import/button-gcloud-storage' ) );
|
||||
}
|
||||
|
||||
// Add DigitalOcean Spaces Extension
|
||||
if ( defined( 'AI1WMIE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_digitalocean', Ai1wm_Template::get_content( 'import/button-digitalocean' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_digitalocean', Ai1wm_Template::get_content( 'import/button-digitalocean' ) );
|
||||
}
|
||||
|
||||
// Add Mega Extension
|
||||
if ( defined( 'AI1WMEE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_mega', Ai1wm_Template::get_content( 'import/button-mega' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_mega', Ai1wm_Template::get_content( 'import/button-mega' ) );
|
||||
}
|
||||
|
||||
// Add Backblaze B2 Extension
|
||||
if ( defined( 'AI1WMAE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_b2', Ai1wm_Template::get_content( 'import/button-b2' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_b2', Ai1wm_Template::get_content( 'import/button-b2' ) );
|
||||
}
|
||||
|
||||
// Add Box Extension
|
||||
if ( defined( 'AI1WMBE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_box', Ai1wm_Template::get_content( 'import/button-box' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_box', Ai1wm_Template::get_content( 'import/button-box' ) );
|
||||
}
|
||||
|
||||
// Add Microsoft Azure Extension
|
||||
if ( defined( 'AI1WMZE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_azure_storage', Ai1wm_Template::get_content( 'import/button-azure-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_azure_storage', Ai1wm_Template::get_content( 'import/button-azure-storage' ) );
|
||||
}
|
||||
|
||||
// Add WebDAV Extension
|
||||
if ( defined( 'AI1WMWE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_webdav', Ai1wm_Template::get_content( 'import/button-webdav' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_webdav', Ai1wm_Template::get_content( 'import/button-webdav' ) );
|
||||
}
|
||||
|
||||
// Add Amazon Glacier Extension
|
||||
if ( defined( 'AI1WMRE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_glacier', Ai1wm_Template::get_content( 'import/button-glacier' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_glacier', Ai1wm_Template::get_content( 'import/button-glacier' ) );
|
||||
}
|
||||
|
||||
return array_merge( $active_filters, $static_filters );
|
||||
}
|
||||
|
||||
public static function pro() {
|
||||
return Ai1wm_Template::get_content( 'import/pro' );
|
||||
}
|
||||
|
||||
public static function max_chunk_size() {
|
||||
return min(
|
||||
ai1wm_parse_size( ini_get( 'post_max_size' ), AI1WM_MAX_CHUNK_SIZE ),
|
||||
ai1wm_parse_size( ini_get( 'upload_max_filesize' ), AI1WM_MAX_CHUNK_SIZE ),
|
||||
ai1wm_parse_size( AI1WM_MAX_CHUNK_SIZE )
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Reset_Controller {
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'reset/index' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Schedules_Controller {
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'schedules/index' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Status_Controller {
|
||||
|
||||
public static function status( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_GET );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access status action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( get_option( AI1WM_STATUS, array() ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Updater_Controller {
|
||||
|
||||
public static function plugins_api( $result, $action = null, $args = null ) {
|
||||
return Ai1wm_Updater::plugins_api( $result, $action, $args );
|
||||
}
|
||||
|
||||
public static function pre_update_plugins( $transient ) {
|
||||
if ( empty( $transient->checked ) ) {
|
||||
return $transient;
|
||||
}
|
||||
|
||||
// Check for updates every 11 hours
|
||||
if ( ( $last_check_for_updates = get_site_transient( AI1WM_LAST_CHECK_FOR_UPDATES ) ) ) {
|
||||
if ( ( time() - $last_check_for_updates ) < 11 * HOUR_IN_SECONDS ) {
|
||||
return $transient;
|
||||
}
|
||||
}
|
||||
|
||||
// Set last check for updates
|
||||
set_site_transient( AI1WM_LAST_CHECK_FOR_UPDATES, time() );
|
||||
|
||||
// Check for updates
|
||||
Ai1wm_Updater::check_for_updates();
|
||||
|
||||
return $transient;
|
||||
}
|
||||
|
||||
public static function update_plugins( $transient ) {
|
||||
return Ai1wm_Updater::update_plugins( $transient );
|
||||
}
|
||||
|
||||
public static function check_for_updates() {
|
||||
return Ai1wm_Updater::check_for_updates();
|
||||
}
|
||||
|
||||
public static function plugin_row_meta( $plugin_meta, $plugin_file ) {
|
||||
return Ai1wm_Updater::plugin_row_meta( $plugin_meta, $plugin_file );
|
||||
}
|
||||
|
||||
public static function in_plugin_update_message( $plugin_data, $response ) {
|
||||
$updater = get_option( AI1WM_UPDATER, array() );
|
||||
|
||||
// Get updater details
|
||||
if ( isset( $updater[ $plugin_data['slug'] ]['update_message'] ) ) {
|
||||
Ai1wm_Template::render( 'updater/update', array( 'message' => $updater[ $plugin_data['slug'] ]['update_message'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Backups {
|
||||
|
||||
/**
|
||||
* Get all backup files
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_files() {
|
||||
$backups = array();
|
||||
|
||||
try {
|
||||
|
||||
// Iterate over directory
|
||||
$iterator = new Ai1wm_Recursive_Directory_Iterator( AI1WM_BACKUPS_PATH );
|
||||
|
||||
// Filter by extensions
|
||||
$iterator = new Ai1wm_Recursive_Extension_Filter( $iterator, array( 'wpress' ) );
|
||||
|
||||
// Recursively iterate over directory
|
||||
$iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );
|
||||
|
||||
// Get backup files
|
||||
foreach ( $iterator as $item ) {
|
||||
try {
|
||||
if ( ai1wm_is_filesize_supported( $item->getPathname() ) ) {
|
||||
$backups[] = array(
|
||||
'path' => $iterator->getSubPath(),
|
||||
'filename' => $iterator->getSubPathname(),
|
||||
'mtime' => $iterator->getMTime(),
|
||||
'size' => $iterator->getSize(),
|
||||
);
|
||||
} else {
|
||||
$backups[] = array(
|
||||
'path' => $iterator->getSubPath(),
|
||||
'filename' => $iterator->getSubPathname(),
|
||||
'mtime' => $iterator->getMTime(),
|
||||
'size' => null,
|
||||
);
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
$backups[] = array(
|
||||
'path' => $iterator->getSubPath(),
|
||||
'filename' => $iterator->getSubPathname(),
|
||||
'mtime' => null,
|
||||
'size' => null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort backups modified date
|
||||
usort( $backups, 'Ai1wm_Backups::compare' );
|
||||
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
|
||||
return $backups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count all backup files
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function count_files() {
|
||||
return count( Ai1wm_Backups::get_files() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete backup file
|
||||
*
|
||||
* @param string $file File name
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delete_file( $file ) {
|
||||
if ( ai1wm_is_filename_supported( $file ) ) {
|
||||
if ( $deleted = @unlink( ai1wm_backup_path( array( 'archive' => $file ) ) ) ) {
|
||||
do_action( 'ai1wm_status_backup_deleted', $file );
|
||||
}
|
||||
|
||||
return $deleted;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all backup labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_labels() {
|
||||
return get_option( AI1WM_BACKUPS_LABELS, array() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set backup label
|
||||
*
|
||||
* @param string $file File name
|
||||
* @param string $label File label
|
||||
* @return boolean
|
||||
*/
|
||||
public static function set_label( $file, $label ) {
|
||||
if ( ( $labels = get_option( AI1WM_BACKUPS_LABELS, array() ) ) !== false ) {
|
||||
$labels[ $file ] = $label;
|
||||
}
|
||||
|
||||
return update_option( AI1WM_BACKUPS_LABELS, $labels );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete backup label
|
||||
*
|
||||
* @param string $file File name
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delete_label( $file ) {
|
||||
if ( ( $labels = get_option( AI1WM_BACKUPS_LABELS, array() ) ) !== false ) {
|
||||
unset( $labels[ $file ] );
|
||||
}
|
||||
|
||||
return update_option( AI1WM_BACKUPS_LABELS, $labels );
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare backup files by modified time
|
||||
*
|
||||
* @param array $a File item A
|
||||
* @param array $b File item B
|
||||
* @return integer
|
||||
*/
|
||||
public static function compare( $a, $b ) {
|
||||
if ( $a['mtime'] === $b['mtime'] ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ( $a['mtime'] > $b['mtime'] ) ? - 1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if backups are downloadable
|
||||
*/
|
||||
public static function are_downloadable() {
|
||||
static $downloadable = null;
|
||||
if ( is_null( $downloadable ) ) {
|
||||
$downloadable = Ai1wm_Backups::are_in_wp_content_folder() || strpos( AI1WM_BACKUPS_PATH, untrailingslashit( ABSPATH ) ) === 0;
|
||||
}
|
||||
|
||||
return $downloadable;
|
||||
}
|
||||
|
||||
public static function are_in_wp_content_folder() {
|
||||
static $in_wp_content = null;
|
||||
if ( is_null( $in_wp_content ) ) {
|
||||
$in_wp_content = strpos( AI1WM_BACKUPS_PATH, untrailingslashit( WP_CONTENT_DIR ) ) === 0;
|
||||
}
|
||||
|
||||
return $in_wp_content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Compatibility {
|
||||
|
||||
public static function get( $params ) {
|
||||
$extensions = Ai1wm_Extensions::get();
|
||||
|
||||
foreach ( $extensions as $extension_name => $extension_data ) {
|
||||
if ( ! isset( $params[ $extension_data['short'] ] ) ) {
|
||||
unset( $extensions[ $extension_name ] );
|
||||
}
|
||||
}
|
||||
|
||||
// If no extension is used, update everything that is available
|
||||
if ( empty( $extensions ) ) {
|
||||
$extensions = Ai1wm_Extensions::get();
|
||||
}
|
||||
|
||||
$messages = array();
|
||||
foreach ( $extensions as $extension_name => $extension_data ) {
|
||||
if ( ! Ai1wm_Compatibility::check( $extension_data ) ) {
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: Extension name. */
|
||||
$messages[] = sprintf( __( '%s is out of date. Please update this extension before using it.', 'all-in-one-wp-migration' ), $extension_data['title'] );
|
||||
} else {
|
||||
/* translators: 1: Extension name, 2: Plugins update page. */
|
||||
$messages[] = sprintf( __( '<strong>%1$s</strong> is out of date. You must <a href="%2$s">update this extension</a> before using it.<br />', 'all-in-one-wp-migration' ), $extension_data['title'], network_admin_url( 'plugins.php' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
public static function check( $extension ) {
|
||||
if ( $extension['version'] !== 'develop' ) {
|
||||
if ( version_compare( $extension['version'], $extension['requires'], '<' ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Abstract {}
|
||||
class Ai1wm_Import_Abstract {}
|
||||
class Ai1wm_Config {}
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Extensions {
|
||||
|
||||
/**
|
||||
* Get active extensions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get() {
|
||||
$extensions = array();
|
||||
|
||||
// Add Microsoft Azure Extension
|
||||
if ( defined( 'AI1WMZE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMZE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMZE_PURCHASE_ID,
|
||||
'title' => AI1WMZE_PLUGIN_TITLE,
|
||||
'about' => AI1WMZE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMZE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMZE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMZE_VERSION,
|
||||
'requires' => '1.53',
|
||||
'short' => AI1WMZE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Backblaze B2 Extension
|
||||
if ( defined( 'AI1WMAE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMAE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMAE_PURCHASE_ID,
|
||||
'title' => AI1WMAE_PLUGIN_TITLE,
|
||||
'about' => AI1WMAE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMAE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMAE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMAE_VERSION,
|
||||
'requires' => '1.59',
|
||||
'short' => AI1WMAE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Backup Plugin
|
||||
if ( defined( 'AI1WMVE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMVE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMVE_PURCHASE_ID,
|
||||
'title' => AI1WMVE_PLUGIN_TITLE,
|
||||
'about' => AI1WMVE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMVE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMVE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMVE_VERSION,
|
||||
'requires' => '1.0',
|
||||
'short' => AI1WMVE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Box Extension
|
||||
if ( defined( 'AI1WMBE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMBE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMBE_PURCHASE_ID,
|
||||
'title' => AI1WMBE_PLUGIN_TITLE,
|
||||
'about' => AI1WMBE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMBE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMBE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMBE_VERSION,
|
||||
'requires' => '1.69',
|
||||
'short' => AI1WMBE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add DigitalOcean Spaces Extension
|
||||
if ( defined( 'AI1WMIE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMIE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMIE_PURCHASE_ID,
|
||||
'title' => AI1WMIE_PLUGIN_TITLE,
|
||||
'about' => AI1WMIE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMIE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMIE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMIE_VERSION,
|
||||
'requires' => '1.69',
|
||||
'short' => AI1WMIE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Direct Extension
|
||||
if ( defined( 'AI1WMXE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMXE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMXE_PURCHASE_ID,
|
||||
'title' => AI1WMXE_PLUGIN_TITLE,
|
||||
'about' => AI1WMXE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMXE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMXE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMXE_VERSION,
|
||||
'requires' => '1.38',
|
||||
'short' => AI1WMXE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Dropbox Extension
|
||||
if ( defined( 'AI1WMDE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMDE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMDE_PURCHASE_ID,
|
||||
'title' => AI1WMDE_PLUGIN_TITLE,
|
||||
'about' => AI1WMDE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMDE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMDE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMDE_VERSION,
|
||||
'requires' => '3.94',
|
||||
'short' => AI1WMDE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add File Extension
|
||||
if ( defined( 'AI1WMTE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMTE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMTE_PURCHASE_ID,
|
||||
'title' => AI1WMTE_PLUGIN_TITLE,
|
||||
'about' => AI1WMTE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMTE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMTE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMTE_VERSION,
|
||||
'requires' => '1.5',
|
||||
'short' => AI1WMTE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add FTP Extension
|
||||
if ( defined( 'AI1WMFE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMFE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMFE_PURCHASE_ID,
|
||||
'title' => AI1WMFE_PLUGIN_TITLE,
|
||||
'about' => AI1WMFE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMFE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMFE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMFE_VERSION,
|
||||
'requires' => '2.93',
|
||||
'short' => AI1WMFE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Google Cloud Storage Extension
|
||||
if ( defined( 'AI1WMCE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMCE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMCE_PURCHASE_ID,
|
||||
'title' => AI1WMCE_PLUGIN_TITLE,
|
||||
'about' => AI1WMCE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMCE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMCE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMCE_VERSION,
|
||||
'requires' => '1.62',
|
||||
'short' => AI1WMCE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Google Drive Extension
|
||||
if ( defined( 'AI1WMGE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMGE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMGE_PURCHASE_ID,
|
||||
'title' => AI1WMGE_PLUGIN_TITLE,
|
||||
'about' => AI1WMGE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMGE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMGE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMGE_VERSION,
|
||||
'requires' => '2.100',
|
||||
'short' => AI1WMGE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Amazon Glacier Extension
|
||||
if ( defined( 'AI1WMRE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMRE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMRE_PURCHASE_ID,
|
||||
'title' => AI1WMRE_PLUGIN_TITLE,
|
||||
'about' => AI1WMRE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMRE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMRE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMRE_VERSION,
|
||||
'requires' => '1.55',
|
||||
'short' => AI1WMRE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Mega Extension
|
||||
if ( defined( 'AI1WMEE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMEE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMEE_PURCHASE_ID,
|
||||
'title' => AI1WMEE_PLUGIN_TITLE,
|
||||
'about' => AI1WMEE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMEE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMEE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMEE_VERSION,
|
||||
'requires' => '1.64',
|
||||
'short' => AI1WMEE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Multisite Extension
|
||||
if ( defined( 'AI1WMME_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMME_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMME_PURCHASE_ID,
|
||||
'title' => AI1WMME_PLUGIN_TITLE,
|
||||
'about' => AI1WMME_PLUGIN_ABOUT,
|
||||
'check' => AI1WMME_PLUGIN_CHECK,
|
||||
'basename' => AI1WMME_PLUGIN_BASENAME,
|
||||
'version' => AI1WMME_VERSION,
|
||||
'requires' => '4.62',
|
||||
'short' => AI1WMME_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add OneDrive Extension
|
||||
if ( defined( 'AI1WMOE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMOE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMOE_PURCHASE_ID,
|
||||
'title' => AI1WMOE_PLUGIN_TITLE,
|
||||
'about' => AI1WMOE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMOE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMOE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMOE_VERSION,
|
||||
'requires' => '1.84',
|
||||
'short' => AI1WMOE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add pCloud Extension
|
||||
if ( defined( 'AI1WMPE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMPE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMPE_PURCHASE_ID,
|
||||
'title' => AI1WMPE_PLUGIN_TITLE,
|
||||
'about' => AI1WMPE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMPE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMPE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMPE_VERSION,
|
||||
'requires' => '1.56',
|
||||
'short' => AI1WMPE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Pro Plugin
|
||||
if ( defined( 'AI1WMKE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMKE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMKE_PURCHASE_ID,
|
||||
'title' => AI1WMKE_PLUGIN_TITLE,
|
||||
'about' => AI1WMKE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMKE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMKE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMKE_VERSION,
|
||||
'requires' => '1.37',
|
||||
'short' => AI1WMKE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add S3 Client Extension
|
||||
if ( defined( 'AI1WMNE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMNE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMNE_PURCHASE_ID,
|
||||
'title' => AI1WMNE_PLUGIN_TITLE,
|
||||
'about' => AI1WMNE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMNE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMNE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMNE_VERSION,
|
||||
'requires' => '1.56',
|
||||
'short' => AI1WMNE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Amazon S3 Extension
|
||||
if ( defined( 'AI1WMSE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMSE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMSE_PURCHASE_ID,
|
||||
'title' => AI1WMSE_PLUGIN_TITLE,
|
||||
'about' => AI1WMSE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMSE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMSE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMSE_VERSION,
|
||||
'requires' => '3.95',
|
||||
'short' => AI1WMSE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Unlimited Extension
|
||||
if ( defined( 'AI1WMUE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMUE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMUE_PURCHASE_ID,
|
||||
'title' => AI1WMUE_PLUGIN_TITLE,
|
||||
'about' => AI1WMUE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMUE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMUE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMUE_VERSION,
|
||||
'requires' => '2.83',
|
||||
'short' => AI1WMUE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add URL Extension
|
||||
if ( defined( 'AI1WMLE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMLE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMLE_PURCHASE_ID,
|
||||
'title' => AI1WMLE_PLUGIN_TITLE,
|
||||
'about' => AI1WMLE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMLE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMLE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMLE_VERSION,
|
||||
'requires' => '2.79',
|
||||
'short' => AI1WMLE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
// Add WebDAV Extension
|
||||
if ( defined( 'AI1WMWE_PLUGIN_NAME' ) ) {
|
||||
$extensions[ AI1WMWE_PLUGIN_NAME ] = array(
|
||||
'key' => AI1WMWE_PURCHASE_ID,
|
||||
'title' => AI1WMWE_PLUGIN_TITLE,
|
||||
'about' => AI1WMWE_PLUGIN_ABOUT,
|
||||
'check' => AI1WMWE_PLUGIN_CHECK,
|
||||
'basename' => AI1WMWE_PLUGIN_BASENAME,
|
||||
'version' => AI1WMWE_VERSION,
|
||||
'requires' => '1.50',
|
||||
'short' => AI1WMWE_PLUGIN_SHORT,
|
||||
);
|
||||
}
|
||||
|
||||
return $extensions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Feedback {
|
||||
|
||||
/**
|
||||
* Submit customer feedback to servmask.com
|
||||
*
|
||||
* @param string $type Feedback type
|
||||
* @param string $email User e-mail
|
||||
* @param string $message User message
|
||||
* @param integer $terms User accept terms
|
||||
* @param string $purchases Purchases IDs
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function add( $type, $email, $message, $terms, $purchases ) {
|
||||
// Validate email
|
||||
if ( filter_var( $email, FILTER_VALIDATE_EMAIL ) === false ) {
|
||||
throw new Ai1wm_Feedback_Exception( esc_html__( 'Please enter a valid email address.', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
|
||||
// Validate type
|
||||
if ( empty( $type ) ) {
|
||||
throw new Ai1wm_Feedback_Exception( esc_html__( 'Please select a feedback type.', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
|
||||
// Validate message
|
||||
if ( empty( $message ) ) {
|
||||
throw new Ai1wm_Feedback_Exception( esc_html__( 'Please describe your issue or feedback.', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
|
||||
// Validate terms
|
||||
if ( empty( $terms ) ) {
|
||||
throw new Ai1wm_Feedback_Exception( esc_html__( 'Please check the consent box so we can use your email to respond to you.', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
|
||||
$response = wp_remote_post(
|
||||
AI1WM_FEEDBACK_URL,
|
||||
array(
|
||||
'timeout' => 15,
|
||||
'body' => array(
|
||||
'type' => $type,
|
||||
'email' => $email,
|
||||
'message' => $message,
|
||||
'purchases' => $purchases,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
/* translators: Error message. */
|
||||
throw new Ai1wm_Feedback_Exception( esc_html( sprintf( __( 'An error occurred while submitting your request: %s', 'all-in-one-wp-migration' ), $response->get_error_message() ) ) );
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Handler {
|
||||
|
||||
/**
|
||||
* Error handler
|
||||
*
|
||||
* @param integer $errno Error level
|
||||
* @param string $errstr Error message
|
||||
* @param string $errfile Error file
|
||||
* @param integer $errline Error line
|
||||
* @return void
|
||||
*/
|
||||
public static function error( $errno, $errstr, $errfile, $errline ) {
|
||||
global $ai1wm_params;
|
||||
if ( ! empty( $ai1wm_params['storage'] ) ) {
|
||||
Ai1wm_Log::error( $ai1wm_params['storage'], array( 'Number' => $errno, 'Message' => $errstr, 'File' => $errfile, 'Line' => $errline ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown handler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function shutdown() {
|
||||
global $ai1wm_params;
|
||||
if ( ! empty( $ai1wm_params['storage'] ) ) {
|
||||
if ( ( $error = error_get_last() ) ) {
|
||||
Ai1wm_Log::error( $ai1wm_params['storage'], $error );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Log {
|
||||
|
||||
public static function error( $nonce, $params ) {
|
||||
$data = array();
|
||||
|
||||
// Add date
|
||||
$data[] = gmdate( 'M d Y H:i:s', time() );
|
||||
|
||||
// Add params
|
||||
$data[] = json_encode( $params );
|
||||
|
||||
// Add empty line
|
||||
$data[] = PHP_EOL;
|
||||
|
||||
// Write log data
|
||||
if ( $handle = ai1wm_open( ai1wm_error_path( $nonce ), 'a' ) ) {
|
||||
ai1wm_write( $handle, implode( PHP_EOL, $data ) );
|
||||
ai1wm_close( $handle );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Message {
|
||||
|
||||
public static function flash( $type, $message ) {
|
||||
if ( ( $messages = get_option( AI1WM_MESSAGES, array() ) ) !== false ) {
|
||||
return update_option( AI1WM_MESSAGES, array_merge( $messages, array( $type => $message ) ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function has( $type ) {
|
||||
if ( ( $messages = get_option( AI1WM_MESSAGES, array() ) ) ) {
|
||||
if ( isset( $messages[ $type ] ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function get( $type ) {
|
||||
$message = null;
|
||||
if ( ( $messages = get_option( AI1WM_MESSAGES, array() ) ) ) {
|
||||
if ( isset( $messages[ $type ] ) && ( $message = $messages[ $type ] ) ) {
|
||||
unset( $messages[ $type ] );
|
||||
}
|
||||
|
||||
// Set messages
|
||||
update_option( AI1WM_MESSAGES, $messages );
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Notification {
|
||||
|
||||
public static function ok( $subject, $message ) {
|
||||
// Enable notifications
|
||||
if ( ! apply_filters( 'ai1wm_notification_ok_toggle', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set email
|
||||
if ( ! ( $email = apply_filters( 'ai1wm_notification_ok_email', get_option( 'admin_email', false ) ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set subject
|
||||
if ( ! ( $subject = apply_filters( 'ai1wm_notification_ok_subject', $subject ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set message
|
||||
if ( ! ( $message = apply_filters( 'ai1wm_notification_ok_message', $message ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send email
|
||||
if ( ai1wm_is_scheduled_backup() ) {
|
||||
wp_mail( $email, $subject, $message, array( 'Content-Type: text/html; charset=UTF-8' ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static function error( $subject, $message ) {
|
||||
// Enable notifications
|
||||
if ( ! apply_filters( 'ai1wm_notification_error_toggle', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set email
|
||||
if ( ! ( $email = apply_filters( 'ai1wm_notification_error_email', get_option( 'admin_email', false ) ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set subject
|
||||
if ( ! ( $subject = apply_filters( 'ai1wm_notification_error_subject', $subject ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set message
|
||||
if ( ! ( $message = apply_filters( 'ai1wm_notification_error_message', $message ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send email
|
||||
if ( ai1wm_is_scheduled_backup() ) {
|
||||
wp_mail( $email, $subject, $message, array( 'Content-Type: text/html; charset=UTF-8' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Status {
|
||||
|
||||
public static function error( $title, $message ) {
|
||||
self::log( array( 'type' => 'error', 'title' => $title, 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function left_error( $title, $message ) {
|
||||
self::log( array( 'type' => 'error', 'title' => $title, 'message' => $message, 'leftAligned' => true ) );
|
||||
}
|
||||
|
||||
public static function info( $message ) {
|
||||
self::log( array( 'type' => 'info', 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function download( $message ) {
|
||||
self::log( array( 'type' => 'download', 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function disk_space_confirm( $message ) {
|
||||
self::log( array( 'type' => 'disk_space_confirm', 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function confirm( $message ) {
|
||||
self::log( array( 'type' => 'confirm', 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function done( $title, $message = null ) {
|
||||
self::log( array( 'type' => 'done', 'title' => $title, 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function blogs( $title, $message ) {
|
||||
self::log( array( 'type' => 'blogs', 'title' => $title, 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function progress( $percent ) {
|
||||
self::log( array( 'type' => 'progress', 'percent' => $percent ) );
|
||||
}
|
||||
|
||||
public static function backup_is_encrypted( $error ) {
|
||||
self::log( array( 'type' => 'backup_is_encrypted', 'error' => $error ) );
|
||||
}
|
||||
|
||||
public static function server_cannot_decrypt( $message ) {
|
||||
self::log( array( 'type' => 'server_cannot_decrypt', 'message' => $message ) );
|
||||
}
|
||||
|
||||
public static function log( $data ) {
|
||||
if ( ! ai1wm_is_scheduled_backup() ) {
|
||||
update_option( AI1WM_STATUS, $data );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Template extends Bandar {
|
||||
|
||||
/**
|
||||
* Renders a file and returns its contents
|
||||
*
|
||||
* @param string $view View to render
|
||||
* @param array $args Set of arguments
|
||||
* @param string|bool $path Path to template
|
||||
* @return string Rendered view
|
||||
*/
|
||||
public static function render( $view, $args = array(), $path = false ) {
|
||||
parent::render( $view, $args, $path );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns link to an asset file
|
||||
*
|
||||
* @param string $asset Asset file
|
||||
* @param string $prefix Asset prefix
|
||||
* @return string Asset URL
|
||||
*/
|
||||
public static function asset_link( $asset, $prefix = 'AI1WM' ) {
|
||||
return constant( $prefix . '_URL' ) . '/lib/view/assets/' . $asset . '?v=' . constant( $prefix . '_VERSION' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a file and gets its contents
|
||||
*
|
||||
* @param string $view View to render
|
||||
* @param array $args Set of arguments
|
||||
* @param string|bool $path Path to template
|
||||
* @return string Rendered view
|
||||
*/
|
||||
public static function get_content( $view, $args = array(), $path = false ) {
|
||||
return parent::getTemplateContent( $view, $args, $path );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Updater {
|
||||
|
||||
/**
|
||||
* Retrieve plugin installer pages from WordPress Plugins API.
|
||||
*
|
||||
* @param mixed $result
|
||||
* @param string $action
|
||||
* @param array|object $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function plugins_api( $result, $action = null, $args = null ) {
|
||||
if ( empty( $args->slug ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Get extensions
|
||||
$extensions = Ai1wm_Extensions::get();
|
||||
|
||||
// View details page
|
||||
if ( isset( $extensions[ $args->slug ] ) && $action === 'plugin_information' ) {
|
||||
$updater = get_option( AI1WM_UPDATER, array() );
|
||||
|
||||
// Plugin details
|
||||
if ( isset( $updater[ $args->slug ] ) ) {
|
||||
return (object) $updater[ $args->slug ];
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update WordPress plugin list page.
|
||||
*
|
||||
* @param object $transient
|
||||
* @return object
|
||||
*/
|
||||
public static function update_plugins( $transient ) {
|
||||
global $wp_version;
|
||||
|
||||
// Creating default object from empty value
|
||||
if ( ! is_object( $transient ) ) {
|
||||
$transient = (object) array();
|
||||
}
|
||||
|
||||
// Get extensions
|
||||
$extensions = Ai1wm_Extensions::get();
|
||||
|
||||
// Get current updates
|
||||
$updater = get_option( AI1WM_UPDATER, array() );
|
||||
|
||||
// Get extension updates
|
||||
foreach ( $updater as $slug => $update ) {
|
||||
if ( isset( $extensions[ $slug ], $update['version'], $update['homepage'], $update['download_link'], $update['icons'] ) ) {
|
||||
|
||||
// Get download URL
|
||||
$download_url = add_query_arg( array( 'siteurl' => get_site_url() ), sprintf( '%s/%s', $update['download_link'], $extensions[ $slug ]['key'] ) );
|
||||
|
||||
// Set plugin details
|
||||
$plugin_details = (object) array(
|
||||
'slug' => $slug,
|
||||
'new_version' => $update['version'],
|
||||
'url' => $update['homepage'],
|
||||
'plugin' => $extensions[ $slug ]['basename'],
|
||||
'package' => $download_url,
|
||||
'tested' => $wp_version,
|
||||
'icons' => $update['icons'],
|
||||
);
|
||||
|
||||
// Enable auto updates
|
||||
if ( version_compare( $extensions[ $slug ]['version'], $update['version'], '<' ) ) {
|
||||
$transient->response[ $extensions[ $slug ]['basename'] ] = $plugin_details;
|
||||
} else {
|
||||
$transient->no_update[ $extensions[ $slug ]['basename'] ] = $plugin_details;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $transient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for extension updates
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function check_for_updates() {
|
||||
$updater = get_option( AI1WM_UPDATER, array() );
|
||||
|
||||
// Get extension updates
|
||||
foreach ( Ai1wm_Extensions::get() as $slug => $extension ) {
|
||||
$about = wp_remote_get(
|
||||
$extension['about'],
|
||||
array(
|
||||
'timeout' => 15,
|
||||
'headers' => array( 'Accept' => 'application/json' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Add plugin updates
|
||||
if ( is_wp_error( $about ) ) {
|
||||
$updater[ $slug ]['error_message'] = $about->get_error_message();
|
||||
} else {
|
||||
$body = wp_remote_retrieve_body( $about );
|
||||
if ( ( $data = json_decode( $body, true ) ) ) {
|
||||
if ( isset( $data['slug'], $data['version'], $data['homepage'], $data['download_link'], $data['icons'] ) ) {
|
||||
$updater[ $slug ] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
// Add plugin messages
|
||||
$check = wp_remote_get(
|
||||
add_query_arg( array( 'site_url' => get_site_url(), 'admin_email' => get_option( 'admin_email' ) ), sprintf( '%s/%s', $extension['check'], $extension['key'] ) ),
|
||||
array(
|
||||
'timeout' => 15,
|
||||
'headers' => array( 'Accept' => 'application/json' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Add plugin checks
|
||||
if ( is_wp_error( $check ) ) {
|
||||
$updater[ $slug ]['error_message'] = $check->get_error_message();
|
||||
} else {
|
||||
$body = wp_remote_retrieve_body( $check );
|
||||
if ( ( $data = json_decode( $body, true ) ) ) {
|
||||
if ( isset( $updater[ $slug ], $data['message'] ) ) {
|
||||
$updater[ $slug ]['update_message'] = $data['message'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return update_option( AI1WM_UPDATER, $updater );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add "Check for updates" link
|
||||
*
|
||||
* @param array $plugin_meta An array of the plugin's metadata, including the version, author, author URI, and plugin URI
|
||||
* @param string $plugin_file Path to the plugin file relative to the plugins directory
|
||||
* @return array
|
||||
*/
|
||||
public static function plugin_row_meta( $plugin_meta, $plugin_file ) {
|
||||
$updater = get_option( AI1WM_UPDATER, array() );
|
||||
|
||||
// Add link for each extension
|
||||
foreach ( Ai1wm_Extensions::get() as $slug => $extension ) {
|
||||
if ( $plugin_file === $extension['basename'] ) {
|
||||
|
||||
// Get updater URL
|
||||
$updater_url = add_query_arg( array( 'ai1wm_check_for_updates' => 1, 'ai1wm_nonce' => wp_create_nonce( 'ai1wm_check_for_updates' ) ), network_admin_url( 'plugins.php' ) );
|
||||
|
||||
// Check for updates
|
||||
$plugin_meta[] = Ai1wm_Template::get_content( 'updater/check', array( 'url' => $updater_url ) );
|
||||
|
||||
// Check error message
|
||||
if ( isset( $updater[ $slug ]['error_message'] ) ) {
|
||||
$plugin_meta[] = Ai1wm_Template::get_content( 'updater/error', array( 'message' => $updater[ $slug ]['error_message'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $plugin_meta;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Archive_Crc {
|
||||
|
||||
public static function execute( $params ) {
|
||||
$archive_bytes_read = 0;
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Calculating archive checksum...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Set archive bytes remaining
|
||||
if ( isset( $params['archive_bytes_remaining'] ) ) {
|
||||
$archive_bytes_remaining = (int) $params['archive_bytes_remaining'];
|
||||
} else {
|
||||
$archive_bytes_remaining = ai1wm_archive_bytes( $params );
|
||||
}
|
||||
|
||||
// Set archive bytes offset
|
||||
if ( isset( $params['archive_bytes_offset'] ) ) {
|
||||
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
|
||||
} else {
|
||||
$archive_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Set archive CRC value
|
||||
$archive_crc_value = null;
|
||||
if ( isset( $params['archive_crc_value'] ) ) {
|
||||
$archive_crc_value = $params['archive_crc_value'];
|
||||
}
|
||||
|
||||
// Flag to hold if file data has been processed
|
||||
$completed = true;
|
||||
|
||||
// Start time
|
||||
$start = microtime( true );
|
||||
|
||||
// Initialize CRC context for this chunk
|
||||
$hash_ctx = Ai1wm_Crc::init_crc32();
|
||||
|
||||
// Open archive for reading
|
||||
if ( ( $file_handle = ai1wm_open( ai1wm_archive_path( $params ), 'rb' ) ) ) {
|
||||
if ( fseek( $file_handle, $archive_bytes_offset, SEEK_SET ) !== -1 ) {
|
||||
|
||||
// Process file in chunks
|
||||
while ( $archive_bytes_remaining > 0 ) {
|
||||
if ( ( $file_content = ai1wm_read( $file_handle, min( Ai1wm_Archiver::READ_CHUNK_SIZE, $archive_bytes_remaining ) ) ) !== false ) {
|
||||
|
||||
// Empty read indicates EOF
|
||||
if ( strlen( $file_content ) === 0 ) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Add the amount of bytes we read
|
||||
$archive_bytes_read += strlen( $file_content );
|
||||
|
||||
// Subtract the amount of bytes we read
|
||||
$archive_bytes_remaining -= strlen( $file_content );
|
||||
|
||||
// Update CRC with original content
|
||||
Ai1wm_Crc::update_crc32( $hash_ctx, $file_content );
|
||||
}
|
||||
|
||||
// Time elapsed
|
||||
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
|
||||
if ( ( microtime( true ) - $start ) > $timeout ) {
|
||||
$completed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get archive bytes offset
|
||||
$archive_bytes_offset += $archive_bytes_read;
|
||||
}
|
||||
|
||||
ai1wm_close( $file_handle );
|
||||
}
|
||||
|
||||
// Combine and finalize CRC
|
||||
if ( empty( $archive_crc_value ) ) {
|
||||
$params['archive_crc_value'] = Ai1wm_Crc::finalize_crc32( $hash_ctx );
|
||||
} else {
|
||||
$params['archive_crc_value'] = Ai1wm_Crc::combine_crc32( $archive_crc_value, Ai1wm_Crc::finalize_crc32( $hash_ctx ), $archive_bytes_read );
|
||||
}
|
||||
|
||||
// End of the archive file?
|
||||
if ( $completed ) {
|
||||
|
||||
// St archive bytes remaining
|
||||
unset( $params['archive_bytes_remaining'] );
|
||||
|
||||
// Unset archive offset
|
||||
unset( $params['archive_bytes_offset'] );
|
||||
|
||||
// Unset completed flag
|
||||
unset( $params['completed'] );
|
||||
|
||||
} else {
|
||||
|
||||
// St archive bytes remaining
|
||||
$params['archive_bytes_remaining'] = $archive_bytes_remaining;
|
||||
|
||||
// Set archive offset
|
||||
$params['archive_bytes_offset'] = $archive_bytes_offset;
|
||||
|
||||
// Set completed flag
|
||||
$params['completed'] = $completed;
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Archive {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
do_action( 'ai1wm_status_export_start', $params );
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Creating export file...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Create empty archive file
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
||||
$archive->close();
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Export file created.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Clean {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Delete storage files
|
||||
Ai1wm_Directory::delete( ai1wm_storage_path( $params ) );
|
||||
|
||||
if ( isset( $params['ai1wm_export_cancel'] ) ) {
|
||||
do_action( 'ai1wm_status_export_canceled', $params );
|
||||
}
|
||||
|
||||
// Exit in console
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Compatibility {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Checking for compatibility...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Get messages
|
||||
$messages = Ai1wm_Compatibility::get( $params );
|
||||
|
||||
// Set messages
|
||||
if ( empty( $messages ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Error message
|
||||
throw new Ai1wm_Compatibility_Exception( wp_kses( implode( $messages ), ai1wm_allowed_html_tags() ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Config_File {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Archiving configuration...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Open the archive file for writing
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
||||
|
||||
// Add package.json to archive
|
||||
$archive->add_file( ai1wm_package_path( $params ), AI1WM_PACKAGE_NAME );
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Configuration archived.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Truncate the archive file
|
||||
$archive->truncate();
|
||||
|
||||
// Close the archive file
|
||||
$archive->close();
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Config {
|
||||
|
||||
public static function execute( $params ) {
|
||||
global $table_prefix, $wp_version;
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Preparing configuration...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Get options
|
||||
$options = wp_load_alloptions();
|
||||
|
||||
// Get database client
|
||||
$db_client = Ai1wm_Database_Utility::get_client();
|
||||
|
||||
$config = array();
|
||||
|
||||
// Set site URL
|
||||
$config['SiteURL'] = site_url();
|
||||
|
||||
// Set home URL
|
||||
$config['HomeURL'] = home_url();
|
||||
|
||||
// Set internal site URL
|
||||
if ( isset( $options['siteurl'] ) ) {
|
||||
$config['InternalSiteURL'] = $options['siteurl'];
|
||||
}
|
||||
|
||||
// Set internal home URL
|
||||
if ( isset( $options['home'] ) ) {
|
||||
$config['InternalHomeURL'] = $options['home'];
|
||||
}
|
||||
|
||||
// Set replace old and new values
|
||||
if ( isset( $params['options']['replace'] ) && ( $replace = $params['options']['replace'] ) ) {
|
||||
for ( $i = 0; $i < count( $replace['old_value'] ); $i++ ) {
|
||||
if ( ! empty( $replace['old_value'][ $i ] ) && ! empty( $replace['new_value'][ $i ] ) ) {
|
||||
$config['Replace']['OldValues'][] = $replace['old_value'][ $i ];
|
||||
$config['Replace']['NewValues'][] = $replace['new_value'][ $i ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set no spam comments
|
||||
if ( isset( $params['options']['no_spam_comments'] ) ) {
|
||||
$config['NoSpamComments'] = true;
|
||||
}
|
||||
|
||||
// Set no post revisions
|
||||
if ( isset( $params['options']['no_post_revisions'] ) ) {
|
||||
$config['NoPostRevisions'] = true;
|
||||
}
|
||||
|
||||
// Set no media
|
||||
if ( isset( $params['options']['no_media'] ) ) {
|
||||
$config['NoMedia'] = true;
|
||||
}
|
||||
|
||||
// Set no themes
|
||||
if ( isset( $params['options']['no_themes'] ) ) {
|
||||
$config['NoThemes'] = true;
|
||||
}
|
||||
|
||||
// Set no inactive themes
|
||||
if ( isset( $params['options']['no_inactive_themes'] ) ) {
|
||||
$config['NoInactiveThemes'] = true;
|
||||
}
|
||||
|
||||
// Set no must-use plugins
|
||||
if ( isset( $params['options']['no_muplugins'] ) ) {
|
||||
$config['NoMustUsePlugins'] = true;
|
||||
}
|
||||
|
||||
// Set no plugins
|
||||
if ( isset( $params['options']['no_plugins'] ) ) {
|
||||
$config['NoPlugins'] = true;
|
||||
}
|
||||
|
||||
// Set no inactive plugins
|
||||
if ( isset( $params['options']['no_inactive_plugins'] ) ) {
|
||||
$config['NoInactivePlugins'] = true;
|
||||
}
|
||||
|
||||
// Set no cache
|
||||
if ( isset( $params['options']['no_cache'] ) ) {
|
||||
$config['NoCache'] = true;
|
||||
}
|
||||
|
||||
// Set no database
|
||||
if ( isset( $params['options']['no_database'] ) ) {
|
||||
$config['NoDatabase'] = true;
|
||||
}
|
||||
|
||||
// Set no email replace
|
||||
if ( isset( $params['options']['no_email_replace'] ) ) {
|
||||
$config['NoEmailReplace'] = true;
|
||||
}
|
||||
|
||||
// Set plugin version
|
||||
$config['Plugin'] = array( 'Version' => AI1WM_VERSION );
|
||||
|
||||
// Set WordPress version and content
|
||||
$config['WordPress'] = array( 'Version' => $wp_version, 'Absolute' => ABSPATH, 'Content' => WP_CONTENT_DIR, 'Plugins' => ai1wm_get_plugins_dir(), 'Themes' => ai1wm_get_themes_dirs(), 'Uploads' => ai1wm_get_uploads_dir(), 'UploadsURL' => ai1wm_get_uploads_url() );
|
||||
|
||||
// Set database version
|
||||
$config['Database'] = array(
|
||||
'Version' => $db_client->server_info(),
|
||||
'Charset' => defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined',
|
||||
'Collate' => defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined',
|
||||
'Prefix' => $table_prefix,
|
||||
);
|
||||
|
||||
// Exclude selected db tables
|
||||
if ( isset( $params['options']['exclude_db_tables'], $params['excluded_db_tables'] ) ) {
|
||||
if ( ( $excluded_db_tables = explode( ',', $params['excluded_db_tables'] ) ) ) {
|
||||
$config['Database']['ExcludedTables'] = $excluded_db_tables;
|
||||
}
|
||||
}
|
||||
|
||||
// Include selected db tables
|
||||
if ( isset( $params['options']['include_db_tables'], $params['included_db_tables'] ) ) {
|
||||
if ( ( $included_db_tables = explode( ',', $params['included_db_tables'] ) ) ) {
|
||||
$config['Database']['IncludedTables'] = $included_db_tables;
|
||||
}
|
||||
}
|
||||
|
||||
// Set PHP version
|
||||
$config['PHP'] = array( 'Version' => PHP_VERSION, 'System' => PHP_OS, 'Integer' => PHP_INT_SIZE );
|
||||
|
||||
// Set active plugins
|
||||
$config['Plugins'] = array_values( array_diff( ai1wm_active_plugins(), ai1wm_active_servmask_plugins() ) );
|
||||
|
||||
// Set active template
|
||||
$config['Template'] = ai1wm_active_template();
|
||||
|
||||
// Set active stylesheet
|
||||
$config['Stylesheet'] = ai1wm_active_stylesheet();
|
||||
|
||||
// Set upload path
|
||||
$config['Uploads'] = get_option( 'upload_path' );
|
||||
|
||||
// Set upload URL path
|
||||
$config['UploadsURL'] = get_option( 'upload_url_path' );
|
||||
|
||||
// Set server info
|
||||
$config['Server'] = array( '.htaccess' => base64_encode( ai1wm_get_htaccess() ), 'web.config' => base64_encode( ai1wm_get_webconfig() ) );
|
||||
|
||||
// Set encrypt backups
|
||||
if ( isset( $params['options']['encrypt_backups'] ) ) {
|
||||
$config['Encrypted'] = true;
|
||||
}
|
||||
|
||||
// Set encrypt password
|
||||
if ( isset( $params['options']['encrypt_password'] ) ) {
|
||||
$config['EncryptedSignature'] = base64_encode( ai1wm_encrypt_string( AI1WM_SIGN_TEXT, $params['options']['encrypt_password'] ) );
|
||||
}
|
||||
|
||||
// Set compression type
|
||||
if ( ! empty( $params['options']['compression_type'] ) ) {
|
||||
$config['Compression'] = array( 'Enabled' => true, 'Type' => $params['options']['compression_type'] );
|
||||
}
|
||||
|
||||
// Save package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'w' );
|
||||
ai1wm_write( $handle, json_encode( $config ) );
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Configuration prepared.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Content {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set encrypt password
|
||||
$encrypt_password = null;
|
||||
if ( isset( $params['options']['encrypt_backups'], $params['options']['encrypt_password'] ) ) {
|
||||
$encrypt_password = $params['options']['encrypt_password'];
|
||||
}
|
||||
|
||||
// Set compression type
|
||||
$compression_type = null;
|
||||
if ( isset( $params['options']['compression_type'] ) ) {
|
||||
$compression_type = $params['options']['compression_type'];
|
||||
}
|
||||
|
||||
// Set archive bytes offset
|
||||
if ( isset( $params['archive_bytes_offset'] ) ) {
|
||||
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
|
||||
} else {
|
||||
$archive_bytes_offset = ai1wm_archive_bytes( $params );
|
||||
}
|
||||
|
||||
// Set file bytes offset
|
||||
if ( isset( $params['file_bytes_offset'] ) ) {
|
||||
$file_bytes_offset = (int) $params['file_bytes_offset'];
|
||||
} else {
|
||||
$file_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Set file bytes written
|
||||
if ( isset( $params['file_bytes_written'] ) ) {
|
||||
$file_bytes_written = (int) $params['file_bytes_written'];
|
||||
} else {
|
||||
$file_bytes_written = 0;
|
||||
}
|
||||
|
||||
// Set content bytes offset
|
||||
if ( isset( $params['content_bytes_offset'] ) ) {
|
||||
$content_bytes_offset = (int) $params['content_bytes_offset'];
|
||||
} else {
|
||||
$content_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Get processed files size
|
||||
if ( isset( $params['processed_files_size'] ) ) {
|
||||
$processed_files_size = (int) $params['processed_files_size'];
|
||||
} else {
|
||||
$processed_files_size = 0;
|
||||
}
|
||||
|
||||
// Get total content files size
|
||||
if ( isset( $params['total_content_files_size'] ) ) {
|
||||
$total_content_files_size = (int) $params['total_content_files_size'];
|
||||
} else {
|
||||
$total_content_files_size = 1;
|
||||
}
|
||||
|
||||
// Get total content files count
|
||||
if ( isset( $params['total_content_files_count'] ) ) {
|
||||
$total_content_files_count = (int) $params['total_content_files_count'];
|
||||
} else {
|
||||
$total_content_files_count = 1;
|
||||
}
|
||||
|
||||
// Set file CRC
|
||||
if ( isset( $params['file_crc'] ) ) {
|
||||
$file_crc = $params['file_crc'];
|
||||
} else {
|
||||
$file_crc = null;
|
||||
}
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d content files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_content_files_count, $progress ) );
|
||||
|
||||
// Flag to hold if file data has been processed
|
||||
$completed = true;
|
||||
|
||||
// Start time
|
||||
$start = microtime( true );
|
||||
|
||||
// Get content list file
|
||||
$content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' );
|
||||
|
||||
// Set the file pointer at the current index
|
||||
if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) {
|
||||
|
||||
// Open the archive file for writing
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ), $encrypt_password, $compression_type );
|
||||
|
||||
// Set the file pointer to the one that we have saved
|
||||
$archive->set_file_pointer( $archive_bytes_offset );
|
||||
|
||||
// Loop over files
|
||||
while ( ( $row = ai1wm_getcsv( $content_list ) ) !== false ) {
|
||||
list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = $row;
|
||||
$file_bytes_read = 0;
|
||||
|
||||
// Add file to archive
|
||||
if ( ( $completed = $archive->add_file( $file_abspath, $file_relpath, $file_bytes_read, $file_bytes_offset, $file_bytes_written, $file_crc ) ) ) {
|
||||
$file_crc = null;
|
||||
|
||||
// Reset file bytes
|
||||
$file_bytes_offset = $file_bytes_written = 0;
|
||||
|
||||
// Get content bytes offset
|
||||
$content_bytes_offset = ftell( $content_list );
|
||||
}
|
||||
|
||||
// Increment processed files size
|
||||
$processed_files_size += $file_bytes_read;
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d content files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_content_files_count, $progress ) );
|
||||
|
||||
// More than 10 seconds have passed, break and do another request
|
||||
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
|
||||
if ( ( microtime( true ) - $start ) > $timeout ) {
|
||||
$completed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get archive bytes offset
|
||||
$archive_bytes_offset = $archive->get_file_pointer();
|
||||
|
||||
// Truncate the archive file
|
||||
$archive->truncate();
|
||||
|
||||
// Close the archive file
|
||||
$archive->close();
|
||||
}
|
||||
|
||||
// End of the content list?
|
||||
if ( feof( $content_list ) ) {
|
||||
|
||||
// Unset archive bytes offset
|
||||
unset( $params['archive_bytes_offset'] );
|
||||
|
||||
// Unset file bytes offset
|
||||
unset( $params['file_bytes_offset'] );
|
||||
|
||||
// Unset file bytes written
|
||||
unset( $params['file_bytes_written'] );
|
||||
|
||||
// Unset content bytes offset
|
||||
unset( $params['content_bytes_offset'] );
|
||||
|
||||
// Unset processed files size
|
||||
unset( $params['processed_files_size'] );
|
||||
|
||||
// Unset total content files size
|
||||
unset( $params['total_content_files_size'] );
|
||||
|
||||
// Unset total content files count
|
||||
unset( $params['total_content_files_count'] );
|
||||
|
||||
// Unset file CRC
|
||||
unset( $params['file_crc'] );
|
||||
|
||||
// Unset completed flag
|
||||
unset( $params['completed'] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set archive bytes offset
|
||||
$params['archive_bytes_offset'] = $archive_bytes_offset;
|
||||
|
||||
// Set file bytes offset
|
||||
$params['file_bytes_offset'] = $file_bytes_offset;
|
||||
|
||||
// Set file bytes written
|
||||
$params['file_bytes_written'] = $file_bytes_written;
|
||||
|
||||
// Set content bytes offset
|
||||
$params['content_bytes_offset'] = $content_bytes_offset;
|
||||
|
||||
// Set processed files size
|
||||
$params['processed_files_size'] = $processed_files_size;
|
||||
|
||||
// Set total content files size
|
||||
$params['total_content_files_size'] = $total_content_files_size;
|
||||
|
||||
// Set total content files count
|
||||
$params['total_content_files_count'] = $total_content_files_count;
|
||||
|
||||
// Set file CRC
|
||||
$params['file_crc'] = $file_crc;
|
||||
|
||||
// Set completed flag
|
||||
$params['completed'] = $completed;
|
||||
}
|
||||
|
||||
// Close the content list file
|
||||
ai1wm_close( $content_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Database_File {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set exclude database
|
||||
if ( isset( $params['options']['no_database'] ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
$database_bytes_read = 0;
|
||||
|
||||
// Set encrypt password
|
||||
$encrypt_password = null;
|
||||
if ( isset( $params['options']['encrypt_backups'], $params['options']['encrypt_password'] ) ) {
|
||||
$encrypt_password = $params['options']['encrypt_password'];
|
||||
}
|
||||
|
||||
// Set compression type
|
||||
$compression_type = null;
|
||||
if ( isset( $params['options']['compression_type'] ) ) {
|
||||
$compression_type = $params['options']['compression_type'];
|
||||
}
|
||||
|
||||
// Set archive bytes offset
|
||||
if ( isset( $params['archive_bytes_offset'] ) ) {
|
||||
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
|
||||
} else {
|
||||
$archive_bytes_offset = ai1wm_archive_bytes( $params );
|
||||
}
|
||||
|
||||
// Set database bytes offset
|
||||
if ( isset( $params['database_bytes_offset'] ) ) {
|
||||
$database_bytes_offset = (int) $params['database_bytes_offset'];
|
||||
} else {
|
||||
$database_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Set database bytes written
|
||||
if ( isset( $params['database_bytes_written'] ) ) {
|
||||
$database_bytes_written = (int) $params['database_bytes_written'];
|
||||
} else {
|
||||
$database_bytes_written = 0;
|
||||
}
|
||||
|
||||
// Set database CRC
|
||||
if ( isset( $params['database_crc'] ) ) {
|
||||
$database_crc = $params['database_crc'];
|
||||
} else {
|
||||
$database_crc = null;
|
||||
}
|
||||
|
||||
// Get total database size
|
||||
if ( isset( $params['total_database_size'] ) ) {
|
||||
$total_database_size = (int) $params['total_database_size'];
|
||||
} else {
|
||||
$total_database_size = ai1wm_database_bytes( $params );
|
||||
}
|
||||
|
||||
// What percent of database have we processed?
|
||||
$progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', 'all-in-one-wp-migration' ), $progress ) );
|
||||
|
||||
// Open the archive file for writing
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ), $encrypt_password, $compression_type );
|
||||
|
||||
// Set the file pointer to the one that we have saved
|
||||
$archive->set_file_pointer( $archive_bytes_offset );
|
||||
|
||||
// Add database.sql to archive
|
||||
if ( $archive->add_file( ai1wm_database_path( $params ), AI1WM_DATABASE_NAME, $database_bytes_read, $database_bytes_offset, $database_bytes_written, $database_crc ) ) {
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Database archived.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Unset archive bytes offset
|
||||
unset( $params['archive_bytes_offset'] );
|
||||
|
||||
// Unset database bytes offset
|
||||
unset( $params['database_bytes_offset'] );
|
||||
|
||||
// Unset database bytes written
|
||||
unset( $params['database_bytes_written'] );
|
||||
|
||||
// Unset database CRC
|
||||
unset( $params['database_crc'] );
|
||||
|
||||
// Unset total database size
|
||||
unset( $params['total_database_size'] );
|
||||
|
||||
// Unset completed flag
|
||||
unset( $params['completed'] );
|
||||
|
||||
} else {
|
||||
|
||||
// Get archive bytes offset
|
||||
$archive_bytes_offset = $archive->get_file_pointer();
|
||||
|
||||
// What percent of database have we processed?
|
||||
$progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', 'all-in-one-wp-migration' ), $progress ) );
|
||||
|
||||
// Set archive bytes offset
|
||||
$params['archive_bytes_offset'] = $archive_bytes_offset;
|
||||
|
||||
// Set database bytes offset
|
||||
$params['database_bytes_offset'] = $database_bytes_offset;
|
||||
|
||||
// Set database bytes written
|
||||
$params['database_bytes_written'] = $database_bytes_written;
|
||||
|
||||
// Set database CRC
|
||||
$params['database_crc'] = $database_crc;
|
||||
|
||||
// Set total database size
|
||||
$params['total_database_size'] = $total_database_size;
|
||||
|
||||
// Set completed flag
|
||||
$params['completed'] = false;
|
||||
}
|
||||
|
||||
// Truncate the archive file
|
||||
$archive->truncate();
|
||||
|
||||
// Close the archive file
|
||||
$archive->close();
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Database {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set exclude database
|
||||
if ( isset( $params['options']['no_database'] ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Set query offset
|
||||
if ( isset( $params['query_offset'] ) ) {
|
||||
$query_offset = (int) $params['query_offset'];
|
||||
} else {
|
||||
$query_offset = 0;
|
||||
}
|
||||
|
||||
// Set table index
|
||||
if ( isset( $params['table_index'] ) ) {
|
||||
$table_index = (int) $params['table_index'];
|
||||
} else {
|
||||
$table_index = 0;
|
||||
}
|
||||
|
||||
// Set table offset
|
||||
if ( isset( $params['table_offset'] ) ) {
|
||||
$table_offset = (int) $params['table_offset'];
|
||||
} else {
|
||||
$table_offset = 0;
|
||||
}
|
||||
|
||||
// Set table rows
|
||||
if ( isset( $params['table_rows'] ) ) {
|
||||
$table_rows = (int) $params['table_rows'];
|
||||
} else {
|
||||
$table_rows = 0;
|
||||
}
|
||||
|
||||
// Set total tables count
|
||||
if ( isset( $params['total_tables_count'] ) ) {
|
||||
$total_tables_count = (int) $params['total_tables_count'];
|
||||
} else {
|
||||
$total_tables_count = 1;
|
||||
}
|
||||
|
||||
// What percent of tables have we processed?
|
||||
$progress = (int) ( ( $table_index / $total_tables_count ) * 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Progress, 2: Number of records. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Exporting database...<br />%1$d%% complete<br />%2$s records saved', 'all-in-one-wp-migration' ), $progress, number_format_i18n( $table_rows ) ) );
|
||||
|
||||
// Get tables list file
|
||||
$tables_list = ai1wm_open( ai1wm_tables_list_path( $params ), 'r' );
|
||||
|
||||
// Loop over tables
|
||||
$tables = array();
|
||||
while ( ( $row = ai1wm_getcsv( $tables_list ) ) !== false ) {
|
||||
list( $table_name ) = $row;
|
||||
$tables[] = $table_name; // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning
|
||||
}
|
||||
|
||||
// Close the tables list file
|
||||
ai1wm_close( $tables_list );
|
||||
|
||||
// Get database client
|
||||
$db_client = Ai1wm_Database_Utility::get_client();
|
||||
|
||||
// Exclude spam comments
|
||||
if ( isset( $params['options']['no_spam_comments'] ) ) {
|
||||
$db_client->set_table_where_query( ai1wm_table_prefix() . 'comments', "`comment_approved` != 'spam'" )
|
||||
->set_table_where_query( ai1wm_table_prefix() . 'commentmeta', sprintf( "`comment_ID` IN ( SELECT `comment_ID` FROM `%s` WHERE `comment_approved` != 'spam' )", ai1wm_table_prefix() . 'comments' ) );
|
||||
}
|
||||
|
||||
// Exclude post revisions
|
||||
if ( isset( $params['options']['no_post_revisions'] ) ) {
|
||||
$db_client->set_table_where_query( ai1wm_table_prefix() . 'posts', "`post_type` != 'revision'" )
|
||||
->set_table_where_query( ai1wm_table_prefix() . 'postmeta', sprintf( "`post_id` IN ( SELECT `ID` FROM `%s` WHERE `post_type` != 'revision' )", ai1wm_table_prefix() . 'posts' ) );
|
||||
}
|
||||
|
||||
$old_table_prefixes = $old_column_prefixes = array();
|
||||
$new_table_prefixes = $new_column_prefixes = array();
|
||||
|
||||
// Set table prefixes
|
||||
if ( ai1wm_table_prefix() ) {
|
||||
$old_table_prefixes[] = ai1wm_table_prefix();
|
||||
$new_table_prefixes[] = ai1wm_servmask_prefix();
|
||||
} else {
|
||||
foreach ( $tables as $table_name ) {
|
||||
$old_table_prefixes[] = $table_name;
|
||||
$new_table_prefixes[] = ai1wm_servmask_prefix() . $table_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Set column prefixes
|
||||
if ( strlen( ai1wm_table_prefix() ) > 1 ) {
|
||||
$old_column_prefixes[] = ai1wm_table_prefix();
|
||||
$new_column_prefixes[] = ai1wm_servmask_prefix();
|
||||
} else {
|
||||
foreach ( array( 'user_roles', 'capabilities', 'user_level', 'dashboard_quick_press_last_post_id', 'user-settings', 'user-settings-time' ) as $column_prefix ) {
|
||||
$old_column_prefixes[] = ai1wm_table_prefix() . $column_prefix;
|
||||
$new_column_prefixes[] = ai1wm_servmask_prefix() . $column_prefix;
|
||||
}
|
||||
}
|
||||
|
||||
$db_client->set_tables( $tables )
|
||||
->set_old_table_prefixes( $old_table_prefixes )
|
||||
->set_new_table_prefixes( $new_table_prefixes )
|
||||
->set_old_column_prefixes( $old_column_prefixes )
|
||||
->set_new_column_prefixes( $new_column_prefixes );
|
||||
|
||||
// Exclude column prefixes
|
||||
$db_client->set_reserved_column_prefixes( array( 'wp_force_deactivated_plugins', 'wp_page_for_privacy_policy', 'wp_rocket_settings', 'wp_rocket_dismiss_imagify_notice', 'wp_rocket_no_licence', 'wp_rocket_rocketcdn_old_url', 'wp_rocket_hide_deactivation_form' ) );
|
||||
|
||||
// Exclude site options
|
||||
$db_client->set_table_where_query( ai1wm_table_prefix() . 'options', sprintf( "`option_name` NOT IN ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", AI1WM_STATUS, AI1WM_SECRET_KEY, AI1WM_AUTH_USER, AI1WM_AUTH_PASSWORD, AI1WM_AUTH_HEADER, AI1WM_BACKUPS_LABELS, AI1WM_SITES_LINKS ) );
|
||||
|
||||
// Set table select columns
|
||||
if ( ( $column_names = $db_client->get_column_names( ai1wm_table_prefix() . 'options' ) ) ) {
|
||||
if ( isset( $column_names['option_name'], $column_names['option_value'] ) ) {
|
||||
$column_names['option_value'] = sprintf( "(CASE WHEN option_name = '%s' THEN 'a:0:{}' WHEN (option_name = '%s' OR option_name = '%s') THEN '' ELSE option_value END) AS option_value", AI1WM_ACTIVE_PLUGINS, AI1WM_ACTIVE_TEMPLATE, AI1WM_ACTIVE_STYLESHEET );
|
||||
}
|
||||
|
||||
$db_client->set_table_select_columns( ai1wm_table_prefix() . 'options', $column_names );
|
||||
}
|
||||
|
||||
// Set table prefix columns
|
||||
$db_client->set_table_prefix_columns( ai1wm_table_prefix() . 'options', array( 'option_name' ) )
|
||||
->set_table_prefix_columns( ai1wm_table_prefix() . 'usermeta', array( 'meta_key' ) );
|
||||
|
||||
// Export database
|
||||
if ( $db_client->export( ai1wm_database_path( $params ), $query_offset, $table_index, $table_offset, $table_rows ) ) {
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Database exported.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Unset query offset
|
||||
unset( $params['query_offset'] );
|
||||
|
||||
// Unset table index
|
||||
unset( $params['table_index'] );
|
||||
|
||||
// Unset table offset
|
||||
unset( $params['table_offset'] );
|
||||
|
||||
// Unset table rows
|
||||
unset( $params['table_rows'] );
|
||||
|
||||
// Unset total tables count
|
||||
unset( $params['total_tables_count'] );
|
||||
|
||||
// Unset completed flag
|
||||
unset( $params['completed'] );
|
||||
|
||||
} else {
|
||||
|
||||
// What percent of tables have we processed?
|
||||
$progress = (int) ( ( $table_index / $total_tables_count ) * 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Progress, 2: Number of records. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Exporting database...<br />%1$d%% complete<br />%2$s records saved', 'all-in-one-wp-migration' ), $progress, number_format_i18n( $table_rows ) ) );
|
||||
|
||||
// Set query offset
|
||||
$params['query_offset'] = $query_offset;
|
||||
|
||||
// Set table index
|
||||
$params['table_index'] = $table_index;
|
||||
|
||||
// Set table offset
|
||||
$params['table_offset'] = $table_offset;
|
||||
|
||||
// Set table rows
|
||||
$params['table_rows'] = $table_rows;
|
||||
|
||||
// Set total tables count
|
||||
$params['total_tables_count'] = $total_tables_count;
|
||||
|
||||
// Set completed flag
|
||||
$params['completed'] = false;
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Download {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Get archive CRC value
|
||||
$archive_crc_value = null;
|
||||
if ( isset( $params['archive_crc_value'] ) ) {
|
||||
$archive_crc_value = $params['archive_crc_value'];
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Renaming export file...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Open the archive file for writing
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
||||
|
||||
// Append EOF block
|
||||
$archive->close( true, $archive_crc_value );
|
||||
|
||||
// Rename archive file
|
||||
if ( rename( ai1wm_archive_path( $params ), ai1wm_backup_path( $params ) ) ) {
|
||||
$blog_id = null;
|
||||
|
||||
// Get subsite Blog ID
|
||||
if ( isset( $params['options']['sites'] ) && ( $sites = $params['options']['sites'] ) ) {
|
||||
if ( count( $sites ) === 1 ) {
|
||||
$blog_id = array_shift( $sites );
|
||||
}
|
||||
}
|
||||
|
||||
// Set archive details
|
||||
$file = ai1wm_archive_name( $params );
|
||||
$link = ai1wm_backup_url( $params );
|
||||
$size = ai1wm_backup_size( $params );
|
||||
$name = ai1wm_site_name( $blog_id );
|
||||
|
||||
// Set progress
|
||||
if ( ai1wm_direct_download_supported() ) {
|
||||
Ai1wm_Status::download(
|
||||
sprintf(
|
||||
/* translators: 1: Link to archive, 2: Archive title, 3: File name, 4: Archive title, 5: File size. */
|
||||
__(
|
||||
'<a href="%1$s" class="ai1wm-button-green ai1wm-emphasize ai1wm-button-download" title="%2$s" download="%3$s">
|
||||
<span>Download %2$s</span>
|
||||
<em>Size: %4$s</em>
|
||||
</a>',
|
||||
'all-in-one-wp-migration'
|
||||
),
|
||||
$link,
|
||||
$name,
|
||||
$file,
|
||||
$size
|
||||
)
|
||||
);
|
||||
} else {
|
||||
Ai1wm_Status::download(
|
||||
sprintf(
|
||||
/* translators: 1: Archive title, 2: File name, 3: Archive title, 4: File size. */
|
||||
__(
|
||||
'<a href="#" class="ai1wm-button-green ai1wm-emphasize ai1wm-direct-download" title="%1$s" download="%2$s">
|
||||
<span>Download %3$s</span>
|
||||
<em>Size: %4$s</em>
|
||||
</a>',
|
||||
'all-in-one-wp-migration'
|
||||
),
|
||||
$name,
|
||||
$file,
|
||||
$name,
|
||||
$size
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'ai1wm_status_export_done', $params );
|
||||
|
||||
// Run manual on backup created hook
|
||||
if ( isset( $params['ai1wm_manual_backup'] ) ) {
|
||||
do_action( 'ai1wm_status_backup_created', $params );
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Enumerate_Content {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
$exclude_filters = array_merge( array( ai1wm_get_uploads_dir(), ai1wm_get_plugins_dir() ), ai1wm_get_themes_dirs() );
|
||||
|
||||
// Get total content files count
|
||||
if ( isset( $params['total_content_files_count'] ) ) {
|
||||
$total_content_files_count = (int) $params['total_content_files_count'];
|
||||
} else {
|
||||
$total_content_files_count = 1;
|
||||
}
|
||||
|
||||
// Get total content files size
|
||||
if ( isset( $params['total_content_files_size'] ) ) {
|
||||
$total_content_files_size = (int) $params['total_content_files_size'];
|
||||
} else {
|
||||
$total_content_files_size = 1;
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Gathering content files...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Exclude cache
|
||||
if ( isset( $params['options']['no_cache'] ) ) {
|
||||
$exclude_filters[] = 'cache';
|
||||
}
|
||||
|
||||
// Exclude must-use plugins
|
||||
if ( isset( $params['options']['no_muplugins'] ) ) {
|
||||
$exclude_filters[] = 'mu-plugins';
|
||||
}
|
||||
|
||||
// Exclude media
|
||||
if ( isset( $params['options']['no_media'] ) ) {
|
||||
$exclude_filters[] = 'blogs.dir';
|
||||
}
|
||||
|
||||
// Exclude SQLite file
|
||||
if ( defined( 'FQDB' ) ) {
|
||||
$exclude_filters[] = FQDB;
|
||||
}
|
||||
|
||||
// Exclude selected files
|
||||
if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
|
||||
if ( ( $excluded_files = explode( ',', $params['excluded_files'] ) ) ) {
|
||||
foreach ( $excluded_files as $excluded_path ) {
|
||||
$exclude_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create content list file
|
||||
$content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'w' );
|
||||
|
||||
// Enumerate over content directory
|
||||
if ( isset( $params['options']['no_themes'], $params['options']['no_muplugins'], $params['options']['no_plugins'] ) === false ) {
|
||||
|
||||
// Iterate over content directory
|
||||
$iterator = new Ai1wm_Recursive_Directory_Iterator( WP_CONTENT_DIR );
|
||||
|
||||
// Exclude content files
|
||||
$iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, apply_filters( 'ai1wm_exclude_content_from_export', ai1wm_content_filters( $exclude_filters ) ) );
|
||||
|
||||
// Recursively iterate over content directory
|
||||
$iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );
|
||||
|
||||
// Write path line
|
||||
foreach ( $iterator as $item ) {
|
||||
if ( $item->isFile() ) {
|
||||
if ( ai1wm_putcsv( $content_list, array( $iterator->getPathname(), $iterator->getSubPathname(), $iterator->getSize(), $iterator->getMTime() ) ) ) {
|
||||
$total_content_files_count++;
|
||||
|
||||
// Add current file size
|
||||
$total_content_files_size += $iterator->getSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Content files gathered.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Set total content files count
|
||||
$params['total_content_files_count'] = $total_content_files_count;
|
||||
|
||||
// Set total content files size
|
||||
$params['total_content_files_size'] = $total_content_files_size;
|
||||
|
||||
// Close the content list file
|
||||
ai1wm_close( $content_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Enumerate_Media {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
$exclude_filters = array();
|
||||
|
||||
// Get total media files count
|
||||
if ( isset( $params['total_media_files_count'] ) ) {
|
||||
$total_media_files_count = (int) $params['total_media_files_count'];
|
||||
} else {
|
||||
$total_media_files_count = 1;
|
||||
}
|
||||
|
||||
// Get total media files size
|
||||
if ( isset( $params['total_media_files_size'] ) ) {
|
||||
$total_media_files_size = (int) $params['total_media_files_size'];
|
||||
} else {
|
||||
$total_media_files_size = 1;
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Gathering media files...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Exclude selected files
|
||||
if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
|
||||
if ( ( $excluded_files = explode( ',', $params['excluded_files'] ) ) ) {
|
||||
foreach ( $excluded_files as $excluded_path ) {
|
||||
$exclude_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create media list file
|
||||
$media_list = ai1wm_open( ai1wm_media_list_path( $params ), 'w' );
|
||||
|
||||
// Enumerate over media directory
|
||||
if ( isset( $params['options']['no_media'] ) === false ) {
|
||||
if ( is_dir( ai1wm_get_uploads_dir() ) ) {
|
||||
|
||||
// Iterate over media directory
|
||||
$iterator = new Ai1wm_Recursive_Directory_Iterator( ai1wm_get_uploads_dir() );
|
||||
|
||||
// Exclude media files
|
||||
$iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, apply_filters( 'ai1wm_exclude_media_from_export', ai1wm_media_filters( $exclude_filters ) ) );
|
||||
|
||||
// Recursively iterate over content directory
|
||||
$iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );
|
||||
|
||||
// Write path line
|
||||
foreach ( $iterator as $item ) {
|
||||
if ( $item->isFile() ) {
|
||||
if ( ai1wm_putcsv( $media_list, array( $iterator->getPathname(), $iterator->getSubPathname(), $iterator->getSize(), $iterator->getMTime() ) ) ) {
|
||||
$total_media_files_count++;
|
||||
|
||||
// Add current file size
|
||||
$total_media_files_size += $iterator->getSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Media files gathered.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Set total media files count
|
||||
$params['total_media_files_count'] = $total_media_files_count;
|
||||
|
||||
// Set total media files size
|
||||
$params['total_media_files_size'] = $total_media_files_size;
|
||||
|
||||
// Close the media list file
|
||||
ai1wm_close( $media_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Enumerate_Plugins {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
$exclude_filters = array( AI1WM_SQLITE_DATABASE_INTEGRATION_NAME );
|
||||
|
||||
// Get total plugins files count
|
||||
if ( isset( $params['total_plugins_files_count'] ) ) {
|
||||
$total_plugins_files_count = (int) $params['total_plugins_files_count'];
|
||||
} else {
|
||||
$total_plugins_files_count = 1;
|
||||
}
|
||||
|
||||
// Get total plugins files size
|
||||
if ( isset( $params['total_plugins_files_size'] ) ) {
|
||||
$total_plugins_files_size = (int) $params['total_plugins_files_size'];
|
||||
} else {
|
||||
$total_plugins_files_size = 1;
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Gathering plugin files...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Exclude inactive plugins
|
||||
if ( isset( $params['options']['no_inactive_plugins'] ) ) {
|
||||
foreach ( get_plugins() as $plugin_name => $plugin_info ) {
|
||||
if ( is_plugin_inactive( $plugin_name ) ) {
|
||||
$exclude_filters[] = ( dirname( $plugin_name ) === '.' ? basename( $plugin_name ) : dirname( $plugin_name ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude selected files
|
||||
if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
|
||||
if ( ( $excluded_files = explode( ',', $params['excluded_files'] ) ) ) {
|
||||
foreach ( $excluded_files as $excluded_path ) {
|
||||
$exclude_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create plugins list file
|
||||
$plugins_list = ai1wm_open( ai1wm_plugins_list_path( $params ), 'w' );
|
||||
|
||||
// Enumerate over plugins directory
|
||||
if ( isset( $params['options']['no_plugins'] ) === false ) {
|
||||
|
||||
// Iterate over plugins directory
|
||||
$iterator = new Ai1wm_Recursive_Directory_Iterator( ai1wm_get_plugins_dir() );
|
||||
|
||||
// Exclude plugins files
|
||||
$iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, apply_filters( 'ai1wm_exclude_plugins_from_export', ai1wm_plugin_filters( $exclude_filters ) ) );
|
||||
|
||||
// Recursively iterate over plugins directory
|
||||
$iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );
|
||||
|
||||
// Write path line
|
||||
foreach ( $iterator as $item ) {
|
||||
if ( $item->isFile() ) {
|
||||
if ( ai1wm_putcsv( $plugins_list, array( $iterator->getPathname(), $iterator->getSubPathname(), $iterator->getSize(), $iterator->getMTime() ) ) ) {
|
||||
$total_plugins_files_count++;
|
||||
|
||||
// Add current file size
|
||||
$total_plugins_files_size += $iterator->getSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Plugin files gathered.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Set total plugins files count
|
||||
$params['total_plugins_files_count'] = $total_plugins_files_count;
|
||||
|
||||
// Set total plugins files size
|
||||
$params['total_plugins_files_size'] = $total_plugins_files_size;
|
||||
|
||||
// Close the plugins list file
|
||||
ai1wm_close( $plugins_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Enumerate_Tables {
|
||||
|
||||
public static function execute( $params ) {
|
||||
// Set exclude database
|
||||
if ( isset( $params['options']['no_database'] ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Get total tables count
|
||||
if ( isset( $params['total_tables_count'] ) ) {
|
||||
$total_tables_count = (int) $params['total_tables_count'];
|
||||
} else {
|
||||
$total_tables_count = 1;
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Gathering database tables...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Get database client
|
||||
$db_client = Ai1wm_Database_Utility::get_client();
|
||||
|
||||
// Include table prefixes
|
||||
if ( ai1wm_table_prefix() ) {
|
||||
$db_client->add_table_prefix_filter( ai1wm_table_prefix() );
|
||||
|
||||
// Include table prefixes (Webba Booking and CiviCRM)
|
||||
foreach ( array( 'wbk_', 'civicrm_' ) as $table_name ) {
|
||||
$db_client->add_table_prefix_filter( $table_name );
|
||||
}
|
||||
}
|
||||
|
||||
// Create tables list file
|
||||
$tables_list = ai1wm_open( ai1wm_tables_list_path( $params ), 'w' );
|
||||
|
||||
// Exclude selected db tables
|
||||
$excluded_db_tables = array();
|
||||
if ( isset( $params['options']['exclude_db_tables'], $params['excluded_db_tables'] ) ) {
|
||||
$excluded_db_tables = explode( ',', $params['excluded_db_tables'] );
|
||||
}
|
||||
|
||||
// Write table line
|
||||
foreach ( $db_client->get_tables() as $table_name ) {
|
||||
if ( ! in_array( $table_name, $excluded_db_tables ) && ai1wm_putcsv( $tables_list, array( $table_name ) ) ) {
|
||||
$total_tables_count++;
|
||||
}
|
||||
}
|
||||
|
||||
// Include selected db tables
|
||||
if ( isset( $params['options']['include_db_tables'] ) && ! empty( $params['included_db_tables'] ) ) {
|
||||
foreach ( explode( ',', $params['included_db_tables'] ) as $table_name ) {
|
||||
if ( ai1wm_putcsv( $tables_list, array( $table_name ) ) ) {
|
||||
$total_tables_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Database tables gathered.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Set total tables count
|
||||
$params['total_tables_count'] = $total_tables_count;
|
||||
|
||||
// Close the tables list file
|
||||
ai1wm_close( $tables_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Enumerate_Themes {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
$exclude_filters = array();
|
||||
|
||||
// Get total themes files count
|
||||
if ( isset( $params['total_themes_files_count'] ) ) {
|
||||
$total_themes_files_count = (int) $params['total_themes_files_count'];
|
||||
} else {
|
||||
$total_themes_files_count = 1;
|
||||
}
|
||||
|
||||
// Get total themes files size
|
||||
if ( isset( $params['total_themes_files_size'] ) ) {
|
||||
$total_themes_files_size = (int) $params['total_themes_files_size'];
|
||||
} else {
|
||||
$total_themes_files_size = 1;
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Gathering theme files...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Exclude inactive themes
|
||||
if ( isset( $params['options']['no_inactive_themes'] ) ) {
|
||||
foreach ( search_theme_directories() as $theme_name => $theme_info ) {
|
||||
if ( ! in_array( $theme_name, array( get_template(), get_stylesheet() ) ) ) {
|
||||
if ( isset( $theme_info['theme_root'] ) ) {
|
||||
$exclude_filters[] = $theme_info['theme_root'] . DIRECTORY_SEPARATOR . $theme_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude selected files
|
||||
if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
|
||||
if ( ( $excluded_files = explode( ',', $params['excluded_files'] ) ) ) {
|
||||
foreach ( $excluded_files as $excluded_path ) {
|
||||
$exclude_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create themes list file
|
||||
$themes_list = ai1wm_open( ai1wm_themes_list_path( $params ), 'w' );
|
||||
|
||||
// Enumerate over themes directory
|
||||
if ( isset( $params['options']['no_themes'] ) === false ) {
|
||||
foreach ( ai1wm_get_themes_dirs() as $theme_dir ) {
|
||||
if ( is_dir( $theme_dir ) ) {
|
||||
|
||||
// Iterate over themes directory
|
||||
$iterator = new Ai1wm_Recursive_Directory_Iterator( $theme_dir );
|
||||
|
||||
// Exclude themes files
|
||||
$iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, apply_filters( 'ai1wm_exclude_themes_from_export', ai1wm_theme_filters( $exclude_filters ) ) );
|
||||
|
||||
// Recursively iterate over themes directory
|
||||
$iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );
|
||||
|
||||
// Write path line
|
||||
foreach ( $iterator as $item ) {
|
||||
if ( $item->isFile() ) {
|
||||
if ( ai1wm_putcsv( $themes_list, array( $iterator->getPathname(), $iterator->getSubPathname(), $iterator->getSize(), $iterator->getMTime() ) ) ) {
|
||||
$total_themes_files_count++;
|
||||
|
||||
// Add current file size
|
||||
$total_themes_files_size += $iterator->getSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Theme files gathered.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Set total themes files count
|
||||
$params['total_themes_files_count'] = $total_themes_files_count;
|
||||
|
||||
// Set total themes files size
|
||||
$params['total_themes_files_size'] = $total_themes_files_size;
|
||||
|
||||
// Close the themes list file
|
||||
ai1wm_close( $themes_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Init {
|
||||
|
||||
public static function execute( $params ) {
|
||||
$blog_id = null;
|
||||
|
||||
// Get subsite Blog ID
|
||||
if ( isset( $params['options']['sites'] ) && ( $sites = $params['options']['sites'] ) ) {
|
||||
if ( count( $sites ) === 1 ) {
|
||||
$blog_id = array_shift( $sites );
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'ai1wm_status_export_init', $params );
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Preparing to export...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Set archive
|
||||
if ( empty( $params['archive'] ) ) {
|
||||
$params['archive'] = ai1wm_archive_file( $blog_id );
|
||||
}
|
||||
|
||||
// Set storage
|
||||
if ( empty( $params['storage'] ) ) {
|
||||
$params['storage'] = ai1wm_storage_folder();
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Media {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set encrypt password
|
||||
$encrypt_password = null;
|
||||
if ( isset( $params['options']['encrypt_backups'], $params['options']['encrypt_password'] ) ) {
|
||||
$encrypt_password = $params['options']['encrypt_password'];
|
||||
}
|
||||
|
||||
// Set compression type
|
||||
$compression_type = null;
|
||||
if ( isset( $params['options']['compression_type'] ) ) {
|
||||
$compression_type = $params['options']['compression_type'];
|
||||
}
|
||||
|
||||
// Set archive bytes offset
|
||||
if ( isset( $params['archive_bytes_offset'] ) ) {
|
||||
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
|
||||
} else {
|
||||
$archive_bytes_offset = ai1wm_archive_bytes( $params );
|
||||
}
|
||||
|
||||
// Set file bytes offset
|
||||
if ( isset( $params['file_bytes_offset'] ) ) {
|
||||
$file_bytes_offset = (int) $params['file_bytes_offset'];
|
||||
} else {
|
||||
$file_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Set file bytes written
|
||||
if ( isset( $params['file_bytes_written'] ) ) {
|
||||
$file_bytes_written = (int) $params['file_bytes_written'];
|
||||
} else {
|
||||
$file_bytes_written = 0;
|
||||
}
|
||||
|
||||
// Set media bytes offset
|
||||
if ( isset( $params['media_bytes_offset'] ) ) {
|
||||
$media_bytes_offset = (int) $params['media_bytes_offset'];
|
||||
} else {
|
||||
$media_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Get processed files size
|
||||
if ( isset( $params['processed_files_size'] ) ) {
|
||||
$processed_files_size = (int) $params['processed_files_size'];
|
||||
} else {
|
||||
$processed_files_size = 0;
|
||||
}
|
||||
|
||||
// Get total media files size
|
||||
if ( isset( $params['total_media_files_size'] ) ) {
|
||||
$total_media_files_size = (int) $params['total_media_files_size'];
|
||||
} else {
|
||||
$total_media_files_size = 1;
|
||||
}
|
||||
|
||||
// Get total media files count
|
||||
if ( isset( $params['total_media_files_count'] ) ) {
|
||||
$total_media_files_count = (int) $params['total_media_files_count'];
|
||||
} else {
|
||||
$total_media_files_count = 1;
|
||||
}
|
||||
|
||||
// Set file CRC
|
||||
if ( isset( $params['file_crc'] ) ) {
|
||||
$file_crc = $params['file_crc'];
|
||||
} else {
|
||||
$file_crc = null;
|
||||
}
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_media_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d media files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_media_files_count, $progress ) );
|
||||
|
||||
// Flag to hold if file data has been processed
|
||||
$completed = true;
|
||||
|
||||
// Start time
|
||||
$start = microtime( true );
|
||||
|
||||
// Get media list file
|
||||
$media_list = ai1wm_open( ai1wm_media_list_path( $params ), 'r' );
|
||||
|
||||
// Set the file pointer at the current index
|
||||
if ( fseek( $media_list, $media_bytes_offset ) !== -1 ) {
|
||||
|
||||
// Open the archive file for writing
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ), $encrypt_password, $compression_type );
|
||||
|
||||
// Set the file pointer to the one that we have saved
|
||||
$archive->set_file_pointer( $archive_bytes_offset );
|
||||
|
||||
// Loop over files
|
||||
while ( ( $row = ai1wm_getcsv( $media_list ) ) !== false ) {
|
||||
list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = $row;
|
||||
$file_bytes_read = 0;
|
||||
|
||||
// Add file to archive
|
||||
if ( ( $completed = $archive->add_file( $file_abspath, 'uploads' . DIRECTORY_SEPARATOR . $file_relpath, $file_bytes_read, $file_bytes_offset, $file_bytes_written, $file_crc ) ) ) {
|
||||
$file_crc = null;
|
||||
|
||||
// Reset file bytes
|
||||
$file_bytes_offset = $file_bytes_written = 0;
|
||||
|
||||
// Get media bytes offset
|
||||
$media_bytes_offset = ftell( $media_list );
|
||||
}
|
||||
|
||||
// Increment processed files size
|
||||
$processed_files_size += $file_bytes_read;
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_media_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d media files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_media_files_count, $progress ) );
|
||||
|
||||
// More than 10 seconds have passed, break and do another request
|
||||
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
|
||||
if ( ( microtime( true ) - $start ) > $timeout ) {
|
||||
$completed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get archive bytes offset
|
||||
$archive_bytes_offset = $archive->get_file_pointer();
|
||||
|
||||
// Truncate the archive file
|
||||
$archive->truncate();
|
||||
|
||||
// Close the archive file
|
||||
$archive->close();
|
||||
}
|
||||
|
||||
// End of the media list?
|
||||
if ( feof( $media_list ) ) {
|
||||
|
||||
// Unset archive bytes offset
|
||||
unset( $params['archive_bytes_offset'] );
|
||||
|
||||
// Unset file bytes offset
|
||||
unset( $params['file_bytes_offset'] );
|
||||
|
||||
// Unset file bytes written
|
||||
unset( $params['file_bytes_written'] );
|
||||
|
||||
// Unset media bytes offset
|
||||
unset( $params['media_bytes_offset'] );
|
||||
|
||||
// Unset processed files size
|
||||
unset( $params['processed_files_size'] );
|
||||
|
||||
// Unset total media files size
|
||||
unset( $params['total_media_files_size'] );
|
||||
|
||||
// Unset total media files count
|
||||
unset( $params['total_media_files_count'] );
|
||||
|
||||
// Unset file CRC
|
||||
unset( $params['file_crc'] );
|
||||
|
||||
// Unset completed flag
|
||||
unset( $params['completed'] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set archive bytes offset
|
||||
$params['archive_bytes_offset'] = $archive_bytes_offset;
|
||||
|
||||
// Set file bytes offset
|
||||
$params['file_bytes_offset'] = $file_bytes_offset;
|
||||
|
||||
// Set file bytes written
|
||||
$params['file_bytes_written'] = $file_bytes_written;
|
||||
|
||||
// Set media bytes offset
|
||||
$params['media_bytes_offset'] = $media_bytes_offset;
|
||||
|
||||
// Set processed files size
|
||||
$params['processed_files_size'] = $processed_files_size;
|
||||
|
||||
// Set total media files size
|
||||
$params['total_media_files_size'] = $total_media_files_size;
|
||||
|
||||
// Set total media files count
|
||||
$params['total_media_files_count'] = $total_media_files_count;
|
||||
|
||||
// Set file CRC
|
||||
$params['file_crc'] = $file_crc;
|
||||
|
||||
// Set completed flag
|
||||
$params['completed'] = $completed;
|
||||
}
|
||||
|
||||
// Close the media list file
|
||||
ai1wm_close( $media_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Plugins {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set encrypt password
|
||||
$encrypt_password = null;
|
||||
if ( isset( $params['options']['encrypt_backups'], $params['options']['encrypt_password'] ) ) {
|
||||
$encrypt_password = $params['options']['encrypt_password'];
|
||||
}
|
||||
|
||||
// Set compression type
|
||||
$compression_type = null;
|
||||
if ( isset( $params['options']['compression_type'] ) ) {
|
||||
$compression_type = $params['options']['compression_type'];
|
||||
}
|
||||
|
||||
// Set archive bytes offset
|
||||
if ( isset( $params['archive_bytes_offset'] ) ) {
|
||||
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
|
||||
} else {
|
||||
$archive_bytes_offset = ai1wm_archive_bytes( $params );
|
||||
}
|
||||
|
||||
// Set file bytes offset
|
||||
if ( isset( $params['file_bytes_offset'] ) ) {
|
||||
$file_bytes_offset = (int) $params['file_bytes_offset'];
|
||||
} else {
|
||||
$file_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Set file bytes written
|
||||
if ( isset( $params['file_bytes_written'] ) ) {
|
||||
$file_bytes_written = (int) $params['file_bytes_written'];
|
||||
} else {
|
||||
$file_bytes_written = 0;
|
||||
}
|
||||
|
||||
// Set plugins bytes offset
|
||||
if ( isset( $params['plugins_bytes_offset'] ) ) {
|
||||
$plugins_bytes_offset = (int) $params['plugins_bytes_offset'];
|
||||
} else {
|
||||
$plugins_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Get processed files size
|
||||
if ( isset( $params['processed_files_size'] ) ) {
|
||||
$processed_files_size = (int) $params['processed_files_size'];
|
||||
} else {
|
||||
$processed_files_size = 0;
|
||||
}
|
||||
|
||||
// Get total plugins files size
|
||||
if ( isset( $params['total_plugins_files_size'] ) ) {
|
||||
$total_plugins_files_size = (int) $params['total_plugins_files_size'];
|
||||
} else {
|
||||
$total_plugins_files_size = 1;
|
||||
}
|
||||
|
||||
// Get total plugins files count
|
||||
if ( isset( $params['total_plugins_files_count'] ) ) {
|
||||
$total_plugins_files_count = (int) $params['total_plugins_files_count'];
|
||||
} else {
|
||||
$total_plugins_files_count = 1;
|
||||
}
|
||||
|
||||
// Set file CRC
|
||||
if ( isset( $params['file_crc'] ) ) {
|
||||
$file_crc = $params['file_crc'];
|
||||
} else {
|
||||
$file_crc = null;
|
||||
}
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_plugins_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d plugin files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_plugins_files_count, $progress ) );
|
||||
|
||||
// Flag to hold if file data has been processed
|
||||
$completed = true;
|
||||
|
||||
// Start time
|
||||
$start = microtime( true );
|
||||
|
||||
// Get plugins list file
|
||||
$plugins_list = ai1wm_open( ai1wm_plugins_list_path( $params ), 'r' );
|
||||
|
||||
// Set the file pointer at the current index
|
||||
if ( fseek( $plugins_list, $plugins_bytes_offset ) !== -1 ) {
|
||||
|
||||
// Open the archive file for writing
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ), $encrypt_password, $compression_type );
|
||||
|
||||
// Set the file pointer to the one that we have saved
|
||||
$archive->set_file_pointer( $archive_bytes_offset );
|
||||
|
||||
// Loop over files
|
||||
while ( ( $row = ai1wm_getcsv( $plugins_list ) ) !== false ) {
|
||||
list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = $row;
|
||||
$file_bytes_read = 0;
|
||||
|
||||
// Add file to archive
|
||||
if ( ( $completed = $archive->add_file( $file_abspath, 'plugins' . DIRECTORY_SEPARATOR . $file_relpath, $file_bytes_read, $file_bytes_offset, $file_bytes_written, $file_crc ) ) ) {
|
||||
$file_crc = null;
|
||||
|
||||
// Reset file bytes
|
||||
$file_bytes_offset = $file_bytes_written = 0;
|
||||
|
||||
// Get plugins bytes offset
|
||||
$plugins_bytes_offset = ftell( $plugins_list );
|
||||
}
|
||||
|
||||
// Increment processed files size
|
||||
$processed_files_size += $file_bytes_read;
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_plugins_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d plugin files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_plugins_files_count, $progress ) );
|
||||
|
||||
// More than 10 seconds have passed, break and do another request
|
||||
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
|
||||
if ( ( microtime( true ) - $start ) > $timeout ) {
|
||||
$completed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get archive bytes offset
|
||||
$archive_bytes_offset = $archive->get_file_pointer();
|
||||
|
||||
// Truncate the archive file
|
||||
$archive->truncate();
|
||||
|
||||
// Close the archive file
|
||||
$archive->close();
|
||||
}
|
||||
|
||||
// End of the plugins list?
|
||||
if ( feof( $plugins_list ) ) {
|
||||
|
||||
// Unset archive bytes offset
|
||||
unset( $params['archive_bytes_offset'] );
|
||||
|
||||
// Unset file bytes offset
|
||||
unset( $params['file_bytes_offset'] );
|
||||
|
||||
// Unset file bytes written
|
||||
unset( $params['file_bytes_written'] );
|
||||
|
||||
// Unset plugins bytes offset
|
||||
unset( $params['plugins_bytes_offset'] );
|
||||
|
||||
// Unset processed files size
|
||||
unset( $params['processed_files_size'] );
|
||||
|
||||
// Unset total plugins files size
|
||||
unset( $params['total_plugins_files_size'] );
|
||||
|
||||
// Unset total plugins files count
|
||||
unset( $params['total_plugins_files_count'] );
|
||||
|
||||
// Unset file CRC
|
||||
unset( $params['file_crc'] );
|
||||
|
||||
// Unset completed flag
|
||||
unset( $params['completed'] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set archive bytes offset
|
||||
$params['archive_bytes_offset'] = $archive_bytes_offset;
|
||||
|
||||
// Set file bytes offset
|
||||
$params['file_bytes_offset'] = $file_bytes_offset;
|
||||
|
||||
// Set file bytes written
|
||||
$params['file_bytes_written'] = $file_bytes_written;
|
||||
|
||||
// Set plugins bytes offset
|
||||
$params['plugins_bytes_offset'] = $plugins_bytes_offset;
|
||||
|
||||
// Set processed files size
|
||||
$params['processed_files_size'] = $processed_files_size;
|
||||
|
||||
// Set total plugins files size
|
||||
$params['total_plugins_files_size'] = $total_plugins_files_size;
|
||||
|
||||
// Set total plugins files count
|
||||
$params['total_plugins_files_count'] = $total_plugins_files_count;
|
||||
|
||||
// Set file CRC
|
||||
$params['file_crc'] = $file_crc;
|
||||
|
||||
// Set completed flag
|
||||
$params['completed'] = $completed;
|
||||
}
|
||||
|
||||
// Close the plugins list file
|
||||
ai1wm_close( $plugins_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Themes {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set encrypt password
|
||||
$encrypt_password = null;
|
||||
if ( isset( $params['options']['encrypt_backups'], $params['options']['encrypt_password'] ) ) {
|
||||
$encrypt_password = $params['options']['encrypt_password'];
|
||||
}
|
||||
|
||||
// Set compression type
|
||||
$compression_type = null;
|
||||
if ( isset( $params['options']['compression_type'] ) ) {
|
||||
$compression_type = $params['options']['compression_type'];
|
||||
}
|
||||
|
||||
// Set archive bytes offset
|
||||
if ( isset( $params['archive_bytes_offset'] ) ) {
|
||||
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
|
||||
} else {
|
||||
$archive_bytes_offset = ai1wm_archive_bytes( $params );
|
||||
}
|
||||
|
||||
// Set file bytes offset
|
||||
if ( isset( $params['file_bytes_offset'] ) ) {
|
||||
$file_bytes_offset = (int) $params['file_bytes_offset'];
|
||||
} else {
|
||||
$file_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Set file bytes written
|
||||
if ( isset( $params['file_bytes_written'] ) ) {
|
||||
$file_bytes_written = (int) $params['file_bytes_written'];
|
||||
} else {
|
||||
$file_bytes_written = 0;
|
||||
}
|
||||
|
||||
// Set themes bytes offset
|
||||
if ( isset( $params['themes_bytes_offset'] ) ) {
|
||||
$themes_bytes_offset = (int) $params['themes_bytes_offset'];
|
||||
} else {
|
||||
$themes_bytes_offset = 0;
|
||||
}
|
||||
|
||||
// Get processed files size
|
||||
if ( isset( $params['processed_files_size'] ) ) {
|
||||
$processed_files_size = (int) $params['processed_files_size'];
|
||||
} else {
|
||||
$processed_files_size = 0;
|
||||
}
|
||||
|
||||
// Get total themes files size
|
||||
if ( isset( $params['total_themes_files_size'] ) ) {
|
||||
$total_themes_files_size = (int) $params['total_themes_files_size'];
|
||||
} else {
|
||||
$total_themes_files_size = 1;
|
||||
}
|
||||
|
||||
// Get total themes files count
|
||||
if ( isset( $params['total_themes_files_count'] ) ) {
|
||||
$total_themes_files_count = (int) $params['total_themes_files_count'];
|
||||
} else {
|
||||
$total_themes_files_count = 1;
|
||||
}
|
||||
|
||||
// Set file CRC
|
||||
if ( isset( $params['file_crc'] ) ) {
|
||||
$file_crc = $params['file_crc'];
|
||||
} else {
|
||||
$file_crc = null;
|
||||
}
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_themes_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d theme files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_themes_files_count, $progress ) );
|
||||
|
||||
// Flag to hold if file data has been processed
|
||||
$completed = true;
|
||||
|
||||
// Start time
|
||||
$start = microtime( true );
|
||||
|
||||
// Get themes list file
|
||||
$themes_list = ai1wm_open( ai1wm_themes_list_path( $params ), 'r' );
|
||||
|
||||
// Set the file pointer at the current index
|
||||
if ( fseek( $themes_list, $themes_bytes_offset ) !== -1 ) {
|
||||
|
||||
// Open the archive file for writing
|
||||
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ), $encrypt_password, $compression_type );
|
||||
|
||||
// Set the file pointer to the one that we have saved
|
||||
$archive->set_file_pointer( $archive_bytes_offset );
|
||||
|
||||
// Loop over files
|
||||
while ( ( $row = ai1wm_getcsv( $themes_list ) ) !== false ) {
|
||||
list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = $row;
|
||||
$file_bytes_read = 0;
|
||||
|
||||
// Add file to archive
|
||||
if ( ( $completed = $archive->add_file( $file_abspath, 'themes' . DIRECTORY_SEPARATOR . $file_relpath, $file_bytes_read, $file_bytes_offset, $file_bytes_written, $file_crc ) ) ) {
|
||||
$file_crc = null;
|
||||
|
||||
// Reset file bytes
|
||||
$file_bytes_offset = $file_bytes_written = 0;
|
||||
|
||||
// Get themes bytes offset
|
||||
$themes_bytes_offset = ftell( $themes_list );
|
||||
}
|
||||
|
||||
// Increment processed files size
|
||||
$processed_files_size += $file_bytes_read;
|
||||
|
||||
// What percent of files have we processed?
|
||||
$progress = (int) min( ( $processed_files_size / $total_themes_files_size ) * 100, 100 );
|
||||
|
||||
// Set progress
|
||||
/* translators: 1: Number of files, 2: Progress. */
|
||||
Ai1wm_Status::info( sprintf( __( 'Archiving %1$d theme files...<br />%2$d%% complete', 'all-in-one-wp-migration' ), $total_themes_files_count, $progress ) );
|
||||
|
||||
// More than 10 seconds have passed, break and do another request
|
||||
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
|
||||
if ( ( microtime( true ) - $start ) > $timeout ) {
|
||||
$completed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get archive bytes offset
|
||||
$archive_bytes_offset = $archive->get_file_pointer();
|
||||
|
||||
// Truncate the archive file
|
||||
$archive->truncate();
|
||||
|
||||
// Close the archive file
|
||||
$archive->close();
|
||||
}
|
||||
|
||||
// End of the themes list?
|
||||
if ( feof( $themes_list ) ) {
|
||||
|
||||
// Unset archive bytes offset
|
||||
unset( $params['archive_bytes_offset'] );
|
||||
|
||||
// Unset file bytes offset
|
||||
unset( $params['file_bytes_offset'] );
|
||||
|
||||
// Unset file bytes written
|
||||
unset( $params['file_bytes_written'] );
|
||||
|
||||
// Unset themes bytes offset
|
||||
unset( $params['themes_bytes_offset'] );
|
||||
|
||||
// Unset processed files size
|
||||
unset( $params['processed_files_size'] );
|
||||
|
||||
// Unset total themes files size
|
||||
unset( $params['total_themes_files_size'] );
|
||||
|
||||
// Unset total themes files count
|
||||
unset( $params['total_themes_files_count'] );
|
||||
|
||||
// Unset file CRC
|
||||
unset( $params['file_crc'] );
|
||||
|
||||
// Unset completed flag
|
||||
unset( $params['completed'] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set archive bytes offset
|
||||
$params['archive_bytes_offset'] = $archive_bytes_offset;
|
||||
|
||||
// Set file bytes offset
|
||||
$params['file_bytes_offset'] = $file_bytes_offset;
|
||||
|
||||
// Set file bytes written
|
||||
$params['file_bytes_written'] = $file_bytes_written;
|
||||
|
||||
// Set themes bytes offset
|
||||
$params['themes_bytes_offset'] = $themes_bytes_offset;
|
||||
|
||||
// Set processed files size
|
||||
$params['processed_files_size'] = $processed_files_size;
|
||||
|
||||
// Set total themes files size
|
||||
$params['total_themes_files_size'] = $total_themes_files_size;
|
||||
|
||||
// Set total themes files count
|
||||
$params['total_themes_files_count'] = $total_themes_files_count;
|
||||
|
||||
// Set file CRC
|
||||
$params['file_crc'] = $file_crc;
|
||||
|
||||
// Set completed flag
|
||||
$params['completed'] = $completed;
|
||||
}
|
||||
|
||||
// Close the themes list file
|
||||
ai1wm_close( $themes_list );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Blogs {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Preparing blogs...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
$blogs = array();
|
||||
|
||||
// Check multisite.json file
|
||||
if ( true === is_file( ai1wm_multisite_path( $params ) ) ) {
|
||||
|
||||
// Read multisite.json file
|
||||
$handle = ai1wm_open( ai1wm_multisite_path( $params ), 'r' );
|
||||
|
||||
// Parse multisite.json file
|
||||
$multisite = ai1wm_read( $handle, filesize( ai1wm_multisite_path( $params ) ) );
|
||||
$multisite = json_decode( $multisite, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// Validate
|
||||
if ( empty( $multisite['Network'] ) ) {
|
||||
if ( isset( $multisite['Sites'] ) && ( $sites = $multisite['Sites'] ) ) {
|
||||
if ( count( $sites ) === 1 && ( $subsite = current( $sites ) ) ) {
|
||||
|
||||
// Set internal Site URL (backward compatibility)
|
||||
if ( empty( $subsite['InternalSiteURL'] ) ) {
|
||||
$subsite['InternalSiteURL'] = null;
|
||||
}
|
||||
|
||||
// Set internal Home URL (backward compatibility)
|
||||
if ( empty( $subsite['InternalHomeURL'] ) ) {
|
||||
$subsite['InternalHomeURL'] = null;
|
||||
}
|
||||
|
||||
// Set active plugins (backward compatibility)
|
||||
if ( empty( $subsite['Plugins'] ) ) {
|
||||
$subsite['Plugins'] = array();
|
||||
}
|
||||
|
||||
// Set active template (backward compatibility)
|
||||
if ( empty( $subsite['Template'] ) ) {
|
||||
$subsite['Template'] = null;
|
||||
}
|
||||
|
||||
// Set active stylesheet (backward compatibility)
|
||||
if ( empty( $subsite['Stylesheet'] ) ) {
|
||||
$subsite['Stylesheet'] = null;
|
||||
}
|
||||
|
||||
// Set uploads path (backward compatibility)
|
||||
if ( empty( $subsite['Uploads'] ) ) {
|
||||
$subsite['Uploads'] = null;
|
||||
}
|
||||
|
||||
// Set uploads URL path (backward compatibility)
|
||||
if ( empty( $subsite['UploadsURL'] ) ) {
|
||||
$subsite['UploadsURL'] = null;
|
||||
}
|
||||
|
||||
// Set uploads path (backward compatibility)
|
||||
if ( empty( $subsite['WordPress']['Uploads'] ) ) {
|
||||
$subsite['WordPress']['Uploads'] = null;
|
||||
}
|
||||
|
||||
// Set uploads URL path (backward compatibility)
|
||||
if ( empty( $subsite['WordPress']['UploadsURL'] ) ) {
|
||||
$subsite['WordPress']['UploadsURL'] = null;
|
||||
}
|
||||
|
||||
// Set blog items
|
||||
$blogs[] = array(
|
||||
'Old' => array(
|
||||
'BlogID' => $subsite['BlogID'],
|
||||
'SiteURL' => $subsite['SiteURL'],
|
||||
'HomeURL' => $subsite['HomeURL'],
|
||||
'InternalSiteURL' => $subsite['InternalSiteURL'],
|
||||
'InternalHomeURL' => $subsite['InternalHomeURL'],
|
||||
'Plugins' => $subsite['Plugins'],
|
||||
'Template' => $subsite['Template'],
|
||||
'Stylesheet' => $subsite['Stylesheet'],
|
||||
'Uploads' => $subsite['Uploads'],
|
||||
'UploadsURL' => $subsite['UploadsURL'],
|
||||
'WordPress' => $subsite['WordPress'],
|
||||
),
|
||||
'New' => array(
|
||||
'BlogID' => null,
|
||||
'SiteURL' => site_url(),
|
||||
'HomeURL' => home_url(),
|
||||
'InternalSiteURL' => site_url(),
|
||||
'InternalHomeURL' => home_url(),
|
||||
'Plugins' => $subsite['Plugins'],
|
||||
'Template' => $subsite['Template'],
|
||||
'Stylesheet' => $subsite['Stylesheet'],
|
||||
'Uploads' => get_option( 'upload_path' ),
|
||||
'UploadsURL' => get_option( 'upload_url_path' ),
|
||||
'WordPress' => array(
|
||||
'UploadsURL' => ai1wm_get_uploads_url(),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
throw new Ai1wm_Import_Exception( esc_html__( 'The archive must contain only a single WordPress site. The process cannot continue. Please revisit your export settings.', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
} else {
|
||||
throw new Ai1wm_Import_Exception( esc_html__( 'The archive must contain at least one WordPress site. The process cannot continue. Please check your export settings.', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
} else {
|
||||
throw new Ai1wm_Import_Exception( esc_html__( 'Could not import a WordPress Network into a single WordPress site. The process cannot continue. Please check your import settings.', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Write blogs.json file
|
||||
$handle = ai1wm_open( ai1wm_blogs_path( $params ), 'w' );
|
||||
ai1wm_write( $handle, json_encode( $blogs ) );
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Blogs prepared.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Check_Compression {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Read package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
|
||||
|
||||
// Parse package.json file
|
||||
$package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
|
||||
$package = json_decode( $package, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// No compression provided
|
||||
if ( empty( $package['Compression']['Enabled'] ) || empty( $package['Compression']['Type'] ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Check if server supports decompression
|
||||
if ( ! ai1wm_has_compression_type( $package['Compression']['Type'] ) ) {
|
||||
throw new Ai1wm_Import_Exception(
|
||||
wp_kses(
|
||||
sprintf(
|
||||
__(
|
||||
'Importing a compressed backup is not supported on this server.
|
||||
Please ensure <strong>%s</strong> extension is enabled. <a href="https://help.servmask.com/knowledgebase/compressed-backups/" target="_blank">Technical details</a>',
|
||||
'all-in-one-wp-migration'
|
||||
),
|
||||
$package['Compression']['Type']
|
||||
),
|
||||
ai1wm_allowed_html_tags()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Set progres
|
||||
Ai1wm_Status::info( __( 'Compressed backup detected. Compression will be handled automatically.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Check_Encryption {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
// Read package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
|
||||
|
||||
// Parse package.json file
|
||||
$package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
|
||||
$package = json_decode( $package, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// No encryption provided
|
||||
if ( empty( $package['Encrypted'] ) || empty( $package['EncryptedSignature'] ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Check decryption support
|
||||
if ( ! ai1wm_can_decrypt() ) {
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
WP_CLI::error( __( 'Importing an encrypted backup is not supported on this server. The process cannot continue. Technical details: https://help.servmask.com/knowledgebase/unable-to-encrypt-and-decrypt-backups/', 'all-in-one-wp-migration' ) );
|
||||
} else {
|
||||
Ai1wm_Status::server_cannot_decrypt( __( 'Importing an encrypted backup is not supported on this server. The process cannot continue. <a href="https://help.servmask.com/knowledgebase/unable-to-encrypt-and-decrypt-backups/" target="_blank">Technical details</a>', 'all-in-one-wp-migration' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Get WP CLI decryption password
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
$params['decryption_password'] = readline( __( 'Backup is encrypted. Please provide decryption password: ', 'all-in-one-wp-migration' ) );
|
||||
}
|
||||
|
||||
// Validate decryption password
|
||||
if ( ! empty( $params['decryption_password'] ) ) {
|
||||
if ( ai1wm_is_decryption_password_valid( $package['EncryptedSignature'], $params['decryption_password'] ) ) {
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Decryption password validated.', 'all-in-one-wp-migration' ) );
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
$decryption_password_error = __( 'The decryption password is not valid. The process cannot continue.', 'all-in-one-wp-migration' );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
WP_CLI::error( $decryption_password_error );
|
||||
} else {
|
||||
Ai1wm_Status::backup_is_encrypted( $decryption_password_error );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Ai1wm_Status::backup_is_encrypted( null );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Clean {
|
||||
|
||||
public static function execute( $params ) {
|
||||
// Get database client
|
||||
$db_client = Ai1wm_Database_Utility::get_client();
|
||||
|
||||
// Flush mainsite tables
|
||||
$db_client->add_table_prefix_filter( ai1wm_table_prefix( 'mainsite' ) );
|
||||
$db_client->flush();
|
||||
|
||||
// Trigger import cancel action
|
||||
if ( isset( $params['ai1wm_import_cancel'] ) ) {
|
||||
do_action( 'ai1wm_status_import_canceled', $params );
|
||||
} else {
|
||||
do_action( 'ai1wm_status_import_done', $params );
|
||||
}
|
||||
|
||||
// Delete storage files
|
||||
Ai1wm_Directory::delete( ai1wm_storage_path( $params ) );
|
||||
|
||||
// Exit in console
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Compatibility {
|
||||
|
||||
public static function execute( $params ) {
|
||||
do_action( 'ai1wm_status_import_start', $params );
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::info( __( 'Checking for compatibility...', 'all-in-one-wp-migration' ) );
|
||||
|
||||
// Get messages
|
||||
$messages = Ai1wm_Compatibility::get( $params );
|
||||
|
||||
// Set messages
|
||||
if ( empty( $messages ) ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Error message
|
||||
throw new Ai1wm_Compatibility_Exception( wp_kses( implode( $messages ), ai1wm_allowed_html_tags() ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Confirm {
|
||||
|
||||
public static function execute( $params ) {
|
||||
|
||||
$messages = array();
|
||||
|
||||
// Read package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
|
||||
|
||||
// Parse package.json file
|
||||
$package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
|
||||
$package = json_decode( $package, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// Confirm message
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
$messages[] = sprintf(
|
||||
/* translators: Link to Unlimited Extension */
|
||||
__(
|
||||
'Importing this file will only replace matching content. Other items stay unchanged.
|
||||
Need a full reset first? Try Reset Hub in our Unlimited Extension (%s).
|
||||
Ensure you have a current backup. Proceed?',
|
||||
'all-in-one-wp-migration'
|
||||
),
|
||||
'https://servmask.com/products/unlimited-extension'
|
||||
);
|
||||
} else {
|
||||
$messages[] = sprintf(
|
||||
/* translators: Link to Unlimited Extension */
|
||||
__(
|
||||
'Importing this file will only replace matching content. Other items stay unchanged.
|
||||
Need a full reset first? Try Reset Hub in our <a href="%s" target="_blank">Unlimited Extension</a>.<br />
|
||||
Ensure you have a current backup. Proceed?',
|
||||
'all-in-one-wp-migration'
|
||||
),
|
||||
'https://servmask.com/products/unlimited-extension?utm_source=import-confirm&utm_medium=plugin&utm_campaign=ai1wm'
|
||||
);
|
||||
}
|
||||
|
||||
// Check compatibility of PHP versions
|
||||
if ( isset( $package['PHP']['Version'] ) ) {
|
||||
// Extract major and minor version numbers
|
||||
$source_versions = explode( '.', $package['PHP']['Version'] );
|
||||
$target_versions = explode( '.', PHP_VERSION );
|
||||
|
||||
$source_major_version = intval( $source_versions[0] );
|
||||
$source_minor_version = intval( isset( $source_versions[1] ) ? $source_versions[1] : 0 );
|
||||
|
||||
$target_major_version = intval( $target_versions[0] );
|
||||
$target_minor_version = intval( isset( $target_versions[1] ) ? $target_versions[1] : 0 );
|
||||
|
||||
if ( $source_major_version !== $target_major_version ) {
|
||||
$from_php = $source_major_version;
|
||||
$to_php = $target_major_version;
|
||||
} elseif ( $source_minor_version !== $target_minor_version ) {
|
||||
$from_php = sprintf( '%s.%s', $source_major_version, $source_minor_version );
|
||||
$to_php = sprintf( '%s.%s', $target_major_version, $target_minor_version );
|
||||
}
|
||||
|
||||
if ( isset( $from_php, $to_php ) ) {
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
$messages[] = sprintf(
|
||||
/* translators: 1: Source PHP version, 2: Target PHP version. */
|
||||
__(
|
||||
'Your backup is from a PHP %1$s but the site that you are importing to is PHP %2$s.
|
||||
This could cause the import to fail. Technical details: https://help.servmask.com/knowledgebase/migrate-wordpress-from-php-5-to-php-7/',
|
||||
'all-in-one-wp-migration'
|
||||
),
|
||||
$from_php,
|
||||
$to_php
|
||||
);
|
||||
} else {
|
||||
$messages[] = sprintf(
|
||||
'<i class="ai1wm-import-info">' .
|
||||
/* translators: 1: Source PHP version, 2: Target PHP version. */
|
||||
__(
|
||||
'Your backup is from a PHP %1$s but the site that you are importing to is PHP %2$s. This could cause the import to fail. <a href="https://help.servmask.com/knowledgebase/migrate-wordpress-from-php-5-to-php-7/" target="_blank">Technical details</a>',
|
||||
'all-in-one-wp-migration'
|
||||
) . '</i>',
|
||||
$from_php,
|
||||
$to_php
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
$assoc_args = array();
|
||||
if ( isset( $params['cli_args'] ) ) {
|
||||
$assoc_args = $params['cli_args'];
|
||||
}
|
||||
|
||||
WP_CLI::confirm( implode( PHP_EOL, $messages ), $assoc_args );
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Set progress
|
||||
Ai1wm_Status::confirm( implode( $messages ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user