initial commit
This commit is contained in:
34
app/webroot/blog/wp-content/plugins/akismet/.htaccess
Normal file
34
app/webroot/blog/wp-content/plugins/akismet/.htaccess
Normal file
@@ -0,0 +1,34 @@
|
||||
# Only allow direct access to specific Web-available files.
|
||||
|
||||
# Apache 2.2
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</IfModule>
|
||||
|
||||
# Apache 2.4
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
|
||||
# Akismet CSS and JS
|
||||
<FilesMatch "^(form\.js|akismet\.js|akismet\.css)$">
|
||||
<IfModule !mod_authz_core.c>
|
||||
Allow from all
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all granted
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
|
||||
# Akismet images
|
||||
<FilesMatch "^logo-full-2x\.png$">
|
||||
<IfModule !mod_authz_core.c>
|
||||
Allow from all
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all granted
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
339
app/webroot/blog/wp-content/plugins/akismet/LICENSE.txt
Normal file
339
app/webroot/blog/wp-content/plugins/akismet/LICENSE.txt
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
590
app/webroot/blog/wp-content/plugins/akismet/_inc/akismet.css
Normal file
590
app/webroot/blog/wp-content/plugins/akismet/_inc/akismet.css
Normal file
@@ -0,0 +1,590 @@
|
||||
.wp-admin.jetpack_page_akismet-key-config, .wp-admin.settings_page_akismet-key-config {
|
||||
background-color:#f3f6f8;
|
||||
}
|
||||
|
||||
#submitted-on {
|
||||
position: relative;
|
||||
}
|
||||
#the-comment-list .author .akismet-user-comment-count {
|
||||
display: inline;
|
||||
}
|
||||
#the-comment-list .author a span {
|
||||
text-decoration: none;
|
||||
color: #999;
|
||||
}
|
||||
#the-comment-list .author a span.akismet-span-link {
|
||||
text-decoration: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
#the-comment-list .akismet_remove_url {
|
||||
margin-left: 3px;
|
||||
color: #999;
|
||||
padding: 2px 3px 2px 0;
|
||||
}
|
||||
#the-comment-list .akismet_remove_url:hover {
|
||||
color: #A7301F;
|
||||
font-weight: bold;
|
||||
padding: 2px 2px 2px 0;
|
||||
}
|
||||
#dashboard_recent_comments .akismet-status {
|
||||
display: none;
|
||||
}
|
||||
.akismet-status {
|
||||
float: right;
|
||||
}
|
||||
.akismet-status a {
|
||||
color: #AAA;
|
||||
font-style: italic;
|
||||
}
|
||||
table.comments td.comment p a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
table.comments td.comment p a:after {
|
||||
content: attr(href);
|
||||
color: #aaa;
|
||||
display: inline-block; /* Show the URL without the link's underline extending under it. */
|
||||
padding: 0 1ex; /* Because it's inline block, we can't just use spaces in the content: attribute to separate it from the link text. */
|
||||
}
|
||||
.mshot-arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 10px solid transparent;
|
||||
border-bottom: 10px solid transparent;
|
||||
border-right: 10px solid #5C5C5C;
|
||||
position: absolute;
|
||||
left: -6px;
|
||||
top: 91px;
|
||||
}
|
||||
.mshot-container {
|
||||
background: #5C5C5C;
|
||||
position: absolute;
|
||||
top: -94px;
|
||||
padding: 7px;
|
||||
width: 450px;
|
||||
height: 338px;
|
||||
z-index: 20000;
|
||||
-moz-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
}
|
||||
.akismet-mshot {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
}
|
||||
.akismet-mshot .mshot-image {
|
||||
margin: 0;
|
||||
height: 338px;
|
||||
width: 450px;
|
||||
}
|
||||
.checkforspam {
|
||||
display: inline-block !important;
|
||||
}
|
||||
.checkforspam-progress {
|
||||
padding-left: 1ex;
|
||||
display: none;
|
||||
}
|
||||
.checkforspam.button-disabled .checkforspam-progress {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.checkforspam-spinner {
|
||||
display: inline-block;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.akismet-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.akismet-card .akismet-right {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.akismet-alert-text {
|
||||
color: #dd3d36;
|
||||
font-weight: bold;
|
||||
font-size: 120%;
|
||||
margin-top: .5rem;
|
||||
}
|
||||
.akismet-alert {
|
||||
border: 1px solid #e5e5e5;
|
||||
padding: 0.4em 1em 1.4em 1em;
|
||||
border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.akismet-alert h3.akismet-key-status {
|
||||
color: #fff;
|
||||
margin: 1em 0 0.5em 0;
|
||||
}
|
||||
|
||||
.akismet-alert.akismet-critical {
|
||||
background-color: #993300;
|
||||
}
|
||||
|
||||
.akismet-alert.akismet-active {
|
||||
background-color: #649316;
|
||||
}
|
||||
|
||||
.akismet-alert p.akismet-key-status {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.akismet-alert p.akismet-description {
|
||||
color:#fff;
|
||||
font-size: 14px;
|
||||
margin: 0 0;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.akismet-alert p.akismet-description a,
|
||||
.akismet-alert p.akismet-description a,
|
||||
.akismet-alert p.akismet-description a,
|
||||
.akismet-alert p.akismet-description a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot {
|
||||
margin-top: 1em;
|
||||
padding: 1em;
|
||||
text-align: center;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot h3 {
|
||||
background: #f5f5f5;
|
||||
color: #888;
|
||||
font-size: 11px;
|
||||
margin: 0;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.new-snapspot ul {
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot ul li {
|
||||
color: #999;
|
||||
float: left;
|
||||
font-size: 11px;
|
||||
padding: 0 20px;
|
||||
text-transform: uppercase;
|
||||
width: 33%;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot ul li:first-child,
|
||||
.akismet-new-snapshot ul li:nth-child(2) {
|
||||
border-right:1px dotted #ccc;
|
||||
}
|
||||
|
||||
.akismet-new-snapshot ul li span {
|
||||
color: #52accc;
|
||||
display: block;
|
||||
font-size: 32px;
|
||||
font-weight: lighter;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.akismet-settings th:first-child {
|
||||
vertical-align: top;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.akismet-settings th.akismet-api-key {
|
||||
vertical-align: middle;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.akismet-settings input[type=text] {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.akismet-settings span.akismet-note{
|
||||
float: left;
|
||||
padding-left: 23px;
|
||||
font-size: 75%;
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
/**
|
||||
* For the activation notice on the plugins page.
|
||||
*/
|
||||
.akismet_activate {
|
||||
min-width: 825px;
|
||||
border: 1px solid #4F800D;
|
||||
padding: 5px;
|
||||
margin: 15px 0;
|
||||
background: #83AF24;
|
||||
background-image: -webkit-gradient(linear, 0% 0, 80% 100%, from(#83AF24), to(#4F800D));
|
||||
background-image: -moz-linear-gradient(80% 100% 120deg, #4F800D, #83AF24);
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.akismet_activate .aa_a {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: 10px;
|
||||
font-size: 140px;
|
||||
color: #769F33;
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.akismet_activate .aa_button {
|
||||
font-weight: bold;
|
||||
border: 1px solid #029DD6;
|
||||
border-top: 1px solid #06B9FD;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
padding: 9px 0 8px 0;
|
||||
color: #FFF;
|
||||
background: #029DD6;
|
||||
background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1));
|
||||
background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6);
|
||||
-moz-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet_activate .aa_button:hover {
|
||||
text-decoration: none !important;
|
||||
border: 1px solid #029DD6;
|
||||
border-bottom: 1px solid #00A8EF;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
padding: 9px 0 8px 0;
|
||||
color: #F0F8FB;
|
||||
background: #0079B1;
|
||||
background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#0079B1), to(#0092BF));
|
||||
background-image: -moz-linear-gradient(0% 100% 90deg, #0092BF, #0079B1);
|
||||
-moz-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
}
|
||||
|
||||
.akismet_activate .aa_button_border {
|
||||
border: 1px solid #006699;
|
||||
-moz-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
background: #029DD6;
|
||||
background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1));
|
||||
background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6);
|
||||
}
|
||||
|
||||
.akismet_activate .aa_button_container {
|
||||
display: inline-block;
|
||||
background: #DEF1B8;
|
||||
padding: 5px;
|
||||
-moz-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
width: 266px;
|
||||
}
|
||||
|
||||
.akismet_activate .aa_description {
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
left: 285px;
|
||||
margin-left: 25px;
|
||||
color: #E5F2B1;
|
||||
font-size: 15px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.akismet_activate .aa_description strong {
|
||||
color: #FFF;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.jetpack_page_akismet-key-config #wpcontent, .settings_page_akismet-key-config #wpcontent {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.akismet-masthead {
|
||||
background-color:#fff;
|
||||
text-align:center;
|
||||
box-shadow:0 1px 0 rgba(200,215,225,0.5),0 1px 2px #e9eff3
|
||||
}
|
||||
@media (max-width: 45rem) {
|
||||
.akismet-masthead {
|
||||
padding:0 1.25rem
|
||||
}
|
||||
}
|
||||
|
||||
.akismet-masthead__inside-container {
|
||||
padding:.375rem 0;
|
||||
margin:0 auto;
|
||||
width:100%;
|
||||
max-width:45rem;
|
||||
text-align: left;
|
||||
}
|
||||
.akismet-masthead__logo-container {
|
||||
padding:.3125rem 0 0
|
||||
}
|
||||
.akismet-masthead__logo {
|
||||
width:10.375rem;
|
||||
height:1.8125rem;
|
||||
}
|
||||
.akismet-masthead__logo-link {
|
||||
display:inline-block;
|
||||
outline:none;
|
||||
vertical-align:middle
|
||||
}
|
||||
.akismet-masthead__logo-link:focus {
|
||||
line-height:0;
|
||||
box-shadow:0 0 0 2px #78dcfa
|
||||
}
|
||||
.akismet-masthead__logo-link+code {
|
||||
margin:0 10px;
|
||||
padding:5px 9px;
|
||||
border-radius:2px;
|
||||
background:#e6ecf1;
|
||||
color:#647a88
|
||||
}
|
||||
.akismet-masthead__links {
|
||||
display:-ms-flexbox;
|
||||
display:flex;
|
||||
-ms-flex-flow:row wrap;
|
||||
flex-flow:row wrap;
|
||||
-ms-flex:2 50%;
|
||||
flex:2 50%;
|
||||
-ms-flex-pack:end;
|
||||
justify-content:flex-end;
|
||||
margin:0
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.akismet-masthead__links {
|
||||
padding-right:.625rem
|
||||
}
|
||||
}
|
||||
.akismet-masthead__link-li {
|
||||
margin:0;
|
||||
padding:0
|
||||
}
|
||||
.akismet-masthead__link {
|
||||
font-style:normal;
|
||||
color:#0087be;
|
||||
padding:.625rem;
|
||||
display:inline-block
|
||||
}
|
||||
.akismet-masthead__link:visited {
|
||||
color:#0087be
|
||||
}
|
||||
.akismet-masthead__link:active,.akismet-masthead__link:hover {
|
||||
color:#00aadc
|
||||
}
|
||||
.akismet-masthead__link:hover {
|
||||
text-decoration:underline
|
||||
}
|
||||
.akismet-masthead__link .dashicons {
|
||||
display:none
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.akismet-masthead__link:hover,.akismet-masthead__link:active {
|
||||
text-decoration:none
|
||||
}
|
||||
.akismet-masthead__link .dashicons {
|
||||
display:block;
|
||||
font-size:1.75rem
|
||||
}
|
||||
.akismet-masthead__link span+span {
|
||||
display:none
|
||||
}
|
||||
}
|
||||
.akismet-masthead__link-li:last-of-type .akismet-masthead__link {
|
||||
padding-right:0
|
||||
}
|
||||
|
||||
.akismet-lower {
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
max-width: 45rem;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-lower .notice {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.akismet-card {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
margin: 0 auto 0.625rem auto;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
|
||||
}
|
||||
|
||||
.akismet-card:after, .akismet-card .inside:after, .akismet-masthead__logo-container:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.akismet-card .inside {
|
||||
padding: 1.5rem;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.akismet-card .akismet-card-actions {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.jetpack_page_akismet-key-config .update-nag, .settings_page_akismet-key-config .update-nag {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.akismet-masthead .akismet-right {
|
||||
line-height: 2.125rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.akismet-box {
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
border: 1px solid rgba(200, 215, 225, 0.5);
|
||||
}
|
||||
|
||||
.akismet-box h2, .akismet-box h3 {
|
||||
padding: 1.5rem 1.5rem .5rem 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-box p {
|
||||
padding: 0 1.5rem 1.5rem 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.akismet-jetpack-email {
|
||||
font-style: oblique;
|
||||
}
|
||||
|
||||
.akismet-jetpack-gravatar {
|
||||
padding: 0 0 0 1.5rem;
|
||||
float: left;
|
||||
margin-right: 1rem;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
}
|
||||
|
||||
.akismet-box p:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.akismet-box .akismet-right {
|
||||
padding-right: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box {
|
||||
margin-bottom: 0;
|
||||
padding: 0;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box:last-child {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-boxes .akismet-box:first-child {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.akismet-button, .akismet-button:hover, .akismet-button:visited {
|
||||
background: white;
|
||||
border-color: #c8d7e1;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 2px;
|
||||
color: #2e4453;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
outline: 0;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-overflow: ellipsis;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
line-height: 21px;
|
||||
border-radius: 4px;
|
||||
padding: 7px 14px 9px;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.akismet-button:hover {
|
||||
border-color: #a8bece;
|
||||
}
|
||||
|
||||
.akismet-button:active {
|
||||
border-width: 2px 1px 1px;
|
||||
}
|
||||
|
||||
.akismet-is-primary, .akismet-is-primary:hover, .akismet-is-primary:visited {
|
||||
background: #00aadc;
|
||||
border-color: #0087be;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.akismet-is-primary:hover, .akismet-is-primary:focus {
|
||||
border-color: #005082;
|
||||
}
|
||||
|
||||
.akismet-is-primary:hover {
|
||||
border-color: #005082;
|
||||
}
|
||||
|
||||
.akismet-section-header {
|
||||
position: relative;
|
||||
margin: 0 auto 0.625rem auto;
|
||||
padding: 1rem;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
padding-top: 0.6875rem;
|
||||
padding-bottom: 0.6875rem;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.akismet-section-header__label {
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-ms-flex-positive: 1;
|
||||
flex-grow: 1;
|
||||
line-height: 1.75rem;
|
||||
position: relative;
|
||||
font-size: 0.875rem;
|
||||
color: #4f748e;
|
||||
}
|
||||
|
||||
.akismet-section-header__actions {
|
||||
line-height: 1.75rem;
|
||||
}
|
||||
285
app/webroot/blog/wp-content/plugins/akismet/_inc/akismet.js
Normal file
285
app/webroot/blog/wp-content/plugins/akismet/_inc/akismet.js
Normal file
@@ -0,0 +1,285 @@
|
||||
jQuery( function ( $ ) {
|
||||
var mshotRemovalTimer = null;
|
||||
var mshotSecondTryTimer = null
|
||||
var mshotThirdTryTimer = null
|
||||
|
||||
var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a';
|
||||
|
||||
$('.akismet-status').each(function () {
|
||||
var thisId = $(this).attr('commentid');
|
||||
$(this).prependTo('#comment-' + thisId + ' .column-comment');
|
||||
});
|
||||
$('.akismet-user-comment-count').each(function () {
|
||||
var thisId = $(this).attr('commentid');
|
||||
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
|
||||
});
|
||||
|
||||
akismet_enable_comment_author_url_removal();
|
||||
|
||||
$( '#the-comment-list' ).on( 'click', '.akismet_remove_url', function () {
|
||||
var thisId = $(this).attr('commentid');
|
||||
var data = {
|
||||
action: 'comment_author_deurl',
|
||||
_wpnonce: WPAkismet.comment_author_url_nonce,
|
||||
id: thisId
|
||||
};
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
beforeSend: function () {
|
||||
// Removes "x" link
|
||||
$("a[commentid='"+ thisId +"']").hide();
|
||||
// Show temp status
|
||||
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) );
|
||||
},
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
// Show status/undo link
|
||||
$("#author_comment_url_"+ thisId)
|
||||
.attr('cid', thisId)
|
||||
.addClass('akismet_undo_link_removal')
|
||||
.html(
|
||||
$( '<span/>' ).text( WPAkismet.strings['URL removed'] )
|
||||
)
|
||||
.append( ' ' )
|
||||
.append(
|
||||
$( '<span/>' )
|
||||
.text( WPAkismet.strings['(undo)'] )
|
||||
.addClass( 'akismet-span-link' )
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}).on( 'click', '.akismet_undo_link_removal', function () {
|
||||
var thisId = $(this).attr('cid');
|
||||
var thisUrl = $(this).attr('href');
|
||||
var data = {
|
||||
action: 'comment_author_reurl',
|
||||
_wpnonce: WPAkismet.comment_author_url_nonce,
|
||||
id: thisId,
|
||||
url: thisUrl
|
||||
};
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
beforeSend: function () {
|
||||
// Show temp status
|
||||
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) );
|
||||
},
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
// Add "x" link
|
||||
$("a[commentid='"+ thisId +"']").show();
|
||||
// Show link. Core strips leading http://, so let's do that too.
|
||||
$("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments.
|
||||
$( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () {
|
||||
clearTimeout( mshotRemovalTimer );
|
||||
|
||||
if ( $( '.akismet-mshot' ).length > 0 ) {
|
||||
if ( $( '.akismet-mshot:first' ).data( 'link' ) == this ) {
|
||||
// The preview is already showing for this link.
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// A new link is being hovered, so remove the old preview.
|
||||
$( '.akismet-mshot' ).remove();
|
||||
}
|
||||
}
|
||||
|
||||
clearTimeout( mshotSecondTryTimer );
|
||||
clearTimeout( mshotThirdTryTimer );
|
||||
|
||||
var thisHref = $( this ).attr( 'href' );
|
||||
|
||||
var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="' + akismet_mshot_url( thisHref ) + '" width="450" height="338" class="mshot-image" /></div>' );
|
||||
mShot.data( 'link', this );
|
||||
|
||||
var offset = $( this ).offset();
|
||||
|
||||
mShot.offset( {
|
||||
left : Math.min( $( window ).width() - 475, offset.left + $( this ).width() + 10 ), // Keep it on the screen if the link is near the edge of the window.
|
||||
top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness
|
||||
} );
|
||||
|
||||
// These retries appear to be superfluous if .mshot-image has already loaded, but it's because mShots
|
||||
// can return a "Generating thumbnail..." image if it doesn't have a thumbnail ready, so we need
|
||||
// to retry to see if we can get the newly generated thumbnail.
|
||||
mshotSecondTryTimer = setTimeout( function () {
|
||||
mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 2 ) );
|
||||
}, 6000 );
|
||||
|
||||
mshotThirdTryTimer = setTimeout( function () {
|
||||
mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 3 ) );
|
||||
}, 12000 );
|
||||
|
||||
$( 'body' ).append( mShot );
|
||||
} ).on( 'mouseout', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () {
|
||||
mshotRemovalTimer = setTimeout( function () {
|
||||
clearTimeout( mshotSecondTryTimer );
|
||||
clearTimeout( mshotThirdTryTimer );
|
||||
|
||||
$( '.akismet-mshot' ).remove();
|
||||
}, 200 );
|
||||
} ).on( 'mouseover', 'tr', function () {
|
||||
// When the mouse hovers over a comment row, begin preloading mshots for any links in the comment or the comment author.
|
||||
var linksToPreloadMshotsFor = $( this ).find( mshotEnabledLinkSelector );
|
||||
|
||||
linksToPreloadMshotsFor.each( function () {
|
||||
// Don't attempt to preload an mshot for a single link twice. Browser caching should cover this, but in case of
|
||||
// race conditions, save a flag locally when we've begun trying to preload one.
|
||||
if ( ! $( this ).data( 'akismet-mshot-preloaded' ) ) {
|
||||
akismet_preload_mshot( $( this ).attr( 'href' ) );
|
||||
$( this ).data( 'akismet-mshot-preloaded', true );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
$('.checkforspam:not(.button-disabled)').click( function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('.checkforspam:not(.button-disabled)').addClass('button-disabled');
|
||||
$('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
|
||||
|
||||
// Update the label on the "Check for Spam" button to use the active "Checking for Spam" language.
|
||||
$( '.checkforspam .akismet-label' ).text( $( '.checkforspam' ).data( 'active-label' ) );
|
||||
|
||||
akismet_check_for_spam(0, 100);
|
||||
});
|
||||
|
||||
var spam_count = 0;
|
||||
var recheck_count = 0;
|
||||
|
||||
function akismet_check_for_spam(offset, limit) {
|
||||
var check_for_spam_buttons = $( '.checkforspam' );
|
||||
|
||||
// We show the percentage complete down to one decimal point so even queues with 100k
|
||||
// pending comments will show some progress pretty quickly.
|
||||
var percentage_complete = Math.round( ( recheck_count / check_for_spam_buttons.data( 'pending-comment-count' ) ) * 1000 ) / 10;
|
||||
|
||||
// Update the progress counter on the "Check for Spam" button.
|
||||
$( '.checkforspam-progress' ).text( check_for_spam_buttons.data( 'progress-label-format' ).replace( '%1$s', percentage_complete ) );
|
||||
|
||||
$.post(
|
||||
ajaxurl,
|
||||
{
|
||||
'action': 'akismet_recheck_queue',
|
||||
'offset': offset,
|
||||
'limit': limit
|
||||
},
|
||||
function(result) {
|
||||
recheck_count += result.counts.processed;
|
||||
spam_count += result.counts.spam;
|
||||
|
||||
if (result.counts.processed < limit) {
|
||||
window.location.href = check_for_spam_buttons.data( 'success-url' ).replace( '__recheck_count__', recheck_count ).replace( '__spam_count__', spam_count );
|
||||
}
|
||||
else {
|
||||
// Account for comments that were caught as spam and moved out of the queue.
|
||||
akismet_check_for_spam(offset + limit - result.counts.spam, limit);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if ( "start_recheck" in WPAkismet && WPAkismet.start_recheck ) {
|
||||
$( '.checkforspam' ).click();
|
||||
}
|
||||
|
||||
if ( typeof MutationObserver !== 'undefined' ) {
|
||||
// Dynamically add the "X" next the the author URL links when a comment is quick-edited.
|
||||
var comment_list_container = document.getElementById( 'the-comment-list' );
|
||||
|
||||
if ( comment_list_container ) {
|
||||
var observer = new MutationObserver( function ( mutations ) {
|
||||
for ( var i = 0, _len = mutations.length; i < _len; i++ ) {
|
||||
if ( mutations[i].addedNodes.length > 0 ) {
|
||||
akismet_enable_comment_author_url_removal();
|
||||
|
||||
// Once we know that we'll have to check for new author links, skip the rest of the mutations.
|
||||
break;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
observer.observe( comment_list_container, { attributes: true, childList: true, characterData: true } );
|
||||
}
|
||||
}
|
||||
|
||||
function akismet_enable_comment_author_url_removal() {
|
||||
$( '#the-comment-list' )
|
||||
.find( 'tr.comment, tr[id ^= "comment-"]' )
|
||||
.find( '.column-author a[href^="http"]:first' ) // Ignore mailto: links, which would be the comment author's email.
|
||||
.each(function () {
|
||||
if ( $( this ).parent().find( '.akismet_remove_url' ).length > 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var linkHref = $(this).attr( 'href' );
|
||||
|
||||
// Ignore any links to the current domain, which are diagnostic tools, like the IP address link
|
||||
// or any other links another plugin might add.
|
||||
var currentHostParts = document.location.href.split( '/' );
|
||||
var currentHost = currentHostParts[0] + '//' + currentHostParts[2] + '/';
|
||||
|
||||
if ( linkHref.indexOf( currentHost ) != 0 ) {
|
||||
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
|
||||
|
||||
$(this)
|
||||
.attr("id", "author_comment_url_"+ thisCommentId[1])
|
||||
.after(
|
||||
$( '<a href="#" class="akismet_remove_url">x</a>' )
|
||||
.attr( 'commentid', thisCommentId[1] )
|
||||
.attr( 'title', WPAkismet.strings['Remove this URL'] )
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an mShot URL if given a link URL.
|
||||
*
|
||||
* @param string linkUrl
|
||||
* @param int retry If retrying a request, the number of the retry.
|
||||
* @return string The mShot URL;
|
||||
*/
|
||||
function akismet_mshot_url( linkUrl, retry ) {
|
||||
var mshotUrl = '//s0.wordpress.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900';
|
||||
|
||||
if ( retry ) {
|
||||
mshotUrl += '&r=' + encodeURIComponent( retry );
|
||||
}
|
||||
|
||||
return mshotUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin loading an mShot preview of a link.
|
||||
*
|
||||
* @param string linkUrl
|
||||
*/
|
||||
function akismet_preload_mshot( linkUrl ) {
|
||||
var img = new Image();
|
||||
img.src = akismet_mshot_url( linkUrl );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the comment form privacy notice display to hide when one clicks Core's dismiss button on the related admin notice.
|
||||
*/
|
||||
$( '#akismet-privacy-notice-admin-notice' ).on( 'click', '.notice-dismiss', function(){
|
||||
$.ajax({
|
||||
url: './options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide',
|
||||
});
|
||||
});
|
||||
});
|
||||
30
app/webroot/blog/wp-content/plugins/akismet/_inc/form.js
Normal file
30
app/webroot/blog/wp-content/plugins/akismet/_inc/form.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var ak_js = document.getElementById( "ak_js" );
|
||||
|
||||
if ( ! ak_js ) {
|
||||
ak_js = document.createElement( 'input' );
|
||||
ak_js.setAttribute( 'id', 'ak_js' );
|
||||
ak_js.setAttribute( 'name', 'ak_js' );
|
||||
ak_js.setAttribute( 'type', 'hidden' );
|
||||
}
|
||||
else {
|
||||
ak_js.parentNode.removeChild( ak_js );
|
||||
}
|
||||
|
||||
ak_js.setAttribute( 'value', ( new Date() ).getTime() );
|
||||
|
||||
var commentForm = document.getElementById( 'commentform' );
|
||||
|
||||
if ( commentForm ) {
|
||||
commentForm.appendChild( ak_js );
|
||||
}
|
||||
else {
|
||||
var replyRowContainer = document.getElementById( 'replyrow' );
|
||||
|
||||
if ( replyRowContainer ) {
|
||||
var children = replyRowContainer.getElementsByTagName( 'td' );
|
||||
|
||||
if ( children.length > 0 ) {
|
||||
children[0].appendChild( ak_js );
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
66
app/webroot/blog/wp-content/plugins/akismet/akismet.php
Normal file
66
app/webroot/blog/wp-content/plugins/akismet/akismet.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Akismet
|
||||
*/
|
||||
/*
|
||||
Plugin Name: Akismet Anti-Spam
|
||||
Plugin URI: https://akismet.com/
|
||||
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
|
||||
Version: 4.0.8
|
||||
Author: Automattic
|
||||
Author URI: https://automattic.com/wordpress-plugins/
|
||||
License: GPLv2 or later
|
||||
Text Domain: akismet
|
||||
*/
|
||||
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Copyright 2005-2015 Automattic, Inc.
|
||||
*/
|
||||
|
||||
// Make sure we don't expose any info if called directly
|
||||
if ( !function_exists( 'add_action' ) ) {
|
||||
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'AKISMET_VERSION', '4.0.8' );
|
||||
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
|
||||
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'AKISMET_DELETE_LIMIT', 100000 );
|
||||
|
||||
register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) );
|
||||
register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) );
|
||||
|
||||
require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' );
|
||||
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' );
|
||||
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-rest-api.php' );
|
||||
|
||||
add_action( 'init', array( 'Akismet', 'init' ) );
|
||||
|
||||
add_action( 'rest_api_init', array( 'Akismet_REST_API', 'init' ) );
|
||||
|
||||
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
||||
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' );
|
||||
add_action( 'init', array( 'Akismet_Admin', 'init' ) );
|
||||
}
|
||||
|
||||
//add wrapper class around deprecated akismet functions that are referenced elsewhere
|
||||
require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' );
|
||||
|
||||
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
||||
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-cli.php' );
|
||||
}
|
||||
1183
app/webroot/blog/wp-content/plugins/akismet/class.akismet-admin.php
Normal file
1183
app/webroot/blog/wp-content/plugins/akismet/class.akismet-admin.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
WP_CLI::add_command( 'akismet', 'Akismet_CLI' );
|
||||
|
||||
/**
|
||||
* Filter spam comments.
|
||||
*/
|
||||
class Akismet_CLI extends WP_CLI_Command {
|
||||
/**
|
||||
* Checks one or more comments against the Akismet API.
|
||||
*
|
||||
* ## OPTIONS
|
||||
* <comment_id>...
|
||||
* : The ID(s) of the comment(s) to check.
|
||||
*
|
||||
* [--noaction]
|
||||
* : Don't change the status of the comment. Just report what Akismet thinks it is.
|
||||
*
|
||||
* ## EXAMPLES
|
||||
*
|
||||
* wp akismet check 12345
|
||||
*
|
||||
* @alias comment-check
|
||||
*/
|
||||
public function check( $args, $assoc_args ) {
|
||||
foreach ( $args as $comment_id ) {
|
||||
if ( isset( $assoc_args['noaction'] ) ) {
|
||||
// Check the comment, but don't reclassify it.
|
||||
$api_response = Akismet::check_db_comment( $comment_id, 'wp-cli' );
|
||||
}
|
||||
else {
|
||||
$api_response = Akismet::recheck_comment( $comment_id, 'wp-cli' );
|
||||
}
|
||||
|
||||
if ( 'true' === $api_response ) {
|
||||
WP_CLI::line( sprintf( __( "Comment #%d is spam.", 'akismet' ), $comment_id ) );
|
||||
}
|
||||
else if ( 'false' === $api_response ) {
|
||||
WP_CLI::line( sprintf( __( "Comment #%d is not spam.", 'akismet' ), $comment_id ) );
|
||||
}
|
||||
else {
|
||||
if ( false === $api_response ) {
|
||||
WP_CLI::error( __( "Failed to connect to Akismet.", 'akismet' ) );
|
||||
}
|
||||
else if ( is_wp_error( $api_response ) ) {
|
||||
WP_CLI::warning( sprintf( __( "Comment #%d could not be checked.", 'akismet' ), $comment_id ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recheck all comments in the Pending queue.
|
||||
*
|
||||
* ## EXAMPLES
|
||||
*
|
||||
* wp akismet recheck_queue
|
||||
*
|
||||
* @alias recheck-queue
|
||||
*/
|
||||
public function recheck_queue() {
|
||||
$batch_size = 100;
|
||||
$start = 0;
|
||||
|
||||
$total_counts = array();
|
||||
|
||||
do {
|
||||
$result_counts = Akismet_Admin::recheck_queue_portion( $start, $batch_size );
|
||||
|
||||
if ( $result_counts['processed'] > 0 ) {
|
||||
foreach ( $result_counts as $key => $count ) {
|
||||
if ( ! isset( $total_counts[ $key ] ) ) {
|
||||
$total_counts[ $key ] = $count;
|
||||
}
|
||||
else {
|
||||
$total_counts[ $key ] += $count;
|
||||
}
|
||||
}
|
||||
$start += $batch_size;
|
||||
$start -= $result_counts['spam']; // These comments will have been removed from the queue.
|
||||
}
|
||||
} while ( $result_counts['processed'] > 0 );
|
||||
|
||||
WP_CLI::line( sprintf( _n( "Processed %d comment.", "Processed %d comments.", $total_counts['processed'], 'akismet' ), number_format( $total_counts['processed'] ) ) );
|
||||
WP_CLI::line( sprintf( _n( "%d comment moved to Spam.", "%d comments moved to Spam.", $total_counts['spam'], 'akismet' ), number_format( $total_counts['spam'] ) ) );
|
||||
|
||||
if ( $total_counts['error'] ) {
|
||||
WP_CLI::line( sprintf( _n( "%d comment could not be checked.", "%d comments could not be checked.", $total_counts['error'], 'akismet' ), number_format( $total_counts['error'] ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
class Akismet_REST_API {
|
||||
/**
|
||||
* Register the REST API routes.
|
||||
*/
|
||||
public static function init() {
|
||||
if ( ! function_exists( 'register_rest_route' ) ) {
|
||||
// The REST API wasn't integrated into core until 4.4, and we support 4.0+ (for now).
|
||||
return false;
|
||||
}
|
||||
|
||||
register_rest_route( 'akismet/v1', '/key', array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_key' ),
|
||||
), array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'set_key' ),
|
||||
'args' => array(
|
||||
'key' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
|
||||
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ),
|
||||
),
|
||||
),
|
||||
), array(
|
||||
'methods' => WP_REST_Server::DELETABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'delete_key' ),
|
||||
)
|
||||
) );
|
||||
|
||||
register_rest_route( 'akismet/v1', '/settings/', array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_settings' ),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'set_boolean_settings' ),
|
||||
'args' => array(
|
||||
'akismet_strictness' => array(
|
||||
'required' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'If true, Akismet will automatically discard the worst spam automatically rather than putting it in the spam folder.', 'akismet' ),
|
||||
),
|
||||
'akismet_show_user_comments_approved' => array(
|
||||
'required' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'If true, show the number of approved comments beside each comment author in the comments list page.', 'akismet' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
register_rest_route( 'akismet/v1', '/stats', array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
|
||||
'args' => array(
|
||||
'interval' => array(
|
||||
'required' => false,
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_interval' ),
|
||||
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
|
||||
'default' => 'all',
|
||||
),
|
||||
),
|
||||
) );
|
||||
|
||||
register_rest_route( 'akismet/v1', '/stats/(?P<interval>[\w+])', array(
|
||||
'args' => array(
|
||||
'interval' => array(
|
||||
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
|
||||
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
|
||||
)
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current Akismet API key.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function get_key( $request = null ) {
|
||||
return rest_ensure_response( Akismet::get_api_key() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API key, if possible.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function set_key( $request ) {
|
||||
if ( defined( 'WPCOM_API_KEY' ) ) {
|
||||
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be changed via the API.', 'akismet' ), array( 'status'=> 409 ) ) );
|
||||
}
|
||||
|
||||
$new_api_key = $request->get_param( 'key' );
|
||||
|
||||
if ( ! self::key_is_valid( $new_api_key ) ) {
|
||||
return rest_ensure_response( new WP_Error( 'invalid_key', __( 'The value provided is not a valid and registered API key.', 'akismet' ), array( 'status' => 400 ) ) );
|
||||
}
|
||||
|
||||
update_option( 'wordpress_api_key', $new_api_key );
|
||||
|
||||
return self::get_key();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the API key, if possible.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function delete_key( $request ) {
|
||||
if ( defined( 'WPCOM_API_KEY' ) ) {
|
||||
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be deleted.', 'akismet' ), array( 'status'=> 409 ) ) );
|
||||
}
|
||||
|
||||
delete_option( 'wordpress_api_key' );
|
||||
|
||||
return rest_ensure_response( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Akismet settings.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function get_settings( $request = null ) {
|
||||
return rest_ensure_response( array(
|
||||
'akismet_strictness' => ( get_option( 'akismet_strictness', '1' ) === '1' ),
|
||||
'akismet_show_user_comments_approved' => ( get_option( 'akismet_show_user_comments_approved', '1' ) === '1' ),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Akismet settings.
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function set_boolean_settings( $request ) {
|
||||
foreach ( array(
|
||||
'akismet_strictness',
|
||||
'akismet_show_user_comments_approved',
|
||||
) as $setting_key ) {
|
||||
|
||||
$setting_value = $request->get_param( $setting_key );
|
||||
if ( is_null( $setting_value ) ) {
|
||||
// This setting was not specified.
|
||||
continue;
|
||||
}
|
||||
|
||||
// From 4.7+, WP core will ensure that these are always boolean
|
||||
// values because they are registered with 'type' => 'boolean',
|
||||
// but we need to do this ourselves for prior versions.
|
||||
$setting_value = Akismet_REST_API::parse_boolean( $setting_value );
|
||||
|
||||
update_option( $setting_key, $setting_value ? '1' : '0' );
|
||||
}
|
||||
|
||||
return self::get_settings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a numeric or string boolean value into a boolean.
|
||||
*
|
||||
* @param mixed $value The value to convert into a boolean.
|
||||
* @return bool The converted value.
|
||||
*/
|
||||
public static function parse_boolean( $value ) {
|
||||
switch ( $value ) {
|
||||
case true:
|
||||
case 'true':
|
||||
case '1':
|
||||
case 1:
|
||||
return true;
|
||||
|
||||
case false:
|
||||
case 'false':
|
||||
case '0':
|
||||
case 0:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return (bool) $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Akismet stats for a given time period.
|
||||
*
|
||||
* Possible `interval` values:
|
||||
* - all
|
||||
* - 60-days
|
||||
* - 6-months
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_Error|WP_REST_Response
|
||||
*/
|
||||
public static function get_stats( $request ) {
|
||||
$api_key = Akismet::get_api_key();
|
||||
|
||||
$interval = $request->get_param( 'interval' );
|
||||
|
||||
$stat_totals = array();
|
||||
|
||||
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
|
||||
|
||||
if ( ! empty( $response[1] ) ) {
|
||||
$stat_totals[$interval] = json_decode( $response[1] );
|
||||
}
|
||||
|
||||
return rest_ensure_response( $stat_totals );
|
||||
}
|
||||
|
||||
private static function key_is_valid( $key ) {
|
||||
$response = Akismet::http_post(
|
||||
Akismet::build_query(
|
||||
array(
|
||||
'key' => $key,
|
||||
'blog' => get_option( 'home' )
|
||||
)
|
||||
),
|
||||
'verify-key'
|
||||
);
|
||||
|
||||
if ( $response[1] == 'valid' ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function privileged_permission_callback() {
|
||||
return current_user_can( 'manage_options' );
|
||||
}
|
||||
|
||||
public static function sanitize_interval( $interval, $request, $param ) {
|
||||
$interval = trim( $interval );
|
||||
|
||||
$valid_intervals = array( '60-days', '6-months', 'all', );
|
||||
|
||||
if ( ! in_array( $interval, $valid_intervals ) ) {
|
||||
$interval = 'all';
|
||||
}
|
||||
|
||||
return $interval;
|
||||
}
|
||||
|
||||
public static function sanitize_key( $key, $request, $param ) {
|
||||
return trim( $key );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Akismet
|
||||
*/
|
||||
class Akismet_Widget extends WP_Widget {
|
||||
|
||||
function __construct() {
|
||||
load_plugin_textdomain( 'akismet' );
|
||||
|
||||
parent::__construct(
|
||||
'akismet_widget',
|
||||
__( 'Akismet Widget' , 'akismet'),
|
||||
array( 'description' => __( 'Display the number of spam comments Akismet has caught' , 'akismet') )
|
||||
);
|
||||
|
||||
if ( is_active_widget( false, false, $this->id_base ) ) {
|
||||
add_action( 'wp_head', array( $this, 'css' ) );
|
||||
}
|
||||
}
|
||||
|
||||
function css() {
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
.a-stats {
|
||||
width: auto;
|
||||
}
|
||||
.a-stats a {
|
||||
background: #7CA821;
|
||||
background-image:-moz-linear-gradient(0% 100% 90deg,#5F8E14,#7CA821);
|
||||
background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#7CA821),to(#5F8E14));
|
||||
border: 1px solid #5F8E14;
|
||||
border-radius:3px;
|
||||
color: #CFEA93;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
height: 100%;
|
||||
-moz-border-radius:3px;
|
||||
padding: 7px 0 8px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
-webkit-border-radius:3px;
|
||||
width: 100%;
|
||||
}
|
||||
.a-stats a:hover {
|
||||
text-decoration: none;
|
||||
background-image:-moz-linear-gradient(0% 100% 90deg,#6F9C1B,#659417);
|
||||
background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#659417),to(#6F9C1B));
|
||||
}
|
||||
.a-stats .count {
|
||||
color: #FFF;
|
||||
display: block;
|
||||
font-size: 15px;
|
||||
line-height: 16px;
|
||||
padding: 0 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
if ( $instance && isset( $instance['title'] ) ) {
|
||||
$title = $instance['title'];
|
||||
}
|
||||
else {
|
||||
$title = __( 'Spam Blocked' , 'akismet' );
|
||||
}
|
||||
?>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:' , 'akismet'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
$instance['title'] = strip_tags( $new_instance['title'] );
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
$count = get_option( 'akismet_spam_count' );
|
||||
|
||||
if ( ! isset( $instance['title'] ) ) {
|
||||
$instance['title'] = __( 'Spam Blocked' , 'akismet' );
|
||||
}
|
||||
|
||||
echo $args['before_widget'];
|
||||
if ( ! empty( $instance['title'] ) ) {
|
||||
echo $args['before_title'];
|
||||
echo esc_html( $instance['title'] );
|
||||
echo $args['after_title'];
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="a-stats">
|
||||
<a href="https://akismet.com" target="_blank" title=""><?php printf( _n( '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', $count , 'akismet'), number_format_i18n( $count ) ); ?></a>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
echo $args['after_widget'];
|
||||
}
|
||||
}
|
||||
|
||||
function akismet_register_widgets() {
|
||||
register_widget( 'Akismet_Widget' );
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'akismet_register_widgets' );
|
||||
1424
app/webroot/blog/wp-content/plugins/akismet/class.akismet.php
Normal file
1424
app/webroot/blog/wp-content/plugins/akismet/class.akismet.php
Normal file
File diff suppressed because it is too large
Load Diff
2
app/webroot/blog/wp-content/plugins/akismet/index.php
Normal file
2
app/webroot/blog/wp-content/plugins/akismet/index.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
# Silence is golden.
|
||||
443
app/webroot/blog/wp-content/plugins/akismet/readme.txt
Normal file
443
app/webroot/blog/wp-content/plugins/akismet/readme.txt
Normal file
@@ -0,0 +1,443 @@
|
||||
=== Akismet Anti-Spam ===
|
||||
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
|
||||
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
|
||||
Requires at least: 4.0
|
||||
Tested up to: 4.9.6
|
||||
Stable tag: 4.0.8
|
||||
License: GPLv2 or later
|
||||
|
||||
Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
|
||||
|
||||
== Description ==
|
||||
|
||||
Akismet checks your comments and contact form submissions against our global database of spam to prevent your site from publishing malicious content. You can review the comment spam it catches on your blog's "Comments" admin screen.
|
||||
|
||||
Major features in Akismet include:
|
||||
|
||||
* Automatically checks all comments and filters out the ones that look like spam.
|
||||
* Each comment has a status history, so you can easily see which comments were caught or cleared by Akismet and which were spammed or unspammed by a moderator.
|
||||
* URLs are shown in the comment body to reveal hidden or misleading links.
|
||||
* Moderators can see the number of approved comments for each user.
|
||||
* A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site.
|
||||
|
||||
PS: You'll need an [Akismet.com API key](https://akismet.com/get/) to use it. Keys are free for personal blogs; paid subscriptions are available for businesses and commercial sites.
|
||||
|
||||
== Installation ==
|
||||
|
||||
Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.com API key](https://akismet.com/get/).
|
||||
|
||||
1, 2, 3: You're done!
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 4.0.8 =
|
||||
*Release Date - 19 June 2018*
|
||||
|
||||
* Improved the grammar and consistency of the in-admin privacy related notes (notice and config).
|
||||
* Revised in-admin explanation of the comment form privacy notice to make its usage clearer.
|
||||
* Added `rel="nofollow noopener"` to the comment form privacy notice to improve SEO and security.
|
||||
|
||||
= 4.0.7 =
|
||||
*Release Date - 28 May 2018*
|
||||
|
||||
* Based on user feedback, the link on "Learn how your comment data is processed." in the optional privacy notice now has a `target` of `_blank` and opens in a new tab/window.
|
||||
* Updated the in-admin privacy notice to use the term "comment" instead of "contact" in "Akismet can display a notice to your users under your comment forms."
|
||||
* Only show in-admin privacy notice if Akismet has an API Key configured
|
||||
|
||||
= 4.0.6 =
|
||||
*Release Date - 26 May 2018*
|
||||
|
||||
* Moved away from using `empty( get_option() )` to instantiating a variable to be compatible with older versions of PHP (5.3, 5.4, etc).
|
||||
|
||||
= 4.0.5 =
|
||||
*Release Date - 26 May 2018*
|
||||
|
||||
* Corrected version number after tagging. Sorry...
|
||||
|
||||
= 4.0.4 =
|
||||
*Release Date - 26 May 2018*
|
||||
|
||||
* Added a hook to provide Akismet-specific privacy information for a site's privacy policy.
|
||||
* Added tools to control the display of a privacy related notice under comment forms.
|
||||
* Fixed HTML in activation failure message to close META and HEAD tag properly.
|
||||
* Fixed a bug that would sometimes prevent Akismet from being correctly auto-configured.
|
||||
|
||||
= 4.0.3 =
|
||||
*Release Date - 19 February 2018*
|
||||
|
||||
* Added a scheduled task to remove entries in wp_commentmeta that no longer have corresponding comments in wp_comments.
|
||||
* Added a new `akismet_batch_delete_count` action to the batch delete methods for people who'd like to keep track of the numbers of records being processed by those methods.
|
||||
|
||||
= 4.0.2 =
|
||||
*Release Date - 18 December 2017*
|
||||
|
||||
* Fixed a bug that could cause Akismet to recheck a comment that has already been manually approved or marked as spam.
|
||||
* Fixed a bug that could cause Akismet to claim that some comments are still waiting to be checked when no comments are waiting to be checked.
|
||||
|
||||
= 4.0.1 =
|
||||
*Release Date - 6 November 2017*
|
||||
|
||||
* Fixed a bug that could prevent some users from connecting Akismet via their Jetpack connection.
|
||||
* Ensured that any pending Akismet-related events are unscheduled if the plugin is deactivated.
|
||||
* Allow some JavaScript to be run asynchronously to avoid affecting page render speeds.
|
||||
|
||||
= 4.0 =
|
||||
*Release Date - 19 September 2017*
|
||||
|
||||
* Added REST API endpoints for configuring Akismet and retrieving stats.
|
||||
* Increased the minimum supported WordPress version to 4.0.
|
||||
* Added compatibility with comments submitted via the REST API.
|
||||
* Improved the progress indicator on the "Check for Spam" button.
|
||||
|
||||
= 3.3.4 =
|
||||
*Release Date - 3 August 2017*
|
||||
|
||||
* Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined.
|
||||
* URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin.
|
||||
* When a comment is caught by the Comment Blacklist, Akismet will always allow it to stay in the trash even if it is spam as well.
|
||||
* Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers.
|
||||
|
||||
= 3.3.3 =
|
||||
*Release Date - 13 July 2017*
|
||||
|
||||
* Reduced amount of bandwidth used by the URL Preview feature.
|
||||
* Improved the admin UI when the API key is manually pre-defined for the site.
|
||||
* Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins.
|
||||
* The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently.
|
||||
* Fixed a bug in the Akismet widget that could cause PHP warnings.
|
||||
|
||||
= 3.3.2 =
|
||||
*Release Date - 10 May 2017*
|
||||
|
||||
* Fixed a bug causing JavaScript errors in some browsers.
|
||||
|
||||
= 3.3.1 =
|
||||
*Release Date - 2 May 2017*
|
||||
|
||||
* Improve performance by only requesting the akismet_comment_nonce option when absolutely necessary.
|
||||
* Fixed two bugs that could cause PHP warnings.
|
||||
* Fixed a bug that was preventing the "Remove author URL" feature from working after a comment was edited using "Quick Edit."
|
||||
* Fixed a bug that was preventing the URL preview feature from working after a comment was edited using "Quick Edit."
|
||||
|
||||
= 3.3 =
|
||||
*Release Date - 23 February 2017*
|
||||
|
||||
* Updated the Akismet admin pages with a new clean design.
|
||||
* Fixed bugs preventing the `akismet_add_comment_nonce` and `akismet_update_alert` wrapper functions from working properly.
|
||||
* Fixed bug preventing the loading indicator from appearing when re-checking all comments for spam.
|
||||
* Added a progress indicator to the "Check for Spam" button.
|
||||
* Added a success message after manually rechecking the Pending queue for spam.
|
||||
|
||||
= 3.2 =
|
||||
*Release Date - 6 September 2016*
|
||||
|
||||
* Added a WP-CLI module. You can now check comments and recheck the moderation queue from the command line.
|
||||
* Stopped using the deprecated jQuery function `.live()`.
|
||||
* Fixed a bug in `remove_comment_author_url()` and `add_comment_author_url()` that could generate PHP notices.
|
||||
* Fixed a bug that could cause an infinite loop for sites with very very very large comment IDs.
|
||||
* Fixed a bug that could cause the Akismet widget title to be blank.
|
||||
|
||||
= 3.1.11 =
|
||||
*Release Date - 12 May 2016*
|
||||
|
||||
* Fixed a bug that could cause the "Check for Spam" button to skip some comments.
|
||||
* Fixed a bug that could prevent some spam submissions from being sent to Akismet.
|
||||
* Updated all links to use https:// when possible.
|
||||
* Disabled Akismet debug logging unless WP_DEBUG and WP_DEBUG_LOG are both enabled.
|
||||
|
||||
= 3.1.10 =
|
||||
*Release Date - 1 April 2016*
|
||||
|
||||
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
|
||||
* Fixed a bug that could have resulted in comments that were caught by the core WordPress comment blacklist not to have a corresponding History entry.
|
||||
* Fixed a bug that could have caused avoidable PHP warnings in the error log.
|
||||
|
||||
= 3.1.9 =
|
||||
*Release Date - 28 March 2016*
|
||||
|
||||
* Add compatibility with Jetpack so that Jetpack can automatically configure Akismet settings when appropriate.
|
||||
* Fixed a bug preventing some comment data from being sent to Akismet.
|
||||
|
||||
= 3.1.8 =
|
||||
*Release Date - 4 March 2016*
|
||||
|
||||
* Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs.
|
||||
* Reduced the amount of bandwidth used on Akismet API calls
|
||||
* Reduced the amount of space Akismet uses in the database
|
||||
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
|
||||
|
||||
= 3.1.7 =
|
||||
*Release Date - 4 January 2016*
|
||||
|
||||
* Added documentation for the 'akismet_comment_nonce' filter.
|
||||
* The post-install activation button is now accessible to screen readers and keyboard-only users.
|
||||
* Fixed a bug that was preventing the "Remove author URL" feature from working in WordPress 4.4
|
||||
|
||||
= 3.1.6 =
|
||||
*Release Date - 14 December 2015*
|
||||
|
||||
* Improve the notices shown after activating Akismet.
|
||||
* Update some strings to allow for the proper plural forms in all languages.
|
||||
|
||||
= 3.1.5 =
|
||||
*Release Date - 13 October 2015*
|
||||
|
||||
* Closes a potential XSS vulnerability.
|
||||
|
||||
= 3.1.4 =
|
||||
*Release Date - 24 September 2015*
|
||||
|
||||
* Fixed a bug that was preventing some users from automatically connecting using Jetpack if they didn't have a current Akismet subscription.
|
||||
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
|
||||
* Error messages and instructions have been simplified to be more understandable.
|
||||
* Link previews are enabled for all links inside comments, not just the author's website link.
|
||||
|
||||
= 3.1.3 =
|
||||
*Release Date - 6 July 2015*
|
||||
|
||||
* Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens.
|
||||
|
||||
= 3.1.2 =
|
||||
*Release Date - 7 June 2015*
|
||||
|
||||
* Reduced the amount of space Akismet uses in the commentmeta table.
|
||||
* Fixed a bug where some comments with quotes in the author name weren't getting history entries
|
||||
* Pre-emptive security improvements to ensure that the Akismet plugin can't be used by attackers to compromise a WordPress installation.
|
||||
* Better UI for the key entry field: allow whitespace to be included at the beginning or end of the key and strip it out automatically when the form is submitted.
|
||||
* When deactivating the plugin, notify the Akismet API so the site can be marked as inactive.
|
||||
* Clearer error messages.
|
||||
|
||||
= 3.1.1 =
|
||||
*Release Date - 17th March, 2015*
|
||||
|
||||
* Improvements to the "Remove comment author URL" JavaScript
|
||||
* Include the pingback pre-check from the 2.6 branch.
|
||||
|
||||
= 3.1 =
|
||||
*Release Date - 11th March, 2015*
|
||||
|
||||
* Use HTTPS by default for all requests to Akismet.
|
||||
* Fix for a situation where Akismet might strip HTML from a comment.
|
||||
|
||||
= 3.0.4 =
|
||||
*Release Date - 11th December, 2014*
|
||||
|
||||
* Fix to make .htaccess compatible with Apache 2.4.
|
||||
* Fix to allow removal of https author URLs.
|
||||
* Fix to avoid stripping part of the author URL when removing and re-adding.
|
||||
* Removed the "Check for Spam" button from the "Trash" and "Approved" queues, where it would have no effect.
|
||||
* Allow automatic API key configuration when Jetpack is installed and connected to a WordPress.com account
|
||||
|
||||
= 3.0.3 =
|
||||
*Release Date - 3rd November, 2014*
|
||||
|
||||
* Fix for sending the wrong data to delete_comment action that could have prevented old spam comments from being deleted.
|
||||
* Added a filter to disable logging of Akismet debugging information.
|
||||
* Added a filter for the maximum comment age when deleting old spam comments.
|
||||
* Added a filter for the number per batch when deleting old spam comments.
|
||||
* Removed the "Check for Spam" button from the Spam folder.
|
||||
|
||||
= 3.0.2 =
|
||||
*Release Date - 18th August, 2014*
|
||||
|
||||
* Performance improvements.
|
||||
* Fixed a bug that could truncate the comment data being sent to Akismet for checking.
|
||||
|
||||
= 3.0.1 =
|
||||
*Release Date - 9th July, 2014*
|
||||
|
||||
* Removed dependency on PHP's fsockopen function
|
||||
* Fix spam/ham reports to work when reported outside of the WP dashboard, e.g., from Notifications or the WP app
|
||||
* Remove jQuery dependency for comment form JavaScript
|
||||
* Remove unnecessary data from some Akismet comment meta
|
||||
* Suspended keys will now result in all comments being put in moderation, not spam.
|
||||
|
||||
= 3.0.0 =
|
||||
*Release Date - 15th April, 2014*
|
||||
|
||||
* Move Akismet to Settings menu
|
||||
* Drop Akismet Stats menu
|
||||
* Add stats snapshot to Akismet settings
|
||||
* Add Akismet subscription details and status to Akismet settings
|
||||
* Add contextual help for each page
|
||||
* Improve Akismet setup to use Jetpack to automate plugin setup
|
||||
* Fix "Check for Spam" to use AJAX to avoid page timing out
|
||||
* Fix Akismet settings page to be responsive
|
||||
* Drop legacy code
|
||||
* Tidy up CSS and Javascript
|
||||
* Replace the old discard setting with a new "discard pervasive spam" feature.
|
||||
|
||||
= 2.6.0 =
|
||||
*Release Date - 18th March, 2014*
|
||||
|
||||
* Add ajax paging to the check for spam button to handle large volumes of comments
|
||||
* Optimize javascript and add localization support
|
||||
* Fix bug in link to spam comments from right now dashboard widget
|
||||
* Fix bug with deleting old comments to avoid timeouts dealing with large volumes of comments
|
||||
* Include X-Pingback-Forwarded-For header in outbound WordPress pingback verifications
|
||||
* Add pre-check for pingbacks, to stop spam before an outbound verification request is made
|
||||
|
||||
= 2.5.9 =
|
||||
*Release Date - 1st August, 2013*
|
||||
|
||||
* Update 'Already have a key' link to redirect page rather than depend on javascript
|
||||
* Fix some non-translatable strings to be translatable
|
||||
* Update Activation banner in plugins page to redirect user to Akismet config page
|
||||
|
||||
= 2.5.8 =
|
||||
*Release Date - 20th January, 2013*
|
||||
|
||||
* Simplify the activation process for new users
|
||||
* Remove the reporter_ip parameter
|
||||
* Minor preventative security improvements
|
||||
|
||||
= 2.5.7 =
|
||||
*Release Date - 13th December, 2012*
|
||||
|
||||
* FireFox Stats iframe preview bug
|
||||
* Fix mshots preview when using https
|
||||
* Add .htaccess to block direct access to files
|
||||
* Prevent some PHP notices
|
||||
* Fix Check For Spam return location when referrer is empty
|
||||
* Fix Settings links for network admins
|
||||
* Fix prepare() warnings in WP 3.5
|
||||
|
||||
= 2.5.6 =
|
||||
*Release Date - 26th April, 2012*
|
||||
|
||||
* Prevent retry scheduling problems on sites where wp_cron is misbehaving
|
||||
* Preload mshot previews
|
||||
* Modernize the widget code
|
||||
* Fix a bug where comments were not held for moderation during an error condition
|
||||
* Improve the UX and display when comments are temporarily held due to an error
|
||||
* Make the Check For Spam button force a retry when comments are held due to an error
|
||||
* Handle errors caused by an invalid key
|
||||
* Don't retry comments that are too old
|
||||
* Improve error messages when verifying an API key
|
||||
|
||||
= 2.5.5 =
|
||||
*Release Date - 11th January, 2012*
|
||||
|
||||
* Add nonce check for comment author URL remove action
|
||||
* Fix the settings link
|
||||
|
||||
= 2.5.4 =
|
||||
*Release Date - 5th January, 2012*
|
||||
|
||||
* Limit Akismet CSS and Javascript loading in wp-admin to just the pages that need it
|
||||
* Added author URL quick removal functionality
|
||||
* Added mShot preview on Author URL hover
|
||||
* Added empty index.php to prevent directory listing
|
||||
* Move wp-admin menu items under Jetpack, if it is installed
|
||||
* Purge old Akismet comment meta data, default of 15 days
|
||||
|
||||
= 2.5.3 =
|
||||
*Release Date - 8th Febuary, 2011*
|
||||
|
||||
* Specify the license is GPL v2 or later
|
||||
* Fix a bug that could result in orphaned commentmeta entries
|
||||
* Include hotfix for WordPress 3.0.5 filter issue
|
||||
|
||||
= 2.5.2 =
|
||||
*Release Date - 14th January, 2011*
|
||||
|
||||
* Properly format the comment count for author counts
|
||||
* Look for super admins on multisite installs when looking up user roles
|
||||
* Increase the HTTP request timeout
|
||||
* Removed padding for author approved count
|
||||
* Fix typo in function name
|
||||
* Set Akismet stats iframe height to fixed 2500px. Better to have one tall scroll bar than two side by side.
|
||||
|
||||
= 2.5.1 =
|
||||
*Release Date - 17th December, 2010*
|
||||
|
||||
* Fix a bug that caused the "Auto delete" option to fail to discard comments correctly
|
||||
* Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce
|
||||
* Fixed padding bug in "author" column of posts screen
|
||||
* Added margin-top to "cleared by ..." badges on dashboard
|
||||
* Fix possible error when calling akismet_cron_recheck()
|
||||
* Fix more PHP warnings
|
||||
* Clean up XHTML warnings for comment nonce
|
||||
* Fix for possible condition where scheduled comment re-checks could get stuck
|
||||
* Clean up the comment meta details after deleting a comment
|
||||
* Only show the status badge if the comment status has been changed by someone/something other than Akismet
|
||||
* Show a 'History' link in the row-actions
|
||||
* Translation fixes
|
||||
* Reduced font-size on author name
|
||||
* Moved "flagged by..." notification to top right corner of comment container and removed heavy styling
|
||||
* Hid "flagged by..." notification while on dashboard
|
||||
|
||||
= 2.5.0 =
|
||||
*Release Date - 7th December, 2010*
|
||||
|
||||
* Track comment actions under 'Akismet Status' on the edit comment screen
|
||||
* Fix a few remaining deprecated function calls ( props Mike Glendinning )
|
||||
* Use HTTPS for the stats IFRAME when wp-admin is using HTTPS
|
||||
* Use the WordPress HTTP class if available
|
||||
* Move the admin UI code to a separate file, only loaded when needed
|
||||
* Add cron retry feature, to replace the old connectivity check
|
||||
* Display Akismet status badge beside each comment
|
||||
* Record history for each comment, and display it on the edit page
|
||||
* Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham
|
||||
* Highlight links in comment content
|
||||
* New option, "Show the number of comments you've approved beside each comment author."
|
||||
* New option, "Use a nonce on the comment form."
|
||||
|
||||
= 2.4.0 =
|
||||
*Release Date - 23rd August, 2010*
|
||||
|
||||
* Spell out that the license is GPLv2
|
||||
* Fix PHP warnings
|
||||
* Fix WordPress deprecated function calls
|
||||
* Fire the delete_comment action when deleting comments
|
||||
* Move code specific for older WP versions to legacy.php
|
||||
* General code clean up
|
||||
|
||||
= 2.3.0 =
|
||||
*Release Date - 5th June, 2010*
|
||||
|
||||
* Fix "Are you sure" nonce message on config screen in WPMU
|
||||
* Fix XHTML compliance issue in sidebar widget
|
||||
* Change author link; remove some old references to WordPress.com accounts
|
||||
* Localize the widget title (core ticket #13879)
|
||||
|
||||
= 2.2.9 =
|
||||
*Release Date - 2nd June, 2010*
|
||||
|
||||
* Eliminate a potential conflict with some plugins that may cause spurious reports
|
||||
|
||||
= 2.2.8 =
|
||||
*Release Date - 27th May, 2010*
|
||||
|
||||
* Fix bug in initial comment check for ipv6 addresses
|
||||
* Report comments as ham when they are moved from spam to moderation
|
||||
* Report comments as ham when clicking undo after spam
|
||||
* Use transition_comment_status action when available instead of older actions for spam/ham submissions
|
||||
* Better diagnostic messages when PHP network functions are unavailable
|
||||
* Better handling of comments by logged-in users
|
||||
|
||||
= 2.2.7 =
|
||||
*Release Date - 17th December, 2009*
|
||||
|
||||
* Add a new AKISMET_VERSION constant
|
||||
* Reduce the possibility of over-counting spam when another spam filter plugin is in use
|
||||
* Disable the connectivity check when the API key is hard-coded for WPMU
|
||||
|
||||
= 2.2.6 =
|
||||
*Release Date - 20th July, 2009*
|
||||
|
||||
* Fix a global warning introduced in 2.2.5
|
||||
* Add changelog and additional readme.txt tags
|
||||
* Fix an array conversion warning in some versions of PHP
|
||||
* Support a new WPCOM_API_KEY constant for easier use with WordPress MU
|
||||
|
||||
= 2.2.5 =
|
||||
*Release Date - 13th July, 2009*
|
||||
|
||||
* Include a new Server Connectivity diagnostic check, to detect problems caused by firewalls
|
||||
|
||||
= 2.2.4 =
|
||||
*Release Date - 3rd June, 2009*
|
||||
|
||||
* Fixed a key problem affecting the stats feature in WordPress MU
|
||||
* Provide additional blog information in Akismet API calls
|
||||
242
app/webroot/blog/wp-content/plugins/akismet/views/config.php
Normal file
242
app/webroot/blog/wp-content/plugins/akismet/views/config.php
Normal file
@@ -0,0 +1,242 @@
|
||||
<div id="akismet-plugin-container">
|
||||
<div class="akismet-masthead">
|
||||
<div class="akismet-masthead__inside-container">
|
||||
<div class="akismet-masthead__logo-container">
|
||||
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="akismet-lower">
|
||||
<?php if ( Akismet::get_api_key() ) { ?>
|
||||
<?php Akismet_Admin::display_status(); ?>
|
||||
<?php } ?>
|
||||
<?php if ( ! empty( $notices ) ) { ?>
|
||||
<?php foreach ( $notices as $notice ) { ?>
|
||||
<?php Akismet::view( 'notice', $notice ); ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ( $stat_totals && isset( $stat_totals['all'] ) && (int) $stat_totals['all']->spam > 0 ) : ?>
|
||||
<div class="akismet-card">
|
||||
<div class="akismet-section-header">
|
||||
<div class="akismet-section-header__label">
|
||||
<span><?php esc_html_e( 'Statistics' , 'akismet'); ?></span>
|
||||
</div>
|
||||
<div class="akismet-section-header__actions">
|
||||
<a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>">
|
||||
<?php esc_html_e( 'Detailed Stats' , 'akismet');?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="akismet-new-snapshot">
|
||||
<iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php printf( '//akismet.com/web/1.0/snapshot.php?blog=%s&api_key=%s&height=200&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() );?>"></iframe>
|
||||
<ul>
|
||||
<li>
|
||||
<h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3>
|
||||
<span><?php echo number_format( $stat_totals['6-months']->spam );?></span>
|
||||
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?>
|
||||
</li>
|
||||
<li>
|
||||
<h3><?php esc_html_e( 'All time' , 'akismet');?></h3>
|
||||
<span><?php echo number_format( $stat_totals['all']->spam );?></span>
|
||||
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?>
|
||||
</li>
|
||||
<li>
|
||||
<h3><?php esc_html_e( 'Accuracy' , 'akismet');?></h3>
|
||||
<span><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
|
||||
<?php printf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ); ?>
|
||||
|
|
||||
<?php printf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
<?php if ( $akismet_user ):?>
|
||||
<div class="akismet-card">
|
||||
<div class="akismet-section-header">
|
||||
<div class="akismet-section-header__label">
|
||||
<span><?php esc_html_e( 'Settings' , 'akismet'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inside">
|
||||
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
|
||||
<table cellspacing="0" class="akismet-settings">
|
||||
<tbody>
|
||||
<?php if ( ! Akismet::predefined_api_key() ) { ?>
|
||||
<tr>
|
||||
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
|
||||
<td width="5%"/>
|
||||
<td align="left">
|
||||
<span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if ( isset( $_GET['ssl_status'] ) ) { ?>
|
||||
<tr>
|
||||
<th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
|
||||
<td></td>
|
||||
<td align="left">
|
||||
<p>
|
||||
<?php
|
||||
|
||||
if ( ! wp_http_supports( array( 'ssl' ) ) ) {
|
||||
?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?><?php
|
||||
}
|
||||
else {
|
||||
$ssl_disabled = get_option( 'akismet_ssl_disabled' );
|
||||
|
||||
if ( $ssl_disabled ) {
|
||||
?><b><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?><?php
|
||||
}
|
||||
else {
|
||||
?><b><?php esc_html_e( 'Enabled.', 'akismet' ); ?></b> <?php esc_html_e( 'All systems functional.', 'akismet' ); ?><?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th align="left" scope="row"><?php esc_html_e('Comments', 'akismet');?></th>
|
||||
<td></td>
|
||||
<td align="left">
|
||||
<p>
|
||||
<label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>">
|
||||
<input
|
||||
name="akismet_show_user_comments_approved"
|
||||
id="akismet_show_user_comments_approved"
|
||||
value="1"
|
||||
type="checkbox"
|
||||
<?php
|
||||
|
||||
// If the option isn't set, or if it's enabled ('1'), or if it was enabled a long time ago ('true'), check the checkbox.
|
||||
checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
|
||||
|
||||
?>
|
||||
/>
|
||||
<?php esc_html_e( 'Show the number of approved comments beside each comment author', 'akismet' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="strictness" align="left" scope="row"><?php esc_html_e('Strictness', 'akismet'); ?></th>
|
||||
<td></td>
|
||||
<td align="left">
|
||||
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend>
|
||||
<p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Silently discard the worst and most pervasive spam so I never see it.', 'akismet'); ?></label></p>
|
||||
<p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Always put spam in the Spam folder for review.', 'akismet'); ?></label></p>
|
||||
</fieldset>
|
||||
<span class="akismet-note"><strong><?php esc_html_e('Note:', 'akismet');?></strong>
|
||||
<?php
|
||||
|
||||
$delete_interval = max( 1, intval( apply_filters( 'akismet_delete_comment_interval', 15 ) ) );
|
||||
|
||||
printf(
|
||||
_n(
|
||||
'Spam in the <a href="%1$s">spam folder</a> older than 1 day is deleted automatically.',
|
||||
'Spam in the <a href="%1$s">spam folder</a> older than %2$d days is deleted automatically.',
|
||||
$delete_interval,
|
||||
'akismet'
|
||||
),
|
||||
admin_url( 'edit-comments.php?comment_status=spam' ),
|
||||
$delete_interval
|
||||
);
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="comment-form-privacy-notice" align="left" scope="row"><?php esc_html_e('Privacy', 'akismet'); ?></th>
|
||||
<td></td>
|
||||
<td align="left">
|
||||
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet privacy notice', 'akismet'); ?></span></legend>
|
||||
<p><label for="akismet_comment_form_privacy_notice_display"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked('display', get_option('akismet_comment_form_privacy_notice')); ?> /> <?php esc_html_e('Display a privacy notice under your comment forms.', 'akismet'); ?></label></p>
|
||||
<p><label for="akismet_comment_form_privacy_notice_hide"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option('akismet_comment_form_privacy_notice'), array('display', 'hide') ) ? checked('hide', get_option('akismet_comment_form_privacy_notice'), false) : 'checked="checked"'; ?> /> <?php esc_html_e('Do not display privacy notice.', 'akismet'); ?></label></p>
|
||||
</fieldset>
|
||||
<span class="akismet-note"><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on above.', 'akismet' );?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="akismet-card-actions">
|
||||
<?php if ( ! Akismet::predefined_api_key() ) { ?>
|
||||
<div id="delete-action">
|
||||
<a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php wp_nonce_field(Akismet_Admin::NONCE) ?>
|
||||
<div id="publishing-action">
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<input type="submit" name="submit" id="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e('Save Changes', 'akismet');?>">
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( ! Akismet::predefined_api_key() ) { ?>
|
||||
<div class="akismet-card">
|
||||
<div class="akismet-section-header">
|
||||
<div class="akismet-section-header__label">
|
||||
<span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inside">
|
||||
<table cellspacing="0" border="0" class="akismet-settings">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
|
||||
<td width="5%"/>
|
||||
<td align="left">
|
||||
<p><?php echo esc_html( $akismet_user->account_name ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
|
||||
<td width="5%"/>
|
||||
<td align="left">
|
||||
<p><?php
|
||||
if ( 'cancelled' == $akismet_user->status ) :
|
||||
esc_html_e( 'Cancelled', 'akismet' );
|
||||
elseif ( 'suspended' == $akismet_user->status ) :
|
||||
esc_html_e( 'Suspended', 'akismet' );
|
||||
elseif ( 'missing' == $akismet_user->status ) :
|
||||
esc_html_e( 'Missing', 'akismet' );
|
||||
elseif ( 'no-sub' == $akismet_user->status ) :
|
||||
esc_html_e( 'No Subscription Found', 'akismet' );
|
||||
else :
|
||||
esc_html_e( 'Active', 'akismet' );
|
||||
endif; ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( $akismet_user->next_billing_date ) : ?>
|
||||
<tr>
|
||||
<th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
|
||||
<td width="5%"/>
|
||||
<td align="left">
|
||||
<p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="akismet-card-actions">
|
||||
<div id="publishing-action">
|
||||
<?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank">
|
||||
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
||||
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
|
||||
<input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
|
||||
<input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'akismet-button akismet-is-primary';?>" value="<?php echo esc_attr( $text ); ?>"/>
|
||||
</form>
|
||||
141
app/webroot/blog/wp-content/plugins/akismet/views/notice.php
Normal file
141
app/webroot/blog/wp-content/plugins/akismet/views/notice.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php if ( $type == 'plugin' ) :?>
|
||||
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
|
||||
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
|
||||
<div class="akismet_activate">
|
||||
<div class="aa_a">A</div>
|
||||
<div class="aa_button_container">
|
||||
<div class="aa_button_border">
|
||||
<input type="submit" class="aa_button" value="<?php esc_attr_e( 'Set up your Akismet account', 'akismet' ); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="aa_description"><?php _e('<strong>Almost done</strong> - configure Akismet and say goodbye to spam', 'akismet');?></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php elseif ( $type == 'spam-check' ) :?>
|
||||
<div class="notice notice-warning">
|
||||
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
|
||||
<p><?php esc_html_e( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ); ?></p>
|
||||
<?php if ( $link_text ) { ?>
|
||||
<p><?php echo $link_text; ?></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php elseif ( $type == 'alert' ) :?>
|
||||
<div class='error'>
|
||||
<p><strong><?php printf( esc_html__( 'Akismet Error Code: %s', 'akismet' ), $code ); ?></strong></p>
|
||||
<p><?php echo esc_html( $msg ); ?></p>
|
||||
<p><?php
|
||||
|
||||
/* translators: the placeholder is a clickable URL that leads to more information regarding an error code. */
|
||||
printf( esc_html__( 'For more information: %s' , 'akismet'), '<a href="https://akismet.com/errors/' . $code . '">https://akismet.com/errors/' . $code . '</a>' );
|
||||
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'notice' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status failed"><?php echo $notice_header; ?></h3>
|
||||
<p class="akismet-description">
|
||||
<?php echo $notice_text; ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'missing-functions' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('Your web host or server administrator has disabled PHP’s <code>gethostbynamel</code> function. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet’s system requirements</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'servers-be-down' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status failed"><?php esc_html_e("Your site can’t connect to the Akismet servers.", 'akismet'); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'active-dunning' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status"><?php esc_html_e("Please update your payment information.", 'akismet'); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('We cannot process your payment. Please <a href="%s" target="_blank">update your payment details</a>.', 'akismet'), 'https://akismet.com/account/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'cancelled' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status"><?php esc_html_e("Your Akismet plan has been cancelled.", 'akismet'); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('Please visit your <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet'), 'https://akismet.com/account/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'suspended' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status failed"><?php esc_html_e("Your Akismet subscription is suspended.", 'akismet'); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'active-notice' && $time_saved ) :?>
|
||||
<div class="akismet-alert akismet-active">
|
||||
<h3 class="akismet-key-status"><?php echo esc_html( $time_saved ); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet'), 'https://akismet.com/account/upgrade/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'missing' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status failed"><?php esc_html_e( 'There is a problem with your API key.', 'akismet'); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'no-sub' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You don’t have an Akismet plan.', 'akismet'); ?></h3>
|
||||
<p class="akismet-description">
|
||||
<?php printf( __( 'In 2012, Akismet began using subscription plans for all accounts (even free ones). A plan has not been assigned to your account, and we’d appreciate it if you’d <a href="%s" target="_blank">sign into your account</a> and choose one.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
|
||||
<br /><br />
|
||||
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'new-key-valid' ) :
|
||||
global $wpdb;
|
||||
|
||||
$check_pending_link = false;
|
||||
|
||||
$at_least_one_comment_in_moderation = !! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" );
|
||||
|
||||
if ( $at_least_one_comment_in_moderation) {
|
||||
$check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="akismet-alert akismet-active">
|
||||
<h3 class="akismet-key-status"><?php esc_html_e( 'Akismet is now protecting your site from spam. Happy blogging!', 'akismet' ); ?></h3>
|
||||
<?php if ( $check_pending_link ) { ?>
|
||||
<p class="akismet-description"><?php printf( __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ), esc_url( $check_pending_link ) ); ?></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php elseif ( $type == 'new-key-invalid' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
|
||||
</div>
|
||||
<?php elseif ( $type == 'existing-key-invalid' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status"><?php esc_html_e( 'Your API key is no longer valid. Please enter a new key or contact support@akismet.com.' , 'akismet'); ?></h3>
|
||||
</div>
|
||||
<?php elseif ( $type == 'new-key-failed' ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<h3 class="akismet-key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
|
||||
<p class="akismet-description"><?php printf( __('The connection to akismet.com could not be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) :?>
|
||||
<div class="akismet-alert akismet-critical">
|
||||
<?php if ( $level == 'yellow' ): ?>
|
||||
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You’re using your Akismet key on more sites than your Pro subscription allows.', 'akismet' ); ?></h3>
|
||||
<p class="akismet-description">
|
||||
<?php printf( __( 'Your Pro subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ), 'https://docs.akismet.com/billing/add-more-sites/' ); ?>
|
||||
<br /><br />
|
||||
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
|
||||
</p>
|
||||
<?php elseif ( $level == 'red' ): ?>
|
||||
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You’re using Akismet on far too many sites for your Pro subscription.', 'akismet' ); ?></h3>
|
||||
<p class="akismet-description">
|
||||
<?php printf( __( 'To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
|
||||
<br /><br />
|
||||
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php elseif ( $type == 'privacy' ) :?>
|
||||
<div class="notice notice-warning is-dismissible" id="akismet-privacy-notice-admin-notice">
|
||||
<p><strong><?php esc_html_e( 'Akismet & Privacy.', 'akismet' );?></strong></p>
|
||||
<p><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on below.', 'akismet' ); ?></p>
|
||||
<p><?php printf( __(' Please <a href="%s">enable</a> or <a href="%s">disable</a> this feature. <a href="%s" id="akismet-privacy-notice-control-notice-info-link" target="_blank">More information</a>.', 'akismet' ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_display', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=display' ) ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_hide', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide' ) ), 'https://akismet.com/privacy/' ); ?></p>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
102
app/webroot/blog/wp-content/plugins/akismet/views/start.php
Normal file
102
app/webroot/blog/wp-content/plugins/akismet/views/start.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<div id="akismet-plugin-container">
|
||||
<div class="akismet-masthead">
|
||||
<div class="akismet-masthead__inside-container">
|
||||
<div class="akismet-masthead__logo-container">
|
||||
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="akismet-lower">
|
||||
<?php Akismet_Admin::display_status(); ?>
|
||||
|
||||
<div class="akismet-box">
|
||||
<h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
|
||||
<p><?php esc_html_e( 'Select one of the options below to get started.', 'akismet' ); ?></p>
|
||||
</div>
|
||||
<div class="akismet-boxes">
|
||||
<?php if ( ! Akismet::predefined_api_key() ) { ?>
|
||||
<?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?>
|
||||
<?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?>
|
||||
<div class="akismet-box">
|
||||
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
|
||||
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
|
||||
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
||||
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
|
||||
<input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
|
||||
<input type="hidden" name="redirect" value="plugin-signup"/>
|
||||
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
|
||||
</form>
|
||||
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
|
||||
<p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
|
||||
</div>
|
||||
<?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
|
||||
<div class="akismet-box">
|
||||
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
|
||||
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
|
||||
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
||||
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
|
||||
<input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
|
||||
<input type="hidden" name="redirect" value="upgrade"/>
|
||||
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/>
|
||||
</form>
|
||||
<p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
|
||||
</div>
|
||||
<?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
|
||||
<div class="centered akismet-box">
|
||||
<h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3>
|
||||
<p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
|
||||
<p><?php esc_html_e( 'No worries! Get in touch and we’ll sort this out.', 'akismet' ); ?></p>
|
||||
<p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
|
||||
</div>
|
||||
<?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
|
||||
<div class="akismet-box">
|
||||
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
|
||||
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
|
||||
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
|
||||
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
|
||||
</form>
|
||||
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
|
||||
<p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="akismet-box">
|
||||
<h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3>
|
||||
<div class="akismet-right">
|
||||
<?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?>
|
||||
</div>
|
||||
<p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="akismet-box">
|
||||
<h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3>
|
||||
<div class="akismet-right">
|
||||
<?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
|
||||
</div>
|
||||
<p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="akismet-box">
|
||||
<h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Already have your key? Enter it here.', 'akismet' ); ?> <a href="https://docs.akismet.com/getting-started/api-key/" target="_blank"><?php esc_html_e( '(What is an API key?)', 'akismet' ); ?></a></p>
|
||||
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
|
||||
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
|
||||
<input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
|
||||
<input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="akismet-box">
|
||||
<h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2>
|
||||
<p><?php echo sprintf( esc_html__( 'An Akismet API key has been defined in the %s file for this site.', 'akismet' ), '<code>wp-config.php</code>' ); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
11
app/webroot/blog/wp-content/plugins/akismet/views/stats.php
Normal file
11
app/webroot/blog/wp-content/plugins/akismet/views/stats.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<div id="akismet-plugin-container">
|
||||
<div class="akismet-masthead">
|
||||
<div class="akismet-masthead__inside-container">
|
||||
<a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="akismet-right"><?php esc_html_e( 'Akismet Settings' , 'akismet' ); ?></a>
|
||||
<div class="akismet-masthead__logo-container">
|
||||
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0"></iframe>
|
||||
</div>
|
||||
213
app/webroot/blog/wp-content/plugins/akismet/wrapper.php
Normal file
213
app/webroot/blog/wp-content/plugins/akismet/wrapper.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
global $wpcom_api_key, $akismet_api_host, $akismet_api_port;
|
||||
|
||||
$wpcom_api_key = defined( 'WPCOM_API_KEY' ) ? constant( 'WPCOM_API_KEY' ) : '';
|
||||
$akismet_api_host = Akismet::get_api_key() . '.rest.akismet.com';
|
||||
$akismet_api_port = 80;
|
||||
|
||||
function akismet_test_mode() {
|
||||
return Akismet::is_test_mode();
|
||||
}
|
||||
|
||||
function akismet_http_post( $request, $host, $path, $port = 80, $ip = null ) {
|
||||
$path = str_replace( '/1.1/', '', $path );
|
||||
|
||||
return Akismet::http_post( $request, $path, $ip );
|
||||
}
|
||||
|
||||
function akismet_microtime() {
|
||||
return Akismet::_get_microtime();
|
||||
}
|
||||
|
||||
function akismet_delete_old() {
|
||||
return Akismet::delete_old_comments();
|
||||
}
|
||||
|
||||
function akismet_delete_old_metadata() {
|
||||
return Akismet::delete_old_comments_meta();
|
||||
}
|
||||
|
||||
function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) {
|
||||
return Akismet::check_db_comment( $id, $recheck_reason );
|
||||
}
|
||||
|
||||
function akismet_rightnow() {
|
||||
if ( !class_exists( 'Akismet_Admin' ) )
|
||||
return false;
|
||||
|
||||
return Akismet_Admin::rightnow_stats();
|
||||
}
|
||||
|
||||
function akismet_admin_init() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_version_warning() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_load_js_and_css() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_nonce_field( $action = -1 ) {
|
||||
return wp_nonce_field( $action );
|
||||
}
|
||||
function akismet_plugin_action_links( $links, $file ) {
|
||||
return Akismet_Admin::plugin_action_links( $links, $file );
|
||||
}
|
||||
function akismet_conf() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_stats_display() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_stats() {
|
||||
return Akismet_Admin::dashboard_stats();
|
||||
}
|
||||
function akismet_admin_warnings() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_comment_row_action( $a, $comment ) {
|
||||
return Akismet_Admin::comment_row_actions( $a, $comment );
|
||||
}
|
||||
function akismet_comment_status_meta_box( $comment ) {
|
||||
return Akismet_Admin::comment_status_meta_box( $comment );
|
||||
}
|
||||
function akismet_comments_columns( $columns ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return $columns;
|
||||
}
|
||||
function akismet_comment_column_row( $column, $comment_id ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_text_add_link_callback( $m ) {
|
||||
return Akismet_Admin::text_add_link_callback( $m );
|
||||
}
|
||||
function akismet_text_add_link_class( $comment_text ) {
|
||||
return Akismet_Admin::text_add_link_class( $comment_text );
|
||||
}
|
||||
function akismet_check_for_spam_button( $comment_status ) {
|
||||
return Akismet_Admin::check_for_spam_button( $comment_status );
|
||||
}
|
||||
function akismet_submit_nonspam_comment( $comment_id ) {
|
||||
return Akismet::submit_nonspam_comment( $comment_id );
|
||||
}
|
||||
function akismet_submit_spam_comment( $comment_id ) {
|
||||
return Akismet::submit_spam_comment( $comment_id );
|
||||
}
|
||||
function akismet_transition_comment_status( $new_status, $old_status, $comment ) {
|
||||
return Akismet::transition_comment_status( $new_status, $old_status, $comment );
|
||||
}
|
||||
function akismet_spam_count( $type = false ) {
|
||||
return Akismet_Admin::get_spam_count( $type );
|
||||
}
|
||||
function akismet_recheck_queue() {
|
||||
return Akismet_Admin::recheck_queue();
|
||||
}
|
||||
function akismet_remove_comment_author_url() {
|
||||
return Akismet_Admin::remove_comment_author_url();
|
||||
}
|
||||
function akismet_add_comment_author_url() {
|
||||
return Akismet_Admin::add_comment_author_url();
|
||||
}
|
||||
function akismet_check_server_connectivity() {
|
||||
return Akismet_Admin::check_server_connectivity();
|
||||
}
|
||||
function akismet_get_server_connectivity( $cache_timeout = 86400 ) {
|
||||
return Akismet_Admin::get_server_connectivity( $cache_timeout );
|
||||
}
|
||||
function akismet_server_connectivity_ok() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return true;
|
||||
}
|
||||
function akismet_admin_menu() {
|
||||
return Akismet_Admin::admin_menu();
|
||||
}
|
||||
function akismet_load_menu() {
|
||||
return Akismet_Admin::load_menu();
|
||||
}
|
||||
function akismet_init() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_get_key() {
|
||||
return Akismet::get_api_key();
|
||||
}
|
||||
function akismet_check_key_status( $key, $ip = null ) {
|
||||
return Akismet::check_key_status( $key, $ip );
|
||||
}
|
||||
function akismet_update_alert( $response ) {
|
||||
return Akismet::update_alert( $response );
|
||||
}
|
||||
function akismet_verify_key( $key, $ip = null ) {
|
||||
return Akismet::verify_key( $key, $ip );
|
||||
}
|
||||
function akismet_get_user_roles( $user_id ) {
|
||||
return Akismet::get_user_roles( $user_id );
|
||||
}
|
||||
function akismet_result_spam( $approved ) {
|
||||
return Akismet::comment_is_spam( $approved );
|
||||
}
|
||||
function akismet_result_hold( $approved ) {
|
||||
return Akismet::comment_needs_moderation( $approved );
|
||||
}
|
||||
function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
|
||||
return Akismet::get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url );
|
||||
}
|
||||
function akismet_update_comment_history( $comment_id, $message, $event = null ) {
|
||||
return Akismet::update_comment_history( $comment_id, $message, $event );
|
||||
}
|
||||
function akismet_get_comment_history( $comment_id ) {
|
||||
return Akismet::get_comment_history( $comment_id );
|
||||
}
|
||||
function akismet_cmp_time( $a, $b ) {
|
||||
return Akismet::_cmp_time( $a, $b );
|
||||
}
|
||||
function akismet_auto_check_update_meta( $id, $comment ) {
|
||||
return Akismet::auto_check_update_meta( $id, $comment );
|
||||
}
|
||||
function akismet_auto_check_comment( $commentdata ) {
|
||||
return Akismet::auto_check_comment( $commentdata );
|
||||
}
|
||||
function akismet_get_ip_address() {
|
||||
return Akismet::get_ip_address();
|
||||
}
|
||||
function akismet_cron_recheck() {
|
||||
return Akismet::cron_recheck();
|
||||
}
|
||||
function akismet_add_comment_nonce( $post_id ) {
|
||||
return Akismet::add_comment_nonce( $post_id );
|
||||
}
|
||||
function akismet_fix_scheduled_recheck() {
|
||||
return Akismet::fix_scheduled_recheck();
|
||||
}
|
||||
function akismet_spam_comments() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return array();
|
||||
}
|
||||
function akismet_spam_totals() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return array();
|
||||
}
|
||||
function akismet_manage_page() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_caught() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function redirect_old_akismet_urls() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
}
|
||||
function akismet_kill_proxy_check( $option ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
|
||||
return 0;
|
||||
}
|
||||
function akismet_pingback_forwarded_for( $r, $url ) {
|
||||
return Akismet::pingback_forwarded_for( $r, $url );
|
||||
}
|
||||
function akismet_pre_check_pingback( $method ) {
|
||||
return Akismet::pre_check_pingback( $method );
|
||||
}
|
||||
81
app/webroot/blog/wp-content/plugins/hello.php
Normal file
81
app/webroot/blog/wp-content/plugins/hello.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Hello_Dolly
|
||||
* @version 1.7
|
||||
*/
|
||||
/*
|
||||
Plugin Name: Hello Dolly
|
||||
Plugin URI: http://wordpress.org/plugins/hello-dolly/
|
||||
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
|
||||
Author: Matt Mullenweg
|
||||
Version: 1.7
|
||||
Author URI: http://ma.tt/
|
||||
*/
|
||||
|
||||
function hello_dolly_get_lyric() {
|
||||
/** These are the lyrics to Hello Dolly */
|
||||
$lyrics = "Hello, Dolly
|
||||
Well, hello, Dolly
|
||||
It's so nice to have you back where you belong
|
||||
You're lookin' swell, Dolly
|
||||
I can tell, Dolly
|
||||
You're still glowin', you're still crowin'
|
||||
You're still goin' strong
|
||||
I feel the room swayin'
|
||||
While the band's playin'
|
||||
One of our old favorite songs from way back when
|
||||
So, take her wrap, fellas
|
||||
Dolly, never go away again
|
||||
Hello, Dolly
|
||||
Well, hello, Dolly
|
||||
It's so nice to have you back where you belong
|
||||
You're lookin' swell, Dolly
|
||||
I can tell, Dolly
|
||||
You're still glowin', you're still crowin'
|
||||
You're still goin' strong
|
||||
I feel the room swayin'
|
||||
While the band's playin'
|
||||
One of our old favorite songs from way back when
|
||||
So, golly, gee, fellas
|
||||
Have a little faith in me, fellas
|
||||
Dolly, never go away
|
||||
Promise, you'll never go away
|
||||
Dolly'll never go away again";
|
||||
|
||||
// Here we split it into lines
|
||||
$lyrics = explode( "\n", $lyrics );
|
||||
|
||||
// And then randomly choose a line
|
||||
return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
|
||||
}
|
||||
|
||||
// This just echoes the chosen line, we'll position it later
|
||||
function hello_dolly() {
|
||||
$chosen = hello_dolly_get_lyric();
|
||||
echo "<p id='dolly'>$chosen</p>";
|
||||
}
|
||||
|
||||
// Now we set that function up to execute when the admin_notices action is called
|
||||
add_action( 'admin_notices', 'hello_dolly' );
|
||||
|
||||
// We need some CSS to position the paragraph
|
||||
function dolly_css() {
|
||||
// This makes sure that the positioning is also good for right-to-left languages
|
||||
$x = is_rtl() ? 'left' : 'right';
|
||||
|
||||
echo "
|
||||
<style type='text/css'>
|
||||
#dolly {
|
||||
float: $x;
|
||||
padding-$x: 15px;
|
||||
padding-top: 5px;
|
||||
margin: 0;
|
||||
font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
";
|
||||
}
|
||||
|
||||
add_action( 'admin_head', 'dolly_css' );
|
||||
|
||||
?>
|
||||
2
app/webroot/blog/wp-content/plugins/index.php
Normal file
2
app/webroot/blog/wp-content/plugins/index.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Silence is golden.
|
||||
164
app/webroot/blog/wp-content/plugins/wp-pagenavi/admin.php
Normal file
164
app/webroot/blog/wp-content/plugins/wp-pagenavi/admin.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
class PageNavi_Options_Page extends scbAdminPage {
|
||||
|
||||
function setup() {
|
||||
$this->textdomain = 'wp-pagenavi';
|
||||
|
||||
$this->args = array(
|
||||
'page_title' => __( 'PageNavi Settings', $this->textdomain ),
|
||||
'menu_title' => __( 'PageNavi', $this->textdomain ),
|
||||
'page_slug' => 'pagenavi',
|
||||
);
|
||||
}
|
||||
|
||||
function validate( $new_data, $old_data ) {
|
||||
$options = wp_parse_args($new_data, $old_data);
|
||||
foreach ( array( 'style', 'num_pages', 'num_larger_page_numbers', 'larger_page_numbers_multiple' ) as $key ) {
|
||||
$options[ $key ] = absint( @$options[ $key ] );
|
||||
}
|
||||
foreach ( array( 'use_pagenavi_css', 'always_show' ) as $key ) {
|
||||
$options[ $key ] = intval( @$options[ $key ] );
|
||||
}
|
||||
foreach ( array( 'pages_text', 'current_text', 'page_text', 'first_text', 'last_text', 'prev_text', 'next_text', 'dotleft_text', 'dotright_text' ) as $key ) {
|
||||
$options[ $key ] = wp_kses_post( @$options[ $key ] );
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function page_content() {
|
||||
$rows = array(
|
||||
array(
|
||||
'title' => __( 'Text For Number Of Pages', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'pages_text',
|
||||
'extra' => 'size="50"',
|
||||
'desc' => '<br />
|
||||
%CURRENT_PAGE% - ' . __( 'The current page number.', $this->textdomain ) . '<br />
|
||||
%TOTAL_PAGES% - ' . __( 'The total number of pages.', $this->textdomain )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For Current Page', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'current_text',
|
||||
'desc' => '<br />
|
||||
%PAGE_NUMBER% - ' . __( 'The page number.', $this->textdomain )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For Page', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'page_text',
|
||||
'desc' => '<br />
|
||||
%PAGE_NUMBER% - ' . __( 'The page number.', $this->textdomain )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For First Page', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'first_text',
|
||||
'desc' => '<br />
|
||||
%TOTAL_PAGES% - ' . __( 'The total number of pages.', $this->textdomain )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For Last Page', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'last_text',
|
||||
'desc' => '<br />
|
||||
%TOTAL_PAGES% - ' . __( 'The total number of pages.', $this->textdomain )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For Previous Page', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'prev_text',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For Next Page', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'next_text',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For Previous ...', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'dotleft_text',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Text For Next ...', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'dotright_text',
|
||||
),
|
||||
);
|
||||
|
||||
$out =
|
||||
html( 'h3', __( 'Page Navigation Text', $this->textdomain ) )
|
||||
.html( 'p', __( 'Leaving a field blank will hide that part of the navigation.', $this->textdomain ) )
|
||||
.$this->table( $rows );
|
||||
|
||||
|
||||
$rows = array(
|
||||
array(
|
||||
'title' => __( 'Use pagenavi-css.css', $this->textdomain ),
|
||||
'type' => 'radio',
|
||||
'name' => 'use_pagenavi_css',
|
||||
'choices' => array( 1 => __( 'Yes', $this->textdomain ), 0 => __( 'No', $this->textdomain ) )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Page Navigation Style', $this->textdomain ),
|
||||
'type' => 'select',
|
||||
'name' => 'style',
|
||||
'values' => array( 1 => __( 'Normal', $this->textdomain ), 2 => __( 'Drop-down List', $this->textdomain ) ),
|
||||
'text' => false
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Always Show Page Navigation', $this->textdomain ),
|
||||
'type' => 'radio',
|
||||
'name' => 'always_show',
|
||||
'choices' => array( 1 => __( 'Yes', $this->textdomain ), 0 => __( 'No', $this->textdomain ) ),
|
||||
'desc' => '<br />'.__( "Show navigation even if there's only one page.", $this->textdomain )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Number Of Pages To Show', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'num_pages',
|
||||
'extra' => 'class="small-text"'
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Number Of Larger Page Numbers To Show', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'num_larger_page_numbers',
|
||||
'extra' => 'class="small-text"',
|
||||
'desc' =>
|
||||
'<br />' . __( 'Larger page numbers are in addition to the normal page numbers. They are useful when there are many pages of posts.', $this->textdomain ) .
|
||||
'<br />' . __( 'For example, WP-PageNavi will display: Pages 1, 2, 3, 4, 5, 10, 20, 30, 40, 50.', $this->textdomain ) .
|
||||
'<br />' . __( 'Enter 0 to disable.', $this->textdomain )
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Show Larger Page Numbers In Multiples Of', $this->textdomain ),
|
||||
'type' => 'text',
|
||||
'name' => 'larger_page_numbers_multiple',
|
||||
'extra' => 'class="small-text"',
|
||||
'desc' =>
|
||||
'<br />' . __( 'For example, if mutiple is 5, it will show: 5, 10, 15, 20, 25', $this->textdomain )
|
||||
)
|
||||
);
|
||||
|
||||
$out .=
|
||||
html( 'h3', __( 'Page Navigation Options', $this->textdomain ) )
|
||||
.$this->table( $rows );
|
||||
|
||||
echo $this->form_wrap( $out );
|
||||
}
|
||||
}
|
||||
|
||||
331
app/webroot/blog/wp-content/plugins/wp-pagenavi/core.php
Normal file
331
app/webroot/blog/wp-content/plugins/wp-pagenavi/core.php
Normal file
@@ -0,0 +1,331 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Template tag: Boxed Style Paging
|
||||
*
|
||||
* @param array $args:
|
||||
* 'before': (string)
|
||||
* 'after': (string)
|
||||
* 'options': (string|array) Used to overwrite options set in WP-Admin -> Settings -> PageNavi
|
||||
*
|
||||
* @return void|string
|
||||
*/
|
||||
function wp_pagenavi( $args = array() ) {
|
||||
if ( !is_array( $args ) ) {
|
||||
$argv = func_get_args();
|
||||
|
||||
$args = array();
|
||||
foreach ( array( 'before', 'after', 'options' ) as $i => $key ) {
|
||||
$args[ $key ] = isset( $argv[ $i ]) ? $argv[ $i ] : '';
|
||||
}
|
||||
}
|
||||
|
||||
$args = wp_parse_args( $args, array(
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'wrapper_tag' => 'div',
|
||||
'wrapper_class' => 'wp-pagenavi',
|
||||
'options' => array(),
|
||||
'query' => $GLOBALS['wp_query'],
|
||||
'type' => 'posts',
|
||||
'echo' => true
|
||||
) );
|
||||
|
||||
extract( $args, EXTR_SKIP );
|
||||
|
||||
$options = wp_parse_args( $options, PageNavi_Core::$options->get() );
|
||||
|
||||
$instance = new PageNavi_Call( $args );
|
||||
|
||||
list( $posts_per_page, $paged, $total_pages ) = $instance->get_pagination_args();
|
||||
|
||||
if ( 1 == $total_pages && !$options['always_show'] )
|
||||
return;
|
||||
|
||||
$pages_to_show = absint( $options['num_pages'] );
|
||||
$larger_page_to_show = absint( $options['num_larger_page_numbers'] );
|
||||
$larger_page_multiple = absint( $options['larger_page_numbers_multiple'] );
|
||||
$pages_to_show_minus_1 = $pages_to_show - 1;
|
||||
$half_page_start = floor( $pages_to_show_minus_1/2 );
|
||||
$half_page_end = ceil( $pages_to_show_minus_1/2 );
|
||||
$start_page = $paged - $half_page_start;
|
||||
|
||||
if ( $start_page <= 0 )
|
||||
$start_page = 1;
|
||||
|
||||
$end_page = $paged + $half_page_end;
|
||||
|
||||
if ( ( $end_page - $start_page ) != $pages_to_show_minus_1 )
|
||||
$end_page = $start_page + $pages_to_show_minus_1;
|
||||
|
||||
if ( $end_page > $total_pages ) {
|
||||
$start_page = $total_pages - $pages_to_show_minus_1;
|
||||
$end_page = $total_pages;
|
||||
}
|
||||
|
||||
if ( $start_page < 1 )
|
||||
$start_page = 1;
|
||||
|
||||
// Support for filters to change class names
|
||||
$class_names = array(
|
||||
'pages' => apply_filters( 'wp_pagenavi_class_pages', 'pages'),
|
||||
'first' => apply_filters( 'wp_pagenavi_class_first', 'first' ),
|
||||
'previouspostslink' => apply_filters( 'wp_pagenavi_class_previouspostslink', 'previouspostslink' ),
|
||||
'extend' => apply_filters( 'wp_pagenavi_class_extend', 'extend' ),
|
||||
'smaller' => apply_filters( 'wp_pagenavi_class_smaller', 'smaller' ),
|
||||
'page' => apply_filters( 'wp_pagenavi_class_page', 'page' ),
|
||||
'current' => apply_filters( 'wp_pagenavi_class_current', 'current'),
|
||||
'larger' => apply_filters( 'wp_pagenavi_class_larger', 'larger' ),
|
||||
'nextpostslink' => apply_filters( 'wp_pagenavi_class_nextpostslink', 'nextpostslink'),
|
||||
'last' => apply_filters( 'wp_pagenavi_class_last', 'last'),
|
||||
);
|
||||
|
||||
$out = '';
|
||||
switch ( intval( $options['style'] ) ) {
|
||||
// Normal
|
||||
case 1:
|
||||
// Text
|
||||
if ( !empty( $options['pages_text'] ) ) {
|
||||
$pages_text = str_replace(
|
||||
array( "%CURRENT_PAGE%", "%TOTAL_PAGES%" ),
|
||||
array( number_format_i18n( $paged ), number_format_i18n( $total_pages ) ),
|
||||
__( $options['pages_text'], 'wp-pagenavi' ) );
|
||||
$out .= "<span class='{$class_names['pages']}'>$pages_text</span>";
|
||||
}
|
||||
|
||||
if ( $start_page >= 2 && $pages_to_show < $total_pages ) {
|
||||
// First
|
||||
$first_text = str_replace( '%TOTAL_PAGES%', number_format_i18n( $total_pages ), __( $options['first_text'], 'wp-pagenavi' ) );
|
||||
$out .= $instance->get_single( 1, $first_text, array(
|
||||
'class' => $class_names['first']
|
||||
), '%TOTAL_PAGES%' );
|
||||
}
|
||||
|
||||
// Previous
|
||||
if ( $paged > 1 && !empty( $options['prev_text'] ) ) {
|
||||
$out .= $instance->get_single( $paged - 1, $options['prev_text'], array(
|
||||
'class' => $class_names['previouspostslink'],
|
||||
'rel' => 'prev'
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $start_page >= 2 && $pages_to_show < $total_pages ) {
|
||||
if ( !empty( $options['dotleft_text'] ) )
|
||||
$out .= "<span class='{$class_names['extend']}'>{$options['dotleft_text']}</span>";
|
||||
}
|
||||
|
||||
// Smaller pages
|
||||
$larger_pages_array = array();
|
||||
if ( $larger_page_multiple )
|
||||
for ( $i = $larger_page_multiple; $i <= $total_pages; $i+= $larger_page_multiple )
|
||||
$larger_pages_array[] = $i;
|
||||
|
||||
$larger_page_start = 0;
|
||||
foreach ( $larger_pages_array as $larger_page ) {
|
||||
if ( $larger_page < ($start_page - $half_page_start) && $larger_page_start < $larger_page_to_show ) {
|
||||
$out .= $instance->get_single( $larger_page, $options['page_text'], array(
|
||||
'class' => "{$class_names['smaller']} {$class_names['page']}",
|
||||
'title' => sprintf( __( 'Page %d', 'wp-pagenavi' ), number_format_i18n( $larger_page ) ),
|
||||
) );
|
||||
$larger_page_start++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $larger_page_start )
|
||||
$out .= "<span class='{$class_names['extend']}'>{$options['dotleft_text']}</span>";
|
||||
|
||||
// Page numbers
|
||||
$timeline = 'smaller';
|
||||
foreach ( range( $start_page, $end_page ) as $i ) {
|
||||
if ( $i == $paged && !empty( $options['current_text'] ) ) {
|
||||
$current_page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['current_text'] );
|
||||
$out .= "<span class='{$class_names['current']}'>$current_page_text</span>";
|
||||
$timeline = 'larger';
|
||||
} else {
|
||||
$out .= $instance->get_single( $i, $options['page_text'], array(
|
||||
'class' => "{$class_names['page']} {$class_names[$timeline]}",
|
||||
'title' => sprintf( __( 'Page %d', 'wp-pagenavi' ), number_format_i18n( $i ) ),
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
// Large pages
|
||||
$larger_page_end = 0;
|
||||
$larger_page_out = '';
|
||||
foreach ( $larger_pages_array as $larger_page ) {
|
||||
if ( $larger_page > ($end_page + $half_page_end) && $larger_page_end < $larger_page_to_show ) {
|
||||
$larger_page_out .= $instance->get_single( $larger_page, $options['page_text'], array(
|
||||
'class' => "{$class_names['larger']} {$class_names['page']}",
|
||||
'title' => sprintf( __( 'Page %d', 'wp-pagenavi' ), number_format_i18n( $larger_page ) ),
|
||||
) );
|
||||
$larger_page_end++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $larger_page_out ) {
|
||||
$out .= "<span class='{$class_names['extend']}'>{$options['dotright_text']}</span>";
|
||||
}
|
||||
$out .= $larger_page_out;
|
||||
|
||||
if ( $end_page < $total_pages ) {
|
||||
if ( !empty( $options['dotright_text'] ) )
|
||||
$out .= "<span class='{$class_names['extend']}'>{$options['dotright_text']}</span>";
|
||||
}
|
||||
|
||||
// Next
|
||||
if ( $paged < $total_pages && !empty( $options['next_text'] ) ) {
|
||||
$out .= $instance->get_single( $paged + 1, $options['next_text'], array(
|
||||
'class' => $class_names['nextpostslink'],
|
||||
'rel' => 'next'
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $end_page < $total_pages ) {
|
||||
// Last
|
||||
$out .= $instance->get_single( $total_pages, __( $options['last_text'], 'wp-pagenavi' ), array(
|
||||
'class' => $class_names['last'],
|
||||
), '%TOTAL_PAGES%' );
|
||||
}
|
||||
break;
|
||||
|
||||
// Dropdown
|
||||
case 2:
|
||||
$out .= '<form action="" method="get">'."\n";
|
||||
$out .= '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">'."\n";
|
||||
|
||||
foreach ( range( 1, $total_pages ) as $i ) {
|
||||
$page_num = $i;
|
||||
if ( $page_num == 1 )
|
||||
$page_num = 0;
|
||||
|
||||
if ( $i == $paged ) {
|
||||
$current_page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['current_text'] );
|
||||
$out .= '<option value="'.esc_url( $instance->get_url( $page_num ) ).'" selected="selected" class="'.$class_names['current'].'">'.$current_page_text."</option>\n";
|
||||
} else {
|
||||
$page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['page_text'] );
|
||||
$out .= '<option value="'.esc_url( $instance->get_url( $page_num ) ).'">'.$page_text."</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$out .= "</select>\n";
|
||||
$out .= "</form>\n";
|
||||
break;
|
||||
}
|
||||
$out = $before . "<" . $wrapper_tag . " class='" . $wrapper_class . "'>\n$out\n</" . $wrapper_tag . ">" . $after;
|
||||
|
||||
$out = apply_filters( 'wp_pagenavi', $out );
|
||||
|
||||
if ( !$echo )
|
||||
return $out;
|
||||
|
||||
echo $out;
|
||||
}
|
||||
|
||||
|
||||
class PageNavi_Call {
|
||||
|
||||
protected $args;
|
||||
|
||||
function __construct( $args ) {
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
function __get( $key ) {
|
||||
return $this->args[ $key ];
|
||||
}
|
||||
|
||||
function get_pagination_args() {
|
||||
global $numpages;
|
||||
|
||||
$query = $this->query;
|
||||
|
||||
switch( $this->type ) {
|
||||
case 'multipart':
|
||||
// Multipart page
|
||||
$posts_per_page = 1;
|
||||
$paged = max( 1, absint( get_query_var( 'page' ) ) );
|
||||
$total_pages = max( 1, $numpages );
|
||||
break;
|
||||
case 'users':
|
||||
// WP_User_Query
|
||||
$posts_per_page = $query->query_vars['number'];
|
||||
$paged = max( 1, floor( $query->query_vars['offset'] / $posts_per_page ) + 1 );
|
||||
$total_pages = max( 1, ceil( $query->total_users / $posts_per_page ) );
|
||||
break;
|
||||
default:
|
||||
// WP_Query
|
||||
$posts_per_page = intval( $query->get( 'posts_per_page' ) );
|
||||
$paged = max( 1, absint( $query->get( 'paged' ) ) );
|
||||
$total_pages = max( 1, absint( $query->max_num_pages ) );
|
||||
break;
|
||||
}
|
||||
|
||||
return array( $posts_per_page, $paged, $total_pages );
|
||||
}
|
||||
|
||||
function get_single( $page, $raw_text, $attr, $format = '%PAGE_NUMBER%' ) {
|
||||
if ( empty( $raw_text ) )
|
||||
return '';
|
||||
|
||||
$text = str_replace( $format, number_format_i18n( $page ), $raw_text );
|
||||
|
||||
$attr['href'] = $this->get_url( $page );
|
||||
|
||||
return html( 'a', $attr, $text );
|
||||
}
|
||||
|
||||
function get_url( $page ) {
|
||||
return ( 'multipart' == $this->type ) ? get_multipage_link( $page ) : get_pagenum_link( $page );
|
||||
}
|
||||
}
|
||||
|
||||
# http://core.trac.wordpress.org/ticket/16973
|
||||
if ( !function_exists( 'get_multipage_link' ) ) :
|
||||
function get_multipage_link( $page = 1 ) {
|
||||
global $post, $wp_rewrite;
|
||||
|
||||
if ( 1 == $page ) {
|
||||
$url = get_permalink();
|
||||
} else {
|
||||
if ( '' == get_option('permalink_structure') || in_array( $post->post_status, array( 'draft', 'pending') ) )
|
||||
$url = add_query_arg( 'page', $page, get_permalink() );
|
||||
elseif ( 'page' == get_option( 'show_on_front' ) && get_option('page_on_front') == $post->ID )
|
||||
$url = trailingslashit( get_permalink() ) . user_trailingslashit( $wp_rewrite->pagination_base . "/$page", 'single_paged' );
|
||||
else
|
||||
$url = trailingslashit( get_permalink() ) . user_trailingslashit( $page, 'single_paged' );
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
endif;
|
||||
|
||||
// Template tag: Drop Down Menu (Deprecated)
|
||||
function wp_pagenavi_dropdown() {
|
||||
wp_pagenavi();
|
||||
}
|
||||
|
||||
|
||||
class PageNavi_Core {
|
||||
static $options;
|
||||
|
||||
static function init( $options ) {
|
||||
self::$options = $options;
|
||||
|
||||
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'stylesheets' ) );
|
||||
}
|
||||
|
||||
static function stylesheets() {
|
||||
if ( !self::$options->use_pagenavi_css )
|
||||
return;
|
||||
|
||||
if ( @file_exists( get_stylesheet_directory() . '/pagenavi-css.css' ) )
|
||||
$css_file = get_stylesheet_directory_uri() . '/pagenavi-css.css';
|
||||
elseif ( @file_exists( get_template_directory() . '/pagenavi-css.css' ) )
|
||||
$css_file = get_template_directory_uri() . '/pagenavi-css.css';
|
||||
else
|
||||
$css_file = plugins_url( 'pagenavi-css.css', __FILE__ );
|
||||
|
||||
wp_enqueue_style( 'wp-pagenavi', $css_file, false, '2.70' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Default style for WP-PageNavi plugin
|
||||
|
||||
http://wordpress.org/extend/plugins/wp-pagenavi/
|
||||
*/
|
||||
|
||||
.wp-pagenavi {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.wp-pagenavi a, .wp-pagenavi span {
|
||||
text-decoration: none;
|
||||
border: 1px solid #BFBFBF;
|
||||
padding: 3px 5px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.wp-pagenavi a:hover, .wp-pagenavi span.current {
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
.wp-pagenavi span.current {
|
||||
font-weight: bold;
|
||||
}
|
||||
205
app/webroot/blog/wp-content/plugins/wp-pagenavi/readme.txt
Normal file
205
app/webroot/blog/wp-content/plugins/wp-pagenavi/readme.txt
Normal file
@@ -0,0 +1,205 @@
|
||||
# WP-PageNavi
|
||||
Contributors: GamerZ, scribu
|
||||
Donate link: https://lesterchan.net/site/donation/
|
||||
Tags: navigation, pagination, paging, pages
|
||||
Requires at least: 3.2
|
||||
Tested up to: 4.8
|
||||
Stable tag: 2.92
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Adds a more advanced paging navigation interface.
|
||||
|
||||
## Description
|
||||
Want to replace the old *← Older posts | Newer posts →* links with some page links?
|
||||
|
||||
This plugin provides the `wp_pagenavi()` template tag which generates fancy pagination links.
|
||||
|
||||
### Usage
|
||||
In your theme, you need to find calls to next_posts_link() and previous_posts_link() and replace them.
|
||||
|
||||
In the Twentyten theme, it looks like this:
|
||||
|
||||
~~~
|
||||
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>
|
||||
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
|
||||
~~~
|
||||
|
||||
You would replace those two lines with this:
|
||||
|
||||
`<?php wp_pagenavi(); ?>`
|
||||
|
||||
For multipart pages, you would look for code like this:
|
||||
|
||||
`<?php wp_link_pages( ... ); ?>`
|
||||
|
||||
and replace it with this:
|
||||
|
||||
`<?php wp_pagenavi( array( 'type' => 'multipart' ) ); ?>`
|
||||
|
||||
Go to *WP-Admin -> Settings -> PageNavi* for configuration.
|
||||
|
||||
### Changing the CSS
|
||||
|
||||
If you need to configure the CSS style of WP-PageNavi, you can copy the `pagenavi-css.css` file from the plugin directory to your theme's directory and make your modifications there. This way, you won't lose your changes when you update the plugin.
|
||||
|
||||
Alternatively, you can uncheck the "Use pagenavi.css?" option from the settings page and add the styles to your theme's style.css file directly.
|
||||
|
||||
### Changing Class Names
|
||||
|
||||
There are [filters](http://codex.wordpress.org/Glossary#Filter) that can be used to change the default class names that are assigned to page navigation elements.
|
||||
|
||||
#### Filters
|
||||
|
||||
* `wp_pagenavi_class_pages`
|
||||
* `wp_pagenavi_class_first`
|
||||
* `wp_pagenavi_class_previouspostslink`
|
||||
* `wp_pagenavi_class_extend`
|
||||
* `wp_pagenavi_class_smaller`
|
||||
* `wp_pagenavi_class_page`
|
||||
* `wp_pagenavi_class_current`
|
||||
* `wp_pagenavi_class_larger`
|
||||
* `wp_pagenavi_class_nextpostslink`
|
||||
* `wp_pagenavi_class_last`
|
||||
|
||||
#### Filter Usage
|
||||
|
||||
~~~
|
||||
// Simple Usage - 1 callback per filter
|
||||
add_filter('wp_pagenavi_class_previouspostslink', 'theme_pagination_previouspostslink_class');
|
||||
add_filter('wp_pagenavi_class_nextpostslink', 'theme_pagination_nextpostslink_class');
|
||||
add_filter('wp_pagenavi_class_page', 'theme_pagination_page_class');
|
||||
|
||||
function theme_pagination_previouspostslink_class($class_name) {
|
||||
return 'pagination__control-link pagination__control-link--previous';
|
||||
}
|
||||
|
||||
function theme_pagination_nextpostslink_class($class_name) {
|
||||
return 'pagination__control-link pagination__control-link--next';
|
||||
}
|
||||
|
||||
function theme_pagination_page_class($class_name) {
|
||||
return 'pagination__current-page';
|
||||
}
|
||||
|
||||
|
||||
// More Concise Usage - 1 callback for all filters
|
||||
add_filter('wp_pagenavi_class_previouspostslink', 'theme_pagination_class');
|
||||
add_filter('wp_pagenavi_class_nextpostslink', 'theme_pagination_class');
|
||||
add_filter('wp_pagenavi_class_page', 'theme_pagination_class');
|
||||
|
||||
function theme_pagination_class($class_name) {
|
||||
switch($class_name) {
|
||||
case 'previouspostslink':
|
||||
$class_name = 'pagination__control-link pagination__control-link--previous';
|
||||
break;
|
||||
case 'nextpostslink':
|
||||
$class_name = 'pagination__control-link pagination__control-link--next';
|
||||
break;
|
||||
case 'page':
|
||||
$class_name = 'pagination__current'
|
||||
break;
|
||||
}
|
||||
return $class_name;
|
||||
}
|
||||
~~~
|
||||
|
||||
### Build Status
|
||||
[](https://travis-ci.org/lesterchan/wp-pagenavi)
|
||||
|
||||
### Development
|
||||
* [https://github.com/lesterchan/wp-pagenavi](https://github.com/lesterchan/wp-pagenavi "https://github.com/lesterchan/wp-pagenavi")
|
||||
|
||||
### Credits
|
||||
* Plugin icon by [SimpleIcon](http://www.simpleicon.com) from [Flaticon](http://www.flaticon.com)
|
||||
|
||||
### Donations
|
||||
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
|
||||
|
||||
## Screenshots
|
||||
|
||||
1. With Custom Styling
|
||||
2. Admin - Options Page
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Error on activation: "Parse error: syntax error, unexpected..."
|
||||
|
||||
Make sure your host is running PHP 5. The only foolproof way to do this is to add this line to wp-config.php (after the opening `<?php` tag):
|
||||
|
||||
`var_dump(PHP_VERSION);`
|
||||
<br>
|
||||
|
||||
### When I go to page 2, I see the same posts as on page 1!
|
||||
|
||||
You're using `query_posts()` wrong. See [The Right Way To use query_posts()](http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html)
|
||||
|
||||
### Does PageNavi work with secondary WP_Query instances?
|
||||
|
||||
Yes; read [this tutorial](http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html)
|
||||
|
||||
### How do I ignore the options page?
|
||||
|
||||
If you are running a multi-language plugin, you will probably want to ignore the strings in the options page.
|
||||
|
||||
You can do that like so:
|
||||
|
||||
`<?php wp_pagenavi( array( 'options' => PageNavi_Core::$options->get_defaults() ) ); ?>`
|
||||
|
||||
## Changelog
|
||||
### 2.92
|
||||
* Add title attr to pages link. Props @Mahjouba91.
|
||||
|
||||
### 2.91
|
||||
* Validate text option against kses
|
||||
* Update SCB Framework
|
||||
|
||||
### 2.90
|
||||
* Remove po/mo files from the plugin
|
||||
* Use translate.wordpress.org to translate the plugin
|
||||
|
||||
### 2.89.1
|
||||
* FIXED: before and after args
|
||||
|
||||
### 2.89
|
||||
* NEW: wrapper_tag option to allow other HTML tag besides DIV and wrapper_class option to allow other class name besides wp-pagenavi. Props @Mahjouba91.
|
||||
|
||||
### 2.88
|
||||
* NEW: Added filters for altering class names. Props @bookwyrm
|
||||
|
||||
### 2.87
|
||||
* NEW: Uses WordPress native uninstall.php
|
||||
|
||||
### 2.86
|
||||
* NEW: Bump to 4.0
|
||||
* NEW: Added rel=next and rel=previous
|
||||
|
||||
### 2.85
|
||||
* FIXED: "Use pagenavi-css.css" & "Always Show Page Navigation" in the options are not being saved
|
||||
|
||||
### 2.84
|
||||
* FIXED: Updated scb framework to fix scbAdminPage incompatible error
|
||||
|
||||
### 2.83
|
||||
* added 'echo' parameter
|
||||
* added Estonian and Bengali translations
|
||||
* updated scbFramework
|
||||
|
||||
### 2.82
|
||||
* fixed prev/next links not appearing in some conditions
|
||||
* added Hebrew, Georgian and Azerbaijani translations
|
||||
* updated scbFramework
|
||||
|
||||
### 2.81
|
||||
* require an explicit type; fixes bugs with multipart pages
|
||||
|
||||
### 2.80
|
||||
* support for multi-part pages and user queries
|
||||
* moved prev/next links before/after first/last links
|
||||
* [more info](http://scribu.net/wordpress/wp-pagenavi/wpn-2-80.html)
|
||||
|
||||
### 2.74 (2011-02-17)
|
||||
* added 'smaller' and 'larger' classes
|
||||
* added $query arg to wp_pagenavi()
|
||||
* updated translations
|
||||
* [more info](http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html)
|
||||
@@ -0,0 +1,584 @@
|
||||
<?php
|
||||
/**
|
||||
* Administration page base class.
|
||||
*/
|
||||
abstract class scbAdminPage {
|
||||
/** Page args
|
||||
* $page_title string (mandatory)
|
||||
* $parent (string) (default: options-general.php)
|
||||
* $capability (string) (default: 'manage_options')
|
||||
* $menu_title (string) (default: $page_title)
|
||||
* $submenu_title (string) (default: $menu_title)
|
||||
* $page_slug (string) (default: sanitized $page_title)
|
||||
* $toplevel (string) If not empty, will create a new top level menu (for expected values see http://codex.wordpress.org/Administration_Menus#Using_add_submenu_page)
|
||||
* - $icon_url (string) URL to an icon for the top level menu
|
||||
* - $position (int) Position of the toplevel menu (caution!)
|
||||
* $screen_icon (string) The icon type to use in the screen header
|
||||
* $nonce string (default: $page_slug)
|
||||
* $action_link (string|bool) Text of the action link on the Plugins page (default: 'Settings')
|
||||
* $admin_action_priority int The priority that the admin_menu action should be executed at (default: 10)
|
||||
*/
|
||||
protected $args;
|
||||
|
||||
// URL to the current plugin directory.
|
||||
// Useful for adding css and js files
|
||||
protected $plugin_url;
|
||||
|
||||
// Created at page init
|
||||
protected $pagehook;
|
||||
|
||||
// scbOptions object holder
|
||||
// Normally, it's used for storing formdata
|
||||
protected $options;
|
||||
protected $option_name;
|
||||
|
||||
// l10n
|
||||
protected $textdomain;
|
||||
|
||||
|
||||
// ____________REGISTRATION COMPONENT____________
|
||||
|
||||
|
||||
private static $registered = array();
|
||||
|
||||
/**
|
||||
* Registers class of page.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $file
|
||||
* @param object $options (optional) A scbOptions object.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function register( $class, $file, $options = null ) {
|
||||
if ( isset( self::$registered[ $class ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self::$registered[ $class ] = array( $file, $options );
|
||||
|
||||
add_action( '_admin_menu', array( __CLASS__, '_pages_init' ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces class of page.
|
||||
*
|
||||
* @param string $old_class
|
||||
* @param string $new_class
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function replace( $old_class, $new_class ) {
|
||||
if ( ! isset( self::$registered[ $old_class ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self::$registered[ $new_class ] = self::$registered[ $old_class ];
|
||||
unset( self::$registered[ $old_class ] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes class of page.
|
||||
*
|
||||
* @param string $class
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function remove( $class ) {
|
||||
if ( ! isset( self::$registered[ $class ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unset( self::$registered[ $class ] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates classes of pages.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function _pages_init() {
|
||||
foreach ( self::$registered as $class => $args ) {
|
||||
new $class( $args[0], $args[1] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ____________MAIN METHODS____________
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|bool $file (optional)
|
||||
* @param object $options (optional) A scbOptions object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $file = false, $options = null ) {
|
||||
if ( is_a( $options, 'scbOptions' ) ) {
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
$this->check_args();
|
||||
|
||||
if ( isset( $this->option_name ) ) {
|
||||
add_action( 'admin_init', array( $this, 'option_init' ) );
|
||||
add_action( 'admin_notices', 'settings_errors' );
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', array( $this, 'page_init' ), $this->args['admin_action_priority'] );
|
||||
add_filter( 'contextual_help', array( $this, '_contextual_help' ), 10, 2 );
|
||||
|
||||
if ( $file ) {
|
||||
$this->file = $file;
|
||||
$this->plugin_url = plugin_dir_url( $file );
|
||||
|
||||
if ( $this->args['action_link'] ) {
|
||||
add_filter( 'plugin_action_links_' . plugin_basename( $file ), array( $this, '_action_link' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where all the page args can be set.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setup() { }
|
||||
|
||||
/**
|
||||
* Called when the page is loaded, but before any rendering.
|
||||
* Useful for calling $screen->add_help_tab() etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
$this->form_handler();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where the css and js go.
|
||||
* Both wp_enqueue_*() and inline code can be added.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function page_head() { }
|
||||
|
||||
/**
|
||||
* This is where the contextual help goes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function page_help() { }
|
||||
|
||||
/**
|
||||
* A generic page header.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function page_header() {
|
||||
echo "<div class='wrap'>\n";
|
||||
screen_icon( $this->args['screen_icon'] );
|
||||
echo html( 'h2', $this->args['page_title'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where the page content goes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function page_content();
|
||||
|
||||
/**
|
||||
* A generic page footer.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function page_footer() {
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where the form data should be validated.
|
||||
*
|
||||
* @param array $new_data
|
||||
* @param array $old_data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validate( $new_data, $old_data ) {
|
||||
return $new_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually handle option saving ( use Settings API instead ).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function form_handler() {
|
||||
if ( empty( $_POST['submit'] ) && empty( $_POST['action'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
check_admin_referer( $this->nonce );
|
||||
|
||||
if ( ! isset( $this->options ) ) {
|
||||
trigger_error( 'options handler not set', E_USER_WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
$new_data = wp_array_slice_assoc( $_POST, array_keys( $this->options->get_defaults() ) );
|
||||
|
||||
$new_data = stripslashes_deep( $new_data );
|
||||
|
||||
$new_data = $this->validate( $new_data, $this->options->get() );
|
||||
|
||||
$this->options->set( $new_data );
|
||||
|
||||
add_action( 'admin_notices', array( $this, 'admin_msg' ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually generate a standard admin notice ( use Settings API instead ).
|
||||
*
|
||||
* @param string $msg (optional)
|
||||
* @param string $class (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_msg( $msg = '', $class = 'updated' ) {
|
||||
if ( empty( $msg ) ) {
|
||||
$msg = __( 'Settings <strong>saved</strong>.', $this->textdomain );
|
||||
}
|
||||
|
||||
echo scb_admin_notice( $msg, $class );
|
||||
}
|
||||
|
||||
|
||||
// ____________UTILITIES____________
|
||||
|
||||
|
||||
/**
|
||||
* Generates a form submit button.
|
||||
*
|
||||
* @param string|array $value (optional) Button text or array of arguments.
|
||||
* @param string $action (optional)
|
||||
* @param string $class (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function submit_button( $value = '', $action = 'submit', $class = 'button' ) {
|
||||
|
||||
$args = is_array( $value ) ? $value : compact( 'value', 'action', 'class' );
|
||||
$args = wp_parse_args( $args, array(
|
||||
'value' => null,
|
||||
'action' => $action,
|
||||
'class' => $class,
|
||||
) );
|
||||
|
||||
return get_submit_button( $args['value'], $args['class'], $args['action'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Mimics scbForms::form_wrap()
|
||||
*
|
||||
* $this->form_wrap( $content ); // generates a form with a default submit button
|
||||
*
|
||||
* $this->form_wrap( $content, false ); // generates a form with no submit button
|
||||
*
|
||||
* // the second argument is sent to submit_button()
|
||||
* $this->form_wrap( $content, array(
|
||||
* 'text' => 'Save changes',
|
||||
* 'name' => 'action',
|
||||
* ) );
|
||||
*
|
||||
* @see scbForms::form_wrap()
|
||||
*
|
||||
* @param string $content
|
||||
* @param boolean|string|array $submit_button (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function form_wrap( $content, $submit_button = true ) {
|
||||
if ( is_array( $submit_button ) ) {
|
||||
$content .= $this->submit_button( $submit_button );
|
||||
} else if ( true === $submit_button ) {
|
||||
$content .= $this->submit_button();
|
||||
} else if ( false !== strpos( $submit_button, '<input' ) ) {
|
||||
$content .= $submit_button;
|
||||
} else if ( false !== strpos( $submit_button, '<button' ) ) {
|
||||
$content .= $submit_button;
|
||||
} else if ( false !== $submit_button ) {
|
||||
$button_args = array_slice( func_get_args(), 1 );
|
||||
$content .= call_user_func_array( array( $this, 'submit_button' ), $button_args );
|
||||
}
|
||||
|
||||
return scbForms::form_wrap( $content, $this->nonce );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a table wrapped in a form.
|
||||
*
|
||||
* @param array $rows
|
||||
* @param array|boolean $formdata (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function form_table( $rows, $formdata = false ) {
|
||||
$output = '';
|
||||
foreach ( $rows as $row ) {
|
||||
$output .= $this->table_row( $row, $formdata );
|
||||
}
|
||||
|
||||
$output = $this->form_table_wrap( $output );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the given content in a <form><table>
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function form_table_wrap( $content ) {
|
||||
$output = $this->table_wrap( $content );
|
||||
$output = $this->form_wrap( $output );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a form table.
|
||||
*
|
||||
* @param array $rows
|
||||
* @param array|boolean $formdata (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function table( $rows, $formdata = false ) {
|
||||
$output = '';
|
||||
foreach ( $rows as $row ) {
|
||||
$output .= $this->table_row( $row, $formdata );
|
||||
}
|
||||
|
||||
$output = $this->table_wrap( $output );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a table row.
|
||||
*
|
||||
* @param array $args
|
||||
* @param array|boolean $formdata (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function table_row( $args, $formdata = false ) {
|
||||
return $this->row_wrap( $args['title'], $this->input( $args, $formdata ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Mimic scbForms inheritance.
|
||||
*
|
||||
* @see scbForms
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call( $method, $args ) {
|
||||
if ( in_array( $method, array( 'input', 'form' ) ) ) {
|
||||
if ( empty( $args[1] ) && isset( $this->options ) ) {
|
||||
$args[1] = $this->options->get();
|
||||
}
|
||||
|
||||
if ( 'form' == $method ) {
|
||||
$args[2] = $this->nonce;
|
||||
}
|
||||
}
|
||||
|
||||
return call_user_func_array( array( 'scbForms', $method ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a string in a <script> tag.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function js_wrap( $string ) {
|
||||
return html( "script type='text/javascript'", $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a string in a <style> tag.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function css_wrap( $string ) {
|
||||
return html( "style type='text/css'", $string );
|
||||
}
|
||||
|
||||
|
||||
// ____________INTERNAL METHODS____________
|
||||
|
||||
|
||||
/**
|
||||
* Registers a page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function page_init() {
|
||||
|
||||
if ( ! $this->args['toplevel'] ) {
|
||||
$this->pagehook = add_submenu_page(
|
||||
$this->args['parent'],
|
||||
$this->args['page_title'],
|
||||
$this->args['menu_title'],
|
||||
$this->args['capability'],
|
||||
$this->args['page_slug'],
|
||||
array( $this, '_page_content_hook' )
|
||||
);
|
||||
} else {
|
||||
$func = 'add_' . $this->args['toplevel'] . '_page';
|
||||
$this->pagehook = $func(
|
||||
$this->args['page_title'],
|
||||
$this->args['menu_title'],
|
||||
$this->args['capability'],
|
||||
$this->args['page_slug'],
|
||||
null,
|
||||
$this->args['icon_url'],
|
||||
$this->args['position']
|
||||
);
|
||||
|
||||
add_submenu_page(
|
||||
$this->args['page_slug'],
|
||||
$this->args['page_title'],
|
||||
$this->args['submenu_title'],
|
||||
$this->args['capability'],
|
||||
$this->args['page_slug'],
|
||||
array( $this, '_page_content_hook' )
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! $this->pagehook ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'load-' . $this->pagehook, array( $this, 'page_loaded' ) );
|
||||
|
||||
add_action( 'admin_print_styles-' . $this->pagehook, array( $this, 'page_head' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function option_init() {
|
||||
register_setting( $this->option_name, $this->option_name, array( $this, 'validate' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks page args.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function check_args() {
|
||||
if ( empty( $this->args['page_title'] ) ) {
|
||||
trigger_error( 'Page title cannot be empty', E_USER_WARNING );
|
||||
}
|
||||
|
||||
$this->args = wp_parse_args( $this->args, array(
|
||||
'toplevel' => '',
|
||||
'position' => null,
|
||||
'icon_url' => '',
|
||||
'screen_icon' => '',
|
||||
'parent' => 'options-general.php',
|
||||
'capability' => 'manage_options',
|
||||
'menu_title' => $this->args['page_title'],
|
||||
'page_slug' => '',
|
||||
'nonce' => '',
|
||||
'action_link' => __( 'Settings', $this->textdomain ),
|
||||
'admin_action_priority' => 10,
|
||||
) );
|
||||
|
||||
if ( empty( $this->args['submenu_title'] ) ) {
|
||||
$this->args['submenu_title'] = $this->args['menu_title'];
|
||||
}
|
||||
|
||||
if ( empty( $this->args['page_slug'] ) ) {
|
||||
$this->args['page_slug'] = sanitize_title_with_dashes( $this->args['menu_title'] );
|
||||
}
|
||||
|
||||
if ( empty( $this->args['nonce'] ) ) {
|
||||
$this->nonce = $this->args['page_slug'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds contextual help.
|
||||
*
|
||||
* @param string $help
|
||||
* @param string|object $screen
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function _contextual_help( $help, $screen ) {
|
||||
if ( is_object( $screen ) ) {
|
||||
$screen = $screen->id;
|
||||
}
|
||||
|
||||
$actual_help = $this->page_help();
|
||||
|
||||
if ( $screen == $this->pagehook && $actual_help ) {
|
||||
return $actual_help;
|
||||
}
|
||||
|
||||
return $help;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays page content.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _page_content_hook() {
|
||||
$this->page_header();
|
||||
$this->page_content();
|
||||
$this->page_footer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an action link.
|
||||
*
|
||||
* @param array $links
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _action_link( $links ) {
|
||||
$url = add_query_arg( 'page', $this->args['page_slug'], admin_url( $this->args['parent'] ) );
|
||||
|
||||
$links[] = html_link( $url, $this->args['action_link'] );
|
||||
|
||||
return $links;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,341 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin screen with metaboxes base class.
|
||||
*/
|
||||
abstract class scbBoxesPage extends scbAdminPage {
|
||||
/*
|
||||
A box definition looks like this:
|
||||
array( $slug, $title, $column );
|
||||
|
||||
Available columns: normal, side, column3, column4
|
||||
*/
|
||||
protected $boxes = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|bool $file (optional)
|
||||
* @param object $options (optional) A scbOptions object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $file = false, $options = null ) {
|
||||
parent::__construct( $file, $options );
|
||||
|
||||
scbUtil::add_uninstall_hook( $this->file, array( $this, 'uninstall' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function page_init() {
|
||||
if ( ! isset( $this->args['columns'] ) ) {
|
||||
$this->args['columns'] = 2;
|
||||
}
|
||||
|
||||
parent::page_init();
|
||||
|
||||
add_action( 'load-' . $this->pagehook, array( $this, 'boxes_init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints default CSS styles.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function default_css() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
.postbox-container + .postbox-container {
|
||||
margin-left: 18px;
|
||||
}
|
||||
.postbox-container {
|
||||
padding-right: 0;
|
||||
}
|
||||
.inside {
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
}
|
||||
.inside table {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.inside table td {
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
.inside table .regular-text {
|
||||
width: 100% !important;
|
||||
}
|
||||
.inside .form-table th {
|
||||
width: 30%;
|
||||
max-width: 200px;
|
||||
padding: 10px 0 !important;
|
||||
}
|
||||
.inside .widefat .check-column {
|
||||
padding-bottom: 7px !important;
|
||||
}
|
||||
.inside p,
|
||||
.inside table {
|
||||
margin: 0 0 10px !important;
|
||||
}
|
||||
.inside p.submit {
|
||||
float: left !important;
|
||||
padding: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.meta-box-sortables {
|
||||
min-height: 100px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays page content.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function page_content() {
|
||||
$this->default_css();
|
||||
|
||||
global $screen_layout_columns;
|
||||
|
||||
if ( isset( $screen_layout_columns ) ) {
|
||||
$hide2 = $hide3 = $hide4 = '';
|
||||
switch ( $screen_layout_columns ) {
|
||||
case 4:
|
||||
if ( ! isset( $this->args['column_widths'] ) ) {
|
||||
$this->args['column_widths'] = array( 24.5, 24.5, 24.5, 24.5 );
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ( ! isset( $this->args['column_widths'] ) ) {
|
||||
$this->args['column_widths'] = array( 32.67, 32.67, 32.67 );
|
||||
}
|
||||
$hide4 = 'display:none;';
|
||||
break;
|
||||
case 2:
|
||||
if ( ! isset( $this->args['column_widths'] ) ) {
|
||||
$this->args['column_widths'] = array( 49, 49 );
|
||||
}
|
||||
$hide3 = $hide4 = 'display:none;';
|
||||
break;
|
||||
default:
|
||||
if ( ! isset( $this->args['column_widths'] ) ) {
|
||||
$this->args['column_widths'] = array( 98 );
|
||||
}
|
||||
$hide2 = $hide3 = $hide4 = 'display:none;';
|
||||
}
|
||||
|
||||
$this->args['column_widths'] = array_pad( $this->args['column_widths'], 4, 0 );
|
||||
}
|
||||
?>
|
||||
<div id='<?php echo $this->pagehook; ?>-widgets' class='metabox-holder'>
|
||||
<?php
|
||||
echo "\t<div class='postbox-container' style='width:{$this->args['column_widths'][0]}%'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'normal', '' );
|
||||
|
||||
echo "\t</div><div class='postbox-container' style='width:{$hide2}{$this->args['column_widths'][1]}%'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'side', '' );
|
||||
|
||||
echo "\t</div><div class='postbox-container' style='width:{$hide3}{$this->args['column_widths'][2]}%'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'column3', '' );
|
||||
|
||||
echo "\t</div><div class='postbox-container' style='width:{$hide4}{$this->args['column_widths'][3]}%'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'column4', '' );
|
||||
?>
|
||||
</div></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays page footer.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function page_footer() {
|
||||
parent::page_footer();
|
||||
$this->_boxes_js_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles option saving.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function form_handler() {
|
||||
if ( empty( $_POST ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
check_admin_referer( $this->nonce );
|
||||
|
||||
// Box handler
|
||||
foreach ( $this->boxes as $box ) {
|
||||
$args = isset( $box[4] ) ? $box[4] : array();
|
||||
|
||||
$handler = $box[0] . '_handler';
|
||||
|
||||
if ( method_exists( $this, $handler ) ) {
|
||||
call_user_func_array( array( $this, $handler ), $args );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls boxes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function uninstall() {
|
||||
global $wpdb;
|
||||
|
||||
$hook = str_replace( '-', '', $this->pagehook );
|
||||
|
||||
foreach ( array( 'metaboxhidden', 'closedpostboxes', 'wp_metaboxorder', 'screen_layout' ) as $option ) {
|
||||
$keys[] = "'{$option}_{$hook}'";
|
||||
}
|
||||
|
||||
$keys = '( ' . implode( ', ', $keys ) . ' )';
|
||||
|
||||
$wpdb->query( "
|
||||
DELETE FROM {$wpdb->usermeta}
|
||||
WHERE meta_key IN {$keys}
|
||||
" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds boxes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boxes_init() {
|
||||
wp_enqueue_script( 'postbox' );
|
||||
|
||||
add_screen_option( 'layout_columns', array(
|
||||
'max' => $this->args['columns'],
|
||||
'default' => $this->args['columns']
|
||||
) );
|
||||
|
||||
$registered = array();
|
||||
|
||||
foreach ( $this->boxes as $box_args ) {
|
||||
$box_args = self::numeric_to_assoc( $box_args, array( 'name', 'title', 'context', 'priority', 'args' ) );
|
||||
|
||||
$defaults = array(
|
||||
'title' => ucfirst( $box_args['name'] ),
|
||||
'context' => 'normal',
|
||||
'priority' => 'default',
|
||||
'args' => array()
|
||||
);
|
||||
$box_args = array_merge( $defaults, $box_args );
|
||||
|
||||
$name = $box_args['name'];
|
||||
|
||||
if ( isset( $registered[ $name ] ) ) {
|
||||
if ( empty( $box_args['args'] ) ) {
|
||||
trigger_error( "Duplicate box name: $name", E_USER_NOTICE );
|
||||
}
|
||||
|
||||
$name = $this->_increment( $name );
|
||||
} else {
|
||||
$registered[ $name ] = true;
|
||||
}
|
||||
|
||||
add_meta_box(
|
||||
$name,
|
||||
$box_args['title'],
|
||||
array( $this, '_intermediate_callback' ),
|
||||
$this->pagehook,
|
||||
$box_args['context'],
|
||||
$box_args['priority'],
|
||||
$box_args['args']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms numeric array to associative.
|
||||
*
|
||||
* @param array $argv
|
||||
* @param array $keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function numeric_to_assoc( $argv, $keys ) {
|
||||
$args = array();
|
||||
|
||||
foreach ( $keys as $i => $key ) {
|
||||
if ( isset( $argv[ $i ] ) ) {
|
||||
$args[ $key ] = $argv[ $i ];
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Since we don't pass an object to do_meta_boxes(),
|
||||
* pass $box['args'] directly to each method.
|
||||
*
|
||||
* @param string $_
|
||||
* @param array $box
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _intermediate_callback( $_, $box ) {
|
||||
list( $name ) = explode( '-', $box['id'] );
|
||||
|
||||
call_user_func_array( array( $this, $name . '_box' ), $box['args'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds/Increments ID in box name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _increment( $name ) {
|
||||
$parts = explode( '-', $name );
|
||||
if ( isset( $parts[1] ) ) {
|
||||
$parts[1]++;
|
||||
} else {
|
||||
$parts[1] = 2;
|
||||
}
|
||||
|
||||
return implode( '-', $parts );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds necesary code for JS to work.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _boxes_js_init() {
|
||||
echo $this->js_wrap( <<<EOT
|
||||
jQuery( document ).ready( function( $ ){
|
||||
// close postboxes that should be closed
|
||||
$( '.if-js-closed' ).removeClass( 'if-js-closed' ).addClass( 'closed' );
|
||||
// postboxes setup
|
||||
postboxes.add_postbox_toggles( '$this->pagehook' );
|
||||
} );
|
||||
EOT
|
||||
);
|
||||
?>
|
||||
|
||||
<form style='display: none' method='get' action=''>
|
||||
<p>
|
||||
<?php
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||
?>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
220
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Cron.php
Normal file
220
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Cron.php
Normal file
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Cron job container.
|
||||
*/
|
||||
class scbCron {
|
||||
protected $schedule;
|
||||
protected $interval;
|
||||
protected $time;
|
||||
|
||||
protected $hook;
|
||||
protected $callback_args = array();
|
||||
|
||||
/**
|
||||
* Create a new cron job.
|
||||
*
|
||||
* @param string|bool $file (optional) Reference to main plugin file
|
||||
* @param array $args List of args:
|
||||
* string $action OR callback $callback
|
||||
* string $schedule OR number $interval
|
||||
* array $callback_args (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $file = false, $args ) {
|
||||
|
||||
// Set time & schedule
|
||||
if ( isset( $args['time'] ) ) {
|
||||
$this->time = $args['time'];
|
||||
}
|
||||
|
||||
if ( isset( $args['interval'] ) ) {
|
||||
$this->schedule = $args['interval'] . 'secs';
|
||||
$this->interval = $args['interval'];
|
||||
} elseif ( isset( $args['schedule'] ) ) {
|
||||
$this->schedule = $args['schedule'];
|
||||
}
|
||||
|
||||
// Set hook
|
||||
if ( isset( $args['action'] ) ) {
|
||||
$this->hook = $args['action'];
|
||||
} else if ( isset( $args['callback'] ) ) {
|
||||
$this->hook = self::_callback_to_string( $args['callback'] );
|
||||
add_action( $this->hook, $args['callback'] );
|
||||
} else if ( method_exists( $this, 'callback' ) ) {
|
||||
$this->hook = self::_callback_to_string( array( $this, 'callback' ) );
|
||||
add_action( $this->hook, $args['callback'] );
|
||||
} else {
|
||||
trigger_error( '$action OR $callback not set', E_USER_WARNING );
|
||||
}
|
||||
|
||||
if ( isset( $args['callback_args'] ) ) {
|
||||
$this->callback_args = (array) $args['callback_args'];
|
||||
}
|
||||
|
||||
if ( $file && $this->schedule ) {
|
||||
scbUtil::add_activation_hook( $file, array( $this, 'reset' ) );
|
||||
register_deactivation_hook( $file, array( $this, 'unschedule' ) );
|
||||
}
|
||||
|
||||
add_filter( 'cron_schedules', array( $this, '_add_timing' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the interval of the cron job.
|
||||
*
|
||||
* @param array $args List of args:
|
||||
* string $schedule OR number $interval
|
||||
* timestamp $time ( optional )
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reschedule( $args ) {
|
||||
|
||||
if ( $args['schedule'] && $this->schedule != $args['schedule'] ) {
|
||||
$this->schedule = $args['schedule'];
|
||||
} elseif ( $args['interval'] && $this->interval != $args['interval'] ) {
|
||||
$this->schedule = $args['interval'] . 'secs';
|
||||
$this->interval = $args['interval'];
|
||||
}
|
||||
|
||||
$this->time = $args['time'];
|
||||
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the schedule.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset() {
|
||||
$this->unschedule();
|
||||
$this->schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cron job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unschedule() {
|
||||
# wp_clear_scheduled_hook( $this->hook, $this->callback_args );
|
||||
self::really_clear_scheduled_hook( $this->hook );
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job now.
|
||||
*
|
||||
* @param array $args (optional) List of arguments to pass to the callback.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function do_now( $args = null ) {
|
||||
if ( is_null( $args ) ) {
|
||||
$args = $this->callback_args;
|
||||
}
|
||||
|
||||
do_action_ref_array( $this->hook, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job with a given delay.
|
||||
*
|
||||
* @param int $delay (optional) Delay in seconds.
|
||||
* @param array $args (optional) List of arguments to pass to the callback.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function do_once( $delay = 0, $args = null ) {
|
||||
if ( is_null( $args ) ) {
|
||||
$args = $this->callback_args;
|
||||
}
|
||||
|
||||
wp_clear_scheduled_hook( $this->hook, $args );
|
||||
wp_schedule_single_event( time() + $delay, $this->hook, $args );
|
||||
}
|
||||
|
||||
|
||||
//_____INTERNAL METHODS_____
|
||||
|
||||
/**
|
||||
* Adds custom schedule timing.
|
||||
*
|
||||
* @param array $schedules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _add_timing( $schedules ) {
|
||||
if ( isset( $schedules[ $this->schedule ] ) ) {
|
||||
return $schedules;
|
||||
}
|
||||
|
||||
$schedules[ $this->schedule ] = array(
|
||||
'interval' => $this->interval,
|
||||
'display' => $this->interval . ' seconds',
|
||||
);
|
||||
|
||||
return $schedules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule() {
|
||||
if ( ! $this->time ) {
|
||||
$this->time = time();
|
||||
}
|
||||
|
||||
wp_schedule_event( $this->time, $this->schedule, $this->hook, $this->callback_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears scheduled job.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function really_clear_scheduled_hook( $name ) {
|
||||
$crons = _get_cron_array();
|
||||
|
||||
foreach ( $crons as $timestamp => $hooks ) {
|
||||
foreach ( $hooks as $hook => $args ) {
|
||||
if ( $hook == $name ) {
|
||||
unset( $crons[ $timestamp ][ $hook ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $crons[ $timestamp ] ) ) {
|
||||
unset( $crons[ $timestamp ] );
|
||||
}
|
||||
}
|
||||
|
||||
_set_cron_array( $crons );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a hook name from given callback.
|
||||
*
|
||||
* @param callback $callback
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function _callback_to_string( $callback ) {
|
||||
if ( ! is_array( $callback ) ) {
|
||||
$str = $callback;
|
||||
} else if ( ! is_string( $callback[0] ) ) {
|
||||
$str = get_class( $callback[0] ) . '_' . $callback[1];
|
||||
} else {
|
||||
$str = $callback[0] . '::' . $callback[1];
|
||||
}
|
||||
|
||||
$str .= '_hook';
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
1052
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Forms.php
Normal file
1052
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Forms.php
Normal file
File diff suppressed because it is too large
Load Diff
119
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Hooks.php
Normal file
119
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Hooks.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Automatic filter binding.
|
||||
*/
|
||||
class scbHooks {
|
||||
private static $mangle_name;
|
||||
|
||||
/**
|
||||
* Adds.
|
||||
*
|
||||
* @param string $class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function add( $class ) {
|
||||
self::_do( 'add_filter', $class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes.
|
||||
*
|
||||
* @param string $class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function remove( $class ) {
|
||||
self::_do( 'remove_filter', $class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints debug.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $mangle_name (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function debug( $class, $mangle_name = false ) {
|
||||
self::$mangle_name = $mangle_name;
|
||||
|
||||
echo "<pre>";
|
||||
self::_do( array( __CLASS__, '_print' ), $class );
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints.
|
||||
*
|
||||
* @param string $tag
|
||||
* @param array $callback
|
||||
* @param int $prio
|
||||
* @param int $argc
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _print( $tag, $callback, $prio, $argc ) {
|
||||
$static = ! is_object( $callback[0] );
|
||||
|
||||
if ( self::$mangle_name ) {
|
||||
$class = $static ? '__CLASS__' : '$this';
|
||||
} else if ( $static ) {
|
||||
$class = "'" . $callback[0] . "'";
|
||||
} else {
|
||||
$class = '$' . get_class( $callback[0] );
|
||||
}
|
||||
|
||||
$func = "array( $class, '$callback[1]' )";
|
||||
|
||||
echo "add_filter( '$tag', $func";
|
||||
|
||||
if ( $prio != 10 || $argc > 1 ) {
|
||||
echo ", $prio";
|
||||
|
||||
if ( $argc > 1 ) {
|
||||
echo ", $argc";
|
||||
}
|
||||
}
|
||||
|
||||
echo " );\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes.
|
||||
*
|
||||
* @param string $action
|
||||
* @param string $class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _do( $action, $class ) {
|
||||
$reflection = new ReflectionClass( $class );
|
||||
|
||||
foreach ( $reflection->getMethods() as $method ) {
|
||||
if ( $method->isPublic() && ! $method->isConstructor() ) {
|
||||
$comment = $method->getDocComment();
|
||||
|
||||
if ( preg_match( '/@nohook[ \t\*\n]+/', $comment ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
preg_match_all( '/@hook:?\s+([^\s]+)/', $comment, $matches ) ? $matches[1] : $method->name;
|
||||
if ( empty( $matches[1] ) ) {
|
||||
$hooks = array( $method->name );
|
||||
} else {
|
||||
$hooks = $matches[1];
|
||||
}
|
||||
|
||||
$priority = preg_match( '/@priority:?\s+(\d+)/', $comment, $matches ) ? $matches[1] : 10;
|
||||
|
||||
foreach ( $hooks as $hook ) {
|
||||
call_user_func( $action, $hook, array( $class, $method->name ), $priority, $method->getNumberOfParameters() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
196
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Options.php
Normal file
196
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Options.php
Normal file
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* Container for an array of options.
|
||||
*/
|
||||
class scbOptions {
|
||||
|
||||
/**
|
||||
* The option name.
|
||||
* @var string
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* The default values.
|
||||
* @var array
|
||||
*/
|
||||
protected $defaults;
|
||||
|
||||
/**
|
||||
* Used by WP hooks.
|
||||
* @var null
|
||||
*/
|
||||
public $wp_filter_id;
|
||||
|
||||
/**
|
||||
* Create a new set of options.
|
||||
*
|
||||
* @param string $key Option name.
|
||||
* @param string $file Reference to main plugin file.
|
||||
* @param array $defaults (optional) An associative array of default values.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $key, $file, $defaults = array() ) {
|
||||
$this->key = $key;
|
||||
$this->defaults = $defaults;
|
||||
|
||||
if ( $file ) {
|
||||
scbUtil::add_activation_hook( $file, array( $this, '_activation' ) );
|
||||
scbUtil::add_uninstall_hook( $file, array( $this, 'delete' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns option name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_key() {
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get option values for one or all fields.
|
||||
*
|
||||
* @param string|array $field (optional) The field to get.
|
||||
* @param mixed $default (optional) The value returned when the key is not found.
|
||||
*
|
||||
* @return mixed Whatever is in those fields.
|
||||
*/
|
||||
public function get( $field = null, $default = null ) {
|
||||
$data = array_merge( $this->defaults, get_option( $this->key, array() ) );
|
||||
|
||||
return scbForms::get_value( $field, $data, $default );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default values for one or all fields.
|
||||
*
|
||||
* @param string|array $field (optional) The field to get.
|
||||
*
|
||||
* @return mixed Whatever is in those fields.
|
||||
*/
|
||||
public function get_defaults( $field = null ) {
|
||||
return scbForms::get_value( $field, $this->defaults );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all data fields, certain fields or a single field.
|
||||
*
|
||||
* @param string|array $field The field to update or an associative array.
|
||||
* @param mixed $value (optional) The new value ( ignored if $field is array ).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set( $field, $value = '' ) {
|
||||
if ( is_array( $field ) ) {
|
||||
$newdata = $field;
|
||||
} else {
|
||||
$newdata = array( $field => $value );
|
||||
}
|
||||
|
||||
$this->update( array_merge( $this->get(), $newdata ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset option to defaults.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset() {
|
||||
$this->update( $this->defaults, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any keys that are not in the defaults array.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cleanup() {
|
||||
$this->update( $this->get(), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update raw data.
|
||||
*
|
||||
* @param mixed $newdata
|
||||
* @param bool $clean (optional) Whether to remove unrecognized keys or not.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function update( $newdata, $clean = true ) {
|
||||
if ( $clean ) {
|
||||
$newdata = $this->_clean( $newdata );
|
||||
}
|
||||
|
||||
update_option( $this->key, array_merge( $this->get(), $newdata ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete() {
|
||||
delete_option( $this->key );
|
||||
}
|
||||
|
||||
|
||||
//_____INTERNAL METHODS_____
|
||||
|
||||
|
||||
/**
|
||||
* Saves an extra query.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _activation() {
|
||||
add_option( $this->key, $this->defaults );
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep only the keys defined in $this->defaults
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _clean( $data ) {
|
||||
return wp_array_slice_assoc( $data, array_keys( $this->defaults ) );
|
||||
}
|
||||
|
||||
private function &_get( $field, $data ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method: $options->field
|
||||
*
|
||||
* @param string|array $field The field to get.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get( $field ) {
|
||||
return $this->get( $field );
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method: $options->field = $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __set( $field, $value ) {
|
||||
$this->set( $field, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method: isset( $options->field )
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset( $field ) {
|
||||
$data = $this->get();
|
||||
return isset( $data[ $field ] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
<?php
|
||||
/**
|
||||
* Class that creates metaboxes on the post editing page.
|
||||
*/
|
||||
class scbPostMetabox {
|
||||
|
||||
/**
|
||||
* Metabox ID.
|
||||
* @var string
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Title.
|
||||
* @var string
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Post types.
|
||||
* @var array
|
||||
*/
|
||||
private $post_types;
|
||||
|
||||
/**
|
||||
* Post meta data.
|
||||
* @var array
|
||||
*/
|
||||
private $post_data = array();
|
||||
|
||||
/**
|
||||
* Action hooks.
|
||||
* @var array
|
||||
*/
|
||||
protected $actions = array( 'admin_enqueue_scripts', 'post_updated_messages' );
|
||||
|
||||
/**
|
||||
* Sets up metabox.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $title
|
||||
* @param array $args (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $id, $title, $args = array() ) {
|
||||
$this->id = $id;
|
||||
$this->title = $title;
|
||||
|
||||
$args = wp_parse_args( $args, array(
|
||||
'post_type' => 'post',
|
||||
'context' => 'advanced',
|
||||
'priority' => 'default',
|
||||
) );
|
||||
|
||||
if ( is_string( $args['post_type'] ) ) {
|
||||
$args['post_type'] = array( $args['post_type'] );
|
||||
}
|
||||
|
||||
$this->post_types = $args['post_type'];
|
||||
$this->context = $args['context'];
|
||||
$this->priority = $args['priority'];
|
||||
|
||||
add_action( 'load-post.php', array( $this, 'pre_register' ) );
|
||||
add_action( 'load-post-new.php', array( $this, 'pre_register' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre register the metabox.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
final public function pre_register() {
|
||||
if ( ! in_array( get_current_screen()->post_type, $this->post_types ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $this->condition() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_GET['post'] ) ) {
|
||||
$this->post_data = $this->get_meta( intval( $_GET['post'] ) );
|
||||
}
|
||||
|
||||
add_action( 'add_meta_boxes', array( $this, 'register' ) );
|
||||
add_action( 'save_post', array( $this, '_save_post' ), 10, 2 );
|
||||
|
||||
foreach ( $this->actions as $action ) {
|
||||
if ( method_exists( $this, $action ) ) {
|
||||
add_action( $action, array( $this, $action ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional checks before registering the metabox.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function condition() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the metabox.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
final public function register() {
|
||||
add_meta_box( $this->id, $this->title, array( $this, 'display' ), null, $this->context, $this->priority );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter data before display.
|
||||
*
|
||||
* @param array $form_data
|
||||
* @param object $post
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function before_display( $form_data, $post ) {
|
||||
return $form_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays metabox content.
|
||||
*
|
||||
* @param object $post
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function display( $post ) {
|
||||
$form_fields = $this->form_fields();
|
||||
if ( ! $form_fields ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$form_data = $this->post_data;
|
||||
$error_fields = array();
|
||||
|
||||
if ( isset( $form_data['_error_data_' . $this->id ] ) ) {
|
||||
$data = maybe_unserialize( $form_data['_error_data_' . $this->id ] );
|
||||
|
||||
$error_fields = $data['fields'];
|
||||
$form_data = $data['data'];
|
||||
|
||||
$this->display_notices( $data['messages'], 'error' );
|
||||
}
|
||||
|
||||
$form_data = $this->before_display( $form_data, $post );
|
||||
|
||||
$this->before_form( $post );
|
||||
echo $this->table( $form_fields, $form_data, $error_fields );
|
||||
$this->after_form( $post );
|
||||
|
||||
delete_post_meta( $post->ID, '_error_data_' . $this->id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns table.
|
||||
*
|
||||
* @param array $rows
|
||||
* @param array $formdata
|
||||
* @param array $errors (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function table( $rows, $formdata, $errors = array() ) {
|
||||
$output = '';
|
||||
foreach ( $rows as $row ) {
|
||||
$output .= $this->table_row( $row, $formdata, $errors );
|
||||
}
|
||||
|
||||
$output = scbForms::table_wrap( $output );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns table row.
|
||||
*
|
||||
* @param array $row
|
||||
* @param array $formdata
|
||||
* @param array $errors (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function table_row( $row, $formdata, $errors = array() ) {
|
||||
$input = scbForms::input( $row, $formdata );
|
||||
|
||||
// If row has an error, highlight it
|
||||
$style = ( in_array( $row['name'], $errors ) ) ? 'style="background-color: #FFCCCC"' : '';
|
||||
|
||||
return html( 'tr',
|
||||
html( "th $style scope='row'", $row['title'] ),
|
||||
html( "td $style", $input )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays notices.
|
||||
*
|
||||
* @param array|string $notices
|
||||
* @param string $class (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function display_notices( $notices, $class = 'updated' ) {
|
||||
// add inline class so the notices stays in metabox
|
||||
$class .= ' inline';
|
||||
|
||||
foreach ( (array) $notices as $notice ) {
|
||||
echo scb_admin_notice( $notice, $class );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display some extra HTML before the form.
|
||||
*
|
||||
* @param object $post
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function before_form( $post ) { }
|
||||
|
||||
/**
|
||||
* Return an array of form fields.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function form_fields() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display some extra HTML after the form.
|
||||
*
|
||||
* @param object $post
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function after_form( $post ) { }
|
||||
|
||||
/**
|
||||
* Makes sure that the saving occurs only for the post being edited.
|
||||
*
|
||||
* @param int $post_id
|
||||
* @param object $post
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
final public function _save_post( $post_id, $post ) {
|
||||
if ( ! isset( $_POST['action'] ) || $_POST['action'] != 'editpost' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! in_array( $post->post_type, $this->post_types ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->save( $post->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves metabox form data.
|
||||
*
|
||||
* @param int $post_id
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function save( $post_id ) {
|
||||
$form_fields = $this->form_fields();
|
||||
|
||||
$to_update = scbForms::validate_post_data( $form_fields );
|
||||
|
||||
// Filter data
|
||||
$to_update = $this->before_save( $to_update, $post_id );
|
||||
|
||||
// Validate dataset
|
||||
$is_valid = $this->validate_post_data( $to_update, $post_id );
|
||||
if ( $is_valid instanceof WP_Error && $is_valid->get_error_codes() ) {
|
||||
|
||||
$error_data = array(
|
||||
'fields' => $is_valid->get_error_codes(),
|
||||
'messages' => $is_valid->get_error_messages(),
|
||||
'data' => $to_update,
|
||||
);
|
||||
update_post_meta( $post_id, '_error_data_' . $this->id, $error_data );
|
||||
|
||||
$location = add_query_arg( 'message', 1, get_edit_post_link( $post_id, 'url' ) );
|
||||
wp_redirect( esc_url_raw( apply_filters( 'redirect_post_location', $location, $post_id ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach ( $to_update as $key => $value ) {
|
||||
update_post_meta( $post_id, $key, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter data before save.
|
||||
*
|
||||
* @param array $post_data
|
||||
* @param int $post_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function before_save( $post_data, $post_id ) {
|
||||
return $post_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate posted data.
|
||||
*
|
||||
* @param array $post_data
|
||||
* @param int $post_id
|
||||
*
|
||||
* @return bool|object A WP_Error object if posted data are invalid.
|
||||
*/
|
||||
protected function validate_post_data( $post_data, $post_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of post meta.
|
||||
*
|
||||
* @param int $post_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_meta( $post_id ) {
|
||||
$meta = get_post_custom( $post_id );
|
||||
foreach ( $meta as $key => $values ) {
|
||||
$meta[ $key ] = maybe_unserialize( $meta[ $key ][0] );
|
||||
}
|
||||
|
||||
return $meta;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Takes care of creating, updating and deleting database tables.
|
||||
*/
|
||||
class scbTable {
|
||||
|
||||
/**
|
||||
* The table name.
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* The table columns.
|
||||
* @var string
|
||||
*/
|
||||
protected $columns;
|
||||
|
||||
/**
|
||||
* The upgrade method.
|
||||
* @var string
|
||||
*/
|
||||
protected $upgrade_method;
|
||||
|
||||
/**
|
||||
* Sets up table.
|
||||
*
|
||||
* @param string $name Table name.
|
||||
* @param string $file Reference to main plugin file.
|
||||
* @param string $columns The SQL columns for the CREATE TABLE statement.
|
||||
* @param array $upgrade_method (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $name, $file, $columns, $upgrade_method = 'dbDelta' ) {
|
||||
$this->name = $name;
|
||||
$this->columns = $columns;
|
||||
$this->upgrade_method = $upgrade_method;
|
||||
|
||||
scb_register_table( $name );
|
||||
|
||||
if ( $file ) {
|
||||
scbUtil::add_activation_hook( $file, array( $this, 'install' ) );
|
||||
scbUtil::add_uninstall_hook( $file, array( $this, 'uninstall' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function install() {
|
||||
scb_install_table( $this->name, $this->columns, $this->upgrade_method );
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function uninstall() {
|
||||
scb_uninstall_table( $this->name );
|
||||
}
|
||||
}
|
||||
|
||||
476
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Util.php
Normal file
476
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Util.php
Normal file
@@ -0,0 +1,476 @@
|
||||
<?php
|
||||
/**
|
||||
* Various utilities.
|
||||
*/
|
||||
class scbUtil {
|
||||
|
||||
/**
|
||||
* Force script enqueue.
|
||||
*
|
||||
* @param array $handles
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function do_scripts( $handles ) {
|
||||
global $wp_scripts;
|
||||
|
||||
if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
|
||||
$wp_scripts = new WP_Scripts();
|
||||
}
|
||||
|
||||
$wp_scripts->do_items( ( array ) $handles );
|
||||
}
|
||||
|
||||
/**
|
||||
* Force style enqueue.
|
||||
*
|
||||
* @param array $handles
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function do_styles( $handles ) {
|
||||
self::do_scripts( 'jquery' );
|
||||
|
||||
global $wp_styles;
|
||||
|
||||
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
|
||||
$wp_styles = new WP_Styles();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
$wp_styles->do_items( ( array ) $handles );
|
||||
$content = str_replace( array( "'", "\n" ), array( '"', '' ), ob_get_clean() );
|
||||
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo "//<![CDATA[";
|
||||
echo "jQuery(function ($) { $('head').prepend('$content'); });\n";
|
||||
echo "//]]>";
|
||||
echo "</script>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable delayed plugin activation. To be used with scb_init()
|
||||
*
|
||||
* @param string $plugin
|
||||
* @param string|array $callback
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function add_activation_hook( $plugin, $callback ) {
|
||||
if ( defined( 'SCB_LOAD_MU' ) ) {
|
||||
register_activation_hook( $plugin, $callback );
|
||||
} else {
|
||||
add_action( 'scb_activation_' . plugin_basename( $plugin ), $callback );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute activation hook.
|
||||
* For debugging.
|
||||
*
|
||||
* @param string $plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function do_activation( $plugin ) {
|
||||
do_action( 'scb_activation_' . plugin_basename( $plugin ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows more than one uninstall hooks.
|
||||
* Also prevents an UPDATE query on each page load.
|
||||
*
|
||||
* @param string $plugin
|
||||
* @param string|array $callback
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function add_uninstall_hook( $plugin, $callback ) {
|
||||
if ( ! is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
register_uninstall_hook( $plugin, '__return_false' ); // dummy
|
||||
|
||||
add_action( 'uninstall_' . plugin_basename( $plugin ), $callback );
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute uninstall hook.
|
||||
* For debugging.
|
||||
*
|
||||
* @param string $plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function do_uninstall( $plugin ) {
|
||||
do_action( 'uninstall_' . plugin_basename( $plugin ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current, full URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_current_url() {
|
||||
return ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a function to each element of a ( nested ) array recursively.
|
||||
*
|
||||
* @param string|array $callback
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function array_map_recursive( $callback, $array ) {
|
||||
array_walk_recursive( $array, array( __CLASS__, 'array_map_recursive_helper' ), $callback );
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
public static function array_map_recursive_helper( &$val, $key, $callback ) {
|
||||
$val = call_user_func( $callback, $val );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract certain $keys from $array.
|
||||
*
|
||||
* @deprecated WP 3.1
|
||||
* @deprecated Use wp_array_slice_assoc()
|
||||
* @see wp_array_slice_assoc()
|
||||
*
|
||||
* @param array $array
|
||||
* @param array $keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function array_extract( $array, $keys ) {
|
||||
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'WP 3.1', 'wp_array_slice_assoc()' );
|
||||
return wp_array_slice_assoc( $array, $keys );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a certain value from a list of arrays.
|
||||
*
|
||||
* @deprecated WP 3.1
|
||||
* @deprecated Use wp_list_pluck()
|
||||
* @see wp_list_pluck()
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function array_pluck( $array, $key ) {
|
||||
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'WP 3.1', 'wp_list_pluck()' );
|
||||
return wp_list_pluck( $array, $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a list of objects into an associative array.
|
||||
*
|
||||
* @deprecated r41
|
||||
* @deprecated Use scb_list_fold()
|
||||
* @see scb_list_fold()
|
||||
*
|
||||
* @param array $objects
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function objects_to_assoc( $objects, $key, $value ) {
|
||||
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'r41', 'scb_list_fold()' );
|
||||
return scb_list_fold( $objects, $key, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array for an IN statement.
|
||||
*
|
||||
* @param array $values
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function array_to_sql( $values ) {
|
||||
foreach ( $values as &$val ) {
|
||||
$val = "'" . esc_sql( trim( $val ) ) . "'";
|
||||
}
|
||||
|
||||
return implode( ',', $values );
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: split_at( '</', '<a></a>' ) => array( '<a>', '</a>' )
|
||||
*
|
||||
* @param string $delim
|
||||
* @param string $str
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function split_at( $delim, $str ) {
|
||||
$i = strpos( $str, $delim );
|
||||
|
||||
if ( false === $i ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$start = substr( $str, 0, $i );
|
||||
$finish = substr( $str, $i );
|
||||
|
||||
return array( $start, $finish );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a standard admin notice.
|
||||
*
|
||||
* @param string $msg
|
||||
* @param string $class (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function scb_admin_notice( $msg, $class = 'updated' ) {
|
||||
return html( "div class='$class fade'", html( "p", $msg ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a list of objects into an associative array.
|
||||
*
|
||||
* @param array $objects
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function scb_list_fold( $list, $key, $value ) {
|
||||
$r = array();
|
||||
|
||||
if ( is_array( reset( $list ) ) ) {
|
||||
foreach ( $list as $item ) {
|
||||
$r[ $item[ $key ] ] = $item[ $value ];
|
||||
}
|
||||
} else {
|
||||
foreach ( $list as $item ) {
|
||||
$r[ $item->$key ] = $item->$value;
|
||||
}
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits a list into sets, grouped by the result of running each value through $fn.
|
||||
*
|
||||
* @param array $list List of items to be partitioned.
|
||||
* @param callback $fn Function that takes an element and returns a string key.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function scb_list_group_by( $list, $fn ) {
|
||||
$groups = array();
|
||||
|
||||
foreach ( $list as $item ) {
|
||||
$key = call_user_func( $fn, $item );
|
||||
|
||||
if ( null === $key ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$groups[ $key ][] = $item;
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
//_____Database Table Utilities_____
|
||||
|
||||
/**
|
||||
* Register a table with $wpdb.
|
||||
*
|
||||
* @param string $key The key to be used on the $wpdb object.
|
||||
* @param string $name (optional) The actual name of the table, without $wpdb->prefix.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function scb_register_table( $key, $name = false ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! $name ) {
|
||||
$name = $key;
|
||||
}
|
||||
|
||||
$wpdb->tables[] = $name;
|
||||
$wpdb->$key = $wpdb->prefix . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the SQL query for installing/upgrading a table.
|
||||
*
|
||||
* @param string $key The key used in scb_register_table().
|
||||
* @param string $columns The SQL columns for the CREATE TABLE statement.
|
||||
* @param array $opts (optional) Various other options.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function scb_install_table( $key, $columns, $opts = array() ) {
|
||||
global $wpdb;
|
||||
|
||||
$full_table_name = $wpdb->$key;
|
||||
|
||||
if ( is_string( $opts ) ) {
|
||||
$opts = array( 'upgrade_method' => $opts );
|
||||
}
|
||||
|
||||
$opts = wp_parse_args( $opts, array(
|
||||
'upgrade_method' => 'dbDelta',
|
||||
'table_options' => '',
|
||||
) );
|
||||
|
||||
$charset_collate = '';
|
||||
if ( $wpdb->has_cap( 'collation' ) ) {
|
||||
if ( ! empty( $wpdb->charset ) ) {
|
||||
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
||||
}
|
||||
if ( ! empty( $wpdb->collate ) ) {
|
||||
$charset_collate .= " COLLATE $wpdb->collate";
|
||||
}
|
||||
}
|
||||
|
||||
$table_options = $charset_collate . ' ' . $opts['table_options'];
|
||||
|
||||
if ( 'dbDelta' == $opts['upgrade_method'] ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
||||
dbDelta( "CREATE TABLE $full_table_name ( $columns ) $table_options" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'delete_first' == $opts['upgrade_method'] ) {
|
||||
$wpdb->query( "DROP TABLE IF EXISTS $full_table_name;" );
|
||||
}
|
||||
|
||||
$wpdb->query( "CREATE TABLE IF NOT EXISTS $full_table_name ( $columns ) $table_options;" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the SQL query for uninstalling a table.
|
||||
*
|
||||
* @param string $key The key used in scb_register_table().
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function scb_uninstall_table( $key ) {
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->$key );
|
||||
}
|
||||
|
||||
//_____Minimalist HTML framework_____
|
||||
|
||||
/**
|
||||
* Generate an HTML tag. Atributes are escaped. Content is NOT escaped.
|
||||
*
|
||||
* @param string $tag
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists( 'html' ) ):
|
||||
function html( $tag ) {
|
||||
static $SELF_CLOSING_TAGS = array( 'area', 'base', 'basefont', 'br', 'hr', 'input', 'img', 'link', 'meta' );
|
||||
|
||||
$args = func_get_args();
|
||||
|
||||
$tag = array_shift( $args );
|
||||
|
||||
if ( is_array( $args[0] ) ) {
|
||||
$closing = $tag;
|
||||
$attributes = array_shift( $args );
|
||||
foreach ( $attributes as $key => $value ) {
|
||||
if ( false === $value ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( true === $value ) {
|
||||
$value = $key;
|
||||
}
|
||||
|
||||
$tag .= ' ' . $key . '="' . esc_attr( $value ) . '"';
|
||||
}
|
||||
} else {
|
||||
list( $closing ) = explode( ' ', $tag, 2 );
|
||||
}
|
||||
|
||||
if ( in_array( $closing, $SELF_CLOSING_TAGS ) ) {
|
||||
return "<{$tag} />";
|
||||
}
|
||||
|
||||
$content = implode( '', $args );
|
||||
|
||||
return "<{$tag}>{$content}</{$closing}>";
|
||||
}
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Generate an <a> tag.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $title (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists( 'html_link' ) ):
|
||||
function html_link( $url, $title = '' ) {
|
||||
if ( empty( $title ) ) {
|
||||
$title = $url;
|
||||
}
|
||||
|
||||
return html( 'a', array( 'href' => esc_url( $url ) ), $title );
|
||||
}
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Returns an array of query flags.
|
||||
*
|
||||
* @param object $wp_query (optional)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function scb_get_query_flags( $wp_query = null ) {
|
||||
if ( ! $wp_query ) {
|
||||
$wp_query = $GLOBALS['wp_query'];
|
||||
}
|
||||
|
||||
$flags = array();
|
||||
foreach ( get_object_vars( $wp_query ) as $key => $val ) {
|
||||
if ( 'is_' == substr( $key, 0, 3 ) && $val ) {
|
||||
$flags[] = substr( $key, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
return $flags;
|
||||
}
|
||||
|
||||
//_____Compatibility layer_____
|
||||
|
||||
/**
|
||||
* Update data from a post field based on Post ID.
|
||||
* @see https://core.trac.wordpress.org/ticket/10946
|
||||
*
|
||||
* @param string $field Post field name.
|
||||
* @param string $value Post field value.
|
||||
* @param int $post_id Post ID.
|
||||
*
|
||||
* @return bool Result of UPDATE query.
|
||||
*/
|
||||
if ( ! function_exists( 'set_post_field' ) ) :
|
||||
function set_post_field( $field, $value, $post_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$post_id = absint( $post_id );
|
||||
$value = sanitize_post_field( $field, $value, $post_id, 'db' );
|
||||
|
||||
return $wpdb->update( $wpdb->posts, array( $field => $value ), array( 'ID' => $post_id ) );
|
||||
}
|
||||
endif;
|
||||
|
||||
124
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Widget.php
Normal file
124
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/Widget.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* Adds compatibility methods between WP_Widget and scbForms.
|
||||
*/
|
||||
abstract class scbWidget extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Widget defaults.
|
||||
* @var array
|
||||
*/
|
||||
protected $defaults = array();
|
||||
|
||||
/**
|
||||
* Widgets to register.
|
||||
* @var array
|
||||
*/
|
||||
private static $scb_widgets = array();
|
||||
|
||||
/**
|
||||
* Initializes widget.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $file (optional)
|
||||
* @param string $base (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init( $class, $file = '', $base = '' ) {
|
||||
self::$scb_widgets[] = $class;
|
||||
|
||||
add_action( 'widgets_init', array( __CLASS__, '_scb_register' ) );
|
||||
|
||||
// for auto-uninstall
|
||||
if ( $file && $base && class_exists( 'scbOptions' ) ) {
|
||||
new scbOptions( "widget_$base", $file );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers widgets.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function _scb_register() {
|
||||
foreach ( self::$scb_widgets as $widget ) {
|
||||
register_widget( $widget );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays widget content.
|
||||
*
|
||||
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
|
||||
* @param array $instance The settings for the particular instance of the widget.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
$instance = wp_parse_args( $instance, $this->defaults );
|
||||
|
||||
extract( $args );
|
||||
|
||||
echo $before_widget;
|
||||
|
||||
$title = apply_filters( 'widget_title', isset( $instance['title'] ) ? $instance['title'] : '', $instance, $this->id_base );
|
||||
|
||||
if ( ! empty( $title ) ) {
|
||||
echo $before_title . $title . $after_title;
|
||||
}
|
||||
|
||||
$this->content( $instance );
|
||||
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where the actual widget content goes.
|
||||
*
|
||||
* @param array $instance The settings for the particular instance of the widget.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function content( $instance ) { }
|
||||
|
||||
|
||||
//_____HELPER METHODS_____
|
||||
|
||||
|
||||
/**
|
||||
* Generates a input form field.
|
||||
*
|
||||
* @param array $args
|
||||
* @param array $formdata (optional)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function input( $args, $formdata = array() ) {
|
||||
$prefix = array( 'widget-' . $this->id_base, $this->number );
|
||||
|
||||
$form = new scbForm( $formdata, $prefix );
|
||||
|
||||
// Add default class
|
||||
if ( ! isset( $args['extra'] ) && 'text' == $args['type'] ) {
|
||||
$args['extra'] = array( 'class' => 'widefat' );
|
||||
}
|
||||
|
||||
// Add default label position
|
||||
if ( ! in_array( $args['type'], array( 'checkbox', 'radio' ) ) && empty( $args['desc_pos'] ) ) {
|
||||
$args['desc_pos'] = 'before';
|
||||
}
|
||||
|
||||
$name = $args['name'];
|
||||
|
||||
if ( ! is_array( $name ) && '[]' == substr( $name, -2 ) ) {
|
||||
$name = array( substr( $name, 0, -2 ), '' );
|
||||
}
|
||||
|
||||
$args['name'] = $name;
|
||||
|
||||
return $form->input( $args );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name" : "scribu/scb-framework",
|
||||
"description": "A set of useful classes for faster plugin development",
|
||||
"keywords" : ["wordpress"],
|
||||
"homepage" : "https://github.com/scribu/wp-scb-framework",
|
||||
"license" : "GPL-3.0+",
|
||||
"authors" : [
|
||||
{
|
||||
"name" : "Cristi Burcă",
|
||||
"homepage": "http://scribu.net/"
|
||||
}
|
||||
],
|
||||
"support" : {
|
||||
"issues": "https://github.com/scribu/wp-scb-framework/issues",
|
||||
"source": "https://github.com/scribu/wp-scb-framework",
|
||||
"wiki": "https://github.com/scribu/wp-scb-framework/wiki"
|
||||
},
|
||||
"autoload" : {
|
||||
"classmap": ["."],
|
||||
"files" : ["load-composer.php", "Util.php"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Pass through version to use when Composer handles classes load.
|
||||
*
|
||||
* @param callable $callback
|
||||
*/
|
||||
function scb_init( $callback = null ) {
|
||||
if ( $callback ) {
|
||||
call_user_func( $callback );
|
||||
}
|
||||
}
|
||||
105
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/load.php
Normal file
105
app/webroot/blog/wp-content/plugins/wp-pagenavi/scb/load.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
$GLOBALS['_scb_data'] = array( 61, __FILE__, array(
|
||||
'scbUtil',
|
||||
'scbOptions',
|
||||
'scbForms',
|
||||
'scbTable',
|
||||
'scbWidget',
|
||||
'scbAdminPage',
|
||||
'scbBoxesPage',
|
||||
'scbPostMetabox',
|
||||
'scbCron',
|
||||
'scbHooks',
|
||||
) );
|
||||
|
||||
if ( ! class_exists( 'scbLoad4' ) ) :
|
||||
/**
|
||||
* The main idea behind this class is to load the most recent version of the scb classes available.
|
||||
*
|
||||
* It waits until all plugins are loaded and then does some crazy hacks to make activation hooks work.
|
||||
*/
|
||||
class scbLoad4 {
|
||||
|
||||
private static $candidates = array();
|
||||
private static $classes;
|
||||
private static $callbacks = array();
|
||||
|
||||
private static $loaded;
|
||||
|
||||
static function init( $callback = '' ) {
|
||||
list( $rev, $file, $classes ) = $GLOBALS['_scb_data'];
|
||||
|
||||
self::$candidates[ $file ] = $rev;
|
||||
self::$classes[ $file ] = $classes;
|
||||
|
||||
if ( ! empty( $callback ) ) {
|
||||
self::$callbacks[ $file ] = $callback;
|
||||
|
||||
add_action( 'activate_plugin', array( __CLASS__, 'delayed_activation' ) );
|
||||
}
|
||||
|
||||
if ( did_action( 'plugins_loaded' ) ) {
|
||||
self::load();
|
||||
} else {
|
||||
add_action( 'plugins_loaded', array( __CLASS__, 'load' ), 9, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public static function delayed_activation( $plugin ) {
|
||||
$plugin_dir = dirname( $plugin );
|
||||
|
||||
if ( '.' == $plugin_dir ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( self::$callbacks as $file => $callback ) {
|
||||
if ( dirname( dirname( plugin_basename( $file ) ) ) == $plugin_dir ) {
|
||||
self::load( false );
|
||||
call_user_func( $callback );
|
||||
do_action( 'scb_activation_' . $plugin );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function load( $do_callbacks = true ) {
|
||||
arsort( self::$candidates );
|
||||
|
||||
$file = key( self::$candidates );
|
||||
|
||||
$path = dirname( $file ) . '/';
|
||||
|
||||
foreach ( self::$classes[ $file ] as $class_name ) {
|
||||
if ( class_exists( $class_name ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fpath = $path . substr( $class_name, 3 ) . '.php';
|
||||
if ( file_exists( $fpath ) ) {
|
||||
include $fpath;
|
||||
self::$loaded[] = $fpath;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $do_callbacks ) {
|
||||
foreach ( self::$callbacks as $callback ) {
|
||||
call_user_func( $callback );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function get_info() {
|
||||
arsort( self::$candidates );
|
||||
|
||||
return array( self::$loaded, self::$candidates );
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'scb_init' ) ) :
|
||||
function scb_init( $callback = '' ) {
|
||||
scbLoad4::init( $callback );
|
||||
}
|
||||
endif;
|
||||
|
||||
24
app/webroot/blog/wp-content/plugins/wp-pagenavi/test.php
Normal file
24
app/webroot/blog/wp-content/plugins/wp-pagenavi/test.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// Template Name: WPN Debug
|
||||
|
||||
get_header();
|
||||
|
||||
query_posts( array( 'post_type' => 'post', 'paged' => get_query_var( 'paged' ) ) );
|
||||
?>
|
||||
|
||||
<div id="primary">
|
||||
<div id="content" role="main">
|
||||
|
||||
<ul>
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<li><?php the_title(); ?>
|
||||
<?php endwhile?>
|
||||
</ul>
|
||||
|
||||
<?php wp_pagenavi(); ?>
|
||||
<?php echo wp_pagenavi( array( 'echo' => false ) ); ?>
|
||||
|
||||
</div><!-- #content -->
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* Uninstall plugin
|
||||
*/
|
||||
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
|
||||
exit ();
|
||||
|
||||
$option_names = array(
|
||||
'pagenavi_options'
|
||||
);
|
||||
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$ms_sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites();
|
||||
|
||||
if( 0 < sizeof( $ms_sites ) ) {
|
||||
foreach ( $ms_sites as $ms_site ) {
|
||||
$blog_id = isset( $ms_site['blog_id'] ) ? $ms_site['blog_id'] : $ms_site->blog_id;
|
||||
switch_to_blog( $blog_id );
|
||||
if( sizeof( $option_names ) > 0 ) {
|
||||
foreach( $option_names as $option_name ) {
|
||||
delete_option( $option_name );
|
||||
plugin_uninstalled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
restore_current_blog();
|
||||
} else {
|
||||
if( sizeof( $option_names ) > 0 ) {
|
||||
foreach( $option_names as $option_name ) {
|
||||
delete_option( $option_name );
|
||||
plugin_uninstalled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete plugin table when uninstalled
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function plugin_uninstalled() {
|
||||
global $wpdb;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: WP-PageNavi
|
||||
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
||||
Description: Adds a more advanced paging navigation to your WordPress blog
|
||||
Version: 2.92
|
||||
Author: Lester 'GaMerZ' Chan
|
||||
Author URI: http://lesterchan.net
|
||||
Text Domain: wp-pagenavi
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__ ) . '/scb/load.php';
|
||||
|
||||
function _pagenavi_init() {
|
||||
load_plugin_textdomain( 'wp-pagenavi' );
|
||||
|
||||
require_once dirname( __FILE__ ) . '/core.php';
|
||||
|
||||
$options = new scbOptions( 'pagenavi_options', __FILE__, array(
|
||||
'pages_text' => __( 'Page %CURRENT_PAGE% of %TOTAL_PAGES%', 'wp-pagenavi' ),
|
||||
'current_text' => '%PAGE_NUMBER%',
|
||||
'page_text' => '%PAGE_NUMBER%',
|
||||
'first_text' => __( '« First', 'wp-pagenavi' ),
|
||||
'last_text' => __( 'Last »', 'wp-pagenavi' ),
|
||||
'prev_text' => __( '«', 'wp-pagenavi' ),
|
||||
'next_text' => __( '»', 'wp-pagenavi' ),
|
||||
'dotleft_text' => __( '...', 'wp-pagenavi' ),
|
||||
'dotright_text' => __( '...', 'wp-pagenavi' ),
|
||||
'num_pages' => 5,
|
||||
'num_larger_page_numbers' => 3,
|
||||
'larger_page_numbers_multiple' => 10,
|
||||
'always_show' => false,
|
||||
'use_pagenavi_css' => true,
|
||||
'style' => 1,
|
||||
) );
|
||||
|
||||
PageNavi_Core::init( $options );
|
||||
|
||||
if ( is_admin() ) {
|
||||
require_once dirname( __FILE__ ) . '/admin.php';
|
||||
new PageNavi_Options_Page( __FILE__, $options );
|
||||
}
|
||||
}
|
||||
scb_init( '_pagenavi_init' );
|
||||
|
||||
Reference in New Issue
Block a user