plugin updates
384
wp/license.txt
Normal file
@@ -0,0 +1,384 @@
|
||||
WordPress - Web publishing software
|
||||
|
||||
Copyright 2011-2023 by the contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
This program incorporates work covered by the following copyright and
|
||||
permission notices:
|
||||
|
||||
b2 is (c) 2001, 2002 Michel Valdrighi - https://cafelog.com
|
||||
|
||||
Wherever third party code has been used, credit has been given in the code's
|
||||
comments.
|
||||
|
||||
b2 is released under the GPL
|
||||
|
||||
and
|
||||
|
||||
WordPress - Web publishing software
|
||||
|
||||
Copyright 2003-2010 by the contributors
|
||||
|
||||
WordPress is released under the GPL
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
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.
|
||||
|
||||
WRITTEN OFFER
|
||||
|
||||
The source code for any program binaries or compressed scripts that are
|
||||
included with WordPress can be freely obtained at the following URL:
|
||||
|
||||
https://wordpress.org/download/source/
|
||||
97
wp/readme.html
Normal file
@@ -0,0 +1,97 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>WordPress › ReadMe</title>
|
||||
<link rel="stylesheet" href="wp-admin/css/install.css?ver=20100228" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="logo">
|
||||
<a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
|
||||
</h1>
|
||||
<p style="text-align: center">Semantic Personal Publishing Platform</p>
|
||||
|
||||
<h2>First Things First</h2>
|
||||
<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I am proud to be a part of. Thousands of hours have gone into WordPress, and we are dedicated to making it better every day. Thank you for making it part of your world.</p>
|
||||
<p style="text-align: right">— Matt Mullenweg</p>
|
||||
|
||||
<h2>Installation: Famous 5-minute install</h2>
|
||||
<ol>
|
||||
<li>Unzip the package in an empty directory and upload everything.</li>
|
||||
<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser. It will take you through the process to set up a <code>wp-config.php</code> file with your database connection details.
|
||||
<ol>
|
||||
<li>If for some reason this does not work, do not worry. It may not work on all web hosts. Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
|
||||
<li>Save the file as <code>wp-config.php</code> and upload it.</li>
|
||||
<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser.</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>Once the configuration file is set up, the installer will set up the tables needed for your site. If there is an error, double check your <code>wp-config.php</code> file, and try again. If it fails again, please go to the <a href="https://wordpress.org/support/forums/">WordPress support forums</a> with as much data as you can gather.</li>
|
||||
<li><strong>If you did not enter a password, note the password given to you.</strong> If you did not provide a username, it will be <code>admin</code>.</li>
|
||||
<li>The installer should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username and password you chose during the installation. If a password was generated for you, you can then click on “Profile” to change the password.</li>
|
||||
</ol>
|
||||
|
||||
<h2>Updating</h2>
|
||||
<h3>Using the Automatic Updater</h3>
|
||||
<ol>
|
||||
<li>Open <span class="file"><a href="wp-admin/update-core.php">wp-admin/update-core.php</a></span> in your browser and follow the instructions.</li>
|
||||
<li>You wanted more, perhaps? That’s it!</li>
|
||||
</ol>
|
||||
|
||||
<h3>Updating Manually</h3>
|
||||
<ol>
|
||||
<li>Before you update anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</li>
|
||||
<li>Delete your old WordPress files, saving ones you’ve modified.</li>
|
||||
<li>Upload the new files.</li>
|
||||
<li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
|
||||
</ol>
|
||||
|
||||
<h2>Migrating from other systems</h2>
|
||||
<p>WordPress can <a href="https://wordpress.org/documentation/article/importing-content/">import from a number of systems</a>. First you need to get WordPress installed and working as described above, before using <a href="wp-admin/import.php">our import tools</a>.</p>
|
||||
|
||||
<h2>System Requirements</h2>
|
||||
<ul>
|
||||
<li><a href="https://secure.php.net/">PHP</a> version <strong>7.0</strong> or greater.</li>
|
||||
<li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.0</strong> or greater.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Recommendations</h3>
|
||||
<ul>
|
||||
<li><a href="https://secure.php.net/">PHP</a> version <strong>7.4</strong> or greater.</li>
|
||||
<li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.7</strong> or greater OR <a href="https://mariadb.org/">MariaDB</a> version <strong>10.4</strong> or greater.</li>
|
||||
<li>The <a href="https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
|
||||
<li><a href="https://wordpress.org/news/2016/12/moving-toward-ssl/">HTTPS</a> support.</li>
|
||||
<li>A link to <a href="https://wordpress.org/">wordpress.org</a> on your site.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Online Resources</h2>
|
||||
<p>If you have any questions that are not addressed in this document, please take advantage of WordPress’ numerous online resources:</p>
|
||||
<dl>
|
||||
<dt><a href="https://wordpress.org/documentation/">HelpHub</a></dt>
|
||||
<dd>HelpHub is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
|
||||
<dt><a href="https://wordpress.org/news/">The WordPress Blog</a></dt>
|
||||
<dd>This is where you’ll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default.</dd>
|
||||
<dt><a href="https://planet.wordpress.org/">WordPress Planet</a></dt>
|
||||
<dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
|
||||
<dt><a href="https://wordpress.org/support/forums/">WordPress Support Forums</a></dt>
|
||||
<dd>If you’ve looked everywhere and still cannot find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
|
||||
<dt><a href="https://make.wordpress.org/support/handbook/appendix/other-support-locations/introduction-to-irc/">WordPress <abbr>IRC</abbr> (Internet Relay Chat) Channel</a></dt>
|
||||
<dd>There is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="https://web.libera.chat/#wordpress">irc.libera.chat #wordpress</a>)</dd>
|
||||
</dl>
|
||||
|
||||
<h2>Final Notes</h2>
|
||||
<ul>
|
||||
<li>If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the <a href="https://wordpress.org/support/forums/">Support Forums</a>.</li>
|
||||
<li>WordPress has a robust plugin <abbr>API</abbr> (Application Programming Interface) that makes extending the code easy. If you are a developer interested in utilizing this, see the <a href="https://developer.wordpress.org/plugins/">Plugin Developer Handbook</a>. You shouldn’t modify any of the core code.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Share the Love</h2>
|
||||
<p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better—you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgeable than yourself, or writing the author of a media article that overlooks us.</p>
|
||||
|
||||
<p>WordPress is the official continuation of <a href="https://cafelog.com/">b2/cafélog</a>, which came from Michel V. The work has been continued by the <a href="https://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="https://wordpress.org/donate/">donating</a>.</p>
|
||||
|
||||
<h2>License</h2>
|
||||
<p>WordPress is free software, and is released under the terms of the <abbr>GPL</abbr> (GNU General Public License) version 2 or (at your option) any later version. See <a href="license.txt">license.txt</a>.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -51,12 +51,12 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
printf(
|
||||
/* translators: 1: WordPress version number, 2: Plural number of bugs. */
|
||||
_n(
|
||||
'<strong>Version %1$s</strong> addressed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed %2$s bugs.',
|
||||
4
|
||||
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.',
|
||||
21
|
||||
),
|
||||
'6.4.1',
|
||||
'4'
|
||||
'6.4.3',
|
||||
'21'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
@@ -66,11 +66,12 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version. */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '6.4.1' )
|
||||
sanitize_title( '6.4.3' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
@@ -96,6 +97,32 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: WordPress version number, 2: Plural number of bugs. */
|
||||
_n(
|
||||
'<strong>Version %1$s</strong> addressed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed %2$s bugs.',
|
||||
4
|
||||
),
|
||||
'6.4.1',
|
||||
'4'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL. */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version. */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '6.4.1' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -69,6 +69,30 @@ class File_Upload_Upgrader {
|
||||
wp_die( $file['error'] );
|
||||
}
|
||||
|
||||
if ( 'pluginzip' === $form || 'themezip' === $form ) {
|
||||
$archive_is_valid = false;
|
||||
|
||||
/** This filter is documented in wp-admin/includes/file.php */
|
||||
if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
|
||||
$archive = new ZipArchive();
|
||||
$archive_is_valid = $archive->open( $file['file'], ZIPARCHIVE::CHECKCONS );
|
||||
|
||||
if ( true === $archive_is_valid ) {
|
||||
$archive->close();
|
||||
}
|
||||
} else {
|
||||
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
|
||||
|
||||
$archive = new PclZip( $file['file'] );
|
||||
$archive_is_valid = is_array( $archive->properties() );
|
||||
}
|
||||
|
||||
if ( true !== $archive_is_valid ) {
|
||||
wp_delete_file( $file['file'] );
|
||||
wp_die( __( 'Incompatible Archive.' ) );
|
||||
}
|
||||
}
|
||||
|
||||
$this->filename = $_FILES[ $form ]['name'];
|
||||
$this->package = $file['file'];
|
||||
|
||||
|
||||
@@ -599,14 +599,12 @@ function populate_options( array $options = array() ) {
|
||||
$autoload = 'yes';
|
||||
}
|
||||
|
||||
if ( is_array( $value ) ) {
|
||||
$value = serialize( $value );
|
||||
}
|
||||
|
||||
if ( ! empty( $insert ) ) {
|
||||
$insert .= ', ';
|
||||
}
|
||||
|
||||
$value = maybe_serialize( sanitize_option( $option, $value ) );
|
||||
|
||||
$insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload );
|
||||
}
|
||||
|
||||
|
||||
@@ -154,6 +154,10 @@ if ( isset( $_GET['action'] ) ) {
|
||||
|
||||
check_admin_referer( 'plugin-upload' );
|
||||
|
||||
if ( isset( $_FILES['pluginzip']['name'] ) && ! str_ends_with( strtolower( $_FILES['pluginzip']['name'] ), '.zip' ) ) {
|
||||
wp_die( __( 'Only .zip archives may be uploaded.' ) );
|
||||
}
|
||||
|
||||
$file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' );
|
||||
|
||||
// Used in the HTML title tag.
|
||||
@@ -302,6 +306,10 @@ if ( isset( $_GET['action'] ) ) {
|
||||
|
||||
check_admin_referer( 'theme-upload' );
|
||||
|
||||
if ( isset( $_FILES['themezip']['name'] ) && ! str_ends_with( strtolower( $_FILES['themezip']['name'] ), '.zip' ) ) {
|
||||
wp_die( __( 'Only .zip archives may be uploaded.' ) );
|
||||
}
|
||||
|
||||
$file_upload = new File_Upload_Upgrader( 'themezip', 'package' );
|
||||
|
||||
// Used in the HTML title tag.
|
||||
|
||||
96
wp/wp-config-sample.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* The base configuration for WordPress
|
||||
*
|
||||
* The wp-config.php creation script uses this file during the installation.
|
||||
* You don't have to use the web site, you can copy this file to "wp-config.php"
|
||||
* and fill in the values.
|
||||
*
|
||||
* This file contains the following configurations:
|
||||
*
|
||||
* * Database settings
|
||||
* * Secret keys
|
||||
* * Database table prefix
|
||||
* * ABSPATH
|
||||
*
|
||||
* @link https://wordpress.org/documentation/article/editing-wp-config-php/
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
// ** Database settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
define( 'DB_NAME', 'database_name_here' );
|
||||
|
||||
/** Database username */
|
||||
define( 'DB_USER', 'username_here' );
|
||||
|
||||
/** Database password */
|
||||
define( 'DB_PASSWORD', 'password_here' );
|
||||
|
||||
/** Database hostname */
|
||||
define( 'DB_HOST', 'localhost' );
|
||||
|
||||
/** Database charset to use in creating database tables. */
|
||||
define( 'DB_CHARSET', 'utf8' );
|
||||
|
||||
/** The database collate type. Don't change this if in doubt. */
|
||||
define( 'DB_COLLATE', '' );
|
||||
|
||||
/**#@+
|
||||
* Authentication unique keys and salts.
|
||||
*
|
||||
* Change these to different unique phrases! You can generate these using
|
||||
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
|
||||
*
|
||||
* You can change these at any point in time to invalidate all existing cookies.
|
||||
* This will force all users to have to log in again.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
define( 'AUTH_KEY', 'put your unique phrase here' );
|
||||
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
|
||||
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
|
||||
define( 'NONCE_KEY', 'put your unique phrase here' );
|
||||
define( 'AUTH_SALT', 'put your unique phrase here' );
|
||||
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
|
||||
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
|
||||
define( 'NONCE_SALT', 'put your unique phrase here' );
|
||||
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* WordPress database table prefix.
|
||||
*
|
||||
* You can have multiple installations in one database if you give each
|
||||
* a unique prefix. Only numbers, letters, and underscores please!
|
||||
*/
|
||||
$table_prefix = 'wp_';
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
*
|
||||
* Change this to true to enable the display of notices during development.
|
||||
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||
* in their development environments.
|
||||
*
|
||||
* For information on other constants that can be used for debugging,
|
||||
* visit the documentation.
|
||||
*
|
||||
* @link https://wordpress.org/documentation/article/debugging-in-wordpress/
|
||||
*/
|
||||
define( 'WP_DEBUG', false );
|
||||
|
||||
/* Add any custom values between this line and the "stop editing" line. */
|
||||
|
||||
|
||||
|
||||
/* That's all, stop editing! Happy publishing. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
define( 'ABSPATH', __DIR__ . '/' );
|
||||
}
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once ABSPATH . 'wp-settings.php';
|
||||
@@ -1,226 +1,229 @@
|
||||
var $ = jQuery.noConflict(),
|
||||
dtx = {
|
||||
queue: [],
|
||||
init: function() {
|
||||
var $inputs = $('input.dtx-pageload[data-dtx-value]');
|
||||
if ($inputs.length) {
|
||||
// If this is any of our built-in shortcodes, see if there's any that can be duplicated via client side
|
||||
$inputs.each(function(i, el) {
|
||||
var $input = $(el),
|
||||
raw_value = $input.attr('data-dtx-value'),
|
||||
v = decodeURIComponent(raw_value).split(' ');
|
||||
if (v.length) {
|
||||
var tag = v[0],
|
||||
atts = {};
|
||||
if (v.length > 1) {
|
||||
for (var x = 1; x < v.length; x++) {
|
||||
var att = v[x].split('=');
|
||||
if (att.length === 2) {
|
||||
var key = att[0];
|
||||
atts[key] = att[1].split("'").join('');
|
||||
}
|
||||
}
|
||||
}
|
||||
var value = '';
|
||||
switch (tag) {
|
||||
case 'CF7_GET':
|
||||
value = dtx.get(atts);
|
||||
break;
|
||||
case 'CF7_referrer':
|
||||
value = dtx.referrer(atts);
|
||||
break;
|
||||
case 'CF7_URL':
|
||||
value = dtx.current_url(atts);
|
||||
break;
|
||||
case 'CF7_get_cookie':
|
||||
value = dtx.get_cookie(atts);
|
||||
break;
|
||||
case 'CF7_guid':
|
||||
value = dtx.guid();
|
||||
break;
|
||||
case 'CF7_get_current_var':
|
||||
if (dtx.validKey(atts, 'key') && atts.key == 'url') {
|
||||
value = dtx.current_url(atts);
|
||||
} else {
|
||||
return; // Do nothing, current page variables are safe to cache, just use the value that was calculated by server
|
||||
}
|
||||
break;
|
||||
case 'CF7_get_post_var': // Current post variables are safe to cache
|
||||
case 'CF7_get_custom_field': // Meta data is safe to cache
|
||||
case 'CF7_get_taxonomy': // Terms are safe to cache
|
||||
case 'CF7_get_attachment': // Media attachment info is safe to cache
|
||||
case 'CF7_bloginfo': // Site info is safe to cache
|
||||
case 'CF7_get_theme_option': // Theme options are safe to cache
|
||||
return; // Do nothing, just use the value that was calculated by server
|
||||
default:
|
||||
if (tag) {
|
||||
// Queue the requests for an AJAX call at the end of init
|
||||
dtx.queue.push({ 'value': raw_value, 'multiline': $input.is('textarea') });
|
||||
}
|
||||
return; // Don't continue after queuing it for AJAX
|
||||
}
|
||||
dtx.set($input, value);
|
||||
}
|
||||
});
|
||||
if (dtx.queue.length) {
|
||||
setTimeout(function() { // Set timeout to force it async
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: dtx_obj.ajax_url,
|
||||
dataType: 'json', // only accept strict JSON objects
|
||||
data: {
|
||||
'action': 'wpcf7dtx',
|
||||
'shortcodes': dtx.queue
|
||||
},
|
||||
cache: false,
|
||||
error: function(xhr, status, error) {
|
||||
console.error('[CF7 DTX AJAX ERROR]', error, status, xhr);
|
||||
},
|
||||
success: function(data, status, xhr) {
|
||||
if (typeof(data) == 'object' && data.length) {
|
||||
$.each(data, function(i, obj) {
|
||||
var $inputs = $('.wpcf7 form input.dtx-pageload[data-dtx-value="' + obj.raw_value + '"]');
|
||||
if ($inputs.length) {
|
||||
dtx.set($inputs, obj.value);
|
||||
$inputs.addClass('dtx-ajax-loaded');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Check if Key Exists in Object
|
||||
*/
|
||||
validKey: function(obj, key) {
|
||||
return obj.hasOwnProperty(key) && typeof(obj[key]) == 'string' && obj[key].trim();
|
||||
},
|
||||
/**
|
||||
* Maybe Obfuscate Value
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-attribute-obfuscate/
|
||||
*/
|
||||
obfuscate: function(value, atts) {
|
||||
value = value.trim();
|
||||
if (dtx.validKey(atts, 'obfuscate') && atts.obfuscate) {
|
||||
var o = '';
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
o += '&#' + value.codePointAt(i) + ';';
|
||||
}
|
||||
return o;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
/**
|
||||
* Set Value for Form Field
|
||||
*/
|
||||
set: function($input, value) {
|
||||
$input.attr('value', value).addClass('dtx-loaded');
|
||||
},
|
||||
/**
|
||||
* Get Value form URL Query by Key
|
||||
*
|
||||
* @see @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-php-get-variables/
|
||||
*/
|
||||
get: function(atts) {
|
||||
if (dtx.validKey(atts, 'key')) {
|
||||
var query = window.location.search;
|
||||
if (query) {
|
||||
query = new URLSearchParams(query);
|
||||
return dtx.obfuscate(query.get(atts.key).trim(), atts);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
/**
|
||||
* Get Referrering URL
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-referrer-url/
|
||||
*/
|
||||
referrer: function(atts) {
|
||||
return dtx.obfuscate(document.referrer, atts);
|
||||
},
|
||||
/**
|
||||
* Get Current URL or Part
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-current-url/
|
||||
*/
|
||||
current_url: function(atts) {
|
||||
if (atts.hasOwnProperty('part')) {
|
||||
var parts = [
|
||||
'scheme', // e.g. `http`
|
||||
'host',
|
||||
'port',
|
||||
'path',
|
||||
'query', // after the question mark ?
|
||||
'fragment' // after the pound sign #
|
||||
];
|
||||
if (parts.includes(atts.part)) {
|
||||
// return part of the url
|
||||
switch (atts.part) {
|
||||
case 'scheme':
|
||||
return dtx.obfuscate(window.location.protocol.replace(':', ''), atts);
|
||||
case 'host':
|
||||
return dtx.obfuscate(window.location.host, atts);
|
||||
case 'port':
|
||||
return dtx.obfuscate(window.location.port, atts);
|
||||
case 'path':
|
||||
return dtx.obfuscate(window.location.pathname, atts);
|
||||
case 'query':
|
||||
return dtx.obfuscate(window.location.search.replace('?', ''), atts);
|
||||
case 'fragment':
|
||||
return dtx.obfuscate(window.location.hash.replace('#', ''), atts);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return dtx.obfuscate(window.location.href, atts); // Return the full url
|
||||
}
|
||||
return '';
|
||||
},
|
||||
/**
|
||||
* Get Cookie Value
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-cookie/
|
||||
*/
|
||||
get_cookie: function(atts) {
|
||||
if (atts.hasOwnProperty('key') && typeof(atts.key) == 'string' && atts.key.trim() != '') {
|
||||
var keyValue = document.cookie.match('(^|;) ?' + atts.key.trim() + '=([^;]*)(;|$)');
|
||||
return keyValue ? dtx.obfuscate(keyValue[2], atts) : '';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
/**
|
||||
* Generate a random GUID (globally unique identifier)
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-guid/
|
||||
*/
|
||||
guid: function() {
|
||||
if (typeof(window.crypto) != 'undefined' && typeof(window.crypto.getRandomValues) != 'undefined') {
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
).toUpperCase();
|
||||
}
|
||||
console.warn('[CF7 DTX] Cryptographically secure PRNG is not available for generating GUID value');
|
||||
var d = new Date().getTime(), //Timestamp
|
||||
d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0; //Time in microseconds since page-load or 0 if unsupported
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
var r = Math.random() * 16; //random number between 0 and 16
|
||||
if (d > 0) { //Use timestamp until depleted
|
||||
r = (d + r) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
} else { //Use microseconds since page-load if supported
|
||||
r = (d2 + r) % 16 | 0;
|
||||
d2 = Math.floor(d2 / 16);
|
||||
}
|
||||
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16).toUpperCase();
|
||||
}).toUpperCase();;
|
||||
}
|
||||
};
|
||||
window['$'] = window['$'] || jQuery.noConflict();
|
||||
var dtx = {
|
||||
queue: [],
|
||||
init: function() {
|
||||
var $inputs = $('input.dtx-pageload[data-dtx-value]');
|
||||
if ($inputs.length) {
|
||||
// If this is any of our built-in shortcodes, see if there's any that can be duplicated via client side
|
||||
$inputs.each(function(i, el) {
|
||||
var $input = $(el),
|
||||
raw_value = $input.attr('data-dtx-value'),
|
||||
v = decodeURIComponent(raw_value).split(' ');
|
||||
if (v.length) {
|
||||
var tag = v[0],
|
||||
atts = {};
|
||||
if (v.length > 1) {
|
||||
for (var x = 1; x < v.length; x++) {
|
||||
var att = v[x].split('=');
|
||||
if (att.length === 2) {
|
||||
var key = att[0];
|
||||
atts[key] = att[1].split("'").join('');
|
||||
}
|
||||
}
|
||||
}
|
||||
var value = '';
|
||||
switch (tag) {
|
||||
case 'CF7_GET':
|
||||
value = dtx.get(atts);
|
||||
break;
|
||||
case 'CF7_referrer':
|
||||
value = dtx.referrer(atts);
|
||||
break;
|
||||
case 'CF7_URL':
|
||||
value = dtx.current_url(atts);
|
||||
break;
|
||||
case 'CF7_get_cookie':
|
||||
value = dtx.get_cookie(atts);
|
||||
break;
|
||||
case 'CF7_guid':
|
||||
value = dtx.guid();
|
||||
break;
|
||||
case 'CF7_get_current_var':
|
||||
if (dtx.validKey(atts, 'key') && atts.key == 'url') {
|
||||
value = dtx.current_url(atts);
|
||||
} else {
|
||||
return; // Do nothing, current page variables are safe to cache, just use the value that was calculated by server
|
||||
}
|
||||
break;
|
||||
case 'CF7_get_post_var': // Current post variables are safe to cache
|
||||
case 'CF7_get_custom_field': // Meta data is safe to cache
|
||||
case 'CF7_get_taxonomy': // Terms are safe to cache
|
||||
case 'CF7_get_attachment': // Media attachment info is safe to cache
|
||||
case 'CF7_bloginfo': // Site info is safe to cache
|
||||
case 'CF7_get_theme_option': // Theme options are safe to cache
|
||||
return; // Do nothing, just use the value that was calculated by server
|
||||
default:
|
||||
if (tag) {
|
||||
// Queue the requests for an AJAX call at the end of init
|
||||
dtx.queue.push({ 'value': raw_value, 'multiline': $input.is('textarea') });
|
||||
}
|
||||
return; // Don't continue after queuing it for AJAX
|
||||
}
|
||||
dtx.set($input, value);
|
||||
}
|
||||
});
|
||||
if (dtx.queue.length) {
|
||||
setTimeout(function() { // Set timeout to force it async
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: dtx_obj.ajax_url,
|
||||
dataType: 'json', // only accept strict JSON objects
|
||||
data: {
|
||||
'action': 'wpcf7dtx',
|
||||
'shortcodes': dtx.queue
|
||||
},
|
||||
cache: false,
|
||||
error: function(xhr, status, error) {
|
||||
console.error('[CF7 DTX AJAX ERROR]', error, status, xhr);
|
||||
},
|
||||
success: function(data, status, xhr) {
|
||||
if (typeof(data) == 'object' && data.length) {
|
||||
$.each(data, function(i, obj) {
|
||||
var $inputs = $('.wpcf7 form input.dtx-pageload[data-dtx-value="' + obj.raw_value + '"]');
|
||||
if ($inputs.length) {
|
||||
$inputs.addClass('dtx-ajax-loaded');
|
||||
dtx.set($inputs, obj.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Check if Key Exists in Object
|
||||
*/
|
||||
validKey: function(obj, key) {
|
||||
return obj.hasOwnProperty(key) && typeof(obj[key]) == 'string' && obj[key].trim();
|
||||
},
|
||||
/**
|
||||
* Maybe Obfuscate Value
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-attribute-obfuscate/
|
||||
*/
|
||||
obfuscate: function(value, atts) {
|
||||
value = value.trim();
|
||||
if (dtx.validKey(atts, 'obfuscate') && atts.obfuscate) {
|
||||
var o = '';
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
o += '&#' + value.codePointAt(i) + ';';
|
||||
}
|
||||
return o;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
/**
|
||||
* Set Value for Form Field
|
||||
*/
|
||||
set: function($input, value) {
|
||||
$input
|
||||
.attr('value', value)
|
||||
.addClass('dtx-loaded')
|
||||
.trigger('dtx_init');
|
||||
},
|
||||
/**
|
||||
* Get Value form URL Query by Key
|
||||
*
|
||||
* @see @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-php-get-variables/
|
||||
*/
|
||||
get: function(atts) {
|
||||
if (dtx.validKey(atts, 'key')) {
|
||||
var query = window.location.search;
|
||||
if (query) {
|
||||
query = new URLSearchParams(query);
|
||||
return dtx.obfuscate(query.get(atts.key).trim(), atts);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
/**
|
||||
* Get Referrering URL
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-referrer-url/
|
||||
*/
|
||||
referrer: function(atts) {
|
||||
return dtx.obfuscate(document.referrer, atts);
|
||||
},
|
||||
/**
|
||||
* Get Current URL or Part
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-current-url/
|
||||
*/
|
||||
current_url: function(atts) {
|
||||
if (atts.hasOwnProperty('part')) {
|
||||
var parts = [
|
||||
'scheme', // e.g. `http`
|
||||
'host',
|
||||
'port',
|
||||
'path',
|
||||
'query', // after the question mark ?
|
||||
'fragment' // after the pound sign #
|
||||
];
|
||||
if (parts.includes(atts.part)) {
|
||||
// return part of the url
|
||||
switch (atts.part) {
|
||||
case 'scheme':
|
||||
return dtx.obfuscate(window.location.protocol.replace(':', ''), atts);
|
||||
case 'host':
|
||||
return dtx.obfuscate(window.location.host, atts);
|
||||
case 'port':
|
||||
return dtx.obfuscate(window.location.port, atts);
|
||||
case 'path':
|
||||
return dtx.obfuscate(window.location.pathname, atts);
|
||||
case 'query':
|
||||
return dtx.obfuscate(window.location.search.replace('?', ''), atts);
|
||||
case 'fragment':
|
||||
return dtx.obfuscate(window.location.hash.replace('#', ''), atts);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return dtx.obfuscate(window.location.href, atts); // Return the full url
|
||||
}
|
||||
return '';
|
||||
},
|
||||
/**
|
||||
* Get Cookie Value
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-cookie/
|
||||
*/
|
||||
get_cookie: function(atts) {
|
||||
if (atts.hasOwnProperty('key') && typeof(atts.key) == 'string' && atts.key.trim() != '') {
|
||||
var keyValue = document.cookie.match('(^|;) ?' + atts.key.trim() + '=([^;]*)(;|$)');
|
||||
return keyValue ? dtx.obfuscate(keyValue[2], atts) : '';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
/**
|
||||
* Generate a random GUID (globally unique identifier)
|
||||
*
|
||||
* @see https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-guid/
|
||||
*/
|
||||
guid: function() {
|
||||
if (typeof(window.crypto) != 'undefined' && typeof(window.crypto.getRandomValues) != 'undefined') {
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
).toUpperCase();
|
||||
}
|
||||
console.warn('[CF7 DTX] Cryptographically secure PRNG is not available for generating GUID value');
|
||||
var d = new Date().getTime(), //Timestamp
|
||||
d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0; //Time in microseconds since page-load or 0 if unsupported
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
var r = Math.random() * 16; //random number between 0 and 16
|
||||
if (d > 0) { //Use timestamp until depleted
|
||||
r = (d + r) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
} else { //Use microseconds since page-load if supported
|
||||
r = (d2 + r) % 16 | 0;
|
||||
d2 = Math.floor(d2 / 16);
|
||||
}
|
||||
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16).toUpperCase();
|
||||
}).toUpperCase();;
|
||||
}
|
||||
};
|
||||
$(document).ready(dtx.init);
|
||||
@@ -1,2 +1,2 @@
|
||||
/*! Do not edit, this file is generated automatically - 2024-01-09 15:01:30 MST */
|
||||
var $=jQuery.noConflict(),dtx={queue:[],init:function(){var e=$("input.dtx-pageload[data-dtx-value]");e.length&&(e.each(function(e,t){var r=$(t),a=r.attr("data-dtx-value"),o=decodeURIComponent(a).split(" ");if(o.length){var n=o[0],c={};if(1<o.length)for(var u=1;u<o.length;u++){var i=o[u].split("="),d;2===i.length&&(c[i[0]]=i[1].split("'").join(""))}var s="";switch(n){case"CF7_GET":s=dtx.get(c);break;case"CF7_referrer":s=dtx.referrer(c);break;case"CF7_URL":s=dtx.current_url(c);break;case"CF7_get_cookie":s=dtx.get_cookie(c);break;case"CF7_guid":s=dtx.guid();break;case"CF7_get_current_var":if(!dtx.validKey(c,"key")||"url"!=c.key)return;s=dtx.current_url(c);break;case"CF7_get_post_var":case"CF7_get_custom_field":case"CF7_get_taxonomy":case"CF7_get_attachment":case"CF7_bloginfo":case"CF7_get_theme_option":return;default:return void(n&&dtx.queue.push({value:a,multiline:r.is("textarea")}))}dtx.set(r,s)}}),dtx.queue.length)&&setTimeout(function(){$.ajax({type:"POST",url:dtx_obj.ajax_url,dataType:"json",data:{action:"wpcf7dtx",shortcodes:dtx.queue},cache:!1,error:function(e,t,r){},success:function(e,t,r){"object"==typeof e&&e.length&&$.each(e,function(e,t){var r=$('.wpcf7 form input.dtx-pageload[data-dtx-value="'+t.raw_value+'"]');r.length&&(dtx.set(r,t.value),r.addClass("dtx-ajax-loaded"))})}})},10)},validKey:function(e,t){return e.hasOwnProperty(t)&&"string"==typeof e[t]&&e[t].trim()},obfuscate:function(e,t){if(e=e.trim(),dtx.validKey(t,"obfuscate")&&t.obfuscate){for(var r="",a=0;a<e.length;a++)r+="&#"+e.codePointAt(a)+";";return r}return e},set:function(e,t){e.attr("value",t).addClass("dtx-loaded")},get:function(e){if(dtx.validKey(e,"key")){var t=window.location.search;if(t)return t=new URLSearchParams(t),dtx.obfuscate(t.get(e.key).trim(),e)}return""},referrer:function(e){return dtx.obfuscate(document.referrer,e)},current_url:function(e){if(!e.hasOwnProperty("part"))return dtx.obfuscate(window.location.href,e);var t;if(["scheme","host","port","path","query","fragment"].includes(e.part))switch(e.part){case"scheme":return dtx.obfuscate(window.location.protocol.replace(":",""),e);case"host":return dtx.obfuscate(window.location.host,e);case"port":return dtx.obfuscate(window.location.port,e);case"path":return dtx.obfuscate(window.location.pathname,e);case"query":return dtx.obfuscate(window.location.search.replace("?",""),e);case"fragment":return dtx.obfuscate(window.location.hash.replace("#",""),e)}return""},get_cookie:function(e){var t;return e.hasOwnProperty("key")&&"string"==typeof e.key&&""!=e.key.trim()&&(t=document.cookie.match("(^|;) ?"+e.key.trim()+"=([^;]*)(;|$)"))?dtx.obfuscate(t[2],e):""},guid:function(){var r,a;return(void 0!==window.crypto&&void 0!==window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)):(r=(new Date).getTime(),a="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random();return 0<r?(t=(r+t)%16|0,r=Math.floor(r/16)):(t=(a+t)%16|0,a=Math.floor(a/16)),("x"===e?t:3&t|8).toString(16).toUpperCase()}))).toUpperCase()}};$(document).ready(dtx.init);
|
||||
/*! Do not edit, this file is generated automatically - 2024-02-13 23:02:47 EST */
|
||||
window.$=window.$||jQuery.noConflict();var dtx={queue:[],init:function(){var e=$("input.dtx-pageload[data-dtx-value]");e.length&&(e.each(function(e,t){var r=$(t),a=r.attr("data-dtx-value"),o=decodeURIComponent(a).split(" ");if(o.length){var n=o[0],c={};if(1<o.length)for(var i=1;i<o.length;i++){var u=o[i].split("="),d;2===u.length&&(c[u[0]]=u[1].split("'").join(""))}var s="";switch(n){case"CF7_GET":s=dtx.get(c);break;case"CF7_referrer":s=dtx.referrer(c);break;case"CF7_URL":s=dtx.current_url(c);break;case"CF7_get_cookie":s=dtx.get_cookie(c);break;case"CF7_guid":s=dtx.guid();break;case"CF7_get_current_var":if(!dtx.validKey(c,"key")||"url"!=c.key)return;s=dtx.current_url(c);break;case"CF7_get_post_var":case"CF7_get_custom_field":case"CF7_get_taxonomy":case"CF7_get_attachment":case"CF7_bloginfo":case"CF7_get_theme_option":return;default:return void(n&&dtx.queue.push({value:a,multiline:r.is("textarea")}))}dtx.set(r,s)}}),dtx.queue.length)&&setTimeout(function(){$.ajax({type:"POST",url:dtx_obj.ajax_url,dataType:"json",data:{action:"wpcf7dtx",shortcodes:dtx.queue},cache:!1,error:function(e,t,r){},success:function(e,t,r){"object"==typeof e&&e.length&&$.each(e,function(e,t){var r=$('.wpcf7 form input.dtx-pageload[data-dtx-value="'+t.raw_value+'"]');r.length&&(r.addClass("dtx-ajax-loaded"),dtx.set(r,t.value))})}})},10)},validKey:function(e,t){return e.hasOwnProperty(t)&&"string"==typeof e[t]&&e[t].trim()},obfuscate:function(e,t){if(e=e.trim(),dtx.validKey(t,"obfuscate")&&t.obfuscate){for(var r="",a=0;a<e.length;a++)r+="&#"+e.codePointAt(a)+";";return r}return e},set:function(e,t){e.attr("value",t).addClass("dtx-loaded").trigger("dtx_init")},get:function(e){if(dtx.validKey(e,"key")){var t=window.location.search;if(t)return t=new URLSearchParams(t),dtx.obfuscate(t.get(e.key).trim(),e)}return""},referrer:function(e){return dtx.obfuscate(document.referrer,e)},current_url:function(e){if(!e.hasOwnProperty("part"))return dtx.obfuscate(window.location.href,e);var t;if(["scheme","host","port","path","query","fragment"].includes(e.part))switch(e.part){case"scheme":return dtx.obfuscate(window.location.protocol.replace(":",""),e);case"host":return dtx.obfuscate(window.location.host,e);case"port":return dtx.obfuscate(window.location.port,e);case"path":return dtx.obfuscate(window.location.pathname,e);case"query":return dtx.obfuscate(window.location.search.replace("?",""),e);case"fragment":return dtx.obfuscate(window.location.hash.replace("#",""),e)}return""},get_cookie:function(e){var t;return e.hasOwnProperty("key")&&"string"==typeof e.key&&""!=e.key.trim()&&(t=document.cookie.match("(^|;) ?"+e.key.trim()+"=([^;]*)(;|$)"))?dtx.obfuscate(t[2],e):""},guid:function(){var r,a;return(void 0!==window.crypto&&void 0!==window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)):(r=(new Date).getTime(),a="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random();return 0<r?(t=(r+t)%16|0,r=Math.floor(r/16)):(t=(a+t)%16|0,a=Math.floor(a/16)),("x"===e?t:3&t|8).toString(16).toUpperCase()}))).toUpperCase()}};$(document).ready(dtx.init);
|
||||
@@ -1,2 +1,2 @@
|
||||
/*! Do not edit, this file is generated automatically - 2024-01-09 15:01:30 MST */
|
||||
/*! Do not edit, this file is generated automatically - 2024-02-13 23:02:47 EST */
|
||||
!function(n){"use strict";"undefined"!=typeof wpcf7&&null!==wpcf7&&(window.wpcf7dtx=window.wpcf7dtx||{},wpcf7dtx.taggen={},wpcf7dtx.taggen.escapeRegExp=function(e){return e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")},wpcf7dtx.taggen.replaceAll=function(e,t,n,a){var c;return null!=e&&"string"==typeof e&&""!==e.trim()&&-1<e.indexOf(t)?(c=new RegExp(wpcf7dtx.taggen.escapeRegExp(t),"g"),a&&(c=new RegExp(t,"g")),e.replace(c,n)):e},wpcf7dtx.taggen.updateOption=function(e){var e=n(e.currentTarget),t=encodeURIComponent(wpcf7dtx.taggen.replaceAll(e.val(),"'","'"));e.siblings('input[type="hidden"].option').val(t)},n(function(){n("form.tag-generator-panel .dtx-option").on("change keyup click",wpcf7dtx.taggen.updateOption),n('.contact-form-editor-panel #tag-generator-list a.thickbox.button[href*="inlineId=tag-generator-panel-dynamic_"]').each(function(){var e=n(this),t=e.text();e.addClass("dtx-form-tag"),"dynamic drop-down menu"!=t&&"dynamic checkboxes"!=t&&"dynamic radio buttons"!=t||e.attr("href",e.attr("href").replace("height=500","height=750"))})}))}(jQuery);
|
||||
@@ -1,218 +1,237 @@
|
||||
== Changelog ==
|
||||
|
||||
= 4.2.0 =
|
||||
|
||||
* Security Update: ** Please be sure to review this doc, as you may need to adjust the settings: https://sevenspark.com/docs/contact-form-7-dynamic-text-extension/allow-data-access **
|
||||
* Feature: Added Settings Screen with Allow Lists
|
||||
* Feature: Added Form Scanner
|
||||
* Feature: Added Allow List key validation in CF7 Form Validator
|
||||
|
||||
= 4.1.0 =
|
||||
|
||||
* Feature: Looks for a `dtx.php` file in the `wp_content` directory to maybe load custom shortcodes, [see support thread](https://wordpress.org/support/topic/how-to-avoid-custom-shortcodes-being-overwritten-on-updates/)
|
||||
* Feature: Looks for a `dtx.php` file in the current active theme's directory to maybe load custom shortcodes, [see support thread](https://wordpress.org/support/topic/how-to-avoid-custom-shortcodes-being-overwritten-on-updates/)
|
||||
* Feature: Looks for a `dtx.php` file in the current active theme's parent directory to maybe load custom shortcodes, [see support thread](https://wordpress.org/support/topic/how-to-avoid-custom-shortcodes-being-overwritten-on-updates/)
|
||||
* Fix: addressed user reported bug, [see support thread](https://wordpress.org/support/topic/fatal-error-v4-0-3/)
|
||||
|
||||
= 4.0.3 =
|
||||
|
||||
* Feature: Added `exclusive` option to checkbox tag generator
|
||||
* Fix: addressed bug that put all dynamic checkbox/radio options into one
|
||||
* Fix: addressed bug in frontend validator for multiple selected values
|
||||
|
||||
= 4.0.2 =
|
||||
|
||||
* Fix: addressed bug that put all dynamic select options into one, [see support thread](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/)
|
||||
* Update: sanitizing and escaping filters now accept `none` as value for `$type` to bypass. Use with caution.
|
||||
|
||||
= 4.0.1 =
|
||||
|
||||
* Fix: addressed bug that prevented translation for cache compatibility description
|
||||
|
||||
= 4.0.0 =
|
||||
|
||||
* Major: modified function names
|
||||
* Major: deprecated `dynamictext` and `dynamichidden` form tags in favor of `dynamic_text` and `dynamic_hidden`. For more information, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_email` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-email/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_url` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-url/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_tel` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-tel/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_number` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-number/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_range` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-range/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_textarea` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-textarea/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_select` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-select/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_radio` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-radio/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_date` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-date/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_submit` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-submit/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dtx_hide_blank` form tag attribute for `dynamic_select`. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-select/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dtx_disable_blank` form tag attribute for `dynamic_select`. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-select/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: added mail validation for `dynamic_email` and `dynamic_hidden` for backend configuration. For more information, see the [FAQ](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/frequently-asked-questions/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: added the Akismet feature to DTX text, email, and URL form tags.
|
||||
* Update: adjusted how queued values were sent for cache compatibility mode to allow for multiline values in textareas
|
||||
* Removed unused utility functions
|
||||
|
||||
= 3.5.4 =
|
||||
|
||||
* Fix: Updated JavaScript to prevent cacheable fields from making unnecessary AJAX requests
|
||||
|
||||
= 3.5.3 =
|
||||
|
||||
* Update: removed the use of sessions, [see support thread](https://wordpress.org/support/topic/add-option-to-disable-session-data/)
|
||||
|
||||
= 3.5.2 =
|
||||
|
||||
* Fix: Updated the `CF7_URL` shortcode to only use `network_home_url()` for multisite installs that do not use subdomains, and use `home_url()` for all others to [maybe address this support thread](https://wordpress.org/support/topic/cf7_url-return-only-domain-and-not-subdomain/)
|
||||
* Fix: Removed a lingering debug call
|
||||
|
||||
= 3.5.1 =
|
||||
|
||||
* Fix: fixed bug so tag generator for dynamic fields work on "Add New Contact Form" page of Contact Form 7
|
||||
* Updated: Updated text in tag generator for cache compatible checkbox and added link to documentation
|
||||
|
||||
= 3.5.0 =
|
||||
|
||||
* Feature: Added the `dtx_pageload` form tag attribute for cache compatibility. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tag-attribute-after-page-load/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Fix: Updated to be compatible with WordPress version 6.3
|
||||
* Fix: Addressed a bug where `scheme` in `CF7_URL part='scheme'` was incorrectly sanitizing as URL instead of text
|
||||
* Fix: Fixed `wp_kses()` in tag generator that stripped out link opening in new tab
|
||||
* Update: `CF7_get_current_var` utilizes PHP session variables where appropriate
|
||||
* Update: All JavaScript assets will load with the `defer` strategy in the footer in [WordPress 6.3](https://make.wordpress.org/core/2023/07/14/registering-scripts-with-async-and-defer-attributes-in-wordpress-6-3/)
|
||||
|
||||
= 3.4.0 =
|
||||
|
||||
* Feature: Feature: Added the `CF7_get_current_var` shortcode, [see support thread for user request](https://wordpress.org/support/topic/wrong-page-title-7/). For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-current-variables/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Fix: Updated the `CF7_URL` shortcode to no longer check for ports since that's handled in `network_home_url()` function, [see support thread](https://wordpress.org/support/topic/version-3-3-0-breaking/)
|
||||
|
||||
= 3.3.0 =
|
||||
|
||||
* Feature: Added the `CF7_get_cookie` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-cookie/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added the `CF7_get_taxonomy` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-taxonomy/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added the `CF7_get_theme_option` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-theme-option/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added `wpcf7dtx_sanitize` filter that sanitizes attribute values in built-in shortcodes
|
||||
* Feature: Added `wpcf7dtx_escape` filter that escapes values in built-in shortcodes
|
||||
* Feature: Added `wpcf7dtx_allow_protocols` filter to customize allowed protocols in escaping URLs in built-in shortcodes
|
||||
* Fix: Updated how plugin gets dynamic value in form tags, now uses `wpcf7dtx_get_dynamic()` function
|
||||
* Fix: Added case-insensitive ID in `CF7_get_post_var`
|
||||
* Fix: Sanitizes post variable keys as keys in `wpcf7dtx_get_post_var()`
|
||||
* Fix: Updated `wpcf7dtx_get_post_id()` to pull from "the loop" if `$post` is unavailable and now used consistently across built-in shortcodes
|
||||
* Fix: Updated tag markup to be compatible with Contact Form 7 version 5.6 Beta for successful form validation, [see support thread](https://wordpress.org/support/topic/required-field-no-error-is-output-when-validating-when-field-is-empty/)
|
||||
* Fix: Updated the `CF7_URL` shortcode to use `network_home_url()`, [see support thread](https://wordpress.org/support/topic/current-url-not-working/)
|
||||
* Fix: Updated GUID function to return appropriately escaped values
|
||||
* Fix: Updated all existing built-in shortcodes to use the the sanitizing, escaping, and obfuscating shortcodes, [see support thread](https://wordpress.org/support/topic/cant-get-obfuscate-to-work/)
|
||||
* Fix: Marked compatible with WordPress core version 6.2.
|
||||
|
||||
= 3.2 =
|
||||
|
||||
* Feature: Add optional 'part' parameter to CF7_URL shortcode to retrieve Host, Query, or Path from current URL
|
||||
* Updated minimum PHP requirement to 7.4 moving forward
|
||||
* Update branding assets
|
||||
* Update Tested Up To to 6.1.1
|
||||
* Plugin will now be jointly maintained by [SevenSpark](https://sevenspark.com/) and [AuRise Creative](https://aurisecreative.com)
|
||||
|
||||
= 3.1.3 =
|
||||
|
||||
* Fix: Fixed the syntax error that reappeared in 3.1.2.
|
||||
|
||||
= 3.1.2 =
|
||||
|
||||
**Release Date: January 27, 2023**
|
||||
|
||||
* Fix: updated the text domain to match the plugin slug
|
||||
* Fix: updated all of the translated strings to match
|
||||
|
||||
= 3.1.1 =
|
||||
|
||||
**Release Date: January 26, 2023**
|
||||
|
||||
* Fix: Fixed the syntax error: Parse error: syntax error, unexpected `)` in /wp-content/plugins/contact-form-7-dynamic-text extension/includes/admin.php on line 212
|
||||
|
||||
= 3.1.0 =
|
||||
|
||||
**Release Date: January 25, 2023**
|
||||
|
||||
* Feature: Added the `CF7_get_attachment` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-media-attachment/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added the `CF7_guid` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-guid/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme).
|
||||
* Feature: Added the dynamic placeholder option to the dynamic form tags that allows you to specify dynamic or static placeholder content while also setting dynamic values. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-attribute-placeholder/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added a "required" dynamic hidden tag (e.g., `[dynamichidden* ...]`). It is identical to the original dynamic hidden tag (as in the field is not actually validated as required because it is hidden); it just doesn't break your website if you use it. This feature was requested by a user.
|
||||
* Feature: Added the `obfuscate` attribute to all included shortcodes
|
||||
|
||||
= 3.0.0 =
|
||||
|
||||
**Release Date: January 17, 2023**
|
||||
|
||||
* Major: Plugin was adopted by AuRise Creative
|
||||
* Major: All functions use the `wpcf7dtx_` prefix
|
||||
* Feature: Added a `post_id` key for the `CF7_get_post_var` shortcode so you can specify a different post
|
||||
* Feature: Updated the `CF7_get_current_user` shortcode to be able to pull data from user metadata too
|
||||
* Feature: Added the "obfuscate" option to `CF7_get_custom_field` shortcode
|
||||
* Feature: Added the "placeholder" checkbox option to the `dynamictext` tag
|
||||
* Fix: Added additional validation for post ID input
|
||||
* Fix: Added additional validation for the `key` attribute in the `CF7_GET` and `CF7_POST` shortcodes
|
||||
* Fix: Shortcode keys are normalized into lowercase before processing
|
||||
* Security: Sanitizing URLs for the `CF7_URL` and `CF7_referrer` shortcode outputs
|
||||
* Feature/Security: Added a `allowed_protocols` attribute to the `CF7_URL` and `CF7_referrer` shortcodes that defaults to `http,https`
|
||||
|
||||
= 2.0.3 =
|
||||
|
||||
* Security: [Fix Reflected XSS](https://web.archive.org/web/20230121180428/https://sevenspark.com/docs/cf7-dtx-security-2019-07-24)
|
||||
|
||||
= 2.0.2.1 =
|
||||
|
||||
* Update changelog properly for 2.0.2 changes:
|
||||
|
||||
= 2.0.2 =
|
||||
|
||||
* Update deprecated `get_currentuserinfo()` function to `wp_get_current_user()`
|
||||
* Update deprecated functions from `WPCF7_add_shortcode` to `WPCF7_add_formtag` and class from `WPCF7_Shortcode` to `WPCF7_FormTag` to comply with CF7 4.6 changes
|
||||
|
||||
= 2.0.1 =
|
||||
|
||||
* Hook change to guarantee the plugin only runs when Contact Form 7 is present in the admin (avoids errors if Contact Form 7 is disabled, or if there is a plugin sequencing issue)
|
||||
|
||||
= 2.0 =
|
||||
|
||||
* Complete rewrite for Compatibility with Contact Form 7 v4
|
||||
|
||||
= 1.2 =
|
||||
|
||||
* Compatibility update for Contact Form 7 v3.9
|
||||
|
||||
= 1.1.0.2 =
|
||||
|
||||
* Updated to work with Contact Form 7 v3.7.x
|
||||
|
||||
= 1.1.0.1 =
|
||||
|
||||
* Removed undefined variable warning
|
||||
|
||||
= 1.1 =
|
||||
|
||||
* Updated for compatibility with Contact Form 7 v3.6
|
||||
* Added Referrer shortcode
|
||||
|
||||
= 1.0.4.2 =
|
||||
|
||||
* Fixed a bug that created repeating square brackets around dynamic text values in cases where the form doesn't validate and JavaScript is deactivated.
|
||||
|
||||
= 1.0.4.1 =
|
||||
|
||||
* Removed trailing whitespace to fix "Headers already sent" errors
|
||||
|
||||
= 1.0.4 =
|
||||
|
||||
* Added Current User Info shortcode
|
||||
* Added Post Custom Field shortcode (with obfuscation support)
|
||||
* Added Hidden Field capability
|
||||
|
||||
= 1.0.3 =
|
||||
|
||||
* Added $_POST shortcode
|
||||
* Added current post/page variable shortcode
|
||||
* Added current URL shortcode
|
||||
|
||||
= 1.0.2 =
|
||||
|
||||
* Fixed administrative control panel dependency issue
|
||||
|
||||
= 1.0.1 =
|
||||
|
||||
* Fixed dependency issue.
|
||||
== Changelog ==
|
||||
|
||||
= 4.2.3 =
|
||||
|
||||
* Fix: Resolved a bug where the `dynamic_select` displayed with a default size of 40 instead of 1.
|
||||
|
||||
= 4.2.2 =
|
||||
|
||||
* Feature: Cache compatibility JavaScript triggers the custom `dtx_init` event on enabled input fields, [see support thread](https://wordpress.org/support/topic/dynamic_text-cf7_url-dont-fire-onchange-event/).
|
||||
|
||||
= 4.2.1 =
|
||||
|
||||
* Feature: Allows text-based fields to use `autocapitalize` attribute
|
||||
* Feature: Allows text-based fields to use `autofocus` attribute
|
||||
* Feature: Allows text-based fields to use `list` attribute
|
||||
* Feature: Allows text-based fields to use `pattern` attribute
|
||||
* Feature: Allows textareas to use `wrap` attribute
|
||||
* Fix: Resolved the bug that prevented the `dynamic_date` shortcode from using `min`, `max`, and `step` attributes, [see support thread](https://wordpress.org/support/topic/dynamic_date-min-max-step-options-ignored/).
|
||||
* Fix: Added minimum version check for Contact Form 7, [see support thread](https://wordpress.org/support/topic/str_contains-is-php-8-0-only-broken-compatibility/).
|
||||
* Fix: Resolved an issue that used a function introduced in PHP 8 while plugin compatibility setting is currently still set to 7.4+, [see support thread](https://wordpress.org/support/topic/str_contains-is-php-8-0-only-broken-compatibility/).
|
||||
|
||||
= 4.2.0 =
|
||||
|
||||
* Security Update: ** Please be sure to review this doc, as you may need to adjust the settings: https://sevenspark.com/docs/contact-form-7-dynamic-text-extension/allow-data-access **
|
||||
* Feature: Added Settings Screen with Allow Lists
|
||||
* Feature: Added Form Scanner
|
||||
* Feature: Added Allow List key validation in CF7 Form Validator
|
||||
|
||||
= 4.1.0 =
|
||||
|
||||
* Feature: Looks for a `dtx.php` file in the `wp_content` directory to maybe load custom shortcodes, [see support thread](https://wordpress.org/support/topic/how-to-avoid-custom-shortcodes-being-overwritten-on-updates/)
|
||||
* Feature: Looks for a `dtx.php` file in the current active theme's directory to maybe load custom shortcodes, [see support thread](https://wordpress.org/support/topic/how-to-avoid-custom-shortcodes-being-overwritten-on-updates/)
|
||||
* Feature: Looks for a `dtx.php` file in the current active theme's parent directory to maybe load custom shortcodes, [see support thread](https://wordpress.org/support/topic/how-to-avoid-custom-shortcodes-being-overwritten-on-updates/)
|
||||
* Fix: addressed user reported bug, [see support thread](https://wordpress.org/support/topic/fatal-error-v4-0-3/)
|
||||
|
||||
= 4.0.3 =
|
||||
|
||||
* Feature: Added `exclusive` option to checkbox tag generator
|
||||
* Fix: addressed bug that put all dynamic checkbox/radio options into one
|
||||
* Fix: addressed bug in frontend validator for multiple selected values
|
||||
|
||||
= 4.0.2 =
|
||||
|
||||
* Fix: addressed bug that put all dynamic select options into one, [see support thread](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/)
|
||||
* Update: sanitizing and escaping filters now accept `none` as value for `$type` to bypass. Use with caution.
|
||||
|
||||
= 4.0.1 =
|
||||
|
||||
* Fix: addressed bug that prevented translation for cache compatibility description
|
||||
|
||||
= 4.0.0 =
|
||||
|
||||
* Major: modified function names
|
||||
* Major: deprecated `dynamictext` and `dynamichidden` form tags in favor of `dynamic_text` and `dynamic_hidden`. For more information, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_email` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-email/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_url` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-url/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_tel` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-tel/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_number` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-number/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_range` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-range/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_textarea` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-textarea/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_select` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-select/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_radio` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-radio/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_date` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-date/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dynamic_submit` form tag. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-submit/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dtx_hide_blank` form tag attribute for `dynamic_select`. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-select/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: introduced `dtx_disable_blank` form tag attribute for `dynamic_select`. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-select/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: added mail validation for `dynamic_email` and `dynamic_hidden` for backend configuration. For more information, see the [FAQ](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/frequently-asked-questions/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: added the Akismet feature to DTX text, email, and URL form tags.
|
||||
* Update: adjusted how queued values were sent for cache compatibility mode to allow for multiline values in textareas
|
||||
* Removed unused utility functions
|
||||
|
||||
= 3.5.4 =
|
||||
|
||||
* Fix: Updated JavaScript to prevent cacheable fields from making unnecessary AJAX requests
|
||||
|
||||
= 3.5.3 =
|
||||
|
||||
* Update: removed the use of sessions, [see support thread](https://wordpress.org/support/topic/add-option-to-disable-session-data/)
|
||||
|
||||
= 3.5.2 =
|
||||
|
||||
* Fix: Updated the `CF7_URL` shortcode to only use `network_home_url()` for multisite installs that do not use subdomains, and use `home_url()` for all others to [maybe address this support thread](https://wordpress.org/support/topic/cf7_url-return-only-domain-and-not-subdomain/)
|
||||
* Fix: Removed a lingering debug call
|
||||
|
||||
= 3.5.1 =
|
||||
|
||||
* Fix: fixed bug so tag generator for dynamic fields work on "Add New Contact Form" page of Contact Form 7
|
||||
* Updated: Updated text in tag generator for cache compatible checkbox and added link to documentation
|
||||
|
||||
= 3.5.0 =
|
||||
|
||||
* Feature: Added the `dtx_pageload` form tag attribute for cache compatibility. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tag-attribute-after-page-load/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Fix: Updated to be compatible with WordPress version 6.3
|
||||
* Fix: Addressed a bug where `scheme` in `CF7_URL part='scheme'` was incorrectly sanitizing as URL instead of text
|
||||
* Fix: Fixed `wp_kses()` in tag generator that stripped out link opening in new tab
|
||||
* Update: `CF7_get_current_var` utilizes PHP session variables where appropriate
|
||||
* Update: All JavaScript assets will load with the `defer` strategy in the footer in [WordPress 6.3](https://make.wordpress.org/core/2023/07/14/registering-scripts-with-async-and-defer-attributes-in-wordpress-6-3/)
|
||||
|
||||
= 3.4.0 =
|
||||
|
||||
* Feature: Feature: Added the `CF7_get_current_var` shortcode, [see support thread for user request](https://wordpress.org/support/topic/wrong-page-title-7/). For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-current-variables/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Fix: Updated the `CF7_URL` shortcode to no longer check for ports since that's handled in `network_home_url()` function, [see support thread](https://wordpress.org/support/topic/version-3-3-0-breaking/)
|
||||
|
||||
= 3.3.0 =
|
||||
|
||||
* Feature: Added the `CF7_get_cookie` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-cookie/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added the `CF7_get_taxonomy` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-taxonomy/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added the `CF7_get_theme_option` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-theme-option/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added `wpcf7dtx_sanitize` filter that sanitizes attribute values in built-in shortcodes
|
||||
* Feature: Added `wpcf7dtx_escape` filter that escapes values in built-in shortcodes
|
||||
* Feature: Added `wpcf7dtx_allow_protocols` filter to customize allowed protocols in escaping URLs in built-in shortcodes
|
||||
* Fix: Updated how plugin gets dynamic value in form tags, now uses `wpcf7dtx_get_dynamic()` function
|
||||
* Fix: Added case-insensitive ID in `CF7_get_post_var`
|
||||
* Fix: Sanitizes post variable keys as keys in `wpcf7dtx_get_post_var()`
|
||||
* Fix: Updated `wpcf7dtx_get_post_id()` to pull from "the loop" if `$post` is unavailable and now used consistently across built-in shortcodes
|
||||
* Fix: Updated tag markup to be compatible with Contact Form 7 version 5.6 Beta for successful form validation, [see support thread](https://wordpress.org/support/topic/required-field-no-error-is-output-when-validating-when-field-is-empty/)
|
||||
* Fix: Updated the `CF7_URL` shortcode to use `network_home_url()`, [see support thread](https://wordpress.org/support/topic/current-url-not-working/)
|
||||
* Fix: Updated GUID function to return appropriately escaped values
|
||||
* Fix: Updated all existing built-in shortcodes to use the the sanitizing, escaping, and obfuscating shortcodes, [see support thread](https://wordpress.org/support/topic/cant-get-obfuscate-to-work/)
|
||||
* Fix: Marked compatible with WordPress core version 6.2.
|
||||
|
||||
= 3.2 =
|
||||
|
||||
* Feature: Add optional 'part' parameter to CF7_URL shortcode to retrieve Host, Query, or Path from current URL
|
||||
* Updated minimum PHP requirement to 7.4 moving forward
|
||||
* Update branding assets
|
||||
* Update Tested Up To to 6.1.1
|
||||
* Plugin will now be jointly maintained by [SevenSpark](https://sevenspark.com/) and [AuRise Creative](https://aurisecreative.com)
|
||||
|
||||
= 3.1.3 =
|
||||
|
||||
* Fix: Fixed the syntax error that reappeared in 3.1.2.
|
||||
|
||||
= 3.1.2 =
|
||||
|
||||
**Release Date: January 27, 2023**
|
||||
|
||||
* Fix: updated the text domain to match the plugin slug
|
||||
* Fix: updated all of the translated strings to match
|
||||
|
||||
= 3.1.1 =
|
||||
|
||||
**Release Date: January 26, 2023**
|
||||
|
||||
* Fix: Fixed the syntax error: Parse error: syntax error, unexpected `)` in /wp-content/plugins/contact-form-7-dynamic-text extension/includes/admin.php on line 212
|
||||
|
||||
= 3.1.0 =
|
||||
|
||||
**Release Date: January 25, 2023**
|
||||
|
||||
* Feature: Added the `CF7_get_attachment` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-media-attachment/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added the `CF7_guid` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-guid/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme).
|
||||
* Feature: Added the dynamic placeholder option to the dynamic form tags that allows you to specify dynamic or static placeholder content while also setting dynamic values. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-attribute-placeholder/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
|
||||
* Feature: Added a "required" dynamic hidden tag (e.g., `[dynamichidden* ...]`). It is identical to the original dynamic hidden tag (as in the field is not actually validated as required because it is hidden); it just doesn't break your website if you use it. This feature was requested by a user.
|
||||
* Feature: Added the `obfuscate` attribute to all included shortcodes
|
||||
|
||||
= 3.0.0 =
|
||||
|
||||
**Release Date: January 17, 2023**
|
||||
|
||||
* Major: Plugin was adopted by AuRise Creative
|
||||
* Major: All functions use the `wpcf7dtx_` prefix
|
||||
* Feature: Added a `post_id` key for the `CF7_get_post_var` shortcode so you can specify a different post
|
||||
* Feature: Updated the `CF7_get_current_user` shortcode to be able to pull data from user metadata too
|
||||
* Feature: Added the "obfuscate" option to `CF7_get_custom_field` shortcode
|
||||
* Feature: Added the "placeholder" checkbox option to the `dynamictext` tag
|
||||
* Fix: Added additional validation for post ID input
|
||||
* Fix: Added additional validation for the `key` attribute in the `CF7_GET` and `CF7_POST` shortcodes
|
||||
* Fix: Shortcode keys are normalized into lowercase before processing
|
||||
* Security: Sanitizing URLs for the `CF7_URL` and `CF7_referrer` shortcode outputs
|
||||
* Feature/Security: Added a `allowed_protocols` attribute to the `CF7_URL` and `CF7_referrer` shortcodes that defaults to `http,https`
|
||||
|
||||
= 2.0.3 =
|
||||
|
||||
* Security: [Fix Reflected XSS](https://web.archive.org/web/20230121180428/https://sevenspark.com/docs/cf7-dtx-security-2019-07-24)
|
||||
|
||||
= 2.0.2.1 =
|
||||
|
||||
* Update changelog properly for 2.0.2 changes:
|
||||
|
||||
= 2.0.2 =
|
||||
|
||||
* Update deprecated `get_currentuserinfo()` function to `wp_get_current_user()`
|
||||
* Update deprecated functions from `WPCF7_add_shortcode` to `WPCF7_add_formtag` and class from `WPCF7_Shortcode` to `WPCF7_FormTag` to comply with CF7 4.6 changes
|
||||
|
||||
= 2.0.1 =
|
||||
|
||||
* Hook change to guarantee the plugin only runs when Contact Form 7 is present in the admin (avoids errors if Contact Form 7 is disabled, or if there is a plugin sequencing issue)
|
||||
|
||||
= 2.0 =
|
||||
|
||||
* Complete rewrite for Compatibility with Contact Form 7 v4
|
||||
|
||||
= 1.2 =
|
||||
|
||||
* Compatibility update for Contact Form 7 v3.9
|
||||
|
||||
= 1.1.0.2 =
|
||||
|
||||
* Updated to work with Contact Form 7 v3.7.x
|
||||
|
||||
= 1.1.0.1 =
|
||||
|
||||
* Removed undefined variable warning
|
||||
|
||||
= 1.1 =
|
||||
|
||||
* Updated for compatibility with Contact Form 7 v3.6
|
||||
* Added Referrer shortcode
|
||||
|
||||
= 1.0.4.2 =
|
||||
|
||||
* Fixed a bug that created repeating square brackets around dynamic text values in cases where the form doesn't validate and JavaScript is deactivated.
|
||||
|
||||
= 1.0.4.1 =
|
||||
|
||||
* Removed trailing whitespace to fix "Headers already sent" errors
|
||||
|
||||
= 1.0.4 =
|
||||
|
||||
* Added Current User Info shortcode
|
||||
* Added Post Custom Field shortcode (with obfuscation support)
|
||||
* Added Hidden Field capability
|
||||
|
||||
= 1.0.3 =
|
||||
|
||||
* Added $_POST shortcode
|
||||
* Added current post/page variable shortcode
|
||||
* Added current URL shortcode
|
||||
|
||||
= 1.0.2 =
|
||||
|
||||
* Fixed administrative control panel dependency issue
|
||||
|
||||
= 1.0.1 =
|
||||
|
||||
* Fixed dependency issue.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Plugin Name: Contact Form 7 - Dynamic Text Extension
|
||||
* Plugin URI: https://sevenspark.com/goods/contact-form-7-dynamic-text-extension
|
||||
* Description: This plugin extends Contact Form 7 by adding dynamic form fields that accept any shortcode to generate default values and placeholder text. Requires Contact Form 7.
|
||||
* Version: 4.2.0
|
||||
* Version: 4.2.3
|
||||
* Author: SevenSpark, AuRise Creative
|
||||
* Author URI: https://sevenspark.com
|
||||
* License: GPL2
|
||||
@@ -31,16 +31,24 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Define current version
|
||||
define('WPCF7DTX_VERSION', '4.2.0');
|
||||
define('WPCF7DTX_VERSION', '4.2.3'); // Define current version of DTX
|
||||
define('WPCF7DTX_MINVERSION', '5.7'); // The minimum version of CF7 required to use all features
|
||||
defined('WPCF7DTX_DIR') || define('WPCF7DTX_DIR', __DIR__); // Define root directory
|
||||
defined('WPCF7DTX_FILE') || define('WPCF7DTX_FILE', __FILE__); // Define root file
|
||||
|
||||
// Define root directory
|
||||
defined('WPCF7DTX_DIR') || define('WPCF7DTX_DIR', __DIR__);
|
||||
define('WPCF7DTX_DATA_ACCESS_KB_URL', 'https://sevenspark.com/docs/contact-form-7-dynamic-text-extension/allow-data-access');
|
||||
|
||||
// Define root file
|
||||
defined('WPCF7DTX_FILE') || define('WPCF7DTX_FILE', __FILE__);
|
||||
|
||||
define( 'WPCF7DTX_DATA_ACCESS_KB_URL', 'https://sevenspark.com/docs/contact-form-7-dynamic-text-extension/allow-data-access' );
|
||||
/**
|
||||
* Determine Dependencies are Met
|
||||
*
|
||||
* @since 4.2.1
|
||||
*
|
||||
* @return bool True if minimum version of Contact Form 7 is met. False otherwise.
|
||||
*/
|
||||
function wpcf7dtx_dependencies()
|
||||
{
|
||||
return defined('WPCF7_VERSION') && version_compare(constant('WPCF7_VERSION'), WPCF7DTX_MINVERSION, '>=');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Plugin
|
||||
@@ -49,6 +57,18 @@ define( 'WPCF7DTX_DATA_ACCESS_KB_URL', 'https://sevenspark.com/docs/contact-form
|
||||
*/
|
||||
function wpcf7dtx_init()
|
||||
{
|
||||
if (!wpcf7dtx_dependencies()) {
|
||||
add_action('admin_notices', function () {
|
||||
echo (wp_kses_post(sprintf(
|
||||
'<div class="notice notice-error is-dismissible"><p><strong>%s</strong> %s</p></div>',
|
||||
__('Form validation for dynamic fields created with <em>Contact Form 7 - Dynamic Text Extension</em> is not available!', 'contact-form-7-dynamic-text-extension'),
|
||||
sprintf(
|
||||
__('<em>Contact Form 7</em> version %s or higher is required.', 'contact-form-7-dynamic-text-extension'),
|
||||
esc_html(WPCF7DTX_MINVERSION)
|
||||
)
|
||||
)));
|
||||
});
|
||||
}
|
||||
add_action('wpcf7_init', 'wpcf7dtx_add_shortcodes'); // Add custom form tags to CF7
|
||||
}
|
||||
add_action('plugins_loaded', 'wpcf7dtx_init', 20);
|
||||
@@ -67,12 +87,12 @@ function wpcf7dtx_config()
|
||||
$wpcf7_dynamic_fields_config = array(
|
||||
'dynamic_text' => array(
|
||||
'title' => __('dynamic text', 'contact-form-7-dynamic-text-extension'), //title
|
||||
'options' => array('placeholder', 'readonly', 'dtx_pageload'),
|
||||
'options' => array('placeholder', 'readonly'),
|
||||
'description' => __('a single-line plain text', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dynamic_hidden' => array(
|
||||
'title' => __('dynamic hidden', 'contact-form-7-dynamic-text-extension'), //title
|
||||
'options' => array('dtx_pageload'),
|
||||
'options' => array(),
|
||||
'description' => __('a single-line plain text hidden input field', 'contact-form-7-dynamic-text-extension'),
|
||||
'features' => array(
|
||||
'display-hidden' => true // Generates an HTML element that is not visible
|
||||
@@ -80,12 +100,12 @@ function wpcf7dtx_config()
|
||||
),
|
||||
'dynamic_email' => array(
|
||||
'title' => __('dynamic email', 'contact-form-7-dynamic-text-extension'), //title
|
||||
'options' => array('placeholder', 'readonly', 'dtx_pageload'),
|
||||
'options' => array('placeholder', 'readonly'),
|
||||
'description' => __('a single-line email address input field', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dynamic_url' => array(
|
||||
'title' => __('dynamic URL', 'contact-form-7-dynamic-text-extension'), //title
|
||||
'options' => array('placeholder', 'readonly', 'dtx_pageload'),
|
||||
'options' => array('placeholder', 'readonly'),
|
||||
'description' => __('a single-line URL input field', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dynamic_tel' => array(
|
||||
@@ -105,7 +125,7 @@ function wpcf7dtx_config()
|
||||
),
|
||||
'dynamic_textarea' => array(
|
||||
'title' => __('dynamic textarea', 'contact-form-7-dynamic-text-extension'), //title
|
||||
'options' => array('placeholder', 'readonly', 'dtx_pageload'),
|
||||
'options' => array('placeholder', 'readonly'),
|
||||
'description' => __('a multi-line plain text input field', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dynamic_select' => array(
|
||||
@@ -136,12 +156,12 @@ function wpcf7dtx_config()
|
||||
),
|
||||
'dynamic_date' => array(
|
||||
'title' => __('dynamic date', 'contact-form-7-dynamic-text-extension'), //title
|
||||
'options' => array('placeholder', 'readonly', 'min', 'max'),
|
||||
'options' => array('placeholder', 'readonly', 'min', 'max', 'step'),
|
||||
'description' => __('a date input field', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dynamic_submit' => array(
|
||||
'title' => __('dynamic submit', 'contact-form-7-dynamic-text-extension'), //title
|
||||
'options' => array('dtx_pageload'),
|
||||
'options' => array(),
|
||||
'description' => __('a submit button', 'contact-form-7-dynamic-text-extension')
|
||||
)
|
||||
);
|
||||
@@ -249,7 +269,6 @@ function wpcf7dtx_shortcode_handler($tag)
|
||||
$atts['name'] = $tag->name;
|
||||
$atts['id'] = strval($tag->get_id_option());
|
||||
$atts['tabindex'] = $tag->get_option('tabindex', 'signed_int', true);
|
||||
$atts['size'] = $tag->get_size_option('40');
|
||||
$atts['class'] = explode(' ', wpcf7_form_controls_class($atts['type']));
|
||||
$atts['class'][] = 'wpcf7dtx';
|
||||
$atts['class'][] = sanitize_html_class('wpcf7dtx-' . $atts['type']);
|
||||
@@ -260,10 +279,22 @@ function wpcf7dtx_shortcode_handler($tag)
|
||||
} else {
|
||||
$atts['aria-invalid'] = 'false';
|
||||
}
|
||||
|
||||
if ($tag->has_option('readonly')) {
|
||||
$atts['readonly'] = 'readonly';
|
||||
}
|
||||
|
||||
// Dynamically determine disabled attribute, remove if invalid
|
||||
$atts['disabled'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('disabled', '', true)), ENT_QUOTES));
|
||||
if ($atts['disabled'] != 'disabled') {
|
||||
unset($atts['disabled']);
|
||||
}
|
||||
|
||||
// Dynamically determine autofocus attribute, remove if invalid
|
||||
$atts['autofocus'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('autofocus', '', true)), ENT_QUOTES));
|
||||
if ($atts['autofocus'] != 'autofocus') {
|
||||
unset($atts['autofocus']);
|
||||
}
|
||||
|
||||
// Add required attribute to applicable input types
|
||||
if ($tag->is_required() && !in_array($atts['type'], array('hidden', 'quiz'))) {
|
||||
$atts['aria-required'] = 'true';
|
||||
@@ -329,12 +360,22 @@ function wpcf7dtx_shortcode_handler($tag)
|
||||
if ($atts['type'] == 'select' && $tag->has_option('include_blank')) {
|
||||
$atts['placeholder'] = wpcf7dtx_array_has_key('placeholder', $atts, __('—Please choose an option—', 'contact-form-7-dynamic-text-extension'));
|
||||
}
|
||||
if ($atts['type'] == 'select') {
|
||||
$atts['size'] = $tag->get_size_option('1');
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* Configuration for text-based fields
|
||||
*/
|
||||
$atts['size'] = $tag->get_size_option('40');
|
||||
$atts['list'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('list', '', true)), ENT_QUOTES));
|
||||
$atts['autocapitalize'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('autocapitalize', '', true)), ENT_QUOTES));
|
||||
$atts['pattern'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('pattern', '', true)), ENT_QUOTES));
|
||||
$atts['min'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('min', '', true)), ENT_QUOTES));
|
||||
$atts['max'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('max', '', true)), ENT_QUOTES));
|
||||
$atts['step'] = wpcf7dtx_get_dynamic(html_entity_decode(urldecode($tag->get_option('step', '', true)), ENT_QUOTES));
|
||||
|
||||
// Attributes
|
||||
// Min and Max length attributes
|
||||
$atts['maxlength'] = $tag->get_maxlength_option();
|
||||
$atts['minlength'] = $tag->get_minlength_option();
|
||||
if ($atts['maxlength'] && $atts['minlength'] && $atts['maxlength'] < $atts['minlength']) {
|
||||
@@ -350,22 +391,26 @@ function wpcf7dtx_shortcode_handler($tag)
|
||||
}
|
||||
|
||||
switch ($atts['type']) {
|
||||
case 'email':
|
||||
case 'url':
|
||||
case 'tel':
|
||||
case 'number':
|
||||
case 'date':
|
||||
// Client-side validation by type
|
||||
$atts['class'][] = sanitize_html_class('wpcf7-validates-as-' . $atts['type']);
|
||||
break;
|
||||
case 'range':
|
||||
// Client-side validation by type
|
||||
$atts['class'][] = 'wpcf7-validates-as-number';
|
||||
break;
|
||||
case 'date':
|
||||
case 'number':
|
||||
case 'email':
|
||||
case 'url':
|
||||
case 'tel':
|
||||
// Client-side validation by type
|
||||
$atts['class'][] = sanitize_html_class('wpcf7-validates-as-' . $atts['type']);
|
||||
break;
|
||||
case 'textarea':
|
||||
// Attributes unique to textareas
|
||||
$atts['cols'] = $tag->get_cols_option('40');
|
||||
$atts['rows'] = $tag->get_rows_option('10');
|
||||
$atts['wrap'] = $tag->get_option('wrap', '', true);
|
||||
if (!in_array($atts['wrap'], array('hard', 'soft'))) {
|
||||
unset($atts['wrap']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
// Include the Settings Page & Update Check
|
||||
include_once( 'admin/settings.php' );
|
||||
include_once( 'admin/update-check.php' );
|
||||
include_once('admin/settings.php');
|
||||
include_once('admin/update-check.php');
|
||||
|
||||
/**
|
||||
* Admin Scripts and Styles
|
||||
|
||||
@@ -1,97 +1,140 @@
|
||||
<?php
|
||||
|
||||
|
||||
add_action( 'plugins_loaded', 'wpcf7dtx_update_check' );
|
||||
function wpcf7dtx_update_check(){
|
||||
if( WPCF7DTX_VERSION !== get_option( 'cf7dtx_version', '' ) ){
|
||||
|
||||
// Update the database version with the current plugin version
|
||||
update_option( 'cf7dtx_version', WPCF7DTX_VERSION );
|
||||
|
||||
// Run the update handler
|
||||
add_action('admin_init', 'wpcf7dtx_update');
|
||||
}
|
||||
}
|
||||
function wpcf7dtx_update(){
|
||||
|
||||
// v4.2.0 will scan for meta and user keys that should be allow-listed and display an admin alert
|
||||
wpcf7dtx_v4_2_0_access_scan_check();
|
||||
|
||||
// Future update processes would go here
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*** 4.2.0 - Security Access ***/
|
||||
function wpcf7dtx_v4_2_0_access_scan_check(){
|
||||
|
||||
$op = 'cf7dtx_v4_2_0_access_scan_check_status';
|
||||
$status = get_option( $op, '' );
|
||||
|
||||
// Status values:
|
||||
// intervention_required - show a notice to the admin
|
||||
// intervention_not_required - we can ignore
|
||||
// intervention_completed - no need to show notice any longer
|
||||
// notice_dismissed - alert was dismissed by user
|
||||
|
||||
// If we've never checked before
|
||||
if( $status === '' ){
|
||||
// Run a scan - 20 by default. If they have more than 20 forms, we'll alert regardless.
|
||||
// For less than 20 forms, we'll only alert if we detect an issue
|
||||
$num_to_scan = 20;
|
||||
$r = wpcf7dtx_scan_forms_for_access_keys( $num_to_scan );
|
||||
$found = count($r['forms']);
|
||||
$scanned = $r['forms_scanned'];
|
||||
|
||||
// If keys were found, or if we scanned the max number (so there are likely more to be scanned)
|
||||
if( $found || $scanned === $num_to_scan ){
|
||||
// We'll show a notice to the user
|
||||
$status = 'intervention_required';
|
||||
}
|
||||
else{
|
||||
// No keys need to be allow-listed, no need to show the user a list
|
||||
$status = 'intervention_not_required';
|
||||
}
|
||||
wpcf7dtx_set_update_access_scan_check_status( $status );
|
||||
}
|
||||
}
|
||||
|
||||
add_action('admin_notices', 'wpcf7dtx_access_keys_notice');
|
||||
/**
|
||||
* Display an admin notice if there are unresolved issues with accessing disallowed keys via DTX shortcodes
|
||||
*/
|
||||
function wpcf7dtx_access_keys_notice(){
|
||||
|
||||
// Don't show this notice on the Scan Results screen to avoid confusion
|
||||
if( isset($_GET['page']) && $_GET['page'] === 'cf7dtx_settings' && ( isset( $_GET['scan-meta-keys']) || isset($_GET['dismiss-access-keys-notice']))) return;
|
||||
|
||||
// If this user is not an administrator, don't do anything. Only admins should see this.
|
||||
$user = wp_get_current_user();
|
||||
if ( !in_array( 'administrator', (array) $user->roles ) ) return;
|
||||
|
||||
// If the status doesn't require intervention, don't do anything
|
||||
$status = get_option( 'cf7dtx_v4_2_0_access_scan_check_status', '' );
|
||||
if( $status !== 'intervention_required' ){
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="notice notice-error">
|
||||
<p>
|
||||
<?php _e('CF7 DTX: Shortcode data access requires allow-listing.', 'contact-form-7-dynamic-text-extension'); ?>
|
||||
<a href="<?php echo wpcf7dtx_get_admin_settings_screen_url(); ?>"><?php _e('Edit Settings', 'contact-form-7-dynamic-text-extension' ); ?></a>
|
||||
|
|
||||
<a href="<?php echo wpcf7dtx_get_admin_scan_screen_url(); ?>"><?php _e('Scan & Resolve', 'contact-form-7-dynamic-text-extension' ); ?></a>
|
||||
|
|
||||
<a href="<?php echo WPCF7DTX_DATA_ACCESS_KB_URL; ?>" target="_blank"><?php _e('More Information', 'contact-form-7-dynamic-text-extension' ); ?></a>
|
||||
<?php if( isset($_GET['page']) && $_GET['page'] === 'cf7dtx_settings' ): ?>
|
||||
| <a href="<?php echo admin_url('admin.php?page=cf7dtx_settings&dismiss-access-keys-notice'); ?>"><?php _e('Dismiss', 'contact-form-7-dynamic-text-extension' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
function wpcf7dtx_set_update_access_scan_check_status( $status ){
|
||||
update_option( 'cf7dtx_v4_2_0_access_scan_check_status', $status );
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Check for Updates
|
||||
*
|
||||
* Hooked to `plugins_loaded` to compare source code version with database version.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_update_check()
|
||||
{
|
||||
if (WPCF7DTX_VERSION !== get_option('cf7dtx_version', '')) {
|
||||
|
||||
// Update the database version with the current plugin version
|
||||
update_option('cf7dtx_version', WPCF7DTX_VERSION);
|
||||
|
||||
// Run the update handler
|
||||
add_action('admin_init', 'wpcf7dtx_update');
|
||||
}
|
||||
}
|
||||
add_action('plugins_loaded', 'wpcf7dtx_update_check');
|
||||
|
||||
/**
|
||||
* Maybe Update DTX
|
||||
*
|
||||
* Optionally hooked to `admin_init` when source code version is newer than database version.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_update()
|
||||
{
|
||||
|
||||
// v4.2.0 will scan for meta and user keys that should be allow-listed and display an admin alert
|
||||
wpcf7dtx_v4_2_0_access_scan_check();
|
||||
|
||||
// Future update processes would go here
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* DTX Form Scan
|
||||
*
|
||||
* Scan for meta and user keys that should be allowlisted and display an admin alert.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_v4_2_0_access_scan_check()
|
||||
{
|
||||
|
||||
$op = 'cf7dtx_v4_2_0_access_scan_check_status';
|
||||
$status = get_option($op, '');
|
||||
|
||||
// Status values:
|
||||
// intervention_required - show a notice to the admin
|
||||
// intervention_not_required - we can ignore
|
||||
// intervention_completed - no need to show notice any longer
|
||||
// notice_dismissed - alert was dismissed by user
|
||||
|
||||
// If we've never checked before
|
||||
if ($status === '') {
|
||||
// Run a scan - 20 by default. If they have more than 20 forms, we'll alert regardless.
|
||||
// For less than 20 forms, we'll only alert if we detect an issue
|
||||
$num_to_scan = 20;
|
||||
$r = wpcf7dtx_scan_forms_for_access_keys($num_to_scan);
|
||||
$found = count($r['forms']);
|
||||
$scanned = $r['forms_scanned'];
|
||||
|
||||
// If keys were found, or if we scanned the max number (so there are likely more to be scanned)
|
||||
if ($found || $scanned === $num_to_scan) {
|
||||
// We'll show a notice to the user
|
||||
$status = 'intervention_required';
|
||||
} else {
|
||||
// No keys need to be allow-listed, no need to show the user a list
|
||||
$status = 'intervention_not_required';
|
||||
}
|
||||
wpcf7dtx_set_update_access_scan_check_status($status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DTX Admin Notice
|
||||
*
|
||||
* Display an admin notice if there are unresolved issues with accessing disallowed keys via DTX shortcodes
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_access_keys_notice()
|
||||
{
|
||||
|
||||
// Don't show this notice on the Scan Results screen to avoid confusion
|
||||
if (isset($_GET['page']) && $_GET['page'] === 'cf7dtx_settings' && (isset($_GET['scan-meta-keys']) || isset($_GET['dismiss-access-keys-notice']))) return;
|
||||
|
||||
// If this user is not an administrator, don't do anything. Only admins should see this.
|
||||
$user = wp_get_current_user();
|
||||
if (!in_array('administrator', (array) $user->roles)) return;
|
||||
|
||||
// If the status doesn't require intervention, don't do anything
|
||||
$status = get_option('cf7dtx_v4_2_0_access_scan_check_status', '');
|
||||
if ($status !== 'intervention_required') {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="notice notice-error">
|
||||
<p>
|
||||
<?php _e('CF7 DTX: Shortcode data access requires allow-listing.', 'contact-form-7-dynamic-text-extension'); ?>
|
||||
<a href="<?php echo wpcf7dtx_get_admin_settings_screen_url(); ?>"><?php _e('Edit Settings', 'contact-form-7-dynamic-text-extension'); ?></a>
|
||||
|
|
||||
<a href="<?php echo wpcf7dtx_get_admin_scan_screen_url(); ?>"><?php _e('Scan & Resolve', 'contact-form-7-dynamic-text-extension'); ?></a>
|
||||
|
|
||||
<a href="<?php echo WPCF7DTX_DATA_ACCESS_KB_URL; ?>" target="_blank"><?php _e('More Information', 'contact-form-7-dynamic-text-extension'); ?></a>
|
||||
<?php if (isset($_GET['page']) && $_GET['page'] === 'cf7dtx_settings') : ?>
|
||||
| <a href="<?php echo admin_url('admin.php?page=cf7dtx_settings&dismiss-access-keys-notice'); ?>"><?php _e('Dismiss', 'contact-form-7-dynamic-text-extension'); ?></a>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
add_action('admin_notices', 'wpcf7dtx_access_keys_notice');
|
||||
|
||||
/**
|
||||
* Set Scan Status
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param string $status
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_set_update_access_scan_check_status($status)
|
||||
{
|
||||
update_option('cf7dtx_v4_2_0_access_scan_check_status', $status);
|
||||
}
|
||||
|
||||
@@ -216,9 +216,9 @@ function wpcf7dtx_get_custom_field($atts = array())
|
||||
), array_change_key_case((array)$atts, CASE_LOWER)));
|
||||
|
||||
// If this key can't be accessed
|
||||
if( !wpcf7dtx_post_meta_key_access_is_allowed( $key ) ){
|
||||
if (!wpcf7dtx_post_meta_key_access_is_allowed($key)) {
|
||||
// Trigger a warning if a denied key is in use
|
||||
wpcf7dtx_access_denied_alert( $key, 'post_meta' );
|
||||
wpcf7dtx_access_denied_alert($key, 'post_meta');
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -353,9 +353,9 @@ function wpcf7dtx_get_current_user($atts = array())
|
||||
if (is_user_logged_in()) {
|
||||
|
||||
// If this key can't be accessed
|
||||
if( !wpcf7dtx_user_data_access_is_allowed( $key ) ){
|
||||
if (!wpcf7dtx_user_data_access_is_allowed($key)) {
|
||||
// Trigger a warning if a denied key is in use
|
||||
wpcf7dtx_access_denied_alert( $key, 'user_data' );
|
||||
wpcf7dtx_access_denied_alert($key, 'user_data');
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +226,12 @@ function wpcf7dtx_get_dynamic($value, $tag = false, $sanitize = 'auto')
|
||||
/**
|
||||
* Get Allowed HTML for Form Field Properties
|
||||
*
|
||||
* @see https://www.w3schools.com/tags/tag_input.asp
|
||||
* @see https://www.w3schools.com/tags/tag_optgroup.asp
|
||||
* @see https://www.w3schools.com/tags/tag_option.asp
|
||||
* @see https://www.w3schools.com/tags/tag_select.asp
|
||||
* @see https://www.w3schools.com/tags/tag_textarea.asp
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param string $type Optional. The type of input for unique properties. Default is `text`.
|
||||
@@ -256,52 +262,61 @@ function wpcf7dtx_get_allowed_field_properties($type = 'text', $extra = array())
|
||||
'id' => array(),
|
||||
'name' => array(),
|
||||
'value' => array(),
|
||||
'required' => array(),
|
||||
'class' => array(),
|
||||
'disabled' => array(),
|
||||
'readonly' => array(),
|
||||
'tabindex' => array(),
|
||||
'size' => array(),
|
||||
'title' => array(),
|
||||
'autofocus' => array(),
|
||||
// ARIA properties
|
||||
'aria-invalid' => array(),
|
||||
'aria-describedby' => array(),
|
||||
// DTX properties
|
||||
'data-dtx-value' => array(),
|
||||
);
|
||||
if ($type != 'hidden') {
|
||||
$allowed_properties['autofocus'] = array();
|
||||
$allowed_properties['readonly'] = array();
|
||||
$allowed_properties['required'] = array();
|
||||
}
|
||||
if (in_array($type, array('checkbox', 'radio', 'acceptance'))) {
|
||||
// Properties exclusive to checkboxes and radio buttons
|
||||
$allowed_properties['checked'] = array();
|
||||
$allowed_properties['dtx-default'] = array();
|
||||
} elseif (in_array($type, array('number', 'range'))) {
|
||||
// Properties exclusive to number inputs
|
||||
$allowed_properties['step'] = array();
|
||||
} elseif ($type == 'select') {
|
||||
// Properties exclusive to select fields
|
||||
$allowed_properties['size'] = array();
|
||||
$allowed_properties['multiple'] = array();
|
||||
$allowed_properties['dtx-default'] = array();
|
||||
unset($allowed_properties['type'], $allowed_properties['value'], $allowed_properties['placeholder'], $allowed_properties['size']); // Remove invalid select attributes
|
||||
}
|
||||
if (!in_array($type, array('checkbox', 'radio', 'select', 'acceptance'))) {
|
||||
// Allowed properties for all text-based inputs
|
||||
$allowed_properties['placeholder'] = array();
|
||||
unset($allowed_properties['type'], $allowed_properties['value']); // Remove invalid select attributes
|
||||
} else {
|
||||
// Properties exclusive to text-based inputs
|
||||
$allowed_properties['autocomplete'] = array();
|
||||
$allowed_properties['minlength'] = array();
|
||||
$allowed_properties['maxlength'] = array();
|
||||
if (in_array($type, array('number', 'range', 'date', 'datetime-local', 'time'))) {
|
||||
// Additional properties for number and date inputs
|
||||
$allowed_properties['min'] = array();
|
||||
$allowed_properties['max'] = array();
|
||||
$allowed_properties['list'] = array();
|
||||
|
||||
// Placeholder
|
||||
if (in_array($type, array('text', 'search', 'url', 'tel', 'email', 'password', 'number'))) {
|
||||
$allowed_properties['placeholder'] = array();
|
||||
}
|
||||
|
||||
// Textarea
|
||||
if ($type == 'textarea') {
|
||||
// Additional properties exclusive to textarea fields
|
||||
$allowed_properties['cols'] = array();
|
||||
$allowed_properties['rows'] = array();
|
||||
$allowed_properties['minlength'] = array();
|
||||
$allowed_properties['maxlength'] = array();
|
||||
$allowed_properties['wrap'] = array();
|
||||
unset($allowed_properties['type'], $allowed_properties['value']); // Remove invalid textarea attributes
|
||||
} elseif (in_array($type, array('text', 'date', 'url', 'tel', 'email', 'password'))) {
|
||||
// Additional properties exclusive to specific text fields
|
||||
} elseif (in_array($type, array('text', 'search', 'url', 'tel', 'email', 'password'))) {
|
||||
// Additional properties exclusive to these text-based fields
|
||||
$allowed_properties['size'] = array();
|
||||
$allowed_properties['minlength'] = array();
|
||||
$allowed_properties['maxlength'] = array();
|
||||
$allowed_properties['pattern'] = array();
|
||||
} elseif (in_array($type, array('number', 'range', 'date', 'datetime-local', 'time'))) {
|
||||
// Number and date inputs
|
||||
$allowed_properties['min'] = array();
|
||||
$allowed_properties['max'] = array();
|
||||
$allowed_properties['step'] = array();
|
||||
}
|
||||
}
|
||||
if (is_array($extra) && count($extra)) {
|
||||
@@ -554,8 +569,10 @@ function wpcf7dtx_textarea_html($atts)
|
||||
* group's options. It also accepts a string value of HTML already formatted as options or
|
||||
* option groups. It also accepts a string value of a self-closing shortcode that is
|
||||
* evaluated and its output is either options or option groups.
|
||||
* @param bool $hide_blank Optional. If true, the first blank placeholder option will have the `hidden` attribute added to it. Default is false.
|
||||
* @param bool $disable_blank Optional. If true, the first blank placeholder option will have the `disabled` attribute added to it. Default is false.
|
||||
* @param bool $hide_blank Optional. If true, the first blank placeholder option will have the
|
||||
* `hidden` attribute added to it. Default is false.
|
||||
* @param bool $disable_blank Optional. If true, the first blank placeholder option will have
|
||||
* the `disabled` attribute added to it. Default is false.
|
||||
*
|
||||
* @return string HTML output of select field
|
||||
*/
|
||||
@@ -644,9 +661,11 @@ function wpcf7dtx_select_html($atts, $options, $hide_blank = false, $disable_bla
|
||||
*
|
||||
* @param string|int $key The key to search for in the array.
|
||||
* @param array $array The array to search.
|
||||
* @param mixed $default The default value to return if not found or is empty. Default is an empty string.
|
||||
* @param mixed $default The default value to return if not found or is empty. Default is
|
||||
* an empty string.
|
||||
*
|
||||
* @return mixed The value of the key found in the array if it exists or the value of `$default` if not found or is empty.
|
||||
* @return mixed The value of the key found in the array if it exists or the value of
|
||||
* `$default` if not found or is empty.
|
||||
*/
|
||||
function wpcf7dtx_array_has_key($key, $array = array(), $default = '')
|
||||
{
|
||||
@@ -665,163 +684,163 @@ function wpcf7dtx_array_has_key($key, $array = array(), $default = '')
|
||||
|
||||
/**
|
||||
* Check if admin has allowed access to a specific post meta key
|
||||
*
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
*
|
||||
* @param string $meta_key The post meta key to test
|
||||
*
|
||||
*
|
||||
* @return bool True if this key can be accessed, false otherwise
|
||||
*/
|
||||
function wpcf7dtx_post_meta_key_access_is_allowed($meta_key)
|
||||
{
|
||||
|
||||
// Get the DTX Settings
|
||||
$settings = wpcf7dtx_get_settings();get_option('cf7dtx_settings', []);
|
||||
$settings = wpcf7dtx_get_settings();
|
||||
|
||||
// Has access to all metadata been enabled?
|
||||
if( isset($settings['post_meta_allow_all']) && $settings['post_meta_allow_all'] === 'enabled' ){
|
||||
if (isset($settings['post_meta_allow_all']) && $settings['post_meta_allow_all'] === 'enabled') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If not, check the Allow List
|
||||
|
||||
$allowed_keys;
|
||||
$allowed_keys = array();
|
||||
|
||||
// No key list from settings
|
||||
if( !isset($settings['post_meta_allow_keys'] ) || !is_string($settings['post_meta_allow_keys'])){
|
||||
$allowed_keys = [];
|
||||
}
|
||||
// Extract allowed keys from setting text area
|
||||
else{
|
||||
// $allowed_keys = preg_split('/\r\n|\r|\n/', $settings['post_meta_allow_keys']);
|
||||
$allowed_keys = wpcf7dtx_parse_allowed_keys( $settings['post_meta_allow_keys'] );
|
||||
if (isset($settings['post_meta_allow_keys']) && is_string($settings['post_meta_allow_keys'])) {
|
||||
// Extract allowed keys from setting text area
|
||||
$allowed_keys = wpcf7dtx_parse_allowed_keys($settings['post_meta_allow_keys']);
|
||||
}
|
||||
|
||||
// Allow custom filters
|
||||
$allowed_keys = apply_filters( 'wpcf7dtx_post_meta_key_allow_list', $allowed_keys );
|
||||
$allowed_keys = apply_filters('wpcf7dtx_post_meta_key_allow_list', $allowed_keys);
|
||||
|
||||
// Check if the key is in the allow list
|
||||
if( in_array( $meta_key, $allowed_keys ) ){
|
||||
if (in_array($meta_key, $allowed_keys)) {
|
||||
return true; // The key is allowed
|
||||
}
|
||||
|
||||
// Everything is disallowed by default
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if admin has allowed access to a specific user data
|
||||
*
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
*
|
||||
* @param string $key The user data key to test
|
||||
*
|
||||
*
|
||||
* @return bool True if this key can be accessed, false otherwise
|
||||
*/
|
||||
function wpcf7dtx_user_data_access_is_allowed( $key )
|
||||
function wpcf7dtx_user_data_access_is_allowed($key)
|
||||
{
|
||||
|
||||
// Get the DTX Settings
|
||||
$settings = wpcf7dtx_get_settings(); //get_option('cf7dtx_settings', []);
|
||||
|
||||
// Has access to all metadata been enabled?
|
||||
if( isset($settings['user_data_allow_all']) && $settings['user_data_allow_all'] === 'enabled' ){
|
||||
if (isset($settings['user_data_allow_all']) && $settings['user_data_allow_all'] === 'enabled') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If not, check the Allow List
|
||||
|
||||
$allowed_keys;
|
||||
$allowed_keys = array();
|
||||
|
||||
// No key list from settings
|
||||
if( !isset($settings['user_data_allow_keys'] ) || !is_string($settings['user_data_allow_keys'])){
|
||||
$allowed_keys = [];
|
||||
}
|
||||
// Extract allowed keys from setting text area
|
||||
else{
|
||||
// $allowed_keys = preg_split('/\r\n|\r|\n/', $settings['user_data_allow_keys']);
|
||||
if (isset($settings['user_data_allow_keys']) && is_string($settings['user_data_allow_keys'])) {
|
||||
// Extract allowed keys from setting text area
|
||||
$allowed_keys = wpcf7dtx_parse_allowed_keys($settings['user_data_allow_keys']);
|
||||
}
|
||||
|
||||
// Allow custom filters
|
||||
$allowed_keys = apply_filters( 'wpcf7dtx_user_data_key_allow_list', $allowed_keys );
|
||||
$allowed_keys = apply_filters('wpcf7dtx_user_data_key_allow_list', $allowed_keys);
|
||||
|
||||
// Check if the key is in the allow list
|
||||
if( in_array( $key, $allowed_keys ) ){
|
||||
if (in_array($key, $allowed_keys)) {
|
||||
return true; // The key is allowed
|
||||
}
|
||||
|
||||
|
||||
// Everything is disallowed by default
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Take the string saved in the options array from the allow list textarea and parse it into an array by newlines.
|
||||
* Also strip whitespace
|
||||
*
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param string $allowlist The string of allowed keys stored in the DB
|
||||
*
|
||||
*
|
||||
* @return array Array of allowed keys
|
||||
*/
|
||||
function wpcf7dtx_parse_allowed_keys( $allowlist ){
|
||||
function wpcf7dtx_parse_allowed_keys($allowlist)
|
||||
{
|
||||
// Split by newlines
|
||||
$keys = wpcf7dtx_split_newlines( $allowlist );
|
||||
$keys = wpcf7dtx_split_newlines($allowlist);
|
||||
// Trim whitespace
|
||||
$keys = array_map( 'trim' , $keys );
|
||||
$keys = array_map('trim', $keys);
|
||||
return $keys;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Used to parse strings stored in the database that are from text areas with one element per line into an array of strings
|
||||
*
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param string $str The multi-line string to be parsed into an array
|
||||
*
|
||||
*
|
||||
* @return array Array of parsed strings
|
||||
*/
|
||||
function wpcf7dtx_split_newlines( $str ){
|
||||
function wpcf7dtx_split_newlines($str)
|
||||
{
|
||||
return preg_split('/\r\n|\r|\n/', $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the CF7 DTX settings field from the WP options table. Returns an empty array if option has not previously been set
|
||||
*
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @return array The settings array
|
||||
*/
|
||||
function wpcf7dtx_get_settings(){
|
||||
return get_option('cf7dtx_settings', []);
|
||||
function wpcf7dtx_get_settings()
|
||||
{
|
||||
return get_option('cf7dtx_settings', array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the CF7 DTX settings in the WP options table
|
||||
*
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param array $settings The settings array
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
function wpcf7dtx_update_settings($settings){
|
||||
update_option( 'cf7dtx_settings', $settings );
|
||||
function wpcf7dtx_update_settings($settings)
|
||||
{
|
||||
update_option('cf7dtx_settings', $settings);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Outputs a useful PHP Warning message to users on how to allow-list denied meta and user keys
|
||||
*
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param string $key The post meta or user key to which access is currently denied
|
||||
* @param string $type Either 'post_meta' or 'user_data', used to display an appropriate message to the user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_access_denied_alert( $key, $type ){
|
||||
|
||||
function wpcf7dtx_access_denied_alert($key, $type)
|
||||
{
|
||||
// Only check on the front end
|
||||
if( is_admin() || wp_doing_ajax() || wp_is_json_request() ) return;
|
||||
if (is_admin() || wp_doing_ajax() || wp_is_json_request()) return;
|
||||
|
||||
$shortcode = '';
|
||||
$list_name = '';
|
||||
|
||||
switch( $type ){
|
||||
switch ($type) {
|
||||
case 'post_meta':
|
||||
$shortcode = 'CF7_get_custom_field';
|
||||
$list_name = __('Meta Key Allow List', 'contact-form-7-dynamic-text-extension');
|
||||
@@ -830,47 +849,21 @@ function wpcf7dtx_access_denied_alert( $key, $type ){
|
||||
$shortcode = 'CF7_get_current_user';
|
||||
$list_name = __('User Data Key Allow List', 'contact-form-7-dynamic-text-extension');
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
$shortcode = '';
|
||||
$list_name = '';
|
||||
break;
|
||||
}
|
||||
|
||||
$settings_page_url = admin_url('admin.php?page=cf7dtx_settings');
|
||||
|
||||
$msg = sprintf(
|
||||
__('CF7 DTX: Access denied to key: "%1$s" in dynamic contact form shortcode: [%2$s]. Please add this key to the %3$s at %4$s','contact-form-7-dynamic-text-extension'),
|
||||
__('CF7 DTX: Access denied to key: "%1$s" in dynamic contact form shortcode: [%2$s]. Please add this key to the %3$s at %4$s', 'contact-form-7-dynamic-text-extension'),
|
||||
$key,
|
||||
$shortcode,
|
||||
$list_name,
|
||||
$settings_page_url
|
||||
);
|
||||
|
||||
trigger_error( $msg, E_USER_WARNING );
|
||||
trigger_error($msg, E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper function to output array and object data
|
||||
*/
|
||||
/*
|
||||
function dtxpretty ($var, $print=true, $privobj=false) {
|
||||
|
||||
$type = gettype($var);
|
||||
|
||||
if( $privobj && $type === 'object' ){
|
||||
$p = '<pre>'.print_r($var, true).'</pre>';
|
||||
}
|
||||
else {
|
||||
$p = '<pre>'.$type . ' ' . json_encode(
|
||||
$var,
|
||||
JSON_UNESCAPED_SLASHES |
|
||||
JSON_UNESCAPED_UNICODE |
|
||||
JSON_PRETTY_PRINT |
|
||||
JSON_PARTIAL_OUTPUT_ON_ERROR |
|
||||
JSON_INVALID_UTF8_SUBSTITUTE
|
||||
).'</pre>';
|
||||
}
|
||||
if( $print ) {
|
||||
echo $p;
|
||||
}
|
||||
return $p;
|
||||
}
|
||||
*/
|
||||
@@ -1,369 +1,373 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Add Frontend Validation Messages
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param array An associative array of messages
|
||||
*
|
||||
* @return array A modified associative array of messages
|
||||
*/
|
||||
function wpcf7dtx_messages($messages)
|
||||
{
|
||||
return array_merge($messages, array(
|
||||
'dtx_invalid_email' => array(
|
||||
'description' => __('There is a field with an invalid email address', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid email address.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dtx_invalid_tel' => array(
|
||||
'description' => __('There is a field with an invalid phone number', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid phone number.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dtx_invalid_number' => array(
|
||||
'description' => __('There is a field with an invalid number', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid number.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dtx_invalid_date' => array(
|
||||
'description' => __('There is a field with an invalid date', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid date.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
));
|
||||
}
|
||||
add_filter('wpcf7_messages', 'wpcf7dtx_messages');
|
||||
|
||||
/**
|
||||
* Add DTX Error Code to Config Validator
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $error_codes A sequential array of available error codes in Contact Form 7.
|
||||
*
|
||||
* @return array A modified sequential array of available error codes in Contact Form 7.
|
||||
*/
|
||||
function wpcf7dtx_config_validator_available_error_codes($error_codes)
|
||||
{
|
||||
$dtx_errors = array('dtx_disallowed');
|
||||
return array_merge($error_codes, $dtx_errors);
|
||||
}
|
||||
add_filter('wpcf7_config_validator_available_error_codes', 'wpcf7dtx_config_validator_available_error_codes');
|
||||
|
||||
/**
|
||||
* Validate DTX Form Fields
|
||||
*
|
||||
* Frontend validation for DTX form tags
|
||||
*
|
||||
* @param WPCF7_Validation $result the current validation result object
|
||||
* @param WPCF7_FormTag $tag the current form tag being filtered for validation
|
||||
*
|
||||
* @return WPCF7_Validation a possibly modified validation result object
|
||||
*/
|
||||
function wpcf7dtx_validation_filter($result, $tag)
|
||||
{
|
||||
$type = str_replace(array('dynamic_', 'dynamic'), '', $tag->basetype);
|
||||
if (empty($tag->name) || in_array($type, array('hidden', 'submit', 'reset'))) {
|
||||
return $result; // Bail early for tags without names or if a specific type
|
||||
}
|
||||
|
||||
// Get the value
|
||||
$user_value = wpcf7dtx_array_has_key($tag->name, $_POST);
|
||||
if (is_array($user_value)) {
|
||||
$selection_count = count($user_value);
|
||||
if (!wpcf7_form_tag_supports($tag->type, 'selectable-values')) {
|
||||
// Field passed selectable values when it's doesn't support them
|
||||
$result->invalidate($tag, wpcf7_get_message('validation_error'));
|
||||
return $result;
|
||||
} elseif ($selection_count > 1) {
|
||||
if (!wpcf7_form_tag_supports($tag->type, 'multiple-controls-container')) {
|
||||
// Field passed multiple values when it's doesn't support them
|
||||
$result->invalidate($tag, wpcf7_get_message('validation_error'));
|
||||
return $result;
|
||||
}
|
||||
foreach ($user_value as $selection) {
|
||||
// Validate each selected choice
|
||||
$result = wpcf7dtx_validate_value($result, sanitize_textarea_field(strval($selection)), $tag, $type);
|
||||
if (!$result->is_valid($tag->name)) {
|
||||
return $result; // Return early if any are invalid
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
$user_value = sanitize_text_field(strval(implode(' ', $user_value)));
|
||||
} elseif ($type == 'textarea') {
|
||||
$user_value = sanitize_textarea_field(strval($user_value));
|
||||
} else {
|
||||
$user_value = sanitize_text_field(strval($user_value));
|
||||
}
|
||||
// Validate and return
|
||||
return wpcf7dtx_validate_value($result, $user_value, $tag, $type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate Single Value
|
||||
*
|
||||
* @param WPCF7_Validation $result the current validation result object
|
||||
* @param string $value the current value being validated, sanitized
|
||||
* @param WPCF7_FormTag $tag the current form tag being filtered for validation
|
||||
* @param string $type Optional. The type of the current form tag. Default is blank for lookup.
|
||||
*
|
||||
* @return WPCF7_Validation a possibly modified validation result object
|
||||
*/
|
||||
function wpcf7dtx_validate_value($result, $value, $tag, $type = '')
|
||||
{
|
||||
$type = $type ? $type : str_replace(array('dynamic_', 'dynamic'), '', $tag->basetype);
|
||||
|
||||
// Validate required fields for value
|
||||
if ($tag->is_required() && empty($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('invalid_required'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Validate value by type
|
||||
if (!empty($value)) {
|
||||
switch ($type) {
|
||||
case 'email':
|
||||
if (!wpcf7_is_email($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_email'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
case 'tel':
|
||||
if (!wpcf7_is_tel($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_tel'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
case 'number':
|
||||
case 'range':
|
||||
if (!wpcf7_is_number($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_number'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
if (!wpcf7_is_date($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_date'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Finish validating text-based inputs
|
||||
$maxlength = $tag->get_maxlength_option();
|
||||
$minlength = $tag->get_minlength_option();
|
||||
if ($maxlength && $minlength && $maxlength < $minlength) {
|
||||
$maxlength = $minlength = null;
|
||||
}
|
||||
$code_units = wpcf7_count_code_units($value);
|
||||
if (false !== $code_units) {
|
||||
if ($maxlength && $maxlength < $code_units) {
|
||||
$result->invalidate($tag, wpcf7_get_message('invalid_too_long'));
|
||||
return $result;
|
||||
} elseif ($minlength && $code_units < $minlength) {
|
||||
$result->invalidate($tag, wpcf7_get_message('invalid_too_short'));
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Backend Mail Configuration Validation
|
||||
*
|
||||
* Validate dynamic form tags used in mail configuration.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param WPCF7_ConfigValidator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_validate($validator)
|
||||
{
|
||||
// Check for sensitive form tags
|
||||
$manager = WPCF7_FormTagsManager::get_instance();
|
||||
$contact_form = $validator->contact_form();
|
||||
$form = $contact_form->prop('form');
|
||||
if (wpcf7_autop_or_not()) {
|
||||
$form = $manager->replace_with_placeholders($form);
|
||||
$form = wpcf7_autop($form);
|
||||
$form = $manager->restore_from_placeholders($form);
|
||||
}
|
||||
$form = $manager->replace_all($form);
|
||||
$tags = $manager->get_scanned_tags();
|
||||
foreach ($tags as $tag) {
|
||||
/** @var WPCF7_FormTag $tag */
|
||||
|
||||
// Only validate DTX formtags
|
||||
if (in_array($tag->basetype, array_merge(
|
||||
array('dynamictext', 'dynamichidden'), // Deprecated DTX form tags
|
||||
array_keys(wpcf7dtx_config()) // DTX form tags
|
||||
))) {
|
||||
// Check value for sensitive data
|
||||
$default = $tag->get_option('defaultvalue', '', true);
|
||||
if (!$default) {
|
||||
$default = $tag->get_default_option(strval(reset($tag->values)));
|
||||
}
|
||||
if (
|
||||
!empty($value = trim(wpcf7_get_hangover($tag->name, $default))) && // Has value
|
||||
($result = wpcf7dtx_validate_sensitive_value($value))['status'] // Has sensitive data
|
||||
) {
|
||||
$validator->add_error('form.body', 'dtx_disallowed', array(
|
||||
'message' => sprintf(
|
||||
__('[%1$s %2$s]: Access to key "%3$s" in shortcode "%4$s" is disallowed by default. To allow access, add "%3$s" to the %5$s Allow List.', 'contact-form-7-dynamic-text-extension'),
|
||||
esc_html($tag->basetype),
|
||||
esc_html($tag->name),
|
||||
esc_html($result['key']),
|
||||
esc_html($result['shortcode']),
|
||||
esc_html($result['shortcode'] == 'CF7_get_current_user' ? __('User Data Key', 'contact-form-7-dynamic-text-extension') : __('Meta Key', 'contact-form-7-dynamic-text-extension'))
|
||||
),
|
||||
'link' => wpcf7dtx_get_admin_settings_screen_url()
|
||||
));
|
||||
}
|
||||
|
||||
// Check placeholder for sensitive data
|
||||
if (
|
||||
($tag->has_option('placeholder') || $tag->has_option('watermark')) && // Using placeholder
|
||||
!empty($placeholder = trim(html_entity_decode(urldecode($tag->get_option('placeholder', '', true)), ENT_QUOTES))) && // Has value
|
||||
($result = wpcf7dtx_validate_sensitive_value($placeholder))['status'] // Has sensitive data
|
||||
) {
|
||||
$validator->add_error('form.body', 'dtx_disallowed', array(
|
||||
'message' => sprintf(
|
||||
__('[%1$s %2$s]: Access to key "%3$s" in shortcode "%4$s" is disallowed by default. To allow access, add "%3$s" to the %5$s Allow List.', 'contact-form-7-dynamic-text-extension'),
|
||||
esc_html($tag->basetype),
|
||||
esc_html($tag->name),
|
||||
esc_html($result['key']),
|
||||
esc_html($result['shortcode']),
|
||||
esc_html($result['shortcode'] == 'CF7_get_current_user' ? __('User Data Key', 'contact-form-7-dynamic-text-extension') : __('Meta Key', 'contact-form-7-dynamic-text-extension'))
|
||||
),
|
||||
'link' => wpcf7dtx_get_admin_settings_screen_url()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate email address
|
||||
if (!$validator->is_valid()) {
|
||||
$contact_form = null;
|
||||
$form_tags = null;
|
||||
foreach ($validator->collect_error_messages() as $component => $errors) {
|
||||
$components = explode('.', $component);
|
||||
if (count($components) === 2 && strpos($components[0], 'mail') === 0 && in_array($components[1], array('sender', 'recipient', 'additional_headers'))) {
|
||||
foreach ($errors as $error) {
|
||||
// Focus on email fields that flag the invalid mailbox syntax warning, have to test link because code isn't sent and message could be in any language
|
||||
if (strpos(wpcf7dtx_array_has_key('link', $error), 'invalid-mailbox-syntax') !== false) {
|
||||
if (is_null($contact_form)) {
|
||||
$contact_form = $validator->contact_form();
|
||||
}
|
||||
if (is_null($form_tags)) {
|
||||
$form_tags = wpcf7_scan_form_tags();
|
||||
}
|
||||
$raw_value = $contact_form->prop($components[0])[$components[1]];
|
||||
foreach ($form_tags as $tag) {
|
||||
if (!empty($tag->name)) {
|
||||
// Check if this form tag is in the raw value
|
||||
$form_tag = '[' . $tag->name . ']';
|
||||
if (strpos($raw_value, $form_tag) !== false && in_array($tag->basetype, array_keys(wpcf7dtx_config()))) {
|
||||
$validator->remove_error($component, 'invalid_mailbox_syntax'); // Remove error, this is ours to handle now
|
||||
$utm_source = urlencode(home_url());
|
||||
if (!in_array($tag->basetype, array('dynamic_hidden', 'dynamic_email'))) {
|
||||
$validator->add_error($component, 'invalid_mailbox_syntax', array(
|
||||
'message' => __('Only email, dynamic email, hidden, or dynamic hidden form tags can be used for email addresses.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-invalid_mailbox_syntax#valid-form-tags', $utm_source))
|
||||
));
|
||||
} else {
|
||||
$dynamic_value = wpcf7dtx_get_dynamic(false, $tag); // Get the dynamic value of this tag
|
||||
if (empty($dynamic_value) && $tag->basetype == 'dynamic_hidden') {
|
||||
$validator->add_error($component, 'maybe_empty', array(
|
||||
'message' => __('The dynamic hidden form tag must have a default value.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-maybe_empty#maybe-empty', $utm_source))
|
||||
));
|
||||
} elseif (empty($dynamic_value) && !$tag->is_required()) {
|
||||
$validator->add_error($component, 'maybe_empty', array(
|
||||
'message' => __('The dynamic form tag must be required or have a default value.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-maybe_empty#maybe-empty', $utm_source))
|
||||
));
|
||||
} elseif (!empty($dynamic_value)) {
|
||||
if (!wpcf7_is_email($dynamic_value)) {
|
||||
$validator->add_error($component, 'invalid_mailbox_syntax', array(
|
||||
'message' => __('The default dynamic value does not result in a valid email address.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-invalid_mailbox_syntax#invalid-email-address', $utm_source))
|
||||
));
|
||||
} elseif ($component[1] == 'sender' && !wpcf7_is_email_in_site_domain($dynamic_value)) {
|
||||
$validator->add_error($component, 'email_not_in_site_domain', array(
|
||||
'message' => __('The dynamic email address for the sender does not belong to the site domain.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-email_not_in_site_domain#invalid-site-domain', $utm_source))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('wpcf7_config_validator_validate', 'wpcf7dtx_validate');
|
||||
|
||||
/**
|
||||
* Validate Field Value for Sensitive Data
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @see https://developer.wordpress.org/reference/functions/get_bloginfo/#description
|
||||
*
|
||||
* @param string $content The string to validate.
|
||||
*
|
||||
* @return array An associative array with keys `status` (bool), `shortcode` (string), and `key` (string).
|
||||
* The value of `status` is true if the content is a shortcode that is attempting to access sensitive data. False
|
||||
* otherwise. The value of `shortcode` is the the shortcode that is making the attempt if `status` is true. The
|
||||
* value of `key` is the shortcode's `key` attribute of the attempt being made if `status` is true.
|
||||
*/
|
||||
function wpcf7dtx_validate_sensitive_value($content)
|
||||
{
|
||||
$r = array(
|
||||
'status' => false,
|
||||
'shortcode' => '',
|
||||
'key' => ''
|
||||
);
|
||||
|
||||
// Parse the attributes. [0] is the shortcode name. ['key'] is the key attribute
|
||||
$atts = shortcode_parse_atts($content);
|
||||
|
||||
// If we can't extract the atts, or the shortcode or `key` is not an att, don't validate
|
||||
if( !is_array($atts) || !array_key_exists('key', $atts) || !array_key_exists('0', $atts) ) return $r;
|
||||
|
||||
// Find the key and shortcode in question
|
||||
$key = sanitize_text_field($atts['key']);
|
||||
$shortcode = sanitize_text_field($atts['0']);
|
||||
|
||||
// If the shortcode or key value does not exist, don't validate
|
||||
if( empty($shortcode) || empty($key) ) return $r;
|
||||
|
||||
$allowed = true;
|
||||
switch( $shortcode ){
|
||||
case 'CF7_get_custom_field':
|
||||
$allowed = wpcf7dtx_post_meta_key_access_is_allowed( $key );
|
||||
break;
|
||||
case 'CF7_get_current_user':
|
||||
$allowed = wpcf7dtx_user_data_access_is_allowed( $key );
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
|
||||
if( !$allowed ){
|
||||
$r['status'] = true;
|
||||
$r['shortcode'] = $shortcode;
|
||||
$r['key'] = $key;
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Add Frontend Validation Messages
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param array An associative array of messages
|
||||
*
|
||||
* @return array A modified associative array of messages
|
||||
*/
|
||||
function wpcf7dtx_messages($messages)
|
||||
{
|
||||
return array_merge($messages, array(
|
||||
'dtx_invalid_email' => array(
|
||||
'description' => __('There is a field with an invalid email address', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid email address.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dtx_invalid_tel' => array(
|
||||
'description' => __('There is a field with an invalid phone number', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid phone number.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dtx_invalid_number' => array(
|
||||
'description' => __('There is a field with an invalid number', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid number.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
'dtx_invalid_date' => array(
|
||||
'description' => __('There is a field with an invalid date', 'contact-form-7-dynamic-text-extension'),
|
||||
'default' => __('Please enter a valid date.', 'contact-form-7-dynamic-text-extension')
|
||||
),
|
||||
));
|
||||
}
|
||||
add_filter('wpcf7_messages', 'wpcf7dtx_messages');
|
||||
|
||||
/**
|
||||
* Add DTX Error Code to Config Validator
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $error_codes A sequential array of available error codes in Contact Form 7.
|
||||
*
|
||||
* @return array A modified sequential array of available error codes in Contact Form 7.
|
||||
*/
|
||||
function wpcf7dtx_config_validator_available_error_codes($error_codes)
|
||||
{
|
||||
$dtx_errors = array('dtx_disallowed');
|
||||
return array_merge($error_codes, $dtx_errors);
|
||||
}
|
||||
add_filter('wpcf7_config_validator_available_error_codes', 'wpcf7dtx_config_validator_available_error_codes');
|
||||
|
||||
/**
|
||||
* Validate DTX Form Fields
|
||||
*
|
||||
* Frontend validation for DTX form tags
|
||||
*
|
||||
* @param WPCF7_Validation $result the current validation result object
|
||||
* @param WPCF7_FormTag $tag the current form tag being filtered for validation
|
||||
*
|
||||
* @return WPCF7_Validation a possibly modified validation result object
|
||||
*/
|
||||
function wpcf7dtx_validation_filter($result, $tag)
|
||||
{
|
||||
$type = str_replace(array('dynamic_', 'dynamic'), '', $tag->basetype);
|
||||
if (empty($tag->name) || in_array($type, array('hidden', 'submit', 'reset'))) {
|
||||
return $result; // Bail early for tags without names or if a specific type
|
||||
}
|
||||
|
||||
// Get the value
|
||||
$user_value = wpcf7dtx_array_has_key($tag->name, $_POST);
|
||||
if (is_array($user_value)) {
|
||||
$selection_count = count($user_value);
|
||||
if (!wpcf7_form_tag_supports($tag->type, 'selectable-values')) {
|
||||
// Field passed selectable values when it's doesn't support them
|
||||
$result->invalidate($tag, wpcf7_get_message('validation_error'));
|
||||
return $result;
|
||||
} elseif ($selection_count > 1) {
|
||||
if (!wpcf7_form_tag_supports($tag->type, 'multiple-controls-container')) {
|
||||
// Field passed multiple values when it's doesn't support them
|
||||
$result->invalidate($tag, wpcf7_get_message('validation_error'));
|
||||
return $result;
|
||||
}
|
||||
foreach ($user_value as $selection) {
|
||||
// Validate each selected choice
|
||||
$result = wpcf7dtx_validate_value($result, sanitize_textarea_field(strval($selection)), $tag, $type);
|
||||
if (!$result->is_valid($tag->name)) {
|
||||
return $result; // Return early if any are invalid
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
$user_value = sanitize_text_field(strval(implode(' ', $user_value)));
|
||||
} elseif ($type == 'textarea') {
|
||||
$user_value = sanitize_textarea_field(strval($user_value));
|
||||
} else {
|
||||
$user_value = sanitize_text_field(strval($user_value));
|
||||
}
|
||||
// Validate and return
|
||||
return wpcf7dtx_validate_value($result, $user_value, $tag, $type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate Single Value
|
||||
*
|
||||
* @param WPCF7_Validation $result the current validation result object
|
||||
* @param string $value the current value being validated, sanitized
|
||||
* @param WPCF7_FormTag $tag the current form tag being filtered for validation
|
||||
* @param string $type Optional. The type of the current form tag. Default is blank for lookup.
|
||||
*
|
||||
* @return WPCF7_Validation a possibly modified validation result object
|
||||
*/
|
||||
function wpcf7dtx_validate_value($result, $value, $tag, $type = '')
|
||||
{
|
||||
$type = $type ? $type : str_replace(array('dynamic_', 'dynamic'), '', $tag->basetype);
|
||||
|
||||
// Validate required fields for value
|
||||
if ($tag->is_required() && empty($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('invalid_required'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Validate value by type
|
||||
if (!empty($value)) {
|
||||
switch ($type) {
|
||||
case 'email':
|
||||
if (!wpcf7_is_email($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_email'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
case 'tel':
|
||||
if (!wpcf7_is_tel($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_tel'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
case 'number':
|
||||
case 'range':
|
||||
if (!wpcf7_is_number($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_number'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
if (!wpcf7_is_date($value)) {
|
||||
$result->invalidate($tag, wpcf7_get_message('dtx_invalid_date'));
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Finish validating text-based inputs
|
||||
$maxlength = $tag->get_maxlength_option();
|
||||
$minlength = $tag->get_minlength_option();
|
||||
if ($maxlength && $minlength && $maxlength < $minlength) {
|
||||
$maxlength = $minlength = null;
|
||||
}
|
||||
$code_units = wpcf7_count_code_units($value);
|
||||
if (false !== $code_units) {
|
||||
if ($maxlength && $maxlength < $code_units) {
|
||||
$result->invalidate($tag, wpcf7_get_message('invalid_too_long'));
|
||||
return $result;
|
||||
} elseif ($minlength && $code_units < $minlength) {
|
||||
$result->invalidate($tag, wpcf7_get_message('invalid_too_short'));
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validator Requires Contact Form 7 Minimum Version
|
||||
*/
|
||||
if (wpcf7dtx_dependencies()) {
|
||||
/**
|
||||
* Backend Mail Configuration Validation
|
||||
*
|
||||
* Validate dynamic form tags used in mail configuration.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param WPCF7_ConfigValidator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpcf7dtx_validate($validator)
|
||||
{
|
||||
// Check for sensitive form tags
|
||||
$manager = WPCF7_FormTagsManager::get_instance();
|
||||
$contact_form = $validator->contact_form();
|
||||
$form = $contact_form->prop('form');
|
||||
if (wpcf7_autop_or_not()) {
|
||||
$form = $manager->replace_with_placeholders($form);
|
||||
$form = wpcf7_autop($form);
|
||||
$form = $manager->restore_from_placeholders($form);
|
||||
}
|
||||
$form = $manager->replace_all($form);
|
||||
$tags = $manager->get_scanned_tags();
|
||||
foreach ($tags as $tag) {
|
||||
/** @var WPCF7_FormTag $tag */
|
||||
|
||||
// Only validate DTX formtags
|
||||
if (in_array($tag->basetype, array_merge(
|
||||
array('dynamictext', 'dynamichidden'), // Deprecated DTX form tags
|
||||
array_keys(wpcf7dtx_config()) // DTX form tags
|
||||
))) {
|
||||
// Check value for sensitive data
|
||||
$default = $tag->get_option('defaultvalue', '', true);
|
||||
if (!$default) {
|
||||
$default = $tag->get_default_option(strval(reset($tag->values)));
|
||||
}
|
||||
if (
|
||||
!empty($value = trim(wpcf7_get_hangover($tag->name, $default))) && // Has value
|
||||
($result = wpcf7dtx_validate_sensitive_value($value))['status'] // Has sensitive data
|
||||
) {
|
||||
$validator->add_error('form.body', 'dtx_disallowed', array(
|
||||
'message' => sprintf(
|
||||
__('[%1$s %2$s]: Access to key "%3$s" in shortcode "%4$s" is disallowed by default. To allow access, add "%3$s" to the %5$s Allow List.', 'contact-form-7-dynamic-text-extension'),
|
||||
esc_html($tag->basetype),
|
||||
esc_html($tag->name),
|
||||
esc_html($result['key']),
|
||||
esc_html($result['shortcode']),
|
||||
esc_html($result['shortcode'] == 'CF7_get_current_user' ? __('User Data Key', 'contact-form-7-dynamic-text-extension') : __('Meta Key', 'contact-form-7-dynamic-text-extension'))
|
||||
),
|
||||
'link' => wpcf7dtx_get_admin_settings_screen_url()
|
||||
));
|
||||
}
|
||||
|
||||
// Check placeholder for sensitive data
|
||||
if (
|
||||
($tag->has_option('placeholder') || $tag->has_option('watermark')) && // Using placeholder
|
||||
!empty($placeholder = trim(html_entity_decode(urldecode($tag->get_option('placeholder', '', true)), ENT_QUOTES))) && // Has value
|
||||
($result = wpcf7dtx_validate_sensitive_value($placeholder))['status'] // Has sensitive data
|
||||
) {
|
||||
$validator->add_error('form.body', 'dtx_disallowed', array(
|
||||
'message' => sprintf(
|
||||
__('[%1$s %2$s]: Access to key "%3$s" in shortcode "%4$s" is disallowed by default. To allow access, add "%3$s" to the %5$s Allow List.', 'contact-form-7-dynamic-text-extension'),
|
||||
esc_html($tag->basetype),
|
||||
esc_html($tag->name),
|
||||
esc_html($result['key']),
|
||||
esc_html($result['shortcode']),
|
||||
esc_html($result['shortcode'] == 'CF7_get_current_user' ? __('User Data Key', 'contact-form-7-dynamic-text-extension') : __('Meta Key', 'contact-form-7-dynamic-text-extension'))
|
||||
),
|
||||
'link' => wpcf7dtx_get_admin_settings_screen_url()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate email address
|
||||
if (!$validator->is_valid()) {
|
||||
$contact_form = null;
|
||||
$form_tags = null;
|
||||
foreach ($validator->collect_error_messages() as $component => $errors) {
|
||||
$components = explode('.', $component);
|
||||
if (count($components) === 2 && strpos($components[0], 'mail') === 0 && in_array($components[1], array('sender', 'recipient', 'additional_headers'))) {
|
||||
foreach ($errors as $error) {
|
||||
// Focus on email fields that flag the invalid mailbox syntax warning, have to test link because code isn't sent and message could be in any language
|
||||
if (strpos(wpcf7dtx_array_has_key('link', $error), 'invalid-mailbox-syntax') !== false) {
|
||||
if (is_null($contact_form)) {
|
||||
$contact_form = $validator->contact_form();
|
||||
}
|
||||
if (is_null($form_tags)) {
|
||||
$form_tags = wpcf7_scan_form_tags();
|
||||
}
|
||||
$raw_value = $contact_form->prop($components[0])[$components[1]];
|
||||
foreach ($form_tags as $tag) {
|
||||
if (!empty($tag->name)) {
|
||||
// Check if this form tag is in the raw value
|
||||
$form_tag = '[' . $tag->name . ']';
|
||||
if (strpos($raw_value, $form_tag) !== false && in_array($tag->basetype, array_keys(wpcf7dtx_config()))) {
|
||||
$validator->remove_error($component, 'invalid_mailbox_syntax'); // Remove error, this is ours to handle now
|
||||
$utm_source = urlencode(home_url());
|
||||
if (!in_array($tag->basetype, array('dynamic_hidden', 'dynamic_email'))) {
|
||||
$validator->add_error($component, 'invalid_mailbox_syntax', array(
|
||||
'message' => __('Only email, dynamic email, hidden, or dynamic hidden form tags can be used for email addresses.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-invalid_mailbox_syntax#valid-form-tags', $utm_source))
|
||||
));
|
||||
} else {
|
||||
$dynamic_value = wpcf7dtx_get_dynamic(false, $tag); // Get the dynamic value of this tag
|
||||
if (empty($dynamic_value) && $tag->basetype == 'dynamic_hidden') {
|
||||
$validator->add_error($component, 'maybe_empty', array(
|
||||
'message' => __('The dynamic hidden form tag must have a default value.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-maybe_empty#maybe-empty', $utm_source))
|
||||
));
|
||||
} elseif (empty($dynamic_value) && !$tag->is_required()) {
|
||||
$validator->add_error($component, 'maybe_empty', array(
|
||||
'message' => __('The dynamic form tag must be required or have a default value.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-maybe_empty#maybe-empty', $utm_source))
|
||||
));
|
||||
} elseif (!empty($dynamic_value)) {
|
||||
if (!wpcf7_is_email($dynamic_value)) {
|
||||
$validator->add_error($component, 'invalid_mailbox_syntax', array(
|
||||
'message' => __('The default dynamic value does not result in a valid email address.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-invalid_mailbox_syntax#invalid-email-address', $utm_source))
|
||||
));
|
||||
} elseif ($component[1] == 'sender' && !wpcf7_is_email_in_site_domain($dynamic_value)) {
|
||||
$validator->add_error($component, 'email_not_in_site_domain', array(
|
||||
'message' => __('The dynamic email address for the sender does not belong to the site domain.', 'contact-form-7-dynamic-text-extension'),
|
||||
'link' => esc_url(sprintf('https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/configuration-errors/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=config-error-email_not_in_site_domain#invalid-site-domain', $utm_source))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('wpcf7_config_validator_validate', 'wpcf7dtx_validate');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate Field Value for Sensitive Data
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @see https://developer.wordpress.org/reference/functions/get_bloginfo/#description
|
||||
*
|
||||
* @param string $content The string to validate.
|
||||
*
|
||||
* @return array An associative array with keys `status` (bool), `shortcode` (string), and `key` (string).
|
||||
* The value of `status` is true if the content is a shortcode that is attempting to access sensitive data. False
|
||||
* otherwise. The value of `shortcode` is the the shortcode that is making the attempt if `status` is true. The
|
||||
* value of `key` is the shortcode's `key` attribute of the attempt being made if `status` is true.
|
||||
*/
|
||||
function wpcf7dtx_validate_sensitive_value($content)
|
||||
{
|
||||
$r = array(
|
||||
'status' => false,
|
||||
'shortcode' => '',
|
||||
'key' => ''
|
||||
);
|
||||
|
||||
// Parse the attributes. [0] is the shortcode name. ['key'] is the key attribute
|
||||
$atts = shortcode_parse_atts($content);
|
||||
|
||||
// If we can't extract the atts, or the shortcode or `key` is not an att, don't validate
|
||||
if (!is_array($atts) || !array_key_exists('key', $atts) || !array_key_exists('0', $atts)) return $r;
|
||||
|
||||
// Find the key and shortcode in question
|
||||
$key = sanitize_text_field($atts['key']);
|
||||
$shortcode = sanitize_text_field($atts['0']);
|
||||
|
||||
// If the shortcode or key value does not exist, don't validate
|
||||
if (empty($shortcode) || empty($key)) return $r;
|
||||
|
||||
$allowed = true;
|
||||
switch ($shortcode) {
|
||||
case 'CF7_get_custom_field':
|
||||
$allowed = wpcf7dtx_post_meta_key_access_is_allowed($key);
|
||||
break;
|
||||
case 'CF7_get_current_user':
|
||||
$allowed = wpcf7dtx_user_data_access_is_allowed($key);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if (!$allowed) {
|
||||
$r['status'] = true;
|
||||
$r['shortcode'] = $shortcode;
|
||||
$r['key'] = $key;
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ Contributors: sevenspark, tessawatkinsllc
|
||||
Donate link: https://just1voice.com/donate/
|
||||
Tags: Contact Form 7, autofill, prepopulate, input, form field, contact form, text, hidden, input, dynamic, GET, POST, title, slug, auto-fill, pre-populate
|
||||
Tested up to: 6.4.2
|
||||
Stable tag: 4.2.0
|
||||
Stable tag: 4.2.3
|
||||
|
||||
This plugin provides additional form tags for the Contact Form 7 plugin. It allows dynamic generation of content for text-based input fields like text, hidden, and email, checkboxes, radio buttons, and drop-down selections using any shortcode.
|
||||
|
||||
@@ -380,16 +380,35 @@ Please check out the [FAQ on our website](https://aurisecreative.com/docs/contac
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 4.2.0 =
|
||||
Extend functionality without losing your work!
|
||||
= 4.2.3 =
|
||||
Resolved a bug where the `dynamic_select` displayed with a default size of 40 instead of 1.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 4.2.3 =
|
||||
|
||||
* Fix: Resolved a bug where the `dynamic_select` displayed with a default size of 40 instead of 1.
|
||||
|
||||
= 4.2.2 =
|
||||
|
||||
* Feature: Cache compatibility JavaScript triggers the custom `dtx_init` event on enabled input fields, [see support thread](https://wordpress.org/support/topic/dynamic_text-cf7_url-dont-fire-onchange-event/).
|
||||
|
||||
= 4.2.1 =
|
||||
|
||||
* Feature: Allows text-based fields to use `autocapitalize` attribute
|
||||
* Feature: Allows text-based fields to use `autofocus` attribute
|
||||
* Feature: Allows text-based fields to use `list` attribute
|
||||
* Feature: Allows text-based fields to use `pattern` attribute
|
||||
* Feature: Allows textareas to use `wrap` attribute
|
||||
* Fix: Resolved the bug that prevented the `dynamic_date` shortcode from using `min`, `max`, and `step` attributes, [see support thread](https://wordpress.org/support/topic/dynamic_date-min-max-step-options-ignored/).
|
||||
* Fix: Added minimum version check for Contact Form 7, [see support thread](https://wordpress.org/support/topic/str_contains-is-php-8-0-only-broken-compatibility/).
|
||||
* Fix: Resolved an issue that used a function introduced in PHP 8 while plugin compatibility setting is currently still set to 7.4+, [see support thread](https://wordpress.org/support/topic/str_contains-is-php-8-0-only-broken-compatibility/).
|
||||
|
||||
= 4.2.0 =
|
||||
|
||||
* Security Update: ** Please be sure to review this doc, as you may need to adjust the settings: https://sevenspark.com/docs/contact-form-7-dynamic-text-extension/allow-data-access **
|
||||
* Feature: Added Settings Screen with Allow Lists
|
||||
* Feature: Added Form Scanner
|
||||
* Feature: Added Form Scanner
|
||||
* Feature: Added Allow List key validation in CF7 Form Validator
|
||||
|
||||
= 4.1.0 =
|
||||
|
||||
@@ -261,7 +261,7 @@ function wpcf7_canonicalize( $text, $args = '' ) {
|
||||
* @return string Sanitized unit-tag.
|
||||
*/
|
||||
function wpcf7_sanitize_unit_tag( $tag ) {
|
||||
$tag = preg_replace( '/[^A-Za-z0-9_-]/', '', $tag );
|
||||
$tag = preg_replace( '/[^A-Za-z0-9_-]/', '', (string) $tag );
|
||||
return $tag;
|
||||
}
|
||||
|
||||
|
||||
@@ -355,6 +355,13 @@ class WPCF7_REST_Controller {
|
||||
$request->get_param( '_wpcf7_unit_tag' )
|
||||
);
|
||||
|
||||
if ( empty( $unit_tag ) ) {
|
||||
return new WP_Error( 'wpcf7_unit_tag_not_found',
|
||||
__( "There is no valid unit tag.", 'contact-form-7' ),
|
||||
array( 'status' => 400 )
|
||||
);
|
||||
}
|
||||
|
||||
$result = $item->submit();
|
||||
|
||||
$response = array_merge( $result, array(
|
||||
|
||||
@@ -219,6 +219,18 @@ function wpcf7_sendinblue_collect_parameters() {
|
||||
}
|
||||
}
|
||||
|
||||
$params = array_map(
|
||||
function ( $param ) {
|
||||
if ( is_array( $param ) ) {
|
||||
$param = wpcf7_array_flatten( $param );
|
||||
$param = reset( $param );
|
||||
}
|
||||
|
||||
return $param;
|
||||
},
|
||||
$params
|
||||
);
|
||||
|
||||
$params = apply_filters(
|
||||
'wpcf7_sendinblue_collect_parameters',
|
||||
$params
|
||||
|
||||
@@ -5,7 +5,7 @@ Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, mult
|
||||
Requires at least: 6.2
|
||||
Requires PHP: 7.4
|
||||
Tested up to: 6.4
|
||||
Stable tag: 5.8.6
|
||||
Stable tag: 5.8.7
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@@ -78,6 +78,10 @@ Do you have questions or issues with Contact Form 7? Use these support channels
|
||||
|
||||
For more information, see [Releases](https://contactform7.com/category/releases/).
|
||||
|
||||
= 5.8.7 =
|
||||
|
||||
[https://contactform7.com/contact-form-7-587/](https://contactform7.com/contact-form-7-587/)
|
||||
|
||||
= 5.8.6 =
|
||||
|
||||
[https://contactform7.com/contact-form-7-586/](https://contactform7.com/contact-form-7-586/)
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
* Author URI: https://ideasilo.wordpress.com/
|
||||
* License: GPL v2 or later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Version: 5.8.6
|
||||
* Version: 5.8.7
|
||||
* Requires at least: 6.2
|
||||
* Requires PHP: 7.4
|
||||
*/
|
||||
|
||||
define( 'WPCF7_VERSION', '5.8.6' );
|
||||
define( 'WPCF7_VERSION', '5.8.7' );
|
||||
|
||||
define( 'WPCF7_REQUIRED_WP_VERSION', '6.2' );
|
||||
|
||||
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://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 <https://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
|
||||
<https://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
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,766 +0,0 @@
|
||||
=== IP Geo Block ===
|
||||
Contributors: tokkonopapa
|
||||
Donate link:
|
||||
Tags: security, firewall, brute force, vulnerability, login, wp-admin, admin, ajax, xmlrpc, comment, pingback, trackback, spam, IP address, geo, geolocation, buddypress, bbPress
|
||||
Requires at least: 3.7
|
||||
Tested up to: 5.0.3
|
||||
Stable tag: 3.0.17.4
|
||||
License: GPLv3
|
||||
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
It blocks spam posts, login attempts and malicious access to the back-end requested from the specific countries, and also prevents zero-day exploit.
|
||||
|
||||
== Description ==
|
||||
|
||||
The more you install themes and plugins, the more likely your sites will be vulnerable, even if you [securely harden your sites](https://codex.wordpress.org/Hardening_WordPress "Hardening WordPress « WordPress Codex").
|
||||
|
||||
While WordPress.org [provides](https://wordpress.org/about/security/ "Security | WordPress.org") [excellent](https://developer.wordpress.org/themes/theme-security/ "Theme Security | Theme Developer Handbook | WordPress Developer Resources") [resources](https://developer.wordpress.org/plugins/security/ "Plugin Security | Plugin Developer Handbook | WordPress Developer Resources"), themes and plugins may often get vulnerable due to developers' [human factors](https://www.google.com/search?q=human+factors+in+security "human factors in security - Google Search") such as lack of security awareness, misuse and disuse of the best practices in those resources.
|
||||
|
||||
This plugin focuses on insights into such developers' human factors instead of detecting the specific attack vectors after they were disclosed. This brings a smart and powerful methods named as "**WP Zero-day Exploit Prevention**" and "**WP Metadata Exploit Protection**".
|
||||
|
||||
Combined with those methods and IP address geolocation, you'll be surprised to find a bunch of malicious or undesirable access blocked in the logs of this plugin after several days of installation.
|
||||
|
||||
= Features =
|
||||
|
||||
* **Privacy by design:**
|
||||
IP address is always encrypted on recording in logs/cache. Moreover, it can be anonymized and restricted on sending to the 3rd parties such as geolocation APIs or whois service.
|
||||
|
||||
* **Immigration control:**
|
||||
Access to the basic and important entrances into back-end such as `wp-comments-post.php`, `xmlrpc.php`, `wp-login.php`, `wp-signup.php`, `wp-admin/admin.php`, `wp-admin/admin-ajax.php`, `wp-admin/admin-post.php` will be validated by means of a country code based on IP address. It allows you to configure either whitelist or blacklist to [specify the countires](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements "ISO 3166-1 alpha-2 - Wikipedia"), [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing "Classless Inter-Domain Routing - Wikipedia") for a range of IP addresses and [AS number](https://en.wikipedia.org/wiki/Autonomous_system_(Internet) "Autonomous system (Internet) - Wikipedia") for a group of IP networks.
|
||||
|
||||
* **Zero-day Exploit Prevention:**
|
||||
Unlike other security firewalls based on attack patterns (vectors), the original feature "**W**ord**P**ress **Z**ero-day **E**xploit **P**revention" (WP-ZEP) is focused on patterns of vulnerability. It is simple but still smart and strong enough to block any malicious accesses to `wp-admin/*.php`, `plugins/*.php` and `themes/*.php` even from the permitted countries. It will protect your site against certain types of attack such as CSRF, LFI, SQLi, XSS and so on, **even if you have some vulnerable plugins and themes in your site**.
|
||||
|
||||
* **Guard against login attempts:**
|
||||
In order to prevent hacking through the login form and XML-RPC by brute-force and the reverse-brute-force attacks, the number of login attempts will be limited per IP address even from the permitted countries.
|
||||
|
||||
* **Minimize server load against brute-force attacks:**
|
||||
You can configure this plugin as a [Must Use Plugins](https://codex.wordpress.org/Must_Use_Plugins "Must Use Plugins « WordPress Codex") so that this plugin can be loaded prior to regular plugins. It can massively [reduce the load on server](https://www.ipgeoblock.com/codex/validation-timing.html "Validation timing | IP Geo Block").
|
||||
|
||||
* **Prevent malicious down/uploading:**
|
||||
A malicious request such as exposing `wp-config.php` or uploading malwares via vulnerable plugins/themes can be blocked.
|
||||
|
||||
* **Block badly-behaved bots and crawlers:**
|
||||
A simple logic may help to reduce the number of rogue bots and crawlers scraping your site.
|
||||
|
||||
* **Support of BuddyPress and bbPress:**
|
||||
You can configure this plugin so that a registered user can login as a membership from anywhere, while a request such as a new user registration, lost password, creating a new topic and subscribing comment can be blocked by country. It is suitable for [BuddyPress](https://wordpress.org/plugins/buddypress/ "BuddyPress — WordPress Plugins") and [bbPress](https://wordpress.org/plugins/bbpress/ "WordPress › bbPress « WordPress Plugins") to help reducing spams.
|
||||
|
||||
* **Referrer suppressor for external links:**
|
||||
When you click an external hyperlink on admin screens, http referrer will be eliminated to hide a footprint of your site.
|
||||
|
||||
* **Multiple source of IP Geolocation databases:**
|
||||
[MaxMind GeoLite2 free databases](https://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+) and [IP2Location LITE databases](https://www.ip2location.com/ "IP Address Geolocation to Identify Website Visitor's Geographical Location") can be installed in this plugin. Also free Geolocation REST APIs and whois information can be available for audit purposes.
|
||||
Father more, [dedicated API class libraries](https://www.ipgeoblock.com/article/api-class-library.html "CloudFlare & CloudFront API class library | IP Geo Block") can be installed for CloudFlare and CloudFront as a reverse proxy service.
|
||||
|
||||
* **Customizing response:**
|
||||
HTTP response code can be selectable as `403 Forbidden` to deny access pages, `404 Not Found` to hide pages or even `200 OK` to redirect to the top page.
|
||||
You can also have a human friendly page (like `404.php`) in your parent/child theme template directory to fit your site design.
|
||||
|
||||
* **Validation logs:**
|
||||
Validation logs for useful information to audit attack patterns can be manageable.
|
||||
|
||||
* **Cooperation with full spec security plugin:**
|
||||
This plugin is lite enough to be able to cooperate with other full spec security plugin such as [Wordfence Security](https://wordpress.org/plugins/wordfence/ "Wordfence Security — WordPress Plugins"). See [this report](https://www.ipgeoblock.com/codex/page-speed-performance.html "Page speed performance | IP Geo Block") about page speed performance.
|
||||
|
||||
* **Extendability:**
|
||||
You can customize the behavior of this plugin via `add_filter()` with [pre-defined filter hook](https://www.ipgeoblock.com/codex/ "Codex | IP Geo Block"). See various use cases in [samples.php](https://github.com/tokkonopapa/WordPress-IP-Geo-Block/blob/master/ip-geo-block/samples.php "WordPress-IP-Geo-Block/samples.php at master - tokkonopapa/WordPress-IP-Geo-Block - GitHub") bundled within this package.
|
||||
You can also get the extension [IP Geo Allow](https://github.com/ddur/WordPress-IP-Geo-Allow "GitHub - ddur/WordPress-IP-Geo-Allow: WordPress Plugin Exension for WordPress-IP-Geo-Block Plugin") by [Dragan](https://github.com/ddur "ddur (Dragan) - GitHub"). It makes admin screens strictly private with more flexible way than specifying IP addresses.
|
||||
|
||||
* **Self blocking prevention and easy rescue:**
|
||||
Website owners do not prefer themselves to be blocked. This plugin prevents such a sad thing unless you force it. And futhermore, if such a situation occurs, you can [rescue yourself](https://www.ipgeoblock.com/codex/what-should-i-do-when-i-m-locked-out.html "What should I do when I'm locked out? | IP Geo Block") easily.
|
||||
|
||||
* **Clean uninstallation:**
|
||||
Nothing is left in your precious mySQL database after uninstallation. So you can feel free to install and activate to make a trial of this plugin's functionality.
|
||||
|
||||
= Attribution =
|
||||
|
||||
This package includes GeoLite2 library distributed by MaxMind, available from [MaxMind](https://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+), and also includes IP2Location open source libraries available from [IP2Location](https://www.ip2location.com "IP Address Geolocation to Identify Website Visitor's Geographical Location").
|
||||
|
||||
Also thanks for providing the following great services and REST APIs for free.
|
||||
|
||||
* [http://ip-api.com/](http://ip-api.com/ "IP-API.com - Free Geolocation API") (IPv4, IPv6 / free for non-commercial use)
|
||||
* [http://geoiplookup.net/](http://geoiplookup.net/ "What Is My IP Address | GeoIP Lookup") (IPv4, IPv6 / free)
|
||||
* [https://ipinfo.io/](https://ipinfo.io/ "IP Address API and Data Solutions") (IPv4, IPv6 / free)
|
||||
* [https://ipapi.com/](https://ipapi.com/ "ipapi - IP Address Lookup and Geolocation API) (IPv4, IPv6 / free, need API key)
|
||||
* [https://ipdata.co/](https://ipdata.co/ "ipdata.co - IP Geolocation and Threat Data API") (IPv4, IPv6 / free, need API key)
|
||||
* [https://ipstack.com/](https://ipstack.com/ "ipstack - Free IP Geolocation API") (IPv4, IPv6 / free for registered user, need API key)
|
||||
* [https://ipinfodb.com/](https://ipinfodb.com/ "Free IP Geolocation Tools and API| IPInfoDB") (IPv4, IPv6 / free for registered user, need API key)
|
||||
|
||||
= Development =
|
||||
|
||||
Development of this plugin is promoted at [WordPress-IP-Geo-Block](https://github.com/tokkonopapa/WordPress-IP-Geo-Block "tokkonopapa/WordPress-IP-Geo-Block - GitHub") and class libraries to handle geo-location database are developed separately as "add-in"s at [WordPress-IP-Geo-API](https://github.com/tokkonopapa/WordPress-IP-Geo-API "tokkonopapa/WordPress-IP-Geo-API - GitHub").
|
||||
|
||||
All contributions will always be welcome. Or visit my [development blog](https://www.ipgeoblock.com/ "IP Geo Block").
|
||||
|
||||
== Installation ==
|
||||
|
||||
= Using The WordPress Dashboard =
|
||||
|
||||
1. Navigate to the 'Add New' in the plugins dashboard
|
||||
2. Search for 'IP Geo Block'
|
||||
3. Click 'Install Now'
|
||||
4. Activate the plugin on the Plugin dashboard
|
||||
5. Stay cool for a while and go to 'Settings' » 'IP Geo Block'
|
||||
6. Try 'Best for Back-end' button for easy setup at the bottom of this plugin's setting page.
|
||||
|
||||
Please refer to [the document](https://www.ipgeoblock.com/codex/ "Codex | IP Geo Block") for your best setup.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Does the site using this plugin comply with GDPR? =
|
||||
|
||||
This plugin is designed based on the principle of "Privacy by design" so that you can compliantly run it to GDPR. As guarding against personal data breach, IP addresses in this plugin are encrypted and also can be anonymized by default. It also provides some functions not only to manually erase them but also to automatically remove them when those are exceeded a certain amount/time.
|
||||
|
||||
However, these are the part of GDPR requirements and do not guarantee that the site is compliant with GDPR. Refer to [3.0.11 release note](https://www.ipgeoblock.com/changelog/release-3.0.11.html) for details.
|
||||
|
||||
= Does this plugin support multisite? =
|
||||
|
||||
Yes. You can synchronize the settings with all the sites on the network when you activate on network and enable "**Network wide settings**" in "**Plugin settings**" section.
|
||||
|
||||
= Does this plugin works well with caching? =
|
||||
|
||||
The short answer is **YES**, especially for the purpose of security e.g. blocking malicious access both on the back-end and on the front-end.
|
||||
|
||||
You can find the long answer and the compatibility list of cache plugins at "[Compatibility with cache plugins](https://www.ipgeoblock.com/codex/living-with-caching-plugin.html 'Compatibility with cache plugins | IP Geo Block')".
|
||||
|
||||
= I still have access from blacklisted country. Does it work correctly? =
|
||||
|
||||
Absolutely, YES.
|
||||
|
||||
Sometimes, a Wordfence Security user would report this type of claim when he/she found some accesses in its Live traffic view. But please don't worry. Before WordPress runs, Wordfence cleverly filters out malicious requests to your site using <a href="https://php.net/manual/en/ini.core.php#ini.auto-prepend-file" title="PHP: Description of core php.ini directives - Manual">auto_prepend_file</a> directive to include PHP based Web Application Firewall. Then this plugin validates the rest of the requests that pass over Wordfence because those were not in WAF rules, especially you enables "**Prevent Zero-day Exploit**".
|
||||
|
||||
It would also possibly be caused by the accuracy of country code in the geolocation databases. Actually, there is a case that a same IP address has different country code.
|
||||
|
||||
For more detail, please refer to "[I still have access from blacklisted country.](https://www.ipgeoblock.com/codex/access-from-blacklisted-country.html 'I still have access from blacklisted country. | IP Geo Block')".
|
||||
|
||||
= How can I test this plugin works? =
|
||||
|
||||
The easiest way is to use [free proxy browser addon](https://www.google.com/search?q=free+proxy+browser+addon "free proxy browser addon - Google Search").
|
||||
|
||||
Another one is to use [http header browser addon](https://www.google.com/search?q=browser+add+on+modify+http+header "browser add on modify http header - Google Search").
|
||||
|
||||
You can add an IP address to the `X-Forwarded-For` header to emulate the access behind the proxy. In this case, you should add `HTTP_X_FORWARDED_FOR` into the "**$_SERVER keys for extra IPs**" on "**Settings**" tab.
|
||||
|
||||
See more details at "[How to test prevention of attacks](https://www.ipgeoblock.com/codex/#how-to-test-prevention-of-attacks 'Codex | IP Geo Block')".
|
||||
|
||||
= I'm locked out! What shall I do? =
|
||||
|
||||
Please find the solution in [Quick recovery from blocking on your login page](https://www.ipgeoblock.com/codex/quick-recovery-from-blockig-on-login-page.html "Quick recovery from blocking on your login page | IP Geo Block") at first.
|
||||
|
||||
You can also find another solution by editing "**Emergent Functionality**" code section near the bottom of `ip-geo-block.php`. This code block can be activated by replacing `/*` (opening multi-line comment) at the top of the line to `//` (single line comment), or `*` at the end of the line to `*/` (closing multi-line comment).
|
||||
|
||||
`/**
|
||||
* Invalidate blocking behavior in case yourself is locked out.
|
||||
*
|
||||
* How to use: Activate the following code and upload this file via FTP.
|
||||
*/
|
||||
/* -- ADD '/' TO THE TOP OR END OF THIS LINE TO ACTIVATE THE FOLLOWINGS -- */
|
||||
function ip_geo_block_emergency( $validate, $settings ) {
|
||||
$validate['result'] = 'passed';
|
||||
return $validate;
|
||||
}
|
||||
add_filter( 'ip-geo-block-login', 'ip_geo_block_emergency', 1, 2 );
|
||||
add_filter( 'ip-geo-block-admin', 'ip_geo_block_emergency', 1, 2 );
|
||||
// */`
|
||||
|
||||
Please not that you have to use an [appropriate editor](https://codex.wordpress.org/Editing_Files#Using_Text_Editors "Editing Files « WordPress Codex").
|
||||
|
||||
After saving and uploading it to `/wp-content/plugins/ip-geo-block/` on your server via FTP, you become to be able to login again as an admin.
|
||||
|
||||
Remember that you should upload the original one after re-configuration to deactivate this feature.
|
||||
|
||||
[This document](https://www.ipgeoblock.com/codex/what-should-i-do-when-i-m-locked-out.html "What should I do when I'm locked out? | IP Geo Block") can also help you.
|
||||
|
||||
= Do I have to turn on all the selection to enhance security? =
|
||||
|
||||
Yes. Roughly speaking, the strategy of this plugin has been constructed as follows:
|
||||
|
||||
- **Block by country**
|
||||
It blocks malicious requests from outside your country.
|
||||
|
||||
- **Prevent Zero-day Exploit**
|
||||
It blocks malicious requests from your country.
|
||||
|
||||
- **Force to load WP core**
|
||||
It blocks the request which has not been covered in the above two.
|
||||
|
||||
- **Bad signatures in query**
|
||||
It blocks the request which has not been covered in the above three.
|
||||
|
||||
Please try "**Best for Back-end**" button at the bottom of this plugin's setting page for easy setup. And also see more details in "[The best practice of target settings](https://www.ipgeoblock.com/codex/the-best-practice-for-target-settings.html 'The best practice of target settings | IP Geo Block')".
|
||||
|
||||
= Does this plugin validate all the requests? =
|
||||
|
||||
Unfortunately, no. This plugin can't handle the requests that are not parsed by WordPress. In other words, a standalone file (PHP, CGI or something excutable) that is unrelated to WordPress can't be validated by this plugin even if it is in the WordPress install directory.
|
||||
|
||||
But there're exceptions: When you enable "**Force to load WP core**" for **Plugins area** or **Themes area**, a standalone PHP file becomes to be able to be blocked. Sometimes this kind of file has some vulnerabilities. This function protects your site against such a case.
|
||||
|
||||
= How to resolve "Sorry, your request cannot be accepted."? =
|
||||
|
||||
If you encounter this message, please refer to [this document](https://www.ipgeoblock.com/codex/you-are-not-allowed-to-access.html "Why “Sorry, your request cannot be accepted” ? | IP Geo Block") to resolve your blocking issue.
|
||||
|
||||
If you can't solve your issue, please let me know about it on the [support forum](https://wordpress.org/support/plugin/ip-geo-block/ "View: Plugin Support « WordPress.org Forums"). Your logs in this plugin and "**Installation information**" at "**Plugin settings**" will be a great help to resolve the issue.
|
||||
|
||||
= How can I fix "Unable to write" error? =
|
||||
|
||||
When you enable "**Force to load WP core**" options, this plugin will try to configure `.htaccess` in your `/wp-content/plugins/` and `/wp-content/themes/` directory in order to protect your site against the malicous attacks to the [OMG plugins and themes](https://www.ipgeoblock.com/article/exposure-of-wp-config-php.html "Prevent exposure of wp-config.php | IP Geo Block").
|
||||
|
||||
But some servers doesn't give read / write permission against `.htaccess` to WordPress. In this case, you can configure `.htaccess` files by your own hand instead of enabling "**Force to load WP core**" options.
|
||||
|
||||
Please refer to "[How can I fix permission troubles?](https://www.ipgeoblock.com/codex/how-can-i-fix-permission-troubles.html 'How can I fix permission troubles? | IP Geo Block')" in order to fix this error.
|
||||
|
||||
== Other Notes ==
|
||||
|
||||
= Known issues =
|
||||
|
||||
* No image is shown after drag & drop a image in grid view at "Media Library". For more details, please refer to [this ticket at Github](https://github.com/tokkonopapa/WordPress-IP-Geo-Block/issues/2 "No image is shown after drag & drop a image in grid view at "Media Library". - Issue #2 - tokkonopapa/WordPress-IP-Geo-Block - GitHub").
|
||||
* From [WordPress 4.5](https://make.wordpress.org/core/2016/03/09/comment-changes-in-wordpress-4-5/ "Comment Changes in WordPress 4.5 – Make WordPress Core"), `rel=nofollow` had no longer be attached to the links in `comment_content`. This change prevents to block "[Server Side Request Forgeries](https://www.owasp.org/index.php/Server_Side_Request_Forgery 'Server Side Request Forgery - OWASP')" (not Cross Site but a malicious internal link in the comment field).
|
||||
* [WordPress.com Mobile App](https://apps.wordpress.com/mobile/ "WordPress.com Apps - Mobile Apps") can't execute image uploading because of its own authentication system via XMLRPC.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. **IP Geo Plugin** - Multisite list on network
|
||||
2. **IP Geo Plugin** - Settings tab
|
||||
3. **IP Geo Plugin** - Validation rules and behavior
|
||||
4. **IP Geo Plugin** - Back-end target settings
|
||||
5. **IP Geo Plugin** - Front-end target settings
|
||||
6. **IP Geo Plugin** - Geolocation API settings
|
||||
7. **IP Geo Plugin** - IP address cache settings
|
||||
8. **IP Geo Plugin** - Statistics tab
|
||||
9. **IP Geo Plugin** - Logs tab
|
||||
10. **IP Geo Plugin** - Search tab
|
||||
11. **IP Geo Plugin** - Attribution tab
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.0.17.4 =
|
||||
* **Fix issue:** Add an option "Metadata Exploit Protection" in "Validation rules and behavior" section and make it disabled by default because it potentially caused "Sorry, your request cannot be accepted".
|
||||
* **Fix issue:** Fix the issue that direct request to PHP files under plugins/themes directory was "404 Not found" when WP-ZEP enabled.
|
||||
* **Fix issue:** Fix the incorrect link to the corresponding option page on error message in multisite environment.
|
||||
* **Improvement:** Update the url to the google map api to prevent 301 redirection.
|
||||
* **Improvement:** Use [RIPE stat Data API](https://stat.ripe.net/docs/data_api "RIPEstat — Internet Measurements and Analysis") to get whois information instead of using YQL (Yahoo! Query Language) which was retired on Jan. 3, 2019.
|
||||
|
||||
= 3.0.17.3 =
|
||||
Sorry for the frequent update.
|
||||
* **Fix issue:** Remove `wp_user_roles` from "Metadata Exploit Protection" which was equipped in 3.0.17 because some plugins/themes would add their own role and capability without admin authority.
|
||||
|
||||
= 3.0.17.2 =
|
||||
* **Fix issue:** Fixed the fatal error under certain condition.
|
||||
|
||||
= 3.0.17.1 =
|
||||
* **Fix issue:** Inadequate verification of IPv4 with some CIDR notation.
|
||||
* **Fix issue:** Insufficient path parsing for document root and content directory when real path and symbolic link were mixtured on virtual host.
|
||||
* **Fix issue:** Unexpected blocking on admin dashboard when home url is different from site url.
|
||||
* **Fix issue:** `wp-signup.php` was not blocked when only "Register" was enabled as "Target actions" at "Login form" in "Back-end target settings" section.
|
||||
* **Improvement:** Improve compatibility with Advanced Access Manager.
|
||||
* **Improvement:** Use comment syntax `@codingStandardsIgnoreLine` for deprecated function on PHP7+ to avoid false positive by some scanning tool like PHP Compatibility Checker.
|
||||
Hava a happy new year!
|
||||
|
||||
= 3.0.17 =
|
||||
* **Fix issue:** Avoid the error of "Can not load Geolocation API libraries" caused by the race condition on upgrading this plugin.
|
||||
* **New feature:** Enhance protecting against certain types of attacks by privilege escalation.
|
||||
* **New feature:** Add a new option of "**Network wide settings**" in "**Plugin settings**" section to synchronize all the settings with the main blog on multisite.
|
||||
* **New feature:** Add "**Preset filters**" using [`ip-geo-block-logs[-preset]`](https://www.ipgeoblock.com/codex/ip-geo-block-logs-preset.html "ip-geo-block-logs[-preset] | IP Geo Block") filter hook to make analyze logs easy on "**Logs**" tab.
|
||||
* **Improvement:** When `pwd` is set at "**$_POST key to record with value**" in "**Privacy and record settings**" section, mask the password in logs unless the login attempt is blocked.
|
||||
* **Improvement:** Flush out the buffer of "**Live update**" on "**Logs**" tab when stop button is activated to avoid data remains.
|
||||
* **Improvement:** Update the geolocation API service "geoip.nekudo.com" to "ipapi.com".
|
||||
* **Improvement:** Update the class for Maxmind GeoLite Legacy databases to prepare against the upcoming expiry of support.
|
||||
* See [3.0.17 release note](https://www.ipgeoblock.com/changelog/release-3.0.17.html) for some details.
|
||||
|
||||
= 3.0.16 =
|
||||
* **Fix issue:** Fix the issue that some functions did not work properly when "Validation timing" was set as `"mu-plugins" (ip-geo-block-mu.php)` under some conditions before WP 4.0.
|
||||
* **New feature:** Add "**Sites list**" page at Network admin page to look through the status of the sites if this plugin is network activated on multisite.
|
||||
* **Improvement:** Support [Swift Performance Lite](https://wordpress.org/plugins/swift-performance-lite/ "Swift Performance Lite | WordPress.org") cache plugin with "Disk Cashe with PHP" caching mode.
|
||||
* **Improvement:** Apply simulation mode to not only the front-end but also to the back-end.
|
||||
* **Improvement:** Optimize SQL issuing to reduce some queries.
|
||||
* See [3.0.16 release note](https://www.ipgeoblock.com/changelog/release-3.0.16.html) for some details.
|
||||
|
||||
= 3.0.15 =
|
||||
* **Fix issue:** Fix the issue that "Can not find Geolocation API libraries" error would always appear when once Geolite2, Maxmind and IP2Location were unselected.
|
||||
* **Fix issue:** Fix the issue that https in ipstack.com is available only for premiums users.
|
||||
* **New feature:** Introduce a new filter hook [`ip-geo-block-logs-preset`](https://www.ipgeoblock.com/codex/ip-geo-block-logs-preset.html "ip-geo-block-logs[-preset] | IP Geo Block") that adds an UI of "Preset filters" at "Search in logs".
|
||||
* **Improvement:** Prevent to make a cached page by WP Fastest Cache on blocking when "Validation timing" is "init" action hook.
|
||||
* **Improvement:** Make the priority of "UA string and qualification" is higher than that of "Block badly-behaved bots and crawlers" on public facing pages.
|
||||
* **Improvement:** Update google charts based on the [release note](https://developers.google.com/chart/interactive/docs/release_notes "Google Charts Release Notes | Charts | Google Developers").
|
||||
* **Improvement:** Always show "Google Maps API key" text box in "Plugin settings" section. If it is saved as empty, Google Maps API will no longer be used and a simple map will appear on "Search" tab.
|
||||
* **Improvement:** Follow the change of RIPE whois format related to AS number.
|
||||
* **Improvement:** Add UI to select the number of entries per page on IP address tables.
|
||||
* **Improvement:** Multiple entries on IP address tables can be selected across the pages for bulk action.
|
||||
* **Improvement:** Multiple Geolocation APIs can be selected on "Search" tab.
|
||||
* **Improvement:** The country code of admin should not be cached if it's `ZZ` during initialization process.
|
||||
|
||||
= 3.0.14 =
|
||||
* **Fix issue:** Fix wrong handling of anonymized IPv6 on clicking a link or applying bulk actions.
|
||||
* **Fix issue:** Fix the issue that added a server's country code which was not in "Whitelist of country code" but its IP address was in "Whitelist of extra IP addresses prior to country code" on activation. ([forum topic](https://wordpress.org/support/topic/possible-bug-disabling-enabling-adds-us-to-whitelist-country-code/ "Topic: Possible bug: disabling/enabling adds “,US” to whitelist country code | WordPress.org"))
|
||||
* **Fix issue:** Fix the issue of "Fatal error: Call to undefined function" which caused 500 Internal error on admin screen under a certain condition.
|
||||
* **Fix issue:** Fix the issue of undefined symbol for openssl in PHP 5.3.5 and under.
|
||||
* **New feature:** Introduce an emergency login link in "Plugins settings" section.
|
||||
* **New feature:** Introduce a new filter hook [`ip-geo-block-dns`](https://www.ipgeoblock.com/codex/ip-geo-block-dns.html "ip-geo-block-dns | IP Geo Block") to specify the primary and secondary domain name resolvers.
|
||||
* **New feature:** Introduce a new filter hook `ip-geo-block-logs`. ([forum topic](https://wordpress.org/support/topic/request-log-filtering/ "Topic: Request: Log filtering | WordPress.org"))
|
||||
* **New feature:** Introduce a new drop-in file `drop-in-admin.php` in Geolocation API library folder.
|
||||
* **Improvement:** Provide help links on "Settings" tab.
|
||||
* **Improvement:** Sort out some related items in the section on "Settings" tab.
|
||||
* **Improvement:** All the http had been replaced to https if possible.
|
||||
|
||||
= 3.0.13 =
|
||||
* **Deprecate:** Remove the hotfix in 3.0.12.1 because of [WordPress 4.9.7 Security and Maintenance Release](https://wordpress.org/news/2018/07/wordpress-4-9-7-security-and-maintenance-release/ "WordPress 4.9.7 Security and Maintenance Release").
|
||||
* **Fix issue:** Local databases settings will be updated when Geolocation API folder can not be found on activation. ([forum topic](https://wordpress.org/support/topic/local-database-settings-wrong-after-server-move/ "Topic: Local Database settings wrong after server move | WordPress.org"))
|
||||
* **Fix issue:** Fix the issue of "ip_geo_block_cache doesn't exist" at activation on clean installation.
|
||||
* **Fix issue:** Fix the issue that "Remove entries by IP address" did not work when "Anonymize IP address" in "Privacy and record settings" section was enabled.
|
||||
* **Fix issue:** Ipdata.co became to require API key for registered user to make up to 1500 requests daily.
|
||||
* **Improvement:** AES256 is applied to encrypt IP address if the algorithm is available. (PHP 5.3.3+)
|
||||
* **Improvement:** Add "Do not send IP address to external APIs" apart from "Anonymize IP address" in "Privacy and record settings" section.
|
||||
|
||||
= 3.0.12.1 =
|
||||
* **Fix issue:** Unexpected blocking cause by an extra slash at the end of `$_SERVER['DOCUMENT_ROOT']` that might be added by server's configuration. ([forum topic](https://wordpress.org/support/topic/wpwebinar/ "Topic: WPWebinar | WordPress.org"))
|
||||
* **Fix issue:** [Human friendly error page](https://www.ipgeoblock.com/codex/customizing-the-response.html#human-friendly-error-page) now works properly. ([forum topic](https://wordpress.org/support/topic/problem-with-permalinks-51/ "Topic: Problem with Permalinks | WordPress.org"))
|
||||
* **Fix issue:** Fix the conflict with WP hide & Security Enhancer. ([forum topic](https://wordpress.org/support/topic/problem-with-permalinks-51/ "Topic: Problem with Permalinks | WordPress.org"))
|
||||
* **Fix issue:** Hotfix [WordPress File Delete to Code Execution](https://blog.ripstech.com/2018/wordpress-file-delete-to-code-execution/ "WARNING: WordPress File Delete to Code Execution") by RIPS Technologies.
|
||||
|
||||
= 3.0.12 =
|
||||
* **Improvement:** Enhance "Privacy and record settings" where "Expiration time [sec] for Logs" can be specified.
|
||||
* **Improvement:** Add "Export cache" in "Statistics in IP address cache" on "Statistics" tab.
|
||||
* **Fix:** Fix some minor bugs.
|
||||
|
||||
= 3.0.11 =
|
||||
* **Improvement:** To comply with GDPR, IP address in logs/cache will be always encrypted. The option of "**Anonymize IP address**" was renamed to "**Privacy friendly**" in "**Privacy and record settings**". It will not only anonymize an IP address but also will restrict on sending to the 3rd parties such as geolocation APIs and whois service.
|
||||
* **Improvement:** Update geolocation APIs and add a new one.
|
||||
* **Improvement:** Change the JavaScript compressor from Google Closure Compiler to UglifyJS 2 to prevent "Uncaught TypeError: Cannot read property 'toLowerCase' of undefined" in a certain environment.
|
||||
* **Fix:** Fix the issue that blocking occurred immediately instead of displaying the login page again when login failed, even the number of times did not exceed the limit.
|
||||
* See [3.0.11 release note](https://www.ipgeoblock.com/changelog/release-3.0.11.html) for some details.
|
||||
|
||||
= 3.0.10.4 =
|
||||
* **Fix:** JavaScript error caused by bad handling form tag without method property. This error was happened with Wordfence Live Traffic.
|
||||
* **Fix:** Inconsistent tags on the settings dashboard.
|
||||
* **Fix:** "Add AS number to Whitelist/Blacklist" at "Bulk action" in "Statistics in cache" section on "Statistics" tab did not work properly because of illegal regular expression.
|
||||
* **Fix:** Add a fallback function to support WP 3.7 and PHP before 5.3.
|
||||
|
||||
= 3.0.10.3 =
|
||||
* **Fix:** Add a fallback process to add some fields into database table especially for MariaDB.
|
||||
* **Fix:** Fatal error that would cause a blank page in PHP 5.3 and under or single site.
|
||||
* **Fix:** Validation timing was not proper when redirection happened in admin context. (#36)
|
||||
|
||||
= 3.0.10.1 =
|
||||
This release is intented to fix the issue reported at forum [here](https://wordpress.org/support/topic/error-on-updating-version-3-0-10/ "Error on updating Version 3.0.10") and [here](https://wordpress.org/support/topic/error-report-on-latest-update/ "error report on latest update").
|
||||
|
||||
If you still find the error "/plugins/ip-geo-block/classes/class-ip-geo-block-logs.php (837) Unknown column 'last' in 'field list'", please deactivate plugin once and activate again. You will see the same error message again, but the things should be fixed.
|
||||
|
||||
= 3.0.10 =
|
||||
* **New feature:** Add "Block badly-behaved bots and crawlers" in "Front-end target settings" section that validates the frequency of request.
|
||||
* **Improvement:** Add a help link to the document for some sections.
|
||||
* **Improvement:** Add descriptions on "Target actions" at "Login form" in "Back-end target settings" section.
|
||||
* **Improvement:** Add new descriptions "passUA" and "blockUA" for result in Logs to identify the reason when "UA string and qualification" is applied.
|
||||
* **Improvement:** AS Number can be handled in "UA string and qualification".
|
||||
* **Improvement:** Make WP cron job for "Auto updating" reliably in multisite environment.
|
||||
* **Improvement:** Better logout compatibility for redirecting to the previous page after login.
|
||||
* **Improvement:** Validate the prefix of IP address CIDR to prevent unexpected fatal error.
|
||||
* **Improvement:** Prevent opening a new window on clicking "Visit Site" in the admin bar menu for multi site by multi domain type.
|
||||
* **Bug fix:** Fix the issue of failing to retrieve client IP address from Chrome Data Saver.
|
||||
* **Bug fix:** Fix the issue of illegal redirection after "Save Changes" on "Settings" => "General Settings" page.
|
||||
* **Bug fix:** Fix the issue of unexpected blocking against the requests to plugins/themes area when "Force to load WP core" is enabled on windows server.
|
||||
* **Bug fix:** Fix the issue that "Search now" was not available when google map failed to load.
|
||||
|
||||
= 3.0.9 =
|
||||
* **New feature:** Add CIDR calculator for IPv4 / IPv6.
|
||||
* **Improvement:** Avoid blocking by wp-zep when IP address is private or loopback network.
|
||||
* **Improvement:** Chnage the priority of internal action hook for better compatibility with other plugins/themes.
|
||||
* **Maintenance:** Change the priority order of local geolocation databases.
|
||||
* **Bug fix:** Fix the issue that the target action for login form on settings tab could not unchecked on saving changes.
|
||||
* **Bug fix:** Fix some other minor bugs.
|
||||
* See [3.0.9 release note](https://www.ipgeoblock.com/changelog/release-3.0.9.html "3.0.9 Release Note | IP Geo Block") for some details.
|
||||
|
||||
= 3.0.8 =
|
||||
* **Improvement:** Use both Maxmind Legacy and GeoLite2 databases parallely.
|
||||
* **Improvement:** Remove self IP address from cache on activation or upgrade to prevent blocking caused by 'ZZ' in cache.
|
||||
|
||||
= 3.0.7.2 =
|
||||
* **Bug fix:** Update Geolocation API library for Maxmind GeoLite2.
|
||||
* **Bug fix:** Fix the issue of potentially fatal error related to "Force to load WP core".
|
||||
|
||||
= 3.0.7.1 =
|
||||
Sorry for frequent update every time, but the following bug should be fixed.
|
||||
* **Bug fix:** Fix the issue that unexpected blocking when GeoLite2 DBs returned "ZZ" (unknown country) as an country code. Actually, GeoLite2 DBs seems not to be equivalent to the legacy ones.
|
||||
|
||||
= 3.0.7 =
|
||||
* **New feature:** Support Maxmind GeoLite2 database which requires PHP 5.4.0+.
|
||||
* **Improvement:** "Live update" can show requests even if those are not specified as a blocking target.
|
||||
* **Bug fix:** Fix the issue that "Force to load WP core" did not work properly under certain condition on Nginx.
|
||||
* **Bug fix:** Fix the compatibility issue with Mail Poet 2/3 related to "Exceptions" for "Admin ajax/post".
|
||||
|
||||
= 3.0.6.1 =
|
||||
Sorry for frequent update but the following bug should be fixed.
|
||||
* **Bug fix:** Fix the bug that "Candidate actions/pages" at "Exceptions" in "Admin ajax/post" were not displayed.
|
||||
|
||||
= 3.0.6 =
|
||||
* **New feature:** Add "Find blocked requests in Logs" button at "Exceptions". This helps to find a solution related to the incompatibility with unwanted blocking.
|
||||
* **Improvement:** Support nginx for "Force to load WP core" at "Plugins area" / "Themes area".
|
||||
* **Improvement:** Improve the extraction ability and verifiability of "Slug in back-end".
|
||||
* **Improvement:** Add a new result "UAlist" that indicate a request is blocked by "UA string and qualification" in "Front-end target settings" section.
|
||||
* **Improvement:** Improve responsiveness of live update control button on windows system.
|
||||
* **Bug fix:** Fix the bug using php short open tag on "Logs" tab.
|
||||
* **Bug fix:** Fix the bug related to absolute path in filesystem on windows system.
|
||||
* **Bug fix:** Fix the issue that "Auto updating (once a month)" could not be disabled.
|
||||
* See [3.0.6 release note](https://www.ipgeoblock.com/changelog/release-3.0.6.html "3.0.6 Release Note | IP Geo Block") for some details.
|
||||
|
||||
= 3.0.5 =
|
||||
* **New feature:** Add "Live update" mode on "Logs" tab.
|
||||
* **Improvement:** List all the IP addresses in cache are now displayed and manageable on "Statistics" tab.
|
||||
* **Improvement:** Add "Either blocked or passed" as a new condition for recording logs. It enables to verify the requests "passed" from the blacklisted countries or the countries not in the whitelist.
|
||||
* **Improvement:** Add two new filter hooks to utilize Google APIs from native domain in China.
|
||||
* See [3.0.5 release note](https://www.ipgeoblock.com/changelog/release-3.0.5.html "3.0.5 Release Note | IP Geo Block") for some details.
|
||||
|
||||
= 3.0.4.6 =
|
||||
* **Bug fix:** Fix the issue that the emergent functionality didn't work when the number of login attempts reached to the limit.
|
||||
* **Bug fix:** Fix the issue that the result would be always `limited` when "Max number of failed login attempts per IP address" is "Disabled".
|
||||
|
||||
= 3.0.4.5 =
|
||||
* **Improvement:** Avoid conflict with [WP Limit Login Attempts](https://wordpress.org/plugins/wp-limit-login-attempts/ "WP Limit Login Attempts — WordPress Plugins"). See some details in ["Sorry, your request cannot be accepted."](https://wordpress.org/support/topic/sorry-your-request-cannot-be-accepted/#post-9544556 "Topic: “Sorry, your request cannot be accepted.” « WordPress.org Forums").
|
||||
|
||||
= 3.0.4.4 =
|
||||
Sorry for the frequent update, but it should be fixed before the next release.
|
||||
* **Bug fix:** Fix the issue that limit of login attempts took precedence over authority of admin.
|
||||
* **Improvement:** Suppress "Unable to read" error message on dashboard in a certain type of server.
|
||||
|
||||
= 3.0.4.3 =
|
||||
* **Bug fix:** Fix a bug of "Missing argument 2 for IP_Geo_Block_Admin_Rewrite::show_message()".
|
||||
|
||||
= 3.0.4.2 =
|
||||
This is a maintenance release addressing various internal improvement toward the next version.
|
||||
* **Bug fix:** Fix a bug that the counter of login attempt counted illegally.
|
||||
* **Bug fix:** Fix a bug that the emergency functionality did not work properly.
|
||||
* **Bug fix:** Fix a bug that an error messages was not displayed when downloading database file.
|
||||
* **Improvement:** Improve the compatibility with a certain type of server using "ftpext" as a method of file system.
|
||||
* **Improvement:** Change rewrite setting from server type base to server function base.
|
||||
* **Improvement:** Strict evaluation of URL on anchor tags for zero-day exploit prevention.
|
||||
* **Improvement:** Avoid blocking on redirection between multisite admin screen.
|
||||
|
||||
= 3.0.4.1 =
|
||||
Thank you all for taking your time again since last update.
|
||||
* **Bug fix:** Fix the error on updating 3.0.4. ([@](https://wordpress.org/support/topic/error-on-updating-3-0-4/ "Topic: Error on updating 3.0.4 « WordPress.org Forums"))
|
||||
* **Bug fix:** Fix the issue of unexpected redirection on anchor tag with empty href in multisite. ([@](https://wordpress.org/support/topic/refresh-the-backend-page/ "Topic: refresh the backend page « WordPress.org Forums"))
|
||||
* **Bug fix:** Fix the issue that "Remove all settings at uninstallation" could not be unchecked. ([@](https://github.com/tokkonopapa/WordPress-IP-Geo-Block/issues/19 "Bugs in v3.0.4 - Issue #19 - tokkonopapa/WordPress-IP-Geo-Block"))
|
||||
|
||||
= 3.0.4 =
|
||||
* **New feature:** Autonomous System Number (ASN) in whitelist and blacklist of extra IP addresses instead of specifying many IP addresses.
|
||||
* **New feature:** Statistics in logs - a new section in Statistics tab.
|
||||
* **Deprecated:** Add a new filter hook `ip-geo-block-upload-forbidden` instead of `ip-geo-block-forbidden-upload`.
|
||||
* **Improvement:** Add a new filter hook `ip-geo-block-upload-capability` to improve compatibility with other plugins that have uploading functionality.
|
||||
* **Improvement:** Add a new option for verifying file upload capability. It can be set apart from verifying file extension and MIME type in "Prevent malicious file uploading".
|
||||
* **Improvement:** Improve ability to extract Ajax actions for "Exception" in "Admin post/ajax".
|
||||
* **Improvement:** Inhibit to embed a special nonce into links when WP-ZEP is disabled at each target. This may improve compatibility with some plugins and themes.
|
||||
* **Bug fix:** Fix the issue of verifying file upload. It could not handle multiple files. ([@](https://wordpress.org/support/topic/incompatible-with-awesome-support-plugin/#post-9403708 "Topic: incompatible with Awesome Support plugin « WordPress.org Forums"))
|
||||
* **Bug fix:** Fix the issue of illegal click event handling on anchor tag without href. ([@](https://wordpress.org/support/topic/pagebuilder-broken-by-ipgeoblock-v3-0-3-4/ "Topic: Pagebuilder broken by IPGeoblock v3.0.3.4 « WordPress.org Forums"))
|
||||
* See [3.0.4 release note](https://www.ipgeoblock.com/changelog/release-3.0.4.html "3.0.4 Release Note | IP Geo Block") for some details.
|
||||
|
||||
= 3.0.3.4 =
|
||||
* **Improvement:** Some minor refactoring for the future release.
|
||||
* **Improvement:** Better throughput against attacks on admin area when `"mu-plugins" (ip-geo-block-mu.php)` is enable.
|
||||
* **Improvement:** Avoid annoying error message related to private IP address.
|
||||
* **Bug fix:** Fix the issue of excessive blocking by bad signature.
|
||||
* **Bug fix:** Fix the issue of illegal usage of `switch_to_blog()`. See [this notes on codex](https://codex.wordpress.org/Function_Reference/restore_current_blog#Notes "Function Reference/restore current blog « WordPress Codex").
|
||||
* **Bug fix:** Fix the issue of illegal JSON format on "Export settings".
|
||||
|
||||
= 3.0.3.3 =
|
||||
Thank you for your patience and understanding in frequent update.
|
||||
|
||||
* **Bug fix:** Fixed the issue of "Notice: Undefined variable" in WP cron. This bug caused frequent refreshing of IP address cache.
|
||||
* **Bug fix:** Fixed the issue of "Fatal Error" in validating user authentication.
|
||||
|
||||
= 3.0.3.2 =
|
||||
* **Bug fix:** Fixed the issue where nonce for WP-ZEP didn't match on front-end.
|
||||
* **Bug fix:** Fixed the issue which deleted all expired cache on multisite.
|
||||
|
||||
= 3.0.3.1 =
|
||||
This is a maintenance release addressing various internal improvement.
|
||||
|
||||
* **Bug fix:** Fixed an issue where deletion of the expired cache was not executed in subordinate blogs when this plugin was activated on the network wide.
|
||||
* **Bug fix:** Some issues caused by IE10/11 on admin pages had been fixed.
|
||||
* **Bug fix:** Turning off check boxes in "**API selection and key settings**" section now becomes to work.
|
||||
* **Improvement:** Better validation performance for logged in user authentication.
|
||||
* **Improvement:** Better rendering by CSS and JS for sections.
|
||||
* **Improvement:** Better handling of click event for embedding a nonce.
|
||||
* **Improvement:** Better handling of cookie for sections.
|
||||
* **Improvement:** Better handling of server and private IP address.
|
||||
* **Improvement:** Better compatibility with file operations using Filesystem API. FTP or SSH based operations are now supported only when [some symbols are defined in `wp-config.php`](https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants "Editing wp-config.php « WordPress Codex").
|
||||
* **Improvement:** Better timing of upgrade check at activation phase instead of `init` action hook.
|
||||
|
||||
= 3.0.3 =
|
||||
* **New feature:** New option "Prevent malicious upload" to restrict MIME types.
|
||||
* **New feature:** New option "Response code" and "Response message" for front-end. This is useful not to violate your affiliate program.
|
||||
* **Improvement:** New Option "DNS reverse lookup" to enable/disable.
|
||||
* **Improvement:** Stop rendering by javascript on setting pages to reduce flash of unstyled content.
|
||||
* **Improvement:** Better compatibility of WP-ZEP with some plugins (Wordfence, Imagify) that request ajax from server side.
|
||||
* **Improvement:** Better handling of server and private IP address.
|
||||
* **Bug fix:** Fix the bug of "Export/Import settings". **Please export json file again if you hold it as backup purpose** because some of settings data might be incompatible.
|
||||
* **Bug fix:** Fix the bug of "Password Reset" caused by miss-spelling "resetpasss".
|
||||
* See some details at [release 3.0.3](https://www.ipgeoblock.com/changelog/release-3.0.3.html "3.0.3 Release Note | IP Geo Block").
|
||||
|
||||
= 3.0.2.2 =
|
||||
* **Improvement:** Change the behavior of "Referrer Suppressor" not to open a new window on public facing pages.
|
||||
* **Improvement:** Improve some of the descriptions of help text.
|
||||
* **Bug fix:** Fix the bug of undefined symbol in admin class related to the Google Map API.
|
||||
* **Bug fix:** Fix the bug of incompatible function arguments when the number of login fails reaches the limit.
|
||||
* **Bug fix:** Fix the issue of not working blocking by country on specific pages correctly as the validation target.
|
||||
|
||||
= 3.0.2.1 =
|
||||
This is a maintenance release addressing some issues.
|
||||
|
||||
* **Update:** Net_DNS2, Net_IPv6, Net_IPv4 to the newest.
|
||||
* **Update:** Geolocation database API for Maxmind and IP2Location to 1.1.8.
|
||||
* **Update:** Bring back the priority of validation for wp-zep and badsig as same as 3.0.2 and before.
|
||||
* **Improvement:** Handle some of loop back and private IP addresses for localhost and host inside load balancer.
|
||||
* **Improvement:** Update instructions when the geolocation API libraries fails to install.
|
||||
* **Bug fix:** Fix the blocking issue of admin ajax/post on front-end.
|
||||
* **Bug fix:** Fix the issue of improper IPv6 handling on setting page.
|
||||
|
||||
= 3.0.2 =
|
||||
* **New feature:** Add "Exceptions" for "Admin ajax/post" to specify the name of action which causes undesired blocking (typically on the public facing pages).
|
||||
* **Improvement:** Add "Disable" to "Max number of failed login attempts per IP address" to avoid conflict with other similar plugin.
|
||||
* **Improvement:** Update geolocation database libraries to 1.1.7 for better compatibility on some platform.
|
||||
* **Trial feature:** Add custom action hook `ip-geo-block-send-response`. This is useful to control firewall via [fail2ban](https://www.fail2ban.org/ "Fail2ban") like [WP fail2ban](https://wordpress.org/plugins/wp-fail2ban/ "WP fail2ban - WordPress Plugins").
|
||||
* See some details at [release 3.0.2](https://www.ipgeoblock.com/changelog/release-3.0.2.html "3.0.2 Release Note | IP Geo Block").
|
||||
|
||||
= 3.0.1.2 =
|
||||
* **Bug fix:** Fix the blocking issue in some environments when upgrading from 2.2.9.1 to 3.0.0.
|
||||
* **Bug fix:** Fix the blocking issue at opening a new window via context menu on dashboard.
|
||||
* **Bug fix:** Fix the potential issue of 500 Internal error in cron job.
|
||||
* **Improvement:** Revive 410 Gone for response code.
|
||||
* **Improvement:** Prevent the issue of resetting matching rule and country code at upgrading.
|
||||
|
||||
= 3.0.1.1 =
|
||||
* **Bug fix:** Fix the issue where **Login form** could not be disabled on **Back-end target settings**.
|
||||
* **Bug fix:** Fix the issue where trackback and pingback could not be blocked since 2.2.4.
|
||||
* **Improved:** Apply the action hook 'pre_trackback_post' that was introduced in WP 4.7.0.
|
||||
* **Improved:** Use 'safe_redirect()' instead of 'redirect()' for secured internal redirection. If you set an external url for **Redirect URL**, please use the filter hook 'allowed_redirect_hosts'.
|
||||
* **Improved:** Better compatibility with the plugin "Anti-Malware Security and Brute-Force Firewall".
|
||||
|
||||
= 3.0.1 =
|
||||
* **Bug fix:** Add lock mechanism for local geolocation DBs to avoid potential fatal error.
|
||||
* **Improvement:** Add self blocking prevention potentially caused by login attempts with the same IP address of logged in user.
|
||||
* **New feature:** Add "**Installation information**" button to make it easy to submit an issue at support forum.
|
||||
|
||||
= 3.0.0 =
|
||||
* **New feature:** Add the function of blocking on front-end.
|
||||
* **New filter hook:** Add `ip-geo-block-public` to extend validation on front-end.
|
||||
* **Improvement:** Avoid conflict with "Open external links in a new window" plugin and some other reason to prevent duplicated window open. For more detail, see [this discussion at support forum](https://wordpress.org/support/topic/ip-geoblock-opens-2-windows-on-link-clicks-when-user-is-logged-in/ "Topic: IP Geoblock opens 2 windows on link clicks when user is logged in « WordPress.org Forums").
|
||||
* **Improvement:** Better compatibility with some plugins, themes and widgets.
|
||||
* **Improvement:** Deferred execution of SQL command to improve the response.
|
||||
* **Improvement:** Make the response compatible with WP original when it is requested by GET method.
|
||||
* See some details at [release 3.0.0](https://www.ipgeoblock.com/changelog/release-3.0.0.html "3.0.0 Release Note | IP Geo Block").
|
||||
|
||||
= 2.2.9.1 =
|
||||
* **Bug fix:** Blocking Wordfence scanning. ([@](https://wordpress.org/support/topic/wordfence-conflict-2/ "WordFence Conflict"))
|
||||
* **Bug fix:** Illegal elimination of colon in text field for IP address. ([@](https://wordpress.org/support/topic/adding-ipv6-to-white-list/ "Adding IPv6 to white list"))
|
||||
* **Improved:** Compatibility with PHP 7 that cause to feel relaxed. ([@](https://wordpress.org/support/topic/plans-for-php-7-compatiblity/ "Plans for PHP 7 compatiblity?"))
|
||||
* **Improved:** Avoid resetting whitelist on update by InfiniteWP. ([@](https://wordpress.org/support/topic/whitelist-resets-on-update/ "[Resolved] Whitelist resets on update"))
|
||||
* **Trial feature:** `X-Robots-Tag` HTTP header with `noindex, nofollow` for login page. ([@](https://wordpress.org/support/topic/ip-geo-block-and-searchmachines/ "IP GEo-block and searchmachines"))
|
||||
|
||||
= 2.2.9 =
|
||||
* **New feature:** A new option that makes this plugin configured as a "Must-use plugin". It can massively reduce the server load especially against brute-force attacks because it initiates this plugin prior to other typical plugins.
|
||||
* **Improvement:** Validation of a certain signature against XSS is internally added to "Bad signature in query" by default.
|
||||
* **Improvement:** Improved compatibility with PHP 7 (Thanks to [FireMyst](https://wordpress.org/support/topic/plans-for-php-7-compatiblity/ "Topic: Plans for PHP 7 compatiblity? « WordPress.org Forums")).
|
||||
* Find details in [2.2.9 Release Note](https://www.ipgeoblock.com/changelog/release-2.2.9.html "2.2.9 Release Note").
|
||||
|
||||
= 2.2.8.2 =
|
||||
* **Bug fix:** Fixed the mismatched internal version number.
|
||||
|
||||
= 2.2.8.1 =
|
||||
* **Bug fix:** Fixed the issue of undefined function `wp_get_raw_referer()` error that happened under certain condition. See [the issue](https://wordpress.org/support/topic/since-php-update-fatal-error-everytime-i-want-to-edit-a-post/ "Since PHP update Fatal error everytime I want to edit a post") at forum.
|
||||
* **Improved:** Avoid resetting country code on update. See [the issue](https://wordpress.org/support/topic/whitelist-resets-on-update/ "Whitelist resets on update") at forum.
|
||||
|
||||
= 2.2.8 =
|
||||
* **Bug fix:** Fixed the issue of stripping some required characters for Google maps API key.
|
||||
* **New feature:** Whois database Lookup for IP address on search tab.
|
||||
* **Update:** Updated geolocation API libraries and services.
|
||||
* Find more details in [2.2.8 Release Note](https://www.ipgeoblock.com/changelog/release-2.2.8.html "2.2.8 Release Note").
|
||||
|
||||
= 2.2.7 =
|
||||
* **Bug fix:** Fix inadequate validation of "**Bad signatures in query**".
|
||||
* **Improvement:** Add fallback for Google Maps API key ([@](https://wordpress.org/support/topic/226-problem-with-search-resp-google-maps "WordPress › Support » [2.2.6] Problem with SEARCH resp. Google Maps")) and corruption of "Bad signatures" ([@](https://wordpress.org/support/topic/226-problem-with-bad-signatures-in-query "WordPress › Support » [2.2.6] Problem with "Bad signatures in query"")).
|
||||
* **Update:** Update geolocation service api.
|
||||
* Find details about Google Maps API in [2.2.7 Release Note](https://www.ipgeoblock.com/changelog/release-2.2.7.html "2.2.7 Release Note").
|
||||
|
||||
= 2.2.6 =
|
||||
* **New feature:** Add saving csv file of logs in "Logs" tab.
|
||||
* **New feature:** Add filter hook `ip-geo-block-record-log` to control over the conditions of recording in more detail.
|
||||
* **Bug fix:** Fixed the issue that "Exceptions" for Plugins/Themes area does not work properly. Please confirm your settings again.
|
||||
* See details at [release 2.2.6](https://www.ipgeoblock.com/changelog/release-2.2.6.html "2.2.6 Release Note").
|
||||
|
||||
= 2.2.5 =
|
||||
* **New feature:** On the settings page, you can specify the pliugin or theme which would cause undesired blocking in order to exclude it from the validation target without embedding any codes into `functions.php`.
|
||||
* **Improvement:** Optimize resource loading on admin dashboard.
|
||||
* **Improvement:** Support clean uninstall for network / multisite.
|
||||
* **Improvement:** Improve the compatibility of downloading IP address databases for Microsoft IIS.
|
||||
* **Bug fix:** Support `FORCE_SSL_ADMIN`.
|
||||
* **Bug fix:** Fix the issue of [@](https://wordpress.org/support/topic/compatibility-with-ag-custom-admin "WordPress › Support » Compatibility with AG Custom Admin") and change the option name "**Important files**" to "**Bad signatures in query**" to avoid misuse.
|
||||
* **Bug fix:** Fix the issue of [@](https://wordpress.org/support/topic/gb-added-to-whitelist "WordPress › Support » GB added to whitelist") which might be caused by some race condition.
|
||||
* **Bug fix:** Fix the issue of restoring post revisions which was blocked.
|
||||
|
||||
= 2.2.4.1 =
|
||||
Sorry for frequent updating.
|
||||
|
||||
* **Bug fix:** Fixed the issue of `Warning: strpos(): Empty needle in...` that was reported in [@](https://wordpress.org/support/topic/version-224-produces-warning-message "WordPress › Support » Version 2.2.4 Produces Warning Message") and [@](https://wordpress.org/support/topic/error-after-update-to-newest-version "WordPress › Support » Error after Update to newest version").
|
||||
|
||||
= 2.2.4 =
|
||||
* **Bug fix:** Fixed the issue that some links on network admin of multisite were blocked when WP-ZEP for `admin area` or `admin ajax/post` was enabled.
|
||||
* **New feature:** Added configure of `.htaccess` for the plugins/themes area.
|
||||
* **Enhancement:** Added `wp-signup.php` to the list of validation target.
|
||||
* **Enhancement:** Added exporting and importing the setting parameters.
|
||||
* **Improvement:** Made the logout url compatible with [Rename wp-login.php](https://wordpress.org/plugins/rename-wp-login/).
|
||||
* **Improvement:** Made condition of validation more strictly at admin diagnosis to prevent unnecessary notice of self blocking. ([@](https://wordpress.org/support/topic/youll-be-blocked-after-you-log-out-notice-doesnt-disappear "[resolved] "You'll be blocked after you log out" notice doesn't disappear"))
|
||||
* **Improvement:** Improved some of UI. ([@](https://wordpress.org/support/topic/possible-to-select-which-countries-are-blocked "[resolved] Possible to select which countries are blocked?"), [@](https://wordpress.org/support/topic/ip-geo-block-black-list "IP Geo Block Black List"))
|
||||
* See some details at [release 2.2.4](https://www.ipgeoblock.com/changelog/release-2.2.4.html "2.2.4 Release Note").
|
||||
|
||||
= 2.2.3.1 =
|
||||
* **Bug fix:** Fixed the issue that disabled validation target was still blocked by country. ([@](https://wordpress.org/support/topic/logs-whitelist-comments-still-blocked "[resolved] logs whitelist comments still blocked?"))
|
||||
* **Improvement:** Better handling of charset and errors for MySQL. ([@](https://wordpress.org/support/topic/whitelist-log "[resolved] Whitelist + Log"))
|
||||
|
||||
= 2.2.3 =
|
||||
* **Improvement:** Since WordPress 4.4, XML-RPC system.multicall is disabled when the authentication fails, but still processed all the methods to the end. Now this plugin immediately blocks the request when the authentication fails without processing the rest of the methods.
|
||||
* **Improvement:** Add UI to change the maximum number of login attempts.
|
||||
* **Improvement:** Add a fallback process of setting up the directory where the geo location database APIs should be installed. It will be set as `wp-content/uploads/` instead of `wp-content/plugins/ip-geo-block/` or `wp-content/` in case of being unable to obtain proper permission. ([@](https://wordpress.org/support/topic/deactivated-after-updte-why "[resolved] Deactivated after update - why?"), [@](https://wordpress.org/support/topic/the-plugin-caused-an-error-message "[resolved] The plugin caused an error message"))
|
||||
* **Improvement:** Moderate the conditions of redirection after logout. ([@](https://wordpress.org/support/topic/logout-redirect-doesnt-work-when-plugin-is-active "[resolved] Logout redirect doesn't work when plugin is active"))
|
||||
* **Improvement:** Prevent self blocking caused by irrelevant signature. ([@](https://wordpress.org/support/topic/works-too-well-blocked-my-wp-admin-myself "[resolved] Works too well - Blocked my wp-admin myself"))
|
||||
* **Bug fix:** Fixed the issue of conflicting with certain plugins due to the irrelevant handling of js event. ([@](https://wordpress.org/support/topic/cannot-edit-pages-when-ip-geo-block-is-enabled "[resolved] Cannot edit pages when ip-geo-block is enabled."))
|
||||
* **New feature:** Add "Blocked per day" graph for the daily statistics.
|
||||
* See some details at [2.2.3 release note](https://www.ipgeoblock.com/changelog/release-2.2.3.html "2.2.3 Release Note").
|
||||
|
||||
= 2.2.2.3 =
|
||||
Sorry for frequent update again but the following obvious bugs should be fixed.
|
||||
|
||||
* **Bug fix:** Fixed the issue of not initializing country code at activation.
|
||||
* **Bug fix:** Fixed the issue that scheme less notation like '//example.com' could not be handled correctly.
|
||||
|
||||
= 2.2.2.2 =
|
||||
Sorry for frequent update.
|
||||
|
||||
* **Bug fix:** Fixed the issue of race condition at activation. This fix is related to the urgent security update at **2.2.2.1 which was not actually the security issue but a bug**. See [this thread](https://wordpress.org/support/topic/white-list-hack "white list hack") about little more details.
|
||||
* **Improvement:** Improved the compatibility with Jetpack.
|
||||
|
||||
= 2.2.2.1 =
|
||||
* **Urgent security update:** Killed the possibility of the options being altered.
|
||||
|
||||
= 2.2.2 =
|
||||
* **Enhancement:** Refactored some codes and components. The number of attacks that can be proccessed per second has been improved by 25% at the maximum.
|
||||
* **Improvement:** In the previous version, the statistical data was recorded into `wp_options`. It caused the uncertainty of recording especially in case of burst attacks. Now the data will be recorded in an independent table to improve this issue.
|
||||
* **Bug fix:** Fixed conflict with NextGEN Gallary Pro. Thanks to [bodowewer](https://wordpress.org/support/profile/bodowewer).
|
||||
* **Bug fix:** Fixed some filter hooks that did not work as intended.
|
||||
* See more details at [2.2.2 release note](https://www.ipgeoblock.com/changelog/release-2.2.2.html "2.2.2 Release Note").
|
||||
|
||||
= 2.2.1.1 =
|
||||
* **Bug fix:** Fixed "open_basedir restriction" issue caused by `file_exists()`.
|
||||
|
||||
= 2.2.1 =
|
||||
* **Enhancement:** In previous version, local geolocation databases will always be removed and downloaded again at every upgrading. Now, the class library for Maxmind and IP2Location have become independent of this plugin and you can put them outside this plugin in order to cut the above useless process. The library can be available from [WordPress-IP-Geo-API](https://github.com/tokkonopapa/WordPress-IP-Geo-API).
|
||||
* **Deprecated:** Cooperation with IP2Location plugins such as [IP2Location Tags](https://wordpress.org/plugins/ip2location-tags/ "WordPress - IP2Location Tags - WordPress Plugins"), [IP2Location Variables](https://wordpress.org/plugins/ip2location-variables/ "WordPress - IP2Location Variables - WordPress Plugins"), [IP2Location Country Blocker](https://wordpress.org/plugins/ip2location-country-blocker/ "WordPress - IP2Location Country Blocker - WordPress Plugins") is out of use. Instead of it, free [IP2Location LITE databases for IPv4 and IPv6](https://lite.ip2location.com/ "Free IP Geolocation Database") will be downloaded.
|
||||
* **Improvement:** Improved connectivity with Jetpack.
|
||||
* **Improvement:** Improved immediacy of downloading databases at upgrading.
|
||||
* **Improvement:** Replaced a terminated RESTful API service with a new stuff.
|
||||
* **Bug fix:** Fixed issue that clicking a link tag without href always refreshed the page. Thanks to [wyclef](https://wordpress.org/support/topic/conflict-with-menu-editor-plugin "WordPress › Support » Conflict with Menu Editor plugin?").
|
||||
* **Bug fix:** Fixed issue that deactivating and activating repeatedly caused to show the welcome message.
|
||||
* **Bug fix:** Fixed issue that a misaligned argument in the function caused 500 internal server error when a request to the php files in plugins/themes area was rewrited to `rewrite.php`.
|
||||
|
||||
= 2.2.0.1 =
|
||||
Sorry for frequent update.
|
||||
|
||||
* **Fix:** Fixed the issue that some actions of other plugins were blocked.
|
||||
|
||||
= 2.2.0 =
|
||||
* **Important:** Now **Block by country** and **Prevent Zero-day Exploit** become to work independently on **Admin area**, **Admin ajax/post** at **Validation target settings**. Please reconfirm them.
|
||||
* **Important:** Previously, a request whose country code can't be available was always blocked. But from this release, such a request is considered as comming from the country whose code is `ZZ`. It means that you can put `ZZ` into the white list and black list.
|
||||
* **New feature:** White list and Black list of extra IP addresses prior to the validation of country code. Thanks to Fabiano for good suggestions at [support forum](https://wordpress.org/support/topic/white-list-of-ip-addresses-or-ranges "WordPress › Support » White list of IP addresses or ranges?")
|
||||
* **New feature:** Malicious signatures to prevent disclosing the important files via vulnerable plugins or themes. A malicious request to try to expose `wp-config.php` or `passwd` can be blocked.
|
||||
* **New feature:** Add privacy considerations related to IP address. Add **Anonymize IP address** at **Record settings**.
|
||||
* **Bug fix:** Fix the issue that spaces in **Text message on comment form** are deleted.
|
||||
* See details at [2.2.0 release note](https://www.ipgeoblock.com/changelog/release-2.2.0.html "2.2.0 Release Note").
|
||||
|
||||
= 2.1.5.1 =
|
||||
* **Bug fix:** Fixed the issue that the Blacklist did not work properly. Thanks to TJayYay for reporting this issue at [support forum](https://wordpress.org/support/topic/hackers-from-country-in-blocked-list-of-countries-trying-to-login "WordPress › Support » Hackers from country in Blocked List of Countries trying to login").
|
||||
|
||||
= 2.1.5 =
|
||||
* **Enhancement:** Enforce preventing self blocking at the first installation. And add the scan button to get all the country code using selected API. Thanks to **Nils** for a nice idea at [support forum](https://wordpress.org/support/topic/locked-out-due-to-eu-vs-country "WordPress › Support » Locked out due to EU vs. Country").
|
||||
* **New feature:** Add pie chart to display statistics of "Blocked by country".
|
||||
* **Enhancement:** WP-ZEP is reinforced against CSRF.
|
||||
* **Bug fix:** Fix illegal handling of the fragment in a link.
|
||||
* See details at [2.1.5 release note](https://www.ipgeoblock.com/changelog/release-2.1.5.html "2.1.5 Release Note").
|
||||
|
||||
= 2.1.4 =
|
||||
* **Bug fix:** Fix the issue that this plugin broke functionality of a certain plugin. Thanks to **opsec** for reporting this issue at [support forum](https://wordpress.org/support/topic/blocks-saves-in-types-or-any-plugins-from-wp-typescom "WordPress › Support » Blocks saves in Types or any plugins from wp-types.com").
|
||||
* **Improvement:** Add checking process for validation rule to prevent being blocked itself. Thanks to **internationals** for proposing at [support forum](https://wordpress.org/support/topic/locked-out-due-to-eu-vs-country "WordPress › Support » Locked out due to EU vs. Country")
|
||||
* **Improvement:** Arrage the order of setting sections to focus the goal of this plugin.
|
||||
* See details at [2.1.4 release note](https://www.ipgeoblock.com/changelog/release-2.1.4.html "2.1.4 Release Note").
|
||||
|
||||
= 2.1.3 =
|
||||
* **New feature:** Add "show" / "hide" at each section on the "Settings" tab.
|
||||
* **New feature:** Add an emergency function that invalidate blocking behavior in case yourself is locked out. This feature is commented out by default at the bottom of `ip-geo-block.php`.
|
||||
* **Improvement:** Prevent adding query strings to the static resources when users logged in.
|
||||
* **Improvement:** Improved the compatibility with Autoptimize.
|
||||
* **Bug fix:** Fix the issue related to showing featured themes on dashboard.
|
||||
* **Bug fix:** Fix minor bug in `rewrite.php` for the advanced use case.
|
||||
* See details at [2.1.3 release note](https://www.ipgeoblock.com/changelog/release-2.1.3.html "2.1.3 Release Note").
|
||||
|
||||
= 2.1.2 =
|
||||
This is a maintenance release.
|
||||
|
||||
* **Bug fix:** Fix the issue that the login-fail-counter didn't work when the validation at `Login form` was `block by country (register, lost password)`. In this release, the login-fail-counter works correctly.
|
||||
* **Bug fix:** Fix the issue that the validation settings of `Admin area` and `Admin ajax/post` were influential with each other. Now each of those works individually.
|
||||
* **Bug fix:** "Site Stats" of Jetpack is now shown on the admin bar which issue was reported on [support forum](https://wordpress.org/support/topic/admin-area-prevent-zero-day-exploit-incompatible-with-jetpack-site-stats-in-a "WordPress › Support » Admin area - Prevent zero-day exploit: Incompatible with Jetpack Site Stats in A").
|
||||
* **Improvement:** Hide checking the existence of log db behind the symbol `IP_GEO_BLOCK_DEBUG` to reduce 1 query on admin screen.
|
||||
* **Improvement:** Add alternative functions of BCMath extension to avoid `PHP Fatal error: Call to undefined function` in `IP2Location.php` when IPv6 is specified.
|
||||
* **Improvement:** Use MaxMind database at the activating process not to be locked out by means of inconsistency of database at the activation and after.
|
||||
* See more details at [2.1.2 release note](https://www.ipgeoblock.com/changelog/release-2.1.2.html "2.1.2 Release Note").
|
||||
|
||||
= 2.1.1 =
|
||||
* **New feature:** Added `Block by country (register, lost password)` at `Login form` on `Settings` tab in order to accept the registered users as membership from anywhere but block the request of new user ragistration and lost password by the country code. Is't suitable for BuddyPress and bbPress.
|
||||
* **Improvement:** Added showing the custom error page for http response code 4xx and 5xx. For example the `403.php` in the theme template directory or in the child theme directory is used if it exists. And new filter hooks `ip-geo-block-(comment|xmlrpc|login|admin)-(status|reason)` are available to customize the response code and reason for human.
|
||||
* **Obsoleted:** Obsoleted the filter hooks `ip-geo-block-(admin-actions|admin-pages|wp-content)`. Alternatively new filter hooks `ip-geo-block-bypass-(admins|plugins|themes)` are added to bypass WP-ZEP.
|
||||
* Find out more details in the [2.1.1 release note](https://www.ipgeoblock.com/changelog/release-2.1.1.html "2.1.1 Release Note").
|
||||
|
||||
= 2.1.0 =
|
||||
* **New feature:** Expanded the operating range of ZP-ZEP, that includes admin area, plugins area, themes area. Now it can prevent a direct malicios attack to the file in plugins and themes area. Please go to the "Validation Settings" on "Settings" tab and check it. Also check my article in "[Analysis of Attack Vector against WP Plugins](https://www.ipgeoblock.com/article/analysis-attack-vector.html)".
|
||||
* **Bug fix:** Fixed the issue that action hook `ip-geo-block-backup-dir` did not work correctly because the order of argument was mismatched.
|
||||
* **Bug fix:** Fixed the issue that a record including utf8 4 bytes character in its columns was not logged into DB in WordPress 4.2.
|
||||
* **Improvement:** Fixed the issue that Referrer Suppressor do nothing with a new element which is added into DOM after DOM ready. The event handler is now delegated at the `body`.
|
||||
|
||||
= 2.0.8 =
|
||||
* Fixed an issue that a certain type of attack vector to the admin area ([example](https://blog.sucuri.net/2014/08/database-takeover-in-custom-contact-forms.html "Critical Vulnerability Disclosed on WordPress Custom Contact Forms Plugin")) could not be blocked by the reason that some plugins accept it on earlier hook (ie `init`) than this plugin (previously `admin_init`).
|
||||
* Added re-creating DB table for validation logs in case of accidentally failed at activation process.
|
||||
* The time of day is shown with local time by adding GMT offset based on the time zone setting.
|
||||
* Optimized resource loading and settings to avoid redundancy.
|
||||
* See details at [this plugin's blog](https://www.ipgeoblock.com/changelog/release-2.0.8.html "2.0.8 Release Note").
|
||||
|
||||
= 2.0.7 =
|
||||
* Avoid JavaScript error which occurs if an anchor link has no `href`.
|
||||
* Improved UI on admin screen.
|
||||
* Added a diagnosis for creation of database table.
|
||||
|
||||
= 2.0.6 =
|
||||
* Sorry for urgent update but avoid an javascript error.
|
||||
|
||||
= 2.0.4 =
|
||||
* Sorry for frequent update but added a function of showing admin notice when none of the IP geolocation providers is selected. Because the user will be locked out from admin screen when the cache expires.
|
||||
* **Bug fix:** Fixed an issue of `get_geolocation()` method at a time of when the cache of IP address is cleared.
|
||||
* Referrer suppressor now supports [meta referrer](https://wiki.whatwg.org/wiki/Meta_referrer "Meta referrer - WHATWG Wiki")
|
||||
|
||||
= 2.0.3 =
|
||||
* **Bug fix:** Fixed an issue that empty black list doesn't work correctly when matching rule is black list.
|
||||
* **New feature:** Added 'Zero-day Exploit Prevention for wp-admin'. Because it is an experimental feature, please open a new issue at [support forum](https://wordpress.org/support/plugin/ip-geo-block "WordPress › Support » IP Geo Block") if you have any troubles with it.
|
||||
* **New feature:** Referrer suppressor for external link. When you click an external hyperlink on admin screen, http referrer will be suppressed to hide a footprint of your site.
|
||||
* Also added the filter hook `ip-geo-block-admin-actions` for safe actions on back-end.
|
||||
|
||||
= 2.0.2 =
|
||||
* **New feature:** Include `wp-admin/admin-post.php` as a validation target in the `Admin area`. This feature is to protect against a vulnerability such as [Analysis of the Fancybox-For-WordPress Vulnerability](https://blog.sucuri.net/2015/02/analysis-of-the-fancybox-for-wordpress-vulnerability.html) on Sucuri Blog.
|
||||
* Added a sample code snippet as a use case for 'Give ajax permission in case of safe actions on front facing page'. See Example 10 in `sample.php`.
|
||||
|
||||
= 2.0.1 =
|
||||
* Fixed the issue of improper scheme from the HTTPS site when loading js for google map.
|
||||
* In order to prevent accidental disclosure of the length of password, changed the length of `*` (masked password) which is logged into the database.
|
||||
|
||||
= 2.0.0 =
|
||||
* **New feature:** Protection against brute-force and reverse-brute-force attacks to `wp-login.php`, `xmlrpc.php` and admin area. This is an experimental function and can be enabled on `Settings` tab. Malicious access can try to login only 5 times per IP address. This retry counter can be reset to zero by `Clear statistics` on `Statistics` tab.
|
||||
|
||||
= 1.0.0 =
|
||||
* Ready to release.
|
||||
|
||||
== Upgrade Notice ==
|
||||
@@ -1,79 +0,0 @@
|
||||
/*! IP Geo Block admin icons
|
||||
* This package includes the following icon font.
|
||||
* IcoMoon - Free / Designer: Keyamoon / License: GPL / CC BY 4.0
|
||||
* Zondicons / Designer: Steve Schoger / License: CC BY 4.0
|
||||
* Material Icons / Designer: Google / License: Apache License 2.0
|
||||
*/
|
||||
@font-face {
|
||||
font-family: 'icomoon';
|
||||
src: url('fonts/icomoon.eot?jihakz');
|
||||
src: url('fonts/icomoon.eot?jihakz#iefix') format('embedded-opentype'),
|
||||
url('fonts/icomoon.ttf?jihakz') format('truetype'),
|
||||
url('fonts/icomoon.woff?jihakz') format('woff'),
|
||||
url('fonts/icomoon.svg?jihakz#icomoon') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
[class^="ip-geo-block-icon-"], [class*=" ip-geo-block-icon-"] {
|
||||
/* use !important to prevent issues with browser extensions that change fonts */
|
||||
font-family: 'icomoon' !important;
|
||||
speak: none;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
|
||||
/* Better Font Rendering =========== */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.ip-geo-block-icon-calc {
|
||||
margin-top: 0.2em !important;
|
||||
}
|
||||
.ip-geo-block-icon-calc:before {
|
||||
content: "\e901";
|
||||
}
|
||||
.ip-geo-block-icon-vpn_lock:before {
|
||||
content: "\e62f";
|
||||
}
|
||||
.ip-geo-block-icon-play:before {
|
||||
content: "\ea1c";
|
||||
}
|
||||
.ip-geo-block-icon-pause:before {
|
||||
content: "\ea1d";
|
||||
}
|
||||
.ip-geo-block-icon-stop:before {
|
||||
content: "\ea1e";
|
||||
}
|
||||
.ip-geo-block-icon-warning:before {
|
||||
content: "\e900";
|
||||
}
|
||||
.ip-geo-block-icon-happy:before {
|
||||
content: "\e9df";
|
||||
}
|
||||
.ip-geo-block-icon-grin2:before {
|
||||
content: "\e9ea";
|
||||
}
|
||||
.ip-geo-block-icon-cool:before {
|
||||
content: "\e9eb";
|
||||
}
|
||||
.ip-geo-block-icon-confused:before {
|
||||
content: "\e9f5";
|
||||
}
|
||||
.ip-geo-block-icon-confused2:before {
|
||||
content: "\e9f6";
|
||||
}
|
||||
.ip-geo-block-icon-crying:before {
|
||||
content: "\ea01";
|
||||
}
|
||||
|
||||
/* Dashicons is the official icon font of the WordPress admin as of 3.8+. */
|
||||
#toplevel_page_ip-geo-block .dashicons-admin-generic:before {
|
||||
font-family: 'icomoon';
|
||||
content: "\e62f";
|
||||
font-size: 18px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
/*! IP Geo Block admin icons
|
||||
* This package includes the following icon font.
|
||||
* IcoMoon - Free / Designer: Keyamoon / License: GPL / CC BY 4.0
|
||||
* Zondicons / Designer: Steve Schoger / License: CC BY 4.0
|
||||
* Material Icons / Designer: Google / License: Apache License 2.0
|
||||
*/
|
||||
@font-face{font-family:icomoon;src:url(fonts/icomoon.eot?jihakz);src:url(fonts/icomoon.eot?jihakz#iefix) format('embedded-opentype'),url(fonts/icomoon.ttf?jihakz) format('truetype'),url(fonts/icomoon.woff?jihakz) format('woff'),url(fonts/icomoon.svg?jihakz#icomoon) format('svg');font-weight:400;font-style:normal}[class*=" ip-geo-block-icon-"],[class^=ip-geo-block-icon-]{font-family:icomoon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ip-geo-block-icon-calc{margin-top:.2em!important}.ip-geo-block-icon-calc:before{content:"\e901"}.ip-geo-block-icon-vpn_lock:before{content:"\e62f"}.ip-geo-block-icon-play:before{content:"\ea1c"}.ip-geo-block-icon-pause:before{content:"\ea1d"}.ip-geo-block-icon-stop:before{content:"\ea1e"}.ip-geo-block-icon-warning:before{content:"\e900"}.ip-geo-block-icon-happy:before{content:"\e9df"}.ip-geo-block-icon-grin2:before{content:"\e9ea"}.ip-geo-block-icon-cool:before{content:"\e9eb"}.ip-geo-block-icon-confused:before{content:"\e9f5"}.ip-geo-block-icon-confused2:before{content:"\e9f6"}.ip-geo-block-icon-crying:before{content:"\ea01"}#toplevel_page_ip-geo-block .dashicons-admin-generic:before{font-family:icomoon;content:"\e62f";font-size:18px;margin-left:2px}
|
||||
@@ -1 +0,0 @@
|
||||
*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:8xp;font-size:14px;line-height:1.4}.container{margin:0;padding:0}.clr:after,.col:after,.container:after,.row:after{content:"";display:table;clear:both}.row{padding-bottom:0}.col{display:block;float:left;width:100%}.span_2{width:8.33333333333%}.span_11{width:45.8333333333%}.span_24{width:100%}fieldset{border:none;margin:0;padding:.5rem}textarea{width:100%;height:4.5rem;resize:horizontal;border:1px solid #ccc;font-size:12px;font-family:Consolas,Monaco,monospace}legend input[type=button]{margin-left:.5rem;vertical-align:middle}#j,#i{display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;justify-content:center;align-items:center}#j{padding:0 .5rem}ul#h{padding:1.5rem 0 0;list-style:none}ul#h li{width:100%;margin:.1rem 0;display:inline-block}ul#h li input{padding:0}#g{height:3em;text-align:center;border:1px solid #ccc;padding:.5rem;font-size:12px;font-family:Consolas,Monaco,monospace}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Generated by IcoMoon</metadata>
|
||||
<defs>
|
||||
<font id="icomoon" horiz-adv-x="1024">
|
||||
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||
<missing-glyph horiz-adv-x="1024" />
|
||||
<glyph unicode=" " horiz-adv-x="512" d="" />
|
||||
<glyph unicode="" glyph-name="vpn_lock" d="M426 44.667v84c-46 0-84 38-84 84v44l-206 204c-6-24-8-50-8-76 0-174 130-320 298-340zM808 426.667h86c2-14 2-28 2-42 0-236-190-428-426-428s-428 192-428 428 192 426 428 426c44 0 88-8 128-20v-108c0-46-40-86-86-86h-86v-84c0-24-18-44-42-44h-86v-84h256c24 0 44-20 44-44v-128h42c38 0 70-24 82-58 56 60 88 142 88 230 0 14 0 28-2 42zM904 768.667v20c0 40-32 74-72 74s-72-34-72-74v-20h144zM938 768.667c24 0 44-20 44-44v-170c0-24-20-42-44-42h-212c-24 0-44 18-44 42v170c0 24 20 44 44 44v20c0 58 48 108 106 108s106-50 106-108v-20z" />
|
||||
<glyph unicode="" glyph-name="warning" d="M1010.432 121.248l-383.968 768c-21.664 43.36-65.952 70.752-114.464 70.752s-92.8-27.392-114.464-70.752l-383.968-768c-19.84-39.68-17.728-86.816 5.6-124.576 23.328-37.696 64.512-60.672 108.864-60.672h767.904c44.384 0 85.568 22.976 108.864 60.672 23.328 37.76 25.44 84.896 5.632 124.576zM575.936 96c0-17.696-14.304-32-32-32h-64c-17.696 0-32 14.304-32 32v64c0 17.696 14.304 32 32 32h64c17.696 0 32-14.304 32-32v-64zM575.936 352c0-17.696-14.304-32-32-32h-64c-17.696 0-32 14.304-32 32v320c0 17.664 14.304 32 32 32h64c17.696 0 32-14.336 32-32v-320z" />
|
||||
<glyph unicode="" glyph-name="calculator" d="M102.4 870.4c0 56.32 46.080 102.4 102.4 102.4h614.4c56.554 0 102.4-45.846 102.4-102.4v0-819.2c0-56.554-45.846-102.4-102.4-102.4v0h-614.4c-56.554 0-102.4 45.846-102.4 102.4v0 819.2zM256 819.2v-102.4h512v102.4h-512zM256 614.4v-102.4h102.4v102.4h-102.4zM460.8 614.4v-102.4h102.4v102.4h-102.4zM665.6 614.4v-102.4h102.4v102.4h-102.4zM256 409.6v-102.4h102.4v102.4h-102.4zM460.8 409.6v-102.4h102.4v102.4h-102.4zM665.6 409.6v-307.2h102.4v307.2h-102.4zM256 204.8v-102.4h102.4v102.4h-102.4zM460.8 204.8v-102.4h102.4v102.4h-102.4z" />
|
||||
<glyph unicode="" glyph-name="happy" d="M512-64c282.77 0 512 229.23 512 512s-229.23 512-512 512-512-229.23-512-512 229.23-512 512-512zM512 864c229.75 0 416-186.25 416-416s-186.25-416-416-416-416 186.25-416 416 186.25 416 416 416zM512 361.24c115.95 0 226.23 30.806 320 84.92-14.574-178.438-153.128-318.16-320-318.16-166.868 0-305.422 139.872-320 318.304 93.77-54.112 204.050-85.064 320-85.064zM256 608c0 53.019 28.654 96 64 96s64-42.981 64-96c0-53.019-28.654-96-64-96s-64 42.981-64 96zM640 608c0 53.019 28.654 96 64 96s64-42.981 64-96c0-53.019-28.654-96-64-96s-64 42.981-64 96z" />
|
||||
<glyph unicode="" glyph-name="grin2" d="M512 960c-282.77 0-512-229.23-512-512s229.226-512 512-512c282.77 0 512 229.23 512 512s-229.23 512-512 512zM704 724c63.962 0 116-52.038 116-116 0-6.378-0.546-12.876-1.628-19.312-1.618-9.632-9.958-16.688-19.724-16.688s-18.108 7.056-19.722 16.69c-6.16 36.684-37.67 53.31-74.926 53.31s-68.766-16.626-74.924-53.31c-1.616-9.632-9.956-16.69-19.722-16.69-0.002 0 0 0-0.002 0-9.766 0-18.106 7.056-19.722 16.688-1.084 6.436-1.63 12.934-1.63 19.312 0 63.962 52.038 116 116 116zM320 724c63.962 0 116-52.038 116-116 0-6.378-0.548-12.876-1.628-19.312-1.618-9.632-9.956-16.688-19.724-16.688s-18.106 7.056-19.722 16.69c-6.16 36.684-37.67 53.31-74.926 53.31s-68.766-16.626-74.924-53.31c-1.616-9.632-9.956-16.69-19.722-16.69 0 0 0 0 0 0-9.766 0-18.106 7.056-19.724 16.688-1.082 6.436-1.63 12.934-1.63 19.312 0 63.962 52.038 116 116 116zM192 384h192v-247.846c-110.094 28.606-192 129.124-192 247.846zM448 128v256h128v-256h-128zM640 136.154v247.846h192c0-118.722-81.904-219.24-192-247.846z" />
|
||||
<glyph unicode="" glyph-name="cool" d="M512-64c282.77 0 512 229.23 512 512s-229.23 512-512 512-512-229.23-512-512 229.23-512 512-512zM512 864c229.75 0 416-186.25 416-416s-186.25-416-416-416-416 186.25-416 416 186.25 416 416 416zM800 704c17.6 0 32-14.4 32-32v-96c0-35.2-28.8-64-64-64h-128c-35.2 0-64 28.8-64 64h-128c0-35.2-28.8-64-64-64h-128c-35.2 0-64 28.8-64 64v96c0 17.6 14.4 32 32 32h192c17.6 0 32-14.4 32-32v-32h128v32c0 17.6 14.4 32 32 32h192zM512 192c93.208 0 174.772 49.818 219.546 124.278l54.88-32.934c-55.966-93.070-157.916-155.344-274.426-155.344-48.458 0-94.384 10.796-135.54 30.082l33.162 55.278c31.354-13.714 65.964-21.36 102.378-21.36z" />
|
||||
<glyph unicode="" glyph-name="confused" d="M512-64c282.77 0 512 229.23 512 512s-229.23 512-512 512-512-229.23-512-512 229.23-512 512-512zM512 864c229.75 0 416-186.25 416-416s-186.25-416-416-416-416 186.25-416 416 186.25 416 416 416zM256 640c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64s-64 28.654-64 64zM640 640c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64s-64 28.654-64 64zM726.106 320h64.864c9.246-72.506-32.452-144.53-103.958-170.56-82.904-30.176-174.9 12.716-205.080 95.616-18.108 49.744-73.306 75.482-123.048 57.372-45.562-16.588-70.956-64.298-60.988-110.424h-64.86c-9.242 72.508 32.45 144.528 103.956 170.56 82.904 30.178 174.902-12.716 205.082-95.614 18.104-49.748 73.306-75.482 123.044-57.372 45.562 16.584 70.956 64.298 60.988 110.422z" />
|
||||
<glyph unicode="" glyph-name="confused2" d="M512 960c-282.77 0-512-229.23-512-512s229.226-512 512-512c282.77 0 512 229.23 512 512s-229.23 512-512 512zM704 704c35.346 0 64-28.654 64-64s-28.654-64-64-64-64 28.654-64 64c0 35.346 28.654 64 64 64zM320 704c35.346 0 64-28.654 64-64s-28.654-64-64-64-64 28.654-64 64c0 35.346 28.654 64 64 64zM687.010 149.44c-82.902-30.18-174.9 12.712-205.080 95.614-18.108 49.742-73.306 75.478-123.048 57.372-45.562-16.588-70.958-64.296-60.988-110.424h-64.86c-9.244 72.508 32.45 144.532 103.956 170.56 82.904 30.18 174.902-12.712 205.082-95.614 18.108-49.742 73.306-75.476 123.046-57.37 45.562 16.584 70.958 64.294 60.988 110.422h64.864c9.24-72.506-32.454-144.532-103.96-170.56z" />
|
||||
<glyph unicode="" glyph-name="crying" d="M512-64c282.77 0 512 229.23 512 512s-229.23 512-512 512-512-229.23-512-512 229.23-512 512-512zM512 864c229.75 0 416-186.25 416-416s-186.25-416-416-416-416 186.25-416 416 186.25 416 416 416zM800 576h-128c-17.674 0-32 14.328-32 32s14.326 32 32 32h128c17.674 0 32-14.328 32-32s-14.326-32-32-32zM352 576h-128c-17.672 0-32 14.328-32 32s14.328 32 32 32h128c17.672 0 32-14.328 32-32s-14.328-32-32-32zM608 104c-8.19 0-16.378 3.124-22.626 9.374-4.582 4.582-29.42 14.626-73.374 14.626s-68.79-10.044-73.374-14.626c-12.496-12.496-32.758-12.496-45.254 0-12.498 12.496-12.498 32.758 0 45.254 30.122 30.12 92.994 33.372 118.628 33.372 25.632 0 88.506-3.252 118.626-33.374 12.498-12.496 12.498-32.758 0-45.254-6.248-6.248-14.436-9.372-22.626-9.372zM736 384c-17.674 0-32 14.326-32 32v64c0 17.672 14.326 32 32 32s32-14.328 32-32v-64c0-17.674-14.326-32-32-32zM736 192c-17.674 0-32 14.326-32 32v64c0 17.674 14.326 32 32 32s32-14.326 32-32v-64c0-17.674-14.326-32-32-32zM288 384c-17.672 0-32 14.326-32 32v64c0 17.672 14.328 32 32 32s32-14.328 32-32v-64c0-17.674-14.328-32-32-32zM288 192c-17.672 0-32 14.326-32 32v64c0 17.674 14.328 32 32 32s32-14.326 32-32v-64c0-17.674-14.328-32-32-32z" />
|
||||
<glyph unicode="" glyph-name="play3" d="M192 832l640-384-640-384z" />
|
||||
<glyph unicode="" glyph-name="pause2" d="M128 832h320v-768h-320zM576 832h320v-768h-320z" />
|
||||
<glyph unicode="" glyph-name="stop2" d="M128 832h768v-768h-768z" />
|
||||
</font></defs></svg>
|
||||
|
Before Width: | Height: | Size: 7.3 KiB |
@@ -1,679 +0,0 @@
|
||||
/*! DataTables 1.10.16
|
||||
* 2008-2017 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
table.ip-geo-block-dataTable {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
clear: both;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
/*
|
||||
* Header and footer styles
|
||||
*/
|
||||
/*
|
||||
* Body styles
|
||||
*/
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th,
|
||||
table.ip-geo-block-dataTable tfoot th {
|
||||
font-weight: bold;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th,
|
||||
table.ip-geo-block-dataTable thead td {
|
||||
padding: 10px 18px;
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th:active,
|
||||
table.ip-geo-block-dataTable thead td:active {
|
||||
outline: none;
|
||||
}
|
||||
table.ip-geo-block-dataTable tfoot th,
|
||||
table.ip-geo-block-dataTable tfoot td {
|
||||
padding: 10px 18px 6px 18px;
|
||||
border-top: 1px solid #111;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead .sorting,
|
||||
table.ip-geo-block-dataTable thead .sorting_asc,
|
||||
table.ip-geo-block-dataTable thead .sorting_desc,
|
||||
table.ip-geo-block-dataTable thead .sorting_asc_disabled,
|
||||
table.ip-geo-block-dataTable thead .sorting_desc_disabled {
|
||||
cursor: pointer;
|
||||
*cursor: hand;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center right;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead .sorting {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAAN0lEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpaQBhPES8gE/z0ElI9M9MA1+gAAD5jWGc4eZ87AAAAABJRU5ErkJggg==); /*url("../images/sort_both.png");*/
|
||||
}
|
||||
table.ip-geo-block-dataTable thead .sorting_asc {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAdUlEQVR4AWO4QyKgWMONG3eWrrh76xbRGtZvulPTdHfzVuI0nDl7p7XrblXD3Y7eu+fPE6FhwWKgaihasuIuAQ2Hj95pbENoqG+9e/QYbg3Xr9+ZPB2iFIGmzrp78yYODdt3gvxa24yCgCK79pAcD8NEw6gGAPv5+lejjyPQAAAAAElFTkSuQmCC); /*url("../images/sort_asc.png");*/
|
||||
}
|
||||
table.ip-geo-block-dataTable thead .sorting_desc {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAcklEQVR4AWO4QyIY2hpGNezac6em6W5tMwoCimzfiUPDzZt3ps66W9WAgiZPv3v9Om4nHT12p74Vobqx7e7ho4T8sGQFQsOCxXcJe/r8+TsdvSDVrV13z5wlLpQ2bwX5fv0mooP11q07S1fcvXFjACMOAM7v+leNDkNAAAAAAElFTkSuQmCC); /*url("../images/sort_desc.png");*/
|
||||
}
|
||||
table.ip-geo-block-dataTable thead .sorting_asc_disabled {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALklEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpZsDAJ6RRA0YNAAAd2DjFaOCLnQAAAABJRU5ErkJggg==); /*url("../images/sort_asc_disabled.png");*/
|
||||
}
|
||||
table.ip-geo-block-dataTable thead .sorting_desc_disabled {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALUlEQVR4AWO4c+cORZjqBowaMGrAf0KYlgYQNoToMMClma4GMKBrpqsB9E9IAFTzOMWpD7f6AAAAAElFTkSuQmCC); /*url("../images/sort_desc_disabled.png");*/
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody tr {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody tr.selected {
|
||||
background-color: #B0BED9;
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody th,
|
||||
table.ip-geo-block-dataTable tbody td {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
table.ip-geo-block-dataTable.row-border tbody th,
|
||||
table.ip-geo-block-dataTable.row-border tbody td,
|
||||
table.ip-geo-block-dataTable.display tbody th,
|
||||
table.ip-geo-block-dataTable.display tbody td {
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
table.ip-geo-block-dataTable.row-border tbody tr:first-child th,
|
||||
table.ip-geo-block-dataTable.row-border tbody tr:first-child td,
|
||||
table.ip-geo-block-dataTable.display tbody tr:first-child th,
|
||||
table.ip-geo-block-dataTable.display tbody tr:first-child td {
|
||||
border-top: none;
|
||||
}
|
||||
table.ip-geo-block-dataTable.cell-border tbody th,
|
||||
table.ip-geo-block-dataTable.cell-border tbody td {
|
||||
border-top: 1px solid #ddd;
|
||||
border-right: 1px solid #ddd;
|
||||
}
|
||||
table.ip-geo-block-dataTable.cell-border tbody tr th:first-child,
|
||||
table.ip-geo-block-dataTable.cell-border tbody tr td:first-child {
|
||||
border-left: 1px solid #ddd;
|
||||
}
|
||||
table.ip-geo-block-dataTable.cell-border tbody tr:first-child th,
|
||||
table.ip-geo-block-dataTable.cell-border tbody tr:first-child td {
|
||||
border-top: none;
|
||||
}
|
||||
table.ip-geo-block-dataTable.stripe tbody tr.odd,
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
table.ip-geo-block-dataTable.stripe tbody tr.odd.selected,
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd.selected {
|
||||
background-color: #acbad4;
|
||||
}
|
||||
table.ip-geo-block-dataTable.hover tbody tr:hover,
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
table.ip-geo-block-dataTable.hover tbody tr:hover.selected,
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover.selected {
|
||||
background-color: #aab7d1;
|
||||
}
|
||||
table.ip-geo-block-dataTable.order-column tbody tr > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column tbody tr > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column tbody tr > .sorting_3,
|
||||
table.ip-geo-block-dataTable.display tbody tr > .sorting_1,
|
||||
table.ip-geo-block-dataTable.display tbody tr > .sorting_2,
|
||||
table.ip-geo-block-dataTable.display tbody tr > .sorting_3 {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
table.ip-geo-block-dataTable.order-column tbody tr.selected > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column tbody tr.selected > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column tbody tr.selected > .sorting_3,
|
||||
table.ip-geo-block-dataTable.display tbody tr.selected > .sorting_1,
|
||||
table.ip-geo-block-dataTable.display tbody tr.selected > .sorting_2,
|
||||
table.ip-geo-block-dataTable.display tbody tr.selected > .sorting_3 {
|
||||
background-color: #acbad5;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd > .sorting_1 {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd > .sorting_2 {
|
||||
background-color: #f3f3f3;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd > .sorting_3,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd > .sorting_3 {
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd.selected > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 {
|
||||
background-color: #a6b4cd;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd.selected > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 {
|
||||
background-color: #a8b5cf;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.odd.selected > .sorting_3,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 {
|
||||
background-color: #a9b7d1;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.even > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.even > .sorting_1 {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.even > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.even > .sorting_2 {
|
||||
background-color: #fcfcfc;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.even > .sorting_3,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.even > .sorting_3 {
|
||||
background-color: #fefefe;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.even.selected > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 {
|
||||
background-color: #acbad5;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.even.selected > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 {
|
||||
background-color: #aebcd6;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr.even.selected > .sorting_3,
|
||||
table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 {
|
||||
background-color: #afbdd8;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column.hover tbody tr:hover > .sorting_1 {
|
||||
background-color: #eaeaea;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column.hover tbody tr:hover > .sorting_2 {
|
||||
background-color: #ececec;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover > .sorting_3,
|
||||
table.ip-geo-block-dataTable.order-column.hover tbody tr:hover > .sorting_3 {
|
||||
background-color: #efefef;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover.selected > .sorting_1,
|
||||
table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 {
|
||||
background-color: #a2aec7;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover.selected > .sorting_2,
|
||||
table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 {
|
||||
background-color: #a3b0c9;
|
||||
}
|
||||
table.ip-geo-block-dataTable.display tbody tr:hover.selected > .sorting_3,
|
||||
table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 {
|
||||
background-color: #a5b2cb;
|
||||
}
|
||||
table.ip-geo-block-dataTable.no-footer {
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
table.ip-geo-block-dataTable.nowrap th,
|
||||
table.ip-geo-block-dataTable.nowrap td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.ip-geo-block-dataTable.compact thead th,
|
||||
table.ip-geo-block-dataTable.compact thead td {
|
||||
padding: 4px 17px 4px 4px;
|
||||
}
|
||||
table.ip-geo-block-dataTable.compact tfoot th,
|
||||
table.ip-geo-block-dataTable.compact tfoot td {
|
||||
padding: 4px;
|
||||
}
|
||||
table.ip-geo-block-dataTable.compact tbody th,
|
||||
table.ip-geo-block-dataTable.compact tbody td {
|
||||
padding: 4px;
|
||||
}
|
||||
table.ip-geo-block-dataTable th.dt-left,
|
||||
table.ip-geo-block-dataTable td.dt-left {
|
||||
text-align: left;
|
||||
}
|
||||
table.ip-geo-block-dataTable th.dt-center,
|
||||
table.ip-geo-block-dataTable td.dt-center,
|
||||
table.ip-geo-block-dataTable td.dataTables_empty {
|
||||
text-align: center;
|
||||
}
|
||||
table.ip-geo-block-dataTable th.dt-right,
|
||||
table.ip-geo-block-dataTable td.dt-right {
|
||||
text-align: right;
|
||||
}
|
||||
table.ip-geo-block-dataTable th.dt-justify,
|
||||
table.ip-geo-block-dataTable td.dt-justify {
|
||||
text-align: justify;
|
||||
}
|
||||
table.ip-geo-block-dataTable th.dt-nowrap,
|
||||
table.ip-geo-block-dataTable td.dt-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th.dt-head-left,
|
||||
table.ip-geo-block-dataTable thead td.dt-head-left,
|
||||
table.ip-geo-block-dataTable tfoot th.dt-head-left,
|
||||
table.ip-geo-block-dataTable tfoot td.dt-head-left {
|
||||
text-align: left;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th.dt-head-center,
|
||||
table.ip-geo-block-dataTable thead td.dt-head-center,
|
||||
table.ip-geo-block-dataTable tfoot th.dt-head-center,
|
||||
table.ip-geo-block-dataTable tfoot td.dt-head-center {
|
||||
text-align: center;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th.dt-head-right,
|
||||
table.ip-geo-block-dataTable thead td.dt-head-right,
|
||||
table.ip-geo-block-dataTable tfoot th.dt-head-right,
|
||||
table.ip-geo-block-dataTable tfoot td.dt-head-right {
|
||||
text-align: right;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th.dt-head-justify,
|
||||
table.ip-geo-block-dataTable thead td.dt-head-justify,
|
||||
table.ip-geo-block-dataTable tfoot th.dt-head-justify,
|
||||
table.ip-geo-block-dataTable tfoot td.dt-head-justify {
|
||||
text-align: justify;
|
||||
}
|
||||
table.ip-geo-block-dataTable thead th.dt-head-nowrap,
|
||||
table.ip-geo-block-dataTable thead td.dt-head-nowrap,
|
||||
table.ip-geo-block-dataTable tfoot th.dt-head-nowrap,
|
||||
table.ip-geo-block-dataTable tfoot td.dt-head-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody th.dt-body-left,
|
||||
table.ip-geo-block-dataTable tbody td.dt-body-left {
|
||||
text-align: left;
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody th.dt-body-center,
|
||||
table.ip-geo-block-dataTable tbody td.dt-body-center {
|
||||
text-align: center;
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody th.dt-body-right,
|
||||
table.ip-geo-block-dataTable tbody td.dt-body-right {
|
||||
text-align: right;
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody th.dt-body-justify,
|
||||
table.ip-geo-block-dataTable tbody td.dt-body-justify {
|
||||
text-align: justify;
|
||||
}
|
||||
table.ip-geo-block-dataTable tbody th.dt-body-nowrap,
|
||||
table.ip-geo-block-dataTable tbody td.dt-body-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.ip-geo-block-dataTable,
|
||||
table.ip-geo-block-dataTable th,
|
||||
table.ip-geo-block-dataTable td {
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/*
|
||||
* Control feature layout
|
||||
*/
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper {
|
||||
position: relative;
|
||||
clear: both;
|
||||
*zoom: 1;
|
||||
zoom: 1;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_length {
|
||||
float: left;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter input {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_info {
|
||||
clear: both;
|
||||
float: left;
|
||||
padding-top: 0.755em;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
|
||||
float: right;
|
||||
text-align: right;
|
||||
padding-top: 0.25em;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
min-width: 1.5em;
|
||||
padding: 0.5em 1em;
|
||||
margin-left: 2px;
|
||||
text-align: center;
|
||||
text-decoration: none !important;
|
||||
cursor: pointer;
|
||||
*cursor: hand;
|
||||
color: #333 !important;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 2px;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
|
||||
color: #333 !important;
|
||||
border: 1px solid #979797;
|
||||
background-color: white;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc));
|
||||
/* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* Chrome10+,Safari5.1+ */
|
||||
background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* FF3.6+ */
|
||||
background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* IE10+ */
|
||||
background: -o-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* Opera 11.10+ */
|
||||
background: linear-gradient(to bottom, white 0%, #dcdcdc 100%);
|
||||
/* W3C */
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
|
||||
cursor: default;
|
||||
color: #666 !important;
|
||||
border: 1px solid transparent;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
|
||||
color: white !important;
|
||||
border: 1px solid #111;
|
||||
background-color: #585858;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));
|
||||
/* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* Chrome10+,Safari5.1+ */
|
||||
background: -moz-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* FF3.6+ */
|
||||
background: -ms-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* IE10+ */
|
||||
background: -o-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* Opera 11.10+ */
|
||||
background: linear-gradient(to bottom, #585858 0%, #111 100%);
|
||||
/* W3C */
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button:active {
|
||||
outline: none;
|
||||
background-color: #2b2b2b;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));
|
||||
/* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* Chrome10+,Safari5.1+ */
|
||||
background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* FF3.6+ */
|
||||
background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* IE10+ */
|
||||
background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* Opera 11.10+ */
|
||||
background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* W3C */
|
||||
box-shadow: inset 0 0 3px #111;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .ellipsis {
|
||||
padding: 0 1em;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_processing {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin-left: -50%;
|
||||
margin-top: -25px;
|
||||
padding-top: 20px;
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
background-color: white;
|
||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0)));
|
||||
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_length,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_info,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_processing,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
|
||||
color: #333;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll {
|
||||
clear: both;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody {
|
||||
*margin-top: -1px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing {
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper.no-footer .dataTables_scrollBody {
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper.no-footer div.dataTables_scrollHead table.ip-geo-block-dataTable,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper.no-footer div.dataTables_scrollBody > table {
|
||||
border-bottom: none;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper:after {
|
||||
visibility: hidden;
|
||||
display: block;
|
||||
content: "";
|
||||
clear: both;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_info,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 640px) {
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_length,
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter {
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
/*! Responsive 2.1.1
|
||||
* 2014-2016 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.child,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th.child,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty {
|
||||
cursor: default !important;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.child:before,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th.child:before,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty:before {
|
||||
display: none !important;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td:first-child,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th:first-child {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
|
||||
top: 9px;
|
||||
left: 4px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
color: white;
|
||||
border: 2px solid white;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 0 3px #444;
|
||||
box-sizing: content-box;
|
||||
text-align: center;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
line-height: 14px;
|
||||
content: '+';
|
||||
background-color: #31b131;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
|
||||
content: '-';
|
||||
background-color: #d33333;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr.child td:before {
|
||||
display: none;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child {
|
||||
padding-left: 27px;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before,
|
||||
table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before {
|
||||
top: 5px;
|
||||
left: 4px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
border-radius: 14px;
|
||||
line-height: 14px;
|
||||
text-indent: 3px;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-column > tbody > tr > td.control,
|
||||
table.ip-geo-block-dataTable.dtr-column > tbody > tr > th.control {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-column > tbody > tr > td.control:before,
|
||||
table.ip-geo-block-dataTable.dtr-column > tbody > tr > th.control:before {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
margin-top: -10px;
|
||||
margin-left: -10px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
color: white;
|
||||
border: 2px solid white;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 0 3px #444;
|
||||
box-sizing: content-box;
|
||||
text-align: center;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
line-height: 14px;
|
||||
content: '+';
|
||||
background-color: #31b131;
|
||||
}
|
||||
table.ip-geo-block-dataTable.dtr-column > tbody > tr.parent td.control:before,
|
||||
table.ip-geo-block-dataTable.dtr-column > tbody > tr.parent th.control:before {
|
||||
content: '-';
|
||||
background-color: #d33333;
|
||||
}
|
||||
table.ip-geo-block-dataTable > tbody > tr.child {
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
table.ip-geo-block-dataTable > tbody > tr.child:hover {
|
||||
background: transparent !important;
|
||||
}
|
||||
table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details {
|
||||
display: inline-block;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details li {
|
||||
border-bottom: 1px solid #efefef;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details li:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
table.ip-geo-block-dataTable > tbody > tr.child span.dtr-title {
|
||||
display: inline-block;
|
||||
min-width: 75px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.dtr-modal {
|
||||
position: fixed;
|
||||
box-sizing: border-box;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
padding: 10em 1em;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-display {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
overflow: auto;
|
||||
margin: auto;
|
||||
z-index: 102;
|
||||
overflow: auto;
|
||||
background-color: #f5f5f7;
|
||||
border: 1px solid black;
|
||||
border-radius: 0.5em;
|
||||
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-content {
|
||||
position: relative;
|
||||
padding: 1em;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-close {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border: 1px solid #eaeaea;
|
||||
background-color: #f9f9f9;
|
||||
text-align: center;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
z-index: 12;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-close:hover {
|
||||
background-color: #eaeaea;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-background {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 101;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
div.dtr-modal div.dtr-modal-display {
|
||||
width: 95%;
|
||||
}
|
||||
}
|
||||
|
||||
/*! datatables.mark.js v2.0.1
|
||||
* Copyright (c) 2016-2017 Julian Motz
|
||||
* https://github.com/julmot/datatables.mark.js/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
mark {
|
||||
background: orange;
|
||||
color: black;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/*! datatables.mark.js v2.0.1
|
||||
* Copyright (c) 2016–2017 Julian Motz
|
||||
* https://github.com/julmot/datatables.mark.js/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
mark {
|
||||
background: orange;
|
||||
color: black;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
mark{background:orange;color:black;}
|
||||
@@ -1,449 +0,0 @@
|
||||
/*! DataTables 1.10.16
|
||||
* 2008-2017 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
table.dataTable {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
clear: both;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
/*
|
||||
* Header and footer styles
|
||||
*/
|
||||
/*
|
||||
* Body styles
|
||||
*/
|
||||
}
|
||||
table.dataTable thead th,
|
||||
table.dataTable tfoot th {
|
||||
font-weight: bold;
|
||||
}
|
||||
table.dataTable thead th,
|
||||
table.dataTable thead td {
|
||||
padding: 10px 18px;
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
table.dataTable thead th:active,
|
||||
table.dataTable thead td:active {
|
||||
outline: none;
|
||||
}
|
||||
table.dataTable tfoot th,
|
||||
table.dataTable tfoot td {
|
||||
padding: 10px 18px 6px 18px;
|
||||
border-top: 1px solid #111;
|
||||
}
|
||||
table.dataTable thead .sorting,
|
||||
table.dataTable thead .sorting_asc,
|
||||
table.dataTable thead .sorting_desc,
|
||||
table.dataTable thead .sorting_asc_disabled,
|
||||
table.dataTable thead .sorting_desc_disabled {
|
||||
cursor: pointer;
|
||||
*cursor: hand;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center right;
|
||||
}
|
||||
table.dataTable thead .sorting {
|
||||
background-image: url("../images/sort_both.png");
|
||||
}
|
||||
table.dataTable thead .sorting_asc {
|
||||
background-image: url("../images/sort_asc.png");
|
||||
}
|
||||
table.dataTable thead .sorting_desc {
|
||||
background-image: url("../images/sort_desc.png");
|
||||
}
|
||||
table.dataTable thead .sorting_asc_disabled {
|
||||
background-image: url("../images/sort_asc_disabled.png");
|
||||
}
|
||||
table.dataTable thead .sorting_desc_disabled {
|
||||
background-image: url("../images/sort_desc_disabled.png");
|
||||
}
|
||||
table.dataTable tbody tr {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
table.dataTable tbody tr.selected {
|
||||
background-color: #B0BED9;
|
||||
}
|
||||
table.dataTable tbody th,
|
||||
table.dataTable tbody td {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td {
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
table.dataTable.row-border tbody tr:first-child th,
|
||||
table.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th,
|
||||
table.dataTable.display tbody tr:first-child td {
|
||||
border-top: none;
|
||||
}
|
||||
table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td {
|
||||
border-top: 1px solid #ddd;
|
||||
border-right: 1px solid #ddd;
|
||||
}
|
||||
table.dataTable.cell-border tbody tr th:first-child,
|
||||
table.dataTable.cell-border tbody tr td:first-child {
|
||||
border-left: 1px solid #ddd;
|
||||
}
|
||||
table.dataTable.cell-border tbody tr:first-child th,
|
||||
table.dataTable.cell-border tbody tr:first-child td {
|
||||
border-top: none;
|
||||
}
|
||||
table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected {
|
||||
background-color: #acbad4;
|
||||
}
|
||||
table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected {
|
||||
background-color: #aab7d1;
|
||||
}
|
||||
table.dataTable.order-column tbody tr > .sorting_1,
|
||||
table.dataTable.order-column tbody tr > .sorting_2,
|
||||
table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1,
|
||||
table.dataTable.display tbody tr > .sorting_2,
|
||||
table.dataTable.display tbody tr > .sorting_3 {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
table.dataTable.order-column tbody tr.selected > .sorting_1,
|
||||
table.dataTable.order-column tbody tr.selected > .sorting_2,
|
||||
table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1,
|
||||
table.dataTable.display tbody tr.selected > .sorting_2,
|
||||
table.dataTable.display tbody tr.selected > .sorting_3 {
|
||||
background-color: #acbad5;
|
||||
}
|
||||
table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 {
|
||||
background-color: #f3f3f3;
|
||||
}
|
||||
table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 {
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 {
|
||||
background-color: #a6b4cd;
|
||||
}
|
||||
table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 {
|
||||
background-color: #a8b5cf;
|
||||
}
|
||||
table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 {
|
||||
background-color: #a9b7d1;
|
||||
}
|
||||
table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 {
|
||||
background-color: #fcfcfc;
|
||||
}
|
||||
table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 {
|
||||
background-color: #fefefe;
|
||||
}
|
||||
table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 {
|
||||
background-color: #acbad5;
|
||||
}
|
||||
table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 {
|
||||
background-color: #aebcd6;
|
||||
}
|
||||
table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 {
|
||||
background-color: #afbdd8;
|
||||
}
|
||||
table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 {
|
||||
background-color: #eaeaea;
|
||||
}
|
||||
table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 {
|
||||
background-color: #ececec;
|
||||
}
|
||||
table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 {
|
||||
background-color: #efefef;
|
||||
}
|
||||
table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 {
|
||||
background-color: #a2aec7;
|
||||
}
|
||||
table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 {
|
||||
background-color: #a3b0c9;
|
||||
}
|
||||
table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 {
|
||||
background-color: #a5b2cb;
|
||||
}
|
||||
table.dataTable.no-footer {
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
table.dataTable.nowrap th, table.dataTable.nowrap td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.dataTable.compact thead th,
|
||||
table.dataTable.compact thead td {
|
||||
padding: 4px 17px 4px 4px;
|
||||
}
|
||||
table.dataTable.compact tfoot th,
|
||||
table.dataTable.compact tfoot td {
|
||||
padding: 4px;
|
||||
}
|
||||
table.dataTable.compact tbody th,
|
||||
table.dataTable.compact tbody td {
|
||||
padding: 4px;
|
||||
}
|
||||
table.dataTable th.dt-left,
|
||||
table.dataTable td.dt-left {
|
||||
text-align: left;
|
||||
}
|
||||
table.dataTable th.dt-center,
|
||||
table.dataTable td.dt-center,
|
||||
table.dataTable td.dataTables_empty {
|
||||
text-align: center;
|
||||
}
|
||||
table.dataTable th.dt-right,
|
||||
table.dataTable td.dt-right {
|
||||
text-align: right;
|
||||
}
|
||||
table.dataTable th.dt-justify,
|
||||
table.dataTable td.dt-justify {
|
||||
text-align: justify;
|
||||
}
|
||||
table.dataTable th.dt-nowrap,
|
||||
table.dataTable td.dt-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.dataTable thead th.dt-head-left,
|
||||
table.dataTable thead td.dt-head-left,
|
||||
table.dataTable tfoot th.dt-head-left,
|
||||
table.dataTable tfoot td.dt-head-left {
|
||||
text-align: left;
|
||||
}
|
||||
table.dataTable thead th.dt-head-center,
|
||||
table.dataTable thead td.dt-head-center,
|
||||
table.dataTable tfoot th.dt-head-center,
|
||||
table.dataTable tfoot td.dt-head-center {
|
||||
text-align: center;
|
||||
}
|
||||
table.dataTable thead th.dt-head-right,
|
||||
table.dataTable thead td.dt-head-right,
|
||||
table.dataTable tfoot th.dt-head-right,
|
||||
table.dataTable tfoot td.dt-head-right {
|
||||
text-align: right;
|
||||
}
|
||||
table.dataTable thead th.dt-head-justify,
|
||||
table.dataTable thead td.dt-head-justify,
|
||||
table.dataTable tfoot th.dt-head-justify,
|
||||
table.dataTable tfoot td.dt-head-justify {
|
||||
text-align: justify;
|
||||
}
|
||||
table.dataTable thead th.dt-head-nowrap,
|
||||
table.dataTable thead td.dt-head-nowrap,
|
||||
table.dataTable tfoot th.dt-head-nowrap,
|
||||
table.dataTable tfoot td.dt-head-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.dataTable tbody th.dt-body-left,
|
||||
table.dataTable tbody td.dt-body-left {
|
||||
text-align: left;
|
||||
}
|
||||
table.dataTable tbody th.dt-body-center,
|
||||
table.dataTable tbody td.dt-body-center {
|
||||
text-align: center;
|
||||
}
|
||||
table.dataTable tbody th.dt-body-right,
|
||||
table.dataTable tbody td.dt-body-right {
|
||||
text-align: right;
|
||||
}
|
||||
table.dataTable tbody th.dt-body-justify,
|
||||
table.dataTable tbody td.dt-body-justify {
|
||||
text-align: justify;
|
||||
}
|
||||
table.dataTable tbody th.dt-body-nowrap,
|
||||
table.dataTable tbody td.dt-body-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataTable,
|
||||
table.dataTable th,
|
||||
table.dataTable td {
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/*
|
||||
* Control feature layout
|
||||
*/
|
||||
.dataTables_wrapper {
|
||||
position: relative;
|
||||
clear: both;
|
||||
*zoom: 1;
|
||||
zoom: 1;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_length {
|
||||
float: left;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_filter input {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_info {
|
||||
clear: both;
|
||||
float: left;
|
||||
padding-top: 0.755em;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate {
|
||||
float: right;
|
||||
text-align: right;
|
||||
padding-top: 0.25em;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate .paginate_button {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
min-width: 1.5em;
|
||||
padding: 0.5em 1em;
|
||||
margin-left: 2px;
|
||||
text-align: center;
|
||||
text-decoration: none !important;
|
||||
cursor: pointer;
|
||||
*cursor: hand;
|
||||
color: #333 !important;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
|
||||
color: #333 !important;
|
||||
border: 1px solid #979797;
|
||||
background-color: white;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc));
|
||||
/* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* Chrome10+,Safari5.1+ */
|
||||
background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* FF3.6+ */
|
||||
background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* IE10+ */
|
||||
background: -o-linear-gradient(top, white 0%, #dcdcdc 100%);
|
||||
/* Opera 11.10+ */
|
||||
background: linear-gradient(to bottom, white 0%, #dcdcdc 100%);
|
||||
/* W3C */
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
|
||||
cursor: default;
|
||||
color: #666 !important;
|
||||
border: 1px solid transparent;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
|
||||
color: white !important;
|
||||
border: 1px solid #111;
|
||||
background-color: #585858;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));
|
||||
/* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* Chrome10+,Safari5.1+ */
|
||||
background: -moz-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* FF3.6+ */
|
||||
background: -ms-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* IE10+ */
|
||||
background: -o-linear-gradient(top, #585858 0%, #111 100%);
|
||||
/* Opera 11.10+ */
|
||||
background: linear-gradient(to bottom, #585858 0%, #111 100%);
|
||||
/* W3C */
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate .paginate_button:active {
|
||||
outline: none;
|
||||
background-color: #2b2b2b;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));
|
||||
/* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* Chrome10+,Safari5.1+ */
|
||||
background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* FF3.6+ */
|
||||
background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* IE10+ */
|
||||
background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* Opera 11.10+ */
|
||||
background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);
|
||||
/* W3C */
|
||||
box-shadow: inset 0 0 3px #111;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate .ellipsis {
|
||||
padding: 0 1em;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_processing {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin-left: -50%;
|
||||
margin-top: -25px;
|
||||
padding-top: 20px;
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
background-color: white;
|
||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0)));
|
||||
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.dataTables_wrapper .dataTables_length,
|
||||
.dataTables_wrapper .dataTables_filter,
|
||||
.dataTables_wrapper .dataTables_info,
|
||||
.dataTables_wrapper .dataTables_processing,
|
||||
.dataTables_wrapper .dataTables_paginate {
|
||||
color: #333;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_scroll {
|
||||
clear: both;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody {
|
||||
*margin-top: -1px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing,
|
||||
.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing,
|
||||
.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing {
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.dataTables_wrapper.no-footer .dataTables_scrollBody {
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,
|
||||
.dataTables_wrapper.no-footer div.dataTables_scrollBody > table {
|
||||
border-bottom: none;
|
||||
}
|
||||
.dataTables_wrapper:after {
|
||||
visibility: hidden;
|
||||
display: block;
|
||||
content: "";
|
||||
clear: both;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
.dataTables_wrapper .dataTables_info,
|
||||
.dataTables_wrapper .dataTables_paginate {
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_paginate {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 640px) {
|
||||
.dataTables_wrapper .dataTables_length,
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
/*! Responsive 2.1.1
|
||||
* 2014-2016 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td.child,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > th.child,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty {
|
||||
cursor: default !important;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td.child:before,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > th.child:before,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty:before {
|
||||
display: none !important;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
|
||||
top: 9px;
|
||||
left: 4px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
color: white;
|
||||
border: 2px solid white;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 0 3px #444;
|
||||
box-sizing: content-box;
|
||||
text-align: center;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
line-height: 14px;
|
||||
content: '+';
|
||||
background-color: #31b131;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
|
||||
content: '-';
|
||||
background-color: #d33333;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr.child td:before {
|
||||
display: none;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child,
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child {
|
||||
padding-left: 27px;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before {
|
||||
top: 5px;
|
||||
left: 4px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
border-radius: 14px;
|
||||
line-height: 14px;
|
||||
text-indent: 3px;
|
||||
}
|
||||
table.dataTable.dtr-column > tbody > tr > td.control,
|
||||
table.dataTable.dtr-column > tbody > tr > th.control {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.dataTable.dtr-column > tbody > tr > td.control:before,
|
||||
table.dataTable.dtr-column > tbody > tr > th.control:before {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
margin-top: -10px;
|
||||
margin-left: -10px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
color: white;
|
||||
border: 2px solid white;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 0 3px #444;
|
||||
box-sizing: content-box;
|
||||
text-align: center;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
line-height: 14px;
|
||||
content: '+';
|
||||
background-color: #31b131;
|
||||
}
|
||||
table.dataTable.dtr-column > tbody > tr.parent td.control:before,
|
||||
table.dataTable.dtr-column > tbody > tr.parent th.control:before {
|
||||
content: '-';
|
||||
background-color: #d33333;
|
||||
}
|
||||
table.dataTable > tbody > tr.child {
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
table.dataTable > tbody > tr.child:hover {
|
||||
background: transparent !important;
|
||||
}
|
||||
table.dataTable > tbody > tr.child ul.dtr-details {
|
||||
display: inline-block;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
table.dataTable > tbody > tr.child ul.dtr-details li {
|
||||
border-bottom: 1px solid #efefef;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
table.dataTable > tbody > tr.child ul.dtr-details li:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
table.dataTable > tbody > tr.child ul.dtr-details li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
table.dataTable > tbody > tr.child span.dtr-title {
|
||||
display: inline-block;
|
||||
min-width: 75px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.dtr-modal {
|
||||
position: fixed;
|
||||
box-sizing: border-box;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
padding: 10em 1em;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-display {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
overflow: auto;
|
||||
margin: auto;
|
||||
z-index: 102;
|
||||
overflow: auto;
|
||||
background-color: #f5f5f7;
|
||||
border: 1px solid black;
|
||||
border-radius: 0.5em;
|
||||
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-content {
|
||||
position: relative;
|
||||
padding: 1em;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-close {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border: 1px solid #eaeaea;
|
||||
background-color: #f9f9f9;
|
||||
text-align: center;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
z-index: 12;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-close:hover {
|
||||
background-color: #eaeaea;
|
||||
}
|
||||
div.dtr-modal div.dtr-modal-background {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 101;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
div.dtr-modal div.dtr-modal-display {
|
||||
width: 95%;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
table.dataTable.dtr-inline.collapsed>tbody>tr>td.child,table.dataTable.dtr-inline.collapsed>tbody>tr>th.child,table.dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty{cursor:default !important}table.dataTable.dtr-inline.collapsed>tbody>tr>td.child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>th.child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty:before{display:none !important}table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child,table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child{position:relative;padding-left:30px;cursor:pointer}table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:before{top:9px;left:4px;height:14px;width:14px;display:block;position:absolute;color:white;border:2px solid white;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;font-family:'Courier New', Courier, monospace;line-height:14px;content:'+';background-color:#31b131}table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before,table.dataTable.dtr-inline.collapsed>tbody>tr.parent>th:first-child:before{content:'-';background-color:#d33333}table.dataTable.dtr-inline.collapsed>tbody>tr.child td:before{display:none}table.dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child,table.dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child{padding-left:27px}table.dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child:before,table.dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child:before{top:5px;left:4px;height:14px;width:14px;border-radius:14px;line-height:14px;text-indent:3px}table.dataTable.dtr-column>tbody>tr>td.control,table.dataTable.dtr-column>tbody>tr>th.control{position:relative;cursor:pointer}table.dataTable.dtr-column>tbody>tr>td.control:before,table.dataTable.dtr-column>tbody>tr>th.control:before{top:50%;left:50%;height:16px;width:16px;margin-top:-10px;margin-left:-10px;display:block;position:absolute;color:white;border:2px solid white;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;font-family:'Courier New', Courier, monospace;line-height:14px;content:'+';background-color:#31b131}table.dataTable.dtr-column>tbody>tr.parent td.control:before,table.dataTable.dtr-column>tbody>tr.parent th.control:before{content:'-';background-color:#d33333}table.dataTable>tbody>tr.child{padding:0.5em 1em}table.dataTable>tbody>tr.child:hover{background:transparent !important}table.dataTable>tbody>tr.child ul.dtr-details{display:inline-block;list-style-type:none;margin:0;padding:0}table.dataTable>tbody>tr.child ul.dtr-details li{border-bottom:1px solid #efefef;padding:0.5em 0}table.dataTable>tbody>tr.child ul.dtr-details li:first-child{padding-top:0}table.dataTable>tbody>tr.child ul.dtr-details li:last-child{border-bottom:none}table.dataTable>tbody>tr.child span.dtr-title{display:inline-block;min-width:75px;font-weight:bold}div.dtr-modal{position:fixed;box-sizing:border-box;top:0;left:0;height:100%;width:100%;z-index:100;padding:10em 1em}div.dtr-modal div.dtr-modal-display{position:absolute;top:0;left:0;bottom:0;right:0;width:50%;height:50%;overflow:auto;margin:auto;z-index:102;overflow:auto;background-color:#f5f5f7;border:1px solid black;border-radius:0.5em;box-shadow:0 12px 30px rgba(0,0,0,0.6)}div.dtr-modal div.dtr-modal-content{position:relative;padding:1em}div.dtr-modal div.dtr-modal-close{position:absolute;top:6px;right:6px;width:22px;height:22px;border:1px solid #eaeaea;background-color:#f9f9f9;text-align:center;border-radius:3px;cursor:pointer;z-index:12}div.dtr-modal div.dtr-modal-close:hover{background-color:#eaeaea}div.dtr-modal div.dtr-modal-background{position:fixed;top:0;left:0;right:0;bottom:0;z-index:101;background:rgba(0,0,0,0.6)}@media screen and (max-width: 767px){div.dtr-modal div.dtr-modal-display{width:95%}}
|
||||
|
Before Width: | Height: | Size: 894 B |
|
Before Width: | Height: | Size: 192 B |
|
Before Width: | Height: | Size: 103 B |
|
Before Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 102 B |
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016–2017 Julian Motz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,26 +0,0 @@
|
||||
/*!
|
||||
Responsive 2.1.1
|
||||
2014-2016 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(l){return c(l,window,document)}):"object"===typeof exports?module.exports=function(l,k){l||(l=window);if(!k||!k.fn.dataTable)k=require("datatables.net")(l,k).$;return c(k,l,l.document)}:c(jQuery,window,document)})(function(c,l,k,p){var m=c.fn.dataTable,j=function(b,a){if(!m.versionCheck||!m.versionCheck("1.10.3"))throw"DataTables Responsive requires DataTables 1.10.3 or newer";this.s={dt:new m.Api(b),columns:[],
|
||||
current:[]};this.s.dt.settings()[0].responsive||(a&&"string"===typeof a.details?a.details={type:a.details}:a&&!1===a.details?a.details={type:!1}:a&&!0===a.details&&(a.details={type:"inline"}),this.c=c.extend(!0,{},j.defaults,m.defaults.responsive,a),b.responsive=this,this._constructor())};c.extend(j.prototype,{_constructor:function(){var b=this,a=this.s.dt,d=a.settings()[0],e=c(l).width();a.settings()[0]._responsive=this;c(l).on("resize.dtr orientationchange.dtr",m.util.throttle(function(){var a=
|
||||
c(l).width();a!==e&&(b._resize(),e=a)}));d.oApi._fnCallbackReg(d,"aoRowCreatedCallback",function(e){-1!==c.inArray(!1,b.s.current)&&c(">td, >th",e).each(function(e){e=a.column.index("toData",e);!1===b.s.current[e]&&c(this).css("display","none")})});a.on("destroy.dtr",function(){a.off(".dtr");c(a.table().body()).off(".dtr");c(l).off("resize.dtr orientationchange.dtr");c.each(b.s.current,function(a,e){!1===e&&b._setColumnVis(a,!0)})});this.c.breakpoints.sort(function(a,b){return a.width<b.width?1:a.width>
|
||||
b.width?-1:0});this._classLogic();this._resizeAuto();d=this.c.details;!1!==d.type&&(b._detailsInit(),a.on("column-visibility.dtr",function(){b._classLogic();b._resizeAuto();b._resize()}),a.on("draw.dtr",function(){b._redrawChildren()}),c(a.table().node()).addClass("dtr-"+d.type));a.on("column-reorder.dtr",function(){b._classLogic();b._resizeAuto();b._resize()});a.on("column-sizing.dtr",function(){b._resizeAuto();b._resize()});a.on("preXhr.dtr",function(){var e=[];a.rows().every(function(){this.child.isShown()&&
|
||||
e.push(this.id(true))});a.one("draw.dtr",function(){a.rows(e).every(function(){b._detailsDisplay(this,false)})})});a.on("init.dtr",function(){b._resizeAuto();b._resize();c.inArray(false,b.s.current)&&a.columns.adjust()});this._resize()},_columnsVisiblity:function(b){var a=this.s.dt,d=this.s.columns,e,f,g=d.map(function(a,b){return{columnIdx:b,priority:a.priority}}).sort(function(a,b){return a.priority!==b.priority?a.priority-b.priority:a.columnIdx-b.columnIdx}),h=c.map(d,function(a){return a.auto&&
|
||||
null===a.minWidth?!1:!0===a.auto?"-":-1!==c.inArray(b,a.includeIn)}),n=0;e=0;for(f=h.length;e<f;e++)!0===h[e]&&(n+=d[e].minWidth);e=a.settings()[0].oScroll;e=e.sY||e.sX?e.iBarWidth:0;a=a.table().container().offsetWidth-e-n;e=0;for(f=h.length;e<f;e++)d[e].control&&(a-=d[e].minWidth);n=!1;e=0;for(f=g.length;e<f;e++){var i=g[e].columnIdx;"-"===h[i]&&(!d[i].control&&d[i].minWidth)&&(n||0>a-d[i].minWidth?(n=!0,h[i]=!1):h[i]=!0,a-=d[i].minWidth)}g=!1;e=0;for(f=d.length;e<f;e++)if(!d[e].control&&!d[e].never&&
|
||||
!h[e]){g=!0;break}e=0;for(f=d.length;e<f;e++)d[e].control&&(h[e]=g);-1===c.inArray(!0,h)&&(h[0]=!0);return h},_classLogic:function(){var b=this,a=this.c.breakpoints,d=this.s.dt,e=d.columns().eq(0).map(function(a){var b=this.column(a),e=b.header().className,a=d.settings()[0].aoColumns[a].responsivePriority;a===p&&(b=c(b.header()).data("priority"),a=b!==p?1*b:1E4);return{className:e,includeIn:[],auto:!1,control:!1,never:e.match(/\bnever\b/)?!0:!1,priority:a}}),f=function(a,b){var d=e[a].includeIn;-1===
|
||||
c.inArray(b,d)&&d.push(b)},g=function(c,d,i,g){if(i)if("max-"===i){g=b._find(d).width;d=0;for(i=a.length;d<i;d++)a[d].width<=g&&f(c,a[d].name)}else if("min-"===i){g=b._find(d).width;d=0;for(i=a.length;d<i;d++)a[d].width>=g&&f(c,a[d].name)}else{if("not-"===i){d=0;for(i=a.length;d<i;d++)-1===a[d].name.indexOf(g)&&f(c,a[d].name)}}else e[c].includeIn.push(d)};e.each(function(b,e){for(var d=b.className.split(" "),f=!1,j=0,l=d.length;j<l;j++){var k=c.trim(d[j]);if("all"===k){f=!0;b.includeIn=c.map(a,function(a){return a.name});
|
||||
return}if("none"===k||b.never){f=!0;return}if("control"===k){f=!0;b.control=!0;return}c.each(a,function(a,b){var d=b.name.split("-"),c=k.match(RegExp("(min\\-|max\\-|not\\-)?("+d[0]+")(\\-[_a-zA-Z0-9])?"));c&&(f=!0,c[2]===d[0]&&c[3]==="-"+d[1]?g(e,b.name,c[1],c[2]+c[3]):c[2]===d[0]&&!c[3]&&g(e,b.name,c[1],c[2]))})}f||(b.auto=!0)});this.s.columns=e},_detailsDisplay:function(b,a){var d=this,e=this.s.dt,f=this.c.details;if(f&&!1!==f.type){var g=f.display(b,a,function(){return f.renderer(e,b[0],d._detailsObj(b[0]))});
|
||||
(!0===g||!1===g)&&c(e.table().node()).triggerHandler("responsive-display.dt",[e,b,g,a])}},_detailsInit:function(){var b=this,a=this.s.dt,d=this.c.details;"inline"===d.type&&(d.target="td:first-child, th:first-child");a.on("draw.dtr",function(){b._tabIndexes()});b._tabIndexes();c(a.table().body()).on("keyup.dtr","td, th",function(b){b.keyCode===13&&c(this).data("dtr-keyboard")&&c(this).click()});var e=d.target;c(a.table().body()).on("click.dtr mousedown.dtr mouseup.dtr","string"===typeof e?e:"td, th",
|
||||
function(d){if(c(a.table().node()).hasClass("collapsed")&&c.inArray(c(this).closest("tr").get(0),a.rows().nodes().toArray())!==-1){if(typeof e==="number"){var g=e<0?a.columns().eq(0).length+e:e;if(a.cell(this).index().column!==g)return}g=a.row(c(this).closest("tr"));d.type==="click"?b._detailsDisplay(g,false):d.type==="mousedown"?c(this).css("outline","none"):d.type==="mouseup"&&c(this).blur().css("outline","")}})},_detailsObj:function(b){var a=this,d=this.s.dt;return c.map(this.s.columns,function(e,
|
||||
c){if(!e.never&&!e.control)return{title:d.settings()[0].aoColumns[c].sTitle,data:d.cell(b,c).render(a.c.orthogonal),hidden:d.column(c).visible()&&!a.s.current[c],columnIndex:c,rowIndex:b}})},_find:function(b){for(var a=this.c.breakpoints,d=0,c=a.length;d<c;d++)if(a[d].name===b)return a[d]},_redrawChildren:function(){var b=this,a=this.s.dt;a.rows({page:"current"}).iterator("row",function(c,e){a.row(e);b._detailsDisplay(a.row(e),!0)})},_resize:function(){var b=this,a=this.s.dt,d=c(l).width(),e=this.c.breakpoints,
|
||||
f=e[0].name,g=this.s.columns,h,j=this.s.current.slice();for(h=e.length-1;0<=h;h--)if(d<=e[h].width){f=e[h].name;break}var i=this._columnsVisiblity(f);this.s.current=i;e=!1;h=0;for(d=g.length;h<d;h++)if(!1===i[h]&&!g[h].never&&!g[h].control){e=!0;break}c(a.table().node()).toggleClass("collapsed",e);var k=!1;a.columns().eq(0).each(function(a,c){i[c]!==j[c]&&(k=!0,b._setColumnVis(a,i[c]))});k&&(this._redrawChildren(),c(a.table().node()).trigger("responsive-resize.dt",[a,this.s.current]))},_resizeAuto:function(){var b=
|
||||
this.s.dt,a=this.s.columns;if(this.c.auto&&-1!==c.inArray(!0,c.map(a,function(b){return b.auto}))){b.table().node();var d=b.table().node().cloneNode(!1),e=c(b.table().header().cloneNode(!1)).appendTo(d),f=c(b.table().body()).clone(!1,!1).empty().appendTo(d),g=b.columns().header().filter(function(a){return b.column(a).visible()}).to$().clone(!1).css("display","table-cell");c(f).append(c(b.rows({page:"current"}).nodes()).clone(!1)).find("th, td").css("display","");if(f=b.table().footer()){var f=c(f.cloneNode(!1)).appendTo(d),
|
||||
h=b.columns().footer().filter(function(a){return b.column(a).visible()}).to$().clone(!1).css("display","table-cell");c("<tr/>").append(h).appendTo(f)}c("<tr/>").append(g).appendTo(e);"inline"===this.c.details.type&&c(d).addClass("dtr-inline collapsed");c(d).find("[name]").removeAttr("name");d=c("<div/>").css({width:1,height:1,overflow:"hidden"}).append(d);d.insertBefore(b.table().node());g.each(function(c){c=b.column.index("fromVisible",c);a[c].minWidth=this.offsetWidth||0});d.remove()}},_setColumnVis:function(b,
|
||||
a){var d=this.s.dt,e=a?"":"none";c(d.column(b).header()).css("display",e);c(d.column(b).footer()).css("display",e);d.column(b).nodes().to$().css("display",e)},_tabIndexes:function(){var b=this.s.dt,a=b.cells({page:"current"}).nodes().to$(),d=b.settings()[0],e=this.c.details.target;a.filter("[data-dtr-keyboard]").removeData("[data-dtr-keyboard]");a="number"===typeof e?":eq("+e+")":e;"td:first-child, th:first-child"===a&&(a=">td:first-child, >th:first-child");c(a,b.rows({page:"current"}).nodes()).attr("tabIndex",
|
||||
d.iTabIndex).data("dtr-keyboard",1)}});j.breakpoints=[{name:"desktop",width:Infinity},{name:"tablet-l",width:1024},{name:"tablet-p",width:768},{name:"mobile-l",width:480},{name:"mobile-p",width:320}];j.display={childRow:function(b,a,d){if(a){if(c(b.node()).hasClass("parent"))return b.child(d(),"child").show(),!0}else{if(b.child.isShown())return b.child(!1),c(b.node()).removeClass("parent"),!1;b.child(d(),"child").show();c(b.node()).addClass("parent");return!0}},childRowImmediate:function(b,a,d){if(!a&&
|
||||
b.child.isShown()||!b.responsive.hasHidden())return b.child(!1),c(b.node()).removeClass("parent"),!1;b.child(d(),"child").show();c(b.node()).addClass("parent");return!0},modal:function(b){return function(a,d,e){if(d)c("div.dtr-modal-content").empty().append(e());else{var f=function(){g.remove();c(k).off("keypress.dtr")},g=c('<div class="dtr-modal"/>').append(c('<div class="dtr-modal-display"/>').append(c('<div class="dtr-modal-content"/>').append(e())).append(c('<div class="dtr-modal-close">×</div>').click(function(){f()}))).append(c('<div class="dtr-modal-background"/>').click(function(){f()})).appendTo("body");
|
||||
c(k).on("keyup.dtr",function(a){27===a.keyCode&&(a.stopPropagation(),f())})}b&&b.header&&c("div.dtr-modal-content").prepend("<h2>"+b.header(a)+"</h2>")}}};j.renderer={listHidden:function(){return function(b,a,d){return(b=c.map(d,function(a){return a.hidden?'<li data-dtr-index="'+a.columnIndex+'" data-dt-row="'+a.rowIndex+'" data-dt-column="'+a.columnIndex+'"><span class="dtr-title">'+a.title+'</span> <span class="dtr-data">'+a.data+"</span></li>":""}).join(""))?c('<ul data-dtr-index="'+a+'" class="dtr-details"/>').append(b):
|
||||
!1}},tableAll:function(b){b=c.extend({tableClass:""},b);return function(a,d,e){a=c.map(e,function(a){return'<tr data-dt-row="'+a.rowIndex+'" data-dt-column="'+a.columnIndex+'"><td>'+a.title+":</td> <td>"+a.data+"</td></tr>"}).join("");return c('<table class="'+b.tableClass+' dtr-details" width="100%"/>').append(a)}}};j.defaults={breakpoints:j.breakpoints,auto:!0,details:{display:j.display.childRow,renderer:j.renderer.listHidden(),target:0,type:"inline"},orthogonal:"display"};var o=c.fn.dataTable.Api;
|
||||
o.register("responsive()",function(){return this});o.register("responsive.index()",function(b){b=c(b);return{column:b.data("dtr-index"),row:b.parent().data("dtr-index")}});o.register("responsive.rebuild()",function(){return this.iterator("table",function(b){b._responsive&&b._responsive._classLogic()})});o.register("responsive.recalc()",function(){return this.iterator("table",function(b){b._responsive&&(b._responsive._resizeAuto(),b._responsive._resize())})});o.register("responsive.hasHidden()",function(){var b=
|
||||
this.context[0];return b._responsive?-1!==c.inArray(!1,b._responsive.s.current):!1});j.version="2.1.1";c.fn.dataTable.Responsive=j;c.fn.DataTable.Responsive=j;c(k).on("preInit.dt.dtr",function(b,a){if("dt"===b.namespace&&(c(a.nTable).hasClass("responsive")||c(a.nTable).hasClass("dt-responsive")||a.oInit.responsive||m.defaults.responsive)){var d=a.oInit.responsive;!1!==d&&new j(a,c.isPlainObject(d)?d:{})}});return j});
|
||||
@@ -1,114 +0,0 @@
|
||||
/*!***************************************************
|
||||
* datatables.mark.js v2.0.1
|
||||
* https://github.com/julmot/datatables.mark.js
|
||||
* Copyright (c) 2016–2017, Julian Motz
|
||||
* Released under the MIT license https://git.io/voRZ7
|
||||
*****************************************************/
|
||||
|
||||
'use strict';
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
(function (factory, window, document) {
|
||||
if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
|
||||
var jquery = require('jquery');
|
||||
require('datatables.net');
|
||||
require('mark.js/dist/jquery.mark.js');
|
||||
module.exports = factory(window, document, jquery);
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery', 'datatables.net', 'markjs'], function (jQuery) {
|
||||
return factory(window, document, jQuery);
|
||||
});
|
||||
} else {
|
||||
factory(window, document, jQuery);
|
||||
}
|
||||
})(function (window, document, $) {
|
||||
var MarkDataTables = function () {
|
||||
function MarkDataTables(dtInstance, options) {
|
||||
_classCallCheck(this, MarkDataTables);
|
||||
|
||||
if (!$.fn.mark || !$.fn.unmark) {
|
||||
throw new Error('jquery.mark.js is necessary for datatables.mark.js');
|
||||
}
|
||||
this.instance = dtInstance;
|
||||
this.options = (typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object' ? options : {};
|
||||
this.intervalThreshold = 49;
|
||||
this.intervalMs = 300;
|
||||
this.initMarkListener();
|
||||
}
|
||||
|
||||
_createClass(MarkDataTables, [{
|
||||
key: 'initMarkListener',
|
||||
value: function initMarkListener() {
|
||||
var _this = this;
|
||||
|
||||
var ev = 'draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth';
|
||||
var intvl = null;
|
||||
this.instance.on(ev, function () {
|
||||
var rows = _this.instance.rows({
|
||||
filter: 'applied',
|
||||
page: 'current'
|
||||
}).nodes().length;
|
||||
if (rows > _this.intervalThreshold) {
|
||||
clearTimeout(intvl);
|
||||
intvl = setTimeout(function () {
|
||||
_this.mark();
|
||||
}, _this.intervalMs);
|
||||
} else {
|
||||
_this.mark();
|
||||
}
|
||||
});
|
||||
this.instance.on('destroy', function () {
|
||||
_this.instance.off(ev);
|
||||
});
|
||||
this.mark();
|
||||
}
|
||||
}, {
|
||||
key: 'mark',
|
||||
value: function mark() {
|
||||
var _this2 = this;
|
||||
|
||||
var globalSearch = this.instance.search();
|
||||
$(this.instance.table().body()).unmark(this.options);
|
||||
this.instance.columns({
|
||||
search: 'applied',
|
||||
page: 'current'
|
||||
}).nodes().each(function (nodes, colIndex) {
|
||||
var columnSearch = _this2.instance.column(colIndex).search(),
|
||||
searchVal = columnSearch || globalSearch;
|
||||
if (searchVal) {
|
||||
nodes.forEach(function (node) {
|
||||
$(node).mark(searchVal, _this2.options);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return MarkDataTables;
|
||||
}();
|
||||
|
||||
$(document).on('init.dt.dth', function (event, settings) {
|
||||
if (event.namespace !== 'dt') {
|
||||
return;
|
||||
}
|
||||
|
||||
var dtInstance = $.fn.dataTable.Api(settings);
|
||||
|
||||
var options = null;
|
||||
if (dtInstance.init().mark) {
|
||||
options = dtInstance.init().mark;
|
||||
} else if ($.fn.dataTable.defaults.mark) {
|
||||
options = $.fn.dataTable.defaults.mark;
|
||||
}
|
||||
if (options === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
new MarkDataTables(dtInstance, options);
|
||||
});
|
||||
}, window, document);
|
||||
@@ -1,7 +0,0 @@
|
||||
/*!***************************************************
|
||||
* datatables.mark.js v2.0.1
|
||||
* https://github.com/julmot/datatables.mark.js
|
||||
* Copyright (c) 2016–2017, Julian Motz
|
||||
* Released under the MIT license https://git.io/voRZ7
|
||||
*****************************************************/
|
||||
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t,n){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))){var r=require("jquery");require("datatables.net"),require("mark.js/dist/jquery.mark.js"),module.exports=e(t,n,r)}else"function"==typeof define&&define.amd?define(["jquery","datatables.net","markjs"],function(r){return e(t,n,r)}):e(t,n,jQuery)}(function(e,t,n){var r=function(){function e(t,r){if(_classCallCheck(this,e),!n.fn.mark||!n.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=t,this.options="object"===(void 0===r?"undefined":_typeof(r))?r:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}return _createClass(e,[{key:"initMarkListener",value:function(){var e=this,t="draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",n=null;this.instance.on(t,function(){e.instance.rows({filter:"applied",page:"current"}).nodes().length>e.intervalThreshold?(clearTimeout(n),n=setTimeout(function(){e.mark()},e.intervalMs)):e.mark()}),this.instance.on("destroy",function(){e.instance.off(t)}),this.mark()}},{key:"mark",value:function(){var e=this,t=this.instance.search();n(this.instance.table().body()).unmark(this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(r,a){var i=e.instance.column(a).search()||t;i&&r.forEach(function(t){n(t).mark(i,e.options)})})}}]),e}();n(t).on("init.dt.dth",function(e,t){if("dt"===e.namespace){var a=n.fn.dataTable.Api(t),i=null;a.init().mark?i=a.init().mark:n.fn.dataTable.defaults.mark&&(i=n.fn.dataTable.defaults.mark),null!==i&&new r(a,i)}})},window,document);
|
||||
@@ -1,164 +0,0 @@
|
||||
/*!
|
||||
DataTables 1.10.16
|
||||
2008-2017 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
(function(h){"function"===typeof define&&define.amd?define(["jquery"],function(E){return h(E,window,document)}):"object"===typeof exports?module.exports=function(E,G){E||(E=window);G||(G="undefined"!==typeof window?require("jquery"):require("jquery")(E));return h(G,E,E.document)}:h(jQuery,window,document)})(function(h,E,G,k){function X(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),
|
||||
d[c]=e,"o"===b[1]&&X(a[e])});a._hungarianMap=d}function I(a,b,c){a._hungarianMap||X(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),I(a[d],b[d],c)):b[d]=b[e]})}function Ca(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&F(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&F(a,a,"sZeroRecords","sLoadingRecords");
|
||||
a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&cb(a)}function db(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":"");"boolean"===typeof a.scrollX&&(a.scrollX=
|
||||
a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&I(m.models.oSearch,a[b])}function eb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;"number"===typeof b&&!h.isArray(b)&&(a.aDataSort=[b])}function fb(a){if(!m.__browser){var b={};m.__browser=b;var c=h("<div/>").css({position:"fixed",top:0,left:-1*h(E).scrollLeft(),height:1,width:1,overflow:"hidden"}).append(h("<div/>").css({position:"absolute",
|
||||
top:1,left:1,width:100,overflow:"scroll"}).append(h("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,m.__browser);a.oScroll.iBarWidth=m.__browser.barWidth}function gb(a,b,c,d,e,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;d!==
|
||||
e;)a.hasOwnProperty(d)&&(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Da(a,b){var c=m.defaults.column,d=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:G.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},m.models.oSearch,c[d]);ja(a,d,h(b).data())}function ja(a,b,c){var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=
|
||||
e.attr("width")||null;var f=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(eb(c),I(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),c.sClass&&e.addClass(c.sClass),h.extend(b,c),F(b,c,"sWidth","sWidthOrig"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),F(b,c,"aDataSort"));var g=b.mData,j=Q(g),i=b.mRender?Q(b.mRender):null,c=function(a){return"string"===
|
||||
typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return R(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=
|
||||
d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function Y(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Ea(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&ka(a);r(a,null,"column-sizing",[a])}function Z(a,b){var c=la(a,"bVisible");return"number"===typeof c[b]?c[b]:null}function $(a,b){var c=
|
||||
la(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}function aa(a){var b=0;h.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==h(d.nTh).css("display")&&b++});return b}function la(a,b){var c=[];h.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Fa(a){var b=a.aoColumns,c=a.aoData,d=m.ext.type.detect,e,f,g,j,i,h,l,q,t;e=0;for(f=b.length;e<f;e++)if(l=b[e],t=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=d.length;g<j;g++){i=0;for(h=c.length;i<h;i++){t[i]===
|
||||
k&&(t[i]=B(a,i,e,"type"));q=d[g](t[i],a);if(!q&&g!==d.length-1)break;if("html"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType="string")}}function hb(a,b,c,d){var e,f,g,j,i,n,l=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){n=b[e];var q=n.targets!==k?n.targets:n.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<g;f++)if("number"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Da(a);d(q[f],n)}else if("number"===typeof q[f]&&0>q[f])d(l.length+q[f],n);else if("string"===typeof q[f]){j=0;for(i=l.length;j<
|
||||
i;j++)("_all"==q[f]||h(l[j].nTh).hasClass(q[f]))&&d(j,n)}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function M(a,b,c,d){var e=a.aoData.length,f=h.extend(!0,{},m.models.oRow,{src:c?"dom":"data",idx:e});f._aData=b;a.aoData.push(f);for(var g=a.aoColumns,j=0,i=g.length;j<i;j++)g[j].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==k&&(a.aIds[b]=f);(c||!a.oFeatures.bDeferRender)&&Ga(a,e,c,d);return e}function ma(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,e){c=Ha(a,e);return M(a,
|
||||
c.data,e,c.cells)})}function B(a,b,c,d){var e=a.iDraw,f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,i=f.fnGetData(g,d,{settings:a,row:b,col:c});if(i===k)return a.iDrawError!=e&&null===j&&(J(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j&&d!==k)i=j;else if("function"===typeof i)return i.call(g);return null===i&&"display"==d?"":i}function ib(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,
|
||||
d,{settings:a,row:b,col:c})}function Ia(a){return h.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\\./g,".")})}function Q(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=Q(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var c=function(a,
|
||||
b,f){var g,j;if(""!==f){j=Ia(f);for(var i=0,n=j.length;i<n;i++){f=j[i].match(ba);g=j[i].match(U);if(f){j[i]=j[i].replace(ba,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");if(h.isArray(a)){i=0;for(n=a.length;i<n;i++)g.push(c(a[i],b,j))}a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(U,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===k)return k;a=a[j[i]]}}return a};return function(b,e){return c(b,e,a)}}return function(b){return b[a]}}function R(a){if(h.isPlainObject(a))return R(a._);
|
||||
if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,d,e){var e=Ia(e),f;f=e[e.length-1];for(var g,j,i=0,n=e.length-1;i<n;i++){g=e[i].match(ba);j=e[i].match(U);if(g){e[i]=e[i].replace(ba,"");a[e[i]]=[];f=e.slice();f.splice(0,i+1);g=f.join(".");if(h.isArray(d)){j=0;for(n=d.length;j<n;j++)f={},b(f,d[j],g),a[e[i]].push(f)}else a[e[i]]=d;return}j&&(e[i]=e[i].replace(U,
|
||||
""),a=a[e[i]](d));if(null===a[e[i]]||a[e[i]]===k)a[e[i]]={};a=a[e[i]]}if(f.match(U))a[f.replace(U,"")](d);else a[f.replace(ba,"")]=d};return function(c,d){return b(c,d,a)}}return function(b,d){b[a]=d}}function Ja(a){return D(a.aoData,"_aData")}function na(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function oa(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===k&&a.splice(d,1)}function ca(a,b,c,d){var e=a.aoData[b],f,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);
|
||||
c.innerHTML=B(a,b,d,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===e.src)e._aData=Ha(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==k)g[d].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;Ka(a,e)}}function Ha(a,b,c,d){var e=[],f=b.firstChild,g,j,i=0,n,l=a.aoColumns,q=a._rowReadObject,d=d!==k?d:q?{}:[],t=function(a,b){if("string"===typeof a){var c=a.indexOf("@");
|
||||
-1!==c&&(c=a.substring(c+1),R(a)(d,b.getAttribute(c)))}},m=function(a){if(c===k||c===i)j=l[i],n=h.trim(a.innerHTML),j&&j._bAttrSrc?(R(j.mData._)(d,n),t(j.mData.sort,a),t(j.mData.type,a),t(j.mData.filter,a)):q?(j._setter||(j._setter=R(j.mData)),j._setter(d,n)):d[i]=n;i++};if(f)for(;f;){g=f.nodeName.toUpperCase();if("TD"==g||"TH"==g)m(f),e.push(f);f=f.nextSibling}else{e=b.anCells;f=0;for(g=e.length;f<g;f++)m(e[f])}if(b=b.firstChild?b:b.nTr)(b=b.getAttribute("id"))&&R(a.rowId)(d,b);return{data:d,cells:e}}
|
||||
function Ga(a,b,c,d){var e=a.aoData[b],f=e._aData,g=[],j,i,n,l,q;if(null===e.nTr){j=c||G.createElement("tr");e.nTr=j;e.anCells=g;j._DT_RowIndex=b;Ka(a,e);l=0;for(q=a.aoColumns.length;l<q;l++){n=a.aoColumns[l];i=c?d[l]:G.createElement(n.sCellType);i._DT_CellIndex={row:b,column:l};g.push(i);if((!c||n.mRender||n.mData!==l)&&(!h.isPlainObject(n.mData)||n.mData._!==l+".display"))i.innerHTML=B(a,b,l,"display");n.sClass&&(i.className+=" "+n.sClass);n.bVisible&&!c?j.appendChild(i):!n.bVisible&&c&&i.parentNode.removeChild(i);
|
||||
n.fnCreatedCell&&n.fnCreatedCell.call(a.oInstance,i,B(a,b,l),f,b,l)}r(a,"aoRowCreatedCallback",null,[j,f,b])}e.nTr.setAttribute("role","row")}function Ka(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?qa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function jb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===
|
||||
h("th, td",g).length,n=a.oClasses,l=a.aoColumns;i&&(e=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],d=h(f.nTh).addClass(f.sClass),i&&d.appendTo(e),a.oFeatures.bSort&&(d.addClass(f.sSortingClass),!1!==f.bSortable&&(d.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),La(a,f.nTh,b))),f.sTitle!=d[0].innerHTML&&d.html(f.sTitle),Ma(a,"header")(a,d,f,n);i&&da(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(n.sHeaderTH);h(j).find(">tr>th, >tr>td").addClass(n.sFooterTH);
|
||||
if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function ea(a,b,c){var d,e,f,g=[],j=[],i=a.aoColumns.length,n;if(b){c===k&&(c=!1);d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++)if(n=i=1,j[d][f]===k){a.appendChild(g[d][f].cell);
|
||||
for(j[d][f]=1;g[d+i]!==k&&g[d][f].cell==g[d+i][f].cell;)j[d+i][f]=1,i++;for(;g[d][f+n]!==k&&g[d][f].cell==g[d][f+n].cell;){for(c=0;c<i;c++)j[d+c][f+n]=1;n++}h(g[d][f].cell).attr("rowspan",i).attr("colspan",n)}}}}function N(a){var b=r(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,d=a.asStripeClasses,e=d.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==y(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=
|
||||
-1);var g=a._iDisplayStart,n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!kb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:n;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ga(a,l);l=q.nTr;if(0!==e){var t=d[c%e];q._sRowStripe!=t&&(h(l).removeClass(q._sRowStripe).addClass(t),q._sRowStripe=t)}r(a,"aoRowCallback",null,[l,q._aData,c,j]);b.push(l);c++}}else c=f.sZeroRecords,1==a.iDraw&&"ajax"==y(a)?c=f.sLoadingRecords:
|
||||
f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":e?d[0]:""}).append(h("<td />",{valign:"top",colSpan:aa(a),"class":a.oClasses.sRowEmpty}).html(c))[0];r(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Ja(a),g,n,i]);r(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],Ja(a),g,n,i]);d=h(a.nTBody);d.children().detach();d.append(h(b));r(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function S(a,b){var c=a.oFeatures,d=c.bFilter;
|
||||
c.bSort&&lb(a);d?fa(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;N(a);a._drawHold=!1}function mb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),d=a.oFeatures,e=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,n,l,q,k=0;k<f.length;k++){g=null;j=f[k];if("<"==j){i=h("<div/>")[0];
|
||||
n=f[k+1];if("'"==n||'"'==n){l="";for(q=2;f[k+q]!=n;)l+=f[k+q],q++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(n=l.split("."),i.id=n[0].substr(1,n[0].length-1),i.className=n[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;k+=q}e.append(i);e=h(i)}else if(">"==j)e=e.parent();else if("l"==j&&d.bPaginate&&d.bLengthChange)g=nb(a);else if("f"==j&&d.bFilter)g=ob(a);else if("r"==j&&d.bProcessing)g=pb(a);else if("t"==j)g=qb(a);else if("i"==j&&d.bInfo)g=rb(a);else if("p"==
|
||||
j&&d.bPaginate)g=sb(a);else if(0!==m.ext.feature.length){i=m.ext.feature;q=0;for(n=i.length;q<n;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),e.append(g))}c.replaceWith(e);a.nHolding=null}function da(a,b){var c=h(b).children("tr"),d,e,f,g,j,i,n,l,q,k;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<i;f++){d=c[f];for(e=d.firstChild;e;){if("TD"==e.nodeName.toUpperCase()||"TH"==e.nodeName.toUpperCase()){l=1*e.getAttribute("colspan");
|
||||
q=1*e.getAttribute("rowspan");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;n=g;k=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][n+j]={cell:e,unique:k},a[f+g].nTr=d}e=e.nextSibling}}}function ra(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],da(c,b)));for(var b=0,e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function sa(a,b,c){r(a,"aoServerParams","serverParams",[b]);if(b&&h.isArray(b)){var d={},
|
||||
e=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(e);c?(c=c[0],d[c]||(d[c]=[]),d[c].push(b.value)):d[b.name]=b.value});b=d}var f,g=a.ajax,j=a.oInstance,i=function(b){r(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var n=h.isFunction(f)?f(b,a):f,b=h.isFunction(f)&&n?n:h.extend(!0,b,n);delete g.data}n={data:b,success:function(b){var c=b.error||b.sError;c&&J(a,0,c);a.json=b;i(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c){var d=r(a,null,"xhr",
|
||||
[a,null,a.jqXHR]);-1===h.inArray(!0,d)&&("parsererror"==c?J(a,0,"Invalid JSON response",1):4===b.readyState&&J(a,0,"Ajax error",7));C(a,!1)}};a.oAjaxData=b;r(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(n,{url:g||a.sAjaxSource})):h.isFunction(g)?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(n,g)),g.data=f)}function kb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,
|
||||
!0),sa(a,tb(a),function(b){ub(a,b)}),!1):!0}function tb(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,n,l,k=V(a);g=a._iDisplayStart;i=!1!==d.bPaginate?a._iDisplayLength:-1;var t=function(a,b){j.push({name:a,value:b})};t("sEcho",a.iDraw);t("iColumns",c);t("sColumns",D(b,"sName").join(","));t("iDisplayStart",g);t("iDisplayLength",i);var pa={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:e.sSearch,regex:e.bRegex}};for(g=0;g<c;g++)n=b[g],
|
||||
l=f[g],i="function"==typeof n.mData?"function":n.mData,pa.columns.push({data:i,name:n.sName,searchable:n.bSearchable,orderable:n.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),t("mDataProp_"+g,i),d.bFilter&&(t("sSearch_"+g,l.sSearch),t("bRegex_"+g,l.bRegex),t("bSearchable_"+g,n.bSearchable)),d.bSort&&t("bSortable_"+g,n.bSortable);d.bFilter&&(t("sSearch",e.sSearch),t("bRegex",e.bRegex));d.bSort&&(h.each(k,function(a,b){pa.order.push({column:b.col,dir:b.dir});t("iSortCol_"+a,b.col);t("sSortDir_"+
|
||||
a,b.dir)}),t("iSortingCols",k.length));b=m.ext.legacy.ajax;return null===b?a.sAjaxSource?j:pa:b?j:pa}function ub(a,b){var c=ta(a,b),d=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(d){if(1*d<a.iDraw)return;a.iDraw=1*d}na(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(f,10);d=0;for(e=c.length;d<e;d++)M(a,c[d]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;N(a);a._bInitComplete||
|
||||
ua(a,b);a.bAjaxDataGet=!0;C(a,!1)}function ta(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?Q(c)(b):b}function ob(a){var b=a.oClasses,c=a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),f=function(){var b=!this.value?
|
||||
"":this.value;b!=e.sSearch&&(fa(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,N(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===y(a)?400:0,i=h("input",b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).on("keyup.DT search.DT input.DT paste.DT cut.DT",g?Na(f,g):f).on("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==G.activeElement&&i.val(e.sSearch)}catch(d){}});
|
||||
return b[0]}function fa(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Fa(a);if("ssp"!=y(a)){vb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<e.length;b++)wb(a,e[b].sSearch,b,e[b].bEscapeRegex!==k?!e[b].bEscapeRegex:e[b].bRegex,e[b].bSmart,e[b].bCaseInsensitive);xb(a)}else f(b);a.bFiltered=!0;r(a,null,"search",[a])}function xb(a){for(var b=
|
||||
m.ext.search,c=a.aiDisplay,d,e,f=0,g=b.length;f<g;f++){for(var j=[],i=0,n=c.length;i<n;i++)e=c[i],d=a.aoData[e],b[f](a,d._aFilterData,e,d._aData,i)&&j.push(e);c.length=0;h.merge(c,j)}}function wb(a,b,c,d,e,f){if(""!==b){for(var g=[],j=a.aiDisplay,d=Oa(b,d,e,f),e=0;e<j.length;e++)b=a.aoData[j[e]]._aFilterData[c],d.test(b)&&g.push(j[e]);a.aiDisplay=g}}function vb(a,b,c,d,e,f){var d=Oa(b,d,e,f),f=a.oPreviousSearch.sSearch,g=a.aiDisplayMaster,j,e=[];0!==m.ext.search.length&&(c=!0);j=yb(a);if(0>=b.length)a.aiDisplay=
|
||||
g.slice();else{if(j||c||f.length>b.length||0!==b.indexOf(f)||a.bSorted)a.aiDisplay=g.slice();b=a.aiDisplay;for(c=0;c<b.length;c++)d.test(a.aoData[b[c]]._sFilterRow)&&e.push(b[c]);a.aiDisplay=e}}function Oa(a,b,c,d){a=b?a:Pa(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',"")}).join(")(?=.*?")+").*$");return RegExp(a,d?"i":"")}function yb(a){var b=a.aoColumns,c,d,e,f,g,j,i,h,l=m.ext.type.search;c=!1;
|
||||
d=0;for(f=a.aoData.length;d<f;d++)if(h=a.aoData[d],!h._aFilterData){j=[];e=0;for(g=b.length;e<g;e++)c=b[e],c.bSearchable?(i=B(a,d,e,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(va.innerHTML=i,i=Wb?va.textContent:va.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);h._aFilterData=j;h._sFilterRow=j.join(" ");c=!0}return c}function zb(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,
|
||||
caseInsensitive:a.bCaseInsensitive}}function Ab(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function rb(a){var b=a.sTableId,c=a.aanFeatures.i,d=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Bb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",b+"_info"));return d[0]}function Bb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+
|
||||
1,e=a.fnDisplayEnd(),f=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Cb(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,d,e,f,g,j));h(b).html(j)}}function Cb(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,
|
||||
f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/e)))}function ga(a){var b,c,d=a.iInitDisplayStart,e=a.aoColumns,f;c=a.oFeatures;var g=a.bDeferLoading;if(a.bInitialised){mb(a);jb(a);ea(a,a.aoHeader);ea(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Ea(a);b=0;for(c=e.length;b<c;b++)f=e[b],f.sWidth&&(f.nTh.style.width=v(f.sWidth));r(a,null,"preInit",[a]);S(a);e=y(a);if("ssp"!=e||g)"ajax"==e?sa(a,[],function(c){var f=ta(a,c);for(b=0;b<f.length;b++)M(a,f[b]);a.iInitDisplayStart=
|
||||
d;S(a);C(a,!1);ua(a,c)},a):(C(a,!1),ua(a))}else setTimeout(function(){ga(a)},200)}function ua(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&Y(a);r(a,null,"plugin-init",[a,b]);r(a,"aoInitComplete","init",[a,b])}function Qa(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Ra(a);r(a,null,"length",[a,c])}function nb(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=e?d[0]:d,d=e?d[1]:d,e=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)e[0][g]=
|
||||
new Option("number"===typeof d[g]?a.fnFormatNumber(d[g]):d[g],f[g]);var i=h("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));h("select",i).val(a._iDisplayLength).on("change.DT",function(){Qa(a,h(this).val());N(a)});h(a.nTable).on("length.dt.DT",function(b,c,d){a===c&&h("select",i).val(d)});return i[0]}function sb(a){var b=a.sPaginationType,c=m.ext.pager[b],d="function"===typeof c,e=function(a){N(a)},
|
||||
b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;d||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),k,l=0;for(k=f.p.length;l<k;l++)Ma(a,"pageButton")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,e)},sName:"pagination"}));return b}function Sa(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===
|
||||
e?d=0:"number"===typeof b?(d=b*e,d>f&&(d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<f&&(d+=e):"last"==b?d=Math.floor((f-1)/e)*e:J(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==d;a._iDisplayStart=d;b&&(r(a,null,"page",[a]),c&&N(a));return b}function pb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",
|
||||
b?"block":"none");r(a,null,"processing",[a,b])}function qb(a){var b=h(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),n=h(b[0].cloneNode(!1)),l=b.children("tfoot");l.length||(l=null);i=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",
|
||||
{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({position:"relative",overflow:"auto",width:!d?null:v(d)}).append(b));l&&i.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",{"class":f.sScrollFootInner}).append(n.removeAttr("id").css("margin-left",
|
||||
0).append("bottom"===j?g:null).append(b.children("tfoot")))));var b=i.children(),k=b[0],f=b[1],t=l?b[2]:null;if(d)h(f).on("scroll.DT",function(){var a=this.scrollLeft;k.scrollLeft=a;l&&(t.scrollLeft=a)});h(f).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=k;a.nScrollBody=f;a.nScrollFoot=t;a.aoDrawCallback.push({fn:ka,sName:"scrolling"});return i[0]}function ka(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,b=b.iBarWidth,f=h(a.nScrollHead),g=f[0].style,j=f.children("div"),i=j[0].style,n=j.children("table"),
|
||||
j=a.nScrollBody,l=h(j),q=j.style,t=h(a.nScrollFoot).children("div"),m=t.children("table"),o=h(a.nTHead),p=h(a.nTable),s=p[0],r=s.style,u=a.nTFoot?h(a.nTFoot):null,x=a.oBrowser,T=x.bScrollOversize,Xb=D(a.aoColumns,"nTh"),O,K,P,w,Ta=[],y=[],z=[],A=[],B,C=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};K=j.scrollHeight>j.clientHeight;if(a.scrollBarVis!==K&&a.scrollBarVis!==k)a.scrollBarVis=K,Y(a);else{a.scrollBarVis=K;p.children("thead, tfoot").remove();
|
||||
u&&(P=u.clone().prependTo(p),O=u.find("tr"),P=P.find("tr"));w=o.clone().prependTo(p);o=o.find("tr");K=w.find("tr");w.find("th, td").removeAttr("tabindex");c||(q.width="100%",f[0].style.width="100%");h.each(ra(a,w),function(b,c){B=Z(a,b);c.style.width=a.aoColumns[B].sWidth});u&&H(function(a){a.style.width=""},P);f=p.outerWidth();if(""===c){r.width="100%";if(T&&(p.find("tbody").height()>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=v(p.outerWidth()-b);f=p.outerWidth()}else""!==d&&(r.width=
|
||||
v(d),f=p.outerWidth());H(C,K);H(function(a){z.push(a.innerHTML);Ta.push(v(h(a).css("width")))},K);H(function(a,b){if(h.inArray(a,Xb)!==-1)a.style.width=Ta[b]},o);h(K).height(0);u&&(H(C,P),H(function(a){A.push(a.innerHTML);y.push(v(h(a).css("width")))},P),H(function(a,b){a.style.width=y[b]},O),h(P).height(0));H(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+z[b]+"</div>";a.style.width=Ta[b]},K);u&&H(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+
|
||||
A[b]+"</div>";a.style.width=y[b]},P);if(p.outerWidth()<f){O=j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")?f+b:f;if(T&&(j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=v(O-b);(""===c||""!==d)&&J(a,1,"Possible column misalignment",6)}else O="100%";q.width=v(O);g.width=v(O);u&&(a.nScrollFoot.style.width=v(O));!e&&T&&(q.height=v(s.offsetHeight+b));c=p.outerWidth();n[0].style.width=v(c);i.width=v(c);d=p.height()>j.clientHeight||"scroll"==l.css("overflow-y");e="padding"+
|
||||
(x.bScrollbarLeft?"Left":"Right");i[e]=d?b+"px":"0px";u&&(m[0].style.width=v(c),t[0].style.width=v(c),t[0].style[e]=d?b+"px":"0px");p.children("colgroup").insertBefore(p.children("thead"));l.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)j.scrollTop=0}}function H(a,b,c){for(var d=0,e=0,f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,d):a(g,d),d++),g=g.nextSibling,j=c?j.nextSibling:null;e++}}function Ea(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,
|
||||
e=d.sY,f=d.sX,g=d.sXInner,j=c.length,i=la(a,"bVisible"),n=h("th",a.nTHead),l=b.getAttribute("width"),k=b.parentNode,t=!1,m,o,p=a.oBrowser,d=p.bScrollOversize;(m=b.style.width)&&-1!==m.indexOf("%")&&(l=m);for(m=0;m<i.length;m++)o=c[i[m]],null!==o.sWidth&&(o.sWidth=Db(o.sWidthOrig,k),t=!0);if(d||!t&&!f&&!e&&j==aa(a)&&j==n.length)for(m=0;m<j;m++)i=Z(a,m),null!==i&&(c[i].sWidth=v(n.eq(m).width()));else{j=h(b).clone().css("visibility","hidden").removeAttr("id");j.find("tbody tr").remove();var s=h("<tr/>").appendTo(j.find("tbody"));
|
||||
j.find("thead, tfoot").remove();j.append(h(a.nTHead).clone()).append(h(a.nTFoot).clone());j.find("tfoot th, tfoot td").css("width","");n=ra(a,j.find("thead")[0]);for(m=0;m<i.length;m++)o=c[i[m]],n[m].style.width=null!==o.sWidthOrig&&""!==o.sWidthOrig?v(o.sWidthOrig):"",o.sWidthOrig&&f&&h(n[m]).append(h("<div/>").css({width:o.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(m=0;m<i.length;m++)t=i[m],o=c[t],h(Eb(a,t)).clone(!1).append(o.sContentPadding).appendTo(s);h("[name]",
|
||||
j).removeAttr("name");o=h("<div/>").css(f||e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(j).appendTo(k);f&&g?j.width(g):f?(j.css("width","auto"),j.removeAttr("width"),j.width()<k.clientWidth&&l&&j.width(k.clientWidth)):e?j.width(k.clientWidth):l&&j.width(l);for(m=e=0;m<i.length;m++)k=h(n[m]),g=k.outerWidth()-k.width(),k=p.bBounding?Math.ceil(n[m].getBoundingClientRect().width):k.outerWidth(),e+=k,c[i[m]].sWidth=v(k-g);b.style.width=v(e);o.remove()}l&&(b.style.width=
|
||||
v(l));if((l||f)&&!a._reszEvt)b=function(){h(E).on("resize.DT-"+a.sInstance,Na(function(){Y(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0}function Db(a,b){if(!a)return 0;var c=h("<div/>").css("width",v(a)).appendTo(b||G.body),d=c[0].offsetWidth;c.remove();return d}function Eb(a,b){var c=Fb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h("<td/>").html(B(a,c,b,"display"))[0]:d.anCells[b]}function Fb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;f<g;f++)c=B(a,f,b,"display")+"",c=c.replace(Yb,
|
||||
""),c=c.replace(/ /g," "),c.length>d&&(d=c.length,e=f);return e}function v(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function V(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var n=[];f=function(a){a.length&&!h.isArray(a[0])?n.push(a):h.merge(n,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<n.length;a++){i=n[a][0];f=e[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=e[g].sType||
|
||||
"string",n[a]._idx===k&&(n[a]._idx=h.inArray(n[a][1],e[g].asSorting)),d.push({src:i,col:g,dir:n[a][1],index:n[a]._idx,type:j,formatter:m.ext.type.order[j+"-pre"]})}return d}function lb(a){var b,c,d=[],e=m.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;Fa(a);h=V(a);b=0;for(c=h.length;b<c;b++)j=h[b],j.formatter&&g++,Gb(a,j.col);if("ssp"!=y(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)d[i[b]]=b;g===h.length?i.sort(function(a,b){var c,e,g,j,i=h.length,k=f[a]._aSortData,m=f[b]._aSortData;for(g=
|
||||
0;g<i;g++)if(j=h[g],c=k[j.col],e=m[j.col],c=c<e?-1:c>e?1:0,0!==c)return"asc"===j.dir?c:-c;c=d[a];e=d[b];return c<e?-1:c>e?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,m=f[a]._aSortData,o=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=m[i.col],g=o[i.col],i=e[i.type+"-"+i.dir]||e["string-"+i.dir],c=i(c,g),0!==c)return c;c=d[a];g=d[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Hb(a){for(var b,c,d=a.aoColumns,e=V(a),a=a.oLanguage.oAria,f=0,g=d.length;f<g;f++){c=d[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,
|
||||
"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<e.length&&e[0].col==f?(i.setAttribute("aria-sort","asc"==e[0].dir?"ascending":"descending"),c=j[e[0].index+1]||j[0]):c=j[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",b)}}function Ua(a,b,c,d){var e=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,
|
||||
D(e,"0")),-1!==c?(b=g(e[c],!0),null===b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=f[b],e[c]._idx=b)):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);S(a);"function"==typeof d&&d(a)}function La(a,b,c,d){var e=a.aoColumns[c];Va(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Ua(a,c,b.shiftKey,d);"ssp"!==y(a)&&C(a,!1)},0)):Ua(a,c,b.shiftKey,d))})}
|
||||
function wa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;e<f;e++)g=b[e].src,h(D(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3));e=0;for(f=d.length;e<f;e++)g=d[e].src,h(D(a.aoData,"anCells",g)).addClass(c+(2>e?e+1:3))}a.aLastSort=d}function Gb(a,b){var c=a.aoColumns[b],d=m.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,$(a,b)));for(var f,g=m.ext.type.order[c.sType+"-pre"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],
|
||||
c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
|
||||
b)}}function Ib(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==
|
||||
k&&h.extend(a.oPreviousSearch,Ab(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Ab(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=m.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function J(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+
|
||||
" - ":"")+c;d&&(c+=". For more information about this error, please see https://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Jb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],
|
||||
h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Va(a,b,c){h(a).on("click.DT",b,function(b){a.blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+
|
||||
".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Ra(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ma(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ha(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,
|
||||
c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function cb(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Wa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Wa)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=
|
||||
[ya(this[m.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return m.ext.internal[a].apply(this,b)}}var m=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new s(ya(this[x.iApiIndex])):new s(this)};this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing=
|
||||
function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===k||a?b.draw(!1):(""!==d.sX||""!==d.sY)&&ka(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===k||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};
|
||||
this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===k?e.search(a,c,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==k||"td"==d||"th"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();
|
||||
return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return ya(this[x.iApiIndex])};
|
||||
this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===k||e)&&h.columns.adjust();(d===k||d)&&h.draw();return 0};this.fnVersionCheck=x.fnVersionCheck;var b=this,c=a===k,d=this.length;c&&(a={});this.oApi=this.internal=x.internal;for(var e in m.ext.internal)e&&(this[e]=Lb(e));this.each(function(){var e={},g=1<d?Jb(e,a,!0):
|
||||
a,j=0,i,e=this.getAttribute("id"),n=!1,l=m.defaults,q=h(this);if("table"!=this.nodeName.toLowerCase())J(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{db(l);eb(l.column);I(l,l,!0);I(l.column,l.column,!0);I(l,h.extend(g,q.data()));var t=m.settings,j=0;for(i=t.length;j<i;j++){var o=t[j];if(o.nTable==this||o.nTHead.parentNode==this||o.nTFoot&&o.nTFoot.parentNode==this){var s=g.bRetrieve!==k?g.bRetrieve:l.bRetrieve;if(c||s)return o.oInstance;if(g.bDestroy!==k?g.bDestroy:l.bDestroy){o.oInstance.fnDestroy();
|
||||
break}else{J(o,0,"Cannot reinitialise DataTable",3);return}}if(o.sTableId==this.id){t.splice(j,1);break}}if(null===e||""===e)this.id=e="DataTables_Table_"+m.ext._unique++;var p=h.extend(!0,{},m.models.oSettings,{sDestroyWidth:q[0].style.width,sInstance:e,sTableId:e});p.nTable=this;p.oApi=b.internal;p.oInit=g;t.push(p);p.oInstance=1===b.length?b:q.dataTable();db(g);g.oLanguage&&Ca(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=h.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);
|
||||
g=Jb(h.extend(!0,{},l),g);F(p.oFeatures,g,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));F(p,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],
|
||||
["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"]]);F(p.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);F(p.oLanguage,g,"fnInfoCallback");z(p,"aoDrawCallback",g.fnDrawCallback,"user");z(p,"aoServerParams",g.fnServerParams,"user");z(p,"aoStateSaveParams",g.fnStateSaveParams,"user");z(p,"aoStateLoadParams",g.fnStateLoadParams,"user");z(p,"aoStateLoaded",g.fnStateLoaded,"user");z(p,"aoRowCallback",
|
||||
g.fnRowCallback,"user");z(p,"aoRowCreatedCallback",g.fnCreatedRow,"user");z(p,"aoHeaderCallback",g.fnHeaderCallback,"user");z(p,"aoFooterCallback",g.fnFooterCallback,"user");z(p,"aoInitComplete",g.fnInitComplete,"user");z(p,"aoPreDrawCallback",g.fnPreDrawCallback,"user");p.rowIdFn=Q(g.rowId);fb(p);var u=p.oClasses;h.extend(u,m.ext.classes,g.oClasses);q.addClass(u.sTable);p.iInitDisplayStart===k&&(p.iInitDisplayStart=g.iDisplayStart,p._iDisplayStart=g.iDisplayStart);null!==g.iDeferLoading&&(p.bDeferLoading=
|
||||
!0,e=h.isArray(g.iDeferLoading),p._iRecordsDisplay=e?g.iDeferLoading[0]:g.iDeferLoading,p._iRecordsTotal=e?g.iDeferLoading[1]:g.iDeferLoading);var v=p.oLanguage;h.extend(!0,v,g.oLanguage);v.sUrl&&(h.ajax({dataType:"json",url:v.sUrl,success:function(a){Ca(a);I(l.oLanguage,a);h.extend(true,v,a);ga(p)},error:function(){ga(p)}}),n=!0);null===g.asStripeClasses&&(p.asStripeClasses=[u.sStripeOdd,u.sStripeEven]);var e=p.asStripeClasses,x=q.children("tbody").find("tr").eq(0);-1!==h.inArray(!0,h.map(e,function(a){return x.hasClass(a)}))&&
|
||||
(h("tbody tr",this).removeClass(e.join(" ")),p.asDestroyStripes=e.slice());e=[];t=this.getElementsByTagName("thead");0!==t.length&&(da(p.aoHeader,t[0]),e=ra(p));if(null===g.aoColumns){t=[];j=0;for(i=e.length;j<i;j++)t.push(null)}else t=g.aoColumns;j=0;for(i=t.length;j<i;j++)Da(p,e?e[j]:null);hb(p,g.aoColumnDefs,t,function(a,b){ja(p,a,b)});if(x.length){var w=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h(x[0]).children("th, td").each(function(a,b){var c=p.aoColumns[a];if(c.mData===
|
||||
a){var d=w(b,"sort")||w(b,"order"),e=w(b,"filter")||w(b,"search");if(d!==null||e!==null){c.mData={_:a+".display",sort:d!==null?a+".@data-"+d:k,type:d!==null?a+".@data-"+d:k,filter:e!==null?a+".@data-"+e:k};ja(p,a)}}})}var T=p.oFeatures,e=function(){if(g.aaSorting===k){var a=p.aaSorting;j=0;for(i=a.length;j<i;j++)a[j][1]=p.aoColumns[j].asSorting[0]}wa(p);T.bSort&&z(p,"aoDrawCallback",function(){if(p.bSorted){var a=V(p),b={};h.each(a,function(a,c){b[c.src]=c.dir});r(p,null,"order",[p,a,b]);Hb(p)}});
|
||||
z(p,"aoDrawCallback",function(){(p.bSorted||y(p)==="ssp"||T.bDeferRender)&&wa(p)},"sc");var a=q.children("caption").each(function(){this._captionSide=h(this).css("caption-side")}),b=q.children("thead");b.length===0&&(b=h("<thead/>").appendTo(q));p.nTHead=b[0];b=q.children("tbody");b.length===0&&(b=h("<tbody/>").appendTo(q));p.nTBody=b[0];b=q.children("tfoot");if(b.length===0&&a.length>0&&(p.oScroll.sX!==""||p.oScroll.sY!==""))b=h("<tfoot/>").appendTo(q);if(b.length===0||b.children().length===0)q.addClass(u.sNoFooter);
|
||||
else if(b.length>0){p.nTFoot=b[0];da(p.aoFooter,p.nTFoot)}if(g.aaData)for(j=0;j<g.aaData.length;j++)M(p,g.aaData[j]);else(p.bDeferLoading||y(p)=="dom")&&ma(p,h(p.nTBody).children("tr"));p.aiDisplay=p.aiDisplayMaster.slice();p.bInitialised=true;n===false&&ga(p)};g.bStateSave?(T.bStateSave=!0,z(p,"aoDrawCallback",xa,"state_save"),Ib(p,g,e)):e()}});b=null;return this},x,s,o,u,Xa={},Mb=/[\r\n]/g,Aa=/<.*?>/g,Zb=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,$b=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)",
|
||||
"g"),Wa=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi,L=function(a){return!a||!0===a||"-"===a?!0:!1},Nb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Ob=function(a,b){Xa[b]||(Xa[b]=RegExp(Pa(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(Xa[b],"."):a},Ya=function(a,b,c){var d="string"===typeof a;if(L(a))return!0;b&&d&&(a=Ob(a,b));c&&d&&(a=a.replace(Wa,""));return!isNaN(parseFloat(a))&&isFinite(a)},Pb=function(a,b,c){return L(a)?!0:!(L(a)||"string"===
|
||||
typeof a)?null:Ya(a.replace(Aa,""),b,c)?!0:null},D=function(a,b,c){var d=[],e=0,f=a.length;if(c!==k)for(;e<f;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<f;e++)a[e]&&d.push(a[e][b]);return d},ia=function(a,b,c,d){var e=[],f=0,g=b.length;if(d!==k)for(;f<g;f++)a[b[f]][c]&&e.push(a[b[f]][c][d]);else for(;f<g;f++)e.push(a[b[f]][c]);return e},W=function(a,b){var c=[],d;b===k?(b=0,d=a):(d=b,b=a);for(var e=b;e<d;e++)c.push(e);return c},Qb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);
|
||||
return b},qa=function(a){var b;a:{if(!(2>a.length)){b=a.slice().sort();for(var c=b[0],d=1,e=b.length;d<e;d++){if(b[d]===c){b=!1;break a}c=b[d]}}b=!0}if(b)return a.slice();b=[];var e=a.length,f,g=0,d=0;a:for(;d<e;d++){c=a[d];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b};m.util={throttle:function(a,b){var c=b!==k?b:200,d,e;return function(){var b=this,g=+new Date,j=arguments;d&&g<d+c?(clearTimeout(e),e=setTimeout(function(){d=k;a.apply(b,j)},c)):(d=g,a.apply(b,j))}},escapeRegex:function(a){return a.replace($b,
|
||||
"\\$1")}};var A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ba=/\[.*?\]$/,U=/\(\)$/,Pa=m.util.escapeRegex,va=h("<div>")[0],Wb=va.textContent!==k,Yb=/<.*?>/g,Na=m.util.throttle,Rb=[],w=Array.prototype,ac=function(a){var b,c,d=m.settings,e=h.map(d,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,e),-1!==b?[d[b]]:null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof
|
||||
h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,e);return-1!==b?d[b]:null}).toArray()};s=function(a,b){if(!(this instanceof s))return new s(a,b);var c=[],d=function(a){(a=ac(a))&&(c=c.concat(a))};if(h.isArray(a))for(var e=0,f=a.length;e<f;e++)d(a[e]);else d(a);this.context=qa(c);b&&h.merge(this,b);this.selector={rows:null,cols:null,opts:null};s.extend(this,this,Rb)};m.Api=s;h.extend(s.prototype,{any:function(){return 0!==this.count()},concat:w.concat,context:[],count:function(){return this.flatten().length},
|
||||
each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new s(b[a],this[a]):null},filter:function(a){var b=[];if(w.filter)b=w.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new s(this.context,b)},flatten:function(){var a=[];return new s(this.context,a.concat.apply(a,this.toArray()))},join:w.join,indexOf:w.indexOf||function(a,b){for(var c=b||0,
|
||||
d=this.length;c<d;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,d){var e=[],f,g,j,h,n,l=this.context,m,o,u=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);g=0;for(j=l.length;g<j;g++){var r=new s(l[g]);if("table"===b)f=c.call(r,l[g],g),f!==k&&e.push(f);else if("columns"===b||"rows"===b)f=c.call(r,l[g],this[g],g),f!==k&&e.push(f);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){o=this[g];"column-rows"===b&&(m=Ba(l[g],u.opts));h=0;for(n=o.length;h<n;h++)f=o[h],f=
|
||||
"cell"===b?c.call(r,l[g],f.row,f.column,g,h):c.call(r,l[g],f,g,h,m),f!==k&&e.push(f)}}return e.length||d?(a=new s(l,a?e.concat.apply([],e):e),b=a.selector,b.rows=u.rows,b.cols=u.cols,b.opts=u.opts,a):this},lastIndexOf:w.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(w.map)b=w.map.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new s(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},
|
||||
pop:w.pop,push:w.push,reduce:w.reduce||function(a,b){return gb(this,a,b,0,this.length,1)},reduceRight:w.reduceRight||function(a,b){return gb(this,a,b,this.length-1,-1,-1)},reverse:w.reverse,selector:null,shift:w.shift,slice:function(){return new s(this.context,this)},sort:w.sort,splice:w.splice,toArray:function(){return w.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},unique:function(){return new s(this.context,qa(this))},unshift:w.unshift});s.extend=function(a,
|
||||
b,c){if(c.length&&b&&(b instanceof s||b.__dt_wrapper)){var d,e,f,g=function(a,b,c){return function(){var d=b.apply(a,arguments);s.extend(d,d,c.methodExt);return d}};d=0;for(e=c.length;d<e;d++)f=c[d],b[f.name]="function"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,s.extend(a,b[f.name],f.propExt)}};s.register=o=function(a,b){if(h.isArray(a))for(var c=0,d=a.length;c<d;c++)s.register(a[c],b);else for(var e=a.split("."),f=Rb,g,j,c=0,d=e.length;c<d;c++){g=(j=-1!==
|
||||
e[c].indexOf("()"))?e[c].replace("()",""):e[c];var i;a:{i=0;for(var n=f.length;i<n;i++)if(f[i].name===g){i=f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===d-1?i.val=b:f=j?i.methodExt:i.propExt}};s.registerPlural=u=function(a,b,c){s.register(a,c);s.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof s?a.length?h.isArray(a[0])?new s(a.context,a[0]):a[0]:k:a})};o("tables()",function(a){var b;if(a){b=s;var c=this.context;if("number"===
|
||||
typeof a)a=[c[a]];else var d=h.map(c,function(a){return a.nTable}),a=h(d).filter(a).map(function(){var a=h.inArray(this,d);return c[a]}).toArray();b=new b(a)}else b=this;return b});o("table()",function(a){var a=this.tables(a),b=a.context;return b.length?new s(b[0]):a});u("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});u("tables().body()","table().body()",function(){return this.iterator("table",function(a){return a.nTBody},1)});u("tables().header()",
|
||||
"table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});u("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});u("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});o("draw()",function(a){return this.iterator("table",function(b){"page"===a?N(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),S(b,!1===a))})});o("page()",function(a){return a===
|
||||
k?this.page.info().page:this.iterator("table",function(b){Sa(b,a)})});o("page.info()",function(){if(0===this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,serverSide:"ssp"===y(a)}});o("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:
|
||||
k:this.iterator("table",function(b){Qa(b,a)})});var Sb=function(a,b,c){if(c){var d=new s(a);d.one("draw",function(){c(d.ajax.json())})}if("ssp"==y(a))S(a,b);else{C(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();sa(a,[],function(c){na(a);for(var c=ta(a,c),d=0,e=c.length;d<e;d++)M(a,c[d]);S(a,b);C(a,!1)})}};o("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});o("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});o("ajax.reload()",function(a,
|
||||
b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});o("ajax.url()",function(a){var b=this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});o("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});var Za=function(a,b,c,d,e){var f=[],g,j,i,n,l,m;i=typeof b;if(!b||"string"===i||"function"===
|
||||
i||b.length===k)b=[b];i=0;for(n=b.length;i<n;i++){j=b[i]&&b[i].split&&!b[i].match(/[\[\(:]/)?b[i].split(","):[b[i]];l=0;for(m=j.length;l<m;l++)(g=c("string"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&(f=f.concat(g))}a=x.selector[a];if(a.length){i=0;for(n=a.length;i<n;i++)f=a[i](d,e,f)}return qa(f)},$a=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:"none",order:"current",page:"all"},a)},ab=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=
|
||||
a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ba=function(a,b){var c,d,e,f=[],g=a.aiDisplay;c=a.aiDisplayMaster;var j=b.search;d=b.order;e=b.page;if("ssp"==y(a))return"removed"===j?[]:W(0,c.length);if("current"==e){c=a._iDisplayStart;for(d=a.fnDisplayEnd();c<d;c++)f.push(g[c])}else if("current"==d||"applied"==d)f="none"==j?c.slice():"applied"==j?g.slice():h.map(c,function(a){return-1===h.inArray(a,g)?a:null});else if("index"==d||"original"==d){c=0;for(d=a.aoData.length;c<
|
||||
d;c++)"none"==j?f.push(c):(e=h.inArray(c,g),(-1===e&&"removed"==j||0<=e&&"applied"==j)&&f.push(c))}return f};o("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=$a(b),c=this.iterator("table",function(c){var e=b,f;return Za("row",a,function(a){var b=Nb(a);if(b!==null&&!e)return[b];f||(f=Ba(c,e));if(b!==null&&h.inArray(b,f)!==-1)return[b];if(a===null||a===k||a==="")return f;if(typeof a==="function")return h.map(f,function(b){var e=c.aoData[b];return a(b,e._aData,e.nTr)?b:null});
|
||||
b=Qb(ia(c.aoData,f,"nTr"));if(a.nodeName){if(a._DT_RowIndex!==k)return[a._DT_RowIndex];if(a._DT_CellIndex)return[a._DT_CellIndex.row];b=h(a).closest("*[data-dt-row]");return b.length?[b.data("dt-row")]:[]}if(typeof a==="string"&&a.charAt(0)==="#"){var i=c.aIds[a.replace(/^#/,"")];if(i!==k)return[i.idx]}return h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},c,e)},1);c.selector.rows=a;c.selector.opts=b;return c});o("rows().nodes()",function(){return this.iterator("row",function(a,
|
||||
b){return a.aoData[b].nTr||k},1)});o("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ia(a.aoData,b,"_aData")},1)});u("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var d=b.aoData[c];return"search"===a?d._aFilterData:d._aSortData},1)});u("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ca(b,c,a)})});u("rows().indexes()","row().index()",function(){return this.iterator("row",function(a,
|
||||
b){return b},1)});u("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var f=0,g=this[d].length;f<g;f++){var h=c[d].rowIdFn(c[d].aoData[this[d][f]]._aData);b.push((!0===a?"#":"")+h)}return new s(c,b)});u("rows().remove()","row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,f=e[c],g,h,i,n,l;e.splice(c,1);g=0;for(h=e.length;g<h;g++)if(i=e[g],l=i.anCells,null!==i.nTr&&(i.nTr._DT_RowIndex=g),null!==l){i=0;for(n=l.length;i<
|
||||
n;i++)l[i]._DT_CellIndex.row=g}oa(b.aiDisplayMaster,c);oa(b.aiDisplay,c);oa(a[d],c,!1);0<b._iRecordsDisplay&&b._iRecordsDisplay--;Ra(b);c=b.rowIdFn(f._aData);c!==k&&delete b.aIds[c]});this.iterator("table",function(a){for(var c=0,d=a.aoData.length;c<d;c++)a.aoData[c].idx=c});return this});o("rows.add()",function(a){var b=this.iterator("table",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(ma(b,c)[0]):h.push(M(b,c));return h},1),c=this.rows(-1);
|
||||
c.pop();h.merge(c,b);return c});o("row()",function(a,b){return ab(this.rows(a,b))});o("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;b[0].aoData[this[0]]._aData=a;ca(b[0],this[0],"data");return this});o("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});o("row.add()",function(a){a instanceof h&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&
|
||||
"TR"===a.nodeName.toUpperCase()?ma(b,a)[0]:M(b,a)});return this.row(b[0])});var bb=function(a,b){var c=a.context;if(c.length&&(c=c[0].aoData[b!==k?b:a[0]])&&c._details)c._details.remove(),c._detailsShow=k,c._details=k},Tb=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];if(d._details){(d._detailsShow=b)?d._details.insertAfter(d.nTr):d._details.detach();var e=c[0],f=new s(e),g=e.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<D(g,
|
||||
"_details").length&&(f.on("draw.dt.DT_details",function(a,b){e===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(e===b)for(var c,d=aa(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",d)}),f.on("destroy.dt.DT_details",function(a,b){if(e===b)for(var c=0,d=g.length;c<d;c++)g[c]._details&&bb(f,c)}))}}};o("row().child()",function(a,b){var c=this.context;
|
||||
if(a===k)return c.length&&this.length?c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)bb(this);else if(c.length&&this.length){var d=c[0],c=c[0].aoData[this[0]],e=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&"tr"===a.nodeName.toLowerCase()?e.push(a):(c=h("<tr><td/></tr>").addClass(b),h("td",c).addClass(b).html(a)[0].colSpan=aa(d),e.push(c[0]))};f(a,b);c._details&&c._details.detach();c._details=h(e);c._detailsShow&&
|
||||
c._details.insertAfter(c.nTr)}return this});o(["row().child.show()","row().child().show()"],function(){Tb(this,!0);return this});o(["row().child.hide()","row().child().hide()"],function(){Tb(this,!1);return this});o(["row().child.remove()","row().child().remove()"],function(){bb(this);return this});o("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var bc=/^([^:]+):(name|visIdx|visible)$/,Ub=function(a,b,c,d,e){for(var c=
|
||||
[],d=0,f=e.length;d<f;d++)c.push(B(a,e[d],b));return c};o("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=$a(b),c=this.iterator("table",function(c){var e=a,f=b,g=c.aoColumns,j=D(g,"sName"),i=D(g,"nTh");return Za("column",e,function(a){var b=Nb(a);if(a==="")return W(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var e=Ba(c,f);return h.map(g,function(b,f){return a(f,Ub(c,f,0,0,e),i[f])?f:null})}var k=typeof a==="string"?a.match(bc):"";if(k)switch(k[2]){case "visIdx":case "visible":b=
|
||||
parseInt(k[1],10);if(b<0){var m=h.map(g,function(a,b){return a.bVisible?b:null});return[m[m.length+b]]}return[Z(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null});default:return[]}if(a.nodeName&&a._DT_CellIndex)return[a._DT_CellIndex.column];b=h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray();if(b.length||!a.nodeName)return b;b=h(a).closest("*[data-dt-column]");return b.length?[b.data("dt-column")]:[]},c,f)},1);c.selector.cols=a;c.selector.opts=b;return c});u("columns().header()",
|
||||
"column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});u("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});u("columns().data()","column().data()",function(){return this.iterator("column-rows",Ub,1)});u("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});u("columns().cache()","column().cache()",
|
||||
function(a){return this.iterator("column-rows",function(b,c,d,e,f){return ia(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});u("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return ia(a.aoData,e,"anCells",b)},1)});u("columns().visible()","column().visible()",function(a,b){var c=this.iterator("column",function(b,c){if(a===k)return b.aoColumns[c].bVisible;var f=b.aoColumns,g=f[c],j=b.aoData,i,n,l;if(a!==k&&g.bVisible!==a){if(a){var m=
|
||||
h.inArray(!0,D(f,"bVisible"),c+1);i=0;for(n=j.length;i<n;i++)l=j[i].nTr,f=j[i].anCells,l&&l.insertBefore(f[c],f[m]||null)}else h(D(b.aoData,"anCells",c)).detach();g.bVisible=a;ea(b,b.aoHeader);ea(b,b.aoFooter);xa(b)}});a!==k&&(this.iterator("column",function(c,e){r(c,null,"column-visibility",[c,e,a,b])}),(b===k||b)&&this.columns.adjust());return c});u("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===a?$(b,c):c},1)});o("columns.adjust()",
|
||||
function(){return this.iterator("table",function(a){Y(a)},1)});o("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return Z(c,b);if("fromData"===a||"toVisible"===a)return $(c,b)}});o("column()",function(a,b){return ab(this.columns(a,b))});o("cells()",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",function(b){var d=a,e=$a(c),f=
|
||||
b.aoData,g=Ba(b,e),j=Qb(ia(f,g,"anCells")),i=h([].concat.apply([],j)),l,n=b.aoColumns.length,m,o,u,s,r,v;return Za("cell",d,function(a){var c=typeof a==="function";if(a===null||a===k||c){m=[];o=0;for(u=g.length;o<u;o++){l=g[o];for(s=0;s<n;s++){r={row:l,column:s};if(c){v=f[l];a(r,B(b,l,s),v.anCells?v.anCells[s]:null)&&m.push(r)}else m.push(r)}}return m}if(h.isPlainObject(a))return[a];c=i.filter(a).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||
|
||||
!a.nodeName)return c;v=h(a).closest("*[data-dt-row]");return v.length?[{row:v.data("dt-row"),column:v.data("dt-column")}]:[]},b,e)});var d=this.columns(b,c),e=this.rows(a,c),f,g,j,i,n,l=this.iterator("table",function(a,b){f=[];g=0;for(j=e[b].length;g<j;g++){i=0;for(n=d[b].length;i<n;i++)f.push({row:e[b][g],column:d[b][i]})}return f},1);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});u("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&
|
||||
a.anCells?a.anCells[c]:k},1)});o("cells().data()",function(){return this.iterator("cell",function(a,b,c){return B(a,b,c)},1)});u("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});u("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,d){return B(b,c,d,a)},1)});u("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,
|
||||
b,c){return{row:b,column:c,columnVisible:$(a,c)}},1)});u("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){ca(b,c,a,d)})});o("cell()",function(a,b,c){return ab(this.cells(a,b,c))});o("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?B(b[0],c[0].row,c[0].column):k;ib(b[0],c[0].row,c[0].column,a);ca(b[0],c[0].row,"data",c[0].column);return this});o("order()",function(a,b){var c=this.context;if(a===k)return 0!==
|
||||
c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:a.length&&!h.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});o("order.listener()",function(a,b,c){return this.iterator("table",function(d){La(d,a,b,c)})});o("order.fixed()",function(a){if(!a){var b=this.context,b=b.length?b[0].aaSortingFixed:k;return h.isArray(b)?{pre:b}:b}return this.iterator("table",function(b){b.aaSortingFixed=h.extend(!0,{},a)})});o(["columns().order()",
|
||||
"column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];h.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});o("search()",function(a,b,c,d){var e=this.context;return a===k?0!==e.length?e[0].oPreviousSearch.sSearch:k:this.iterator("table",function(e){e.oFeatures.bFilter&&fa(e,h.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});u("columns().search()","column().search()",function(a,
|
||||
b,c,d){return this.iterator("column",function(e,f){var g=e.aoPreSearchCols;if(a===k)return g[f].sSearch;e.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),fa(e,e.oPreviousSearch,1))})});o("state()",function(){return this.context.length?this.context[0].oSavedState:null});o("state.clear()",function(){return this.iterator("table",function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});o("state.loaded()",function(){return this.context.length?
|
||||
this.context[0].oLoadedState:null});o("state.save()",function(){return this.iterator("table",function(a){xa(a)})});m.versionCheck=m.fnVersionCheck=function(a){for(var b=m.version.split("."),a=a.split("."),c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};m.isDataTable=m.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;if(a instanceof m.Api)return!0;h.each(m.settings,function(a,e){var f=e.nScrollHead?h("table",e.nScrollHead)[0]:null,g=e.nScrollFoot?
|
||||
h("table",e.nScrollFoot)[0]:null;if(e.nTable===b||f===b||g===b)c=!0});return c};m.tables=m.fnTables=function(a){var b=!1;h.isPlainObject(a)&&(b=a.api,a=a.visible);var c=h.map(m.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable});return b?new s(c):c};m.camelToHungarian=I;o("$()",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){o(b+"()",function(){var a=Array.prototype.slice.call(arguments);
|
||||
a[0]=h.map(a[0].split(/\s/),function(a){return!a.match(/\.dt\b/)?a+".dt":a}).join(" ");var d=h(this.tables().nodes());d[b].apply(d,a);return this})});o("clear()",function(){return this.iterator("table",function(a){na(a)})});o("settings()",function(){return new s(this.context,this.context)});o("init()",function(){var a=this.context;return a.length?a[0].oInit:null});o("data()",function(){return this.iterator("table",function(a){return D(a.aoData,"_aData")}).flatten()});o("destroy()",function(a){a=a||
|
||||
!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),o;b.bDestroying=!0;r(b,"aoDestroyCallback","destroy",[b]);a||(new s(b)).columns().visible(!0);k.off(".DT").find(":not(tbody *)").off(".DT");h(E).off(".DT-"+b.sInstance);e!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&e!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));
|
||||
b.aaSorting=[];b.aaSortingFixed=[];wa(b);h(l).removeClass(b.asStripeClasses.join(" "));h("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);f.children().detach();f.append(l);g=a?"remove":"detach";i[g]();k[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),i.css("width",b.sDestroyWidth).removeClass(d.sTable),(o=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%o])}));c=h.inArray(b,m.settings);-1!==c&&m.settings.splice(c,
|
||||
1)})});h.each(["column","row","cell"],function(a,b){o(b+"s().every()",function(a){var d=this.selector.opts,e=this;return this.iterator(b,function(f,g,h,i,n){a.call(e[b](g,"cell"===b?h:d,"cell"===b?d:k),g,h,i,n)})})});o("i18n()",function(a,b,c){var d=this.context[0],a=Q(a)(d.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:a._);return a.replace("%d",c)});m.version="1.10.16";m.settings=[];m.models={};m.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};m.models.oRow=
|
||||
{nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};m.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,
|
||||
sWidthOrig:null};m.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
|
||||
this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+
|
||||
"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",
|
||||
sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},m.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};
|
||||
X(m.defaults);m.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};X(m.defaults.column);m.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,
|
||||
bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],
|
||||
aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,fnServerData:null,
|
||||
aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==y(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,
|
||||
b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};m.ext=x={buttons:{},classes:{},builder:"-source-",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},
|
||||
order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:m.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:m.version};h.extend(x,{afnFiltering:x.search,aTypes:x.type.detect,ofnSearch:x.type.search,oSort:x.type.order,afnSortData:x.order,aoFeatures:x.feature,oApi:x.internal,oStdClasses:x.classes,oPagination:x.pager});h.extend(m.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",
|
||||
sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",
|
||||
sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var Kb=m.ext.pager;h.extend(Kb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},numbers:function(a,b){return[ha(a,
|
||||
b)]},simple_numbers:function(a,b){return["previous",ha(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ha(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",ha(a,b),"last"]},_numbers:ha,numbers_length:7});h.extend(!0,m.ext.renderer,{pageButton:{_:function(a,b,c,d,e,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i=a.oLanguage.oAria.paginate||{},n,l,m=0,o=function(b,d){var k,s,u,r,v=function(b){Sa(a,b.data.action,true)};k=0;for(s=d.length;k<s;k++){r=d[k];if(h.isArray(r)){u=
|
||||
h("<"+(r.DT_el||"div")+"/>").appendTo(b);o(u,r)}else{n=null;l="";switch(r){case "ellipsis":b.append('<span class="ellipsis">…</span>');break;case "first":n=j.sFirst;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "previous":n=j.sPrevious;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "next":n=j.sNext;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;case "last":n=j.sLast;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;default:n=r+1;l=e===r?g.sPageButtonActive:""}if(n!==null){u=h("<a>",{"class":g.sPageButton+
|
||||
" "+l,"aria-controls":a.sTableId,"aria-label":i[r],"data-dt-idx":m,tabindex:a.iTabIndex,id:c===0&&typeof r==="string"?a.sTableId+"_"+r:null}).html(n).appendTo(b);Va(u,{action:r},v);m++}}}},s;try{s=h(b).find(G.activeElement).data("dt-idx")}catch(u){}o(h(b).empty(),d);s!==k&&h(b).find("[data-dt-idx="+s+"]").focus()}}});h.extend(m.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Ya(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&!Zb.test(a))return null;var b=Date.parse(a);
|
||||
return null!==b&&!isNaN(b)||L(a)?"date":null},function(a,b){var c=b.oLanguage.sDecimal;return Ya(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c,!0)?"html-num-fmt"+c:null},function(a){return L(a)||"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(m.ext.type.search,{html:function(a){return L(a)?a:"string"===typeof a?a.replace(Mb," ").replace(Aa,""):""},string:function(a){return L(a)?
|
||||
a:"string"===typeof a?a.replace(Mb," "):a}});var za=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Ob(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};h.extend(x.type.order,{"date-pre":function(a){return Date.parse(a)||-Infinity},"html-pre":function(a){return L(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return L(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<
|
||||
b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});cb("");h.extend(!0,m.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass)}})},jqueryui:function(a,b,c,d){h("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);
|
||||
h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass);b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass(h[e]=="asc"?d.sSortJUIAsc:h[e]=="desc"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});var Vb=function(a){return"string"===typeof a?a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,
|
||||
"""):a};m.render={number:function(a,b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return Vb(f);h=h.toFixed(c);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+f+(e||"")}}},text:function(){return{display:Vb}}};h.extend(m.ext.internal,{_fnExternApiFunc:Lb,_fnBuildAjax:sa,_fnAjaxUpdate:kb,_fnAjaxParameters:tb,_fnAjaxUpdateDraw:ub,
|
||||
_fnAjaxDataSrc:ta,_fnAddColumn:Da,_fnColumnOptions:ja,_fnAdjustColumnSizing:Y,_fnVisibleToColumnIndex:Z,_fnColumnIndexToVisible:$,_fnVisbleColumns:aa,_fnGetColumns:la,_fnColumnTypes:Fa,_fnApplyColumnDefs:hb,_fnHungarianMap:X,_fnCamelToHungarian:I,_fnLanguageCompat:Ca,_fnBrowserDetect:fb,_fnAddData:M,_fnAddTr:ma,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:B,_fnSetCellData:ib,
|
||||
_fnSplitObjNotation:Ia,_fnGetObjectDataFn:Q,_fnSetObjectDataFn:R,_fnGetDataMaster:Ja,_fnClearTable:na,_fnDeleteIndex:oa,_fnInvalidate:ca,_fnGetRowElements:Ha,_fnCreateTr:Ga,_fnBuildHead:jb,_fnDrawHead:ea,_fnDraw:N,_fnReDraw:S,_fnAddOptionsHtml:mb,_fnDetectHeader:da,_fnGetUniqueThs:ra,_fnFeatureHtmlFilter:ob,_fnFilterComplete:fa,_fnFilterCustom:xb,_fnFilterColumn:wb,_fnFilter:vb,_fnFilterCreateSearch:Oa,_fnEscapeRegex:Pa,_fnFilterData:yb,_fnFeatureHtmlInfo:rb,_fnUpdateInfo:Bb,_fnInfoMacros:Cb,_fnInitialise:ga,
|
||||
_fnInitComplete:ua,_fnLengthChange:Qa,_fnFeatureHtmlLength:nb,_fnFeatureHtmlPaginate:sb,_fnPageChange:Sa,_fnFeatureHtmlProcessing:pb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:qb,_fnScrollDraw:ka,_fnApplyToChildren:H,_fnCalculateColumnWidths:Ea,_fnThrottle:Na,_fnConvertToWidth:Db,_fnGetWidestNode:Eb,_fnGetMaxLenString:Fb,_fnStringToCss:v,_fnSortFlatten:V,_fnSort:lb,_fnSortAria:Hb,_fnSortListener:Ua,_fnSortAttachListener:La,_fnSortingClasses:wa,_fnSortData:Gb,_fnSaveState:xa,_fnLoadState:Ib,_fnSettingsFromNode:ya,
|
||||
_fnLog:J,_fnMap:F,_fnBindAction:Va,_fnCallbackReg:z,_fnCallbackFire:r,_fnLengthOverflow:Ra,_fnRenderer:Ma,_fnDataSource:y,_fnRowAttributes:Ka,_fnCalculateEnd:function(){}});h.fn.dataTable=m;m.$=h;h.fn.dataTableSettings=m.settings;h.fn.dataTableExt=m.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(m,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});
|
||||
@@ -1,20 +0,0 @@
|
||||
Copyright (c) 2008-2015 SpryMedia Limited
|
||||
https://datatables.net
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 471 B |
|
Before Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 427 B |
|
Before Width: | Height: | Size: 405 B |
@@ -1,920 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Test for restore_network()
|
||||
define( 'TEST_RESTORE_NETWORK', FALSE );
|
||||
define( 'TEST_NETWORK_BLOG_COUNT', 30 );
|
||||
|
||||
class IP_Geo_Block_Admin_Ajax {
|
||||
|
||||
/**
|
||||
* Admin ajax sub functions
|
||||
*
|
||||
* @param string $which name of the geolocation api provider (should be validated by whitelist)
|
||||
*/
|
||||
public static function search_ip( $which ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-lkup.php';
|
||||
|
||||
// check format
|
||||
if ( filter_var( $ip = trim( $_POST['ip'] ), FILTER_VALIDATE_IP ) ) {
|
||||
// get option settings and compose request headers
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$tmp = IP_Geo_Block::get_request_headers( $options );
|
||||
|
||||
// create object for provider and get location
|
||||
if ( $geo = IP_Geo_Block_API::get_instance( $which, $options ) )
|
||||
$res = $geo->get_location( $ip, $tmp );
|
||||
else
|
||||
$res = array( 'errorMessage' => 'Unknown service.' );
|
||||
} else {
|
||||
$res = array( 'errorMessage' => 'Invalid IP address.' );
|
||||
}
|
||||
|
||||
if ( empty( $res['errorMessage'] ) ) {
|
||||
if ( $geo = IP_Geo_Block_API::get_instance( 'Maxmind', $options ) ) {
|
||||
$tmp = microtime( TRUE );
|
||||
$geo = $geo->get_location( $ip, array( 'ASN' => TRUE ) );
|
||||
$tmp = microtime( TRUE ) - $tmp;
|
||||
|
||||
$res['AS number'] = isset( $geo['ASN'] ) ? esc_html( $geo['ASN'] ) : '';
|
||||
$res['AS number'] .= sprintf( ' (%.1f [msec])', $tmp * 1000.0 );
|
||||
}
|
||||
|
||||
$tmp = microtime( TRUE );
|
||||
$res['host (DNS)'] = esc_html( IP_Geo_Block_Lkup::gethostbyaddr( $ip ) );
|
||||
$tmp = microtime( TRUE ) - $tmp;
|
||||
$res['host (DNS)'] .= sprintf( ' (%.1f [msec])', $tmp * 1000.0 );
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get country code from providers
|
||||
*
|
||||
* @param string $which 'ip_client' or 'ip_server' (not in use)
|
||||
*/
|
||||
public static function scan_country( $which ) {
|
||||
// scan all the country code using selected APIs
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$ip = IP_Geo_Block::get_ip_address();
|
||||
$args = IP_Geo_Block::get_request_headers( $options );
|
||||
$type = IP_Geo_Block_Provider::get_providers( 'type', FALSE, FALSE );
|
||||
$providers = IP_Geo_Block_Provider::get_valid_providers( $options, FALSE, FALSE );
|
||||
|
||||
$res['IP address'] = esc_html( $ip );
|
||||
|
||||
foreach ( $providers as $provider ) {
|
||||
if ( $geo = IP_Geo_Block_API::get_instance( $provider, $options ) ) {
|
||||
$ret = $geo->get_location( $ip, $args );
|
||||
$res[ $provider ] = array(
|
||||
'type' => $type[ $provider ],
|
||||
'code' => esc_html(
|
||||
FALSE === $ret ? __( 'n/a', 'ip-geo-block' ) : (
|
||||
! empty( $ret['errorMessage'] ) ? $ret['errorMessage'] : (
|
||||
! empty( $ret['countryCode' ] ) ? $ret['countryCode' ] :
|
||||
__( 'n/a', 'ip-geo-block' ) ) )
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert array
|
||||
*
|
||||
*/
|
||||
private static function array_insert( &$base_array, $insert_value, $position = null ) {
|
||||
if ( ! is_array( $insert_value ) )
|
||||
$insert_value = array( $insert_value );
|
||||
|
||||
$position = is_null( $position ) ? count( $base_array ) : intval( $position );
|
||||
$base_array = array_merge( array_splice( $base_array, 0, $position ), $insert_value, $base_array );
|
||||
}
|
||||
|
||||
/**
|
||||
* Export logs from MySQL DB
|
||||
*
|
||||
* @param string $which 'comment', 'xmlrpc', 'login', 'admin' or 'public'
|
||||
*/
|
||||
public static function export_logs( $which ) {
|
||||
$csv = '#';
|
||||
$time = $_SERVER['REQUEST_TIME'];
|
||||
|
||||
$csv .= implode( ',', array(
|
||||
__( 'Time', 'ip-geo-block' ),
|
||||
__( 'IP address', 'ip-geo-block' ),
|
||||
__( 'Code', 'ip-geo-block' ),
|
||||
__( 'ASN', 'ip-geo-block' ),
|
||||
__( 'Target', 'ip-geo-block' ),
|
||||
__( 'Result', 'ip-geo-block' ),
|
||||
__( 'Request', 'ip-geo-block' ),
|
||||
__( 'User agent', 'ip-geo-block' ),
|
||||
__( 'HTTP headers', 'ip-geo-block' ),
|
||||
__( '$_POST data', 'ip-geo-block' ),
|
||||
) ) . PHP_EOL;
|
||||
|
||||
foreach ( IP_Geo_Block_Logs::restore_logs( $which ) as $data ) {
|
||||
$hook = array_shift( $data ); // remove `No`
|
||||
$hook = array_shift( $data ); // extract `hook`
|
||||
self::array_insert( $data, $hook, 3 );
|
||||
$data[0] = IP_Geo_Block_Util::localdate( $data[0], 'Y-m-d H:i:s' );
|
||||
$data[7] = str_replace( ',', '‚', $data[7] ); // , --> ‚
|
||||
$data[8] = str_replace( ',', '‚', $data[8] ); // , --> ‚
|
||||
$data[9] = str_replace( ',', '‚', $data[9] ); // , --> ‚
|
||||
$csv .= implode( ',', $data ) . PHP_EOL;
|
||||
}
|
||||
|
||||
// Send as file
|
||||
header( 'Content-Description: File Transfer' );
|
||||
header( 'Content-Type: application/octet-stream' );
|
||||
header( 'Content-Disposition: attachment; filename="' . IP_Geo_Block::PLUGIN_NAME . '_' . IP_Geo_Block_Util::localdate( $time, 'Y-m-d_H-i-s' ) . '.csv"' );
|
||||
header( 'Pragma: public' );
|
||||
header( 'Expires: 0' );
|
||||
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
|
||||
header( 'Content-Length: ' . strlen( $csv ) );
|
||||
echo $csv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format logs from rows array
|
||||
*
|
||||
*/
|
||||
private static function format_logs( $rows ) {
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$res = array();
|
||||
|
||||
foreach ( $rows as $row ) {
|
||||
array_shift( $row ); // remove `No`
|
||||
$row = array_map( 'esc_html', $row );
|
||||
|
||||
if ( $options['anonymize'] && FALSE === strpos( $row[2], '***' ) ) {
|
||||
$row[2] = IP_Geo_Block_Util::anonymize_ip( $row[2], TRUE );
|
||||
$row[8] = IP_Geo_Block_Util::anonymize_ip( $row[8], FALSE );
|
||||
}
|
||||
|
||||
$res[] = array(
|
||||
/* 0 Checkbox */ '',
|
||||
/* 1 Time (raw) */ $row[1],
|
||||
/* 2 Date */ '’' . IP_Geo_Block_Util::localdate( $row[1], 'y-m-d H:i:s' ),
|
||||
/* 3 IP address */ '<span><a href="#!">' . $row[2] . '</a></span>',
|
||||
/* 4 Country code */ '<span>' . $row[3] . '</span>',
|
||||
/* 5 AS number */ '<span>' . $row[5] . '</span>',
|
||||
/* 6 Target */ '<span>' . $row[0] . '</span>',
|
||||
/* 7 Status */ '<span>' . $row[4] . '</span>',
|
||||
/* 8 Request */ '<span>' . $row[6] . '</span>',
|
||||
/* 9 User agent */ '<span>' . $row[7] . '</span>',
|
||||
/* 10 HTTP headers */ '<span>' . $row[8] . '</span>',
|
||||
/* 11 $_POST data */ '<span>' . $row[9] . '</span>',
|
||||
);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore logs from MySQL DB
|
||||
*
|
||||
* @param string $which 'comment', 'xmlrpc', 'login', 'admin' or 'public'
|
||||
*/
|
||||
public static function restore_logs( $which ) {
|
||||
return array( 'data' => self::format_logs(
|
||||
apply_filters( IP_Geo_Block::PLUGIN_NAME . '-logs', IP_Geo_Block_Logs::restore_logs( $which ) )
|
||||
) ); // DataTables requires `data`
|
||||
}
|
||||
|
||||
/**
|
||||
* Catch and release the authority for live log
|
||||
*
|
||||
* @return TRUE or WP_Error
|
||||
*/
|
||||
public static function catch_live_log() {
|
||||
$user = IP_Geo_Block_Util::get_current_user_id();
|
||||
$auth = IP_Geo_Block::get_live_log();
|
||||
|
||||
if ( $auth === FALSE || $user === (int)$auth ) {
|
||||
set_transient( IP_Geo_Block::PLUGIN_NAME . '-live-log', $user, IP_Geo_Block_Admin::TIMEOUT_LIVE_UPDATE );
|
||||
return TRUE;
|
||||
} else {
|
||||
$info = get_userdata( $auth );
|
||||
return new WP_Error( 'Warn', sprintf( __( 'The user %s (user ID: %d) is in use.', 'ip-geo-block' ), $info->user_login, $auth ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static function release_live_log() {
|
||||
if ( is_wp_error( $result = self::catch_live_log() ) )
|
||||
return $result;
|
||||
|
||||
delete_transient( IP_Geo_Block::PLUGIN_NAME . '-live-log' );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore and reset live log in SQLite
|
||||
*
|
||||
*/
|
||||
public static function reset_live_log() {
|
||||
return IP_Geo_Block_Logs::reset_sqlite_db();
|
||||
}
|
||||
|
||||
public static function restore_live_log( $hook, $settings ) {
|
||||
if ( is_wp_error( $ret = self::catch_live_log() ) )
|
||||
return $ret;
|
||||
|
||||
if ( ! is_wp_error( $res = IP_Geo_Block_Logs::restore_live_log( $hook, $settings ) ) )
|
||||
return array( 'data' => self::format_logs( apply_filters( IP_Geo_Block::PLUGIN_NAME . '-logs', $res ) ) );
|
||||
else
|
||||
return array( 'error' => $res->get_error_message() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Export IP address in cache from MySQL DB
|
||||
*
|
||||
*/
|
||||
public static function export_cache( $anonymize = TRUE ) {
|
||||
$csv = '#';
|
||||
$time = $_SERVER['REQUEST_TIME'];
|
||||
|
||||
$csv .= implode( ',', array(
|
||||
__( 'IP address', 'ip-geo-block' ),
|
||||
__( 'Code', 'ip-geo-block' ),
|
||||
__( 'ASN', 'ip-geo-block' ),
|
||||
__( 'Host name', 'ip-geo-block' ),
|
||||
__( 'Target', 'ip-geo-block' ),
|
||||
__( 'Failure / Total', 'ip-geo-block' ),
|
||||
__( 'Elapsed[sec]', 'ip-geo-block' ),
|
||||
) ) . PHP_EOL;
|
||||
|
||||
foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
|
||||
if ( $anonymize ) {
|
||||
$key = IP_Geo_Block_Util::anonymize_ip( $key, TRUE );
|
||||
$val['host'] = IP_Geo_Block_Util::anonymize_ip( $val['host'], FALSE );
|
||||
}
|
||||
|
||||
$csv .= implode( ',', array(
|
||||
/* IP address */ $key,
|
||||
/* Country code */ $val['code'],
|
||||
/* AS number */ $val['asn' ],
|
||||
/* Host name */ $val['host'],
|
||||
/* Target */ $val['hook'],
|
||||
/* Failure / Total */ sprintf( '%d / %d', (int)$val['fail'], (int)$val['reqs'] ),
|
||||
/* Elapsed[sec] */ $time - (int)$val['time'],
|
||||
) ) . PHP_EOL;
|
||||
}
|
||||
|
||||
// Send as file
|
||||
header( 'Content-Description: File Transfer' );
|
||||
header( 'Content-Type: application/octet-stream' );
|
||||
header( 'Content-Disposition: attachment; filename="' . IP_Geo_Block::PLUGIN_NAME . '_' . IP_Geo_Block_Util::localdate( $time, 'Y-m-d_H-i-s' ) . '.csv"' );
|
||||
header( 'Pragma: public' );
|
||||
header( 'Expires: 0' );
|
||||
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
|
||||
header( 'Content-Length: ' . strlen( $csv ) );
|
||||
echo $csv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore cache from MySQL DB
|
||||
*
|
||||
*/
|
||||
public static function restore_cache( $anonymize = TRUE ) {
|
||||
$res = array();
|
||||
$time = $_SERVER['REQUEST_TIME'];
|
||||
|
||||
foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
|
||||
if ( $anonymize ) {
|
||||
$key = IP_Geo_Block_Util::anonymize_ip( $key, TRUE );
|
||||
$val['host'] = IP_Geo_Block_Util::anonymize_ip( $val['host'], FALSE );
|
||||
}
|
||||
|
||||
$res[] = array(
|
||||
/* Checkbox */ '',
|
||||
/* IP address */ '<span><a href="#!" data-hash="' . esc_attr( $val['hash'] ). '">' . esc_html( $key ) . '</a></span>',
|
||||
/* Country code */ '<span>' . esc_html( $val['code'] ) . '</span>',
|
||||
/* AS number */ '<span>' . esc_html( $val['asn' ] ) . '</span>',
|
||||
/* Host name */ '<span>' . esc_html( $val['host'] ) . '</span>',
|
||||
/* Target */ '<span>' . esc_html( $val['hook'] ) . '</span>',
|
||||
/* Fails/Calls */ '<span>' . sprintf( '%d / %d', (int)$val['fail'], (int)$val['reqs'] ) . '</span>',
|
||||
/* Elapsed[sec] */ '<span>' . ( $time - (int)$val['time'] ) . '</span>',
|
||||
);
|
||||
}
|
||||
|
||||
return array( 'data' => $res ); // DataTables requires `data`
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of active sites on your installation
|
||||
*/
|
||||
public static function get_network_count() {
|
||||
if ( ! defined( 'TEST_RESTORE_NETWORK' ) or ! TEST_RESTORE_NETWORK ):
|
||||
if ( is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) ) {
|
||||
return get_blog_count(); // get_sites( array( 'count' => TRUE ) ) @since 4.6
|
||||
} else {
|
||||
$count = 0;
|
||||
global $wpdb;
|
||||
foreach ( $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs`" ) as $id ) {
|
||||
switch_to_blog( $id );
|
||||
is_plugin_active( IP_GEO_BLOCK_BASE ) and ++$count;
|
||||
restore_current_blog();
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
else:
|
||||
return TEST_NETWORK_BLOG_COUNT;
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore blocked per target in logs
|
||||
*
|
||||
* @param string $duration the number of selected duration
|
||||
* @param int $offset the start of blog to restore logs
|
||||
* @param int $length the number of blogs to restore logs from $offset
|
||||
* @param int $literal JavaScript literal notation
|
||||
*/
|
||||
public static function restore_network( $duration, $offset = 0, $length = 100, $literal = FALSE ) {
|
||||
$zero = array(
|
||||
'comment' => 0,
|
||||
'xmlrpc' => 0,
|
||||
'login' => 0,
|
||||
'admin' => 0,
|
||||
'public' => 0,
|
||||
);
|
||||
|
||||
$time = array(
|
||||
YEAR_IN_SECONDS, // All
|
||||
HOUR_IN_SECONDS, // Latest 1 hour
|
||||
DAY_IN_SECONDS, // Latest 24 hours
|
||||
WEEK_IN_SECONDS, // Latest 1 week
|
||||
30 * DAY_IN_SECONDS // Latest 1 month (MONTH_IN_SECONDS is since WP 4.4+)
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
$length += $offset;
|
||||
$json = $count = array();
|
||||
$duration = isset( $time[ $duration ] ) ? $time[ $duration ] : $time[0];
|
||||
|
||||
if ( ! defined( 'TEST_RESTORE_NETWORK' ) or ! TEST_RESTORE_NETWORK ):
|
||||
global $wpdb;
|
||||
foreach ( $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs`" ) as $id ) {
|
||||
switch_to_blog( $id );
|
||||
|
||||
if ( is_plugin_active( IP_GEO_BLOCK_BASE ) && $offset <= $i && $i < $length ) {
|
||||
// array of ( `time`, `ip`, `hook`, `code`, `method`, `data` )
|
||||
$name = get_bloginfo( 'name' );
|
||||
$logs = IP_Geo_Block_Logs::get_recent_logs( $duration );
|
||||
|
||||
$count[ $name ] = $zero;
|
||||
|
||||
// Blocked hooks by time
|
||||
foreach( $logs as $val ) {
|
||||
++$count[ $name ][ $val['hook'] ];
|
||||
}
|
||||
|
||||
// link over network
|
||||
$count[ $name ]['link'] = esc_url( add_query_arg(
|
||||
array( 'page' => IP_Geo_Block::PLUGIN_NAME ),
|
||||
admin_url( 'options-general.php' )
|
||||
) );
|
||||
}
|
||||
|
||||
restore_current_blog();
|
||||
}
|
||||
else:
|
||||
for ( $i = 0; $i < TEST_NETWORK_BLOG_COUNT; ++$i ) {
|
||||
if ( $offset <= $i && $i < $length ) {
|
||||
$count[ 'site-' . $i ] = array(
|
||||
$i, $i, $i, $i, $i,
|
||||
esc_url( add_query_arg(
|
||||
array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 1 ),
|
||||
admin_url( 'options-general.php' )
|
||||
) )
|
||||
);
|
||||
}
|
||||
}
|
||||
endif; // TEST_RESTORE_NETWORK
|
||||
|
||||
if ( $literal ) {
|
||||
// https://stackoverflow.com/questions/17327022/create-line-chart-using-google-chart-api-and-json-for-datatable
|
||||
foreach ( $count as $key => $val ) {
|
||||
$json['rows'][]['c'] = array(
|
||||
array( 'v' => $key ),
|
||||
array( 'v' => $val['comment'] ),
|
||||
array( 'v' => $val['xmlrpc' ] ),
|
||||
array( 'v' => $val['login' ] ),
|
||||
array( 'v' => $val['admin' ] ),
|
||||
array( 'v' => $val['public' ] ),
|
||||
array( 'v' => $val['link' ] ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
// https://developers.google.com/chart/interactive/docs/datatables_dataviews#arraytodatatable
|
||||
foreach ( $count as $key => $val ) {
|
||||
array_push( $json, array_merge( array( $key ), array_values( $val ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate json from the client and respond safe data
|
||||
*
|
||||
*/
|
||||
public static function validate_settings( $parent ) {
|
||||
// restore escaped characters (see wp_magic_quotes() in wp-includes/load.php)
|
||||
$json = json_decode(
|
||||
str_replace(
|
||||
array( '\\"', '\\\\', "\'" ),
|
||||
array( '"', '\\', "'" ),
|
||||
isset( $_POST['data'] ) ? $_POST['data'] : ''
|
||||
), TRUE
|
||||
);
|
||||
|
||||
if ( NULL === $json )
|
||||
wp_die( 'Illegal JSON format.', '', array( 'response' => 500, 'back_link' => TRUE ) ); // @Since 2.0.4
|
||||
|
||||
// Convert json to setting data
|
||||
$input = self::json_to_settings( $json );
|
||||
|
||||
// Integrate posted data into current settings because if can be a part of hole data
|
||||
$input = $parent->array_replace_recursive(
|
||||
$parent->preprocess_options( IP_Geo_Block::get_option(), IP_Geo_Block::get_default() ), $input
|
||||
);
|
||||
|
||||
// Validate options and convert to json
|
||||
$output = $parent->sanitize_options( $input );
|
||||
$json = self::json_unsafe_encode( self::settings_to_json( $output ) );
|
||||
|
||||
mbstring_binary_safe_encoding(); // @since 3.7.0
|
||||
$length = strlen( $json );
|
||||
reset_mbstring_encoding(); // @since 3.7.0
|
||||
|
||||
// Send json as file
|
||||
header( 'Content-Description: File Transfer' );
|
||||
header( 'Content-Type: application/octet-stream' );
|
||||
header( 'Content-Disposition: attachment; filename="' . IP_Geo_Block::PLUGIN_NAME . '-settings.json"' );
|
||||
header( 'Pragma: public' );
|
||||
header( 'Expires: 0' );
|
||||
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
|
||||
header( 'Content-Length: ' . $length );
|
||||
echo $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert json associative array to settings array
|
||||
*
|
||||
*/
|
||||
private static function json_to_settings( $input ) {
|
||||
$settings = $m = array();
|
||||
$prfx = IP_Geo_Block::OPTION_NAME;
|
||||
|
||||
try {
|
||||
foreach ( $input as $key => $val ) {
|
||||
if ( preg_match( "/${prfx}\[(.+?)\](?:\[(.+?)\](?:\[(.+?)\])?)?/", $key, $m ) ) {
|
||||
switch ( count( $m ) ) {
|
||||
case 2:
|
||||
$settings[ $m[1] ] = $val;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$settings[ $m[1] ][ $m[2] ] = $val;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ( is_numeric( $m[3] ) ) {
|
||||
if ( empty( $settings[ $m[1] ][ $m[2] ] ) )
|
||||
$settings[ $m[1] ][ $m[2] ] = 0;
|
||||
$settings[ $m[1] ][ $m[2] ] |= $val;
|
||||
} else { // [*]:checkbox
|
||||
$settings[ $m[1] ][ $m[2] ][ $m[3] ] = $val;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch ( Exception $e ) { // should be returned as ajax response
|
||||
wp_die( sprintf( __( 'illegal format at %s. Please delete the corresponding line and try again.', 'ip-geo-block' ), print_r( @$m[0], TRUE ) ) );
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert settings array to json associative array
|
||||
*
|
||||
*/
|
||||
public static function settings_to_json( $input, $overwrite = TRUE ) {
|
||||
// [*]:list of checkboxes, [$]:comma separated text to array, [%]:associative array
|
||||
$keys = array(
|
||||
'[version]',
|
||||
'[matching_rule]',
|
||||
'[white_list]',
|
||||
'[black_list]',
|
||||
'[extra_ips][white_list]',
|
||||
'[extra_ips][black_list]',
|
||||
'[anonymize]',
|
||||
'[restrict_api]', // 3.0.13
|
||||
'[simulate]', // 3.0.14
|
||||
'[signature]',
|
||||
'[login_fails]',
|
||||
'[response_code]',
|
||||
'[response_msg]', // 3.0.0
|
||||
'[redirect_uri]', // 3.0.0
|
||||
'[validation][timing]', // 2.2.9
|
||||
'[validation][proxy]',
|
||||
'[validation][comment]',
|
||||
'[validation][xmlrpc]',
|
||||
'[validation][login]',
|
||||
'[login_action][login]', // 2.2.8
|
||||
'[login_action][register]', // 2.2.8
|
||||
'[login_action][resetpass]', // 2.2.8
|
||||
'[login_action][lostpassword]', // 2.2.8
|
||||
'[login_action][postpass]', // 2.2.8
|
||||
'[validation][admin][1]',
|
||||
'[validation][admin][2]',
|
||||
'[validation][ajax][1]',
|
||||
'[validation][ajax][2]',
|
||||
'[validation][plugins]',
|
||||
'[validation][themes]',
|
||||
'[validation][includes]', // 3.0.0
|
||||
'[validation][uploads]', // 3.0.0
|
||||
'[validation][languages]', // 3.0.0
|
||||
'[validation][public]', // 3.0.0
|
||||
'[validation][restapi]', // 3.0.3
|
||||
'[validation][mimetype]', // 3.0.3
|
||||
'[rewrite][plugins]',
|
||||
'[rewrite][themes]',
|
||||
'[rewrite][includes]', // 3.0.0
|
||||
'[rewrite][uploads]', // 3.0.0
|
||||
'[rewrite][languages]', // 3.0.0
|
||||
'[exception][plugins][*]', // 2.2.5
|
||||
'[exception][themes][*]', // 2.2.5
|
||||
'[exception][admin][$]', // 3.0.0
|
||||
'[exception][public][$]', // 3.0.0
|
||||
'[exception][includes][$]', // 3.0.0
|
||||
'[exception][uploads][$]', // 3.0.0
|
||||
'[exception][languages][$]', // 3.0.0
|
||||
'[exception][restapi][$]', // 3.0.3
|
||||
'[public][matching_rule]', // 3.0.0
|
||||
'[public][white_list]', // 3.0.0
|
||||
'[public][black_list]', // 3.0.0
|
||||
'[public][target_rule]', // 3.0.0
|
||||
'[public][target_pages][$]', // 3.0.0
|
||||
'[public][target_posts][$]', // 3.0.0
|
||||
'[public][target_cates][$]', // 3.0.0
|
||||
'[public][target_tags][$]', // 3.0.0
|
||||
'[public][ua_list]', // 3.0.0
|
||||
'[public][dnslkup]', // 3.0.3
|
||||
'[public][response_code]', // 3.0.3
|
||||
'[public][response_msg]', // 3.0.3
|
||||
'[public][redirect_uri]', // 3.0.3
|
||||
'[public][behavior]', // 3.0.10
|
||||
'[behavior][time]', // 3.0.10
|
||||
'[behavior][view]', // 3.0.10
|
||||
'[save_statistics]',
|
||||
'[validation][recdays]', // 2.2.9
|
||||
'[validation][reclogs]',
|
||||
'[validation][maxlogs]',
|
||||
'[validation][explogs]', // 3.0.12
|
||||
'[validation][postkey]',
|
||||
'[update][auto]',
|
||||
'[cache_time_gc]', // 3.0.0
|
||||
'[cache_hold]',
|
||||
'[cache_time]',
|
||||
'[comment][pos]',
|
||||
'[comment][msg]',
|
||||
'[clean_uninstall]',
|
||||
'[api_key][GoogleMap]', // 2.2.7
|
||||
'[network_wide]', // 3.0.0
|
||||
'[mimetype][white_list][%]', // 3.0.3
|
||||
'[mimetype][black_list]', // 3.0.3
|
||||
'[mimetype][capability][$]', // 3.0.4
|
||||
'[Maxmind][use_asn]', // 3.0.4
|
||||
'[live_update][in_memory]', // 3.0.5
|
||||
'[monitor][updated_option]', // 3.0.18
|
||||
'[monitor][update_site_option]', // 3.0.18
|
||||
'[metadata][pre_update_option][$]', // 3.0.17
|
||||
'[metadata][pre_update_site_option][$]', // 3.0.17
|
||||
);
|
||||
$json = array();
|
||||
$prfx = IP_Geo_Block::OPTION_NAME;
|
||||
|
||||
// add providers
|
||||
foreach ( array_keys( IP_Geo_Block_Provider::get_providers( 'key' ) ) as $key ) {
|
||||
$keys[] = '[providers][' . $key . ']';
|
||||
}
|
||||
|
||||
foreach ( $keys as $key ) {
|
||||
if ( preg_match( "/\[(.+?)\](?:\[(.+?)\](?:\[(.+?)\])?)?/", $key, $m ) ) {
|
||||
switch ( count( $m ) ) {
|
||||
case 2:
|
||||
if ( isset( $input[ $m[1] ] ) ) {
|
||||
$json[ $prfx.'['.$m[1].']' ] = strval( $input[ $m[1] ] );
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if ( '%' === $m[2] ) { // [%]:associative array
|
||||
foreach ( isset( $input[ $m[1] ] ) ? $input[ $m[1] ] : array() as $key => $val ) {
|
||||
$json[ $prfx.'['.$m[1].']['.$key.']' ] = $val;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ( isset( $input[ $m[1] ][ $m[2] ] ) || $overwrite ) {
|
||||
$json[ $prfx.'['.$m[1].']['.$m[2].']' ] = (
|
||||
isset( $input[ $m[1] ][ $m[2] ] ) &&
|
||||
'@' !== $input[ $m[1] ][ $m[2] ] ?
|
||||
strval( $input[ $m[1] ][ $m[2] ] ) : ''
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ( is_numeric( $m[3] ) ) {
|
||||
if ( isset( $input[ $m[1] ][ $m[2] ] ) )
|
||||
$json[ $prfx.'['.$m[1].']['.$m[2].']'.'['.$m[3].']' ] =
|
||||
strval( $input[ $m[1] ][ $m[2] ] ) & (int)$m[3];
|
||||
}
|
||||
elseif ( isset( $input[ $m[1] ][ $m[2] ] ) ) {
|
||||
if ( '*' === $m[3] ) { // [*]:checkbox
|
||||
foreach ( $input[ $m[1] ][ $m[2] ] as $val ) {
|
||||
$json[ $prfx.'['.$m[1].']['.$m[2].']'.'['.$val.']' ] = '1';
|
||||
}
|
||||
} elseif ( '%' === $m[3] ) { // [%]:associative array
|
||||
foreach ( $input[ $m[1] ][ $m[2] ] as $key => $val ) {
|
||||
$json[ $prfx.'['.$m[1].']['.$m[2].']'.'['.$key.']' ] = $val;
|
||||
}
|
||||
} elseif ( is_array( $input[ $m[1] ][ $m[2] ] ) ) { // [$]:comma separated text to array
|
||||
$json[ $prfx.'['.$m[1].']['.$m[2].']' ] = implode( ',', $input[ $m[1] ][ $m[2] ] );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make preferred settings with formatted json
|
||||
*
|
||||
*/
|
||||
public static function preferred_to_json() {
|
||||
return self::settings_to_json(
|
||||
array(
|
||||
'login_fails' => 10, // Limited number of login attempts
|
||||
'validation' => array( // Action hook for validation
|
||||
'comment' => TRUE, // Validate on comment post
|
||||
'login' => 1, // Validate on login
|
||||
'admin' => 3, // Validate on admin (1:country 2:ZEP)
|
||||
'ajax' => 3, // Validate on ajax/post (1:country 2:ZEP)
|
||||
'xmlrpc' => 1, // Validate on xmlrpc (1:country 2:close)
|
||||
'postkey' => 'action,comment,log,pwd,FILES', // Keys in $_POST and $_FILES
|
||||
'plugins' => 2, // Validate on wp-content/plugins
|
||||
'themes' => 2, // Validate on wp-content/themes
|
||||
'timing' => 1, // 0:init, 1:mu-plugins, 2:drop-in
|
||||
'mimetype' => 1, // 0:disable, 1:white_list, 2:black_list
|
||||
),
|
||||
'signature' => "../,/wp-config.php,/passwd\ncurl,wget,eval,base64\nselect:.5,where:.5,union:.5\nload_file:.5,create:.6,password:.4",
|
||||
'rewrite' => array( // Apply rewrite rule
|
||||
'plugins' => TRUE, // for wp-content/plugins
|
||||
'themes' => TRUE, // for wp-content/themes
|
||||
),
|
||||
),
|
||||
FALSE // should not overwrite the existing parameters
|
||||
);
|
||||
}
|
||||
|
||||
// Encode json without JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT
|
||||
// Note: It should not be rendered via jQuery .html() at client side
|
||||
private static function json_unsafe_encode( $data ) {
|
||||
if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
|
||||
$opts = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
||||
if ( function_exists( 'wp_json_encode' ) ) // @since 4.1.0
|
||||
$json = wp_json_encode( $data, $opts );
|
||||
else
|
||||
$json = json_encode( $data, $opts );
|
||||
}
|
||||
|
||||
else { // JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES are not supported in PHP 5.3 and under
|
||||
$json = self::json_unescaped_unicode( $data );
|
||||
$json = preg_replace(
|
||||
array( '!{"!', '!":!', '!("?),"!', '!"}!', '!\\\\/!' ),
|
||||
array( '{'.PHP_EOL.' "', '": ', '$1,'.PHP_EOL.' "', '"'.PHP_EOL.'}', '/' ),
|
||||
$json
|
||||
);
|
||||
}
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
// Fallback function for PHP 5.3 and under
|
||||
// @link https://qiita.com/keromichan16/items/5ff45a77fb0d48e046cc
|
||||
// @link https://stackoverflow.com/questions/16498286/why-does-the-php-json-encode-function-convert-utf-8-strings-to-hexadecimal-entit/
|
||||
private static function json_unescaped_unicode( $input ) {
|
||||
return preg_replace_callback(
|
||||
'/(?:\\\\u[0-9a-zA-Z]{4})++/',
|
||||
array( __CLASS__, 'convert_encoding' ),
|
||||
json_encode( $input )
|
||||
);
|
||||
}
|
||||
|
||||
// Fallback function for PHP 5.3 and under
|
||||
private static function convert_encoding( $matches ) {
|
||||
return mb_convert_encoding(
|
||||
pack( 'H*', str_replace( '\\u', '', $matches[0] ) ), 'UTF-8', 'UTF-16'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get blocked action and pages
|
||||
*
|
||||
* @param string $which 'page', 'action', 'plugin', 'theme'
|
||||
* @return array of the name of action/page, plugin or theme
|
||||
*/
|
||||
private static function get_blocked_queries( $which ) {
|
||||
$result = array();
|
||||
|
||||
switch ( $which ) {
|
||||
case 'page':
|
||||
case 'action':
|
||||
$dir = IP_Geo_Block_Util::slashit( str_replace( site_url(), '', admin_url() ) ); /* `/wp-admin/` */
|
||||
|
||||
foreach ( IP_Geo_Block_Logs::search_blocked_logs( 'method', $dir ) as $log ) {
|
||||
foreach ( array( 'method', 'data' ) as $key ) {
|
||||
if ( preg_match( '!' . $which . '=([\-\w]+)!', $log[ $key ], $matches ) ) {
|
||||
$result += array( $matches[1] => $which );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'plugins':
|
||||
case 'themes':
|
||||
// make a list of installed plugins/themes
|
||||
if ( 'plugins' === $which ) {
|
||||
$key = array();
|
||||
foreach ( get_plugins() as $pat => $log ) {
|
||||
$pat = explode( '/', $pat, 2 );
|
||||
$key[] = $pat[0];
|
||||
}
|
||||
} else {
|
||||
$key = wp_get_themes();
|
||||
}
|
||||
|
||||
$dir = 'plugins' === $which ? plugins_url() : get_theme_root_uri();
|
||||
$dir = IP_Geo_Block_Util::slashit( str_replace( site_url(), '', $dir ) );
|
||||
$pat = preg_quote( $dir, '!' ); /* `/wp-content/(plugins|themes)/` */
|
||||
|
||||
foreach ( IP_Geo_Block_Logs::search_blocked_logs( 'method', $dir ) as $log ) {
|
||||
if ( preg_match( '!' . $pat . '(.+?)/!', $log['method'], $matches ) && in_array( $matches[1], $key, TRUE ) ) {
|
||||
$result += array( $matches[1] => $which );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug in blocked requests for exceptions
|
||||
*
|
||||
*/
|
||||
public static function find_exceptions( $target ) {
|
||||
switch ( $target ) {
|
||||
case 'find-admin':
|
||||
$res = array();
|
||||
foreach ( array( 'action', 'page' ) as $which ) {
|
||||
$res += self::get_blocked_queries( $which );
|
||||
}
|
||||
return $res;
|
||||
|
||||
case 'find-plugins':
|
||||
return self::get_blocked_queries( 'plugins' );
|
||||
|
||||
case 'find-themes':
|
||||
return self::get_blocked_queries( 'themes' );
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get debug information related to WordPress
|
||||
*
|
||||
*/
|
||||
public static function get_wp_info() {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-lkup.php';
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
// DNS reverse lookup
|
||||
$key = microtime( TRUE );
|
||||
$val = IP_Geo_Block_Lkup::gethostbyaddr( '8.8.8.8' );
|
||||
$key = microtime( TRUE ) - $key;
|
||||
|
||||
// MySQL (supress WordPress error: Unknown system variable 'block_encryption_mode')
|
||||
$buf = @ini_set( 'output_buffering', 0 );
|
||||
$dsp = @ini_set( 'display_errors', 0 );
|
||||
$log = @ini_set( 'error_log', '/' . 'dev' . '/' . 'null' );
|
||||
$err = @error_reporting( 0 );
|
||||
$ver = $GLOBALS['wpdb']->get_var( 'SELECT @@GLOBAL.version' );
|
||||
$bem = $GLOBALS['wpdb']->get_var( 'SELECT @@GLOBAL.block_encryption_mode' ); // `aes-128-ecb` @since MySQL 5.6.17
|
||||
@ini_set( 'output_buffering', $buf );
|
||||
@ini_set( 'display_errors', $dsp );
|
||||
@ini_set( 'error_log', $log );
|
||||
@error_reporting( $err );
|
||||
|
||||
// Human readable size, Proces owner
|
||||
// https://gist.github.com/mehdichaouch/341a151dd5f469002a021c9396aa2615
|
||||
// https://secure.php.net/manual/function.get-current-user.php#57624
|
||||
// https://secure.php.net/manual/function.posix-getpwuid.php#82387
|
||||
$siz = array( 'B', 'K', 'M', 'G', 'T', 'P' );
|
||||
$usr = function_exists( 'posix_getpwuid' ) ? posix_getpwuid( posix_geteuid() ) : array( 'name' => getenv( 'USERNAME' ) );
|
||||
|
||||
// Server, PHP, WordPress
|
||||
$res = array_map( 'esc_html', array(
|
||||
'Server:' => $_SERVER['SERVER_SOFTWARE'],
|
||||
'MySQL:' => $ver . ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG && $bem ? ' (' . $bem . ')' : '' ),
|
||||
'PHP:' => PHP_VERSION,
|
||||
'PHP SAPI:' => php_sapi_name(),
|
||||
'Memory limit:' => ini_get( 'memory_limit' ),
|
||||
'Peak usage:' => @round( ( $m = memory_get_peak_usage() ) / pow( 1024, ( $i = floor( log( $m, 1024 ) ) ) ), 2 ) . $siz[ $i ],
|
||||
'WordPress:' => $GLOBALS['wp_version'],
|
||||
'Multisite:' => is_multisite() ? 'yes' : 'no',
|
||||
'File system:' => $fs->get_method(),
|
||||
'Temp folder:' => get_temp_dir(),
|
||||
'Process owner:' => $usr['name'],
|
||||
'File owner:' => get_current_user(), // Gets the name of the owner of the current PHP script
|
||||
'Umask:' => sprintf( '%o', umask() ^ 511 /* 0777 */ ),
|
||||
'Zlib:' => function_exists( 'gzopen' ) ? 'yes' : 'no',
|
||||
'ZipArchive:' => class_exists( 'ZipArchive', FALSE ) ? 'yes' : 'no',
|
||||
'PECL phar:' => class_exists( 'PharData', FALSE ) ? 'yes' : 'no',
|
||||
'BC Math:' => (extension_loaded('gmp') ? 'gmp ' : '') . (function_exists('bcadd') ? 'yes' : 'no'),
|
||||
'mb_strcut:' => function_exists( 'mb_strcut' ) ? 'yes' : 'no', // @since PHP 4.0.6
|
||||
'OpenSSL:' => defined( 'OPENSSL_RAW_DATA' ) ? 'yes' : 'no', // @since PHP 5.3.3
|
||||
'SQLite(PDO):' => extension_loaded( 'pdo_sqlite' ) ? 'yes' : 'no',
|
||||
'DNS lookup:' => ('8.8.8.8' !== $val ? 'available' : 'n/a') . sprintf( ' [%.1f msec]', $key * 1000.0 ),
|
||||
'User agent:' => $_SERVER['HTTP_USER_AGENT'],
|
||||
) );
|
||||
|
||||
// Child and parent themes
|
||||
$activated = wp_get_theme(); // @since 3.4.0
|
||||
$res += array( esc_html( $activated->get( 'Name' ) ) => esc_html( $activated->get( 'Version' ) ) );
|
||||
|
||||
if ( $installed = $activated->get( 'Template' ) ) {
|
||||
$activated = wp_get_theme( $installed );
|
||||
$res += array( esc_html( $activated->get( 'Name' ) ) => esc_html( $activated->get( 'Version' ) ) );
|
||||
}
|
||||
|
||||
// Plugins
|
||||
$installed = get_plugins(); // @since 1.5.0
|
||||
$activated = get_site_option( 'active_sitewide_plugins' ); // @since 2.8.0
|
||||
! is_array( $activated ) and $activated = array();
|
||||
$activated = array_merge( $activated, array_fill_keys( get_option( 'active_plugins' ), TRUE ) );
|
||||
|
||||
foreach ( $installed as $key => $val ) {
|
||||
if ( isset( $activated[ $key ] ) ) {
|
||||
$res += array( esc_html( $val['Name'] ) => esc_html( $val['Version'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Blocked self requests
|
||||
$installed = array_reverse( IP_Geo_Block_Logs::search_logs( IP_Geo_Block::get_ip_address(), IP_Geo_Block::get_option() ) );
|
||||
foreach ( $installed as $val ) {
|
||||
if ( IP_Geo_Block::is_blocked( $val['result'] ) ) {
|
||||
// hide port and nonce
|
||||
$method = preg_replace( '/\[\d+\]/', '', $val['method'] );
|
||||
$method = preg_replace( '/(' . IP_Geo_Block::get_auth_key() . ')(?:=|%3D)([\w]+)/', '$1=...', $method );
|
||||
|
||||
// add post data
|
||||
$query = array();
|
||||
foreach ( explode( ',', $val['data'] ) as $str ) {
|
||||
FALSE !== strpos( $str, '=' ) and $query[] = $str;
|
||||
}
|
||||
|
||||
if ( ! empty( $query ) )
|
||||
$method .= '(' . implode( ',', $query ) . ')';
|
||||
|
||||
$res += array(
|
||||
esc_html( IP_Geo_Block_Util::localdate( $val['time'], 'Y-m-d H:i:s' ) ) =>
|
||||
esc_html( str_pad( $val['result'], 8 ) . $method )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,470 +0,0 @@
|
||||
<?php
|
||||
class IP_Geo_Block_Admin_Rewrite {
|
||||
|
||||
/**
|
||||
* Instance of this class.
|
||||
*/
|
||||
private static $instance = NULL;
|
||||
|
||||
// private values
|
||||
private $doc_root = NULL; // document root
|
||||
private $base_uri = NULL; // plugins base uri
|
||||
private $config_file = NULL; // `.htaccess` or `.user.ini`
|
||||
private $wp_dirs = array(); // path to `plugins` and `themes` from document root
|
||||
|
||||
// template of rewrite rule in wp-content/(plugins|themes)/
|
||||
private $rewrite_rule = array(
|
||||
'.htaccess' => array(
|
||||
'plugins' => array(
|
||||
'# BEGIN IP Geo Block',
|
||||
'<IfModule mod_rewrite.c>',
|
||||
'RewriteEngine on',
|
||||
'RewriteBase %REWRITE_BASE%',
|
||||
'RewriteCond %{REQUEST_URI} !ip-geo-block/rewrite.php$',
|
||||
'RewriteRule ^.*\.php$ rewrite.php [L]',
|
||||
'</IfModule>',
|
||||
'# END IP Geo Block',
|
||||
),
|
||||
'themes' => array(
|
||||
'# BEGIN IP Geo Block',
|
||||
'<IfModule mod_rewrite.c>',
|
||||
'RewriteEngine on',
|
||||
'RewriteBase %REWRITE_BASE%',
|
||||
'RewriteRule ^.*\.php$ rewrite.php [L]',
|
||||
'</IfModule>',
|
||||
'# END IP Geo Block',
|
||||
),
|
||||
),
|
||||
'.user.ini' => array(
|
||||
'plugins' => array(
|
||||
'; BEGIN IP Geo Block%ADDITIONAL%',
|
||||
'auto_prepend_file = "%IP_GEO_BLOCK_PATH%rewrite-ini.php"',
|
||||
'; END IP Geo Block',
|
||||
),
|
||||
'themes' => array(
|
||||
'; BEGIN IP Geo Block%ADDITIONAL%',
|
||||
'auto_prepend_file = "%IP_GEO_BLOCK_PATH%rewrite-ini.php"',
|
||||
'; END IP Geo Block',
|
||||
),
|
||||
),
|
||||
// https://www.wordfence.com/blog/2014/05/nginx-wordfence-falcon-engine-php-fpm-fastcgi-fast-cgi/
|
||||
// 'nginx' => array(
|
||||
// 'plugins' => array(
|
||||
// '# BEGIN IP Geo Block',
|
||||
// 'location ~ %REWRITE_BASE%rewrite.php$ {}',
|
||||
// 'location %WP_CONTENT_DIR%/plugins/ {',
|
||||
// ' rewrite ^%WP_CONTENT_DIR%/plugins/.*\.php$ %REWRITE_BASE%rewrite.php break;',
|
||||
// '}',
|
||||
// '# END IP Geo Block',
|
||||
// 'themes' => array(
|
||||
// '# BEGIN IP Geo Block',
|
||||
// 'location %WP_CONTENT_DIR%/themes/ {',
|
||||
// ' rewrite ^%WP_CONTENT_DIR%/themes/.*\.php$ %REWRITE_BASE%rewrite.php break;',
|
||||
// '}',
|
||||
// '# END IP Geo Block',
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
|
||||
private function __construct() {
|
||||
// https://stackoverflow.com/questions/25017381/setting-php-document-root-on-webserver
|
||||
$this->doc_root = str_replace( DIRECTORY_SEPARATOR, '/', str_replace( $_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME'] ) );
|
||||
$this->base_uri = str_replace( $this->doc_root, '', str_replace( DIRECTORY_SEPARATOR, '/', IP_GEO_BLOCK_PATH ) );
|
||||
|
||||
// target directories (WP_CONTENT_DIR can be defined in wp-config.php as an aliased or symbolic linked path)
|
||||
$path = str_replace( $this->doc_root, '', str_replace( DIRECTORY_SEPARATOR, '/', realpath( WP_CONTENT_DIR ) ) );
|
||||
$this->wp_dirs = array(
|
||||
'plugins' => $path . '/plugins/',
|
||||
'themes' => $path . '/themes/',
|
||||
);
|
||||
|
||||
// Apache in wp-includes/vars.php
|
||||
global $is_apache;
|
||||
if ( ! empty( $is_apache ) )
|
||||
$this->config_file = '.htaccess';
|
||||
|
||||
// CGI/FastCGI SAPI (cgi, cgi-fcgi, fpm-fcgi)
|
||||
elseif ( version_compare( PHP_VERSION, '5.3' ) >= 0 && FALSE !== strpos( php_sapi_name(), 'cgi' ) )
|
||||
$this->config_file = ini_get( 'user_ini.filename' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this class.
|
||||
*
|
||||
*/
|
||||
private static function get_instance() {
|
||||
return self::$instance ? self::$instance : ( self::$instance = new self );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove empty element from the array
|
||||
*
|
||||
* @param array contents of configuration file
|
||||
* @return array updated array of contents
|
||||
*/
|
||||
private function remove_empty( $content ) {
|
||||
while ( FALSE !== ( $tmp = reset( $content ) ) ) {
|
||||
if ( strlen( trim( $tmp ) ) ) {
|
||||
break;
|
||||
} else {
|
||||
array_shift( $content );
|
||||
}
|
||||
}
|
||||
|
||||
while ( FALSE !== ( $tmp = end( $content ) ) ) {
|
||||
if ( strlen( trim( $tmp ) ) ) {
|
||||
break;
|
||||
} else {
|
||||
array_pop( $content );
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the block of rewrite rule
|
||||
*
|
||||
* @param array contents of configuration file
|
||||
* @return array list of begin and end
|
||||
*/
|
||||
private function find_rewrite_block( $content ) {
|
||||
return preg_grep(
|
||||
'/^\s*?[#;]\s*?(?:BEGIN|END)\s*?IP Geo Block\s*?$/i', (array)$content
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path of .htaccess in wp-content/plugins/themes/
|
||||
*
|
||||
* @param string 'plugins' or 'themes'
|
||||
* @return string absolute path to the .htaccess or NULL
|
||||
*/
|
||||
private function get_rewrite_file( $which ) {
|
||||
if ( $this->config_file )
|
||||
return $this->doc_root . $this->wp_dirs[ $which ] . $this->config_file;
|
||||
else
|
||||
return NULL; /* NOT SUPPORTED */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contents in .htaccess in wp-content/(plugins|themes)/
|
||||
*
|
||||
* @param string 'plugins' or 'themes'
|
||||
* @return array contents of configuration file or WP_Error
|
||||
*/
|
||||
private function get_rewrite_rule( $which ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
// check the existence of configuration file
|
||||
$file = $this->get_rewrite_file( $which );
|
||||
$exist = $file ? $fs->exists( $file ) : FALSE;
|
||||
|
||||
// check permission
|
||||
if ( $exist ) {
|
||||
if ( ! $fs->is_readable( $file ) ) {
|
||||
return new WP_Error( 'Error',
|
||||
sprintf( __( 'Unable to read <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $file ) . ' ' .
|
||||
sprintf( __( 'Or please refer to %s to set it manually.', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How to fix permission troubles? | IP Geo Block">How to fix permission troubles?</a>' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// get file contents as an array
|
||||
$exist = $fs->get_contents_array( $file );
|
||||
return FALSE !== $exist ? $exist : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Put contents to .htaccess in wp-content/(plugins|themes)/
|
||||
*
|
||||
* @param string $which 'plugins' or 'themes'
|
||||
* @param array contents of configuration file
|
||||
* @return bool TRUE (success) or FALSE (failure)
|
||||
*/
|
||||
private function put_rewrite_rule( $which, $content ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
$file = $this->get_rewrite_file( $which );
|
||||
|
||||
if ( ! $file || FALSE === $fs->put_contents( $file, implode( PHP_EOL, $content ) ) ) {
|
||||
$this->show_message(
|
||||
sprintf( __( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $file ) . ' ' .
|
||||
sprintf( __( 'Or please refer to %s to set it manually.', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How to fix permission troubles? | IP Geo Block">How to fix permission troubles?</a>' )
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// if content is empty then remove file
|
||||
$content = $this->remove_empty( $content );
|
||||
return empty( $content ) ? $fs->delete( $file ) : TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the block of rewrite rule exists
|
||||
*
|
||||
* @param string 'plugins' or 'themes'
|
||||
* @return bool TRUE (found), FALSE (not found or unavailable) or WP_Error
|
||||
*/
|
||||
private function get_rewrite_stat( $which ) {
|
||||
if ( $this->config_file ) {
|
||||
$content = $this->get_rewrite_rule( $which );
|
||||
|
||||
if ( is_wp_error( $content ) )
|
||||
return $content;
|
||||
|
||||
$block = $this->find_rewrite_block( $content );
|
||||
|
||||
if ( '.htaccess' === $this->config_file ) {
|
||||
return empty( $block ) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
else {
|
||||
if ( empty( $block ) ) {
|
||||
$block = preg_grep( '/auto_prepend_file/i', $content );
|
||||
|
||||
if ( empty( $block ) ) {
|
||||
return FALSE; // rewrite rule is not found in configuration file
|
||||
}
|
||||
|
||||
else {
|
||||
return new WP_Error( 'Error', sprintf(
|
||||
__( '“auto_prepend_file” already defined in %s.', 'ip-geo-block' ),
|
||||
$this->get_rewrite_file( $which )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
return TRUE; // rewrite rule already exists in configuration file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1; /* NOT SUPPORTED */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the block of rewrite rule
|
||||
*
|
||||
* @param array contents of configuration file
|
||||
* @param array contents to be removed
|
||||
* @return array array of contents without rewrite rule
|
||||
*/
|
||||
private function remove_rewrite_block( $content, $block ) {
|
||||
$block = array_reverse( $block, TRUE );
|
||||
|
||||
reset( $block );
|
||||
while( FALSE !== current( $block ) ) {
|
||||
$key_end = key( $block ); $val_end = current( $block ); next( $block );
|
||||
$key_begin = key( $block ); $val_begin = current( $block ); next( $block );
|
||||
if ( NULL !== $key_end && NULL !== $key_begin ) {
|
||||
array_splice( $content, $key_begin, $key_end - $key_begin + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the block of rewrite rule
|
||||
*
|
||||
* @param string 'plugins' or 'themes'
|
||||
* @param array contents of configuration file
|
||||
* @return array array of contents with the block of rewrite rule
|
||||
*/
|
||||
private function append_rewrite_block( $which, $content ) {
|
||||
if ( $type = $this->config_file ) {
|
||||
// in case that `.user.ini` is configured differently
|
||||
if ( '.htaccess' !== $type && '.user.ini' !== $type )
|
||||
$type = '.user.ini';
|
||||
|
||||
// in case that another `.user.ini` in ascendant directory
|
||||
$additional = '';
|
||||
if ( '.user.ini' === $type ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
$dir = dirname( IP_GEO_BLOCK_PATH ); // `/wp-content/plugins`
|
||||
$ini = $this->config_file;
|
||||
$doc = $this->doc_root;
|
||||
|
||||
do {
|
||||
// avoid loop just in case
|
||||
if ( ( $next = dirname( $dir ) ) !== $dir )
|
||||
$dir = $next;
|
||||
else
|
||||
break;
|
||||
|
||||
if ( $fs->exists( "$dir/$ini" ) ) {
|
||||
$tmp = $fs->get_contents_array( "$dir/$ini" );
|
||||
$tmp = preg_replace( '/^\s*(auto_prepend_file.*)$/', '; $1', $tmp );
|
||||
$tmp = $this->remove_empty( $tmp );
|
||||
|
||||
if ( ! empty( $tmp ) )
|
||||
$additional = PHP_EOL . PHP_EOL . implode( PHP_EOL, $tmp ) . PHP_EOL;
|
||||
|
||||
break;
|
||||
}
|
||||
} while ( $dir !== $doc );
|
||||
}
|
||||
|
||||
return array_merge(
|
||||
$content,
|
||||
str_replace(
|
||||
array( '%REWRITE_BASE%', '%WP_CONTENT_DIR%', '%IP_GEO_BLOCK_PATH%', '%ADDITIONAL%' ),
|
||||
array( $this->base_uri, WP_CONTENT_DIR, IP_GEO_BLOCK_PATH, $additional ),
|
||||
$this->rewrite_rule[ $type ][ $which ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add rewrite rule to server configration
|
||||
*
|
||||
* @param string 'plugins' or 'themes'
|
||||
* @return bool TRUE (found), FALSE (not found or unavailable)
|
||||
*/
|
||||
private function add_rewrite_rule( $which ) {
|
||||
$stat = $this->get_rewrite_stat( $which );
|
||||
|
||||
if ( is_wp_error( $stat ) ) {
|
||||
$this->show_message( $stat->get_error_message() );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
elseif ( TRUE === $stat ) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
elseif ( FALSE === $stat ) {
|
||||
$content = $this->get_rewrite_rule( $which );
|
||||
|
||||
if ( is_wp_error( $content ) ) {
|
||||
$this->show_message( $content->get_error_message() );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$content = $this->append_rewrite_block( $which, $content );
|
||||
return $this->put_rewrite_rule( $which, $content );
|
||||
}
|
||||
|
||||
return -1; /* NOT SUPPORTED */
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete rewrite rule to server configration
|
||||
*
|
||||
* @param string 'plugins' or 'themes'
|
||||
* @return bool TRUE (found), FALSE (not found or unavailable)
|
||||
*/
|
||||
private function del_rewrite_rule( $which ) {
|
||||
$stat = $this->get_rewrite_stat( $which );
|
||||
|
||||
if ( is_wp_error( $stat ) ) {
|
||||
$this->show_message( $stat->get_error_message() );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
elseif ( FALSE === $stat ) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
elseif ( TRUE === $stat ) {
|
||||
$content = $this->get_rewrite_rule( $which );
|
||||
|
||||
if ( is_wp_error( $content ) ) {
|
||||
$this->show_message( $content->get_error_message() );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$block = $this->find_rewrite_block( $content );
|
||||
$content = $this->remove_rewrite_block( $content, $block );
|
||||
return $this->put_rewrite_rule( $which, $content );
|
||||
}
|
||||
|
||||
return -1; /* NOT SUPPORTED */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show notice message
|
||||
*
|
||||
*/
|
||||
private function show_message( $msg ) {
|
||||
if ( class_exists( 'IP_Geo_Block_Admin', FALSE ) )
|
||||
IP_Geo_Block_Admin::add_admin_notice( 'error', $msg );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check rewrite rules
|
||||
*
|
||||
*/
|
||||
public static function check_rewrite_all() {
|
||||
$rewrite = self::get_instance();
|
||||
|
||||
$status = array();
|
||||
foreach ( array_keys( $rewrite->rewrite_rule['.htaccess'] ) as $key ) {
|
||||
$stat = $rewrite->get_rewrite_stat( $key );
|
||||
$status[ $key ] = is_wp_error( $stat ) ? FALSE : $stat;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate all rewrite rules according to the settings
|
||||
*
|
||||
*/
|
||||
public static function activate_rewrite_all( $options ) {
|
||||
$rewrite = self::get_instance();
|
||||
|
||||
foreach ( array_keys( $rewrite->rewrite_rule['.htaccess'] ) as $key ) {
|
||||
if ( $options[ $key ] )
|
||||
// if it fails to write, then return FALSE
|
||||
$options[ $key ] = $rewrite->add_rewrite_rule( $key ) ? TRUE : FALSE;
|
||||
else
|
||||
// regardless of the result, return FALSE
|
||||
$options[ $key ] = $rewrite->del_rewrite_rule( $key ) ? FALSE : FALSE;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate all rewrite rules
|
||||
*
|
||||
*/
|
||||
public static function deactivate_rewrite_all() {
|
||||
$rewrite = self::get_instance();
|
||||
|
||||
foreach ( array_keys( $rewrite->rewrite_rule['.htaccess'] ) as $key ) {
|
||||
$rewrite->del_rewrite_rule( $key );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of target directories.
|
||||
*
|
||||
*/
|
||||
public static function get_dirs() {
|
||||
$rewrite = self::get_instance();
|
||||
return str_replace( $rewrite->doc_root, '', $rewrite->wp_dirs );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return configuration file type.
|
||||
*
|
||||
*/
|
||||
public static function get_config_file() {
|
||||
$rewrite = self::get_instance();
|
||||
return $rewrite->config_file;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
<?php
|
||||
class IP_Geo_Block_Admin_Tab {
|
||||
|
||||
public static function tab_setup( $context, $tab ) {
|
||||
$cookie = $context->get_cookie();
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$plugin_slug = IP_Geo_Block::PLUGIN_NAME;
|
||||
|
||||
register_setting(
|
||||
$option_slug = IP_Geo_Block::PLUGIN_NAME,
|
||||
$option_name = IP_Geo_Block::OPTION_NAME
|
||||
);
|
||||
|
||||
/*----------------------------------------*
|
||||
* Validation logs
|
||||
*----------------------------------------*/
|
||||
add_settings_section(
|
||||
$section = $plugin_slug . '-logs',
|
||||
array( __( 'Validation logs', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/record-settings-and-logs.html" title="Validation logs | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>' ),
|
||||
( $options['validation']['reclogs'] ?
|
||||
array( __CLASS__, 'validation_logs' ) :
|
||||
array( __CLASS__, 'warn_accesslog' )
|
||||
),
|
||||
$option_slug
|
||||
);
|
||||
|
||||
if ( $options['validation']['reclogs'] ):
|
||||
|
||||
if ( extension_loaded( 'pdo_sqlite' ) ):
|
||||
$html = '<ul id="ip-geo-block-live-log">';
|
||||
$html .= '<li><input type="radio" name="ip-geo-block-live-log" id="ip-geo-block-live-log-start" value="start"><label for="ip-geo-block-live-log-start" title="Start"><span class="ip-geo-block-icon-play"></span></label></li>';
|
||||
$html .= '<li><input type="radio" name="ip-geo-block-live-log" id="ip-geo-block-live-log-pause" value="pause"><label for="ip-geo-block-live-log-pause" title="Pause"><span class="ip-geo-block-icon-pause"></span></label></li>';
|
||||
$html .= '<li><input type="radio" name="ip-geo-block-live-log" id="ip-geo-block-live-log-stop" value="stop" checked><label for="ip-geo-block-live-log-stop" title="Stop"><span class="ip-geo-block-icon-stop"></span></label></li>';
|
||||
$html .= '</ul>';
|
||||
|
||||
// Live update
|
||||
add_settings_field(
|
||||
$option_name.'_live-log',
|
||||
__( 'Live update', 'ip-geo-block' ) . '<div id="ip-geo-block-live-loading"><div></div><div></div></div>',
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'live-log',
|
||||
'value' => $html,
|
||||
'class' => isset( $cookie[ $tab ][1] ) && $cookie[ $tab ][1] === 'o' ? '' : 'ip-geo-block-hide',
|
||||
)
|
||||
);
|
||||
endif; // extension_loaded( 'pdo_sqlite' )
|
||||
|
||||
// make a list of target (same as in tab-accesslog.php)
|
||||
$target = array(
|
||||
'comment' => __( 'Comment post', 'ip-geo-block' ),
|
||||
'xmlrpc' => __( 'XML-RPC', 'ip-geo-block' ),
|
||||
'login' => __( 'Login form', 'ip-geo-block' ),
|
||||
'admin' => __( 'Admin area', 'ip-geo-block' ),
|
||||
'public' => __( 'Public facing pages', 'ip-geo-block' ),
|
||||
);
|
||||
|
||||
$html = "\n".'<li><label><input type="radio" name="' . $plugin_slug . '-target" value="all" checked="checked" />' . __( 'All', 'ip-geo-block' ) . '</label></li>' . "\n";
|
||||
foreach ( $target as $key => $val ) {
|
||||
$html .= '<li><label><input type="radio" name="' . $plugin_slug . '-target" value="' . $key . '" />';
|
||||
$html .= '<dfn title="' . $val . '">' . $key . '</dfn>' . '</label></li>' . "\n";
|
||||
}
|
||||
|
||||
// Select target
|
||||
add_settings_field(
|
||||
$option_name.'_select_target',
|
||||
__( 'Select target', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'select_target',
|
||||
'value' => '<ul id="' . $plugin_slug . '-select-target">' . $html . '</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Search in logs
|
||||
add_settings_field(
|
||||
$option_name.'_search_filter',
|
||||
__( 'Search in logs', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'text',
|
||||
'option' => $option_name,
|
||||
'field' => 'search_filter',
|
||||
'value' => isset( $_GET['s'] ) ? esc_html( $_GET['s'] ) : '', // preset filter
|
||||
'after' => '<a class="button button-secondary" id="ip-geo-block-reset-filter" title="' . __( 'Reset', 'ip-geo-block' ) . '" href="#!">'. __( 'Reset', 'ip-geo-block' ) . '</a>',
|
||||
)
|
||||
);
|
||||
|
||||
// Preset filters
|
||||
$filters = has_filter( $plugin_slug . '-logs-preset' ) ? apply_filters( $plugin_slug . '-logs-preset', array() ) : $context->preset_filters();
|
||||
if ( ! empty( $filters ) ) {
|
||||
// allowed tags and attributes
|
||||
$allow_tags = array(
|
||||
'span' => array(
|
||||
'class' => 1,
|
||||
'title' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
$html = '<ul id="ip-geo-block-logs-preset">';
|
||||
foreach ( $filters as $filter ) {
|
||||
$html .= '<li><a href="#!" data-value="' . esc_attr( $filter['value'] ) . '">' . IP_Geo_Block_Util::kses( $filter['title'], $allow_tags ) . '</a></li>';
|
||||
}
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_logs_preset',
|
||||
'<div class="ip-geo-block-subitem">' . __( 'Preset filters', 'ip-geo-block' ) . '</div>',
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'logs_preset',
|
||||
'value' => $html,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Bulk action
|
||||
add_settings_field(
|
||||
$option_name.'_bulk_action',
|
||||
__( 'Bulk action', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'select',
|
||||
'option' => $option_name,
|
||||
'field' => 'bulk_action',
|
||||
'value' => 0,
|
||||
'list' => array(
|
||||
0 => NULL,
|
||||
'bulk-action-ip-erase' => __( 'Remove entries by IP address', 'ip-geo-block' ),
|
||||
'bulk-action-ip-white' => __( 'Add IP address to “Whitelist”', 'ip-geo-block' ),
|
||||
'bulk-action-ip-black' => __( 'Add IP address to “Blacklist”', 'ip-geo-block' ), ) + ( $options['Maxmind']['use_asn'] <= 0 ? array() : array(
|
||||
'bulk-action-as-white' => __( 'Add AS number to “Whitelist”', 'ip-geo-block' ),
|
||||
'bulk-action-as-black' => __( 'Add AS number to “Blacklist”', 'ip-geo-block' ),
|
||||
) ),
|
||||
'after' => '<a class="button button-secondary" id="ip-geo-block-bulk-action" title="' . __( 'Apply', 'ip-geo-block' ) . '" href="#!">'. __( 'Apply', 'ip-geo-block' ) . '</a>' . '<div id="'.$plugin_slug.'-loading"></div>',
|
||||
)
|
||||
);
|
||||
|
||||
// Clear logs
|
||||
add_settings_field(
|
||||
$option_name.'_clear_all',
|
||||
__( 'Clear logs', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'button',
|
||||
'option' => $option_name,
|
||||
'field' => 'clear_all',
|
||||
'value' => __( 'Clear all', 'ip-geo-block' ),
|
||||
'after' => '<div id="'.$plugin_slug.'-logs"></div>',
|
||||
'class' => empty( $cookie[ $tab ][1] ) || $cookie[ $tab ][1] !== 'o' ? '' : 'ip-geo-block-hide',
|
||||
)
|
||||
);
|
||||
|
||||
// Export logs
|
||||
add_settings_field(
|
||||
$option_name.'_export_logs',
|
||||
__( 'Export logs', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'none',
|
||||
'before' => '<a class="button button-secondary" id="ip-geo-block-export-logs" title="' . __( 'Export to the local file', 'ip-geo-block' ) . '" href="#!">'. __( 'Export csv', 'ip-geo-block' ) . '</a>',
|
||||
'after' => '<div id="'.$plugin_slug.'-export"></div>',
|
||||
'class' => empty( $cookie[ $tab ][1] ) || $cookie[ $tab ][1] !== 'o' ? '' : 'ip-geo-block-hide',
|
||||
)
|
||||
);
|
||||
|
||||
endif; // $options['validation']['reclogs']
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that fills the section with the desired content.
|
||||
*
|
||||
*/
|
||||
private static function dashboard_url() {
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$context = IP_Geo_Block_Admin::get_instance();
|
||||
return $context->dashboard_url( $options['network_wide'] );
|
||||
}
|
||||
|
||||
public static function validation_logs() {
|
||||
echo '<table id="', IP_Geo_Block::PLUGIN_NAME, '-validation-logs" class="', IP_Geo_Block::PLUGIN_NAME, '-dataTable display" cellspacing="0" width="100%">', "\n", '<thead></thead><tbody></tbody></table>', "\n";
|
||||
}
|
||||
|
||||
public static function warn_accesslog() {
|
||||
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), self::dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
|
||||
echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord “Validation logs”%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
|
||||
echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
class IP_Geo_Block_Admin_Tab {
|
||||
|
||||
public static function tab_setup( $context, $tab ) {
|
||||
|
||||
register_setting(
|
||||
$option_slug = IP_Geo_Block::PLUGIN_NAME,
|
||||
$option_name = IP_Geo_Block::OPTION_NAME
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
$section = IP_Geo_Block::PLUGIN_NAME . '-attribution',
|
||||
__( 'Attribution links', 'ip-geo-block' ),
|
||||
NULL,
|
||||
$option_slug
|
||||
);
|
||||
|
||||
foreach ( IP_Geo_Block_Provider::get_providers( 'link' ) as $provider => $key ) {
|
||||
add_settings_field(
|
||||
$option_name.'_attribution_'.$provider,
|
||||
$provider,
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'attribution',
|
||||
'value' => $key,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
class IP_Geo_Block_Admin_Tab {
|
||||
|
||||
public static function tab_setup( $context, $tab ) {
|
||||
$options = IP_Geo_Block::get_option();
|
||||
|
||||
register_setting(
|
||||
$option_slug = IP_Geo_Block::PLUGIN_NAME,
|
||||
$option_name = IP_Geo_Block::OPTION_NAME
|
||||
);
|
||||
|
||||
/*----------------------------------------*
|
||||
* Geolocation
|
||||
*----------------------------------------*/
|
||||
add_settings_section(
|
||||
$section = IP_Geo_Block::PLUGIN_NAME . '-search',
|
||||
__( 'Search IP address geolocation', 'ip-geo-block' ),
|
||||
NULL,
|
||||
$option_slug
|
||||
);
|
||||
|
||||
// make providers list
|
||||
$list = array();
|
||||
$providers = IP_Geo_Block_Provider::get_providers( 'key' );
|
||||
foreach ( $providers as $provider => $key ) {
|
||||
if ( ! is_string( $key ) || // provider that does not need api key
|
||||
! empty( $options['providers'][ $provider ] ) ) { // provider that has api key
|
||||
$list += array( $provider => $provider );
|
||||
}
|
||||
}
|
||||
|
||||
// get selected item
|
||||
$provider = array();
|
||||
$providers = array_keys( $providers );
|
||||
$cookie = $context->get_cookie();
|
||||
if ( isset( $cookie[ $tab ] ) ) {
|
||||
foreach ( array_slice( (array)$cookie[ $tab ], 3 ) as $key => $val ) {
|
||||
if ( 'o' === $val ) {
|
||||
$provider[] = $providers[ $key ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_service',
|
||||
__( 'Geolocation API', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'select',
|
||||
'attr' => 'multiple="multiple"',
|
||||
'option' => $option_name,
|
||||
'field' => 'service',
|
||||
'value' => ! empty( $provider ) ? $provider : $providers[0],
|
||||
'list' => $list,
|
||||
)
|
||||
);
|
||||
|
||||
// preset IP address
|
||||
if ( isset( $_GET['s'] ) ) {
|
||||
$list = preg_replace(
|
||||
array( '/\.\*+$/', '/:\w*\*+$/', '/(::.*)::$/' ),
|
||||
array( '.0', '::', '$1' ),
|
||||
trim( $_GET['s'] )
|
||||
); // de-anonymize if `***` exists
|
||||
$list = filter_var( $list, FILTER_VALIDATE_IP ) ? $list : '';
|
||||
} else {
|
||||
$list = '';
|
||||
}
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_ip_address',
|
||||
__( 'IP address', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'text',
|
||||
'option' => $option_name,
|
||||
'field' => 'ip_address',
|
||||
'value' => $list,
|
||||
)
|
||||
);
|
||||
|
||||
// Anonymize IP address
|
||||
add_settings_field(
|
||||
$option_name.'_anonymize',
|
||||
__( '<dfn title="IP address is always encrypted on recording in Cache and Logs. Moreover, this option replaces the end of IP address with “***” to make it anonymous.">Anonymize IP address</dfn>', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'option' => $option_name,
|
||||
'field' => 'anonymize',
|
||||
'value' => ( ! empty( $options['anonymize'] ) || ! empty( $options['restrict_api'] ) ) ? TRUE : FALSE,
|
||||
)
|
||||
);
|
||||
|
||||
// Search geolocation
|
||||
add_settings_field(
|
||||
$option_name.'_get_location',
|
||||
__( 'Search geolocation', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'button',
|
||||
'option' => $option_name,
|
||||
'field' => 'get_location',
|
||||
'value' => __( 'Search now', 'ip-geo-block' ),
|
||||
'after' => '<div id="ip-geo-block-loading"></div>',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
<?php
|
||||
class IP_Geo_Block_Admin_Tab {
|
||||
|
||||
// UI control parameters
|
||||
static $controls = array(
|
||||
'time' => 0, // Duration to retrieve
|
||||
'rows' => 2, // Rows
|
||||
'cols' => 1, // Columns
|
||||
'warn' => FALSE,
|
||||
);
|
||||
|
||||
public static function tab_setup( $context, $tab ) {
|
||||
/*----------------------------------------*
|
||||
* Control parameters in cookie
|
||||
*----------------------------------------*/
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$cookie = $context->get_cookie(); // [0]:Section, [1]:Open a new window, [2]:Duration to retrieve, [3]:Row, [4]:Column
|
||||
self::$controls['time'] = empty( $cookie[ $tab ][2] ) ? self::$controls['time'] : min( 3, max( 0, (int)$cookie[ $tab ][2] ) );
|
||||
self::$controls['rows'] = empty( $cookie[ $tab ][3] ) ? self::$controls['rows'] : min( 4, max( 1, (int)$cookie[ $tab ][3] ) );
|
||||
self::$controls['cols'] = empty( $cookie[ $tab ][4] ) ? self::$controls['cols'] : min( 5, max( 1, (int)$cookie[ $tab ][4] ) );
|
||||
self::$controls['warn'] = ! $options['validation']['reclogs'];
|
||||
|
||||
/*----------------------------------------*
|
||||
* Blocked by target in logs section
|
||||
*----------------------------------------*/
|
||||
register_setting(
|
||||
$option_slug = IP_Geo_Block::PLUGIN_NAME,
|
||||
$option_name = IP_Geo_Block::OPTION_NAME
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
$section = IP_Geo_Block::PLUGIN_NAME . '-network',
|
||||
__( 'Blocked by target in logs', 'ip-geo-block' ),
|
||||
array( __CLASS__, 'render_network' ),
|
||||
$option_slug
|
||||
);
|
||||
|
||||
/*----------------------------------------*
|
||||
* Chart display layout
|
||||
*----------------------------------------*/
|
||||
$html = '<ul id="ip-geo-block-select-layout">';
|
||||
$html .= '<li>' . __( 'Rows', 'ip-geo-block' ) . ' : <select name="rows">';
|
||||
$html .= '<option value="1"' . selected( 1, self::$controls['rows'], FALSE ) . '> 5</option>';
|
||||
$html .= '<option value="2"' . selected( 2, self::$controls['rows'], FALSE ) . '>10</option>';
|
||||
$html .= '<option value="4"' . selected( 4, self::$controls['rows'], FALSE ) . '>20</option>';
|
||||
$html .= '</select></li>';
|
||||
$html .= '<li>' .__( 'Columns', 'ip-geo-block' ) . ' : <select name="cols">';
|
||||
$html .= '<option value="1"' . selected( 1, self::$controls['cols'], FALSE ) . '>1</option>';
|
||||
$html .= '<option value="2"' . selected( 2, self::$controls['cols'], FALSE ) . '>2</option>';
|
||||
$html .= '<option value="3"' . selected( 3, self::$controls['cols'], FALSE ) . '>3</option>';
|
||||
$html .= '<option value="4"' . selected( 4, self::$controls['cols'], FALSE ) . '>4</option>';
|
||||
$html .= '<option value="5"' . selected( 5, self::$controls['cols'], FALSE ) . '>5</option>';
|
||||
$html .= '</select></li>';
|
||||
$html .= '<li><a id="ip-geo-block-apply-layout" class="button button-secondary" href="';
|
||||
$html .= esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 5 ), network_admin_url( 'admin.php' ) ) );
|
||||
$html .= '">' . __( 'Apply', 'ip-geo-block' ) . '</a></li>';
|
||||
$html .= '</ul>';
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_chart-size',
|
||||
__( 'Chart display layout', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'value' => $html,
|
||||
)
|
||||
);
|
||||
|
||||
/*----------------------------------------*
|
||||
* Duration to retrieve
|
||||
*----------------------------------------*/
|
||||
$time = array(
|
||||
__( 'All', 'ip-geo-block' ),
|
||||
__( 'Latest 1 hour', 'ip-geo-block' ),
|
||||
__( 'Latest 24 hours', 'ip-geo-block' ),
|
||||
__( 'Latest 1 week', 'ip-geo-block' ),
|
||||
);
|
||||
|
||||
// make a list of duration
|
||||
$html = "\n";
|
||||
foreach ( $time as $key => $val ) {
|
||||
$html .= '<li><label><input type="radio" name="' . $option_slug . '-duration" value="' . $key . '"'
|
||||
. ($key == self::$controls['time'] ? ' checked="checked"' : '') . ' />' . $val . '</label></li>' . "\n";
|
||||
}
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_select_duration',
|
||||
__( 'Duration to retrieve', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'value' => '<ul id="' . $option_slug . '-select-duration">' . $html . '</ul>',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render log data
|
||||
*
|
||||
* @param array $args associative array of `id`, `title`, `callback`.
|
||||
*/
|
||||
public static function render_network( $args ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'admin/includes/class-admin-ajax.php';
|
||||
|
||||
if ( self::$controls['warn'] ) {
|
||||
$context = IP_Geo_Block_Admin::get_instance();
|
||||
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 5 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-5' );
|
||||
echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord “Validation logs”%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '"><strong>', '</strong></a>' ), '</p>', "\n";
|
||||
echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
|
||||
}
|
||||
|
||||
$row = self::$controls['rows'] * 5;
|
||||
$col = self::$controls['cols'];
|
||||
$page = empty( $_REQUEST['p']) ? 0 : (int)$_REQUEST['p'];
|
||||
$start = $page * ( $row * $col );
|
||||
$count = min( $total = IP_Geo_Block_Admin_Ajax::get_network_count(), $row * $col );
|
||||
|
||||
// [0]:site, [1]:comment, [2]:xmlrpc, [3]:login, [4]:admin, [5]:public, [6]:link
|
||||
$json = IP_Geo_Block_Admin_Ajax::restore_network( self::$controls['time'], $start, $count, FALSE );
|
||||
|
||||
// Max value on hAxis
|
||||
$max = 0;
|
||||
$num = count( $json );
|
||||
for ( $i = 0; $i < $num; ++$i ) {
|
||||
$max = max( $max, array_sum( array_slice( $json[ $i ], 1, 5 ) ) );
|
||||
}
|
||||
|
||||
// Split the array into chunks
|
||||
$arr = array_chunk( $json, $row );
|
||||
$num = (int)floor( count( $arr ) / $col );
|
||||
|
||||
// Embed array into data attribute as json
|
||||
echo '<div class="ip-geo-block-row ip-geo-block-range" data-ip-geo-block-range="[0,', $max, ']">', "\n";
|
||||
for ( $i = 0; $i < $col; ++$i ) {
|
||||
if ( isset( $arr[ $i ] ) ) {
|
||||
echo '<div class="ip-geo-block-network ip-geo-block-column" ',
|
||||
'id="', $args['id'], '-', $i, '" ',
|
||||
'data-', $args['id'], '-', $i, '=\'', json_encode( $arr[ $i ] ), '\'>',
|
||||
'</div>', "\n";
|
||||
} else {
|
||||
echo '<div class="ip-geo-block-column"></div>';
|
||||
}
|
||||
}
|
||||
echo '</div>', "\n";
|
||||
|
||||
// pagination
|
||||
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 5 ), network_admin_url( 'admin.php' ) ) );
|
||||
echo '<div class="dataTables_wrapper"><div class="dataTables_paginate">', "\n",
|
||||
'<a class="paginate_button first', ($page === 0 ? ' disabled' : ''), '" href="', $url, '&p=', (0 ), '">«</a>',
|
||||
'<a class="paginate_button previous', ($page === 0 ? ' disabled' : ''), '" href="', $url, '&p=', (0 < $page ? $page-1 : 0), '">‹</a><span>';
|
||||
|
||||
$num = (int)ceil( $total / ( $row * $col ) );
|
||||
for ( $i = 0; $i < $num; ++$i ) {
|
||||
echo '<a class="paginate_button', ($i === $page ? ' current' : ''), '" href="', $url, '&p=', $i, '">', $i+1, '</a>';
|
||||
}
|
||||
$num -= 1;
|
||||
|
||||
echo '</span>',
|
||||
'<a class="paginate_button next', ($page === $num ? ' disabled' : ''), '" href="', $url, '&p=', ($num > $page ? $page+1 : $page), '">›</a>',
|
||||
'<a class="paginate_button last', ($page === $num ? ' disabled' : ''), '" href="', $url, '&p=', ($num ), '">»</a>',
|
||||
'</div></div>', "\n"; // paginate wrapper
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,420 +0,0 @@
|
||||
<?php
|
||||
class IP_Geo_Block_Admin_Tab {
|
||||
|
||||
public static function tab_setup( $context, $tab ) {
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$plugin_slug = IP_Geo_Block::PLUGIN_NAME;
|
||||
|
||||
register_setting(
|
||||
$option_slug = IP_Geo_Block::PLUGIN_NAME,
|
||||
$option_name = IP_Geo_Block::OPTION_NAME
|
||||
);
|
||||
|
||||
/*----------------------------------------*
|
||||
* Statistics of validation
|
||||
*----------------------------------------*/
|
||||
add_settings_section(
|
||||
$section = $plugin_slug . '-statistics',
|
||||
__( 'Statistics of validation', 'ip-geo-block' ),
|
||||
( $options['save_statistics'] ?
|
||||
NULL :
|
||||
array( __CLASS__, 'warn_statistics' )
|
||||
),
|
||||
$option_slug
|
||||
);
|
||||
|
||||
if ( $options['save_statistics'] ) :
|
||||
$statistics = IP_Geo_Block_Logs::restore_stat();
|
||||
|
||||
// Number of blocked access
|
||||
add_settings_field(
|
||||
$option_name.'_blocked',
|
||||
__( 'Blocked', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'blocked',
|
||||
'value' => (int)$statistics['blocked'],
|
||||
)
|
||||
);
|
||||
|
||||
// Blocked by countries
|
||||
$count = array();
|
||||
|
||||
arsort( $statistics['countries'] );
|
||||
foreach ( $statistics['countries'] as $key => $val ) {
|
||||
$count[] = array( esc_html( $key ), (int)$val );
|
||||
}
|
||||
|
||||
$html = '<div id="' . $plugin_slug . '-chart-countries" data-' . $plugin_slug . '-chart-countries=\'' . json_encode( $count ) . '\'></div>';
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_countries',
|
||||
__( 'Blocked by countries', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'countries',
|
||||
'value' => $html,
|
||||
)
|
||||
);
|
||||
|
||||
// Blocked hooks by date
|
||||
$zero = array(
|
||||
'comment' => 0,
|
||||
'xmlrpc' => 0,
|
||||
'login' => 0,
|
||||
'admin' => 0,
|
||||
'public' => 0,
|
||||
);
|
||||
|
||||
$prev = 0;
|
||||
$count = array();
|
||||
|
||||
// make array( `time`, `comment`, `xlmrpc`, `login`, `admin`, `public` )
|
||||
foreach ( $statistics['daystats'] as $key => $val ) {
|
||||
while ( $prev && $key - $prev > DAY_IN_SECONDS ) {
|
||||
$count[] = array( $prev += DAY_IN_SECONDS, 0, 0, 0, 0, 0 );
|
||||
}
|
||||
$count[] = array_merge(
|
||||
array( $prev = $key ),
|
||||
array_values( array_merge( $zero, $val ) )
|
||||
);
|
||||
}
|
||||
|
||||
// embed array into data attribute as json
|
||||
$html = '<div id="' . $plugin_slug . '-chart-daily" data-' . $plugin_slug . '-chart-daily=\'' . json_encode( $count ) . '\'></div>';
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_daily',
|
||||
__( 'Blocked per day', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'daily',
|
||||
'value' => $html,
|
||||
)
|
||||
);
|
||||
|
||||
// Blocked by type of IP address
|
||||
add_settings_field(
|
||||
$option_name.'_type',
|
||||
__( 'Blocked by type of IP address', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'type',
|
||||
'value' => '<table class="'.$option_slug.'-statistics-table">' .
|
||||
'<thead><tr><th>IPv4</th><th>IPv6</th></tr></thead><tbody><tr>' .
|
||||
'<td>' . esc_html( $statistics['IPv4'] ) . '</td>' .
|
||||
'<td>' . esc_html( $statistics['IPv6'] ) . '</td>' .
|
||||
'</tr></tbody></table>',
|
||||
)
|
||||
);
|
||||
|
||||
$html = '<table class="'.$option_slug.'-statistics-table"><thead><tr>';
|
||||
$html .= '<th>' . __( 'Name of API', 'ip-geo-block' ) . '</th>';
|
||||
$html .= '<th>' . __( 'Call', 'ip-geo-block' ) . '</th>';
|
||||
$html .= '<th>' . __( 'Response [msec]', 'ip-geo-block' ) . '</th>';
|
||||
$html .= '</tr></thead><tbody>';
|
||||
|
||||
foreach ( $statistics['providers'] as $key => $val ) {
|
||||
$html .= '<tr><td>' . esc_html( $key ) . '</td>';
|
||||
$html .= '<td>' . sprintf( '%5d', (int)$val['count'] ) . '</td><td>';
|
||||
$html .= sprintf( '%4.1f', (float)(1000.0 * $val['time'] / $val['count']) );
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
$html .= "</tbody></table>";
|
||||
|
||||
// Average response time of each API
|
||||
add_settings_field(
|
||||
$option_name.'_service',
|
||||
__( 'Average response time of each API', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'html',
|
||||
'option' => $option_name,
|
||||
'field' => 'service',
|
||||
'value' => $html,
|
||||
)
|
||||
);
|
||||
|
||||
// Clear statistics
|
||||
add_settings_field(
|
||||
$option_name.'_clear_statistics',
|
||||
__( 'Clear statistics', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'button',
|
||||
'option' => $option_name,
|
||||
'field' => 'clear_statistics',
|
||||
'value' => __( 'Clear all', 'ip-geo-block' ),
|
||||
'after' => '<div id="'.$plugin_slug.'-statistics"></div>',
|
||||
)
|
||||
);
|
||||
|
||||
endif;
|
||||
|
||||
/*----------------------------------------*
|
||||
* Statistics in Validation logs
|
||||
*----------------------------------------*/
|
||||
add_settings_section(
|
||||
$section = $plugin_slug . '-stat-logs',
|
||||
__( 'Statistics in validation logs', 'ip-geo-block' ),
|
||||
( $options['validation']['reclogs'] ?
|
||||
array( __CLASS__, 'statistics_logs' ) :
|
||||
array( __CLASS__, 'warn_validation' )
|
||||
),
|
||||
$option_slug
|
||||
);
|
||||
|
||||
if ( $options['validation']['reclogs'] ) :
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_clear_logs',
|
||||
__( 'Clear logs', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'button',
|
||||
'option' => $option_name,
|
||||
'field' => 'clear_logs',
|
||||
'value' => __( 'Clear all', 'ip-geo-block' ),
|
||||
)
|
||||
);
|
||||
|
||||
endif;
|
||||
|
||||
/*----------------------------------------*
|
||||
* Statistics in IP address cache
|
||||
*----------------------------------------*/
|
||||
add_settings_section(
|
||||
$section = $plugin_slug . '-cache',
|
||||
__( 'Statistics in IP address cache', 'ip-geo-block' ),
|
||||
( $options['cache_hold'] ?
|
||||
array( __CLASS__, 'statistics_cache' ) :
|
||||
array( __CLASS__, 'warn_ipadr_cache' )
|
||||
),
|
||||
$option_slug
|
||||
);
|
||||
|
||||
if ( $options['cache_hold'] ) :
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_search_filter',
|
||||
__( 'Search in cache', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'text',
|
||||
'option' => $option_name,
|
||||
'field' => 'search_filter',
|
||||
'value' => '',
|
||||
'after' => '<a class="button button-secondary" id="ip-geo-block-reset-filter" title="'
|
||||
. __( 'Reset', 'ip-geo-block' ) . '" href="#!">'. __( 'Reset', 'ip-geo-block' ) . '</a>',
|
||||
)
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_bulk_action',
|
||||
__( 'Bulk action', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'select',
|
||||
'option' => $option_name,
|
||||
'field' => 'bulk_action',
|
||||
'value' => 0,
|
||||
'list' => array(
|
||||
0 => NULL,
|
||||
'bulk-action-remove' => __( 'Remove entries by IP address', 'ip-geo-block' ),
|
||||
'bulk-action-ip-white' => __( 'Add IP address to “Whitelist”', 'ip-geo-block' ),
|
||||
'bulk-action-ip-black' => __( 'Add IP address to “Blacklist”', 'ip-geo-block' ), ) + ( $options['Maxmind']['use_asn'] <= 0 ? array() : array(
|
||||
'bulk-action-as-white' => __( 'Add AS number to “Whitelist”', 'ip-geo-block' ),
|
||||
'bulk-action-as-black' => __( 'Add AS number to “Blacklist”', 'ip-geo-block' ),
|
||||
) ),
|
||||
'after' => '<a class="button button-secondary" id="ip-geo-block-bulk-action" title="' . __( 'Apply', 'ip-geo-block' ) . '" href="#!">' . __( 'Apply', 'ip-geo-block' ) . '</a>' . '<div id="'.$plugin_slug.'-loading"></div>',
|
||||
)
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
$option_name.'_clear_all',
|
||||
__( 'Clear cache', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'button',
|
||||
'option' => $option_name,
|
||||
'field' => 'clear_all',
|
||||
'value' => __( 'Clear all', 'ip-geo-block' ),
|
||||
'after' => '<div id="'.$plugin_slug.'-cache"></div>',
|
||||
)
|
||||
);
|
||||
|
||||
// Export cache
|
||||
add_settings_field(
|
||||
$option_name.'_export_cache',
|
||||
__( 'Export cache', 'ip-geo-block' ),
|
||||
array( $context, 'callback_field' ),
|
||||
$option_slug,
|
||||
$section,
|
||||
array(
|
||||
'type' => 'none',
|
||||
'before' => '<a class="button button-secondary" id="ip-geo-block-export-cache" title="' . __( 'Export to the local file', 'ip-geo-block' ) . '" href="#!">'. __( 'Export csv', 'ip-geo-block' ) . '</a>',
|
||||
'after' => '<div id="'.$plugin_slug.'-export"></div>',
|
||||
)
|
||||
);
|
||||
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render top list in logs
|
||||
*
|
||||
*/
|
||||
public static function statistics_logs() {
|
||||
// Count by key
|
||||
$count = array();
|
||||
$keys = array(
|
||||
'code' => __( 'Country (Top 10)', 'ip-geo-block' ),
|
||||
'asn' => __( 'AS number (Top 10)', 'ip-geo-block' ),
|
||||
'ip' => __( 'IP address (Top 10)', 'ip-geo-block' ),
|
||||
'slug' => __( 'Slug in back-end', 'ip-geo-block' ),
|
||||
);
|
||||
|
||||
// Count by keys ($log: `time`, `ip`, `hook`, `code`, `method`, `data`)
|
||||
foreach( IP_Geo_Block_Logs::get_recent_logs( YEAR_IN_SECONDS ) as $log ) {
|
||||
$log['ip'] = '[' . $log['code'] . '] ' . $log['ip'];
|
||||
$key = $log['method'] . ' ' . $log['data'];
|
||||
|
||||
// <methodName>...</methodName>
|
||||
if ( preg_match( '#<methodName>(.*?)</methodName>#', $key, $matches ) )
|
||||
$log['slug'] = '/xmlrpc.php ' . $matches[1];
|
||||
|
||||
// /wp-content/(plugins|themes)/...
|
||||
elseif ( preg_match( '#(/wp-content/(?:plugins|themes)/.*?/)#', $key, $matches ) )
|
||||
$log['slug'] = $matches[1];
|
||||
|
||||
// /wp-admin/admin*.php?action=...
|
||||
elseif ( preg_match( '#(/wp-admin/admin.*?\.php).*((?:page|action)=[-\w]+)#', $key, $matches ) )
|
||||
$log['slug'] = $matches[1] . ' ' . $matches[2];
|
||||
|
||||
// /wp-admin/*.php
|
||||
elseif ( preg_match( '#(/wp-admin/(?!admin).*?\.php)#', $key, $matches ) )
|
||||
$log['slug'] = $matches[1];
|
||||
|
||||
// file uploading *.(zip|tar|rar|gz|php|...)
|
||||
elseif ( preg_match( '#(\[name\]\s*?=>\s*?[^\s]+)#', $key, $matches ) )
|
||||
$log['slug'] = $matches[1];
|
||||
|
||||
// other *.php file with or without query string
|
||||
elseif ( preg_match( '#(/[^/]*\.php)[^/\w]#', $key, $matches ) && FALSE === strpos( $key, '/wp-admin/' ) )
|
||||
$log['slug'] = $matches[1];
|
||||
|
||||
foreach ( array_keys( $keys ) as $key ) {
|
||||
if ( ! empty( $log[ $key ] ) )
|
||||
$count[ $key ][] = $log[ $key ];
|
||||
}
|
||||
}
|
||||
|
||||
$options = IP_Geo_Block::get_option();
|
||||
|
||||
// Statistics by keys
|
||||
foreach ( $keys as $slug => $log ) {
|
||||
if ( 'slug' !== $slug )
|
||||
echo '<ol class="ip-geo-block-top-list"><h4>', esc_html( $log ), '</h4>';
|
||||
else
|
||||
echo '<ol class="ip-geo-block-top-list"><h4>', esc_html( $log ), ' <a class="ip-geo-block-icon ip-geo-block-icon-cycle" id="ip-geo-block-sort-slug" title="', __( 'Toggle sorting order', 'ip-geo-block' ) ,'"><span></span></a></h4>';
|
||||
|
||||
if ( isset( $count[ $slug ] ) ) {
|
||||
$logs = array_count_values( $count[ $slug ] );
|
||||
arsort( $logs );
|
||||
|
||||
if ( 'slug' !== $slug )
|
||||
$logs = array_slice( $logs, 0, 10 ); // Make list of top 10
|
||||
|
||||
foreach ( $logs as $key => $log ) {
|
||||
$link = explode( ' ', $key );
|
||||
$link = esc_html( end( $link ) );
|
||||
$key = esc_html( $key );
|
||||
|
||||
if ( 'ip' === $slug && $options['anonymize'] )
|
||||
$link = $key = IP_Geo_Block_Util::anonymize_ip( $link );
|
||||
|
||||
echo '<li><code>';
|
||||
echo str_replace(
|
||||
$link,
|
||||
'<a href="' .
|
||||
esc_url( add_query_arg(
|
||||
array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 4, 's' => $link ),
|
||||
admin_url( 'options-general.php' )
|
||||
) ) .
|
||||
'" target=_blank>' . $link . '</a>',
|
||||
$key
|
||||
);
|
||||
echo '</code> (', (int)$log, ')</li>', "\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ol>', "\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render IP address cache
|
||||
*
|
||||
*/
|
||||
public static function statistics_cache() {
|
||||
echo '<table id="', IP_Geo_Block::PLUGIN_NAME, '-statistics-cache" class="', IP_Geo_Block::PLUGIN_NAME, '-dataTable display" cellspacing="0" width="100%">', "\n", '<thead></thead><tbody></tbody></table>', "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that fills the section with the desired content.
|
||||
*
|
||||
*/
|
||||
private static function dashboard_url() {
|
||||
$options = IP_Geo_Block::get_option();
|
||||
$context = IP_Geo_Block_Admin::get_instance();
|
||||
return $context->dashboard_url( $options['network_wide'] );
|
||||
}
|
||||
|
||||
public static function warn_statistics() {
|
||||
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), self::dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
|
||||
echo '<p>', sprintf( __( '[ %sRecord “Statistics of validation”%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
|
||||
echo '<p>', __( 'Please set the proper condition to record and analyze the validation statistics.', 'ip-geo-block' ), '</p>', "\n";
|
||||
}
|
||||
|
||||
public static function warn_validation() {
|
||||
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), self::dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
|
||||
echo '<p>', sprintf( __( '[ %sRecord “Validation logs”%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
|
||||
echo '<p>', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
|
||||
}
|
||||
|
||||
public static function warn_ipadr_cache() {
|
||||
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), self::dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
|
||||
echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord “IP address cache”%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
|
||||
echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record IP address in cache.', 'ip-geo-block' ), '</p>', "\n";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,520 +0,0 @@
|
||||
/*jslint white: true */
|
||||
/*!
|
||||
* Project: WP-ZEP - Zero-day exploit Prevention for wp-admin
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
(function ($, window, document) {
|
||||
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Description
|
||||
var auth = IP_GEO_BLOCK_AUTH, wpzep = {
|
||||
init: false,
|
||||
regexp: new RegExp(auth.key + '(?:=|%3D)\\w+')
|
||||
},
|
||||
|
||||
// regular expression to find target for is_admin()
|
||||
regexp = new RegExp(
|
||||
'^(?:' + (auth.home || '') + auth.admin
|
||||
+ '|' + (auth.home || '') + auth.plugins
|
||||
+ '|' + (auth.home || '') + auth.themes
|
||||
+ '|' + (auth.admin ) // when site url is different from home url
|
||||
+ ')(?:.*\\.php|.*\\/)?$'
|
||||
),
|
||||
|
||||
// `theme-install.php` eats the query and set it to `request[browse]` as a parameter
|
||||
theme_featured = function (data) {
|
||||
var i = data.length, q = 'request%5Bbrowse%5D=' + auth.key;
|
||||
while (i-- > 0) {
|
||||
if (data[i].indexOf(q) !== -1) {
|
||||
data[i] = 'request%5Bbrowse%5D=featured'; // correct the parameter
|
||||
break;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// `upload.php` eats the query and set it to `query[ip-geo-block-auth-nonce]` as a parameter
|
||||
media_library = function (data) {
|
||||
var i = data.length, q = 'query%5B' + auth.key + '%5D=';
|
||||
while (i-- > 0) {
|
||||
if (data[i].indexOf(q) !== -1) {
|
||||
delete data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// list of excluded links
|
||||
ajax_links = {
|
||||
'upload.php': media_library,
|
||||
'theme-install.php': theme_featured,
|
||||
'network/theme-install.php': theme_featured
|
||||
};
|
||||
|
||||
// Check path that should be excluded
|
||||
function check_ajax(path) {
|
||||
path = path.replace(auth.home + auth.admin, '');
|
||||
return ajax_links.hasOwnProperty(path) ? ajax_links[path] : null;
|
||||
}
|
||||
|
||||
// Escape string for use in HTML.
|
||||
function escapeHTML(html) {
|
||||
var elem = document.createElement('div');
|
||||
elem.appendChild(document.createTextNode(html));
|
||||
html = elem.innerHTML.replace(/["']/g, function (match) {
|
||||
return {
|
||||
'"': '"',
|
||||
"'": ''' //"
|
||||
}[match];
|
||||
});
|
||||
elem = '';
|
||||
return html;
|
||||
}
|
||||
|
||||
// Parse a URL and return its components
|
||||
function parse_uri(uri) {
|
||||
// avoid malformed URI error when uri includes '%'
|
||||
uri = /*decodeURIComponent*/(uri ? uri.toString() : '');
|
||||
|
||||
var m = uri.match(
|
||||
// https://tools.ietf.org/html/rfc3986#appendix-B
|
||||
/^(?:([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/
|
||||
);
|
||||
|
||||
// scheme :// authority path ? query # fragment
|
||||
return {
|
||||
scheme: m[1] || '',
|
||||
relative: m[2] || '',
|
||||
authority: m[3] || '',
|
||||
path: m[4] || '',
|
||||
query: m[5] || '',
|
||||
fragment: m[6] || ''
|
||||
};
|
||||
}
|
||||
|
||||
// Compose a URL from components
|
||||
function compose_uri(uri) {
|
||||
return (uri.scheme ? uri.scheme + ':' : '') +
|
||||
(uri.relative + uri.path) +
|
||||
(uri.query ? '?' + uri.query : '') +
|
||||
(uri.fragment ? '#' + uri.fragment : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert relative url to absolute url using browser feature
|
||||
*
|
||||
* @param string target url
|
||||
* @param string base of absolute url (default window.locatoin.href)
|
||||
* @return component of url
|
||||
*/
|
||||
var absolute_uri = (function () {
|
||||
var doc = null;
|
||||
|
||||
try {
|
||||
new URL('/', 'http://example.com/'); // test if URL object is abailable
|
||||
} catch (e) {
|
||||
try {
|
||||
doc = (new DOMParser()).parseFromString('<html><head></head><body></body></html>', 'text/html'); // IE11
|
||||
} catch (f) {
|
||||
doc = document.implementation.createHTMLDocument(''); // IE10
|
||||
}
|
||||
}
|
||||
|
||||
return function (url, base) {
|
||||
var d = document, baseElm, aElm, result;
|
||||
url = typeof url !== 'undefined' ? url : window.location.href;
|
||||
if (null === doc) {
|
||||
if (typeof base === 'undefined') {
|
||||
base = window.location.href; // based on current url
|
||||
}
|
||||
try {
|
||||
result = new URL(url, base); // base must be valid
|
||||
} catch (e) {
|
||||
result = new URL(url, window.location.href);
|
||||
}
|
||||
} else {
|
||||
// use anchor element to resolve url
|
||||
if (typeof base !== 'undefined') {
|
||||
// assign base element to anchor to be independent of the current document
|
||||
d = doc;
|
||||
while (d.head.firstChild) {
|
||||
d.head.removeChild(d.head.firstChild);
|
||||
}
|
||||
baseElm = d.createElement('base');
|
||||
baseElm.setAttribute('href', base);
|
||||
d.head.appendChild(baseElm);
|
||||
}
|
||||
aElm = d.createElement('a');
|
||||
aElm.setAttribute('href', url);
|
||||
aElm.setAttribute('href', aElm.href);
|
||||
//d.appendChild(aElm);
|
||||
|
||||
result = {
|
||||
protocol: aElm.protocol,
|
||||
host: aElm.host,
|
||||
hostname: aElm.hostname,
|
||||
port: aElm.port,
|
||||
pathname: aElm.pathname,
|
||||
search: aElm.search,
|
||||
hash: aElm.hash,
|
||||
href: aElm.href,
|
||||
username: '',
|
||||
password: '',
|
||||
origin : aElm.origin || null
|
||||
};
|
||||
if ('http:' === result.protocol && '80' === result.port) {
|
||||
// remove port number `80` in case of `http` and defalut port
|
||||
result.port = '';
|
||||
result.host = result.host.replace(/:80$/, '');
|
||||
} else if ('https:' === result.protocol && '443' === result.port) {
|
||||
// remove port number `443` in case of `https` and defalut port
|
||||
result.port = '';
|
||||
result.host = result.host.replace(/:443$/, '');
|
||||
}
|
||||
if ('http:' === result.protocol || 'https:' === result.protocol) {
|
||||
if (result.pathname && result.pathname.charAt(0) !== '/') {
|
||||
// in case no `/` at the top
|
||||
result.pathname = '/' + result.pathname;
|
||||
}
|
||||
if (!result.origin) {
|
||||
result.origin = result.protocol + '//' + result.hostname + (result.port ? ':' + result.port : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.username || result.password) {
|
||||
// throw an error if basic basic authentication is targeted
|
||||
throw new URIError(result.username + ':' + result.password);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}());
|
||||
/*
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
|
||||
function encodeURIComponentRFC3986(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
||||
return '%' + c.charCodeAt(0).toString(16);
|
||||
});
|
||||
}
|
||||
*/
|
||||
// Append the nonce as query strings to the uri
|
||||
function add_query_nonce(uri, nonce) {
|
||||
if (typeof uri !== 'object') { // `string` or `undefined`
|
||||
uri = parse_uri(uri || window.location.href);
|
||||
}
|
||||
|
||||
var data = uri.query ? uri.query.split('&') : [],
|
||||
i = data.length,
|
||||
q = auth.key + '=';
|
||||
|
||||
// remove an old nonce
|
||||
while (i-- > 0) {
|
||||
if (data[i].indexOf(q) === 0) { // or `wpzep.regexp.test(data[i])`
|
||||
data.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data.push(auth.key + '=' + encodeURIComponent(nonce)); //RFC3986
|
||||
uri.query = data.join('&');
|
||||
|
||||
return compose_uri(uri);
|
||||
}
|
||||
|
||||
// Check uri component if it is not empty or only fragment (`#...`)
|
||||
function check_uri(uri) {
|
||||
return (!uri.scheme || /^https?$/.test(uri.scheme)) && (uri.path || uri.query);
|
||||
}
|
||||
|
||||
// Check uri where the nonce is needed
|
||||
// Note: in case of url in the admin area of different site, it returns 0
|
||||
function is_admin(url) {
|
||||
// parse uri and get real path
|
||||
try {
|
||||
url = url || window.location.pathname || ''; // in case of empty `action` on the form tag
|
||||
} catch (e) {
|
||||
url = '';
|
||||
}
|
||||
|
||||
var uri = parse_uri(url.toLowerCase());
|
||||
|
||||
// possibly scheme is `javascript` and path is `void(0);`
|
||||
if (check_uri(uri)) {
|
||||
// get absolute path with flattening `./`, `../`, `//`
|
||||
uri = absolute_uri(url);
|
||||
|
||||
// external domain (`http://example` or `www.example`)
|
||||
// https://tools.ietf.org/html/rfc6454#section-4
|
||||
if (uri.origin !== window.location.origin) {
|
||||
return -1; // external
|
||||
}
|
||||
|
||||
// check if uri includes the target path of zep
|
||||
url = regexp.exec(uri.pathname);
|
||||
if (url) {
|
||||
if ((0 <= url[0].indexOf(auth.admin + 'admin-')) ||
|
||||
(0 <= url[0].indexOf(auth.admin )) ||
|
||||
(0 <= url[0].indexOf(auth.plugins )) ||
|
||||
(0 <= url[0].indexOf(auth.themes ))) {
|
||||
return 1; // internal for admin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // internal not admin
|
||||
}
|
||||
|
||||
// Check if current page is admin area and the target of wp-zep
|
||||
function is_backend() {
|
||||
return (is_admin(window.location.pathname) === 1 || wpzep.regexp(window.location.search));
|
||||
}
|
||||
|
||||
// Check if url belongs to multisite
|
||||
function is_multisite(url) {
|
||||
var i, j, n = auth.sites.length;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
j = url.indexOf(auth.sites[i] + '/');
|
||||
if (0 <= j && j <= 6) { // from `//` to `https://`
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the uri does not need a nonce
|
||||
function is_neutral(uri) {
|
||||
// return !uri.query; // without queries
|
||||
// return !uri.query || !$('body').hasClass('wp-core-ui'); // without queries or outside dashboard
|
||||
return /\/$/.test(uri.path); // `/wp-admin/`
|
||||
}
|
||||
|
||||
// check if the link has nofollow
|
||||
function has_nofollow($elem) {
|
||||
return -1 !== ($elem.attr('rel') || '').indexOf('nofollow');
|
||||
}
|
||||
/*
|
||||
$.ajaxSetup({
|
||||
beforeSend: function (xhr, settings) {
|
||||
// settings: {
|
||||
// url: '/wp-admin/admin-ajax.php'
|
||||
// method: 'POST' or 'GET'
|
||||
// contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
// data: 'action=...'
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// plupload
|
||||
$(window).on('BeforeUpload', function (uploader, file) {
|
||||
console.log(uploader);
|
||||
});
|
||||
*/
|
||||
// Embed a nonce before an Ajax request is sent
|
||||
// $(document).ajaxSend(function (event, jqxhr, settings) {
|
||||
$.ajaxPrefilter(function (settings /*, original, jqxhr*/) {
|
||||
// POST to async-upload.php causes an error in https://wordpress.org/plugins/mammoth-docx-converter/
|
||||
if (is_admin(settings.url) === 1 && !settings.url.match(/async-upload\.php$/)) {
|
||||
// multipart/form-data (XMLHttpRequest Level 2)
|
||||
// IE10+, Firefox 4+, Safari 5+, Android 3+
|
||||
if (typeof window.FormData !== 'undefined' && settings.data instanceof FormData) {
|
||||
settings.data.append(auth.key, auth.nonce);
|
||||
}
|
||||
|
||||
// application/x-www-form-urlencoded
|
||||
else {
|
||||
// Behavior of jQuery Ajax
|
||||
// method url url+data data
|
||||
// GET query query data
|
||||
// POST query query data
|
||||
var data, callback, uri = parse_uri(settings.url);
|
||||
|
||||
if (typeof settings.data === 'undefined' || uri.query) {
|
||||
settings.url = add_query_nonce(uri, auth.nonce);
|
||||
} else {
|
||||
data = settings.data ? settings.data.split('&') : [];
|
||||
callback = check_ajax(window.location.pathname);
|
||||
if (callback) {
|
||||
data = callback(data);
|
||||
}
|
||||
data.push(auth.key + '=' + encodeURIComponent(auth.nonce)); //RFC3986
|
||||
settings.data = data.join('&');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* jQuery.bind-first library v0.2.3 (jquery >= 1.7)
|
||||
* Copyright (c) 2013 Vladimir Zhuravlev
|
||||
*
|
||||
* Released under MIT License
|
||||
* @license https://github.com/private-face/jquery.bind-first
|
||||
*
|
||||
* Date: Thu Feb 6 10:13:59 ICT 2014
|
||||
*/
|
||||
function moveHandlerToTop($el, eventName, isDelegated) {
|
||||
var data = $._data($el[0]).events,
|
||||
events = data[eventName],
|
||||
handler = isDelegated ? events.splice(events.delegateCount - 1, 1)[0] : events.pop();
|
||||
|
||||
events.splice(isDelegated ? 0 : (events.delegateCount || 0), 0, handler);
|
||||
}
|
||||
|
||||
function moveEventHandlers($elems, eventsString, isDelegate) {
|
||||
var events = eventsString.split(/\s+/);
|
||||
$elems.each(function(i) {
|
||||
for (i = 0; i < events.length; ++i) {
|
||||
var pureEventName = $.trim(events[i]).match(/[^\.]+/i)[0];
|
||||
moveHandlerToTop($(this), pureEventName, isDelegate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof $.fn.onFirst === 'undefined') {
|
||||
$.fn.onFirst = function(types, selector) {
|
||||
var type, $el = $(this), isDelegated = (typeof selector === 'string');
|
||||
|
||||
$.fn.on.apply($el, arguments);
|
||||
|
||||
// events map
|
||||
if (typeof types === 'object') {
|
||||
for (type in types) {
|
||||
if (types.hasOwnProperty(type)) {
|
||||
moveEventHandlers($el, type, isDelegated);
|
||||
}
|
||||
}
|
||||
} else if (typeof types === 'string') {
|
||||
moveEventHandlers($el, types, isDelegated);
|
||||
}
|
||||
|
||||
return $el;
|
||||
};
|
||||
}
|
||||
|
||||
/*--------------------------------
|
||||
* Attach event to the document
|
||||
*--------------------------------*/
|
||||
function attach_event() {
|
||||
// https://www.sitepoint.com/jquery-body-on-document-on/
|
||||
var elem = $(document); // `html` or `body` doesn't work with some browsers
|
||||
|
||||
elem.onFirst('click contextmenu', 'a', function (event) {
|
||||
var admin = 0, // default: do nothing if href is empty
|
||||
$this = $(this),
|
||||
href = $this.attr('href') || '', // returns 'string' or 'undefined'
|
||||
uri = parse_uri(href);
|
||||
|
||||
// check href has right scheme and path
|
||||
if (check_uri(uri)) {
|
||||
admin = is_admin(href);
|
||||
}
|
||||
|
||||
// console.log('href:' + href, uri, 'admin:' + admin, 'is_backend:' + is_backend(), 'is_multisite:' + is_multisite(href));
|
||||
|
||||
// if context menu then continue and should be checked in check_nonce()
|
||||
if ('click' !== event.type) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if admin area (except a link with nofollow in the comment thread) then add a nonce
|
||||
else if (admin === 1) {
|
||||
$this.attr('href', is_neutral(uri) ? href :
|
||||
add_query_nonce( href, has_nofollow($this) ? 'nofollow' : auth.nonce )
|
||||
);
|
||||
}
|
||||
|
||||
// if external then redirect with no referrer not to leak out the nonce
|
||||
else if (admin === -1 && is_backend()) {
|
||||
// open within the same window
|
||||
if ('_self' === $this.attr('target') || is_multisite(href)) {
|
||||
$this.attr('href', is_neutral(uri) ? href :
|
||||
add_query_nonce( href, has_nofollow($this) ? 'nofollow' : auth.nonce )
|
||||
);
|
||||
}
|
||||
|
||||
// open a new window
|
||||
else if (!this.hasAttribute('onClick')) {
|
||||
// avoid `url=...;url=javascript:...`
|
||||
href = href.split(';', 2).shift();
|
||||
href = escapeHTML(decodeURIComponent(this.href)); // & => &
|
||||
|
||||
admin = window.open();
|
||||
admin.document.write(
|
||||
'<!DOCTYPE html><html><head>' +
|
||||
'<meta name="referrer" content="never" />' +
|
||||
'<meta name="referrer" content="no-referrer" />' +
|
||||
'<meta http-equiv="refresh" content="0; url=' + href + '" />' +
|
||||
($('body').hasClass('webview') ? '<script>window.location.replace("' + href + '")</script>' : '') +
|
||||
'</head></html>'
|
||||
);
|
||||
admin.document.close();
|
||||
|
||||
// stop event propagation and location transition
|
||||
event.stopImmediatePropagation();
|
||||
return false; // same as event.stopPropagation() and event.preventDefault()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
elem.onFirst('submit', 'form', function (/*event*/) {
|
||||
var $this = $(this), action = $this.attr('action'); // possibly 'undefined'
|
||||
|
||||
// if admin area then add the nonce
|
||||
if (is_admin(action) === 1) {
|
||||
if ('post' === ($this.attr('method') || '').toLowerCase()) {
|
||||
$this.attr('action', add_query_nonce(action, auth.nonce));
|
||||
} else {
|
||||
// https://www.w3.org/TR/1999/REC-html401-19991224/types.html#type-name
|
||||
$this.append('<input type="hidden" name="' + auth.key + '" value="' + auth.nonce + '">');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*--------------------------------
|
||||
* Something after document ready
|
||||
*--------------------------------*/
|
||||
function attach_ready(/*stat*/) {
|
||||
if (!wpzep.init) {
|
||||
wpzep.init = true;
|
||||
|
||||
$('img').each(function (/*index*/) {
|
||||
var src = $(this).attr('src');
|
||||
|
||||
// if admin area
|
||||
if (is_admin(src) === 1) {
|
||||
$(this).attr('src', add_query_nonce(src, auth.nonce));
|
||||
}
|
||||
});
|
||||
|
||||
// Restore post revisions (wp-admin/revisions.php @since 2.6.0)
|
||||
if ('undefined' !== typeof window._wpRevisionsSettings) {
|
||||
var i, data = window._wpRevisionsSettings.revisionData, n = data.length;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (!wpzep.regexp.test(data[i].restoreUrl)) {
|
||||
window._wpRevisionsSettings.revisionData[i].restoreUrl = add_query_nonce(data[i].restoreUrl, auth.nonce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the title of sub-menu.
|
||||
$('#toplevel_page_ip-geo-block li.wp-first-item').each(function (/*i, obj*/) {
|
||||
var $this = $(this);
|
||||
$this.css('display', 'IP Geo Block' === $this.children('a').text() ? 'none' : 'block');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(window).on('error', function (/*event*/) { // event.originalEvent.message
|
||||
attach_ready(); // fallback on error
|
||||
});
|
||||
|
||||
$(function () {
|
||||
attach_ready();
|
||||
});
|
||||
|
||||
// Attach event to add nonce
|
||||
attach_event();
|
||||
}(jQuery, window, document));
|
||||
@@ -1,16 +0,0 @@
|
||||
/*!
|
||||
* Project: WP-ZEP - Zero-day exploit Prevention for wp-admin
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n){var r=IP_GEO_BLOCK_AUTH,o={init:!1,regexp:new RegExp(r.key+"(?:=|%3D)\\w+")},a=new RegExp("^(?:"+(r.home||"")+r.admin+"|"+(r.home||"")+r.plugins+"|"+(r.home||"")+r.themes+"|"+r.admin+")(?:.*\\.php|.*\\/)?$"),i=function(e){for(var t=e.length,n="request%5Bbrowse%5D="+r.key;t-- >0;)if(-1!==e[t].indexOf(n)){e[t]="request%5Bbrowse%5D=featured";break}return e},h={"upload.php":function(e){for(var t=e.length,n="query%5B"+r.key+"%5D=";t-- >0;)if(-1!==e[t].indexOf(n)){delete e[t];break}return e},"theme-install.php":i,"network/theme-install.php":i};function s(e){var t=(e=e?e.toString():"").match(/^(?:([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return{scheme:t[1]||"",relative:t[2]||"",authority:t[3]||"",path:t[4]||"",query:t[5]||"",fragment:t[6]||""}}var c,p=function(){var e=null;try{new URL("/","http://example.com/")}catch(t){try{e=(new DOMParser).parseFromString("<html><head></head><body></body></html>","text/html")}catch(t){e=n.implementation.createHTMLDocument("")}}return function(r,o){var a,i,h,s=n;if(r=void 0!==r?r:t.location.href,null===e){void 0===o&&(o=t.location.href);try{h=new URL(r,o)}catch(e){h=new URL(r,t.location.href)}}else{if(void 0!==o){for(s=e;s.head.firstChild;)s.head.removeChild(s.head.firstChild);(a=s.createElement("base")).setAttribute("href",o),s.head.appendChild(a)}(i=s.createElement("a")).setAttribute("href",r),i.setAttribute("href",i.href),"http:"===(h={protocol:i.protocol,host:i.host,hostname:i.hostname,port:i.port,pathname:i.pathname,search:i.search,hash:i.hash,href:i.href,username:"",password:"",origin:i.origin||null}).protocol&&"80"===h.port?(h.port="",h.host=h.host.replace(/:80$/,"")):"https:"===h.protocol&&"443"===h.port&&(h.port="",h.host=h.host.replace(/:443$/,"")),"http:"!==h.protocol&&"https:"!==h.protocol||(h.pathname&&"/"!==h.pathname.charAt(0)&&(h.pathname="/"+h.pathname),h.origin||(h.origin=h.protocol+"//"+h.hostname+(h.port?":"+h.port:"")))}if(h.username||h.password)throw new URIError(h.username+":"+h.password);return h}}();function l(e,n){"object"!=typeof e&&(e=s(e||t.location.href));for(var o=e.query?e.query.split("&"):[],a=o.length,i=r.key+"=";a-- >0;)if(0===o[a].indexOf(i)){o.splice(a,1);break}return o.push(r.key+"="+encodeURIComponent(n)),e.query=o.join("&"),function(e){return(e.scheme?e.scheme+":":"")+(e.relative+e.path)+(e.query?"?"+e.query:"")+(e.fragment?"#"+e.fragment:"")}(e)}function f(e){return(!e.scheme||/^https?$/.test(e.scheme))&&(e.path||e.query)}function u(e){try{e=e||t.location.pathname||""}catch(t){e=""}var n=s(e.toLowerCase());if(f(n)){if((n=p(e)).origin!==t.location.origin)return-1;if((e=a.exec(n.pathname))&&(0<=e[0].indexOf(r.admin+"admin-")||0<=e[0].indexOf(r.admin)||0<=e[0].indexOf(r.plugins)||0<=e[0].indexOf(r.themes)))return 1}return 0}function m(e){return/\/$/.test(e.path)}function d(e){return-1!==(e.attr("rel")||"").indexOf("nofollow")}
|
||||
/*
|
||||
* jQuery.bind-first library v0.2.3 (jquery >= 1.7)
|
||||
* Copyright (c) 2013 Vladimir Zhuravlev
|
||||
*
|
||||
* Released under MIT License
|
||||
* @license https://github.com/private-face/jquery.bind-first
|
||||
*
|
||||
* Date: Thu Feb 6 10:13:59 ICT 2014
|
||||
*/
|
||||
function v(t,n,r){var o=e._data(t[0]).events[n],a=r?o.splice(o.delegateCount-1,1)[0]:o.pop();o.splice(r?0:o.delegateCount||0,0,a)}function g(t,n,r){var o=n.split(/\s+/);t.each(function(t){for(t=0;t<o.length;++t){var n=e.trim(o[t]).match(/[^\.]+/i)[0];v(e(this),n,r)}})}function y(){if(!o.init){if(o.init=!0,e("img").each(function(){var t=e(this).attr("src");1===u(t)&&e(this).attr("src",l(t,r.nonce))}),void 0!==t._wpRevisionsSettings){var n,a=t._wpRevisionsSettings.revisionData,i=a.length;for(n=0;n<i;++n)o.regexp.test(a[n].restoreUrl)||(t._wpRevisionsSettings.revisionData[n].restoreUrl=l(a[n].restoreUrl,r.nonce))}e("#toplevel_page_ip-geo-block li.wp-first-item").each(function(){var t=e(this);t.css("display","IP Geo Block"===t.children("a").text()?"none":"block")})}}e.ajaxPrefilter(function(e){if(1===u(e.url)&&!e.url.match(/async-upload\.php$/))if(void 0!==t.FormData&&e.data instanceof FormData)e.data.append(r.key,r.nonce);else{var n,o,a=s(e.url);void 0===e.data||a.query?e.url=l(a,r.nonce):(n=e.data?e.data.split("&"):[],i=(i=t.location.pathname).replace(r.home+r.admin,""),(o=h.hasOwnProperty(i)?h[i]:null)&&(n=o(n)),n.push(r.key+"="+encodeURIComponent(r.nonce)),e.data=n.join("&"))}var i}),void 0===e.fn.onFirst&&(e.fn.onFirst=function(t,n){var r,o=e(this),a="string"==typeof n;if(e.fn.on.apply(o,arguments),"object"==typeof t)for(r in t)t.hasOwnProperty(r)&&g(o,r,a);else"string"==typeof t&&g(o,t,a);return o}),e(t).on("error",function(){y()}),e(function(){y()}),(c=e(n)).onFirst("click contextmenu","a",function(a){var i,h,c=0,p=e(this),v=p.attr("href")||"",g=s(v);if(f(g)&&(c=u(v)),"click"===a.type)if(1===c)p.attr("href",m(g)?v:l(v,d(p)?"nofollow":r.nonce));else if(-1===c&&(1===u(t.location.pathname)||o.regexp(t.location.search)))if("_self"===p.attr("target")||function(e){var t,n,o=r.sites.length;for(t=0;t<o;++t)if(0<=(n=e.indexOf(r.sites[t]+"/"))&&n<=6)return!0;return!1}(v))p.attr("href",m(g)?v:l(v,d(p)?"nofollow":r.nonce));else if(!this.hasAttribute("onClick"))return v=v.split(";",2).shift(),i=decodeURIComponent(this.href),(h=n.createElement("div")).appendChild(n.createTextNode(i)),i=h.innerHTML.replace(/["']/g,function(e){return{'"':""","'":"'"}[e]}),h="",v=i,(c=t.open()).document.write('<!DOCTYPE html><html><head><meta name="referrer" content="never" /><meta name="referrer" content="no-referrer" /><meta http-equiv="refresh" content="0; url='+v+'" />'+(e("body").hasClass("webview")?'<script>window.location.replace("'+v+'")<\/script>':"")+"</head></html>"),c.document.close(),a.stopImmediatePropagation(),!1}),c.onFirst("submit","form",function(){var t=e(this),n=t.attr("action");1===u(n)&&("post"===(t.attr("method")||"").toLowerCase()?t.attr("action",l(n,r.nonce)):t.append('<input type="hidden" name="'+r.key+'" value="'+r.nonce+'">'))})}(jQuery,window,document);
|
||||
@@ -1,127 +0,0 @@
|
||||
/*!
|
||||
* Project: GmapRS - google map for WordPress IP Geo Block
|
||||
* Description: A really simple google map plugin based on jQuery-boilerplate.
|
||||
* Version: 0.2.4
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
// https://developers.google.com/maps/documentation/javascript/events?hl=en#auth-errors
|
||||
function gm_authFailure() {
|
||||
jQuery(window).trigger('ip-geo-block-gmap-error');
|
||||
}
|
||||
|
||||
(function ($) {
|
||||
$(function ($) {
|
||||
if ('undefined' === typeof google) {
|
||||
return;
|
||||
}
|
||||
var e = "GmapRS",
|
||||
d = "plugin_" + e,
|
||||
b = {
|
||||
zoom: 2,
|
||||
latitude: 0,
|
||||
longitude: 0
|
||||
},
|
||||
i = google.maps,
|
||||
h = function (j) {
|
||||
this.o = $.extend({}, b);
|
||||
this.q = [];
|
||||
};
|
||||
h.prototype = {
|
||||
init: function (j) {
|
||||
$.extend(this.o, j);
|
||||
this.c = new i.LatLng(this.o.latitude, this.o.longitude);
|
||||
this.m = new i.Map(this.e.get(0), {
|
||||
zoom: this.o.zoom,
|
||||
center: this.c,
|
||||
mapTypeId: i.MapTypeId.ROADMAP
|
||||
});
|
||||
},
|
||||
destroy: function () {
|
||||
this.deleteMarkers();
|
||||
this.e.data(d, null);
|
||||
},
|
||||
setCenter: function () {
|
||||
if (arguments.length >= 2) {
|
||||
var j = new i.LatLng((this.o.latitude = arguments[0]), (this.o.longitude = arguments[1]));
|
||||
delete this.c;
|
||||
this.c = j;
|
||||
}
|
||||
this.m.setCenter(this.c);
|
||||
return this.e;
|
||||
},
|
||||
setZoom: function (j) {
|
||||
this.m.setZoom(j || this.o.zoom);
|
||||
return this.e;
|
||||
},
|
||||
getZoom: function () {
|
||||
return this.m.getZoom();
|
||||
},
|
||||
showMarker: function (l, k) {
|
||||
var j = this.q[l];
|
||||
if (j && j.w) {
|
||||
(false === k) ? j.w.close() : j.w.open(this.m, j.m);
|
||||
}
|
||||
},
|
||||
addMarker: function (l) {
|
||||
var m, j, k;
|
||||
m = new i.LatLng(l.latitude || this.o.latitude, l.longitude || this.o.longitude);
|
||||
j = new i.Marker({
|
||||
position: m,
|
||||
map: this.m,
|
||||
title: l.title || ""
|
||||
});
|
||||
if (l.content) {
|
||||
k = new i.InfoWindow({
|
||||
content: l.content
|
||||
});
|
||||
i.event.addListener(j, "click", function () {
|
||||
k.open(j.getMap(), j);
|
||||
});
|
||||
}
|
||||
this.q.push({
|
||||
p: m,
|
||||
w: k,
|
||||
m: j
|
||||
});
|
||||
this.m.setCenter(m);
|
||||
this.m.setZoom(l.zoom);
|
||||
if (l.show) {
|
||||
this.showMarker(this.q.length - 1);
|
||||
}
|
||||
return this.e;
|
||||
},
|
||||
deleteMarkers: function () {
|
||||
var j, k;
|
||||
for (j in this.q) {
|
||||
if (this.q.hasOwnProperty(j)) {
|
||||
k = this.q[j];
|
||||
k.m.setMap(null);
|
||||
}
|
||||
}
|
||||
this.q.length = 0;
|
||||
return this.e;
|
||||
}
|
||||
};
|
||||
$.fn[e] = function (k) {
|
||||
var l, j;
|
||||
if (!(this.data(d) instanceof h)) {
|
||||
this.data(d, new h(this));
|
||||
}
|
||||
j = this.data(d);
|
||||
j.e = this;
|
||||
if (typeof k === "undefined" || typeof k === "object") {
|
||||
if (typeof j.init === "function") {
|
||||
j.init(k);
|
||||
}
|
||||
} else {
|
||||
if (typeof k === "string" && typeof j[k] === "function") {
|
||||
l = Array.prototype.slice.call(arguments, 1);
|
||||
return j[k].apply(j, l);
|
||||
} else {
|
||||
$.error("Method " + k + " does not exist." + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* Project: GmapRS - google map for WordPress IP Geo Block
|
||||
* Description: A really simple google map plugin based on jQuery-boilerplate.
|
||||
* Version: 0.2.4
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
function gm_authFailure(){jQuery(window).trigger("ip-geo-block-gmap-error")}jQuery(function(t){if("undefined"!=typeof google){var e="GmapRS",i="plugin_"+e,o={zoom:2,latitude:0,longitude:0},n=google.maps,s=function(e){this.o=t.extend({},o),this.q=[]};s.prototype={init:function(e){t.extend(this.o,e),this.c=new n.LatLng(this.o.latitude,this.o.longitude),this.m=new n.Map(this.e.get(0),{zoom:this.o.zoom,center:this.c,mapTypeId:n.MapTypeId.ROADMAP})},destroy:function(){this.deleteMarkers(),this.e.data(i,null)},setCenter:function(){if(arguments.length>=2){var t=new n.LatLng(this.o.latitude=arguments[0],this.o.longitude=arguments[1]);delete this.c,this.c=t}return this.m.setCenter(this.c),this.e},setZoom:function(t){return this.m.setZoom(t||this.o.zoom),this.e},getZoom:function(){return this.m.getZoom()},showMarker:function(t,e){var i=this.q[t];i&&i.w&&(!1===e?i.w.close():i.w.open(this.m,i.m))},addMarker:function(t){var e,i,o;return e=new n.LatLng(t.latitude||this.o.latitude,t.longitude||this.o.longitude),i=new n.Marker({position:e,map:this.m,title:t.title||""}),t.content&&(o=new n.InfoWindow({content:t.content}),n.event.addListener(i,"click",function(){o.open(i.getMap(),i)})),this.q.push({p:e,w:o,m:i}),this.m.setCenter(e),this.m.setZoom(t.zoom),t.show&&this.showMarker(this.q.length-1),this.e},deleteMarkers:function(){var t;for(t in this.q)this.q.hasOwnProperty(t)&&this.q[t].m.setMap(null);return this.q.length=0,this.e}},t.fn[e]=function(o){var n,r;if(this.data(i)instanceof s||this.data(i,new s(this)),(r=this.data(i)).e=this,void 0===o||"object"==typeof o)"function"==typeof r.init&&r.init(o);else{if("string"==typeof o&&"function"==typeof r[o])return n=Array.prototype.slice.call(arguments,1),r[o].apply(r,n);t.error("Method "+o+" does not exist."+e)}}}});
|
||||
@@ -1,80 +0,0 @@
|
||||
/*jslint white: true */
|
||||
/*!
|
||||
* Project: whois.js - get whois infomation from RIPE Network Coordination Center
|
||||
* Description: A jQuery plugin to get whois infomation from RIPE NCC database.
|
||||
* Version: 0.2
|
||||
* Copyright (c) 2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*
|
||||
* RIPE NCC
|
||||
* @link https://stat.ripe.net/docs/data_api#Whois
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend({
|
||||
whois: function (query, callback) {
|
||||
var results = [],
|
||||
url = 'https://stat.ripe.net/data/whois/data.json?resource=';
|
||||
|
||||
function escapeHTML(str) {
|
||||
return str ? str.toString().replace(/[&<>"']/g, function (match) { //'"
|
||||
return {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
}[match];
|
||||
}) : '';
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
url: url + query,
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
})
|
||||
|
||||
.done(function (data, textStatus, jqXHR) {
|
||||
// https://stackoverflow.com/questions/722668/traverse-all-the-nodes-of-a-json-object-tree-with-javascript#answer-722676
|
||||
function process(key, value) {
|
||||
if (value && typeof value === 'object') {
|
||||
if (value.key) {
|
||||
value.key = escapeHTML(value.key);
|
||||
value.value = escapeHTML(value.value);
|
||||
if (value.details_link) {
|
||||
value.value = '<a href="' + escapeHTML(value.details_link) + '">' + value.value + '</a>';
|
||||
}
|
||||
results.push({
|
||||
name : value.key,
|
||||
value: value.value
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function traverse(obj, func) {
|
||||
for (var i in obj) {
|
||||
func.apply(this, [i, obj[i]]);
|
||||
if (obj[i] !== null && typeof(obj[i]) === 'object') {
|
||||
traverse(obj[i], func); //going one step down in the object tree!!
|
||||
}
|
||||
}
|
||||
}
|
||||
traverse(data.data, process);
|
||||
})
|
||||
|
||||
.fail(function (jqXHR, textStatus, errorThrown) {
|
||||
results.push({
|
||||
name : escapeHTML(textStatus),
|
||||
value: escapeHTML(errorThrown)
|
||||
});
|
||||
})
|
||||
|
||||
.always(function () {
|
||||
if (callback) {
|
||||
callback(results);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
@@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* Project: whois.js - get whois infomation from RIPE Network Coordination Center
|
||||
* Description: A jQuery plugin to get whois infomation from RIPE NCC database.
|
||||
* Version: 0.2
|
||||
* Copyright (c) 2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
!function(e){e.extend({whois:function(t,n){var a=[];function u(e){return e?e.toString().replace(/[&<>"']/g,function(e){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[e]}):""}return e.ajax({url:"https://stat.ripe.net/data/whois/data.json?resource="+t,method:"GET",dataType:"json"}).done(function(e,t,n){!function e(t,n){for(var a in t)n.apply(this,[a,t[a]]),null!==t[a]&&"object"==typeof t[a]&&e(t[a],n)}(e.data,function(e,t){t&&"object"==typeof t&&t.key&&(t.key=u(t.key),t.value=u(t.value),t.details_link&&(t.value='<a href="'+u(t.details_link)+'">'+t.value+"</a>"),a.push({name:t.key,value:t.value}))})}).fail(function(e,t,n){a.push({name:u(t),value:u(n)})}).always(function(){n&&n(a)})}})}(jQuery);
|
||||
@@ -1,120 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* IP Geo Block - Activate
|
||||
*
|
||||
* @package IP_Geo_Block
|
||||
* @author tokkonopapa <tokkonopapa@yahoo.com>
|
||||
* @license GPL-3.0
|
||||
* @link https://www.ipgeoblock.com/
|
||||
* @copyright 2013-2019 tokkonopapa
|
||||
*/
|
||||
|
||||
// Stuff for resources
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-util.php';
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-opts.php';
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-logs.php';
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-cron.php';
|
||||
require_once IP_GEO_BLOCK_PATH . 'admin/includes/class-admin-rewrite.php';
|
||||
|
||||
class IP_Geo_Block_Activate {
|
||||
|
||||
// Activate and deactivate main blog
|
||||
private static function activate_main_blog( $settings ) {
|
||||
IP_Geo_Block_Cron::start_update_db( $settings );
|
||||
IP_Geo_Block_Opts::setup_validation_timing( $settings );
|
||||
IP_Geo_Block_Admin_Rewrite::activate_rewrite_all( $settings['rewrite'] );
|
||||
}
|
||||
|
||||
private static function deactivate_main_blog() {
|
||||
IP_Geo_Block_Cron::stop_update_db();
|
||||
IP_Geo_Block_Opts::setup_validation_timing();
|
||||
IP_Geo_Block_Admin_Rewrite::deactivate_rewrite_all();
|
||||
}
|
||||
|
||||
// Activate and deactivate each blog
|
||||
public static function activate_blog() {
|
||||
IP_Geo_Block_Opts::upgrade();
|
||||
IP_Geo_Block_Logs::create_tables();
|
||||
IP_Geo_Block_Logs::delete_cache_entry();
|
||||
IP_Geo_Block_Cron::start_cache_gc();
|
||||
}
|
||||
|
||||
private static function deactivate_blog() {
|
||||
IP_Geo_Block_Cron::stop_cache_gc();
|
||||
IP_Geo_Block_Logs::delete_cache_entry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register options into database table when the plugin is activated.
|
||||
*
|
||||
* @link https://wordpress.stackexchange.com/questions/181141/how-to-run-an-activation-function-when-plugin-is-network-activated-on-multisite
|
||||
*/
|
||||
public static function activate( $network_wide = FALSE ) {
|
||||
// Update main blog first.
|
||||
self::activate_blog();
|
||||
|
||||
// Get option of main blog.
|
||||
$settings = IP_Geo_Block::get_option();
|
||||
|
||||
if ( is_multisite() && $network_wide ) {
|
||||
global $wpdb;
|
||||
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
|
||||
|
||||
// Skip the main blog.
|
||||
array_shift( $blog_ids );
|
||||
|
||||
foreach ( $blog_ids as $id ) {
|
||||
switch_to_blog( $id );
|
||||
|
||||
if ( $settings['network_wide'] ) {
|
||||
// Copy settings of main site to individual site
|
||||
$map = IP_Geo_Block::get_option( FALSE );
|
||||
$settings['api_key']['GoogleMap'] = $map['api_key']['GoogleMap'];
|
||||
IP_Geo_Block::update_option( $settings, FALSE );
|
||||
}
|
||||
|
||||
// Initialize inidivisual site
|
||||
self::activate_blog();
|
||||
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
|
||||
if ( did_action( 'init' ) && current_user_can( 'manage_options' ) ) {
|
||||
self::activate_main_blog( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the plugin is deactivated.
|
||||
*
|
||||
*/
|
||||
public static function deactivate( $network_wide = FALSE ) {
|
||||
add_action( 'shutdown', array( __CLASS__, 'deactivate_plugin' ) );
|
||||
}
|
||||
|
||||
public static function deactivate_plugin() {
|
||||
self::deactivate_blog();
|
||||
|
||||
if ( is_multisite() && is_main_site() ) {
|
||||
global $wpdb;
|
||||
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
|
||||
|
||||
// Skip the main blog.
|
||||
array_shift( $blog_ids );
|
||||
|
||||
foreach ( $blog_ids as $id ) {
|
||||
switch_to_blog( $id );
|
||||
|
||||
// Skip when this plugin is still active
|
||||
if ( ! is_plugin_active( IP_GEO_BLOCK_BASE ) )
|
||||
self::deactivate_blog();
|
||||
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
|
||||
self::deactivate_main_blog();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,678 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* IP Geo Block - IP Address Geolocation API Class
|
||||
*
|
||||
* @package IP_Geo_Block
|
||||
* @author tokkonopapa <tokkonopapa@yahoo.com>
|
||||
* @license GPL-3.0
|
||||
* @link https://www.ipgeoblock.com/
|
||||
* @copyright 2013-2019 tokkonopapa
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service type
|
||||
*
|
||||
*/
|
||||
define( 'IP_GEO_BLOCK_API_TYPE_IPV4', 1 ); // can handle IPv4
|
||||
define( 'IP_GEO_BLOCK_API_TYPE_IPV6', 2 ); // can handle IPv6
|
||||
define( 'IP_GEO_BLOCK_API_TYPE_BOTH', 3 ); // can handle both IPv4 and IPv6
|
||||
|
||||
/**
|
||||
* Abstract class
|
||||
*
|
||||
*/
|
||||
abstract class IP_Geo_Block_API {
|
||||
|
||||
/**
|
||||
* These values must be instantiated in child class
|
||||
*
|
||||
*//*
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_[IPV4 | IPV6 | BOTH],
|
||||
'url' => 'http://example.com/%API_KEY%/%API_FORMAT%/%API_OPTION%/%API_IP%';
|
||||
'api' => array(
|
||||
'%API_IP%' => '', // should be set in build_url()
|
||||
'%API_KEY%' => '', // should be set in __construct()
|
||||
'%API_FORMAT%' => '', // may be set in child class
|
||||
'%API_OPTION%' => '', // may be set in child class
|
||||
),
|
||||
'transform' => array(
|
||||
'errorMessage' => '',
|
||||
'countryCode' => '',
|
||||
'countryName' => '',
|
||||
'regionName' => '',
|
||||
'cityName' => '',
|
||||
'latitude' => '',
|
||||
'longitude' => '',
|
||||
)
|
||||
);*/
|
||||
|
||||
/**
|
||||
* Constructer & Destructer
|
||||
*
|
||||
*/
|
||||
protected function __construct( $api_key = NULL ) {
|
||||
if ( is_string( $api_key ) )
|
||||
$this->template['api']['%API_KEY%'] = $api_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build URL from template
|
||||
*
|
||||
*/
|
||||
protected static function build_url( $ip, $template ) {
|
||||
$template['api']['%API_IP%'] = $ip;
|
||||
return str_replace(
|
||||
array_keys( $template['api'] ),
|
||||
array_values( $template['api'] ),
|
||||
$template['url']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch service provider to get geolocation information
|
||||
*
|
||||
*/
|
||||
protected static function fetch_provider( $ip, $args, $template ) {
|
||||
|
||||
// check supported type of IP address
|
||||
if ( ! ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) && ( $template['type'] & IP_GEO_BLOCK_API_TYPE_IPV4 ) ) &&
|
||||
! ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) && ( $template['type'] & IP_GEO_BLOCK_API_TYPE_IPV6 ) ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// build query
|
||||
$tmp = self::build_url( $ip, $template );
|
||||
|
||||
// https://codex.wordpress.org/Function_Reference/wp_remote_get
|
||||
$res = @wp_remote_get( $tmp, $args ); // @since 2.7
|
||||
if ( is_wp_error( $res ) )
|
||||
return array( 'errorMessage' => $res->get_error_message() );
|
||||
$tmp = wp_remote_retrieve_header( $res, 'content-type' );
|
||||
$res = wp_remote_retrieve_body( $res );
|
||||
|
||||
// clear decoded data
|
||||
$data = array();
|
||||
|
||||
// extract content type
|
||||
// ex: "Content-type: text/plain; charset=utf-8"
|
||||
if ( $tmp ) {
|
||||
$tmp = explode( '/', $tmp, 2 );
|
||||
$tmp = explode( ';', $tmp[1], 2 );
|
||||
$tmp = trim( $tmp[0] );
|
||||
}
|
||||
|
||||
switch ( $tmp ) {
|
||||
// decode json
|
||||
case 'json':
|
||||
case 'html': // ipinfo.io, Xhanch
|
||||
case 'plain': // geoPlugin
|
||||
$data = json_decode( $res, TRUE ); // PHP 5 >= 5.2.0, PECL json >= 1.2.0
|
||||
if ( NULL === $data ) // ipinfo.io (get_country)
|
||||
$data[ $template['transform']['countryCode'] ] = trim( $res );
|
||||
break;
|
||||
|
||||
// decode xml
|
||||
case 'xml':
|
||||
$tmp = '/\<(.+?)\>(?:\<\!\[CDATA\[)?([^\>]*?)(?:\]\]\>)?\<\/\\1\>/i';
|
||||
if ( preg_match_all( $tmp, $res, $matches ) !== FALSE ) {
|
||||
if ( is_array( $matches[1] ) && ! empty( $matches[1] ) ) {
|
||||
foreach ( $matches[1] as $key => $val ) {
|
||||
$data[ $val ] = $matches[2][ $key ];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// unknown format
|
||||
default:
|
||||
return array( 'errorMessage' => "unsupported content type: $tmp" );
|
||||
}
|
||||
|
||||
// transformation
|
||||
$res = array();
|
||||
foreach ( $template['transform'] as $key => $val ) {
|
||||
if ( ! empty( $val ) && ! empty( $data[ $val ] ) )
|
||||
$res[ $key ] = is_string( $data[ $val ] ) ? esc_html( $data[ $val ] ) : $data[ $val ];
|
||||
}
|
||||
|
||||
// if country code is '-' or 'UNDEFINED' then error.
|
||||
if ( isset( $res['countryCode'] ) && is_string( $res['countryCode'] ) )
|
||||
$res['countryCode'] = preg_match( '/^[A-Z]{2}/', $res['countryCode'], $matches ) ? $matches[0] : NULL;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get geolocation information from service provider
|
||||
*
|
||||
*/
|
||||
public function get_location( $ip, $args = array() ) {
|
||||
return self::fetch_provider( $ip, $args, $this->template );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get only country code
|
||||
*
|
||||
* Override this method if a provider supports this feature for quick response.
|
||||
*/
|
||||
public function get_country( $ip, $args = array() ) {
|
||||
$res = $this->get_location( $ip, $args );
|
||||
return FALSE === $res ? FALSE : ( empty( $res['countryCode'] ) ? NULL : $res['countryCode'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert provider name to class name
|
||||
*
|
||||
*/
|
||||
public static function get_class_name( $provider ) {
|
||||
$provider = 'IP_Geo_Block_API_' . preg_replace( '/[\W]/', '', $provider );
|
||||
return class_exists( $provider, FALSE ) ? $provider : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get option key
|
||||
*
|
||||
*/
|
||||
public static function get_api_key( $provider, $options ) {
|
||||
return empty( $options['providers'][ $provider ] ) ? NULL : $options['providers'][ $provider ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance of inherited object
|
||||
*
|
||||
*/
|
||||
private static $instance = array();
|
||||
|
||||
public static function get_instance( $provider, $options ) {
|
||||
if ( $name = self::get_class_name( $provider ) ) {
|
||||
if ( empty( self::$instance[ $name ] ) )
|
||||
return self::$instance[ $name ] = new $name( self::get_api_key( $provider, $options ) );
|
||||
else
|
||||
return self::$instance[ $name ];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for IP-API.com
|
||||
*
|
||||
* URL : http://ip-api.com/
|
||||
* Term of use : http://ip-api.com/docs/#usage_limits
|
||||
* Licence fee : free for non-commercial use
|
||||
* Rate limit : 240 requests per minute
|
||||
* Sample URL : http://ip-api.com/json/2a00:1210:fffe:200::1
|
||||
* Sample URL : http://ip-api.com/xml/yahoo.co.jp
|
||||
* Input type : IP address (IPv4, IPv6 with limited coverage) / domain name
|
||||
* Output type : json, xml
|
||||
*/
|
||||
class IP_Geo_Block_API_IPAPIcom extends IP_Geo_Block_API {
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
|
||||
'url' => 'http://ip-api.com/%API_FORMAT%/%API_IP%',
|
||||
'api' => array(
|
||||
'%API_FORMAT%' => 'json',
|
||||
),
|
||||
'transform' => array(
|
||||
'errorMessage' => 'error',
|
||||
'countryCode' => 'countryCode',
|
||||
'countryName' => 'country',
|
||||
'regionName' => 'regionName',
|
||||
'cityName' => 'city',
|
||||
'latitude' => 'lat',
|
||||
'longitude' => 'lon',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for GeoIPLookup.net
|
||||
*
|
||||
* URL : http://geoiplookup.net/
|
||||
* Term of use : http://geoiplookup.net/terms-of-use.php
|
||||
* Licence fee : free
|
||||
* Rate limit : none
|
||||
* Sample URL : http://api.geoiplookup.net/?query=2a00:1210:fffe:200::1
|
||||
* Input type : IP address (IPv4, IPv6)
|
||||
* Output type : xml
|
||||
*/
|
||||
class IP_Geo_Block_API_GeoIPLookup extends IP_Geo_Block_API {
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
|
||||
'url' => 'http://api.geoiplookup.net/?query=%API_IP%',
|
||||
'api' => array(),
|
||||
'transform' => array(
|
||||
'countryCode' => 'countrycode',
|
||||
'countryName' => 'countryname',
|
||||
'regionName' => 'countryname',
|
||||
'cityName' => 'city',
|
||||
'latitude' => 'latitude',
|
||||
'longitude' => 'longitude',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for ipinfo.io
|
||||
*
|
||||
* URL : https://ipinfo.io/
|
||||
* Term of use : https://ipinfo.io/developers#terms
|
||||
* Licence fee : free
|
||||
* Rate limit : 1,000 lookups daily
|
||||
* Sample URL : https://ipinfo.io/124.83.187.140/json
|
||||
* Sample URL : https://ipinfo.io/124.83.187.140/country
|
||||
* Input type : IP address (IPv4)
|
||||
* Output type : json
|
||||
*/
|
||||
class IP_Geo_Block_API_ipinfoio extends IP_Geo_Block_API {
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
|
||||
'url' => 'https://ipinfo.io/%API_IP%/%API_FORMAT%%API_OPTION%',
|
||||
'api' => array(
|
||||
'%API_FORMAT%' => 'json',
|
||||
'%API_OPTION%' => '',
|
||||
),
|
||||
'transform' => array(
|
||||
'countryCode' => 'country',
|
||||
'countryName' => 'country',
|
||||
'regionName' => 'region',
|
||||
'cityName' => 'city',
|
||||
'latitude' => 'loc',
|
||||
'longitude' => 'loc',
|
||||
)
|
||||
);
|
||||
|
||||
public function get_location( $ip, $args = array() ) {
|
||||
$res = parent::get_location( $ip, $args );
|
||||
if ( ! empty( $res ) && ! empty( $res['latitude'] ) ) {
|
||||
$loc = explode( ',', $res['latitude'] );
|
||||
$res['latitude' ] = $loc[0];
|
||||
$res['longitude'] = $loc[1];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function get_country( $ip, $args = array() ) {
|
||||
$this->template['api']['%API_FORMAT%'] = '';
|
||||
$this->template['api']['%API_OPTION%'] = 'country';
|
||||
return parent::get_country( $ip, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for ipapi
|
||||
*
|
||||
* URL : https://ipapi.com/
|
||||
* Term of use : https://ipapi.com/terms
|
||||
* Licence fee : free to use the API
|
||||
* Rate limit : 10,000 reqests per month
|
||||
* Sample URL : http://api.ipapi.com/2a00:1210:fffe:200::1?access_key=...
|
||||
* Input type : IP address (IPv4, IPv6)
|
||||
* Output type : json
|
||||
*/
|
||||
class IP_Geo_Block_API_ipapi extends IP_Geo_Block_API {
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
|
||||
'url' => 'http://api.ipapi.com/%API_IP%?access_key=%API_KEY%',
|
||||
'api' => array(),
|
||||
'transform' => array(
|
||||
'countryCode' => 'country_code',
|
||||
'countryName' => 'country_name',
|
||||
'cityName' => 'city',
|
||||
'latitude' => 'latitude',
|
||||
'longitude' => 'longitude',
|
||||
'error' => 'error',
|
||||
)
|
||||
);
|
||||
|
||||
public function get_location( $ip, $args = array() ) {
|
||||
$res = parent::get_location( $ip, $args );
|
||||
if ( isset( $res['countryName'] ) ) {
|
||||
$res['countryCode'] = esc_html( $res['countryCode'] );
|
||||
$res['countryName'] = esc_html( $res['countryName'] );
|
||||
$res['latitude' ] = esc_html( $res['latitude' ] );
|
||||
$res['longitude' ] = esc_html( $res['longitude' ] );
|
||||
return $res;
|
||||
} else {
|
||||
return array( 'errorMessage' => esc_html( $res['error']['info'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for Ipdata.co
|
||||
*
|
||||
* URL : https://ipdata.co/
|
||||
* Term of use : https://ipdata.co/terms.html
|
||||
* Licence fee : free
|
||||
* Rate limit : 1,500 lookups free daily
|
||||
* Sample URL : https://api.ipdata.co/8.8.8.8?api-key=...
|
||||
* Input type : IP address (IPv4, IPv6)
|
||||
* Output type : json
|
||||
*/
|
||||
class IP_Geo_Block_API_Ipdataco extends IP_Geo_Block_API {
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
|
||||
'url' => 'https://api.ipdata.co/%API_IP%?api-key=%API_KEY%',
|
||||
'api' => array(
|
||||
'%API_FORMAT%' => 'json',
|
||||
),
|
||||
'transform' => array(
|
||||
'countryCode' => 'country_code',
|
||||
'countryName' => 'country_name',
|
||||
'regionName' => 'region',
|
||||
'cityName' => 'city',
|
||||
'latitude' => 'latitude',
|
||||
'longitude' => 'longitude',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for ipstack
|
||||
*
|
||||
* URL : https://ipstack.com/
|
||||
* Term of use : https://ipstack.com/terms
|
||||
* Licence fee : free for registered user
|
||||
* Rate limit : 10,000 queries per month for free (https can be available for premium users)
|
||||
* Sample URL : http://api.ipstack.com/186.116.207.169?access_key=YOUR_ACCESS_KEY&output=json&legacy=1
|
||||
* Input type : IP address (IPv4, IPv6) / domain name
|
||||
* Output type : json, xml
|
||||
*/
|
||||
class IP_Geo_Block_API_ipstack extends IP_Geo_Block_API {
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
|
||||
'url' => 'http://api.ipstack.com/%API_IP%?access_key=%API_KEY%&output=%API_FORMAT%',
|
||||
'api' => array(
|
||||
'%API_FORMAT%' => 'json',
|
||||
),
|
||||
'transform' => array(
|
||||
'countryCode' => 'country_code',
|
||||
'countryName' => 'country_name',
|
||||
'regionName' => 'region_name',
|
||||
'cityName' => 'city',
|
||||
'latitude' => 'latitude',
|
||||
'longitude' => 'longitude',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for IPInfoDB
|
||||
*
|
||||
* URL : https://ipinfodb.com/
|
||||
* Term of use :
|
||||
* Licence fee : free (need to regist to get API key)
|
||||
* Rate limit : 2 queries/second for registered user
|
||||
* Sample URL : https://api.ipinfodb.com/v3/ip-city/?key=...&format=xml&ip=124.83.187.140
|
||||
* Sample URL : https://api.ipinfodb.com/v3/ip-country/?key=...&format=xml&ip=yahoo.co.jp
|
||||
* Input type : IP address (IPv4, IPv6) / domain name
|
||||
* Output type : json, xml
|
||||
*/
|
||||
class IP_Geo_Block_API_IPInfoDB extends IP_Geo_Block_API {
|
||||
protected $template = array(
|
||||
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
|
||||
'url' => 'https://api.ipinfodb.com/v3/%API_OPTION%/?key=%API_KEY%&format=%API_FORMAT%&ip=%API_IP%',
|
||||
'api' => array(
|
||||
'%API_FORMAT%' => 'xml',
|
||||
'%API_OPTION%' => 'ip-city',
|
||||
),
|
||||
'transform' => array(
|
||||
'countryCode' => 'countryCode',
|
||||
'countryName' => 'countryName',
|
||||
'regionName' => 'regionName',
|
||||
'cityName' => 'cityName',
|
||||
'latitude' => 'latitude',
|
||||
'longitude' => 'longitude',
|
||||
)
|
||||
);
|
||||
|
||||
public function __construct( $api_key = NULL ) {
|
||||
// sanitization
|
||||
parent::__construct( preg_replace( '/\W/', '', $api_key ) );
|
||||
}
|
||||
|
||||
public function get_country( $ip, $args = array() ) {
|
||||
$this->api_template['%API_OPTION%'] = 'ip-country';
|
||||
return parent::get_country( $ip, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for Cache
|
||||
*
|
||||
* Input type : IP address (IPv4, IPv6)
|
||||
* Output type : array
|
||||
*/
|
||||
class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
|
||||
// memory cache
|
||||
protected static $memcache = array();
|
||||
|
||||
public static function update_cache( $hook, $validate, $settings, $countup = TRUE ) {
|
||||
$time = $_SERVER['REQUEST_TIME'];
|
||||
$cache = self::get_cache( $ip = $validate['ip'], $settings['cache_hold'] );
|
||||
|
||||
if ( $cache ) {
|
||||
$fail = isset( $validate['fail'] ) ? $validate['fail'] : 0;
|
||||
$call = $cache['reqs'] + ( $countup ? 1 : 0 ); // prevent duplicate count up
|
||||
$last = $cache['last'];
|
||||
$view = $cache['view'];
|
||||
} else { // if new cache then reset these values
|
||||
$fail = 0;
|
||||
$call = 1;
|
||||
$last = $time;
|
||||
$view = 1;
|
||||
}
|
||||
|
||||
if ( $cache && 'public' === $hook ) {
|
||||
if ( $time - $last > $settings['behavior']['time'] )
|
||||
$view = 1;
|
||||
else
|
||||
++$view;
|
||||
$last = $time;
|
||||
}
|
||||
|
||||
$cache = array(
|
||||
'time' => $time,
|
||||
'ip' => $ip,
|
||||
'hook' => $hook,
|
||||
'asn' => $validate['asn' ], // @since 3.0.4
|
||||
'code' => $validate['code'],
|
||||
'auth' => $validate['auth'], // get_current_user_id() > 0
|
||||
'fail' => $fail, // $validate['auth'] ? 0 : $fail,
|
||||
'reqs' => $settings['save_statistics'] ? $call : 0,
|
||||
'last' => $last,
|
||||
'view' => $view,
|
||||
'host' => isset( $validate['host'] ) && $validate['host'] !== $ip ? $validate['host'] : '',
|
||||
);
|
||||
|
||||
// do not update cache while installing geolocation databases
|
||||
if ( $settings['cache_hold'] && ! ( $validate['auth'] && 'ZZ' === $validate['code'] ) )
|
||||
IP_Geo_Block_Logs::update_cache( $cache );
|
||||
|
||||
return self::$memcache[ $ip ] = $cache;
|
||||
}
|
||||
|
||||
public static function clear_cache() {
|
||||
IP_Geo_Block_Logs::clear_cache();
|
||||
self::$memcache = array();
|
||||
}
|
||||
|
||||
public static function get_cache( $ip, $use_cache = TRUE ) {
|
||||
if ( isset( self::$memcache[ $ip ] ) )
|
||||
return self::$memcache[ $ip ];
|
||||
else
|
||||
return $use_cache ? self::$memcache[ $ip ] = IP_Geo_Block_Logs::search_cache( $ip ) : NULL;
|
||||
}
|
||||
|
||||
public function get_location( $ip, $args = array() ) {
|
||||
if ( $cache = self::get_cache( $ip ) )
|
||||
return array( 'countryCode' => $cache['code'] );
|
||||
else
|
||||
return array( 'errorMessage' => 'not in the cache' );
|
||||
}
|
||||
|
||||
public function get_country( $ip, $args = array() ) {
|
||||
return ( $cache = self::get_cache( $ip ) ) ? ( isset( $args['cache'] ) ? $cache : $cache['code'] ) : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provider support class
|
||||
*
|
||||
*/
|
||||
class IP_Geo_Block_Provider {
|
||||
|
||||
protected static $providers = array(
|
||||
'IP-API.com' => array(
|
||||
'key' => FALSE,
|
||||
'type' => 'IPv4, IPv6 / free for non-commercial use',
|
||||
'link' => '<a rel="noreferrer" href="http://ip-api.com/" title="IP-API.com - Free Geolocation API">http://ip-api.com/</a> (IPv4, IPv6 / free for non-commercial use)',
|
||||
),
|
||||
|
||||
'GeoIPLookup' => array(
|
||||
'key' => NULL,
|
||||
'type' => 'IPv4, IPv6 / free',
|
||||
'link' => '<a rel="noreferrer" href="http://geoiplookup.net/" title="What Is My IP Address | GeoIP Lookup">GeoIPLookup.net</a> (IPv4, IPv6 / free)',
|
||||
),
|
||||
|
||||
'ipinfo.io' => array(
|
||||
'key' => NULL,
|
||||
'type' => 'IPv4, IPv6 / free',
|
||||
'link' => '<a rel="noreferrer" href="https://ipinfo.io/" title="IP Address API and Data Solutions">https://ipinfo.io/</a> (IPv4, IPv6 / free up to 1,000 lookups daily)',
|
||||
),
|
||||
|
||||
'ipapi' => array(
|
||||
'key' => '',
|
||||
'type' => 'IPv4, IPv6 / free',
|
||||
'link' => '<a rel="noreferrer" href="https://ipapi.com/" title="ipapi - IP Address Lookup and Geolocation API">https://ipapi.com/</a> (IPv4, IPv6 / free up to 10,000 lookups monthly for registered user)',
|
||||
),
|
||||
|
||||
'Ipdata.co' => array(
|
||||
'key' => '',
|
||||
'type' => 'IPv4, IPv6 / free',
|
||||
'link' => '<a rel="noreferrer" href="https://ipdata.co/" title="ipdata.co - IP Geolocation and Threat Data API">https://ipdata.co/</a> (IPv4, IPv6 / free up to 1,500 lookups daily for registered user)',
|
||||
),
|
||||
|
||||
'ipstack' => array(
|
||||
'key' => '',
|
||||
'type' => 'IPv4, IPv6 / free for registered user',
|
||||
'link' => '<a rel="noreferrer" href="https://ipstack.com/" title="ipstack - Free IP Geolocation API">https://ipstack.com/</a> (IPv4, IPv6 / free for registered user)',
|
||||
),
|
||||
|
||||
'IPInfoDB' => array(
|
||||
'key' => '',
|
||||
'type' => 'IPv4, IPv6 / free for registered user',
|
||||
'link' => '<a rel="noreferrer" href="https://ipinfodb.com/" title="Free IP Geolocation Tools and API| IPInfoDB">https://ipinfodb.com/</a> (IPv4, IPv6 / free for registered user)',
|
||||
),
|
||||
);
|
||||
|
||||
// Internal DB
|
||||
protected static $internals = array(
|
||||
'Cache' => array(
|
||||
'key' => NULL,
|
||||
'type' => 'IPv4, IPv6',
|
||||
'link' => NULL,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Register and get addon provider class information
|
||||
*
|
||||
*/
|
||||
public static function register_addon( $api ) {
|
||||
self::$internals += $api;
|
||||
}
|
||||
|
||||
public static function get_addons( $providers = array(), $force = FALSE ) {
|
||||
$apis = array();
|
||||
|
||||
foreach ( self::$internals as $key => $val ) {
|
||||
if ( 'Cache' !== $key && ( $force || ! isset( $providers[ $key ] ) || ! empty( $providers[ $key ] ) ) )
|
||||
$apis[] = $key;
|
||||
}
|
||||
|
||||
return $apis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pairs of provider name and API key
|
||||
*
|
||||
*/
|
||||
public static function get_providers( $key = 'key', $rand = FALSE, $cache = FALSE, $all = TRUE ) {
|
||||
// add internal DB
|
||||
$list = array();
|
||||
foreach ( self::$internals as $provider => $tmp ) {
|
||||
if ( 'Cache' !== $provider || $cache )
|
||||
$list[ $provider ] = $tmp[ $key ];
|
||||
}
|
||||
|
||||
if ( $all ) {
|
||||
$tmp = array_keys( self::$providers );
|
||||
|
||||
// randomize
|
||||
if ( $rand )
|
||||
shuffle( $tmp );
|
||||
|
||||
foreach ( $tmp as $name ) {
|
||||
$list[ $name ] = self::$providers[ $name ][ $key ];
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns providers name list which are checked in settings
|
||||
*
|
||||
*/
|
||||
public static function get_valid_providers( $settings, $rand = TRUE, $cache = TRUE, $all = FALSE ) {
|
||||
$list = array();
|
||||
$providers = $settings['providers' ]; // list of not selected and selected with api key
|
||||
$cache &= $settings['cache_hold']; // exclude `Cache` when `IP address cache` is disabled
|
||||
|
||||
foreach ( self::get_providers( 'key', $rand, $cache, empty( $settings['restrict_api'] ) || $all ) as $name => $key ) {
|
||||
// ( if $name has api key ) || ( if $name that does not need api key is selected )
|
||||
if ( ! empty( $providers[ $name ] ) || ( ! isset( $providers[ $name ] ) && NULL === $key ) ) {
|
||||
$list[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load additional plugins
|
||||
*
|
||||
*/
|
||||
if ( class_exists( 'IP_Geo_Block', FALSE ) ) {
|
||||
|
||||
// Avoid "The plugin does not have a valid header" on activation under WP4.0
|
||||
if ( is_plugin_active( IP_GEO_BLOCK_BASE ) ) {
|
||||
// Get absolute path to the geo-location API
|
||||
$dir = IP_Geo_Block::get_option();
|
||||
if ( $dir['api_dir'] ) {
|
||||
$dir = IP_Geo_Block_Util::slashit(
|
||||
apply_filters( IP_Geo_Block::PLUGIN_NAME . '-api-dir', $dir['api_dir'] )
|
||||
);
|
||||
|
||||
// Scan API directory
|
||||
$plugins = ( is_dir( $dir ) ? scandir( $dir, defined( 'SCANDIR_SORT_DESCENDING' ) ? SCANDIR_SORT_DESCENDING : 1 ) : FALSE );
|
||||
|
||||
// Load addons by heigher priority order
|
||||
if ( FALSE !== $plugins ) {
|
||||
$exclude = array( '.', '..' );
|
||||
foreach ( $plugins as $plugin ) {
|
||||
if ( ! in_array( $plugin, $exclude, TRUE ) && is_dir( $dir.$plugin ) ) {
|
||||
@include $dir.$plugin.'/class-'.$plugin.'.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,440 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* IP Geo Block - Cron Class
|
||||
*
|
||||
* @package IP_Geo_Block
|
||||
* @author tokkonopapa <tokkonopapa@yahoo.com>
|
||||
* @license GPL-3.0
|
||||
* @link https://www.ipgeoblock.com/
|
||||
* @copyright 2013-2019 tokkonopapa
|
||||
*/
|
||||
|
||||
class IP_Geo_Block_Cron {
|
||||
|
||||
/**
|
||||
* Cron scheduler.
|
||||
*
|
||||
*/
|
||||
private static function schedule_cron_job( &$update, $db, $immediate = FALSE ) {
|
||||
wp_clear_scheduled_hook( IP_Geo_Block::CRON_NAME, array( $immediate ) );
|
||||
|
||||
if ( $update['auto'] || $immediate ) {
|
||||
$now = time();
|
||||
$next = $now + ( $immediate ? 0 : DAY_IN_SECONDS );
|
||||
|
||||
if ( FALSE === $immediate ) {
|
||||
++$update['retry'];
|
||||
$cycle = DAY_IN_SECONDS * (int)$update['cycle'];
|
||||
|
||||
if ( isset( $db['ipv4_last'] ) ) {
|
||||
// in case of Maxmind Legacy or IP2Location
|
||||
if ( $now - (int)$db['ipv4_last'] < $cycle &&
|
||||
$now - (int)$db['ipv6_last'] < $cycle ) {
|
||||
$update['retry'] = 0;
|
||||
$next = max( (int)$db['ipv4_last'], (int)$db['ipv6_last'] ) +
|
||||
$cycle + rand( DAY_IN_SECONDS, DAY_IN_SECONDS * 6 );
|
||||
}
|
||||
} else {
|
||||
// in case of Maxmind GeoLite2
|
||||
if ( $now - (int)$db['ip_last'] < $cycle ) {
|
||||
$update['retry'] = 0;
|
||||
$next = (int)$db['ip_last'] +
|
||||
$cycle + rand( DAY_IN_SECONDS, DAY_IN_SECONDS * 6 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wp_schedule_single_event( $next, IP_Geo_Block::CRON_NAME, array( $immediate ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Database auto downloader.
|
||||
*
|
||||
* This function is called when:
|
||||
* 1. Plugin is activated
|
||||
* 2. WP Cron is kicked
|
||||
* under the following condition:
|
||||
* A. Once per site when this plugin is activated on network wide
|
||||
* B. Multiple time for each blog when this plugin is individually activated
|
||||
*/
|
||||
public static function exec_update_db( $immediate = FALSE ) {
|
||||
$settings = IP_Geo_Block::get_option();
|
||||
|
||||
// extract ip address from transient API to confirm the request source
|
||||
if ( $immediate ) {
|
||||
set_transient( IP_Geo_Block::CRON_NAME, IP_Geo_Block::get_ip_address( $settings ), MINUTE_IN_SECONDS );
|
||||
add_filter( IP_Geo_Block::PLUGIN_NAME . '-ip-addr', array( __CLASS__, 'extract_ip' ) );
|
||||
}
|
||||
|
||||
$context = IP_Geo_Block::get_instance();
|
||||
$args = IP_Geo_Block::get_request_headers( $settings );
|
||||
|
||||
// download database files (higher priority order)
|
||||
foreach ( $providers = IP_Geo_Block_Provider::get_addons( $settings['providers'] ) as $provider ) {
|
||||
if ( $geo = IP_Geo_Block_API::get_instance( $provider, $settings ) ) {
|
||||
$res[ $provider ] = $geo->download( $settings[ $provider ], $args );
|
||||
|
||||
// re-schedule cron job
|
||||
self::schedule_cron_job( $settings['update'], $settings[ $provider ], FALSE );
|
||||
|
||||
// update provider settings
|
||||
self::update_settings( $settings, array( 'update', $provider ) );
|
||||
|
||||
// skip to update settings in case of InfiniteWP that could be in a different country
|
||||
if ( isset( $_SERVER['HTTP_X_REQUESTED_FROM'] ) && FALSE !== strpos( $_SERVER['HTTP_X_REQUESTED_FROM'], 'InfiniteWP' ) )
|
||||
continue;
|
||||
|
||||
// update matching rule immediately
|
||||
if ( $immediate && 'done' !== get_transient( IP_Geo_Block::CRON_NAME ) ) {
|
||||
$validate = $context->validate_ip( 'admin', $settings );
|
||||
|
||||
if ( 'ZZ' === $validate['code'] )
|
||||
continue;
|
||||
|
||||
// matching rule should be reset when blocking happens
|
||||
if ( 'passed' !== $validate['result'] )
|
||||
$settings['matching_rule'] = -1;
|
||||
|
||||
// setup country code in whitelist if it needs to be initialized
|
||||
if ( -1 === (int)$settings['matching_rule'] ) {
|
||||
$settings['matching_rule'] = 0; // white list
|
||||
|
||||
// when the country code doesn't exist in whitelist, then add it
|
||||
if ( FALSE === strpos( $settings['white_list'], $validate['code'] ) )
|
||||
$settings['white_list'] .= ( $settings['white_list'] ? ',' : '' ) . $validate['code'];
|
||||
}
|
||||
|
||||
// update option settings
|
||||
self::update_settings( $settings, array( 'matching_rule', 'white_list' ) );
|
||||
|
||||
// finished to update matching rule
|
||||
set_transient( IP_Geo_Block::CRON_NAME, 'done', 5 * MINUTE_IN_SECONDS );
|
||||
|
||||
// trigger update action
|
||||
do_action( IP_Geo_Block::PLUGIN_NAME . '-db-updated', $settings, $validate['code'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isset( $res ) ? $res : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update setting data according to the site type.
|
||||
*
|
||||
*/
|
||||
private static function update_settings( $src, $keys = array() ) {
|
||||
// for multisite
|
||||
if ( is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) ) {
|
||||
global $wpdb;
|
||||
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs`" );
|
||||
|
||||
foreach ( $blog_ids as $id ) {
|
||||
switch_to_blog( $id );
|
||||
$dst = IP_Geo_Block::get_option( FALSE );
|
||||
|
||||
foreach ( $keys as $key ) {
|
||||
$dst[ $key ] = $src[ $key ];
|
||||
}
|
||||
|
||||
IP_Geo_Block::update_option( $dst, FALSE );
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
|
||||
// for single site
|
||||
else {
|
||||
IP_Geo_Block::update_option( $src );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract ip address from transient API.
|
||||
*
|
||||
*/
|
||||
public static function extract_ip( $ip ) {
|
||||
return filter_var(
|
||||
$ip_self = get_transient( IP_Geo_Block::CRON_NAME ), FILTER_VALIDATE_IP
|
||||
) ? $ip_self : $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kick off a cron job to download database immediately in background on activation.
|
||||
*
|
||||
*/
|
||||
public static function start_update_db( $settings, $immediate = TRUE ) {
|
||||
// updating should be done by main site when this plugin is activated for network
|
||||
if ( is_main_site() || ! is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) )
|
||||
self::schedule_cron_job( $settings['update'], NULL, $immediate );
|
||||
}
|
||||
|
||||
public static function stop_update_db() {
|
||||
wp_clear_scheduled_hook( IP_Geo_Block::CRON_NAME, array( FALSE ) ); // @since 2.1.0
|
||||
|
||||
// wait until updating has finished to avoid race condition with IP_Geo_Block_Opts::install_api()
|
||||
$time = 0;
|
||||
while ( ( $stat = get_transient( IP_Geo_Block::CRON_NAME ) ) && 'done' !== $stat ) {
|
||||
sleep( 1 );
|
||||
|
||||
if ( ++$time > 5 * MINUTE_IN_SECONDS ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kick off a cron job to garbage collection for IP address cache.
|
||||
*
|
||||
*/
|
||||
public static function exec_cache_gc( $settings ) {
|
||||
self::stop_cache_gc();
|
||||
|
||||
IP_Geo_Block_Logs::delete_expired( array(
|
||||
min( 365, max( 1, (int)$settings['validation']['explogs'] ) ) * DAY_IN_SECONDS,
|
||||
(int)$settings['cache_time']
|
||||
) );
|
||||
|
||||
self::start_cache_gc( $settings );
|
||||
}
|
||||
|
||||
public static function start_cache_gc( $settings = FALSE ) {
|
||||
if ( ! wp_next_scheduled( IP_Geo_Block::CACHE_NAME ) ) {
|
||||
$settings or $settings = IP_Geo_Block::get_option();
|
||||
wp_schedule_single_event( time() + max( $settings['cache_time_gc'], MINUTE_IN_SECONDS ), IP_Geo_Block::CACHE_NAME );
|
||||
}
|
||||
}
|
||||
|
||||
public static function stop_cache_gc() {
|
||||
wp_clear_scheduled_hook( IP_Geo_Block::CACHE_NAME ); // @since 2.1.0
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompresses gz archive and output to the file.
|
||||
*
|
||||
* @param string $src full path to the downloaded file.
|
||||
* @param string $dst full path to extracted file.
|
||||
* @return TRUE or array of error code and message.
|
||||
*/
|
||||
private static function gzfile( $src, $dst ) {
|
||||
try {
|
||||
if ( FALSE === ( $gz = gzopen( $src, 'r' ) ) )
|
||||
throw new Exception(
|
||||
sprintf( __( 'Unable to read <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $src )
|
||||
);
|
||||
|
||||
if ( FALSE === ( $fp = @fopen( $dst, 'cb' ) ) )
|
||||
throw new Exception(
|
||||
sprintf( __( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $filename )
|
||||
);
|
||||
|
||||
if ( ! flock( $fp, LOCK_EX ) )
|
||||
throw new Exception(
|
||||
sprintf( __( 'Can\'t lock <code>%s</code>. Please try again after a while.', 'ip-geo-block' ), $filename )
|
||||
);
|
||||
|
||||
ftruncate( $fp, 0 ); // truncate file
|
||||
|
||||
// same block size in wp-includes/class-http.php
|
||||
while ( $data = gzread( $gz, 4096 ) ) {
|
||||
fwrite( $fp, $data, strlen( $data ) );
|
||||
}
|
||||
}
|
||||
|
||||
catch ( Exception $e ) {
|
||||
$err = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $fp ) ) {
|
||||
fflush( $fp ); // flush output before releasing the lock
|
||||
flock ( $fp, LOCK_UN ); // release the lock
|
||||
fclose( $fp );
|
||||
}
|
||||
|
||||
return empty( $err ) ? TRUE : $err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download zip/gz file, uncompress and save it to specified file
|
||||
*
|
||||
* @param string $url URL of remote file to be downloaded.
|
||||
* @param array $args request headers.
|
||||
* @param string $filename full path to the downloaded file.
|
||||
* @param int $modified time of last modified on the remote server.
|
||||
* @return array status message.
|
||||
*/
|
||||
public static function download_zip( $url, $args, $files, $modified ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
// get extension
|
||||
$ext = strtolower( pathinfo( $url, PATHINFO_EXTENSION ) );
|
||||
if ( 'tar' === strtolower( pathinfo( pathinfo( $url, PATHINFO_FILENAME ), PATHINFO_EXTENSION ) ) )
|
||||
$ext = 'tar';
|
||||
|
||||
// check file (1st parameter includes absolute path in case of array)
|
||||
$filename = is_array( $files ) ? $files[0] : (string)$files;
|
||||
if ( ! $fs->exists( $filename ) )
|
||||
$modified = 0;
|
||||
|
||||
// set 'If-Modified-Since' request header
|
||||
$args += array(
|
||||
'headers' => array(
|
||||
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||
'Accept-Encoding' => 'gzip, deflate',
|
||||
'If-Modified-Since' => gmdate( DATE_RFC1123, (int)$modified ),
|
||||
),
|
||||
);
|
||||
|
||||
// fetch file and get response code & message
|
||||
if ( isset( $args['method'] ) && 'GET' === $args['method'] )
|
||||
$src = wp_remote_get ( ( $url = esc_url_raw( $url ) ), $args );
|
||||
else
|
||||
$src = wp_remote_head( ( $url = esc_url_raw( $url ) ), $args );
|
||||
|
||||
if ( is_wp_error( $src ) )
|
||||
return array(
|
||||
'code' => $src->get_error_code(),
|
||||
'message' => $src->get_error_message(),
|
||||
);
|
||||
|
||||
$code = wp_remote_retrieve_response_code ( $src );
|
||||
$mesg = wp_remote_retrieve_response_message( $src );
|
||||
$data = wp_remote_retrieve_header( $src, 'last-modified' );
|
||||
$modified = $data ? strtotime( $data ) : $modified;
|
||||
|
||||
if ( 304 == $code )
|
||||
return array(
|
||||
'code' => $code,
|
||||
'message' => __( 'Your database file is up-to-date.', 'ip-geo-block' ),
|
||||
'filename' => $filename,
|
||||
'modified' => $modified,
|
||||
);
|
||||
|
||||
elseif ( 200 != $code )
|
||||
return array(
|
||||
'code' => $code,
|
||||
'message' => $code.' '.$mesg,
|
||||
);
|
||||
|
||||
try {
|
||||
// in case that the server which does not support HEAD method
|
||||
if ( isset( $args['method'] ) && 'GET' === $args['method'] ) {
|
||||
$data = wp_remote_retrieve_body( $src );
|
||||
|
||||
if ( 'gz' === $ext ) {
|
||||
if ( function_exists( 'gzdecode') ) { // @since PHP 5.4.0
|
||||
if ( FALSE === $fs->put_contents( $filename, gzdecode( $data ) ) )
|
||||
throw new Exception(
|
||||
sprintf( __( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $filename )
|
||||
);
|
||||
}
|
||||
|
||||
else {
|
||||
$src = get_temp_dir() . basename( $url ); // $src should be removed
|
||||
$fs->put_contents( $src, $data );
|
||||
if ( TRUE !== ( $ret = self::gzfile( $src, $filename ) ) ) {
|
||||
$err = $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elseif ( 'tar' === $ext && class_exists( 'PharData', FALSE ) ) { // @since PECL phar 2.0.0
|
||||
$name = wp_remote_retrieve_header( $src, 'content-disposition' );
|
||||
$name = explode( 'filename=', $name );
|
||||
$name = array_pop( $name ); // e.g. GeoLite2-Country_20180102.tar.gz
|
||||
$src = ( $tmp = get_temp_dir() ) . $name; // $src should be removed
|
||||
|
||||
// CVE-2015-6833: A directory traversal when extracting ZIP files could be used to overwrite files
|
||||
// outside of intended area via a `..` in a ZIP archive entry that is mishandled by extractTo().
|
||||
if ( $fs->put_contents( $src, $data ) ) {
|
||||
$data = new PharData( $src, FilesystemIterator::SKIP_DOTS ); // get archives
|
||||
|
||||
// make the list of contents to be extracted from archives.
|
||||
// when the list doesn't match the contents in archives, extractTo() may be crushed on windows.
|
||||
$dst = $data->getSubPathname(); // e.g. GeoLite2-Country_20180102
|
||||
foreach ( $files as $key => $val ) {
|
||||
$files[ $key ] = $dst.'/'.basename( $val );
|
||||
}
|
||||
|
||||
// extract specific files from archives into temporary directory and copy it to the destination.
|
||||
$data->extractTo( $tmp .= $dst, $files /* NULL */, TRUE ); // $tmp should be removed
|
||||
|
||||
// copy extracted files to Geolocation APIs directory
|
||||
$dst = dirname( $filename );
|
||||
foreach ( $files as $val ) {
|
||||
// should the destination be exclusive with LOCK_EX ?
|
||||
// $fs->put_contents( $dst.'/'.basename( $val ), $fs->get_contents( $tmp.'/'.$val ) );
|
||||
$fs->copy( $tmp.'/'.$val, $dst.'/'.basename( $val ), TRUE );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// downloaded and unzip
|
||||
else {
|
||||
// download file
|
||||
$src = download_url( $url );
|
||||
|
||||
if ( is_wp_error( $src ) )
|
||||
throw new Exception(
|
||||
$src->get_error_code() . ' ' . $src->get_error_message()
|
||||
);
|
||||
|
||||
// unzip file
|
||||
if ( 'gz' === $ext ) {
|
||||
if ( TRUE !== ( $ret = self::gzfile( $src, $filename ) ) ) {
|
||||
$err = $ret;
|
||||
}
|
||||
}
|
||||
|
||||
elseif ( 'zip' === $ext && class_exists( 'ZipArchive', FALSE ) ) {
|
||||
$tmp = get_temp_dir(); // @since 2.5
|
||||
$ret = $fs->unzip_file( $src, $tmp ); // @since 2.5
|
||||
|
||||
if ( is_wp_error( $ret ) )
|
||||
throw new Exception(
|
||||
$ret->get_error_code() . ' ' . $ret->get_error_message()
|
||||
);
|
||||
|
||||
if ( FALSE === ( $data = $fs->get_contents( $tmp .= basename( $filename ) ) ) )
|
||||
throw new Exception(
|
||||
sprintf( __( 'Unable to read <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $tmp )
|
||||
);
|
||||
|
||||
if ( FALSE === $fs->put_contents( $filename, $data ) )
|
||||
throw new Exception(
|
||||
sprintf( __( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $filename )
|
||||
);
|
||||
}
|
||||
|
||||
else {
|
||||
throw new Exception( __( 'gz or zip is not supported on your system.', 'ip-geo-block' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// error handler
|
||||
catch ( Exception $e ) {
|
||||
$err = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
|
||||
! empty ( $gz ) and gzclose( $gz );
|
||||
! empty ( $tmp ) and $fs->delete( $tmp, TRUE ); // should be removed recursively in case of directory
|
||||
is_string( $src ) && $fs->is_file( $src ) and $fs->delete( $src );
|
||||
|
||||
return empty( $err ) ? array(
|
||||
'code' => $code,
|
||||
'message' => sprintf( __( 'Last update: %s', 'ip-geo-block' ), IP_Geo_Block_Util::localdate( $modified ) ),
|
||||
'filename' => $filename,
|
||||
'modified' => $modified,
|
||||
) : $err;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,330 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* IP Geo Block - Filesystem
|
||||
*
|
||||
* @package IP_Geo_Block
|
||||
* @author tokkonopapa <tokkonopapa@yahoo.com>
|
||||
* @license GPL-3.0
|
||||
* @link https://www.ipgeoblock.com/
|
||||
* @link https://codex.wordpress.org/Filesystem_API
|
||||
* @copyright 2013-2019 tokkonopapa
|
||||
*/
|
||||
|
||||
class IP_Geo_Block_FS {
|
||||
|
||||
/**
|
||||
* Private variables of this class.
|
||||
*
|
||||
*/
|
||||
private static $instance = NULL;
|
||||
private static $method = 'direct';
|
||||
|
||||
/**
|
||||
* Create an instance of this class.
|
||||
*
|
||||
*/
|
||||
private static function get_instance() {
|
||||
return self::$instance ? self::$instance : ( self::$instance = new self );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize and return instance of this class.
|
||||
*
|
||||
*/
|
||||
public static function init( $msg = NULL ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/template.php'; // for submit_button() in request_filesystem_credentials()
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php'; // for get_filesystem_method(), request_filesystem_credentials()
|
||||
global $wp_filesystem;
|
||||
|
||||
// check already assigned by WP_Filesystem()
|
||||
if ( empty( $wp_filesystem ) ) {
|
||||
if (0) {
|
||||
// https://codex.wordpress.org/Filesystem_API#Tips_and_Tricks
|
||||
if ( 'direct' === ( self::$method = get_filesystem_method() ) ) { // @since 2.5.0
|
||||
// request_filesystem_credentials() can be run without any issues and don't need to worry about passing in a URL
|
||||
$creds = request_filesystem_credentials( admin_url(), '', FALSE, FALSE, NULL ); // @since 2.5.0
|
||||
|
||||
// initialize the API @since 2.5.0
|
||||
WP_Filesystem( $creds );
|
||||
}
|
||||
|
||||
elseif ( class_exists( 'IP_Geo_Block_Admin', FALSE ) ) {
|
||||
IP_Geo_Block_Admin::add_admin_notice(
|
||||
'error',
|
||||
sprintf( __( 'This plugin does not support method “%s” for FTP or SSH based file operations. Please refer to <a href="https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" title="Editing wp-config.php « WordPress Codex">this document</a> for more details.', 'ip-geo-block' ), self::$method )
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Determines the method on the filesystem.
|
||||
self::$method = get_filesystem_method();
|
||||
|
||||
if ( FALSE !== ( $creds = request_filesystem_credentials( admin_url(), '', FALSE, FALSE, NULL ) ) ) {
|
||||
WP_Filesystem( $creds );
|
||||
}
|
||||
|
||||
elseif ( class_exists( 'IP_Geo_Block_Admin', FALSE ) ) {
|
||||
IP_Geo_Block_Admin::add_admin_notice(
|
||||
'error',
|
||||
__( 'You should define some constants in your <code>wp-config.php</code> for FTP or SSH based file operations. Please refer to <a href="https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" title="Editing wp-config.php « WordPress Codex">this document</a> for more details.', 'ip-geo-block' )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return self::get_instance();
|
||||
}
|
||||
|
||||
// Add slash at the end of string.
|
||||
private function slashit( $string ) {
|
||||
return rtrim( $string, '/\\' ) . '/';
|
||||
}
|
||||
|
||||
// Get absolute path.
|
||||
private function absolute_path( $file ) {
|
||||
global $wp_filesystem;
|
||||
$path = str_replace( ABSPATH, $wp_filesystem->abspath(), dirname( $file ) );
|
||||
|
||||
return $this->slashit( $path ) . basename( $file );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get method of the file system;
|
||||
*
|
||||
* @return string method of file system
|
||||
*/
|
||||
public function get_method() {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return self::$method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file or directory exists.
|
||||
*
|
||||
* @param string $file Path to file/directory.
|
||||
* @return bool Whether $file exists or not.
|
||||
*/
|
||||
public function exists( $file ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->exists( $this->absolute_path( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate if path is file
|
||||
*
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
public function is_file( $path ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->is_file( $this->absolute_path( $path ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate if path is directory
|
||||
*
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
public function is_dir( $path ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->is_dir( $this->absolute_path( $path ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file is readable.
|
||||
*
|
||||
* @param string $file Path to file.
|
||||
* @return bool Whether $file is readable.
|
||||
*/
|
||||
public function is_readable( $file ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->is_readable( $this->absolute_path( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file or directory is writable.
|
||||
*
|
||||
* @param string $file Path to file.
|
||||
* @return bool Whether $file is writable.
|
||||
*/
|
||||
public function is_writable( $file ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->is_writable( $this->absolute_path( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a directory
|
||||
*
|
||||
* @param string $path
|
||||
* @param mixed $chmod
|
||||
* @param mixed $chown
|
||||
* @param mixed $chgrp
|
||||
* @return bool
|
||||
*/
|
||||
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->mkdir( $this->absolute_path( $path ), $chmod, $chown, $chgrp );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file or directory.
|
||||
*
|
||||
* @param string $file Path to the file.
|
||||
* @param bool $recursive If set True changes file group recursively.
|
||||
* @param bool $type Type of resource. 'f' for file, 'd' for directory.
|
||||
* @return bool True if the file or directory was deleted, false on failure.
|
||||
*/
|
||||
public function delete( $file, $recursive = FALSE, $type = FALSE ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->delete( $this->absolute_path( $file ), $recursive, $type );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file.
|
||||
*
|
||||
* @param string $src
|
||||
* @param string $dst
|
||||
* @param bool $overwrite
|
||||
* @param int $mode
|
||||
* @return bool
|
||||
*/
|
||||
public function copy( $src, $dst, $overwrite = FALSE, $mode = FALSE ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->copy(
|
||||
$this->absolute_path( $src ),
|
||||
$this->absolute_path( $dst ),
|
||||
$overwrite, $mode
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string to a file with an exclusive lock.
|
||||
*
|
||||
* @param string $file Remote path to the file where to write the data.
|
||||
* @param string $contents The data to write.
|
||||
* @param int $mode The file permissions as octal number, usually 0644. Default false.
|
||||
* @return bool
|
||||
*/
|
||||
public function put_contents( $file, $contents, $mode = FALSE ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
if ( 'direct' === self::$method )
|
||||
return @file_put_contents( $this->absolute_path( $file ), $contents, LOCK_EX );
|
||||
else
|
||||
return $wp_filesystem->put_contents( $this->absolute_path( $file ), $contents, $mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads entire file into a string
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $file Name of the file to read.
|
||||
* @return string|bool The data of contents or false on failure.
|
||||
*/
|
||||
public function get_contents( $file ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
if ( 'direct' === self::$method )
|
||||
return @file_get_contents( $this->absolute_path( $file ) );
|
||||
else
|
||||
return $wp_filesystem->get_contents( $this->absolute_path( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Read entire file into an array.
|
||||
*
|
||||
* @param string $file Filename.
|
||||
* @return array|bool An array of contents or false on failure.
|
||||
*/
|
||||
public function get_contents_array( $file ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return array();
|
||||
|
||||
// https://php.net/manual/en/function.file.php#refsect1-function.file-returnvalues
|
||||
@ini_set( 'auto_detect_line_endings', TRUE );
|
||||
|
||||
if ( ! $this->is_file( $file ) || ! $this->is_readable( $file ) )
|
||||
return FALSE;
|
||||
|
||||
if ( 'direct' === self::$method )
|
||||
return file( $this->absolute_path( $file ), FILE_IGNORE_NEW_LINES );
|
||||
|
||||
$file = $wp_filesystem->get_contents_array( $this->absolute_path( $file ) );
|
||||
return FALSE !== $file ? array_map( 'rtrim', $file ) : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unzips a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction.
|
||||
*
|
||||
* @param string $src Full path and filename of zip archive.
|
||||
* @param string $dst Full path on the filesystem to extract archive to.
|
||||
* @return WP_Error on failure, True on success
|
||||
*/
|
||||
public function unzip_file( $src, $dst ) {
|
||||
return unzip_file( $src, $this->absolute_path( $dst ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get details for files in a directory or a specific file.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $path
|
||||
* @param bool $include_hidden
|
||||
* @param bool $recursive
|
||||
* @return array|bool {
|
||||
* Array of files. False if unable to list directory contents.
|
||||
* @type string 'name' Name of the file/directory.
|
||||
* @type string 'perms' *nix representation of permissions.
|
||||
* @type int 'permsn' Octal representation of permissions.
|
||||
* @type string 'owner' Owner name or ID.
|
||||
* @type int 'size' Size of file in bytes.
|
||||
* @type int 'lastmodunix' Last modified unix timestamp.
|
||||
* @type mixed 'lastmod' Last modified month (3 letter) and day (without leading 0).
|
||||
* @type int 'time' Last modified time.
|
||||
* @type string 'type' Type of resource. 'f' for file, 'd' for directory.
|
||||
* @type mixed 'files' If a directory and $recursive is true, contains another array of files.
|
||||
* }
|
||||
*/
|
||||
public function dirlist( $path, $include_hidden = FALSE, $recursive = FALSE ) {
|
||||
global $wp_filesystem;
|
||||
if ( empty( $wp_filesystem ) )
|
||||
return FALSE;
|
||||
|
||||
return $wp_filesystem->dirlist( $path, $include_hidden, $recursive );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* IP Geo Block - DNS lookup
|
||||
*
|
||||
* @package IP_Geo_Block
|
||||
* @author tokkonopapa <tokkonopapa@yahoo.com>
|
||||
* @license GPL-3.0
|
||||
* @link https://www.ipgeoblock.com/
|
||||
* @copyright 2016-2019 tokkonopapa
|
||||
*/
|
||||
|
||||
class IP_Geo_Block_Lkup {
|
||||
|
||||
/**
|
||||
* Converts IP address to in_addr representation
|
||||
*
|
||||
* @link https://stackoverflow.com/questions/14459041/inet-pton-replacement-function-for-php-5-2-17-in-windows
|
||||
*/
|
||||
private static function inet_pton( $ip ) {
|
||||
// available on Windows platforms after PHP 5.3.0, need IPv6 support by PHP
|
||||
if ( function_exists( 'inet_pton' ) && ( $ip = @inet_pton( $ip ) ) )
|
||||
return $ip;
|
||||
|
||||
// ipv4
|
||||
elseif ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
|
||||
if ( FALSE === strpos( $ip, ':' ) ) {
|
||||
$ip = pack( 'N', ip2long( $ip ) );
|
||||
}
|
||||
else {
|
||||
$ip = explode( ':', $ip );
|
||||
$ip = pack( 'N', ip2long( $ip[ count( $ip ) - 1 ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
// ipv6
|
||||
elseif ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {
|
||||
$ip = explode( ':', $ip );
|
||||
$parts = 8 - count( $ip );
|
||||
$res = '';
|
||||
$replaced = 0;
|
||||
foreach ( $ip as $seg ) {
|
||||
if ( $seg != '' ) {
|
||||
$res .= str_pad( $seg, 4, '0', STR_PAD_LEFT );
|
||||
}
|
||||
elseif ( $replaced == 0 ) {
|
||||
for ( $i = 0; $i <= $parts; ++$i ) {
|
||||
$res .= '0000';
|
||||
}
|
||||
$replaced = 1;
|
||||
}
|
||||
elseif ( $replaced == 1 ) {
|
||||
$res .= '0000';
|
||||
}
|
||||
}
|
||||
$ip = pack( 'H' . strlen( $res ), $res );
|
||||
}
|
||||
|
||||
return $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* DNS lookup
|
||||
*
|
||||
*/
|
||||
public static function gethostbyaddr( $ip ) {
|
||||
// array( 'nameservers' => array( '8.8.8.8', '8.8.4.4' ) ) // Google public DNS
|
||||
// array( 'nameservers' => array( '1.1.1.1', '1.0.0.1' ) ) // APNIC public DNS
|
||||
$servers = array( 'nameservers' => apply_filters( IP_GEO_BLOCK::PLUGIN_NAME . '-dns', array() ) );
|
||||
if ( ! empty( $servers['nameservers'] ) ) {
|
||||
set_include_path( IP_GEO_BLOCK_PATH . 'includes' . PATH_SEPARATOR . get_include_path() );
|
||||
require_once IP_GEO_BLOCK_PATH . 'includes/Net/DNS2.php';
|
||||
|
||||
$r = new Net_DNS2_Resolver( $servers );
|
||||
|
||||
try {
|
||||
$result = $r->query( $ip, 'PTR' );
|
||||
}
|
||||
catch ( Net_DNS2_Exception $e ) {
|
||||
$result = $e->getMessage();
|
||||
}
|
||||
|
||||
if ( isset( $result->answer ) ) {
|
||||
foreach ( $result->answer as $obj ) {
|
||||
if ( 'PTR' === $obj->type ) {
|
||||
return $obj->ptrdname;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// available on Windows platforms after PHP 5.3.0
|
||||
if ( function_exists( 'gethostbyaddr' ) )
|
||||
$host = @gethostbyaddr( $ip );
|
||||
|
||||
// if not available
|
||||
if ( empty( $host ) && function_exists( 'dns_get_record' ) ) {
|
||||
// generate in-addr.arpa notation
|
||||
if ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
|
||||
$ptr = implode( ".", array_reverse( explode( ".", $ip ) ) ) . ".in-addr.arpa";
|
||||
}
|
||||
|
||||
elseif ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {
|
||||
$ptr = self::inet_pton( $ip );
|
||||
$ptr = implode(".", array_reverse( str_split( bin2hex( $ptr ) ) ) ) . ".ip6.arpa";
|
||||
}
|
||||
|
||||
if ( isset( $ptr ) and $ptr = @dns_get_record( $ptr, DNS_PTR ) ) {
|
||||
return $ptr[0]['target'];
|
||||
}
|
||||
}
|
||||
|
||||
return empty( $host ) ? $ip : $host;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* IP Geo Block - Register all actions and filters for the plugin
|
||||
*
|
||||
* @package IP_Geo_Block
|
||||
* @author tokkonopapa <tokkonopapa@yahoo.com>
|
||||
* @license GPL-3.0
|
||||
* @link https://www.ipgeoblock.com/
|
||||
* @copyright 2016-2019 tokkonopapa
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register all actions and filters for the plugin.
|
||||
*
|
||||
* Maintain a list of all hooks that are registered throughout
|
||||
* the plugin, and register them with the WordPress API. Call the
|
||||
* run function to execute the list of actions and filters.
|
||||
*/
|
||||
class IP_Geo_Block_Loader {
|
||||
|
||||
/**
|
||||
* The array of actions registered with WordPress.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @access protected
|
||||
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $actions;
|
||||
|
||||
/**
|
||||
* The array of filters registered with WordPress.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @access protected
|
||||
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $filters;
|
||||
|
||||
/**
|
||||
* Initialize the collections used to maintain the actions and filters.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->actions = array();
|
||||
$this->filters = array();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new action to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $hook The name of the WordPress action that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the action is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority Optional. he priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
||||
*/
|
||||
public function add_action( $hook, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->actions = $this->add( $this->actions, $hook, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new filter to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority Optional. he priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
|
||||
*/
|
||||
public function add_filter( $hook, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->filters = $this->add( $this->filters, $hook, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
public function apply_filters( $hook, $value ) {
|
||||
$args = func_get_args();
|
||||
|
||||
foreach ( $this->filters as $index => $filter ) {
|
||||
if ( $filter['hook'] === $hook ) {
|
||||
$args[1] = $value;
|
||||
$value = call_user_func_array(
|
||||
$filter['callback'], array_slice( $args, 1, (int)$filter['accepted_args'] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility function that is used to register the actions and hooks into a single
|
||||
* collection.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @access private
|
||||
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
||||
* @return array The collection of actions and filters registered with WordPress.
|
||||
*/
|
||||
private function add( $hooks, $hook, $callback, $priority, $accepted_args ) {
|
||||
|
||||
$hooks[] = array(
|
||||
'hook' => $hook,
|
||||
'callback' => $callback,
|
||||
'priority' => $priority,
|
||||
'accepted_args' => $accepted_args
|
||||
);
|
||||
|
||||
return $hooks;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the filters and actions with WordPress.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public function run() {
|
||||
|
||||
/**
|
||||
* This part will be executed after loading this plugin.
|
||||
* Register all the rest of the action and filter hooks.
|
||||
*/
|
||||
if ( IP_Geo_Block_Util::is_user_logged_in() ) {
|
||||
foreach ( $this->actions as $index => $hook ) {
|
||||
add_action( $hook['hook'], $hook['callback'], $hook['priority'], $hook['accepted_args'] );
|
||||
unset( $this->actions[ $index ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This part will be executed at the very beginning of WordPress core.
|
||||
* Execute callbacks that are specified by the component with 'init'.
|
||||
*/
|
||||
elseif ( defined( 'WP_ADMIN' ) && WP_ADMIN ) {
|
||||
// admin ajax/post needs to be deferred
|
||||
foreach ( $this->actions as $index => $hook ) {
|
||||
add_action( $hook['hook'], $hook['callback'], $hook['priority'], $hook['accepted_args'] );
|
||||
unset( $this->actions[ $index ] );
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
// Execute callback directly
|
||||
foreach ( $this->actions as $index => $hook ) {
|
||||
call_user_func( $hook['callback'], $hook['accepted_args'] );
|
||||
unset( $this->actions[ $index ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,575 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* IP Geo Block - Options
|
||||
*
|
||||
* @package IP_Geo_Block
|
||||
* @author tokkonopapa <tokkonopapa@yahoo.com>
|
||||
* @license GPL-3.0
|
||||
* @link https://www.ipgeoblock.com/
|
||||
* @copyright 2013-2019 tokkonopapa
|
||||
*/
|
||||
|
||||
class IP_Geo_Block_Opts {
|
||||
|
||||
/**
|
||||
* Default values of option table to be cached into options database table.
|
||||
*
|
||||
*/
|
||||
private static $option_table = array(
|
||||
'version' => '3.0.17',// Version of this table (not package)
|
||||
// since version 1.0
|
||||
'providers' => array(), // List of providers and API keys
|
||||
'comment' => array( // Message on the comment form
|
||||
'pos' => 0, // Position (0:none, 1:top, 2:bottom)
|
||||
'msg' => NULL, // Message text on comment form
|
||||
),
|
||||
'matching_rule' => -1, // -1:neither, 0:white list, 1:black list
|
||||
'white_list' => NULL, // Comma separeted country code
|
||||
'black_list' => 'ZZ', // Comma separeted country code
|
||||
'timeout' => 30, // Timeout in second
|
||||
'response_code' => 403, // Response code
|
||||
'save_statistics' => TRUE, // Record validation statistics
|
||||
'clean_uninstall' => TRUE, // Remove all savings from DB
|
||||
'simulate' => FALSE, // just simulate, never block
|
||||
// since version 1.1
|
||||
'cache_hold' => TRUE, // Record IP address cache
|
||||
'cache_time' => HOUR_IN_SECONDS, // @since 3.5
|
||||
// since version 3.0.0
|
||||
'cache_time_gc' => 900, // Cache garbage collection time
|
||||
'request_ua' => NULL, // since version 3.0.7
|
||||
// since version 1.2, 1.3
|
||||
'login_fails' => -1, // Limited number of login attempts
|
||||
'validation' => array( // Action hook for validation
|
||||
'comment' => FALSE, // Validate on comment post
|
||||
'login' => 1, // Validate on login
|
||||
'admin' => 1, // Validate on admin (1:country 2:ZEP)
|
||||
'ajax' => 0, // Validate on ajax/post (1:country 2:ZEP)
|
||||
'xmlrpc' => 1, // Validate on xmlrpc (1:country 2:close)
|
||||
'proxy' => NULL, // $_SERVER variables for IPs
|
||||
'reclogs' => 1, // 1:blocked 2:passed 3:unauth 4:auth 5:all 6:blocked/passed
|
||||
'postkey' => 'action,comment,log,pwd,FILES', // Keys in $_POST, $_FILES
|
||||
// since version 1.3.1
|
||||
'maxlogs' => 500, // Max number of rows for validation logs
|
||||
'backup' => NULL, // Absolute path to directory for backup logs
|
||||
// since version 3.0.13
|
||||
'explogs' => 7, // expiration time for logs [days]
|
||||
// since version 2.1.0
|
||||
'plugins' => 0, // Validate on wp-content/plugins (1:country 2:ZEP)
|
||||
'themes' => 0, // Validate on wp-content/themes (1:country 2:ZEP)
|
||||
// since version 2.2.9
|
||||
'timing' => 0, // 0:init, 1:mu-plugins, 2:drop-in
|
||||
'recdays' => 30, // Number of days for validation statistics
|
||||
// since version 3.0.0
|
||||
'includes' => 3, // for wp-includes/
|
||||
'uploads' => 3, // for UPLOADS/uploads
|
||||
'languages' => 3, // for WP_CONTENT_DIR/language
|
||||
'public' => 0, // Validate on public facing pages
|
||||
// since version 3.0.3
|
||||
'restapi' => 3, // for get_rest_url()
|
||||
'mimetype' => 0, // 0:disable, 1:white_list, 2:black_list
|
||||
// since version 3.0.18
|
||||
'metadata' => FALSE,
|
||||
),
|
||||
'update' => array( // Updating IP address DB
|
||||
'auto' => TRUE, // Auto updating of DB files
|
||||
'retry' => 0, // Number of retry to download
|
||||
'cycle' => 30, // Updating cycle (days)
|
||||
),
|
||||
// since version 3.0.9, 3.0.17
|
||||
'priority' => array( 0, PHP_INT_MAX ), // 0:high, 1:low
|
||||
// since version 2.2.0
|
||||
'anonymize' => TRUE, // Anonymize IP address to hide privacy
|
||||
'signature' => '../,/wp-config.php,/passwd', // malicious signature
|
||||
'extra_ips' => array( // Additional IP validation
|
||||
'white_list' => NULL, // White list of IP addresses
|
||||
'black_list' => NULL, // Black list of IP addresses
|
||||
),
|
||||
'rewrite' => array( // Apply rewrite rule
|
||||
'plugins' => FALSE, // for wp-content/plugins
|
||||
'themes' => FALSE, // for wp-content/themes
|
||||
// since version 3.0.0
|
||||
'includes' => FALSE, // for wp-includes/
|
||||
'uploads' => FALSE, // for UPLOADS/uploads
|
||||
'languages' => FALSE, // for wp-content/language
|
||||
),
|
||||
'Maxmind' => array( // Maxmind
|
||||
// since version 2.2.2
|
||||
'ipv4_path' => NULL, // Path to IPv4 DB file
|
||||
'ipv6_path' => NULL, // Path to IPv6 DB file
|
||||
// since version 2.2.1
|
||||
'ipv4_last' => 0, // Last-Modified of DB file
|
||||
'ipv6_last' => 0, // Last-Modified of DB file
|
||||
// since version 3.0.4
|
||||
'use_asn' => -1, // -1:install, 0:disable, 1:enable
|
||||
'asn4_path' => NULL, // AS Number for IPv4
|
||||
'asn6_path' => NULL, // AS Number for IPv6
|
||||
'asn4_last' => 0, // AS Number for IPv4
|
||||
'asn6_last' => 0, // AS Number for IPv6
|
||||
),
|
||||
'IP2Location' => array( // IP2Location
|
||||
// since version 2.2.2
|
||||
'ipv4_path' => NULL, // Path to IPv4 DB file
|
||||
'ipv6_path' => NULL, // Path to IPv6 DB file
|
||||
// since version 2.2.1
|
||||
'ipv4_last' => 0, // Last-Modified of DB file
|
||||
'ipv6_last' => 0, // Last-Modified of DB file
|
||||
),
|
||||
// since version 3.0.8
|
||||
'Geolite2' => array( // Maxmind
|
||||
'use_asn' => -1, // -1:install, 0:disable, 1:enable
|
||||
'ip_path' => NULL, // GeoLite2 DB: Path
|
||||
'ip_last' => NULL, // GeoLite2 DB: Last-Modified
|
||||
'asn_path' => NULL, // GeoLite2 ASN DB: Path
|
||||
'asn_last' => NULL, // GeoLite2 ASN DB: Last-Modified
|
||||
),
|
||||
// since version 2.2.3
|
||||
'api_dir' => NULL, // Path to geo-location API
|
||||
// since version 2.2.5
|
||||
'exception' => array( // list of exceptional
|
||||
'plugins' => array(), // for pliugins
|
||||
'themes' => array(), // for themes
|
||||
// since version 3.0.0
|
||||
'admin' => array(), // for wp-admin
|
||||
'public' => array( // for public facing pages
|
||||
'bbp-new-topic', 'bbp-edit-topic',
|
||||
'bbp-new-reply', 'bbp-edit-reply',
|
||||
),
|
||||
'includes' => array(), // for wp-includes/
|
||||
'uploads' => array(), // for UPLOADS/uploads
|
||||
'languages' => array(), // for wp-content/language
|
||||
// since version 3.0.3
|
||||
'restapi' => array(), // for get_rest_url()
|
||||
),
|
||||
// since version 2.2.7
|
||||
'api_key' => array( // API key
|
||||
'GoogleMap' => NULL, // 'default':revoked, NULL:iframe
|
||||
),
|
||||
// since version 2.2.8
|
||||
'login_action' => array( // Actions for wp-login.php
|
||||
'login' => TRUE,
|
||||
'register' => TRUE,
|
||||
'resetpass' => TRUE,
|
||||
'lostpassword' => TRUE,
|
||||
'postpass' => TRUE,
|
||||
),
|
||||
// since version 3.0.0
|
||||
'response_msg' => 'Sorry, your request cannot be accepted.', // message on blocking
|
||||
'redirect_uri' => 'http://blackhole.webpagetest.org/', // redirection on blocking
|
||||
'network_wide' => FALSE, // settings page on network dashboard
|
||||
'public' => array(
|
||||
'matching_rule' => -1, // -1:follow, 0:white list, 1:black list
|
||||
'white_list' => NULL, // Comma separeted country code
|
||||
'black_list' => 'ZZ', // Comma separeted country code
|
||||
'target_rule' => 0, // 0:all requests, 1:specify the target
|
||||
'target_pages' => array(), // blocking target of pages
|
||||
'target_posts' => array(), // blocking target of post types
|
||||
'target_cates' => array(), // blocking target of categories
|
||||
'target_tags' => array(), // blocking target of tags
|
||||
'ua_list' => "Google:HOST,bot:HOST,slurp:HOST\nspider:HOST,archive:HOST,*:FEED\nembed.ly:HOST,Twitterbot:US,Facebot:US",
|
||||
// since version 3.0.3
|
||||
'dnslkup' => FALSE, // use DNS reverse lookup
|
||||
'response_code' => 307, // better for AdSense
|
||||
'redirect_uri' => NULL, // home
|
||||
'response_msg' => 'Sorry, your request cannot be accepted.', // message on blocking
|
||||
// since version 3.0.10
|
||||
'behavior' => FALSE // Bad behavior
|
||||
),
|
||||
// since version 3.0.3
|
||||
'mimetype' => array(
|
||||
'white_list' => array(), // key and value
|
||||
'black_list' => "asp,aspx,cgi,exe,js,jsp,php,php3,php4,php5,pl,py,pht,phtml,html,htm,shtml,htaccess,sh,svg,gz,zip,rar,tar", // comma separated extension
|
||||
// since version 3.0.4
|
||||
'capability' => array( 'upload_files' ),
|
||||
),
|
||||
// since version 3.0.5
|
||||
'live_update' => array(
|
||||
'in_memory' => 0, // -1:unavailable, 0:file, 1:memory
|
||||
),
|
||||
// since version 3.0.10
|
||||
'behavior' => array(
|
||||
'view' => 7, // More than 7 page view in 5 seconds
|
||||
'time' => 5, // More than 7 page view in 5 seconds
|
||||
),
|
||||
// since version 3.0.13
|
||||
'restrict_api' => TRUE, // Do not send IP address to external APIs
|
||||
// since version 3.0.14
|
||||
'login_link' => array(
|
||||
'link' => NULL, // key of login link
|
||||
'hash' => NULL, // hash of 'link'
|
||||
),
|
||||
// since version 3.0.18
|
||||
'monitor' => array(
|
||||
'updated_option' => FALSE,
|
||||
'update_site_option' => FALSE,
|
||||
),
|
||||
'metadata' => array(
|
||||
'pre_update_option' => array( 'siteurl', 'admin_email', 'users_can_register', 'default_role' ), // @since 2.0.0 `manage_options`
|
||||
'pre_update_site_option' => array( 'siteurl', 'admin_email', 'registration' ), // @since 3.0.0 `manage_network_options`
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* I/F for option table
|
||||
*
|
||||
*/
|
||||
public static function get_default() {
|
||||
// https://developer.wordpress.org/reference/functions/wp_get_mime_types/
|
||||
// https://codex.wordpress.org/Uploading_Files#About_Uploading_Files_on_Dashboard
|
||||
self::$option_table['mimetype']['white_list'] = array(
|
||||
// Image formats.
|
||||
'jpg|jpeg|jpe' => 'image/jpeg',
|
||||
'gif' => 'image/gif',
|
||||
'png' => 'image/png',
|
||||
'ico' => 'image/x-icon',
|
||||
|
||||
// Video formats.
|
||||
'wmv' => 'video/x-ms-wmv',
|
||||
'avi' => 'video/avi',
|
||||
'mov|qt' => 'video/quicktime',
|
||||
'mpeg|mpg|mpe' => 'video/mpeg',
|
||||
'mp4|m4v' => 'video/mp4',
|
||||
'ogv' => 'video/ogg',
|
||||
'3gp|3gpp' => 'video/3gpp',
|
||||
'3g2|3gp2' => 'video/3gpp2',
|
||||
|
||||
// Audio formats.
|
||||
'mp3|m4a|m4b' => 'audio/mpeg',
|
||||
'wav' => 'audio/wav',
|
||||
'ogg|oga' => 'audio/ogg',
|
||||
|
||||
// Misc application formats.
|
||||
'pdf' => 'application/pdf',
|
||||
'psd' => 'application/octet-stream',
|
||||
|
||||
// MS Office formats.
|
||||
'doc' => 'application/msword',
|
||||
'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
|
||||
'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
|
||||
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||
);
|
||||
|
||||
return self::$option_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade option table
|
||||
* @since 3.0.3.1 This should be executed in admin context
|
||||
*/
|
||||
public static function upgrade() {
|
||||
$default = IP_Geo_Block::get_default();
|
||||
$settings = IP_Geo_Block::get_option();
|
||||
$version = $settings['version'];
|
||||
|
||||
// refresh if it's too old
|
||||
if ( version_compare( $version, '2.0.0' ) < 0 )
|
||||
$settings = $default;
|
||||
|
||||
if ( version_compare( $version, '2.1.0' ) < 0 ) {
|
||||
foreach ( array( 'plugins', 'themes' ) as $tmp ) {
|
||||
$settings['validation'][ $tmp ] = $default['validation'][ $tmp ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '2.2.0' ) < 0 ) {
|
||||
foreach ( array( 'anonymize', 'signature', 'extra_ips', 'rewrite' ) as $tmp ) {
|
||||
$settings[ $tmp ] = $default[ $tmp ];
|
||||
}
|
||||
|
||||
foreach ( array( 'admin', 'ajax' ) as $tmp ) {
|
||||
if ( $settings['validation'][ $tmp ] == 2 )
|
||||
$settings['validation'][ $tmp ] = 3; // WP-ZEP + Block by country
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '2.2.1' ) < 0 ) {
|
||||
foreach ( array( 'Maxmind', 'IP2Location' ) as $tmp ) {
|
||||
$settings[ $tmp ] = $default[ $tmp ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '2.2.2' ) < 0 ) {
|
||||
$tmp = get_option( 'ip_geo_block_statistics' );
|
||||
$tmp['daystats'] = array();
|
||||
IP_Geo_Block_Logs::record_stat( $tmp );
|
||||
delete_option( 'ip_geo_block_statistics' ); // @since 1.2.0
|
||||
|
||||
foreach ( array( 'maxmind', 'ip2location' ) as $tmp ) {
|
||||
unset( $settings[ $tmp ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '2.2.3' ) < 0 )
|
||||
$settings['api_dir'] = $default['api_dir'];
|
||||
|
||||
if ( version_compare( $version, '2.2.5' ) < 0 ) {
|
||||
// https://wordpress.org/support/topic/compatibility-with-ag-custom-admin
|
||||
$arr = array();
|
||||
foreach ( explode( ',', $settings['signature'] ) as $tmp ) {
|
||||
$tmp = trim( $tmp );
|
||||
if ( 'wp-config.php' === $tmp || 'passwd' === $tmp )
|
||||
$tmp = '/' . $tmp;
|
||||
array_push( $arr, $tmp );
|
||||
}
|
||||
$settings['signature'] = implode( ',', $arr );
|
||||
foreach ( array( 'plugins', 'themes' ) as $tmp ) {
|
||||
$settings['exception'][ $tmp ] = $default['exception'][ $tmp ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '2.2.6' ) < 0 ) {
|
||||
$settings['signature'] = str_replace( " ", "\n", $settings['signature'] );
|
||||
$settings['extra_ips']['white_list'] = str_replace( " ", "\n", $settings['extra_ips']['white_list'] );
|
||||
$settings['extra_ips']['black_list'] = str_replace( " ", "\n", $settings['extra_ips']['black_list'] );
|
||||
|
||||
foreach ( array( 'plugins', 'themes' ) as $tmp ) {
|
||||
$arr = array_keys( $settings['exception'][ $tmp ] );
|
||||
if ( ! empty( $arr ) && ! is_numeric( $arr[0] ) )
|
||||
$settings['exception'][ $tmp ] = $arr;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '2.2.7' ) < 0 )
|
||||
$settings['api_key'] = $default['api_key'];
|
||||
|
||||
if ( version_compare( $version, '2.2.8' ) < 0 ) {
|
||||
$settings['login_action'] = $default['login_action'];
|
||||
// Block by country (register, lost password)
|
||||
if ( 2 === (int)$settings['validation']['login'] )
|
||||
$settings['login_action']['login'] = FALSE;
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '2.2.9' ) < 0 ) {
|
||||
$settings['validation']['timing' ] = $default['validation']['timing' ];
|
||||
$settings['validation']['recdays'] = $default['validation']['recdays'];
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.0' ) < 0 ) {
|
||||
foreach ( array( 'cache_time_gc', 'response_msg', 'redirect_uri', 'network_wide', 'public' ) as $tmp ) {
|
||||
$settings[ $tmp ] = $default[ $tmp ];
|
||||
}
|
||||
|
||||
foreach ( array( 'public', 'includes', 'uploads', 'languages' ) as $tmp ) {
|
||||
$settings['validation'][ $tmp ] = $default['validation'][ $tmp ];
|
||||
$settings['rewrite' ][ $tmp ] = $default['rewrite' ][ $tmp ];
|
||||
$settings['exception' ][ $tmp ] = $default['exception' ][ $tmp ];
|
||||
}
|
||||
|
||||
$settings['exception']['admin'] = $default['exception']['admin'];
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.1' ) < 0 )
|
||||
delete_transient( IP_Geo_Block::CACHE_NAME ); // @since 2.8
|
||||
|
||||
if ( version_compare( $version, '3.0.3' ) < 0 ) {
|
||||
$settings['exception' ]['restapi' ] = $default['exception' ]['restapi' ];
|
||||
$settings['validation' ]['restapi' ] = $default['validation']['restapi' ];
|
||||
$settings['validation' ]['mimetype' ] = $default['validation']['mimetype' ];
|
||||
$settings['public' ]['redirect_uri' ] = $default['public' ]['redirect_uri' ];
|
||||
$settings['public' ]['response_msg' ] = $default['public' ]['response_msg' ];
|
||||
$settings['public' ]['response_code'] = $default['public' ]['response_code'];
|
||||
$settings['public' ]['dnslkup' ] = TRUE;
|
||||
$settings['public' ]['ua_list' ] = str_replace( '*:HOST=embed.ly', 'embed.ly:HOST', $settings['public']['ua_list'] );
|
||||
$settings['login_action']['resetpass' ] = @$settings['login_action']['resetpasss'];
|
||||
$settings['mimetype' ] = $default['mimetype'];
|
||||
unset(
|
||||
$settings['rewrite' ]['public' ], // unused @3.0.0
|
||||
$settings['rewrite' ]['content' ], // unused @3.0.0
|
||||
$settings['login_action']['resetpasss'] // mis-spelled
|
||||
);
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.4.1' ) < 0 ) {
|
||||
if ( ! isset( $settings['Maxmind']['use_asn'] ) ) {
|
||||
$settings['Maxmind' ]['use_asn' ] = 0; // disable
|
||||
$settings['Maxmind' ]['asn4_path' ] = $default['Maxmind' ]['asn4_path' ];
|
||||
$settings['Maxmind' ]['asn4_last' ] = $default['Maxmind' ]['asn4_last' ];
|
||||
$settings['Maxmind' ]['asn6_path' ] = $default['Maxmind' ]['asn6_path' ];
|
||||
$settings['Maxmind' ]['asn6_last' ] = $default['Maxmind' ]['asn6_last' ];
|
||||
$settings['mimetype']['capability'] = $default['mimetype']['capability'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.5' ) < 0 )
|
||||
$settings['live_update'] = $default['live_update'];
|
||||
|
||||
if ( version_compare( $version, '3.0.8' ) < 0 ) {
|
||||
$settings['timeout' ] = $default['timeout' ];
|
||||
$settings['Geolite2'] = $default['Geolite2'];
|
||||
$settings['Geolite2']['use_asn'] = $settings['Maxmind']['use_asn'];
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.10' ) < 0 ) {
|
||||
$settings['behavior'] = $default['behavior'];
|
||||
$settings['public' ]['behavior'] = $default['public']['behavior'];
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.11' ) < 0 ) {
|
||||
// change the size of some database columns
|
||||
$settings['cache_hold'] = $default['cache_hold'];
|
||||
IP_Geo_Block_Logs::delete_tables( IP_Geo_Block::CACHE_NAME );
|
||||
IP_Geo_Block_Logs::create_tables();
|
||||
IP_Geo_Block_Logs::reset_sqlite_db();
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.13' ) < 0 ) {
|
||||
$settings['validation' ]['maxlogs'] = $default['validation']['maxlogs'];
|
||||
$settings['validation' ]['explogs'] = $default['validation']['explogs'];
|
||||
$settings['restrict_api'] = $settings['anonymize'];
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.14' ) < 0 )
|
||||
$settings['login_link'] = $default['login_link'];
|
||||
|
||||
if ( version_compare( $version, '3.0.15' ) < 0 )
|
||||
IP_Geo_Block_Logs::upgrade( $version );
|
||||
|
||||
if ( version_compare( $version, '3.0.16' ) < 0 ) {
|
||||
$settings['simulate'] = $settings['public']['simulate'];
|
||||
unset( $settings['public']['simulate'] );
|
||||
}
|
||||
|
||||
if ( version_compare( $version, '3.0.17' ) < 0 )
|
||||
$settings['priority'] = $default['priority'];
|
||||
|
||||
if ( version_compare( $version, '3.0.18' ) < 0 ) {
|
||||
$settings['validation']['metadata'] = $default['validation']['metadata'];
|
||||
$settings['monitor' ] = $default['monitor' ];
|
||||
$settings['metadata' ] = $default['metadata'];
|
||||
IP_Geo_Block::update_metadata( NULL );
|
||||
|
||||
self::remove_mu_plugin( ); // remove new file
|
||||
self::remove_mu_plugin(''); // remove old file
|
||||
self::setup_validation_timing( $settings );
|
||||
}
|
||||
|
||||
// update package version number
|
||||
$settings['version'] = IP_Geo_Block::VERSION;
|
||||
|
||||
// install addons for IP Geolocation database API ver. 1.1.15 at IP Geo Block 3.0.18
|
||||
$providers = IP_Geo_Block_Provider::get_addons();
|
||||
if ( empty( $providers ) || ! $settings['api_dir'] || ! file_exists( $settings['api_dir'] ) || version_compare( $version, '3.0.18' ) < 0 )
|
||||
$settings['api_dir'] = self::install_api( $settings );
|
||||
|
||||
$settings['request_ua'] = trim( str_replace( array( 'InfiniteWP' ), '', @$_SERVER['HTTP_USER_AGENT'] ) );
|
||||
|
||||
// update (or create if it does not exist) option table
|
||||
IP_Geo_Block::update_option( $settings );
|
||||
|
||||
// return upgraded settings
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install / Uninstall APIs
|
||||
*
|
||||
*/
|
||||
private static function install_api( $settings ) {
|
||||
IP_Geo_Block_Cron::stop_update_db();
|
||||
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
$src = IP_Geo_Block_Util::slashit( IP_GEO_BLOCK_PATH . 'wp-content/' . IP_Geo_Block::GEOAPI_NAME );
|
||||
$dst = IP_Geo_Block_Util::slashit( self::get_api_dir( $settings ) );
|
||||
|
||||
if ( $src !== $dst ) {
|
||||
$fs->exists( $dst ) or $fs->mkdir( $dst );
|
||||
|
||||
$result = copy_dir( $src, $dst );
|
||||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
if ( class_exists( 'IP_Geo_Block_Admin', FALSE ) ) {
|
||||
IP_Geo_Block_Admin::add_admin_notice( 'error',
|
||||
sprintf( __( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), '<code>' . $dst . '</code>' )
|
||||
);
|
||||
}
|
||||
$dst = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
IP_Geo_Block_Cron::start_update_db( $settings );
|
||||
|
||||
return $dst;
|
||||
}
|
||||
|
||||
public static function uninstall_api( $settings ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
return $fs->delete( self::get_api_dir( $settings ), TRUE ); // $recursive = true
|
||||
}
|
||||
|
||||
private static function get_api_dir( $settings ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
// wp-content
|
||||
$dir = ( empty( $settings['api_dir'] ) || ! $fs->exists( $settings['api_dir'] ) ) ? WP_CONTENT_DIR : dirname( $settings['api_dir'] );
|
||||
|
||||
if ( ! $fs->is_writable( $dir ) ) {
|
||||
// wp-content/uploads
|
||||
$dir = wp_upload_dir();
|
||||
$dir = $dir['basedir'];
|
||||
|
||||
if ( ! $fs->is_writable( $dir ) ) // wp-content/plugins/ip-geo-block
|
||||
$dir = $fs->is_writable( IP_GEO_BLOCK_PATH ) ? IP_GEO_BLOCK_PATH : NULL;
|
||||
}
|
||||
|
||||
return IP_Geo_Block_Util::slashit(
|
||||
apply_filters( IP_Geo_Block::PLUGIN_NAME . '-api-dir', $dir )
|
||||
) . IP_Geo_Block::GEOAPI_NAME; // must add `ip-geo-api` for basename
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate / Deactivate Must-use plugin / Advanced cache
|
||||
*
|
||||
*/
|
||||
private static function remove_mu_plugin( $prefix = '!' ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
if ( $fs->exists( $src = WPMU_PLUGIN_DIR . '/' . $prefix . 'ip-geo-block-mu.php' ) )
|
||||
return $fs->delete( $src ) ? TRUE : $src;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public static function get_validation_timing( $prefix = '!' ) {
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
return $fs->exists( WPMU_PLUGIN_DIR . '/' . $prefix . 'ip-geo-block-mu.php' ) ? 1 : 0;
|
||||
}
|
||||
|
||||
public static function setup_validation_timing( $settings = NULL, $prefix = '!' ) {
|
||||
switch ( $settings ? (int)$settings['validation']['timing'] : 0 ) {
|
||||
case 0: // init
|
||||
if ( TRUE !== ( $src = self::remove_mu_plugin() ) )
|
||||
return $src;
|
||||
break;
|
||||
|
||||
case 1: // mu-plugins
|
||||
$src = IP_GEO_BLOCK_PATH . 'wp-content/mu-plugins/ip-geo-block-mu.php';
|
||||
$dst = WPMU_PLUGIN_DIR . '/' . $prefix . 'ip-geo-block-mu.php';
|
||||
|
||||
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
|
||||
$fs = IP_Geo_Block_FS::init( __FUNCTION__ );
|
||||
|
||||
if ( ! $fs->is_file( $dst ) ) {
|
||||
if ( ! $fs->is_dir( WPMU_PLUGIN_DIR ) && ! $fs->mkdir( WPMU_PLUGIN_DIR ) )
|
||||
return $dst;
|
||||
|
||||
if ( ! $fs->copy( $src, $dst, TRUE ) )
|
||||
return $dst;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
<?php
|
||||
// Silence is golden.
|
||||
@@ -1,142 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* DNS Library for handling lookups and updates.
|
||||
*
|
||||
* PHP Version 5
|
||||
*
|
||||
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Mike Pultz nor the names of his contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category Networking
|
||||
* @package Net_DNS2
|
||||
* @author Mike Pultz <mike@mikepultz.com>
|
||||
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/package/Net_DNS2
|
||||
* @since File available since Release 0.6.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Exception handler used by Net_DNS2
|
||||
*
|
||||
* @category Networking
|
||||
* @package Net_DNS2
|
||||
* @author Mike Pultz <mike@mikepultz.com>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
* @link http://pear.php.net/package/Net_DNS2
|
||||
*
|
||||
*/
|
||||
class Net_DNS2_Exception extends Exception
|
||||
{
|
||||
private $_request;
|
||||
private $_response;
|
||||
|
||||
/**
|
||||
* Constructor - overload the constructor so we can pass in the request
|
||||
* and response object (when it's available)
|
||||
*
|
||||
* @param string $message the exception message
|
||||
* @param int $code the exception code
|
||||
* @param object $previous the previous Exception object
|
||||
* @param object $request the Net_DNS2_Packet_Request object for this request
|
||||
* @param object $response the Net_DNS2_Packet_Response object for this request
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function __construct(
|
||||
$message = '',
|
||||
$code = 0,
|
||||
$previous = null,
|
||||
Net_DNS2_Packet_Request $request = null,
|
||||
Net_DNS2_Packet_Response $response = null
|
||||
) {
|
||||
//
|
||||
// store the request/response objects (if passed)
|
||||
//
|
||||
$this->_request = $request;
|
||||
$this->_response = $response;
|
||||
|
||||
//
|
||||
// call the parent constructor
|
||||
//
|
||||
// the "previous" argument was added in PHP 5.3.0
|
||||
//
|
||||
// https://code.google.com/p/netdns2/issues/detail?id=25
|
||||
//
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=') == true) {
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
} else {
|
||||
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the Net_DNS2_Packet_Request object (if available)
|
||||
*
|
||||
* @return Net_DNS2_Packet_Request object
|
||||
* @access public
|
||||
* @since function available since release 1.3.1
|
||||
*
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->_request;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the Net_DNS2_Packet_Response object (if available)
|
||||
*
|
||||
* @return Net_DNS2_Packet_Response object
|
||||
* @access public
|
||||
* @since function available since release 1.3.1
|
||||
*
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->_response;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* c-hanging-comment-ender-p: nil
|
||||
* End:
|
||||
*/
|
||||
?>
|
||||
@@ -1,277 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* DNS Library for handling lookups and updates.
|
||||
*
|
||||
* PHP Version 5
|
||||
*
|
||||
* Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Mike Pultz nor the names of his contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category Networking
|
||||
* @package Net_DNS2
|
||||
* @author Mike Pultz <mike@mikepultz.com>
|
||||
* @copyright 2010 Mike Pultz <mike@mikepultz.com>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/package/Net_DNS2
|
||||
* @since File available since Release 0.6.0
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* DNS Packet Header class
|
||||
*
|
||||
* This class handles parsing and constructing DNS Packet Headers as defined
|
||||
* by section 4.1.1 of RFC1035.
|
||||
*
|
||||
* DNS header format - RFC1035 section 4.1.1
|
||||
* DNS header format - RFC4035 section 3.2
|
||||
*
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
* | ID |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
* |QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
* | QDCOUNT |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
* | ANCOUNT |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
* | NSCOUNT |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
* | ARCOUNT |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
*
|
||||
* @category Networking
|
||||
* @package Net_DNS2
|
||||
* @author Mike Pultz <mike@mikepultz.com>
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
* @link http://pear.php.net/package/Net_DNS2
|
||||
*
|
||||
*/
|
||||
class Net_DNS2_Header
|
||||
{
|
||||
public $id; // 16 bit - identifier
|
||||
public $qr; // 1 bit - 0 = query, 1 = response
|
||||
public $opcode; // 4 bit - op code
|
||||
public $aa; // 1 bit - Authoritative Answer
|
||||
public $tc; // 1 bit - TrunCation
|
||||
public $rd; // 1 bit - Recursion Desired
|
||||
public $ra; // 1 bit - Recursion Available
|
||||
public $z; // 1 bit - Reserved
|
||||
public $ad; // 1 bit - Authentic Data (RFC4035)
|
||||
public $cd; // 1 bit - Checking Disabled (RFC4035)
|
||||
public $rcode; // 4 bit - Response code
|
||||
public $qdcount; // 16 bit - entries in the question section
|
||||
public $ancount; // 16 bit - resource records in the answer section
|
||||
public $nscount; // 16 bit - name server rr in the authority records section
|
||||
public $arcount; // 16 bit - rr's in the additional records section
|
||||
|
||||
/**
|
||||
* Constructor - builds a new Net_DNS2_Header object
|
||||
*
|
||||
* @param mixed &$packet either a Net_DNS2_Packet object or null
|
||||
*
|
||||
* @throws Net_DNS2_Exception
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function __construct(Net_DNS2_Packet &$packet = null)
|
||||
{
|
||||
if (!is_null($packet)) {
|
||||
|
||||
$this->set($packet);
|
||||
} else {
|
||||
|
||||
$this->id = $this->nextPacketId();
|
||||
$this->qr = Net_DNS2_Lookups::QR_QUERY;
|
||||
$this->opcode = Net_DNS2_Lookups::OPCODE_QUERY;
|
||||
$this->aa = 0;
|
||||
$this->tc = 0;
|
||||
$this->rd = 1;
|
||||
$this->ra = 0;
|
||||
$this->z = 0;
|
||||
$this->ad = 0;
|
||||
$this->cd = 0;
|
||||
$this->rcode = Net_DNS2_Lookups::RCODE_NOERROR;
|
||||
$this->qdcount = 1;
|
||||
$this->ancount = 0;
|
||||
$this->nscount = 0;
|
||||
$this->arcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the next available packet id
|
||||
*
|
||||
* @return integer
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function nextPacketId()
|
||||
{
|
||||
if (++Net_DNS2_Lookups::$next_packet_id > 65535) {
|
||||
|
||||
Net_DNS2_Lookups::$next_packet_id = 1;
|
||||
}
|
||||
|
||||
return Net_DNS2_Lookups::$next_packet_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* magic __toString() method to return the header as a string
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$output = ";;\n;; Header:\n";
|
||||
|
||||
$output .= ";;\t id = " . $this->id . "\n";
|
||||
$output .= ";;\t qr = " . $this->qr . "\n";
|
||||
$output .= ";;\t opcode = " . $this->opcode . "\n";
|
||||
$output .= ";;\t aa = " . $this->aa . "\n";
|
||||
$output .= ";;\t tc = " . $this->tc . "\n";
|
||||
$output .= ";;\t rd = " . $this->rd . "\n";
|
||||
$output .= ";;\t ra = " . $this->ra . "\n";
|
||||
$output .= ";;\t z = " . $this->z . "\n";
|
||||
$output .= ";;\t ad = " . $this->ad . "\n";
|
||||
$output .= ";;\t cd = " . $this->cd . "\n";
|
||||
$output .= ";;\t rcode = " . $this->rcode . "\n";
|
||||
$output .= ";;\t qdcount = " . $this->qdcount . "\n";
|
||||
$output .= ";;\t ancount = " . $this->ancount . "\n";
|
||||
$output .= ";;\t nscount = " . $this->nscount . "\n";
|
||||
$output .= ";;\t arcount = " . $this->arcount . "\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* constructs a Net_DNS2_Header from a Net_DNS2_Packet object
|
||||
*
|
||||
* @param Net_DNS2_Packet &$packet Object
|
||||
*
|
||||
* @return boolean
|
||||
* @throws Net_DNS2_Exception
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function set(Net_DNS2_Packet &$packet)
|
||||
{
|
||||
//
|
||||
// the header must be at least 12 bytes long.
|
||||
//
|
||||
if ($packet->rdlength < Net_DNS2_Lookups::DNS_HEADER_SIZE) {
|
||||
|
||||
throw new Net_DNS2_Exception(
|
||||
'invalid header data provided; to small',
|
||||
Net_DNS2_Lookups::E_HEADER_INVALID
|
||||
);
|
||||
}
|
||||
|
||||
$offset = 0;
|
||||
|
||||
//
|
||||
// parse the values
|
||||
//
|
||||
$this->id = ord($packet->rdata[$offset]) << 8 |
|
||||
ord($packet->rdata[++$offset]);
|
||||
|
||||
++$offset;
|
||||
$this->qr = (ord($packet->rdata[$offset]) >> 7) & 0x1;
|
||||
$this->opcode = (ord($packet->rdata[$offset]) >> 3) & 0xf;
|
||||
$this->aa = (ord($packet->rdata[$offset]) >> 2) & 0x1;
|
||||
$this->tc = (ord($packet->rdata[$offset]) >> 1) & 0x1;
|
||||
$this->rd = ord($packet->rdata[$offset]) & 0x1;
|
||||
|
||||
++$offset;
|
||||
$this->ra = (ord($packet->rdata[$offset]) >> 7) & 0x1;
|
||||
$this->z = (ord($packet->rdata[$offset]) >> 6) & 0x1;
|
||||
$this->ad = (ord($packet->rdata[$offset]) >> 5) & 0x1;
|
||||
$this->cd = (ord($packet->rdata[$offset]) >> 4) & 0x1;
|
||||
$this->rcode = ord($packet->rdata[$offset]) & 0xf;
|
||||
|
||||
$this->qdcount = ord($packet->rdata[++$offset]) << 8 |
|
||||
ord($packet->rdata[++$offset]);
|
||||
$this->ancount = ord($packet->rdata[++$offset]) << 8 |
|
||||
ord($packet->rdata[++$offset]);
|
||||
$this->nscount = ord($packet->rdata[++$offset]) << 8 |
|
||||
ord($packet->rdata[++$offset]);
|
||||
$this->arcount = ord($packet->rdata[++$offset]) << 8 |
|
||||
ord($packet->rdata[++$offset]);
|
||||
|
||||
//
|
||||
// increment the internal offset
|
||||
//
|
||||
$packet->offset += Net_DNS2_Lookups::DNS_HEADER_SIZE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a binary packed DNS Header
|
||||
*
|
||||
* @param Net_DNS2_Packet &$packet Object
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function get(Net_DNS2_Packet &$packet)
|
||||
{
|
||||
$packet->offset += Net_DNS2_Lookups::DNS_HEADER_SIZE;
|
||||
|
||||
return pack('n', $this->id) .
|
||||
chr(
|
||||
($this->qr << 7) | ($this->opcode << 3) |
|
||||
($this->aa << 2) | ($this->tc << 1) | ($this->rd)
|
||||
) .
|
||||
chr(
|
||||
($this->ra << 7) | ($this->ad << 5) | ($this->cd << 4) | $this->rcode
|
||||
) .
|
||||
pack('n4', $this->qdcount, $this->ancount, $this->nscount, $this->arcount);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* c-hanging-comment-ender-p: nil
|
||||
* End:
|
||||
*/
|
||||
?>
|
||||