Version Description
- The /popular-posts GET API endpoint is now being cached as well.
- Added a new Content Tag: title_attr.
- Added a new filter hook to filter popular posts terms.
- Minor code improvements.
Download this release
Release Info
Developer | hcabrera |
Plugin | WordPress Popular Posts |
Version | 5.1.0 |
Comparing to | |
See all releases |
Code changes from version 5.0.2 to 5.1.0
- LICENSE +339 -0
- i18n/wordpress-popular-posts.pot +29 -25
- readme.txt +9 -2
- src/Admin/admin-page.php +1 -1
- src/Output.php +8 -1
- src/Rest/Controller.php +46 -29
- wordpress-popular-posts.php +2 -2
LICENSE
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
i18n/wordpress-popular-posts.pot
CHANGED
@@ -5,7 +5,7 @@ msgid ""
|
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: WordPress Popular Posts\n"
|
7 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-popular-posts\n"
|
8 |
-
"POT-Creation-Date: 2020-
|
9 |
"PO-Revision-Date: 2015-04-24 13:30-0430\n"
|
10 |
"Last-Translator: Héctor Cabrera <hcabrerab@gmail.com>\n"
|
11 |
"Language-Team: Héctor Cabrera <me@cabrerahector.com>\n"
|
@@ -77,7 +77,7 @@ msgid "Settings"
|
|
77 |
msgstr ""
|
78 |
|
79 |
#: ../src/Admin/Admin.php:699 ../src/Admin/Admin.php:1088 ../src/Admin/Admin.php:1092
|
80 |
-
#: ../src/Output.php:
|
81 |
#, php-format
|
82 |
msgid "%s view"
|
83 |
msgid_plural "%s views"
|
@@ -85,7 +85,7 @@ msgstr[0] ""
|
|
85 |
msgstr[1] ""
|
86 |
|
87 |
#: ../src/Admin/Admin.php:699 ../src/Admin/Admin.php:1090 ../src/Admin/Admin.php:1092
|
88 |
-
#: ../src/Output.php:
|
89 |
#, php-format
|
90 |
msgid "%s comment"
|
91 |
msgid_plural "%s comments"
|
@@ -867,6 +867,10 @@ msgstr ""
|
|
867 |
msgid "returns post/page title, no link"
|
868 |
msgstr ""
|
869 |
|
|
|
|
|
|
|
|
|
870 |
#: ../src/Admin/admin-page.php:878
|
871 |
msgid "returns linked author name, requires stats_author=1"
|
872 |
msgstr ""
|
@@ -903,98 +907,98 @@ msgstr ""
|
|
903 |
msgid "Sorry. No data so far."
|
904 |
msgstr ""
|
905 |
|
906 |
-
#: ../src/Output.php:
|
907 |
#, php-format
|
908 |
msgid "%s view per day"
|
909 |
msgid_plural "%s views per day"
|
910 |
msgstr[0] ""
|
911 |
msgstr[1] ""
|
912 |
|
913 |
-
#: ../src/Output.php:
|
914 |
#, php-format
|
915 |
msgid "by %s"
|
916 |
msgstr ""
|
917 |
|
918 |
-
#: ../src/Output.php:
|
919 |
#, php-format
|
920 |
msgid "posted %s"
|
921 |
msgstr ""
|
922 |
|
923 |
-
#: ../src/Output.php:
|
924 |
#, php-format
|
925 |
msgid "posted on %s"
|
926 |
msgstr ""
|
927 |
|
928 |
-
#: ../src/Output.php:
|
929 |
#, php-format
|
930 |
msgid "under %s"
|
931 |
msgstr ""
|
932 |
|
933 |
-
#: ../src/Rest/Controller.php:
|
934 |
msgid "Invalid Widget Instance ID"
|
935 |
msgstr ""
|
936 |
|
937 |
-
#: ../src/Rest/Controller.php:
|
938 |
msgid "Return popular posts from specified custom post type(s)."
|
939 |
msgstr ""
|
940 |
|
941 |
-
#: ../src/Rest/Controller.php:
|
942 |
msgid "The maximum number of popular posts to return."
|
943 |
msgstr ""
|
944 |
|
945 |
-
#: ../src/Rest/Controller.php:
|
946 |
msgid "Retrieve the most popular entries published within the specified time range."
|
947 |
msgstr ""
|
948 |
|
949 |
-
#: ../src/Rest/Controller.php:
|
950 |
msgid "An offset point for the collection."
|
951 |
msgstr ""
|
952 |
|
953 |
-
#: ../src/Rest/Controller.php:
|
954 |
msgid "Set the sorting option of the popular posts."
|
955 |
msgstr ""
|
956 |
|
957 |
-
#: ../src/Rest/Controller.php:
|
958 |
msgid "Return popular posts from a specified time range."
|
959 |
msgstr ""
|
960 |
|
961 |
-
#: ../src/Rest/Controller.php:
|
962 |
msgid "Specifies the time unit of the custom time range."
|
963 |
msgstr ""
|
964 |
|
965 |
-
#: ../src/Rest/Controller.php:
|
966 |
msgid "Specifies the number of time units of the custom time range."
|
967 |
msgstr ""
|
968 |
|
969 |
-
#: ../src/Rest/Controller.php:
|
970 |
msgid "Post IDs to exclude from the listing."
|
971 |
msgstr ""
|
972 |
|
973 |
-
#: ../src/Rest/Controller.php:
|
974 |
msgid "Include posts in a specified taxonomy."
|
975 |
msgstr ""
|
976 |
|
977 |
-
#: ../src/Rest/Controller.php:
|
978 |
msgid "Taxonomy IDs, separated by comma (prefix a minus sign to exclude)."
|
979 |
msgstr ""
|
980 |
|
981 |
-
#: ../src/Rest/Controller.php:
|
982 |
msgid "Include popular posts from author ID(s)."
|
983 |
msgstr ""
|
984 |
|
985 |
-
#: ../src/Rest/Controller.php:
|
986 |
msgid "Security nonce."
|
987 |
msgstr ""
|
988 |
|
989 |
-
#: ../src/Rest/Controller.php:
|
990 |
msgid "The post / page ID."
|
991 |
msgstr ""
|
992 |
|
993 |
-
#: ../src/Rest/Controller.php:
|
994 |
msgid "Enables Data Sampling."
|
995 |
msgstr ""
|
996 |
|
997 |
-
#: ../src/Rest/Controller.php:
|
998 |
msgid "Sets the Sampling Rate."
|
999 |
msgstr ""
|
1000 |
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: WordPress Popular Posts\n"
|
7 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-popular-posts\n"
|
8 |
+
"POT-Creation-Date: 2020-03-28 09:44-0400\n"
|
9 |
"PO-Revision-Date: 2015-04-24 13:30-0430\n"
|
10 |
"Last-Translator: Héctor Cabrera <hcabrerab@gmail.com>\n"
|
11 |
"Language-Team: Héctor Cabrera <me@cabrerahector.com>\n"
|
77 |
msgstr ""
|
78 |
|
79 |
#: ../src/Admin/Admin.php:699 ../src/Admin/Admin.php:1088 ../src/Admin/Admin.php:1092
|
80 |
+
#: ../src/Output.php:722
|
81 |
#, php-format
|
82 |
msgid "%s view"
|
83 |
msgid_plural "%s views"
|
85 |
msgstr[1] ""
|
86 |
|
87 |
#: ../src/Admin/Admin.php:699 ../src/Admin/Admin.php:1090 ../src/Admin/Admin.php:1092
|
88 |
+
#: ../src/Output.php:705
|
89 |
#, php-format
|
90 |
msgid "%s comment"
|
91 |
msgid_plural "%s comments"
|
867 |
msgid "returns post/page title, no link"
|
868 |
msgstr ""
|
869 |
|
870 |
+
#: ../src/Admin/admin-page.php:878
|
871 |
+
msgid "similar to text_title, sanitized for use in title/alt attributes"
|
872 |
+
msgstr ""
|
873 |
+
|
874 |
#: ../src/Admin/admin-page.php:878
|
875 |
msgid "returns linked author name, requires stats_author=1"
|
876 |
msgstr ""
|
907 |
msgid "Sorry. No data so far."
|
908 |
msgstr ""
|
909 |
|
910 |
+
#: ../src/Output.php:716
|
911 |
#, php-format
|
912 |
msgid "%s view per day"
|
913 |
msgid_plural "%s views per day"
|
914 |
msgstr[0] ""
|
915 |
msgstr[1] ""
|
916 |
|
917 |
+
#: ../src/Output.php:745
|
918 |
#, php-format
|
919 |
msgid "by %s"
|
920 |
msgstr ""
|
921 |
|
922 |
+
#: ../src/Output.php:751
|
923 |
#, php-format
|
924 |
msgid "posted %s"
|
925 |
msgstr ""
|
926 |
|
927 |
+
#: ../src/Output.php:751
|
928 |
#, php-format
|
929 |
msgid "posted on %s"
|
930 |
msgstr ""
|
931 |
|
932 |
+
#: ../src/Output.php:759
|
933 |
#, php-format
|
934 |
msgid "under %s"
|
935 |
msgstr ""
|
936 |
|
937 |
+
#: ../src/Rest/Controller.php:304
|
938 |
msgid "Invalid Widget Instance ID"
|
939 |
msgstr ""
|
940 |
|
941 |
+
#: ../src/Rest/Controller.php:414
|
942 |
msgid "Return popular posts from specified custom post type(s)."
|
943 |
msgstr ""
|
944 |
|
945 |
+
#: ../src/Rest/Controller.php:421
|
946 |
msgid "The maximum number of popular posts to return."
|
947 |
msgstr ""
|
948 |
|
949 |
+
#: ../src/Rest/Controller.php:429
|
950 |
msgid "Retrieve the most popular entries published within the specified time range."
|
951 |
msgstr ""
|
952 |
|
953 |
+
#: ../src/Rest/Controller.php:437
|
954 |
msgid "An offset point for the collection."
|
955 |
msgstr ""
|
956 |
|
957 |
+
#: ../src/Rest/Controller.php:445
|
958 |
msgid "Set the sorting option of the popular posts."
|
959 |
msgstr ""
|
960 |
|
961 |
+
#: ../src/Rest/Controller.php:453
|
962 |
msgid "Return popular posts from a specified time range."
|
963 |
msgstr ""
|
964 |
|
965 |
+
#: ../src/Rest/Controller.php:461
|
966 |
msgid "Specifies the time unit of the custom time range."
|
967 |
msgstr ""
|
968 |
|
969 |
+
#: ../src/Rest/Controller.php:469
|
970 |
msgid "Specifies the number of time units of the custom time range."
|
971 |
msgstr ""
|
972 |
|
973 |
+
#: ../src/Rest/Controller.php:477
|
974 |
msgid "Post IDs to exclude from the listing."
|
975 |
msgstr ""
|
976 |
|
977 |
+
#: ../src/Rest/Controller.php:485
|
978 |
msgid "Include posts in a specified taxonomy."
|
979 |
msgstr ""
|
980 |
|
981 |
+
#: ../src/Rest/Controller.php:493
|
982 |
msgid "Taxonomy IDs, separated by comma (prefix a minus sign to exclude)."
|
983 |
msgstr ""
|
984 |
|
985 |
+
#: ../src/Rest/Controller.php:501
|
986 |
msgid "Include popular posts from author ID(s)."
|
987 |
msgstr ""
|
988 |
|
989 |
+
#: ../src/Rest/Controller.php:522
|
990 |
msgid "Security nonce."
|
991 |
msgstr ""
|
992 |
|
993 |
+
#: ../src/Rest/Controller.php:528
|
994 |
msgid "The post / page ID."
|
995 |
msgstr ""
|
996 |
|
997 |
+
#: ../src/Rest/Controller.php:535
|
998 |
msgid "Enables Data Sampling."
|
999 |
msgstr ""
|
1000 |
|
1001 |
+
#: ../src/Rest/Controller.php:542
|
1002 |
msgid "Sets the Sampling Rate."
|
1003 |
msgstr ""
|
1004 |
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: hcabrera
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
|
4 |
Tags: popular, posts, widget, popularity, top
|
5 |
Requires at least: 4.7
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 5.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -89,6 +89,13 @@ The FAQ section has been moved [here](https://github.com/cabrerahector/wordpress
|
|
89 |
4. Statistics panel.
|
90 |
|
91 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= 5.0.2 =
|
93 |
|
94 |
- A performance notice will be displayed for mid/high traffic sites (see [#239](https://github.com/cabrerahector/wordpress-popular-posts/issues/239)).
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
|
4 |
Tags: popular, posts, widget, popularity, top
|
5 |
Requires at least: 4.7
|
6 |
+
Tested up to: 5.4
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 5.1.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
89 |
4. Statistics panel.
|
90 |
|
91 |
== Changelog ==
|
92 |
+
= 5.1.0 =
|
93 |
+
|
94 |
+
- The /popular-posts GET API endpoint is now being cached as well.
|
95 |
+
- Added a new Content Tag: title_attr.
|
96 |
+
- Added a new [filter hook to filter popular posts terms](https://github.com/cabrerahector/wordpress-popular-posts/wiki/3.-Filters#wpp_post_terms).
|
97 |
+
- Minor code improvements.
|
98 |
+
|
99 |
= 5.0.2 =
|
100 |
|
101 |
- A performance notice will be displayed for mid/high traffic sites (see [#239](https://github.com/cabrerahector/wordpress-popular-posts/issues/239)).
|
src/Admin/admin-page.php
CHANGED
@@ -875,7 +875,7 @@ if ( ! $wpp_rand = get_option("wpp_rand") ) {
|
|
875 |
<tr>
|
876 |
<td><strong>post_html</strong></td>
|
877 |
<td><?php _e('Sets the HTML structure of each post', 'wordpress-popular-posts'); ?></td>
|
878 |
-
<td><?php _e('Text string, custom HTML', 'wordpress-popular-posts'); ?>.<br /><br /><strong><?php _e('Available Content Tags', 'wordpress-popular-posts'); ?>:</strong> <br /><br /><em>{thumb}</em> (<?php _e('returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{thumb_img}</em> (<?php _e('returns thumbnail image without linking to post/page, requires thumbnail_width & thumbnail_height', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{thumb_url}</em> (<?php _e('returns thumbnail url, requires thumbnail_width & thumbnail_height', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{title}</em> (<?php _e('returns linked post/page title', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{pid}</em> (<?php _e('returns the post/page ID', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{summary}</em> (<?php _e('returns post/page excerpt, and requires excerpt_length to be greater than 0', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{stats}</em> (<?php _e('returns the default stats tags', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{rating}</em> (<?php _e('returns post/page current rating, requires WP-PostRatings installed and enabled', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{score}</em> (<?php _e('returns post/page current rating as an integer, requires WP-PostRatings installed and enabled', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{url}</em> (<?php _e('returns the URL of the post/page', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{text_title}</em> (<?php _e('returns post/page title, no link', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{author}</em> (<?php _e('returns linked author name, requires stats_author=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{category}</em> (<?php _e('returns linked category name, requires stats_category=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{taxonomy}</em> (<?php _e('returns linked taxonomy names, requires stats_taxonomy=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{views}</em> (<?php _e('returns views count only, no text', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{comments}</em> (<?php _e('returns comments count only, no text, requires stats_comments=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{date}</em> (<?php _e('returns post/page date, requires stats_date=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{total_items}</em> (<?php _e('outputs number of popular posts found', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{item_position}</em> (<?php _e('outputs the position of the post in the listing', 'wordpress-popular-posts'); ?>)</td>
|
879 |
<td><li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li></td>
|
880 |
<td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br /><?php<br />$args = array(<br /> 'post_html' => '<li>{thumb} <a href="{url}">{text_title}</a></li>'<br />);<br /><br />wpp_get_mostpopular($args );<br />?><br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp post_html='<li>{thumb} <a href="{url}">{text_title}</a></li>']<br /><br /></td>
|
881 |
</tr>
|
875 |
<tr>
|
876 |
<td><strong>post_html</strong></td>
|
877 |
<td><?php _e('Sets the HTML structure of each post', 'wordpress-popular-posts'); ?></td>
|
878 |
+
<td><?php _e('Text string, custom HTML', 'wordpress-popular-posts'); ?>.<br /><br /><strong><?php _e('Available Content Tags', 'wordpress-popular-posts'); ?>:</strong> <br /><br /><em>{thumb}</em> (<?php _e('returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{thumb_img}</em> (<?php _e('returns thumbnail image without linking to post/page, requires thumbnail_width & thumbnail_height', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{thumb_url}</em> (<?php _e('returns thumbnail url, requires thumbnail_width & thumbnail_height', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{title}</em> (<?php _e('returns linked post/page title', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{pid}</em> (<?php _e('returns the post/page ID', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{summary}</em> (<?php _e('returns post/page excerpt, and requires excerpt_length to be greater than 0', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{stats}</em> (<?php _e('returns the default stats tags', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{rating}</em> (<?php _e('returns post/page current rating, requires WP-PostRatings installed and enabled', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{score}</em> (<?php _e('returns post/page current rating as an integer, requires WP-PostRatings installed and enabled', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{url}</em> (<?php _e('returns the URL of the post/page', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{text_title}</em> (<?php _e('returns post/page title, no link', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{title_attr}</em> (<?php _e('similar to text_title, sanitized for use in title/alt attributes', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{author}</em> (<?php _e('returns linked author name, requires stats_author=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{category}</em> (<?php _e('returns linked category name, requires stats_category=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{taxonomy}</em> (<?php _e('returns linked taxonomy names, requires stats_taxonomy=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{views}</em> (<?php _e('returns views count only, no text', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{comments}</em> (<?php _e('returns comments count only, no text, requires stats_comments=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{date}</em> (<?php _e('returns post/page date, requires stats_date=1', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{total_items}</em> (<?php _e('outputs number of popular posts found', 'wordpress-popular-posts'); ?>)<br /><br /> <em>{item_position}</em> (<?php _e('outputs the position of the post in the listing', 'wordpress-popular-posts'); ?>)</td>
|
879 |
<td><li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li></td>
|
880 |
<td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br /><?php<br />$args = array(<br /> 'post_html' => '<li>{thumb} <a href="{url}">{text_title}</a></li>'<br />);<br /><br />wpp_get_mostpopular($args );<br />?><br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp post_html='<li>{thumb} <a href="{url}">{text_title}</a></li>']<br /><br /></td>
|
881 |
</tr>
|
src/Output.php
CHANGED
@@ -314,6 +314,7 @@ class Output {
|
|
314 |
$data = [
|
315 |
'id' => $post_id,
|
316 |
'title' => '<a href="' . $permalink . '" ' . ($post_title_attr !== $post_title ? 'title="' . $post_title_attr . '" ' : '' ) . 'class="wpp-post-title" target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_title . '</a>',
|
|
|
317 |
'summary' => $post_excerpt,
|
318 |
'stats' => $post_meta,
|
319 |
'img' => ( ! empty($post_thumbnail) ) ? '<a href="' . $permalink . '" ' . ($post_title_attr !== $post_title ? 'title="' . $post_title_attr . '" ' : '' ) . 'target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_thumbnail . '</a>' : '',
|
@@ -592,6 +593,8 @@ class Output {
|
|
592 |
$terms = wp_list_filter($terms, $args, 'NOT');
|
593 |
}
|
594 |
|
|
|
|
|
595 |
if (
|
596 |
is_array($terms)
|
597 |
&& ! empty($terms)
|
@@ -776,7 +779,7 @@ class Output {
|
|
776 |
return false;
|
777 |
|
778 |
$params = [];
|
779 |
-
$pattern = '/\{(pid|excerpt|summary|meta|stats|title|image|thumb|thumb_img|thumb_url|rating|score|url|text_title|author|taxonomy|category|views|comments|date|total_items|item_position)\}/i';
|
780 |
preg_match_all($pattern, $string, $matches);
|
781 |
|
782 |
array_map('strtolower', $matches[0]);
|
@@ -789,6 +792,10 @@ class Output {
|
|
789 |
$string = str_replace("{title}", $data['title'], $string);
|
790 |
}
|
791 |
|
|
|
|
|
|
|
|
|
792 |
if ( in_array("{meta}", $matches[0]) || in_array("{stats}", $matches[0]) ) {
|
793 |
$string = str_replace(["{meta}", "{stats}"], $data['stats'], $string);
|
794 |
}
|
314 |
$data = [
|
315 |
'id' => $post_id,
|
316 |
'title' => '<a href="' . $permalink . '" ' . ($post_title_attr !== $post_title ? 'title="' . $post_title_attr . '" ' : '' ) . 'class="wpp-post-title" target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_title . '</a>',
|
317 |
+
'title_attr' => $post_title_attr,
|
318 |
'summary' => $post_excerpt,
|
319 |
'stats' => $post_meta,
|
320 |
'img' => ( ! empty($post_thumbnail) ) ? '<a href="' . $permalink . '" ' . ($post_title_attr !== $post_title ? 'title="' . $post_title_attr . '" ' : '' ) . 'target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_thumbnail . '</a>' : '',
|
593 |
$terms = wp_list_filter($terms, $args, 'NOT');
|
594 |
}
|
595 |
|
596 |
+
$terms = apply_filters('wpp_post_terms', $terms);
|
597 |
+
|
598 |
if (
|
599 |
is_array($terms)
|
600 |
&& ! empty($terms)
|
779 |
return false;
|
780 |
|
781 |
$params = [];
|
782 |
+
$pattern = '/\{(pid|excerpt|summary|meta|stats|title|title_attr|image|thumb|thumb_img|thumb_url|rating|score|url|text_title|author|taxonomy|category|views|comments|date|total_items|item_position)\}/i';
|
783 |
preg_match_all($pattern, $string, $matches);
|
784 |
|
785 |
array_map('strtolower', $matches[0]);
|
792 |
$string = str_replace("{title}", $data['title'], $string);
|
793 |
}
|
794 |
|
795 |
+
if ( in_array("{title_attr}", $matches[0]) ) {
|
796 |
+
$string = str_replace("{title_attr}", $data['title_attr'], $string);
|
797 |
+
}
|
798 |
+
|
799 |
if ( in_array("{meta}", $matches[0]) || in_array("{stats}", $matches[0]) ) {
|
800 |
$string = str_replace(["{meta}", "{stats}"], $data['stats'], $string);
|
801 |
}
|
src/Rest/Controller.php
CHANGED
@@ -97,7 +97,8 @@ class Controller extends \WP_REST_Controller {
|
|
97 |
{
|
98 |
$params = $request->get_params();
|
99 |
$popular_posts = [];
|
100 |
-
|
|
|
101 |
$results = $query->get_posts();
|
102 |
|
103 |
if ( is_array($results) && ! empty($results) ) {
|
@@ -344,34 +345,7 @@ class Controller extends \WP_REST_Controller {
|
|
344 |
}
|
345 |
}
|
346 |
|
347 |
-
|
348 |
-
if ( $this->config['tools']['cache']['active'] ) {
|
349 |
-
$key = md5(json_encode($instance));
|
350 |
-
$popular_posts = \WordPressPopularPosts\Cache::get($key);
|
351 |
-
|
352 |
-
if ( false === $popular_posts ) {
|
353 |
-
$popular_posts = new Query($instance);
|
354 |
-
|
355 |
-
$time_value = $this->config['tools']['cache']['interval']['value']; // eg. 5
|
356 |
-
$time_unit = $this->config['tools']['cache']['interval']['time']; // eg. 'minute'
|
357 |
-
|
358 |
-
// No popular posts found, check again in 1 minute
|
359 |
-
if ( ! $popular_posts->get_posts() ) {
|
360 |
-
$time_value = 1;
|
361 |
-
$time_unit = 'minute';
|
362 |
-
}
|
363 |
-
|
364 |
-
\WordPressPopularPosts\Cache::set(
|
365 |
-
$key,
|
366 |
-
$popular_posts,
|
367 |
-
$time_value,
|
368 |
-
$time_unit
|
369 |
-
);
|
370 |
-
}
|
371 |
-
} // Get popular posts
|
372 |
-
else {
|
373 |
-
$popular_posts = new Query($instance);
|
374 |
-
}
|
375 |
|
376 |
if ( is_numeric($is_single) && $is_single > 0 ) {
|
377 |
add_filter('wpp_is_single', function($id) use ($is_single) {
|
@@ -596,4 +570,47 @@ class Controller extends \WP_REST_Controller {
|
|
596 |
],
|
597 |
];
|
598 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
}
|
97 |
{
|
98 |
$params = $request->get_params();
|
99 |
$popular_posts = [];
|
100 |
+
|
101 |
+
$query = $this->maybe_query($params);
|
102 |
$results = $query->get_posts();
|
103 |
|
104 |
if ( is_array($results) && ! empty($results) ) {
|
345 |
}
|
346 |
}
|
347 |
|
348 |
+
$popular_posts = $this->maybe_query($instance);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
|
350 |
if ( is_numeric($is_single) && $is_single > 0 ) {
|
351 |
add_filter('wpp_is_single', function($id) use ($is_single) {
|
570 |
],
|
571 |
];
|
572 |
}
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Gets Query object from cache if it exists,
|
576 |
+
* otherwise a new Query object will be
|
577 |
+
* instantiated and returned.
|
578 |
+
*
|
579 |
+
* @since 5.0.3
|
580 |
+
* @param array
|
581 |
+
* @return Query
|
582 |
+
*/
|
583 |
+
private function maybe_query(array $params)
|
584 |
+
{
|
585 |
+
// Return cached results
|
586 |
+
if ( $this->config['tools']['cache']['active'] ) {
|
587 |
+
$key = 'wpp_' . md5(json_encode($params));
|
588 |
+
$query = \WordPressPopularPosts\Cache::get($key);
|
589 |
+
|
590 |
+
if ( false === $query ) {
|
591 |
+
$query = new Query($params);
|
592 |
+
|
593 |
+
$time_value = $this->config['tools']['cache']['interval']['value'];
|
594 |
+
$time_unit = $this->config['tools']['cache']['interval']['time'];
|
595 |
+
|
596 |
+
// No popular posts found, check again in 1 minute
|
597 |
+
if ( ! $query->get_posts() ) {
|
598 |
+
$time_value = 1;
|
599 |
+
$time_unit = 'minute';
|
600 |
+
}
|
601 |
+
|
602 |
+
\WordPressPopularPosts\Cache::set(
|
603 |
+
$key,
|
604 |
+
$query,
|
605 |
+
$time_value,
|
606 |
+
$time_unit
|
607 |
+
);
|
608 |
+
}
|
609 |
+
} // Get real-time popular posts
|
610 |
+
else {
|
611 |
+
$query = new Query($params);
|
612 |
+
}
|
613 |
+
|
614 |
+
return $query;
|
615 |
+
}
|
616 |
}
|
wordpress-popular-posts.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: WordPress Popular Posts
|
17 |
* Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
|
18 |
* Description: A highly customizable widget that displays the most popular posts on your blog.
|
19 |
-
* Version: 5.0
|
20 |
* Author: Hector Cabrera
|
21 |
* Author URI: https://cabrerahector.com/
|
22 |
* License: GPL-2.0+
|
@@ -29,7 +29,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
29 |
die();
|
30 |
}
|
31 |
|
32 |
-
define('WPP_VERSION', '5.0
|
33 |
define('WPP_MIN_PHP_VERSION', '5.4');
|
34 |
define('WPP_MIN_WP_VERSION', '4.9');
|
35 |
|
16 |
* Plugin Name: WordPress Popular Posts
|
17 |
* Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
|
18 |
* Description: A highly customizable widget that displays the most popular posts on your blog.
|
19 |
+
* Version: 5.1.0
|
20 |
* Author: Hector Cabrera
|
21 |
* Author URI: https://cabrerahector.com/
|
22 |
* License: GPL-2.0+
|
29 |
die();
|
30 |
}
|
31 |
|
32 |
+
define('WPP_VERSION', '5.1.0');
|
33 |
define('WPP_MIN_PHP_VERSION', '5.4');
|
34 |
define('WPP_MIN_WP_VERSION', '4.9');
|
35 |
|