WordPress Popular Posts - Version 5.2.0

Version Description

If you're using a caching plugin, flushing its cache right after installing / upgrading to this version is required.

  • JavaScript based Lazy Loading superseded by Native Lazing Loading.
  • Improved Pageviews Cache.
  • Views/comments count will be prettified now!
  • Fixed a few layout issues found in widget themes.
  • Improved compatibility with Content Security Policy (CSP).
  • Added support for ACF images.
  • Other minor improvements and fixes.

Release notes

Download this release

Release Info

Developer hcabrera
Plugin Icon 128x128 WordPress Popular Posts
Version 5.2.0
Comparing to
See all releases

Code changes from version 5.1.0 to 5.2.0

Files changed (63) hide show
  1. LICENSE +339 -339
  2. assets/css/admin.css +418 -418
  3. assets/css/datepicker.css +399 -399
  4. assets/css/fontello.css +49 -49
  5. assets/css/wpp.css +76 -76
  6. assets/fonts/fontello.svg +17 -17
  7. assets/js/admin.js +356 -356
  8. assets/js/chart.js +191 -191
  9. assets/js/vendor/Chart.min.js +13 -13
  10. assets/js/wpp-5.0.0.min.js +0 -3
  11. assets/js/wpp-5.2.0.min.js +6 -0
  12. assets/js/wpp.js +150 -95
  13. assets/themes/cards-compact/config.json +50 -50
  14. assets/themes/cards-compact/style.css +63 -63
  15. assets/themes/cards/config.json +50 -50
  16. assets/themes/cards/style.css +62 -62
  17. assets/themes/cardview-compact/config.json +50 -50
  18. assets/themes/cardview-compact/style.css +71 -77
  19. assets/themes/cardview/config.json +50 -50
  20. assets/themes/cardview/style.css +75 -76
  21. assets/themes/evergreen/config.json +50 -50
  22. assets/themes/evergreen/style.css +48 -48
  23. assets/themes/midnight/config.json +50 -50
  24. assets/themes/midnight/style.css +48 -48
  25. assets/themes/sunrise/config.json +50 -50
  26. assets/themes/sunrise/style.css +48 -48
  27. assets/themes/sunset/config.json +50 -50
  28. assets/themes/sunset/style.css +48 -48
  29. assets/themes/tiles/config.json +50 -50
  30. assets/themes/tiles/style.css +64 -64
  31. assets/themes/tiny/config.json +41 -41
  32. assets/themes/tiny/style.css +36 -36
  33. i18n/wordpress-popular-posts.pot +1196 -1204
  34. index.php +2 -2
  35. readme.txt +16 -2
  36. src/Activation/Activator.php +129 -129
  37. src/Activation/Deactivator.php +66 -66
  38. src/Admin/Admin.php +1379 -1379
  39. src/Admin/admin-page.php +951 -951
  40. src/Bootstrap.php +25 -25
  41. src/Cache.php +111 -111
  42. src/Container/Container.php +110 -110
  43. src/Container/ContainerConfigurationInterface.php +17 -17
  44. src/Container/WordPressPopularPostsConfiguration.php +59 -59
  45. src/Front/Front.php +465 -567
  46. src/Helper.php +335 -272
  47. src/I18N.php +36 -36
  48. src/Image.php +806 -795
  49. src/Moment/CustomFormats/MomentJs.php +152 -152
  50. src/Moment/FormatsInterface.php +23 -23
  51. src/Moment/LICENSE.md +21 -21
  52. src/Moment/Locales/ar_TN.php +44 -44
  53. src/Moment/Locales/ca_ES.php +65 -65
  54. src/Moment/Locales/cs_CZ.php +107 -107
  55. src/Moment/Locales/da_DK.php +43 -43
  56. src/Moment/Locales/de_DE.php +44 -44
  57. src/Moment/Locales/en_GB.php +64 -64
  58. src/Moment/Locales/en_US.php +20 -20
  59. src/Moment/Locales/es_ES.php +46 -46
  60. src/Moment/Locales/fr_FR.php +55 -55
  61. src/Moment/Locales/hu_HU.php +72 -72
  62. src/Moment/Locales/id_ID.php +44 -44
  63. src/Moment/Locales/it_IT.php +71 -74
LICENSE CHANGED
@@ -1,339 +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.
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.
assets/css/admin.css CHANGED
@@ -1,418 +1,418 @@
1
- #wpp-message { display: none; }
2
-
3
- /*
4
- * Navigation
5
- */
6
- #wpp-menu {
7
- float: none;
8
- clear: both;
9
- }
10
-
11
- #wpp-menu ul {
12
- text-align: center;
13
- }
14
-
15
- #wpp-menu ul li {
16
- padding: 0 15px 0 10px;
17
- margin: 0 0px;
18
- display: inline;
19
- border-right: #ddd 1px solid;
20
- }
21
-
22
- #wpp-menu ul li:first-child {
23
- display: none;
24
- }
25
-
26
- #wpp-menu ul li:last-child {
27
- border: none;
28
- }
29
-
30
- #wpp-menu ul li a {
31
- }
32
-
33
- #wpp-menu ul li.current a {
34
- color: #00a0d2;
35
- text-decoration: none;
36
- }
37
-
38
- .wpp-wrapper {
39
- margin: 20px 20px 0 2px;
40
- -webkit-font-smoothing: subpixel-antialiased;
41
- }
42
-
43
- .wpp-lightbox {
44
- display: none;
45
- position: fixed;
46
- top: 50%;
47
- left: 50%;
48
- z-index: 999;
49
- margin: -140px 0 0 -140px;
50
- padding: 15px;
51
- width: 250px;
52
- max-height: 280px;
53
- background: #fff;
54
- -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
55
- -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
56
- box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
57
- }
58
-
59
- .wpp-lightbox-tabs {
60
- margin: 0 0 25px 0;
61
- padding: 0 0 0 0;
62
- text-align: center;
63
- }
64
-
65
- .wpp-lightbox-tabs li {
66
- display: inline;
67
- list-style: none;
68
- margin: 0;
69
- padding: 0 15px 0 10px;
70
- border-right: #ddd 1px solid;
71
- }
72
-
73
- .wpp-lightbox-tabs li:first-child {
74
- padding: 0 15px 0 0;
75
- }
76
-
77
- .wpp-lightbox-tabs li:last-child {
78
- padding: 0 0 0 10px;
79
- border-right: none;
80
- }
81
-
82
- .wpp-lightbox-tabs li.active a {
83
- color: #00a0d2;
84
- text-decoration: none;
85
- }
86
-
87
- .wpp-lightbox-tab-content {
88
- overflow: hidden;
89
- display: none;
90
- width: 100%;
91
- }
92
-
93
- .wpp-lightbox-tab-content-active {
94
- display: block;
95
- }
96
-
97
- .wpp-lightbox form {
98
- display: block;
99
- }
100
-
101
- .wpp-lightbox form input[type=text] {
102
- display: block;
103
- margin: 0 0 15px 0;
104
- width: 100%;
105
- box-sizing: border-box;
106
- }
107
-
108
- .wpp-section-stats {
109
- position: relative;
110
- }
111
-
112
- .wpp-section-stats .dashicons-admin-generic {
113
- position: absolute;
114
- top: 22px;
115
- left: 0;
116
- width: 21px;
117
- height: 21px;
118
- transition: transform 0.3s;
119
- }
120
-
121
- .wpp-section-stats .dashicons-admin-generic:hover {
122
- transform: rotate(360deg);
123
- }
124
-
125
- .wpp-header {
126
- overflow: hidden;
127
- display: block;
128
- padding: 25px 0 0 0;
129
- }
130
-
131
- .wpp-header h2,
132
- .wpp-header h3,
133
- .wpp-header h4,
134
- .wpp-header h5 {
135
- text-align: center;
136
- }
137
-
138
- .wpp-header h2 {
139
- margin: 0 0 5px 0;
140
- font-size: 1.0em;
141
- font-weight: 400;
142
- line-height: 1.0em;
143
- }
144
-
145
- .wpp-header h3 {
146
- margin: 0 0 30px 0;
147
- font-size: 3.5em;
148
- letter-spacing: -1px;
149
- line-height: 1.0em;
150
- }
151
-
152
- .wpp-header h4,
153
- #wpp-chart-wrapper h4 {
154
- margin: 0 0 8px 0;
155
- font-size: 2.0em;
156
- font-weight: 100;
157
- line-height: 1.0em;
158
- letter-spacing: -2px;
159
- }
160
-
161
- .wpp-header h5,
162
- #wpp-chart-wrapper h5 {
163
- margin: 0 0 0 0;
164
- font-size: 0.9em;
165
- font-weight: 300;
166
- line-height: 0.9em;
167
- }
168
-
169
- .wpp-header-nav {
170
- margin: 55px auto 0px auto;
171
- padding: 0;
172
- text-align: center;
173
- }
174
-
175
- .wpp-header-nav li {
176
- display: inline;
177
- list-style: none;
178
- margin: 0 4px;
179
- padding: 0;
180
- }
181
-
182
- .wpp-header-nav li a {
183
- display: inline-block;
184
- padding: 6px 12px 7px;
185
- line-height: 1.1em;
186
- }
187
-
188
- .wpp-section-stats .wpp-header-nav li a:hover,
189
- .wpp-section-stats .wpp-header-nav li.current a {
190
- color: #00a0d2;
191
- }
192
-
193
- .wpp-section-stats .wpp-header-nav li.current a {
194
- text-decoration: none;
195
- }
196
-
197
- #wpp-chart-wrapper {
198
- width: 100%;
199
- }
200
-
201
- #wpp-chart-wrapper h4,
202
- #wpp-chart-wrapper h5 {
203
- text-align: center;
204
- }
205
-
206
- #wpp-chart-wrapper #wpp-chart {
207
- position: relative;
208
- overflow: hidden;
209
- margin: 20px auto 0 auto;
210
- width: 100%;
211
- height: 250px;
212
- }
213
-
214
- #wpp-chart-wrapper #wpp-chart p {
215
- margin: 0 10px;
216
- text-align: center;
217
- }
218
-
219
- #wpp-chart-wrapper #wpp-chart a:hover {
220
- text-decoration: underline;
221
- }
222
-
223
- .wpp-content {
224
- float: none;
225
- clear: both;
226
- width: 100%;
227
- background: #fff;
228
- }
229
-
230
- .wpp-content .wpp-tabbed-nav {
231
- overflow: hidden;
232
- margin: 0 0 0 0;
233
- padding: 0;
234
- background: #f9f9f9;
235
- }
236
-
237
- .wpp-content .wpp-tabbed-nav li {
238
- display: inline;
239
- float: left;
240
- margin: 0;
241
- padding: 0;
242
- width: 25%;
243
- border-bottom: #f0f0f0 1px solid;
244
- }
245
-
246
- .wpp-content .wpp-tabbed-nav li.active {
247
- border-bottom: #bbb 1px solid;
248
- }
249
-
250
- .wpp-content .wpp-tabbed-nav li a {
251
- display: block;
252
- padding: 15px;
253
- font-size: 1.2em;
254
- text-align: center;
255
- text-decoration: none;
256
- outline: none;
257
- box-shadow: none;
258
- }
259
-
260
- #wpp-listing .wpp-tabbed-nav li a .fa {
261
- display: inline-block;
262
- margin: 0 8px 0 0;
263
- }
264
-
265
- .wpp-tab-content {
266
- display: none;
267
- overflow: hidden;
268
- padding: 2% 30px;
269
- width: 100%;
270
- box-sizing: border-box;
271
- }
272
-
273
- .wpp-tab-content-active {
274
- display: block;
275
- }
276
-
277
- .wpp-tab-content .spinner {
278
- display: block;
279
- visibility: visible;
280
- float: none;
281
- margin-left: auto;
282
- margin-right: auto;
283
- }
284
-
285
- .popular-posts-list {
286
- margin: 0 0 0 0;
287
- padding: 0;
288
- list-style: none;
289
- counter-reset: wpp-counter;
290
- font-size: 1rem;
291
- line-height: 1.2;
292
- }
293
-
294
- .popular-posts-list li {
295
- counter-increment: wpp-counter;
296
- margin: 0 1% 15px 1%;
297
- padding: 0 0 10px 0;
298
- border-bottom: #f0f0f0 1px solid;
299
- }
300
-
301
- .popular-posts-list li::before {
302
- display: inline-block;
303
- width: 20px;
304
- content: counter(wpp-counter) ". ";
305
- }
306
-
307
- .popular-posts-list li:last-child,
308
- .popular-posts-list li:last-child {
309
- margin: 0 1%;
310
- border: none;
311
- }
312
-
313
- .popular-posts-list li a.wpp-title {
314
- display: inline;
315
- font-size: 1em;
316
- text-decoration: none;
317
- }
318
-
319
- .popular-posts-list li:first-child,
320
- .popular-posts-list li:first-child a.wpp-title {
321
- font-size: 1.15em;
322
- }
323
-
324
- .popular-posts-list li:nth-child(2),
325
- .popular-posts-list li:nth-child(2) a.wpp-title {
326
- font-size: 1.05em;
327
- }
328
-
329
- .popular-posts-list li:first-child a.wpp-title,
330
- .popular-posts-list li:nth-child(2) a.wpp-title,
331
- .popular-posts-list li:nth-child(3) a.wpp-title {
332
- font-weight: bold;
333
- letter-spacing: -1px;
334
- }
335
-
336
- .popular-posts-list li a.wpp-title:hover {
337
- text-decoration: underline;
338
- }
339
-
340
- .popular-posts-list li span {
341
- color: #bbb;
342
- font-size: 13px;
343
- }
344
-
345
- .popular-posts-list li small {
346
- display: none;
347
- font-size: 13px;
348
- }
349
-
350
- .popular-posts-list li:hover small {
351
- display: inline;
352
- }
353
-
354
- #wpp_params {}
355
-
356
- #wpp_params div {
357
- }
358
-
359
- #wpp_params div table {
360
- width: 100%;
361
- min-width: 800px;
362
- background: white;
363
- }
364
-
365
- #wpp_params div table tr th {
366
- font-size: 1.2em;
367
- text-align: left;
368
- border-bottom: #dedede 1px solid;
369
- }
370
-
371
- #wpp_params div table tr th,
372
- #wpp_params div table tr td {
373
- padding: 1em;
374
- }
375
-
376
- #wpp_params div table tr td {
377
- position: static !important;
378
- clear: none !important;
379
- display: table-cell !important;
380
- vertical-align: top;
381
- }
382
-
383
- .clear {
384
- float:none;
385
- clear:both;
386
- width:100%;
387
- }
388
-
389
- /*
390
- * Media Queries
391
- */
392
-
393
- /* Small devices */
394
- @media only screen and (max-width: 480px){
395
-
396
- }
397
-
398
- /* Tablets & small desktops */
399
- @media only screen and (max-width: 768px) {
400
-
401
- .wpp-wrapper {
402
- margin: 20px 12px 0 2px;
403
- }
404
-
405
- #wpp-listing .wpp-tabbed-nav li a span:last-child {
406
- display: none;
407
- }
408
-
409
- #wpp-listing .wpp-tabbed-nav li a .fa {
410
- margin: 0 0 0 0;
411
- }
412
-
413
- }
414
-
415
- /* Medium desktops, Large desktops & other devices */
416
- @media only screen and (max-width: 992px) { /* 960 + 16 + 16 */
417
-
418
- }
1
+ #wpp-message { display: none; }
2
+
3
+ /*
4
+ * Navigation
5
+ */
6
+ #wpp-menu {
7
+ float: none;
8
+ clear: both;
9
+ }
10
+
11
+ #wpp-menu ul {
12
+ text-align: center;
13
+ }
14
+
15
+ #wpp-menu ul li {
16
+ padding: 0 15px 0 10px;
17
+ margin: 0 0px;
18
+ display: inline;
19
+ border-right: #ddd 1px solid;
20
+ }
21
+
22
+ #wpp-menu ul li:first-child {
23
+ display: none;
24
+ }
25
+
26
+ #wpp-menu ul li:last-child {
27
+ border: none;
28
+ }
29
+
30
+ #wpp-menu ul li a {
31
+ }
32
+
33
+ #wpp-menu ul li.current a {
34
+ color: #00a0d2;
35
+ text-decoration: none;
36
+ }
37
+
38
+ .wpp-wrapper {
39
+ margin: 20px 20px 0 2px;
40
+ -webkit-font-smoothing: subpixel-antialiased;
41
+ }
42
+
43
+ .wpp-lightbox {
44
+ display: none;
45
+ position: fixed;
46
+ top: 50%;
47
+ left: 50%;
48
+ z-index: 999;
49
+ margin: -140px 0 0 -140px;
50
+ padding: 15px;
51
+ width: 250px;
52
+ max-height: 280px;
53
+ background: #fff;
54
+ -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
55
+ -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
56
+ box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
57
+ }
58
+
59
+ .wpp-lightbox-tabs {
60
+ margin: 0 0 25px 0;
61
+ padding: 0 0 0 0;
62
+ text-align: center;
63
+ }
64
+
65
+ .wpp-lightbox-tabs li {
66
+ display: inline;
67
+ list-style: none;
68
+ margin: 0;
69
+ padding: 0 15px 0 10px;
70
+ border-right: #ddd 1px solid;
71
+ }
72
+
73
+ .wpp-lightbox-tabs li:first-child {
74
+ padding: 0 15px 0 0;
75
+ }
76
+
77
+ .wpp-lightbox-tabs li:last-child {
78
+ padding: 0 0 0 10px;
79
+ border-right: none;
80
+ }
81
+
82
+ .wpp-lightbox-tabs li.active a {
83
+ color: #00a0d2;
84
+ text-decoration: none;
85
+ }
86
+
87
+ .wpp-lightbox-tab-content {
88
+ overflow: hidden;
89
+ display: none;
90
+ width: 100%;
91
+ }
92
+
93
+ .wpp-lightbox-tab-content-active {
94
+ display: block;
95
+ }
96
+
97
+ .wpp-lightbox form {
98
+ display: block;
99
+ }
100
+
101
+ .wpp-lightbox form input[type=text] {
102
+ display: block;
103
+ margin: 0 0 15px 0;
104
+ width: 100%;
105
+ box-sizing: border-box;
106
+ }
107
+
108
+ .wpp-section-stats {
109
+ position: relative;
110
+ }
111
+
112
+ .wpp-section-stats .dashicons-admin-generic {
113
+ position: absolute;
114
+ top: 22px;
115
+ left: 0;
116
+ width: 21px;
117
+ height: 21px;
118
+ transition: transform 0.3s;
119
+ }
120
+
121
+ .wpp-section-stats .dashicons-admin-generic:hover {
122
+ transform: rotate(360deg);
123
+ }
124
+
125
+ .wpp-header {
126
+ overflow: hidden;
127
+ display: block;
128
+ padding: 25px 0 0 0;
129
+ }
130
+
131
+ .wpp-header h2,
132
+ .wpp-header h3,
133
+ .wpp-header h4,
134
+ .wpp-header h5 {
135
+ text-align: center;
136
+ }
137
+
138
+ .wpp-header h2 {
139
+ margin: 0 0 5px 0;
140
+ font-size: 1.0em;
141
+ font-weight: 400;
142
+ line-height: 1.0em;
143
+ }
144
+
145
+ .wpp-header h3 {
146
+ margin: 0 0 30px 0;
147
+ font-size: 3.5em;
148
+ letter-spacing: -1px;
149
+ line-height: 1.0em;
150
+ }
151
+
152
+ .wpp-header h4,
153
+ #wpp-chart-wrapper h4 {
154
+ margin: 0 0 8px 0;
155
+ font-size: 2.0em;
156
+ font-weight: 100;
157
+ line-height: 1.0em;
158
+ letter-spacing: -2px;
159
+ }
160
+
161
+ .wpp-header h5,
162
+ #wpp-chart-wrapper h5 {
163
+ margin: 0 0 0 0;
164
+ font-size: 0.9em;
165
+ font-weight: 300;
166
+ line-height: 0.9em;
167
+ }
168
+
169
+ .wpp-header-nav {
170
+ margin: 55px auto 0px auto;
171
+ padding: 0;
172
+ text-align: center;
173
+ }
174
+
175
+ .wpp-header-nav li {
176
+ display: inline;
177
+ list-style: none;
178
+ margin: 0 4px;
179
+ padding: 0;
180
+ }
181
+
182
+ .wpp-header-nav li a {
183
+ display: inline-block;
184
+ padding: 6px 12px 7px;
185
+ line-height: 1.1em;
186
+ }
187
+
188
+ .wpp-section-stats .wpp-header-nav li a:hover,
189
+ .wpp-section-stats .wpp-header-nav li.current a {
190
+ color: #00a0d2;
191
+ }
192
+
193
+ .wpp-section-stats .wpp-header-nav li.current a {
194
+ text-decoration: none;
195
+ }
196
+
197
+ #wpp-chart-wrapper {
198
+ width: 100%;
199
+ }
200
+
201
+ #wpp-chart-wrapper h4,
202
+ #wpp-chart-wrapper h5 {
203
+ text-align: center;
204
+ }
205
+
206
+ #wpp-chart-wrapper #wpp-chart {
207
+ position: relative;
208
+ overflow: hidden;
209
+ margin: 20px auto 0 auto;
210
+ width: 100%;
211
+ height: 250px;
212
+ }
213
+
214
+ #wpp-chart-wrapper #wpp-chart p {
215
+ margin: 0 10px;
216
+ text-align: center;
217
+ }
218
+
219
+ #wpp-chart-wrapper #wpp-chart a:hover {
220
+ text-decoration: underline;
221
+ }
222
+
223
+ .wpp-content {
224
+ float: none;
225
+ clear: both;
226
+ width: 100%;
227
+ background: #fff;
228
+ }
229
+
230
+ .wpp-content .wpp-tabbed-nav {
231
+ overflow: hidden;
232
+ margin: 0 0 0 0;
233
+ padding: 0;
234
+ background: #f9f9f9;
235
+ }
236
+
237
+ .wpp-content .wpp-tabbed-nav li {
238
+ display: inline;
239
+ float: left;
240
+ margin: 0;
241
+ padding: 0;
242
+ width: 25%;
243
+ border-bottom: #f0f0f0 1px solid;
244
+ }
245
+
246
+ .wpp-content .wpp-tabbed-nav li.active {
247
+ border-bottom: #bbb 1px solid;
248
+ }
249
+
250
+ .wpp-content .wpp-tabbed-nav li a {
251
+ display: block;
252
+ padding: 15px;
253
+ font-size: 1.2em;
254
+ text-align: center;
255
+ text-decoration: none;
256
+ outline: none;
257
+ box-shadow: none;
258
+ }
259
+
260
+ #wpp-listing .wpp-tabbed-nav li a .fa {
261
+ display: inline-block;
262
+ margin: 0 8px 0 0;
263
+ }
264
+
265
+ .wpp-tab-content {
266
+ display: none;
267
+ overflow: hidden;
268
+ padding: 2% 30px;
269
+ width: 100%;
270
+ box-sizing: border-box;
271
+ }
272
+
273
+ .wpp-tab-content-active {
274
+ display: block;
275
+ }
276
+
277
+ .wpp-tab-content .spinner {
278
+ display: block;
279
+ visibility: visible;
280
+ float: none;
281
+ margin-left: auto;
282
+ margin-right: auto;
283
+ }
284
+
285
+ .popular-posts-list {
286
+ margin: 0 0 0 0;
287
+ padding: 0;
288
+ list-style: none;
289
+ counter-reset: wpp-counter;
290
+ font-size: 1rem;
291
+ line-height: 1.2;
292
+ }
293
+
294
+ .popular-posts-list li {
295
+ counter-increment: wpp-counter;
296
+ margin: 0 1% 15px 1%;
297
+ padding: 0 0 10px 0;
298
+ border-bottom: #f0f0f0 1px solid;
299
+ }
300
+
301
+ .popular-posts-list li::before {
302
+ display: inline-block;
303
+ width: 20px;
304
+ content: counter(wpp-counter) ". ";
305
+ }
306
+
307
+ .popular-posts-list li:last-child,
308
+ .popular-posts-list li:last-child {
309
+ margin: 0 1%;
310
+ border: none;
311
+ }
312
+
313
+ .popular-posts-list li a.wpp-title {
314
+ display: inline;
315
+ font-size: 1em;
316
+ text-decoration: none;
317
+ }
318
+
319
+ .popular-posts-list li:first-child,
320
+ .popular-posts-list li:first-child a.wpp-title {
321
+ font-size: 1.15em;
322
+ }
323
+
324
+ .popular-posts-list li:nth-child(2),
325
+ .popular-posts-list li:nth-child(2) a.wpp-title {
326
+ font-size: 1.05em;
327
+ }
328
+
329
+ .popular-posts-list li:first-child a.wpp-title,
330
+ .popular-posts-list li:nth-child(2) a.wpp-title,
331
+ .popular-posts-list li:nth-child(3) a.wpp-title {
332
+ font-weight: bold;
333
+ letter-spacing: -1px;
334
+ }
335
+
336
+ .popular-posts-list li a.wpp-title:hover {
337
+ text-decoration: underline;
338
+ }
339
+
340
+ .popular-posts-list li span {
341
+ color: #bbb;
342
+ font-size: 13px;
343
+ }
344
+
345
+ .popular-posts-list li small {
346
+ display: none;
347
+ font-size: 13px;
348
+ }
349
+
350
+ .popular-posts-list li:hover small {
351
+ display: inline;
352
+ }
353
+
354
+ #wpp_params {}
355
+
356
+ #wpp_params div {
357
+ }
358
+
359
+ #wpp_params div table {
360
+ width: 100%;
361
+ min-width: 800px;
362
+ background: white;
363
+ }
364
+
365
+ #wpp_params div table tr th {
366
+ font-size: 1.2em;
367
+ text-align: left;
368
+ border-bottom: #dedede 1px solid;
369
+ }
370
+
371
+ #wpp_params div table tr th,
372
+ #wpp_params div table tr td {
373
+ padding: 1em;
374
+ }
375
+
376
+ #wpp_params div table tr td {
377
+ position: static !important;
378
+ clear: none !important;
379
+ display: table-cell !important;
380
+ vertical-align: top;
381
+ }
382
+
383
+ .clear {
384
+ float:none;
385
+ clear:both;
386
+ width:100%;
387
+ }
388
+
389
+ /*
390
+ * Media Queries
391
+ */
392
+
393
+ /* Small devices */
394
+ @media only screen and (max-width: 480px){
395
+
396
+ }
397
+
398
+ /* Tablets & small desktops */
399
+ @media only screen and (max-width: 768px) {
400
+
401
+ .wpp-wrapper {
402
+ margin: 20px 12px 0 2px;
403
+ }
404
+
405
+ #wpp-listing .wpp-tabbed-nav li a span:last-child {
406
+ display: none;
407
+ }
408
+
409
+ #wpp-listing .wpp-tabbed-nav li a .fa {
410
+ margin: 0 0 0 0;
411
+ }
412
+
413
+ }
414
+
415
+ /* Medium desktops, Large desktops & other devices */
416
+ @media only screen and (max-width: 992px) { /* 960 + 16 + 16 */
417
+
418
+ }
assets/css/datepicker.css CHANGED
@@ -1,399 +1,399 @@
1
- /*! jQuery UI - v1.12.1 - 2017-08-15
2
- * http://jqueryui.com
3
- * Includes: core.css, datepicker.css
4
- * Copyright jQuery Foundation and other contributors; Licensed MIT */
5
-
6
- /* Layout helpers
7
- ----------------------------------*/
8
- .ui-helper-hidden {
9
- display: none;
10
- }
11
- .ui-helper-hidden-accessible {
12
- border: 0;
13
- clip: rect(0 0 0 0);
14
- height: 1px;
15
- margin: -1px;
16
- overflow: hidden;
17
- padding: 0;
18
- position: absolute;
19
- width: 1px;
20
- }
21
- .ui-helper-reset {
22
- margin: 0;
23
- padding: 0;
24
- border: 0;
25
- outline: 0;
26
- line-height: 1.3;
27
- text-decoration: none;
28
- font-size: 100%;
29
- list-style: none;
30
- }
31
- .ui-helper-clearfix:before,
32
- .ui-helper-clearfix:after {
33
- content: "";
34
- display: table;
35
- border-collapse: collapse;
36
- }
37
- .ui-helper-clearfix:after {
38
- clear: both;
39
- }
40
- .ui-helper-zfix {
41
- width: 100%;
42
- height: 100%;
43
- top: 0;
44
- left: 0;
45
- position: absolute;
46
- opacity: 0;
47
- filter:Alpha(Opacity=0); /* support: IE8 */
48
- }
49
-
50
- .ui-front {
51
- z-index: 100;
52
- }
53
-
54
-
55
- /* Interaction Cues
56
- ----------------------------------*/
57
- .ui-state-disabled {
58
- cursor: default !important;
59
- pointer-events: none;
60
- }
61
-
62
-
63
- /* Icons
64
- ----------------------------------*/
65
- .ui-icon {
66
- display: inline-block;
67
- vertical-align: middle;
68
- margin-top: -.25em;
69
- position: relative;
70
- text-indent: -99999px;
71
- overflow: hidden;
72
- background-repeat: no-repeat;
73
- }
74
-
75
- .ui-widget-icon-block {
76
- left: 50%;
77
- margin-left: -8px;
78
- display: block;
79
- }
80
-
81
- /* Misc visuals
82
- ----------------------------------*/
83
-
84
- /* Overlays */
85
- .ui-widget-overlay {
86
- position: fixed;
87
- top: 0;
88
- left: 0;
89
- width: 100%;
90
- height: 100%;
91
- }
92
- .ui-datepicker {
93
- width: 17em;
94
- padding: .2em .2em 0;
95
- display: none;
96
- }
97
- .ui-datepicker .ui-datepicker-header {
98
- position: relative;
99
- padding: .2em 0;
100
- }
101
- .ui-datepicker .ui-datepicker-prev,
102
- .ui-datepicker .ui-datepicker-next {
103
- position: absolute;
104
- top: 2px;
105
- width: 1.8em;
106
- height: 1.8em;
107
- }
108
- .ui-datepicker .ui-datepicker-prev-hover,
109
- .ui-datepicker .ui-datepicker-next-hover {
110
- top: 1px;
111
- }
112
- .ui-datepicker .ui-datepicker-prev {
113
- left: 2px;
114
- }
115
- .ui-datepicker .ui-datepicker-next {
116
- right: 2px;
117
- }
118
- .ui-datepicker .ui-datepicker-prev-hover {
119
- left: 1px;
120
- }
121
- .ui-datepicker .ui-datepicker-next-hover {
122
- right: 1px;
123
- }
124
- .ui-datepicker .ui-datepicker-prev span,
125
- .ui-datepicker .ui-datepicker-next span {
126
- display: block;
127
- position: absolute;
128
- left: 50%;
129
- margin-left: -8px;
130
- top: 50%;
131
- margin-top: -8px;
132
- }
133
- .ui-datepicker .ui-datepicker-title {
134
- margin: 0 2.3em;
135
- line-height: 1.8em;
136
- text-align: center;
137
- }
138
- .ui-datepicker .ui-datepicker-title select {
139
- font-size: 1em;
140
- margin: 1px 0;
141
- }
142
- .ui-datepicker select.ui-datepicker-month,
143
- .ui-datepicker select.ui-datepicker-year {
144
- width: 45%;
145
- }
146
- .ui-datepicker table {
147
- width: 100%;
148
- font-size: .9em;
149
- border-collapse: collapse;
150
- margin: 0 0 .4em;
151
- }
152
- .ui-datepicker th {
153
- padding: .7em .3em;
154
- text-align: center;
155
- font-weight: bold;
156
- border: 0;
157
- }
158
- .ui-datepicker td {
159
- border: 0;
160
- padding: 1px;
161
- }
162
- .ui-datepicker td span,
163
- .ui-datepicker td a {
164
- display: block;
165
- padding: .2em;
166
- text-align: right;
167
- text-decoration: none;
168
- }
169
- .ui-datepicker .ui-datepicker-buttonpane {
170
- background-image: none;
171
- margin: .7em 0 0 0;
172
- padding: 0 .2em;
173
- border-left: 0;
174
- border-right: 0;
175
- border-bottom: 0;
176
- }
177
- .ui-datepicker .ui-datepicker-buttonpane button {
178
- float: right;
179
- margin: .5em .2em .4em;
180
- cursor: pointer;
181
- padding: .2em .6em .3em .6em;
182
- width: auto;
183
- overflow: visible;
184
- }
185
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
186
- float: left;
187
- }
188
-
189
- /* with multiple calendars */
190
- .ui-datepicker.ui-datepicker-multi {
191
- width: auto;
192
- }
193
- .ui-datepicker-multi .ui-datepicker-group {
194
- float: left;
195
- }
196
- .ui-datepicker-multi .ui-datepicker-group table {
197
- width: 95%;
198
- margin: 0 auto .4em;
199
- }
200
- .ui-datepicker-multi-2 .ui-datepicker-group {
201
- width: 50%;
202
- }
203
- .ui-datepicker-multi-3 .ui-datepicker-group {
204
- width: 33.3%;
205
- }
206
- .ui-datepicker-multi-4 .ui-datepicker-group {
207
- width: 25%;
208
- }
209
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
210
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
211
- border-left-width: 0;
212
- }
213
- .ui-datepicker-multi .ui-datepicker-buttonpane {
214
- clear: left;
215
- }
216
- .ui-datepicker-row-break {
217
- clear: both;
218
- width: 100%;
219
- font-size: 0;
220
- }
221
-
222
- /* RTL support */
223
- .ui-datepicker-rtl {
224
- direction: rtl;
225
- }
226
- .ui-datepicker-rtl .ui-datepicker-prev {
227
- right: 2px;
228
- left: auto;
229
- }
230
- .ui-datepicker-rtl .ui-datepicker-next {
231
- left: 2px;
232
- right: auto;
233
- }
234
- .ui-datepicker-rtl .ui-datepicker-prev:hover {
235
- right: 1px;
236
- left: auto;
237
- }
238
- .ui-datepicker-rtl .ui-datepicker-next:hover {
239
- left: 1px;
240
- right: auto;
241
- }
242
- .ui-datepicker-rtl .ui-datepicker-buttonpane {
243
- clear: right;
244
- }
245
- .ui-datepicker-rtl .ui-datepicker-buttonpane button {
246
- float: left;
247
- }
248
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
249
- .ui-datepicker-rtl .ui-datepicker-group {
250
- float: right;
251
- }
252
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
253
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
254
- border-right-width: 0;
255
- border-left-width: 1px;
256
- }
257
-
258
- /* Icons */
259
- .ui-datepicker .ui-icon {
260
- display: block;
261
- text-indent: -99999px;
262
- overflow: hidden;
263
- background-repeat: no-repeat;
264
- left: .5em;
265
- top: .3em;
266
- }
267
-
268
-
269
- /*
270
- * Custom datepicker theme for WPP.
271
- *
272
- * @author Hector Cabrera
273
- */
274
-
275
- .ui-datepicker {
276
- background: #fff;
277
- -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
278
- -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
279
- box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
280
- border-radius: 5px;
281
- }
282
-
283
- .ui-datepicker-header {}
284
-
285
- .ui-datepicker .ui-datepicker-prev {
286
- left: 0;
287
- }
288
-
289
- .ui-datepicker .ui-datepicker-next {
290
- right: 0;
291
- }
292
-
293
- .ui-datepicker .ui-datepicker-prev span,
294
- .ui-datepicker .ui-datepicker-next span {
295
- display: block;
296
- position: absolute;
297
- /*left: 50%;
298
- margin-left: -8px;
299
- top: 50%;
300
- margin-top: -8px;*/
301
- }
302
-
303
- .ui-datepicker-prev:before,
304
- .ui-datepicker-next:after {
305
- position: absolute;
306
- top: 6px;
307
- display: inline-block;
308
- font-family: 'FontAwesome';
309
- line-height: 1.1em;
310
- }
311
-
312
- .ui-datepicker-prev:before {
313
- left: 9px;
314
- content: "\f060";
315
- }
316
-
317
- .ui-datepicker-next:after {
318
- right: 9px;
319
- content: "\f061";
320
- }
321
-
322
- .ui-datepicker .ui-datepicker-prev-hover,
323
- .ui-datepicker .ui-datepicker-next-hover {
324
- top: 2px !important;
325
- }
326
-
327
- .ui-datepicker-calendar {}
328
-
329
- .ui-datepicker-calendar tr td {
330
- text-align: center;
331
- }
332
-
333
- .ui-datepicker-unselectable span {
334
- color: #ccc;
335
- text-align: center !important;
336
- }
337
-
338
- .ui-datepicker-calendar tr td a {
339
- text-align: center;
340
- background: #fcfcfc;
341
- }
342
-
343
- .ui-datepicker-calendar tr td.date-range-selected a {
344
- color: #fff;
345
- text-shadow: 0 -1px 1px #ba281e, 1px 0 1px #ba281e, 0 1px 1px #ba281e, -1px 0 1px #ba281e;
346
- background: #e14d43;
347
- }
348
-
349
- .ui-datepicker-buttonpane {}
350
-
351
- .ui-datepicker-buttonpane button {
352
- display: inline-block;
353
- text-decoration: none;
354
- font-size: 13px;
355
- line-height: 26px;
356
- height: 28px;
357
- margin: 0;
358
- padding: 0 10px 1px !important;
359
- border-color: #ccc;
360
- background: #f7f7f7;
361
- vertical-align: top;
362
- cursor: pointer;
363
- border-width: 1px;
364
- border-style: solid;
365
- -webkit-appearance: none;
366
- -webkit-border-radius: 3px;
367
- border-radius: 3px;
368
- white-space: nowrap;
369
- -webkit-box-sizing: border-box;
370
- -moz-box-sizing: border-box;
371
- box-sizing: border-box;
372
- }
373
-
374
- /* Today button */
375
- .ui-datepicker-buttonpane .ui-datepicker-current {
376
- display: none;
377
- }
378
-
379
- .ui-datepicker-buttonpane .ui-priority-primary {
380
- color: #fff;
381
- background: #e14d43;
382
- border-color: #d02c21 #ba281e #ba281e;
383
- -webkit-box-shadow: 0 1px 0 #ba281e;
384
- box-shadow: 0 1px 0 #ba281e;
385
- text-shadow: 0 -1px 1px #ba281e, 1px 0 1px #ba281e, 0 1px 1px #ba281e, -1px 0 1px #ba281e;
386
- }
387
-
388
- .ui-datepicker-buttonpane .ui-priority-primary:hover {
389
- background: #e35950;
390
- border-color: #ba281e;
391
- }
392
-
393
- .ui-datepicker-buttonpane .ui-priority-secondary {
394
- color: #555;
395
- border-color: #ccc;
396
- background: #f7f7f7;
397
- -webkit-box-shadow: 0 1px 0 #ccc;
398
- box-shadow: 0 1px 0 #ccc;
399
- }
1
+ /*! jQuery UI - v1.12.1 - 2017-08-15
2
+ * http://jqueryui.com
3
+ * Includes: core.css, datepicker.css
4
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ /* Layout helpers
7
+ ----------------------------------*/
8
+ .ui-helper-hidden {
9
+ display: none;
10
+ }
11
+ .ui-helper-hidden-accessible {
12
+ border: 0;
13
+ clip: rect(0 0 0 0);
14
+ height: 1px;
15
+ margin: -1px;
16
+ overflow: hidden;
17
+ padding: 0;
18
+ position: absolute;
19
+ width: 1px;
20
+ }
21
+ .ui-helper-reset {
22
+ margin: 0;
23
+ padding: 0;
24
+ border: 0;
25
+ outline: 0;
26
+ line-height: 1.3;
27
+ text-decoration: none;
28
+ font-size: 100%;
29
+ list-style: none;
30
+ }
31
+ .ui-helper-clearfix:before,
32
+ .ui-helper-clearfix:after {
33
+ content: "";
34
+ display: table;
35
+ border-collapse: collapse;
36
+ }
37
+ .ui-helper-clearfix:after {
38
+ clear: both;
39
+ }
40
+ .ui-helper-zfix {
41
+ width: 100%;
42
+ height: 100%;
43
+ top: 0;
44
+ left: 0;
45
+ position: absolute;
46
+ opacity: 0;
47
+ filter:Alpha(Opacity=0); /* support: IE8 */
48
+ }
49
+
50
+ .ui-front {
51
+ z-index: 100;
52
+ }
53
+
54
+
55
+ /* Interaction Cues
56
+ ----------------------------------*/
57
+ .ui-state-disabled {
58
+ cursor: default !important;
59
+ pointer-events: none;
60
+ }
61
+
62
+
63
+ /* Icons
64
+ ----------------------------------*/
65
+ .ui-icon {
66
+ display: inline-block;
67
+ vertical-align: middle;
68
+ margin-top: -.25em;
69
+ position: relative;
70
+ text-indent: -99999px;
71
+ overflow: hidden;
72
+ background-repeat: no-repeat;
73
+ }
74
+
75
+ .ui-widget-icon-block {
76
+ left: 50%;
77
+ margin-left: -8px;
78
+ display: block;
79
+ }
80
+
81
+ /* Misc visuals
82
+ ----------------------------------*/
83
+
84
+ /* Overlays */
85
+ .ui-widget-overlay {
86
+ position: fixed;
87
+ top: 0;
88
+ left: 0;
89
+ width: 100%;
90
+ height: 100%;
91
+ }
92
+ .ui-datepicker {
93
+ width: 17em;
94
+ padding: .2em .2em 0;
95
+ display: none;
96
+ }
97
+ .ui-datepicker .ui-datepicker-header {
98
+ position: relative;
99
+ padding: .2em 0;
100
+ }
101
+ .ui-datepicker .ui-datepicker-prev,
102
+ .ui-datepicker .ui-datepicker-next {
103
+ position: absolute;
104
+ top: 2px;
105
+ width: 1.8em;
106
+ height: 1.8em;
107
+ }
108
+ .ui-datepicker .ui-datepicker-prev-hover,
109
+ .ui-datepicker .ui-datepicker-next-hover {
110
+ top: 1px;
111
+ }
112
+ .ui-datepicker .ui-datepicker-prev {
113
+ left: 2px;
114
+ }
115
+ .ui-datepicker .ui-datepicker-next {
116
+ right: 2px;
117
+ }
118
+ .ui-datepicker .ui-datepicker-prev-hover {
119
+ left: 1px;
120
+ }
121
+ .ui-datepicker .ui-datepicker-next-hover {
122
+ right: 1px;
123
+ }
124
+ .ui-datepicker .ui-datepicker-prev span,
125
+ .ui-datepicker .ui-datepicker-next span {
126
+ display: block;
127
+ position: absolute;
128
+ left: 50%;
129
+ margin-left: -8px;
130
+ top: 50%;
131
+ margin-top: -8px;
132
+ }
133
+ .ui-datepicker .ui-datepicker-title {
134
+ margin: 0 2.3em;
135
+ line-height: 1.8em;
136
+ text-align: center;
137
+ }
138
+ .ui-datepicker .ui-datepicker-title select {
139
+ font-size: 1em;
140
+ margin: 1px 0;
141
+ }
142
+ .ui-datepicker select.ui-datepicker-month,
143
+ .ui-datepicker select.ui-datepicker-year {
144
+ width: 45%;
145
+ }
146
+ .ui-datepicker table {
147
+ width: 100%;
148
+ font-size: .9em;
149
+ border-collapse: collapse;
150
+ margin: 0 0 .4em;
151
+ }
152
+ .ui-datepicker th {
153
+ padding: .7em .3em;
154
+ text-align: center;
155
+ font-weight: bold;
156
+ border: 0;
157
+ }
158
+ .ui-datepicker td {
159
+ border: 0;
160
+ padding: 1px;
161
+ }
162
+ .ui-datepicker td span,
163
+ .ui-datepicker td a {
164
+ display: block;
165
+ padding: .2em;
166
+ text-align: right;
167
+ text-decoration: none;
168
+ }
169
+ .ui-datepicker .ui-datepicker-buttonpane {
170
+ background-image: none;
171
+ margin: .7em 0 0 0;
172
+ padding: 0 .2em;
173
+ border-left: 0;
174
+ border-right: 0;
175
+ border-bottom: 0;
176
+ }
177
+ .ui-datepicker .ui-datepicker-buttonpane button {
178
+ float: right;
179
+ margin: .5em .2em .4em;
180
+ cursor: pointer;
181
+ padding: .2em .6em .3em .6em;
182
+ width: auto;
183
+ overflow: visible;
184
+ }
185
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
186
+ float: left;
187
+ }
188
+
189
+ /* with multiple calendars */
190
+ .ui-datepicker.ui-datepicker-multi {
191
+ width: auto;
192
+ }
193
+ .ui-datepicker-multi .ui-datepicker-group {
194
+ float: left;
195
+ }
196
+ .ui-datepicker-multi .ui-datepicker-group table {
197
+ width: 95%;
198
+ margin: 0 auto .4em;
199
+ }
200
+ .ui-datepicker-multi-2 .ui-datepicker-group {
201
+ width: 50%;
202
+ }
203
+ .ui-datepicker-multi-3 .ui-datepicker-group {
204
+ width: 33.3%;
205
+ }
206
+ .ui-datepicker-multi-4 .ui-datepicker-group {
207
+ width: 25%;
208
+ }
209
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
210
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
211
+ border-left-width: 0;
212
+ }
213
+ .ui-datepicker-multi .ui-datepicker-buttonpane {
214
+ clear: left;
215
+ }
216
+ .ui-datepicker-row-break {
217
+ clear: both;
218
+ width: 100%;
219
+ font-size: 0;
220
+ }
221
+
222
+ /* RTL support */
223
+ .ui-datepicker-rtl {
224
+ direction: rtl;
225
+ }
226
+ .ui-datepicker-rtl .ui-datepicker-prev {
227
+ right: 2px;
228
+ left: auto;
229
+ }
230
+ .ui-datepicker-rtl .ui-datepicker-next {
231
+ left: 2px;
232
+ right: auto;
233
+ }
234
+ .ui-datepicker-rtl .ui-datepicker-prev:hover {
235
+ right: 1px;
236
+ left: auto;
237
+ }
238
+ .ui-datepicker-rtl .ui-datepicker-next:hover {
239
+ left: 1px;
240
+ right: auto;
241
+ }
242
+ .ui-datepicker-rtl .ui-datepicker-buttonpane {
243
+ clear: right;
244
+ }
245
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button {
246
+ float: left;
247
+ }
248
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
249
+ .ui-datepicker-rtl .ui-datepicker-group {
250
+ float: right;
251
+ }
252
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
253
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
254
+ border-right-width: 0;
255
+ border-left-width: 1px;
256
+ }
257
+
258
+ /* Icons */
259
+ .ui-datepicker .ui-icon {
260
+ display: block;
261
+ text-indent: -99999px;
262
+ overflow: hidden;
263
+ background-repeat: no-repeat;
264
+ left: .5em;
265
+ top: .3em;
266
+ }
267
+
268
+
269
+ /*
270
+ * Custom datepicker theme for WPP.
271
+ *
272
+ * @author Hector Cabrera
273
+ */
274
+
275
+ .ui-datepicker {
276
+ background: #fff;
277
+ -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
278
+ -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
279
+ box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25);
280
+ border-radius: 5px;
281
+ }
282
+
283
+ .ui-datepicker-header {}
284
+
285
+ .ui-datepicker .ui-datepicker-prev {
286
+ left: 0;
287
+ }
288
+
289
+ .ui-datepicker .ui-datepicker-next {
290
+ right: 0;
291
+ }
292
+
293
+ .ui-datepicker .ui-datepicker-prev span,
294
+ .ui-datepicker .ui-datepicker-next span {
295
+ display: block;
296
+ position: absolute;
297
+ /*left: 50%;
298
+ margin-left: -8px;
299
+ top: 50%;
300
+ margin-top: -8px;*/
301
+ }
302
+
303
+ .ui-datepicker-prev:before,
304
+ .ui-datepicker-next:after {
305
+ position: absolute;
306
+ top: 6px;
307
+ display: inline-block;
308
+ font-family: 'FontAwesome';
309
+ line-height: 1.1em;
310
+ }
311
+
312
+ .ui-datepicker-prev:before {
313
+ left: 9px;
314
+ content: "\f060";
315
+ }
316
+
317
+ .ui-datepicker-next:after {
318
+ right: 9px;
319
+ content: "\f061";
320
+ }
321
+
322
+ .ui-datepicker .ui-datepicker-prev-hover,
323
+ .ui-datepicker .ui-datepicker-next-hover {
324
+ top: 2px !important;
325
+ }
326
+
327
+ .ui-datepicker-calendar {}
328
+
329
+ .ui-datepicker-calendar tr td {
330
+ text-align: center;
331
+ }
332
+
333
+ .ui-datepicker-unselectable span {
334
+ color: #ccc;
335
+ text-align: center !important;
336
+ }
337
+
338
+ .ui-datepicker-calendar tr td a {
339
+ text-align: center;
340
+ background: #fcfcfc;
341
+ }
342
+
343
+ .ui-datepicker-calendar tr td.date-range-selected a {
344
+ color: #fff;
345
+ text-shadow: 0 -1px 1px #ba281e, 1px 0 1px #ba281e, 0 1px 1px #ba281e, -1px 0 1px #ba281e;
346
+ background: #e14d43;
347
+ }
348
+
349
+ .ui-datepicker-buttonpane {}
350
+
351
+ .ui-datepicker-buttonpane button {
352
+ display: inline-block;
353
+ text-decoration: none;
354
+ font-size: 13px;
355
+ line-height: 26px;
356
+ height: 28px;
357
+ margin: 0;
358
+ padding: 0 10px 1px !important;
359
+ border-color: #ccc;
360
+ background: #f7f7f7;
361
+ vertical-align: top;
362
+ cursor: pointer;
363
+ border-width: 1px;
364
+ border-style: solid;
365
+ -webkit-appearance: none;
366
+ -webkit-border-radius: 3px;
367
+ border-radius: 3px;
368
+ white-space: nowrap;
369
+ -webkit-box-sizing: border-box;
370
+ -moz-box-sizing: border-box;
371
+ box-sizing: border-box;
372
+ }
373
+
374
+ /* Today button */
375
+ .ui-datepicker-buttonpane .ui-datepicker-current {
376
+ display: none;
377
+ }
378
+
379
+ .ui-datepicker-buttonpane .ui-priority-primary {
380
+ color: #fff;
381
+ background: #e14d43;
382
+ border-color: #d02c21 #ba281e #ba281e;
383
+ -webkit-box-shadow: 0 1px 0 #ba281e;
384
+ box-shadow: 0 1px 0 #ba281e;
385
+ text-shadow: 0 -1px 1px #ba281e, 1px 0 1px #ba281e, 0 1px 1px #ba281e, -1px 0 1px #ba281e;
386
+ }
387
+
388
+ .ui-datepicker-buttonpane .ui-priority-primary:hover {
389
+ background: #e35950;
390
+ border-color: #ba281e;
391
+ }
392
+
393
+ .ui-datepicker-buttonpane .ui-priority-secondary {
394
+ color: #555;
395
+ border-color: #ccc;
396
+ background: #f7f7f7;
397
+ -webkit-box-shadow: 0 1px 0 #ccc;
398
+ box-shadow: 0 1px 0 #ccc;
399
+ }
assets/css/fontello.css CHANGED
@@ -1,50 +1,50 @@
1
- @font-face {
2
- font-family: 'fontello';
3
- src: url('../fonts/fontello.eot?57329479');
4
- src: url('../fonts/fontello.eot?57329479#iefix') format('embedded-opentype'),
5
- url('../fonts/fontello.woff2?57329479') format('woff2'),
6
- url('../fonts/fontello.woff?57329479') format('woff'),
7
- url('../fonts/fontello.ttf?57329479') format('truetype'),
8
- url('../fonts/fontello.svg?57329479#fontello') format('svg');
9
- font-weight: normal;
10
- font-style: normal;
11
- }
12
- [class^="wpp-icon-"]:before, [class*=" icon-"]:before {
13
- font-family: "fontello";
14
- font-style: normal;
15
- font-weight: normal;
16
- speak: none;
17
-
18
- display: inline-block;
19
- text-decoration: inherit;
20
- width: 1em;
21
- margin-right: .2em;
22
- text-align: center;
23
- /* opacity: .8; */
24
-
25
- /* For safety - reset parent styles, that can break glyph codes*/
26
- font-variant: normal;
27
- text-transform: none;
28
-
29
- /* fix buttons height, for twitter bootstrap */
30
- line-height: 1em;
31
-
32
- /* Animation center compensation - margins should be symmetric */
33
- /* remove if not needed */
34
- margin-left: .2em;
35
-
36
- /* you can be more comfortable with increased icons size */
37
- /* font-size: 120%; */
38
-
39
- /* Font smoothing. That was taken from TWBS */
40
- -webkit-font-smoothing: antialiased;
41
- -moz-osx-font-smoothing: grayscale;
42
-
43
- /* Uncomment for 3D effect */
44
- /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
45
- }
46
-
47
- .wpp-icon-eye:before { content: '\e800'; }
48
- .wpp-icon-award:before { content: '\e801'; }
49
- .wpp-icon-comment:before { content: '\f0e5'; }
50
  .wpp-icon-rocket:before { content: '\f135'; }
1
+ @font-face {
2
+ font-family: 'fontello';
3
+ src: url('../fonts/fontello.eot?57329479');
4
+ src: url('../fonts/fontello.eot?57329479#iefix') format('embedded-opentype'),
5
+ url('../fonts/fontello.woff2?57329479') format('woff2'),
6
+ url('../fonts/fontello.woff?57329479') format('woff'),
7
+ url('../fonts/fontello.ttf?57329479') format('truetype'),
8
+ url('../fonts/fontello.svg?57329479#fontello') format('svg');
9
+ font-weight: normal;
10
+ font-style: normal;
11
+ }
12
+ [class^="wpp-icon-"]:before, [class*=" icon-"]:before {
13
+ font-family: "fontello";
14
+ font-style: normal;
15
+ font-weight: normal;
16
+ speak: none;
17
+
18
+ display: inline-block;
19
+ text-decoration: inherit;
20
+ width: 1em;
21
+ margin-right: .2em;
22
+ text-align: center;
23
+ /* opacity: .8; */
24
+
25
+ /* For safety - reset parent styles, that can break glyph codes*/
26
+ font-variant: normal;
27
+ text-transform: none;
28
+
29
+ /* fix buttons height, for twitter bootstrap */
30
+ line-height: 1em;
31
+
32
+ /* Animation center compensation - margins should be symmetric */
33
+ /* remove if not needed */
34
+ margin-left: .2em;
35
+
36
+ /* you can be more comfortable with increased icons size */
37
+ /* font-size: 120%; */
38
+
39
+ /* Font smoothing. That was taken from TWBS */
40
+ -webkit-font-smoothing: antialiased;
41
+ -moz-osx-font-smoothing: grayscale;
42
+
43
+ /* Uncomment for 3D effect */
44
+ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
45
+ }
46
+
47
+ .wpp-icon-eye:before { content: '\e800'; }
48
+ .wpp-icon-award:before { content: '\e801'; }
49
+ .wpp-icon-comment:before { content: '\f0e5'; }
50
  .wpp-icon-rocket:before { content: '\f135'; }
assets/css/wpp.css CHANGED
@@ -1,77 +1,77 @@
1
- /*
2
- Wordpress Popular Posts plugin stylesheet
3
- Developed by Hector Cabrera
4
- cabrerahector.com | @cabrerahector
5
-
6
- Use the following classes to style your popular posts list as you like.
7
- */
8
-
9
- /* Styles the "Sorry, no data so far" message */
10
- .wpp-no-data {
11
- }
12
-
13
- /* UL - Popular Posts container styles */
14
- .wpp-list {
15
- }
16
-
17
- /* LI - Post container styles */
18
- .wpp-list li {
19
- overflow: hidden;
20
- float: none;
21
- clear: both;
22
- margin-bottom: 1rem;
23
- }
24
-
25
- .wpp-list li:last-of-type {
26
- margin-bottom: 0;
27
- }
28
-
29
- /* Styles for the popular post in view */
30
- .wpp-list li.current {
31
- }
32
-
33
- /* Thumbnail styles */
34
- .wpp-thumbnail {
35
- display: inline;
36
- float: left;
37
- margin: 0 1rem 0 0;
38
- border: none;
39
- }
40
-
41
- /* Title styles */
42
- .wpp-post-title {
43
- }
44
-
45
- /* Excerpt styles */
46
- .wpp-excerpt {
47
- }
48
-
49
- /* Stats tag styles */
50
- .wpp-meta, .post-stats {
51
- display: block;
52
- font-size: 0.8em;
53
- }
54
-
55
- /* Comments count styles */
56
- .wpp-comments {
57
- }
58
-
59
- /* Views count styles */
60
- .wpp-views {
61
- }
62
-
63
- /* Author styles */
64
- .wpp-author {
65
- }
66
-
67
- /* Post date styles */
68
- .wpp-date {
69
- }
70
-
71
- /* Post category styles */
72
- .wpp-category {
73
- }
74
-
75
- /* WP-PostRatings styles */
76
- .wpp-rating {
77
  }
1
+ /*
2
+ Wordpress Popular Posts plugin stylesheet
3
+ Developed by Hector Cabrera
4
+ cabrerahector.com | @cabrerahector
5
+
6
+ Use the following classes to style your popular posts list as you like.
7
+ */
8
+
9
+ /* Styles the "Sorry, no data so far" message */
10
+ .wpp-no-data {
11
+ }
12
+
13
+ /* UL - Popular Posts container styles */
14
+ .wpp-list {
15
+ }
16
+
17
+ /* LI - Post container styles */
18
+ .wpp-list li {
19
+ overflow: hidden;
20
+ float: none;
21
+ clear: both;
22
+ margin-bottom: 1rem;
23
+ }
24
+
25
+ .wpp-list li:last-of-type {
26
+ margin-bottom: 0;
27
+ }
28
+
29
+ /* Styles for the popular post in view */
30
+ .wpp-list li.current {
31
+ }
32
+
33
+ /* Thumbnail styles */
34
+ .wpp-thumbnail {
35
+ display: inline;
36
+ float: left;
37
+ margin: 0 1rem 0 0;
38
+ border: none;
39
+ }
40
+
41
+ /* Title styles */
42
+ .wpp-post-title {
43
+ }
44
+
45
+ /* Excerpt styles */
46
+ .wpp-excerpt {
47
+ }
48
+
49
+ /* Stats tag styles */
50
+ .wpp-meta, .post-stats {
51
+ display: block;
52
+ font-size: 0.8em;
53
+ }
54
+
55
+ /* Comments count styles */
56
+ .wpp-comments {
57
+ }
58
+
59
+ /* Views count styles */
60
+ .wpp-views {
61
+ }
62
+
63
+ /* Author styles */
64
+ .wpp-author {
65
+ }
66
+
67
+ /* Post date styles */
68
+ .wpp-date {
69
+ }
70
+
71
+ /* Post category styles */
72
+ .wpp-category {
73
+ }
74
+
75
+ /* WP-PostRatings styles */
76
+ .wpp-rating {
77
  }
assets/fonts/fontello.svg CHANGED
@@ -1,18 +1,18 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
5
- <defs>
6
- <font id="fontello" horiz-adv-x="1000" >
7
- <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
- <missing-glyph horiz-adv-x="1000" />
9
- <glyph glyph-name="eye" unicode="&#xe800;" d="M929 314q-85 132-213 197 34-58 34-125 0-103-73-177t-177-73-177 73-73 177q0 67 34 125-128-65-213-197 75-114 187-182t242-68 243 68 186 182z m-402 215q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m473-215q0-19-11-38-78-129-210-206t-279-77-279 77-210 206q-11 19-11 38t11 39q78 128 210 205t279 78 279-78 210-205q11-20 11-39z" horiz-adv-x="1000" />
10
-
11
- <glyph glyph-name="award" unicode="&#xe801;" d="M256 357q-42 91-42 207h-143v-53q0-44 53-91t132-63z m601 154v53h-143q0-116-41-207 79 16 131 63t53 91z m72 71v-71q0-40-24-80t-62-73-97-54-120-25q-23-30-53-53-21-19-29-40t-8-50q0-30 17-51t54-21q42 0 75-25t32-64v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 39 33 64t74 25q38 0 55 21t17 51q0 28-8 50t-29 40q-30 23-53 53-64 3-121 25t-96 54-63 73-23 80v71q0 23 16 38t38 16h160v53q0 37 27 63t63 27h321q37 0 63-27t26-63v-53h161q22 0 38-16t16-38z" horiz-adv-x="928.6" />
12
-
13
- <glyph glyph-name="comment-empty" unicode="&#xf0e5;" d="M500 636q-114 0-213-39t-157-105-59-142q0-62 40-119t113-98l48-28-15-53q-13-51-39-97 85 36 154 96l24 21 32-3q38-5 72-5 114 0 213 39t157 105 59 142-59 142-157 105-213 39z m500-286q0-97-67-179t-182-130-251-48q-39 0-81 4-110-97-257-135-27-8-63-12h-3q-8 0-15 6t-9 15v1q-2 2 0 6t1 6 2 5l4 5t4 5 4 5q4 5 17 19t20 22 17 22 18 28 15 33 15 42q-88 50-138 123t-51 157q0 97 67 179t182 130 251 48 251-48 182-130 67-179z" horiz-adv-x="1000" />
14
-
15
- <glyph glyph-name="rocket" unicode="&#xf135;" d="M804 600q0 22-16 38t-38 16-38-16-16-38 16-38 38-16 38 16 16 38z m125 161q0-139-43-240t-141-202q-45-44-109-98l-11-211q-1-9-9-15l-214-125q-4-2-9-2-7 0-13 5l-36 36q-7 7-4 17l47 155-156 156-154-47q-2-1-6-1-7 0-12 5l-36 36q-10 11-3 22l125 214q6 8 15 9l211 11q54 64 98 109 105 104 200 144t241 40q7 0 13-6t6-12z" horiz-adv-x="928.6" />
16
- </font>
17
- </defs>
18
  </svg>
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="fontello" horiz-adv-x="1000" >
7
+ <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="eye" unicode="&#xe800;" d="M929 314q-85 132-213 197 34-58 34-125 0-103-73-177t-177-73-177 73-73 177q0 67 34 125-128-65-213-197 75-114 187-182t242-68 243 68 186 182z m-402 215q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m473-215q0-19-11-38-78-129-210-206t-279-77-279 77-210 206q-11 19-11 38t11 39q78 128 210 205t279 78 279-78 210-205q11-20 11-39z" horiz-adv-x="1000" />
10
+
11
+ <glyph glyph-name="award" unicode="&#xe801;" d="M256 357q-42 91-42 207h-143v-53q0-44 53-91t132-63z m601 154v53h-143q0-116-41-207 79 16 131 63t53 91z m72 71v-71q0-40-24-80t-62-73-97-54-120-25q-23-30-53-53-21-19-29-40t-8-50q0-30 17-51t54-21q42 0 75-25t32-64v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 39 33 64t74 25q38 0 55 21t17 51q0 28-8 50t-29 40q-30 23-53 53-64 3-121 25t-96 54-63 73-23 80v71q0 23 16 38t38 16h160v53q0 37 27 63t63 27h321q37 0 63-27t26-63v-53h161q22 0 38-16t16-38z" horiz-adv-x="928.6" />
12
+
13
+ <glyph glyph-name="comment-empty" unicode="&#xf0e5;" d="M500 636q-114 0-213-39t-157-105-59-142q0-62 40-119t113-98l48-28-15-53q-13-51-39-97 85 36 154 96l24 21 32-3q38-5 72-5 114 0 213 39t157 105 59 142-59 142-157 105-213 39z m500-286q0-97-67-179t-182-130-251-48q-39 0-81 4-110-97-257-135-27-8-63-12h-3q-8 0-15 6t-9 15v1q-2 2 0 6t1 6 2 5l4 5t4 5 4 5q4 5 17 19t20 22 17 22 18 28 15 33 15 42q-88 50-138 123t-51 157q0 97 67 179t182 130 251 48 251-48 182-130 67-179z" horiz-adv-x="1000" />
14
+
15
+ <glyph glyph-name="rocket" unicode="&#xf135;" d="M804 600q0 22-16 38t-38 16-38-16-16-38 16-38 38-16 38 16 16 38z m125 161q0-139-43-240t-141-202q-45-44-109-98l-11-211q-1-9-9-15l-214-125q-4-2-9-2-7 0-13 5l-36 36q-7 7-4 17l47 155-156 156-154-47q-2-1-6-1-7 0-12 5l-36 36q-10 11-3 22l125 214q6 8 15 9l211 11q54 64 98 109 105 104 200 144t241 40q7 0 13-6t6-12z" horiz-adv-x="928.6" />
16
+ </font>
17
+ </defs>
18
  </svg>
assets/js/admin.js CHANGED
@@ -1,357 +1,357 @@
1
- (function ($) {
2
- "use strict";
3
- $(function () {
4
-
5
- // Stats config
6
- $("#wpp-stats-config-btn, #wpp_stats_options .button-secondary").on("click", function(e){
7
- e.preventDefault();
8
-
9
- // Hide custom range modal box
10
- if ( $("#wpp-stats-range").is(":visible") ) {
11
- $("#wpp-stats-range").hide();
12
- }
13
-
14
- if ( $("#wpp-stats-config").is(":visible") ) {
15
- $("#wpp-stats-config").hide();
16
- }
17
- else{
18
- $("#wpp-stats-config").show();
19
- }
20
- });
21
-
22
- // Stats range
23
- $("#wpp-stats-range form").on('submit', function(e){
24
- e.preventDefault();
25
-
26
- if ( $("#wpp-stats-range").is(":visible") ) {
27
- $("#wpp-stats-range").hide();
28
- }
29
-
30
- get_chart_data( $("#wpp-time-ranges li a[data-range='custom']") );
31
-
32
- $(".wpp-lightbox-tabs li:eq(0) a").trigger("click");
33
- });
34
-
35
- $("#wpp-stats-range form .button-secondary").on('click', function(e){
36
- e.preventDefault();
37
-
38
- if ( $("#wpp-stats-range").is(":visible") ) {
39
- $("#wpp-stats-range").hide();
40
- }
41
-
42
- $("#stats_range_date").val('');
43
-
44
- $(".wpp-lightbox-tabs li:eq(0) a").trigger("click");
45
- });
46
-
47
- function get_chart_data(me) {
48
- var args = {
49
- action: 'wpp_update_chart',
50
- nonce: wpp_admin_params.nonce,
51
- range: me.data("range"),
52
- time_quantity: $("#stats_range_time_quantity").val(),
53
- time_unit: $("#stats_range_time_unit").val()
54
- };
55
-
56
- if ( '' != $("#stats_range_date").val() ){
57
- args.dates = $("#stats_range_date").val();
58
- }
59
-
60
- $.get(
61
- ajaxurl,
62
- args,
63
- function( response ){
64
- if ( 'ok' == response.status ) {
65
- me.parent().addClass("current").siblings().removeClass("current");
66
-
67
- // Update titles
68
- $("#wpp-chart-wrapper h4").html( response.data.totals.label_summary );
69
- $("#wpp-chart-wrapper h5").html( response.data.totals.label_date_range );
70
-
71
- // Update chart
72
- WPPChart.populate(response.data);
73
-
74
- $("#wpp-listing .wpp-tabbed-nav li:eq(0) a").trigger("click");
75
-
76
- // Update lists
77
- args = {
78
- action: 'wpp_get_most_viewed',
79
- nonce: wpp_admin_params.nonce,
80
- items: 'most-viewed'
81
- };
82
-
83
- if ( '' != $("#stats_range_date").val() ){
84
- args.dates = $("#stats_range_date").val();
85
- }
86
-
87
- $("#wpp-listing .wpp-tab-content:eq(0)").html('<span class="spinner"></span>');
88
-
89
- $.get(
90
- ajaxurl,
91
- args,
92
- function( response ){
93
- $("#wpp-listing .wpp-tab-content:eq(0)").html(response);
94
- }
95
- );
96
-
97
- args = {
98
- action: 'wpp_get_most_commented',
99
- nonce: wpp_admin_params.nonce,
100
- items: 'most-commented'
101
- };
102
-
103
- if ( '' != $("#stats_range_date").val() ){
104
- args.dates = $("#stats_range_date").val();
105
- }
106
-
107
- $("#wpp-listing .wpp-tab-content:eq(1)").html('<span class="spinner"></span>');
108
-
109
- $.get(
110
- ajaxurl,
111
- args,
112
- function( response ){
113
- $("#wpp-listing .wpp-tab-content:eq(1)").html(response);
114
- }
115
- );
116
-
117
- args = {
118
- action: 'wpp_get_trending',
119
- nonce: wpp_admin_params.nonce,
120
- items: 'trending'
121
- };
122
-
123
- if ( '' != $("#stats_range_date").val() ){
124
- args.dates = $("#stats_range_date").val();
125
- }
126
-
127
- $("#wpp-listing .wpp-tab-content:eq(2)").html('<span class="spinner"></span>');
128
-
129
- $.get(
130
- ajaxurl,
131
- args,
132
- function( response ){
133
- $("#wpp-listing .wpp-tab-content:eq(2)").html(response);
134
- }
135
- );
136
-
137
- // Unset date range
138
- $("#stats_range_date").val('');
139
- }
140
- }
141
- );
142
-
143
- }
144
-
145
- $("#wpp-time-ranges li a").on("click", function(e){
146
- e.preventDefault();
147
-
148
- var me = $(this);
149
-
150
- // Update chart
151
- if ( WPPChart.canRender() ) {
152
- if ( 'custom' != me.data("range") ) {
153
- get_chart_data(me);
154
- }
155
- else {
156
- // Hide Config modal box
157
- if ( $("#wpp-stats-config").is(":visible") ) {
158
- $("#wpp-stats-config").hide();
159
- }
160
-
161
- if ( !$("#wpp-stats-range").is(":visible") ) {
162
- $("#wpp-stats-range").show();
163
- }
164
- }
165
- }
166
- });
167
-
168
- $("#wpp-time-ranges li.current a").trigger("click");
169
-
170
- $(".wpp-lightbox-tabs li a").on("click", function(e){
171
- e.preventDefault();
172
-
173
- var me = $(this);
174
- me.parent().addClass("active").siblings().removeClass("active");
175
-
176
- me.closest(".wpp-lightbox").find(".wpp-lightbox-tab-content").removeClass("wpp-lightbox-tab-content-active").filter(function( index ) {
177
- return me.parent().index() == index;
178
- }).addClass("wpp-lightbox-tab-content-active");
179
- });
180
-
181
- // Datepicker
182
- $.datepicker._defaults.onAfterUpdate = null;
183
- var datepicker__updateDatepicker = $.datepicker._updateDatepicker;
184
-
185
- $.datepicker._updateDatepicker = function( instance ){
186
- datepicker__updateDatepicker.call( this, instance );
187
-
188
- var onAfterUpdate = this._get( instance, 'onAfterUpdate' );
189
-
190
- if ( onAfterUpdate ) {
191
- onAfterUpdate.apply( ( instance.input ? instance.input[0] : null ), [( instance.input ? instance.input.val() : '' ), instance] );
192
- }
193
- };
194
-
195
- var curr = -1,
196
- prev = -1;
197
-
198
- var dp_field = $("#stats_range_date");
199
-
200
- var wpp_datepicker = dp_field.datepicker({
201
- maxDate: 0,
202
- dateFormat: 'yy-mm-dd',
203
- showButtonPanel: true,
204
- beforeShowDay: function(date){
205
- return [true, ( (date.getTime() >= Math.min(prev, curr) && date.getTime() <= Math.max(prev, curr) ) ? 'date-range-selected' : '' )]
206
- },
207
- onSelect: function(dateText, instance){
208
-
209
- var d1, d2;
210
-
211
- prev = curr;
212
-
213
- curr = ( new Date(instance.selectedYear, instance.selectedMonth, instance.selectedDay) ).getTime();
214
-
215
- if (
216
- -1 == prev
217
- || prev == curr
218
- ) {
219
- prev = curr;
220
- dp_field.val( dateText );
221
- }
222
- else {
223
-
224
- d1 = $.datepicker.formatDate('yy-mm-dd', new Date( Math.min(prev, curr) ), {});
225
- d2 = $.datepicker.formatDate('yy-mm-dd', new Date( Math.max(prev, curr) ), {});
226
-
227
- dp_field.val( d1 + ' ~ ' + d2 );
228
-
229
- }
230
-
231
- $(this).data('datepicker').inline = true;
232
-
233
- },
234
- onClose: function(){
235
- $(this).data('datepicker').inline = false;
236
- },
237
- onAfterUpdate: function( instance ){
238
- var calendar = $(this);
239
-
240
- if (
241
- prev > -1
242
- && curr > -1
243
- ){
244
-
245
- $('<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">OK</button>').appendTo( $(".ui-datepicker-buttonpane") ).on('click', function(){
246
- dp_field.datepicker('hide');
247
- });
248
- }
249
- }
250
- });
251
-
252
- // STATISTICS TABS
253
- $("#wpp-listing .wpp-tabbed-nav li a").on("click", function(e){
254
- e.preventDefault();
255
-
256
- var me = $(this),
257
- target = me.parent().index();
258
-
259
- me.parent().addClass("active").siblings().removeClass("active");
260
-
261
- me.closest("#wpp-listing").children(".wpp-tab-content:eq(" + target + ")").addClass("wpp-tab-content-active").siblings().removeClass("wpp-tab-content-active");
262
-
263
- });
264
-
265
- // TOOLS
266
- // thumb source selection
267
- $("#thumb_source").change(function() {
268
- if ($(this).val() == "custom_field") {
269
- $("#lbl_field, #thumb_field, #row_custom_field, #row_custom_field_resize").show();
270
- } else {
271
- $("#lbl_field, #thumb_field, #row_custom_field, #row_custom_field_resize").hide();
272
- }
273
- });
274
- // file upload
275
- $('#upload_thumb_button').click(function(e) {
276
- e.preventDefault();
277
-
278
- var custom_uploader = wp.media({
279
- title: 'WordPress Popular Posts',
280
- library: { type : 'image' },
281
- button: { text: wpp_admin_params.label_media_upload_button },
282
- id: 'library-' + (Math.random() * 10),
283
- multiple: false
284
- }).on('select', function() {
285
- var attachment = custom_uploader.state().get('selection').first().toJSON();
286
- $('#upload_thumb_src').val( attachment.url );
287
-
288
- var img = new Image();
289
- img.onload = function() {
290
- $("#thumb-review").html( this ).parent().fadeIn();
291
- }
292
- img.src = attachment.url;
293
-
294
- })
295
- .open();
296
-
297
- });
298
- // log limit
299
- $("#log_limit").change(function(){
300
- var me = $(this);
301
-
302
- if (me.val() == 1) {
303
- me.parent().children("label, .description").show();
304
- me.parent().children("br").hide();
305
- } else {
306
- me.parent().children("label, .description").hide();
307
- me.parent().children("br").show();
308
- }
309
- });
310
- // cache interval
311
- $("#cache").change(function() {
312
- if ($(this).val() == 1) {
313
- $("#cache_refresh_interval").show();
314
- } else {
315
- $("#cache_refresh_interval, #cache_too_long").hide();
316
- }
317
- });
318
- // interval
319
- $("#cache_interval_time").change(function() {
320
- var value = parseInt( $("#cache_interval_value").val() );
321
- var time = $(this).val();
322
-
323
- if ( time == "hour" && value > 72 ) {
324
- $("#cache_too_long").show();
325
- } else if ( time == "day" && value > 3 ) {
326
- $("#cache_too_long").show();
327
- } else if ( time == "week" && value > 1 ) {
328
- $("#cache_too_long").show();
329
- } else if ( time == "month" && value >= 1 ) {
330
- $("#cache_too_long").show();
331
- } else if ( time == "year" && value >= 1 ) {
332
- $("#cache_too_long").show();
333
- } else {
334
- $("#cache_too_long").hide();
335
- }
336
- });
337
-
338
- $("#cache_interval_value").change(function() {
339
- var value = parseInt( $(this).val() );
340
- var time = $("#cache_interval_time").val();
341
-
342
- if ( time == "hour" && value > 72 ) {
343
- $("#cache_too_long").show();
344
- } else if ( time == "day" && value > 3 ) {
345
- $("#cache_too_long").show();
346
- } else if ( time == "week" && value > 1 ) {
347
- $("#cache_too_long").show();
348
- } else if ( time == "month" && value >= 1 ) {
349
- $("#cache_too_long").show();
350
- } else if ( time == "year" && value >= 1 ) {
351
- $("#cache_too_long").show();
352
- } else {
353
- $("#cache_too_long").hide();
354
- }
355
- });
356
- });
357
  }(jQuery));
1
+ (function ($) {
2
+ "use strict";
3
+ $(function () {
4
+
5
+ // Stats config
6
+ $("#wpp-stats-config-btn, #wpp_stats_options .button-secondary").on("click", function(e){
7
+ e.preventDefault();
8
+
9
+ // Hide custom range modal box
10
+ if ( $("#wpp-stats-range").is(":visible") ) {
11
+ $("#wpp-stats-range").hide();
12
+ }
13
+
14
+ if ( $("#wpp-stats-config").is(":visible") ) {
15
+ $("#wpp-stats-config").hide();
16
+ }
17
+ else{
18
+ $("#wpp-stats-config").show();
19
+ }
20
+ });
21
+
22
+ // Stats range
23
+ $("#wpp-stats-range form").on('submit', function(e){
24
+ e.preventDefault();
25
+
26
+ if ( $("#wpp-stats-range").is(":visible") ) {
27
+ $("#wpp-stats-range").hide();
28
+ }
29
+
30
+ get_chart_data( $("#wpp-time-ranges li a[data-range='custom']") );
31
+
32
+ $(".wpp-lightbox-tabs li:eq(0) a").trigger("click");
33
+ });
34
+
35
+ $("#wpp-stats-range form .button-secondary").on('click', function(e){
36
+ e.preventDefault();
37
+
38
+ if ( $("#wpp-stats-range").is(":visible") ) {
39
+ $("#wpp-stats-range").hide();
40
+ }
41
+
42
+ $("#stats_range_date").val('');
43
+
44
+ $(".wpp-lightbox-tabs li:eq(0) a").trigger("click");
45
+ });
46
+
47
+ function get_chart_data(me) {
48
+ var args = {
49
+ action: 'wpp_update_chart',
50
+ nonce: wpp_admin_params.nonce,
51
+ range: me.data("range"),
52
+ time_quantity: $("#stats_range_time_quantity").val(),
53
+ time_unit: $("#stats_range_time_unit").val()
54
+ };
55
+
56
+ if ( '' != $("#stats_range_date").val() ){
57
+ args.dates = $("#stats_range_date").val();
58
+ }
59
+
60
+ $.get(
61
+ ajaxurl,
62
+ args,
63
+ function( response ){
64
+ if ( 'ok' == response.status ) {
65
+ me.parent().addClass("current").siblings().removeClass("current");
66
+
67
+ // Update titles
68
+ $("#wpp-chart-wrapper h4").html( response.data.totals.label_summary );
69
+ $("#wpp-chart-wrapper h5").html( response.data.totals.label_date_range );
70
+
71
+ // Update chart
72
+ WPPChart.populate(response.data);
73
+
74
+ $("#wpp-listing .wpp-tabbed-nav li:eq(0) a").trigger("click");
75
+
76
+ // Update lists
77
+ args = {
78
+ action: 'wpp_get_most_viewed',
79
+ nonce: wpp_admin_params.nonce,
80
+ items: 'most-viewed'
81
+ };
82
+
83
+ if ( '' != $("#stats_range_date").val() ){
84
+ args.dates = $("#stats_range_date").val();
85
+ }
86
+
87
+ $("#wpp-listing .wpp-tab-content:eq(0)").html('<span class="spinner"></span>');
88
+
89
+ $.get(
90
+ ajaxurl,
91
+ args,
92
+ function( response ){
93
+ $("#wpp-listing .wpp-tab-content:eq(0)").html(response);
94
+ }
95
+ );
96
+
97
+ args = {
98
+ action: 'wpp_get_most_commented',
99
+ nonce: wpp_admin_params.nonce,
100
+ items: 'most-commented'
101
+ };
102
+
103
+ if ( '' != $("#stats_range_date").val() ){
104
+ args.dates = $("#stats_range_date").val();
105
+ }
106
+
107
+ $("#wpp-listing .wpp-tab-content:eq(1)").html('<span class="spinner"></span>');
108
+
109
+ $.get(
110
+ ajaxurl,
111
+ args,
112
+ function( response ){
113
+ $("#wpp-listing .wpp-tab-content:eq(1)").html(response);
114
+ }
115
+ );
116
+
117
+ args = {
118
+ action: 'wpp_get_trending',
119
+ nonce: wpp_admin_params.nonce,
120
+ items: 'trending'
121
+ };
122
+
123
+ if ( '' != $("#stats_range_date").val() ){
124
+ args.dates = $("#stats_range_date").val();
125
+ }
126
+
127
+ $("#wpp-listing .wpp-tab-content:eq(2)").html('<span class="spinner"></span>');
128
+
129
+ $.get(
130
+ ajaxurl,
131
+ args,
132
+ function( response ){
133
+ $("#wpp-listing .wpp-tab-content:eq(2)").html(response);
134
+ }
135
+ );
136
+
137
+ // Unset date range
138
+ $("#stats_range_date").val('');
139
+ }
140
+ }
141
+ );
142
+
143
+ }
144
+
145
+ $("#wpp-time-ranges li a").on("click", function(e){
146
+ e.preventDefault();
147
+
148
+ var me = $(this);
149
+
150
+ // Update chart
151
+ if ( WPPChart.canRender() ) {
152
+ if ( 'custom' != me.data("range") ) {
153
+ get_chart_data(me);
154
+ }
155
+ else {
156
+ // Hide Config modal box
157
+ if ( $("#wpp-stats-config").is(":visible") ) {
158
+ $("#wpp-stats-config").hide();
159
+ }
160
+
161
+ if ( !$("#wpp-stats-range").is(":visible") ) {
162
+ $("#wpp-stats-range").show();
163
+ }
164
+ }
165
+ }
166
+ });
167
+
168
+ $("#wpp-time-ranges li.current a").trigger("click");
169
+
170
+ $(".wpp-lightbox-tabs li a").on("click", function(e){
171
+ e.preventDefault();
172
+
173
+ var me = $(this);
174
+ me.parent().addClass("active").siblings().removeClass("active");
175
+
176
+ me.closest(".wpp-lightbox").find(".wpp-lightbox-tab-content").removeClass("wpp-lightbox-tab-content-active").filter(function( index ) {
177
+ return me.parent().index() == index;
178
+ }).addClass("wpp-lightbox-tab-content-active");
179
+ });
180
+
181
+ // Datepicker
182
+ $.datepicker._defaults.onAfterUpdate = null;
183
+ var datepicker__updateDatepicker = $.datepicker._updateDatepicker;
184
+
185
+ $.datepicker._updateDatepicker = function( instance ){
186
+ datepicker__updateDatepicker.call( this, instance );
187
+
188
+ var onAfterUpdate = this._get( instance, 'onAfterUpdate' );
189
+
190
+ if ( onAfterUpdate ) {
191
+ onAfterUpdate.apply( ( instance.input ? instance.input[0] : null ), [( instance.input ? instance.input.val() : '' ), instance] );
192
+ }
193
+ };
194
+
195
+ var curr = -1,
196
+ prev = -1;
197
+
198
+ var dp_field = $("#stats_range_date");
199
+
200
+ var wpp_datepicker = dp_field.datepicker({
201
+ maxDate: 0,
202
+ dateFormat: 'yy-mm-dd',
203
+ showButtonPanel: true,
204
+ beforeShowDay: function(date){
205
+ return [true, ( (date.getTime() >= Math.min(prev, curr) && date.getTime() <= Math.max(prev, curr) ) ? 'date-range-selected' : '' )]
206
+ },
207
+ onSelect: function(dateText, instance){
208
+
209
+ var d1, d2;
210
+
211
+ prev = curr;
212
+
213
+ curr = ( new Date(instance.selectedYear, instance.selectedMonth, instance.selectedDay) ).getTime();
214
+
215
+ if (
216
+ -1 == prev
217
+ || prev == curr
218
+ ) {
219
+ prev = curr;
220
+ dp_field.val( dateText );
221
+ }
222
+ else {
223
+
224
+ d1 = $.datepicker.formatDate('yy-mm-dd', new Date( Math.min(prev, curr) ), {});
225
+ d2 = $.datepicker.formatDate('yy-mm-dd', new Date( Math.max(prev, curr) ), {});
226
+
227
+ dp_field.val( d1 + ' ~ ' + d2 );
228
+
229
+ }
230
+
231
+ $(this).data('datepicker').inline = true;
232
+
233
+ },
234
+ onClose: function(){
235
+ $(this).data('datepicker').inline = false;
236
+ },
237
+ onAfterUpdate: function( instance ){
238
+ var calendar = $(this);
239
+
240
+ if (
241
+ prev > -1
242
+ && curr > -1
243
+ ){
244
+
245
+ $('<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">OK</button>').appendTo( $(".ui-datepicker-buttonpane") ).on('click', function(){
246
+ dp_field.datepicker('hide');
247
+ });
248
+ }
249
+ }
250
+ });
251
+
252
+ // STATISTICS TABS
253
+ $("#wpp-listing .wpp-tabbed-nav li a").on("click", function(e){
254
+ e.preventDefault();
255
+
256
+ var me = $(this),
257
+ target = me.parent().index();
258
+
259
+ me.parent().addClass("active").siblings().removeClass("active");
260
+
261
+ me.closest("#wpp-listing").children(".wpp-tab-content:eq(" + target + ")").addClass("wpp-tab-content-active").siblings().removeClass("wpp-tab-content-active");
262
+
263
+ });
264
+
265
+ // TOOLS
266
+ // thumb source selection
267
+ $("#thumb_source").change(function() {
268
+ if ($(this).val() == "custom_field") {
269
+ $("#lbl_field, #thumb_field, #row_custom_field, #row_custom_field_resize").show();
270
+ } else {
271
+ $("#lbl_field, #thumb_field, #row_custom_field, #row_custom_field_resize").hide();
272
+ }
273
+ });
274
+ // file upload
275
+ $('#upload_thumb_button').click(function(e) {
276
+ e.preventDefault();
277
+
278
+ var custom_uploader = wp.media({
279
+ title: 'WordPress Popular Posts',
280
+ library: { type : 'image' },
281
+ button: { text: wpp_admin_params.label_media_upload_button },
282
+ id: 'library-' + (Math.random() * 10),
283
+ multiple: false
284
+ }).on('select', function() {
285
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
286
+ $('#upload_thumb_src').val( attachment.url );
287
+
288
+ var img = new Image();
289
+ img.onload = function() {
290
+ $("#thumb-review").html( this ).parent().fadeIn();
291
+ }
292
+ img.src = attachment.url;
293
+
294
+ })
295
+ .open();
296
+
297
+ });
298
+ // log limit
299
+ $("#log_limit").change(function(){
300
+ var me = $(this);
301
+
302
+ if (me.val() == 1) {
303
+ me.parent().children("label, .description").show();
304
+ me.parent().children("br").hide();
305
+ } else {
306
+ me.parent().children("label, .description").hide();
307
+ me.parent().children("br").show();
308
+ }
309
+ });
310
+ // cache interval
311
+ $("#cache").change(function() {
312
+ if ($(this).val() == 1) {
313
+ $("#cache_refresh_interval").show();
314
+ } else {
315
+ $("#cache_refresh_interval, #cache_too_long").hide();
316
+ }
317
+ });
318
+ // interval
319
+ $("#cache_interval_time").change(function() {
320
+ var value = parseInt( $("#cache_interval_value").val() );
321
+ var time = $(this).val();
322
+
323
+ if ( time == "hour" && value > 72 ) {
324
+ $("#cache_too_long").show();
325
+ } else if ( time == "day" && value > 3 ) {
326
+ $("#cache_too_long").show();
327
+ } else if ( time == "week" && value > 1 ) {
328
+ $("#cache_too_long").show();
329
+ } else if ( time == "month" && value >= 1 ) {
330
+ $("#cache_too_long").show();
331
+ } else if ( time == "year" && value >= 1 ) {
332
+ $("#cache_too_long").show();
333
+ } else {
334
+ $("#cache_too_long").hide();
335
+ }
336
+ });
337
+
338
+ $("#cache_interval_value").change(function() {
339
+ var value = parseInt( $(this).val() );
340
+ var time = $("#cache_interval_time").val();
341
+
342
+ if ( time == "hour" && value > 72 ) {
343
+ $("#cache_too_long").show();
344
+ } else if ( time == "day" && value > 3 ) {
345
+ $("#cache_too_long").show();
346
+ } else if ( time == "week" && value > 1 ) {
347
+ $("#cache_too_long").show();
348
+ } else if ( time == "month" && value >= 1 ) {
349
+ $("#cache_too_long").show();
350
+ } else if ( time == "year" && value >= 1 ) {
351
+ $("#cache_too_long").show();
352
+ } else {
353
+ $("#cache_too_long").hide();
354
+ }
355
+ });
356
+ });
357
  }(jQuery));
assets/js/chart.js CHANGED
@@ -1,191 +1,191 @@
1
- var WPPChart = (function() {
2
- "use strict";
3
-
4
- /**
5
- * Private functions and variables
6
- */
7
-
8
- var defaults = {
9
- type: 'line',
10
- data: {
11
- labels: [],
12
- datasets: [
13
- {
14
- label: "",
15
- fill: true,
16
- lineTension: 0.2,
17
- borderWidth: 3,
18
- backgroundColor: "rgba(221, 66, 66, 0.8)",
19
- borderColor: "#881111",
20
- borderCapStyle: 'butt',
21
- borderDash: [],
22
- borderDashOffset: 0.0,
23
- borderJoinStyle: 'miter',
24
- pointBorderColor: "#881111",
25
- pointBackgroundColor: "#fff",
26
- pointBorderWidth: 2,
27
- pointHoverRadius: 4,
28
- pointHoverBackgroundColor: "#881111",
29
- pointHoverBorderColor: "#881111",
30
- pointHoverBorderWidth: 3,
31
- pointRadius: 3,
32
- pointHitRadius: 10,
33
- data: [],
34
- },
35
- {
36
- label: "",
37
- fill: true,
38
- lineTension: 0.2,
39
- borderWidth: 3,
40
- backgroundColor: "rgba(136, 17, 17, 0.3)",
41
- borderColor: "#a80000",
42
- borderCapStyle: 'butt',
43
- borderDash: [],
44
- borderDashOffset: 0.0,
45
- borderJoinStyle: 'miter',
46
- pointBorderColor: "#a80000",
47
- pointBackgroundColor: "#fff",
48
- pointBorderWidth: 2,
49
- pointHoverRadius: 4,
50
- pointHoverBackgroundColor: "#a80000",
51
- pointHoverBorderColor: "#a80000",
52
- pointHoverBorderWidth: 3,
53
- pointRadius: 3,
54
- pointHitRadius: 10,
55
- data: [],
56
- }
57
- ]
58
- },
59
- options: {
60
- legend: {
61
- display: true,
62
- labels: {
63
- fontColor: '#23282d',
64
- fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
65
- fontSize: 12
66
- }
67
- },
68
- responsive: true,
69
- maintainAspectRatio: false,
70
- layout: {
71
- padding: {
72
- top: 2,
73
- right: 5,
74
- bottom: 0,
75
- left: 5
76
- }
77
- },
78
- scales: {
79
- xAxes: [{
80
- display: true,
81
- gridLines: {
82
- display: false,
83
- },
84
- ticks: {
85
- fontSize: 10,
86
- fontColor: '#23282d',
87
- autoSkip: false,
88
- maxRotation: 90,
89
- minRotation: 90
90
- }
91
- }],
92
- yAxes: [{
93
- display: false
94
- }]
95
- }
96
- }
97
- },
98
- chart = null,
99
- canRender = !! window.CanvasRenderingContext2D,
100
- element = null,
101
- cvs = null;
102
-
103
- var canRender = function(){
104
- return canRender;
105
- };
106
-
107
- // Source: http://stackoverflow.com/a/5624139
108
- var HexToRGB = function( hex ){
109
- var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
110
-
111
- hex = hex.replace(shorthandRegex, function( m, r, g, b ) {
112
- return r + r + g + g + b + b;
113
- });
114
-
115
- var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
116
-
117
- return result ? {
118
- r: parseInt( result[1], 16 ),
119
- g: parseInt( result[2], 16 ),
120
- b: parseInt( result[3], 16 )
121
- } : null;
122
- };
123
-
124
- /**
125
- * Public functions
126
- */
127
-
128
- var init = function(container, options){
129
- if ( ! canRender() ) {
130
- throw new Error('Your browser is too old, WPPChart cannot create its data chart.');
131
- }
132
-
133
- if ( 'undefined' == typeof container ) {
134
- throw new Error('Please tell WPPChart where to inject the chart.');
135
- }
136
-
137
- element = document.getElementById(container);
138
-
139
- if ( ! element ) {
140
- throw new Error('WPPChart cannot find ' + container);
141
- }
142
-
143
- if ( 'undefined' == typeof Chart ) {
144
- throw new Error('ChartJS library not found');
145
- }
146
-
147
- cvs = document.createElement('canvas');
148
- element.appendChild(cvs);
149
- };
150
-
151
- var populate = function(data){
152
- if ( chart ) {
153
- chart.destroy();
154
- }
155
-
156
- var config = defaults;
157
-
158
- config.data.labels = data.labels;
159
- config.data.datasets[0].label = data.datasets[0].label;
160
- config.data.datasets[0].data = data.datasets[0].data;
161
- config.data.datasets[1].label = data.datasets[1].label;
162
- config.data.datasets[1].data = data.datasets[1].data;
163
-
164
-
165
- var rgb_comments = HexToRGB(wpp_chart_params.colors[2]);
166
- config.data.datasets[1].backgroundColor = "rgba(" + rgb_comments.r + ", " + rgb_comments.g + ", " + rgb_comments.b + ", 0.9)";
167
- config.data.datasets[1].borderColor = wpp_chart_params.colors[2];
168
- config.data.datasets[1].pointBorderColor = wpp_chart_params.colors[2];
169
- config.data.datasets[1].pointHoverBackgroundColor = wpp_chart_params.colors[2];
170
- config.data.datasets[1].pointHoverBorderColor = wpp_chart_params.colors[2];
171
-
172
- var rgb_views = HexToRGB(wpp_chart_params.colors[3]);
173
- config.data.datasets[0].backgroundColor = "rgba(" + rgb_views.r + ", " + rgb_views.g + ", " + rgb_views.b + ", 0.7)";
174
- config.data.datasets[0].borderColor = wpp_chart_params.colors[3];
175
- config.data.datasets[0].pointBorderColor = wpp_chart_params.colors[3];
176
- config.data.datasets[0].pointHoverBackgroundColor = wpp_chart_params.colors[3];
177
- config.data.datasets[0].pointHoverBorderColor = wpp_chart_params.colors[3];
178
-
179
- chart = new Chart(cvs, config);
180
- };
181
-
182
- /**
183
- * Provide access to public methods
184
- */
185
-
186
- return {
187
- init: init,
188
- populate: populate,
189
- canRender: canRender
190
- };
191
- })();
1
+ var WPPChart = (function() {
2
+ "use strict";
3
+
4
+ /**
5
+ * Private functions and variables
6
+ */
7
+
8
+ var defaults = {
9
+ type: 'line',
10
+ data: {
11
+ labels: [],
12
+ datasets: [
13
+ {
14
+ label: "",
15
+ fill: true,
16
+ lineTension: 0.2,
17
+ borderWidth: 3,
18
+ backgroundColor: "rgba(221, 66, 66, 0.8)",
19
+ borderColor: "#881111",
20
+ borderCapStyle: 'butt',
21
+ borderDash: [],
22
+ borderDashOffset: 0.0,
23
+ borderJoinStyle: 'miter',
24
+ pointBorderColor: "#881111",
25
+ pointBackgroundColor: "#fff",
26
+ pointBorderWidth: 2,
27
+ pointHoverRadius: 4,
28
+ pointHoverBackgroundColor: "#881111",
29
+ pointHoverBorderColor: "#881111",
30
+ pointHoverBorderWidth: 3,
31
+ pointRadius: 3,
32
+ pointHitRadius: 10,
33
+ data: [],
34
+ },
35
+ {
36
+ label: "",
37
+ fill: true,
38
+ lineTension: 0.2,
39
+ borderWidth: 3,
40
+ backgroundColor: "rgba(136, 17, 17, 0.3)",
41
+ borderColor: "#a80000",
42
+ borderCapStyle: 'butt',
43
+ borderDash: [],
44
+ borderDashOffset: 0.0,
45
+ borderJoinStyle: 'miter',
46
+ pointBorderColor: "#a80000",
47
+ pointBackgroundColor: "#fff",
48
+ pointBorderWidth: 2,
49
+ pointHoverRadius: 4,
50
+ pointHoverBackgroundColor: "#a80000",
51
+ pointHoverBorderColor: "#a80000",
52
+ pointHoverBorderWidth: 3,
53
+ pointRadius: 3,
54
+ pointHitRadius: 10,
55
+ data: [],
56
+ }
57
+ ]
58
+ },
59
+ options: {
60
+ legend: {
61
+ display: true,
62
+ labels: {
63
+ fontColor: '#23282d',
64
+ fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
65
+ fontSize: 12
66
+ }
67
+ },
68
+ responsive: true,
69
+ maintainAspectRatio: false,
70
+ layout: {
71
+ padding: {
72
+ top: 2,
73
+ right: 5,
74
+ bottom: 0,
75
+ left: 5
76
+ }
77
+ },
78
+ scales: {
79
+ xAxes: [{
80
+ display: true,
81
+ gridLines: {
82
+ display: false,
83
+ },
84
+ ticks: {
85
+ fontSize: 10,
86
+ fontColor: '#23282d',
87
+ autoSkip: false,
88
+ maxRotation: 90,
89
+ minRotation: 90
90
+ }
91
+ }],
92
+ yAxes: [{
93
+ display: false
94
+ }]
95
+ }
96
+ }
97
+ },
98
+ chart = null,
99
+ canRender = !! window.CanvasRenderingContext2D,
100
+ element = null,
101
+ cvs = null;
102
+
103
+ var canRender = function(){
104
+ return canRender;
105
+ };
106
+
107
+ // Source: http://stackoverflow.com/a/5624139
108
+ var HexToRGB = function( hex ){
109
+ var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
110
+
111
+ hex = hex.replace(shorthandRegex, function( m, r, g, b ) {
112
+ return r + r + g + g + b + b;
113
+ });
114
+
115
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
116
+
117
+ return result ? {
118
+ r: parseInt( result[1], 16 ),
119
+ g: parseInt( result[2], 16 ),
120
+ b: parseInt( result[3], 16 )
121
+ } : null;
122
+ };
123
+
124
+ /**
125
+ * Public functions
126
+ */
127
+
128
+ var init = function(container, options){
129
+ if ( ! canRender() ) {
130
+ throw new Error('Your browser is too old, WPPChart cannot create its data chart.');
131
+ }
132
+
133
+ if ( 'undefined' == typeof container ) {
134
+ throw new Error('Please tell WPPChart where to inject the chart.');
135
+ }
136
+
137
+ element = document.getElementById(container);
138
+
139
+ if ( ! element ) {
140
+ throw new Error('WPPChart cannot find ' + container);
141
+ }
142
+
143
+ if ( 'undefined' == typeof Chart ) {
144
+ throw new Error('ChartJS library not found');
145
+ }
146
+
147
+ cvs = document.createElement('canvas');
148
+ element.appendChild(cvs);
149
+ };
150
+
151
+ var populate = function(data){
152
+ if ( chart ) {
153
+ chart.destroy();
154
+ }
155
+
156
+ var config = defaults;
157
+
158
+ config.data.labels = data.labels;
159
+ config.data.datasets[0].label = data.datasets[0].label;
160
+ config.data.datasets[0].data = data.datasets[0].data;
161
+ config.data.datasets[1].label = data.datasets[1].label;
162
+ config.data.datasets[1].data = data.datasets[1].data;
163
+
164
+
165
+ var rgb_comments = HexToRGB(wpp_chart_params.colors[2]);
166
+ config.data.datasets[1].backgroundColor = "rgba(" + rgb_comments.r + ", " + rgb_comments.g + ", " + rgb_comments.b + ", 0.9)";
167
+ config.data.datasets[1].borderColor = wpp_chart_params.colors[2];
168
+ config.data.datasets[1].pointBorderColor = wpp_chart_params.colors[2];
169
+ config.data.datasets[1].pointHoverBackgroundColor = wpp_chart_params.colors[2];
170
+ config.data.datasets[1].pointHoverBorderColor = wpp_chart_params.colors[2];
171
+
172
+ var rgb_views = HexToRGB(wpp_chart_params.colors[3]);
173
+ config.data.datasets[0].backgroundColor = "rgba(" + rgb_views.r + ", " + rgb_views.g + ", " + rgb_views.b + ", 0.7)";
174
+ config.data.datasets[0].borderColor = wpp_chart_params.colors[3];
175
+ config.data.datasets[0].pointBorderColor = wpp_chart_params.colors[3];
176
+ config.data.datasets[0].pointHoverBackgroundColor = wpp_chart_params.colors[3];
177
+ config.data.datasets[0].pointHoverBorderColor = wpp_chart_params.colors[3];
178
+
179
+ chart = new Chart(cvs, config);
180
+ };
181
+
182
+ /**
183
+ * Provide access to public methods
184
+ */
185
+
186
+ return {
187
+ init: init,
188
+ populate: populate,
189
+ canRender: canRender
190
+ };
191
+ })();
assets/js/vendor/Chart.min.js CHANGED
@@ -1,14 +1,14 @@
1
- /*!
2
- * Chart.js
3
- * http://chartjs.org/
4
- * Version: 2.5.0
5
- *
6
- * Copyright 2017 Nick Downie
7
- * Released under the MIT license
8
- * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
9
- */
10
- !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Chart=t()}}(function(){return function t(e,a,i){function n(r,s){if(!a[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(o)return o(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=a[r]={exports:{}};e[r][0].call(d.exports,function(t){var a=e[r][1][t];return n(a?a:t)},d,d.exports,t,e,a,i)}return a[r].exports}for(var o="function"==typeof require&&require,r=0;r<i.length;r++)n(i[r]);return n}({1:[function(t,e,a){},{}],2:[function(t,e,a){function i(t){if(t){var e=/^#([a-fA-F0-9]{3})$/,a=/^#([a-fA-F0-9]{6})$/,i=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,o=/(\w+)/,r=[0,0,0],s=1,l=t.match(e);if(l){l=l[1];for(var u=0;u<r.length;u++)r[u]=parseInt(l[u]+l[u],16)}else if(l=t.match(a)){l=l[1];for(var u=0;u<r.length;u++)r[u]=parseInt(l.slice(2*u,2*u+2),16)}else if(l=t.match(i)){for(var u=0;u<r.length;u++)r[u]=parseInt(l[u+1]);s=parseFloat(l[4])}else if(l=t.match(n)){for(var u=0;u<r.length;u++)r[u]=Math.round(2.55*parseFloat(l[u+1]));s=parseFloat(l[4])}else if(l=t.match(o)){if("transparent"==l[1])return[0,0,0,0];if(r=y[l[1]],!r)return}for(var u=0;u<r.length;u++)r[u]=b(r[u],0,255);return s=s||0==s?b(s,0,1):1,r[3]=s,r}}function n(t){if(t){var e=/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,a=t.match(e);if(a){var i=parseFloat(a[4]),n=b(parseInt(a[1]),0,360),o=b(parseFloat(a[2]),0,100),r=b(parseFloat(a[3]),0,100),s=b(isNaN(i)?1:i,0,1);return[n,o,r,s]}}}function o(t){if(t){var e=/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,a=t.match(e);if(a){var i=parseFloat(a[4]),n=b(parseInt(a[1]),0,360),o=b(parseFloat(a[2]),0,100),r=b(parseFloat(a[3]),0,100),s=b(isNaN(i)?1:i,0,1);return[n,o,r,s]}}}function r(t){var e=i(t);return e&&e.slice(0,3)}function s(t){var e=n(t);return e&&e.slice(0,3)}function l(t){var e=i(t);return e?e[3]:(e=n(t))?e[3]:(e=o(t))?e[3]:void 0}function u(t){return"#"+x(t[0])+x(t[1])+x(t[2])}function d(t,e){return e<1||t[3]&&t[3]<1?c(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function c(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function h(t,e){if(e<1||t[3]&&t[3]<1)return f(t,e);var a=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return"rgb("+a+"%, "+i+"%, "+n+"%)"}function f(t,e){var a=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return"rgba("+a+"%, "+i+"%, "+n+"%, "+(e||t[3]||1)+")"}function g(t,e){return e<1||t[3]&&t[3]<1?p(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function p(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function m(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"}function v(t){return k[t.slice(0,3)]}function b(t,e,a){return Math.min(Math.max(e,t),a)}function x(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var y=t(6);e.exports={getRgba:i,getHsla:n,getRgb:r,getHsl:s,getHwb:o,getAlpha:l,hexString:u,rgbString:d,rgbaString:c,percentString:h,percentaString:f,hslString:g,hslaString:p,hwbString:m,keyword:v};var k={};for(var S in y)k[y[S]]=S},{6:6}],3:[function(t,e,a){var i=t(5),n=t(2),o=function(t){if(t instanceof o)return t;if(!(this instanceof o))return new o(t);this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1};var e;if("string"==typeof t)if(e=n.getRgba(t))this.setValues("rgb",e);else if(e=n.getHsla(t))this.setValues("hsl",e);else{if(!(e=n.getHwb(t)))throw new Error('Unable to parse color from string "'+t+'"');this.setValues("hwb",e)}else if("object"==typeof t)if(e=t,void 0!==e.r||void 0!==e.red)this.setValues("rgb",e);else if(void 0!==e.l||void 0!==e.lightness)this.setValues("hsl",e);else if(void 0!==e.v||void 0!==e.value)this.setValues("hsv",e);else if(void 0!==e.w||void 0!==e.whiteness)this.setValues("hwb",e);else{if(void 0===e.c&&void 0===e.cyan)throw new Error("Unable to parse color from object "+JSON.stringify(t));this.setValues("cmyk",e)}};o.prototype={rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t%=360,t=t<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return n.hexString(this.values.rgb)},rgbString:function(){return n.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return n.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return n.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return n.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return n.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return n.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return n.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],a=0;a<t.length;a++){var i=t[a]/255;e[a]=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),a=t.luminosity();return e>a?(e+.05)/(a+.05):(a+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(299*t[0]+587*t[1]+114*t[2])/1e3;return e<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,a=(e[0]+t)%360;return e[0]=a<0?360+a:a,this.setValues("hsl",e),this},mix:function(t,e){var a=this,i=t,n=void 0===e?.5:e,o=2*n-1,r=a.alpha()-i.alpha(),s=((o*r===-1?o:(o+r)/(1+o*r))+1)/2,l=1-s;return this.rgb(s*a.red()+l*i.red(),s*a.green()+l*i.green(),s*a.blue()+l*i.blue()).alpha(a.alpha()*n+i.alpha()*(1-n))},toJSON:function(){return this.rgb()},clone:function(){var t,e,a=new o,i=this.values,n=a.values;for(var r in i)i.hasOwnProperty(r)&&(t=i[r],e={}.toString.call(t),"[object Array]"===e?n[r]=t.slice(0):"[object Number]"===e?n[r]=t:console.error("unexpected color value:",t));return a}},o.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},o.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},o.prototype.getValues=function(t){for(var e=this.values,a={},i=0;i<t.length;i++)a[t.charAt(i)]=e[t][i];return 1!==e.alpha&&(a.a=e.alpha),a},o.prototype.setValues=function(t,e){var a,n=this.values,o=this.spaces,r=this.maxes,s=1;if("alpha"===t)s=e;else if(e.length)n[t]=e.slice(0,t.length),s=e[t.length];else if(void 0!==e[t.charAt(0)]){for(a=0;a<t.length;a++)n[t][a]=e[t.charAt(a)];s=e.a}else if(void 0!==e[o[t][0]]){var l=o[t];for(a=0;a<t.length;a++)n[t][a]=e[l[a]];s=e.alpha}if(n.alpha=Math.max(0,Math.min(1,void 0===s?n.alpha:s)),"alpha"===t)return!1;var u;for(a=0;a<t.length;a++)u=Math.max(0,Math.min(r[t][a],n[t][a])),n[t][a]=Math.round(u);for(var d in o)d!==t&&(n[d]=i[t][d](n[t]));return!0},o.prototype.setSpace=function(t,e){var a=e[0];return void 0===a?this.getValues(t):("number"==typeof a&&(a=Array.prototype.slice.call(e)),this.setValues(t,a),this)},o.prototype.setChannel=function(t,e,a){var i=this.values[t];return void 0===a?i[e]:a===i[e]?this:(i[e]=a,this.setValues(t,i),this)},"undefined"!=typeof window&&(window.Color=o),e.exports=o},{2:2,5:5}],4:[function(t,e,a){function i(t){var e,a,i,n=t[0]/255,o=t[1]/255,r=t[2]/255,s=Math.min(n,o,r),l=Math.max(n,o,r),u=l-s;return l==s?e=0:n==l?e=(o-r)/u:o==l?e=2+(r-n)/u:r==l&&(e=4+(n-o)/u),e=Math.min(60*e,360),e<0&&(e+=360),i=(s+l)/2,a=l==s?0:i<=.5?u/(l+s):u/(2-l-s),[e,100*a,100*i]}function n(t){var e,a,i,n=t[0],o=t[1],r=t[2],s=Math.min(n,o,r),l=Math.max(n,o,r),u=l-s;return a=0==l?0:u/l*1e3/10,l==s?e=0:n==l?e=(o-r)/u:o==l?e=2+(r-n)/u:r==l&&(e=4+(n-o)/u),e=Math.min(60*e,360),e<0&&(e+=360),i=l/255*1e3/10,[e,a,i]}function o(t){var e=t[0],a=t[1],n=t[2],o=i(t)[0],r=1/255*Math.min(e,Math.min(a,n)),n=1-1/255*Math.max(e,Math.max(a,n));return[o,100*r,100*n]}function s(t){var e,a,i,n,o=t[0]/255,r=t[1]/255,s=t[2]/255;return n=Math.min(1-o,1-r,1-s),e=(1-o-n)/(1-n)||0,a=(1-r-n)/(1-n)||0,i=(1-s-n)/(1-n)||0,[100*e,100*a,100*i,100*n]}function l(t){return Z[JSON.stringify(t)]}function u(t){var e=t[0]/255,a=t[1]/255,i=t[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92;var n=.4124*e+.3576*a+.1805*i,o=.2126*e+.7152*a+.0722*i,r=.0193*e+.1192*a+.9505*i;return[100*n,100*o,100*r]}function d(t){var e,a,i,n=u(t),o=n[0],r=n[1],s=n[2];return o/=95.047,r/=100,s/=108.883,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*r-16,a=500*(o-r),i=200*(r-s),[e,a,i]}function c(t){return z(d(t))}function h(t){var e,a,i,n,o,r=t[0]/360,s=t[1]/100,l=t[2]/100;if(0==s)return o=255*l,[o,o,o];a=l<.5?l*(1+s):l+s-l*s,e=2*l-a,n=[0,0,0];for(var u=0;u<3;u++)i=r+1/3*-(u-1),i<0&&i++,i>1&&i--,o=6*i<1?e+6*(a-e)*i:2*i<1?a:3*i<2?e+(a-e)*(2/3-i)*6:e,n[u]=255*o;return n}function f(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return 0===o?[0,0,0]:(o*=2,n*=o<=1?o:2-o,a=(o+n)/2,e=2*n/(o+n),[i,100*e,100*a])}function p(t){return o(h(t))}function m(t){return s(h(t))}function v(t){return l(h(t))}function x(t){var e=t[0]/60,a=t[1]/100,i=t[2]/100,n=Math.floor(e)%6,o=e-Math.floor(e),r=255*i*(1-a),s=255*i*(1-a*o),l=255*i*(1-a*(1-o)),i=255*i;switch(n){case 0:return[i,l,r];case 1:return[s,i,r];case 2:return[r,i,l];case 3:return[r,s,i];case 4:return[l,r,i];case 5:return[i,r,s]}}function y(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return a=(2-n)*o,e=n*o,e/=a<=1?a:2-a,e=e||0,a/=2,[i,100*e,100*a]}function k(t){return o(x(t))}function S(t){return s(x(t))}function M(t){return l(x(t))}function w(t){var e,a,i,n,o=t[0]/360,s=t[1]/100,l=t[2]/100,u=s+l;switch(u>1&&(s/=u,l/=u),e=Math.floor(6*o),a=1-l,i=6*o-e,0!=(1&e)&&(i=1-i),n=s+i*(a-s),e){default:case 6:case 0:r=a,g=n,b=s;break;case 1:r=n,g=a,b=s;break;case 2:r=s,g=a,b=n;break;case 3:r=s,g=n,b=a;break;case 4:r=n,g=s,b=a;break;case 5:r=a,g=s,b=n}return[255*r,255*g,255*b]}function C(t){return i(w(t))}function I(t){return n(w(t))}function D(t){return s(w(t))}function A(t){return l(w(t))}function T(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100,s=t[3]/100;return e=1-Math.min(1,n*(1-s)+s),a=1-Math.min(1,o*(1-s)+s),i=1-Math.min(1,r*(1-s)+s),[255*e,255*a,255*i]}function P(t){return i(T(t))}function _(t){return n(T(t))}function F(t){return o(T(t))}function V(t){return l(T(t))}function R(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100;return e=3.2406*n+o*-1.5372+r*-.4986,a=n*-.9689+1.8758*o+.0415*r,i=.0557*n+o*-.204+1.057*r,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,e=Math.min(Math.max(0,e),1),a=Math.min(Math.max(0,a),1),i=Math.min(Math.max(0,i),1),[255*e,255*a,255*i]}function O(t){var e,a,i,n=t[0],o=t[1],r=t[2];return n/=95.047,o/=100,r/=108.883,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,e=116*o-16,a=500*(n-o),i=200*(o-r),[e,a,i]}function L(t){return z(O(t))}function B(t){var e,a,i,n,o=t[0],r=t[1],s=t[2];return o<=8?(a=100*o/903.3,n=7.787*(a/100)+16/116):(a=100*Math.pow((o+16)/116,3),n=Math.pow(a/100,1/3)),e=e/95.047<=.008856?e=95.047*(r/500+n-16/116)/7.787:95.047*Math.pow(r/500+n,3),i=i/108.883<=.008859?i=108.883*(n-s/200-16/116)/7.787:108.883*Math.pow(n-s/200,3),[e,a,i]}function z(t){var e,a,i,n=t[0],o=t[1],r=t[2];return e=Math.atan2(r,o),a=360*e/2/Math.PI,a<0&&(a+=360),i=Math.sqrt(o*o+r*r),[n,i,a]}function W(t){return R(B(t))}function N(t){var e,a,i,n=t[0],o=t[1],r=t[2];return i=r/360*2*Math.PI,e=o*Math.cos(i),a=o*Math.sin(i),[n,e,a]}function E(t){return B(N(t))}function H(t){return W(N(t))}function j(t){return G[t]}function U(t){return i(j(t))}function q(t){return n(j(t))}function Y(t){return o(j(t))}function X(t){return s(j(t))}function K(t){return d(j(t))}function J(t){return u(j(t))}e.exports={rgb2hsl:i,rgb2hsv:n,rgb2hwb:o,rgb2cmyk:s,rgb2keyword:l,rgb2xyz:u,rgb2lab:d,rgb2lch:c,hsl2rgb:h,hsl2hsv:f,hsl2hwb:p,hsl2cmyk:m,hsl2keyword:v,hsv2rgb:x,hsv2hsl:y,hsv2hwb:k,hsv2cmyk:S,hsv2keyword:M,hwb2rgb:w,hwb2hsl:C,hwb2hsv:I,hwb2cmyk:D,hwb2keyword:A,cmyk2rgb:T,cmyk2hsl:P,cmyk2hsv:_,cmyk2hwb:F,cmyk2keyword:V,keyword2rgb:j,keyword2hsl:U,keyword2hsv:q,keyword2hwb:Y,keyword2cmyk:X,keyword2lab:K,keyword2xyz:J,xyz2rgb:R,xyz2lab:O,xyz2lch:L,lab2xyz:B,lab2rgb:W,lab2lch:z,lch2lab:N,lch2xyz:E,lch2rgb:H};var G={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Z={};for(var Q in G)Z[JSON.stringify(G[Q])]=Q},{}],5:[function(t,e,a){var i=t(4),n=function(){return new u};for(var o in i){n[o+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(o);var r=/(\w+)2(\w+)/.exec(o),s=r[1],l=r[2];n[s]=n[s]||{},n[s][l]=n[o]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var a=i[t](e);if("string"==typeof a||void 0===a)return a;for(var n=0;n<a.length;n++)a[n]=Math.round(a[n]);return a}}(o)}var u=function(){this.convs={}};u.prototype.routeSpace=function(t,e){var a=e[0];return void 0===a?this.getValues(t):("number"==typeof a&&(a=Array.prototype.slice.call(e)),this.setValues(t,a))},u.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},u.prototype.getValues=function(t){var e=this.convs[t];if(!e){var a=this.space,i=this.convs[a];e=n[a][t](i),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){u.prototype[t]=function(e){return this.routeSpace(t,arguments)}}),e.exports=n},{4:4}],6:[function(t,e,a){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],7:[function(t,e,a){var i=t(28)();t(26)(i),t(42)(i),t(22)(i),t(31)(i),t(25)(i),t(21)(i),t(23)(i),t(24)(i),t(29)(i),t(33)(i),t(34)(i),t(32)(i),t(35)(i),t(30)(i),t(27)(i),t(36)(i),t(37)(i),t(38)(i),t(39)(i),t(40)(i),t(45)(i),t(43)(i),t(44)(i),t(46)(i),t(47)(i),t(48)(i),t(15)(i),t(16)(i),t(17)(i),t(18)(i),t(19)(i),t(20)(i),t(8)(i),t(9)(i),t(10)(i),t(11)(i),t(12)(i),t(13)(i),t(14)(i),window.Chart=e.exports=i},{10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,42:42,43:43,44:44,45:45,46:46,47:47,48:48,8:8,9:9}],8:[function(t,e,a){"use strict";e.exports=function(t){t.Bar=function(e,a){return a.type="bar",new t(e,a)}}},{}],9:[function(t,e,a){"use strict";e.exports=function(t){t.Bubble=function(e,a){return a.type="bubble",new t(e,a)}}},{}],10:[function(t,e,a){"use strict";e.exports=function(t){t.Doughnut=function(e,a){return a.type="doughnut",new t(e,a)}}},{}],11:[function(t,e,a){"use strict";e.exports=function(t){t.Line=function(e,a){return a.type="line",new t(e,a)}}},{}],12:[function(t,e,a){"use strict";e.exports=function(t){t.PolarArea=function(e,a){return a.type="polarArea",new t(e,a)}}},{}],13:[function(t,e,a){"use strict";e.exports=function(t){t.Radar=function(e,a){return a.type="radar",new t(e,a)}}},{}],14:[function(t,e,a){"use strict";e.exports=function(t){var e={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-1"}],yAxes:[{type:"linear",position:"left",id:"y-axis-1"}]},tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}};t.defaults.scatter=e,t.controllers.scatter=t.controllers.line,t.Scatter=function(e,a){return a.type="scatter",new t(e,a)}}},{}],15:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.bar={hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}},t.controllers.bar=t.DatasetController.extend({dataElementType:t.elements.Rectangle,initialize:function(e,a){t.DatasetController.prototype.initialize.call(this,e,a);var i=this,n=i.getMeta(),o=i.getDataset();n.stack=o.stack,n.bar=!0},getStackCount:function(){var t=this,a=t.getMeta(),i=t.getScaleForId(a.yAxisID),n=[];return e.each(t.chart.data.datasets,function(e,a){var o=t.chart.getDatasetMeta(a);o.bar&&t.chart.isDatasetVisible(a)&&(i.options.stacked===!1||i.options.stacked===!0&&n.indexOf(o.stack)===-1||void 0===i.options.stacked&&(void 0===o.stack||n.indexOf(o.stack)===-1))&&n.push(o.stack)},t),n.length},update:function(t){var a=this;e.each(a.getMeta().data,function(e,i){a.updateElement(e,i,t)},a)},updateElement:function(t,a,i){var n=this,o=n.getMeta(),r=n.getScaleForId(o.xAxisID),s=n.getScaleForId(o.yAxisID),l=s.getBasePixel(),u=n.chart.options.elements.rectangle,d=t.custom||{},c=n.getDataset();t._xScale=r,t._yScale=s,t._datasetIndex=n.index,t._index=a;var h=n.getRuler(a);t._model={x:n.calculateBarX(a,n.index,h),y:i?l:n.calculateBarY(a,n.index),label:n.chart.data.labels[a],datasetLabel:c.label,horizontal:!1,base:i?l:n.calculateBarBase(n.index,a),width:n.calculateBarWidth(h),backgroundColor:d.backgroundColor?d.backgroundColor:e.getValueAtIndexOrDefault(c.backgroundColor,a,u.backgroundColor),borderSkipped:d.borderSkipped?d.borderSkipped:u.borderSkipped,borderColor:d.borderColor?d.borderColor:e.getValueAtIndexOrDefault(c.borderColor,a,u.borderColor),borderWidth:d.borderWidth?d.borderWidth:e.getValueAtIndexOrDefault(c.borderWidth,a,u.borderWidth)},t.pivot()},calculateBarBase:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.yAxisID),o=n.getBaseValue(),r=o;if(n.options.stacked===!0||void 0===n.options.stacked&&void 0!==i.stack){for(var s=a.chart,l=s.data.datasets,u=Number(l[t].data[e]),d=0;d<t;d++){var c=l[d],h=s.getDatasetMeta(d);if(h.bar&&h.yAxisID===n.id&&s.isDatasetVisible(d)&&i.stack===h.stack){var f=Number(c.data[e]);o+=u<0?Math.min(f,r):Math.max(f,r)}}return n.getPixelForValue(o)}return n.getBasePixel()},getRuler:function(){var t=this,e=t.getMeta(),a=t.getScaleForId(e.xAxisID),i=t.getStackCount(),n=a.width/a.ticks.length,o=n*a.options.categoryPercentage,r=(n-n*a.options.categoryPercentage)/2,s=o/i,l=s*a.options.barPercentage,u=s-s*a.options.barPercentage;return{stackCount:i,tickWidth:n,categoryWidth:o,categorySpacing:r,fullBarWidth:s,barWidth:l,barSpacing:u}},calculateBarWidth:function(t){var e=this,a=e.getMeta(),i=e.getScaleForId(a.xAxisID);return i.options.barThickness?i.options.barThickness:t.barWidth},getStackIndex:function(t){var e,a,i=this,n=i.chart.getDatasetMeta(t),o=i.getScaleForId(n.yAxisID),r=[n.stack];for(a=0;a<t;++a)e=this.chart.getDatasetMeta(a),e.bar&&this.chart.isDatasetVisible(a)&&(o.options.stacked===!1||o.options.stacked===!0&&r.indexOf(e.stack)===-1||void 0===o.options.stacked&&(void 0===e.stack||r.indexOf(e.stack)===-1))&&r.push(e.stack);return r.length-1},calculateBarX:function(t,e,a){var i=this,n=i.getMeta(),o=i.getScaleForId(n.xAxisID),r=i.getStackIndex(e),s=o.getPixelForValue(null,t,e,i.chart.isCombo);return s-=i.chart.isCombo?a.tickWidth/2:0,s+a.barWidth/2+a.categorySpacing+a.barWidth*r+a.barSpacing/2+a.barSpacing*r},calculateBarY:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.yAxisID),o=Number(a.getDataset().data[t]);if(n.options.stacked||void 0===n.options.stacked&&void 0!==i.stack){for(var r=n.getBaseValue(),s=r,l=r,u=0;u<e;u++){var d=a.chart.data.datasets[u],c=a.chart.getDatasetMeta(u);if(c.bar&&c.yAxisID===n.id&&a.chart.isDatasetVisible(u)&&i.stack===c.stack){var h=Number(d.data[t]);h<0?l+=h||0:s+=h||0}}return o<0?n.getPixelForValue(l+o):n.getPixelForValue(s+o)}return n.getPixelForValue(o)},draw:function(e){var a,i,n=this,o=e||1,r=n.getMeta().data,s=n.getDataset();for(t.canvasHelpers.clipArea(n.chart.chart.ctx,n.chart.chartArea),a=0,i=r.length;a<i;++a){var l=s.data[a];null===l||void 0===l||isNaN(l)||r[a].transition(o).draw()}t.canvasHelpers.unclipArea(n.chart.chart.ctx)},setHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model;o.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.hoverBackgroundColor,i,e.getHoverColor(o.backgroundColor)),o.borderColor=n.hoverBorderColor?n.hoverBorderColor:e.getValueAtIndexOrDefault(a.hoverBorderColor,i,e.getHoverColor(o.borderColor)),o.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:e.getValueAtIndexOrDefault(a.hoverBorderWidth,i,o.borderWidth)},removeHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model,r=this.chart.options.elements.rectangle;o.backgroundColor=n.backgroundColor?n.backgroundColor:e.getValueAtIndexOrDefault(a.backgroundColor,i,r.backgroundColor),o.borderColor=n.borderColor?n.borderColor:e.getValueAtIndexOrDefault(a.borderColor,i,r.borderColor),o.borderWidth=n.borderWidth?n.borderWidth:e.getValueAtIndexOrDefault(a.borderWidth,i,r.borderWidth)}}),t.defaults.horizontalBar={hover:{mode:"label"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{position:"left",type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{callbacks:{title:function(t,e){var a="";return t.length>0&&(t[0].yLabel?a=t[0].yLabel:e.labels.length>0&&t[0].index<e.labels.length&&(a=e.labels[t[0].index])),a},label:function(t,e){var a=e.datasets[t.datasetIndex].label||"";return a+": "+t.xLabel}}}},t.controllers.horizontalBar=t.controllers.bar.extend({getStackCount:function(){var t=this,a=t.getMeta(),i=t.getScaleForId(a.xAxisID),n=[];return e.each(t.chart.data.datasets,function(e,a){var o=t.chart.getDatasetMeta(a);o.bar&&t.chart.isDatasetVisible(a)&&(i.options.stacked===!1||i.options.stacked===!0&&n.indexOf(o.stack)===-1||void 0===i.options.stacked&&(void 0===o.stack||n.indexOf(o.stack)===-1))&&n.push(o.stack)},t),n.length},updateElement:function(t,a,i){var n=this,o=n.getMeta(),r=n.getScaleForId(o.xAxisID),s=n.getScaleForId(o.yAxisID),l=r.getBasePixel(),u=t.custom||{},d=n.getDataset(),c=n.chart.options.elements.rectangle;t._xScale=r,t._yScale=s,t._datasetIndex=n.index,t._index=a;var h=n.getRuler(a);t._model={x:i?l:n.calculateBarX(a,n.index),y:n.calculateBarY(a,n.index,h),label:n.chart.data.labels[a],datasetLabel:d.label,horizontal:!0,base:i?l:n.calculateBarBase(n.index,a),height:n.calculateBarHeight(h),backgroundColor:u.backgroundColor?u.backgroundColor:e.getValueAtIndexOrDefault(d.backgroundColor,a,c.backgroundColor),borderSkipped:u.borderSkipped?u.borderSkipped:c.borderSkipped,borderColor:u.borderColor?u.borderColor:e.getValueAtIndexOrDefault(d.borderColor,a,c.borderColor),
11
- borderWidth:u.borderWidth?u.borderWidth:e.getValueAtIndexOrDefault(d.borderWidth,a,c.borderWidth)},t.pivot()},calculateBarBase:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.xAxisID),o=n.getBaseValue(),r=o;if(n.options.stacked||void 0===n.options.stacked&&void 0!==i.stack){for(var s=a.chart,l=s.data.datasets,u=Number(l[t].data[e]),d=0;d<t;d++){var c=l[d],h=s.getDatasetMeta(d);if(h.bar&&h.xAxisID===n.id&&s.isDatasetVisible(d)&&i.stack===h.stack){var f=Number(c.data[e]);o+=u<0?Math.min(f,r):Math.max(f,r)}}return n.getPixelForValue(o)}return n.getBasePixel()},getRuler:function(){var t=this,e=t.getMeta(),a=t.getScaleForId(e.yAxisID),i=t.getStackCount(),n=a.height/a.ticks.length,o=n*a.options.categoryPercentage,r=(n-n*a.options.categoryPercentage)/2,s=o/i,l=s*a.options.barPercentage,u=s-s*a.options.barPercentage;return{stackCount:i,tickHeight:n,categoryHeight:o,categorySpacing:r,fullBarHeight:s,barHeight:l,barSpacing:u}},calculateBarHeight:function(t){var e=this,a=e.getMeta(),i=e.getScaleForId(a.yAxisID);return i.options.barThickness?i.options.barThickness:t.barHeight},getStackIndex:function(t){var e,a,i=this,n=i.chart.getDatasetMeta(t),o=i.getScaleForId(n.xAxisID),r=[n.stack];for(a=0;a<t;++a)e=this.chart.getDatasetMeta(a),e.bar&&this.chart.isDatasetVisible(a)&&(o.options.stacked===!1||o.options.stacked===!0&&r.indexOf(e.stack)===-1||void 0===o.options.stacked&&(void 0===e.stack||r.indexOf(e.stack)===-1))&&r.push(e.stack);return r.length-1},calculateBarX:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.xAxisID),o=Number(a.getDataset().data[t]);if(n.options.stacked||void 0===n.options.stacked&&void 0!==i.stack){for(var r=n.getBaseValue(),s=r,l=r,u=0;u<e;u++){var d=a.chart.data.datasets[u],c=a.chart.getDatasetMeta(u);if(c.bar&&c.xAxisID===n.id&&a.chart.isDatasetVisible(u)&&i.stack===c.stack){var h=Number(d.data[t]);h<0?l+=h||0:s+=h||0}}return o<0?n.getPixelForValue(l+o):n.getPixelForValue(s+o)}return n.getPixelForValue(o)},calculateBarY:function(t,e,a){var i=this,n=i.getMeta(),o=i.getScaleForId(n.yAxisID),r=i.getStackIndex(e),s=o.getPixelForValue(null,t,e,i.chart.isCombo);return s-=i.chart.isCombo?a.tickHeight/2:0,s+a.barHeight/2+a.categorySpacing+a.barHeight*r+a.barSpacing/2+a.barSpacing*r}})}},{}],16:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.bubble={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(){return""},label:function(t,e){var a=e.datasets[t.datasetIndex].label||"",i=e.datasets[t.datasetIndex].data[t.index];return a+": ("+t.xLabel+", "+t.yLabel+", "+i.r+")"}}}},t.controllers.bubble=t.DatasetController.extend({dataElementType:t.elements.Point,update:function(t){var a=this,i=a.getMeta(),n=i.data;e.each(n,function(e,i){a.updateElement(e,i,t)})},updateElement:function(a,i,n){var o=this,r=o.getMeta(),s=o.getScaleForId(r.xAxisID),l=o.getScaleForId(r.yAxisID),u=a.custom||{},d=o.getDataset(),c=d.data[i],h=o.chart.options.elements.point,f=o.index;e.extend(a,{_xScale:s,_yScale:l,_datasetIndex:f,_index:i,_model:{x:n?s.getPixelForDecimal(.5):s.getPixelForValue("object"==typeof c?c:NaN,i,f,o.chart.isCombo),y:n?l.getBasePixel():l.getPixelForValue(c,i,f),radius:n?0:u.radius?u.radius:o.getRadius(c),hitRadius:u.hitRadius?u.hitRadius:e.getValueAtIndexOrDefault(d.hitRadius,i,h.hitRadius)}}),t.DatasetController.prototype.removeHoverStyle.call(o,a,h);var g=a._model;g.skip=u.skip?u.skip:isNaN(g.x)||isNaN(g.y),a.pivot()},getRadius:function(t){return t.r||this.chart.options.elements.point.radius},setHoverStyle:function(a){var i=this;t.DatasetController.prototype.setHoverStyle.call(i,a);var n=i.chart.data.datasets[a._datasetIndex],o=a._index,r=a.custom||{},s=a._model;s.radius=r.hoverRadius?r.hoverRadius:e.getValueAtIndexOrDefault(n.hoverRadius,o,i.chart.options.elements.point.hoverRadius)+i.getRadius(n.data[o])},removeHoverStyle:function(e){var a=this;t.DatasetController.prototype.removeHoverStyle.call(a,e,a.chart.options.elements.point);var i=a.chart.data.datasets[e._datasetIndex].data[e._index],n=e.custom||{},o=e._model;o.radius=n.radius?n.radius:a.getRadius(i)}})}},{}],17:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults;a.doughnut={animation:{animateRotate:!0,animateScale:!1},aspectRatio:1,hover:{mode:"single"},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o<i[0].data.length;++o)e.push('<li><span style="background-color:'+i[0].backgroundColor[o]+'"></span>'),n[o]&&e.push(n[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],s=o.data[n],l=s&&s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(r.backgroundColor,n,d.backgroundColor),h=l.borderColor?l.borderColor:u(r.borderColor,n,d.borderColor),f=l.borderWidth?l.borderWidth:u(r.borderWidth,n,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;a<i;++a)n=r.getDatasetMeta(a),n.data[o]&&(n.data[o].hidden=!n.data[o].hidden);r.update()}},cutoutPercentage:50,rotation:Math.PI*-.5,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,a){var i=a.labels[t.index],n=": "+a.datasets[t.datasetIndex].data[t.index];return e.isArray(i)?(i=i.slice(),i[0]+=n):i+=n,i}}}},a.pie=e.clone(a.doughnut),e.extend(a.pie,{cutoutPercentage:0}),t.controllers.doughnut=t.controllers.pie=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,getRingIndex:function(t){for(var e=0,a=0;a<t;++a)this.chart.isDatasetVisible(a)&&++e;return e},update:function(t){var a=this,i=a.chart,n=i.chartArea,o=i.options,r=o.elements.arc,s=n.right-n.left-r.borderWidth,l=n.bottom-n.top-r.borderWidth,u=Math.min(s,l),d={x:0,y:0},c=a.getMeta(),h=o.cutoutPercentage,f=o.circumference;if(f<2*Math.PI){var g=o.rotation%(2*Math.PI);g+=2*Math.PI*(g>=Math.PI?-1:g<-Math.PI?1:0);var p=g+f,m={x:Math.cos(g),y:Math.sin(g)},v={x:Math.cos(p),y:Math.sin(p)},b=g<=0&&0<=p||g<=2*Math.PI&&2*Math.PI<=p,x=g<=.5*Math.PI&&.5*Math.PI<=p||g<=2.5*Math.PI&&2.5*Math.PI<=p,y=g<=-Math.PI&&-Math.PI<=p||g<=Math.PI&&Math.PI<=p,k=g<=.5*-Math.PI&&.5*-Math.PI<=p||g<=1.5*Math.PI&&1.5*Math.PI<=p,S=h/100,M={x:y?-1:Math.min(m.x*(m.x<0?1:S),v.x*(v.x<0?1:S)),y:k?-1:Math.min(m.y*(m.y<0?1:S),v.y*(v.y<0?1:S))},w={x:b?1:Math.max(m.x*(m.x>0?1:S),v.x*(v.x>0?1:S)),y:x?1:Math.max(m.y*(m.y>0?1:S),v.y*(v.y>0?1:S))},C={width:.5*(w.x-M.x),height:.5*(w.y-M.y)};u=Math.min(s/C.width,l/C.height),d={x:(w.x+M.x)*-.5,y:(w.y+M.y)*-.5}}i.borderWidth=a.getMaxBorderWidth(c.data),i.outerRadius=Math.max((u-i.borderWidth)/2,0),i.innerRadius=Math.max(h?i.outerRadius/100*h:0,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),i.offsetX=d.x*i.outerRadius,i.offsetY=d.y*i.outerRadius,c.total=a.calculateTotal(),a.outerRadius=i.outerRadius-i.radiusLength*a.getRingIndex(a.index),a.innerRadius=Math.max(a.outerRadius-i.radiusLength,0),e.each(c.data,function(e,i){a.updateElement(e,i,t)})},updateElement:function(t,a,i){var n=this,o=n.chart,r=o.chartArea,s=o.options,l=s.animation,u=(r.left+r.right)/2,d=(r.top+r.bottom)/2,c=s.rotation,h=s.rotation,f=n.getDataset(),g=i&&l.animateRotate?0:t.hidden?0:n.calculateCircumference(f.data[a])*(s.circumference/(2*Math.PI)),p=i&&l.animateScale?0:n.innerRadius,m=i&&l.animateScale?0:n.outerRadius,v=e.getValueAtIndexOrDefault;e.extend(t,{_datasetIndex:n.index,_index:a,_model:{x:u+o.offsetX,y:d+o.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:m,innerRadius:p,label:v(f.label,a,o.data.labels[a])}});var b=t._model;this.removeHoverStyle(t),i&&l.animateRotate||(0===a?b.startAngle=s.rotation:b.startAngle=n.getMeta().data[a-1]._model.endAngle,b.endAngle=b.startAngle+b.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,a=this.getDataset(),i=this.getMeta(),n=0;return e.each(i.data,function(e,i){t=a.data[i],isNaN(t)||e.hidden||(n+=Math.abs(t))}),n},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,a,i=0,n=this.index,o=t.length,r=0;r<o;r++)e=t[r]._model?t[r]._model.borderWidth:0,a=t[r]._chart?t[r]._chart.config.data.datasets[n].hoverBorderWidth:0,i=e>i?e:i,i=a>i?a:i;return i}})}},{}],18:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return a.getValueOrDefault(t.showLine,e.showLines)}var a=t.helpers;t.defaults.line={showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}},t.controllers.line=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,update:function(t){var i,n,o,r=this,s=r.getMeta(),l=s.dataset,u=s.data||[],d=r.chart.options,c=d.elements.line,h=r.getScaleForId(s.yAxisID),f=r.getDataset(),g=e(f,d);for(g&&(o=l.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),l._scale=h,l._datasetIndex=r.index,l._children=u,l._model={spanGaps:f.spanGaps?f.spanGaps:d.spanGaps,tension:o.tension?o.tension:a.getValueOrDefault(f.lineTension,c.tension),backgroundColor:o.backgroundColor?o.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:o.borderWidth?o.borderWidth:f.borderWidth||c.borderWidth,borderColor:o.borderColor?o.borderColor:f.borderColor||c.borderColor,borderCapStyle:o.borderCapStyle?o.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:o.borderDash?o.borderDash:f.borderDash||c.borderDash,borderDashOffset:o.borderDashOffset?o.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:o.borderJoinStyle?o.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:o.fill?o.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:o.steppedLine?o.steppedLine:a.getValueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:o.cubicInterpolationMode?o.cubicInterpolationMode:a.getValueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode),scaleTop:h.top,scaleBottom:h.bottom,scaleZero:h.getBasePixel()},l.pivot()),i=0,n=u.length;i<n;++i)r.updateElement(u[i],i,t);for(g&&0!==l._model.tension&&r.updateBezierControlPoints(),i=0,n=u.length;i<n;++i)u[i].pivot()},getPointBackgroundColor:function(t,e){var i=this.chart.options.elements.point.backgroundColor,n=this.getDataset(),o=t.custom||{};return o.backgroundColor?i=o.backgroundColor:n.pointBackgroundColor?i=a.getValueAtIndexOrDefault(n.pointBackgroundColor,e,i):n.backgroundColor&&(i=n.backgroundColor),i},getPointBorderColor:function(t,e){var i=this.chart.options.elements.point.borderColor,n=this.getDataset(),o=t.custom||{};return o.borderColor?i=o.borderColor:n.pointBorderColor?i=a.getValueAtIndexOrDefault(n.pointBorderColor,e,i):n.borderColor&&(i=n.borderColor),i},getPointBorderWidth:function(t,e){var i=this.chart.options.elements.point.borderWidth,n=this.getDataset(),o=t.custom||{};return isNaN(o.borderWidth)?isNaN(n.pointBorderWidth)?isNaN(n.borderWidth)||(i=n.borderWidth):i=a.getValueAtIndexOrDefault(n.pointBorderWidth,e,i):i=o.borderWidth,i},updateElement:function(t,e,i){var n,o,r=this,s=r.getMeta(),l=t.custom||{},u=r.getDataset(),d=r.index,c=u.data[e],h=r.getScaleForId(s.yAxisID),f=r.getScaleForId(s.xAxisID),g=r.chart.options.elements.point,p=r.chart.data.labels||[],m=1===p.length||1===u.data.length||r.chart.isCombo;void 0!==u.radius&&void 0===u.pointRadius&&(u.pointRadius=u.radius),void 0!==u.hitRadius&&void 0===u.pointHitRadius&&(u.pointHitRadius=u.hitRadius),n=f.getPixelForValue("object"==typeof c?c:NaN,e,d,m),o=i?h.getBasePixel():r.calculatePointY(c,e,d),t._xScale=f,t._yScale=h,t._datasetIndex=d,t._index=e,t._model={x:n,y:o,skip:l.skip||isNaN(n)||isNaN(o),radius:l.radius||a.getValueAtIndexOrDefault(u.pointRadius,e,g.radius),pointStyle:l.pointStyle||a.getValueAtIndexOrDefault(u.pointStyle,e,g.pointStyle),backgroundColor:r.getPointBackgroundColor(t,e),borderColor:r.getPointBorderColor(t,e),borderWidth:r.getPointBorderWidth(t,e),tension:s.dataset._model?s.dataset._model.tension:0,steppedLine:!!s.dataset._model&&s.dataset._model.steppedLine,hitRadius:l.hitRadius||a.getValueAtIndexOrDefault(u.pointHitRadius,e,g.hitRadius)}},calculatePointY:function(t,e,a){var i,n,o,r=this,s=r.chart,l=r.getMeta(),u=r.getScaleForId(l.yAxisID),d=0,c=0;if(u.options.stacked){for(i=0;i<a;i++)if(n=s.data.datasets[i],o=s.getDatasetMeta(i),"line"===o.type&&o.yAxisID===u.id&&s.isDatasetVisible(i)){var h=Number(u.getRightValue(n.data[e]));h<0?c+=h||0:d+=h||0}var f=Number(u.getRightValue(t));return f<0?u.getPixelForValue(c+f):u.getPixelForValue(d+f)}return u.getPixelForValue(t)},updateBezierControlPoints:function(){function t(t,e,a){return Math.max(Math.min(t,a),e)}var e,i,n,o,r,s=this,l=s.getMeta(),u=s.chart.chartArea,d=l.data||[];if(l.dataset._model.spanGaps&&(d=d.filter(function(t){return!t._model.skip})),"monotone"===l.dataset._model.cubicInterpolationMode)a.splineCurveMonotone(d);else for(e=0,i=d.length;e<i;++e)n=d[e],o=n._model,r=a.splineCurve(a.previousItem(d,e)._model,o,a.nextItem(d,e)._model,l.dataset._model.tension),o.controlPointPreviousX=r.previous.x,o.controlPointPreviousY=r.previous.y,o.controlPointNextX=r.next.x,o.controlPointNextY=r.next.y;if(s.chart.options.elements.line.capBezierPoints)for(e=0,i=d.length;e<i;++e)o=d[e]._model,o.controlPointPreviousX=t(o.controlPointPreviousX,u.left,u.right),o.controlPointPreviousY=t(o.controlPointPreviousY,u.top,u.bottom),o.controlPointNextX=t(o.controlPointNextX,u.left,u.right),o.controlPointNextY=t(o.controlPointNextY,u.top,u.bottom)},draw:function(a){var i,n,o=this,r=o.getMeta(),s=r.data||[],l=a||1;for(i=0,n=s.length;i<n;++i)s[i].transition(l);for(t.canvasHelpers.clipArea(o.chart.chart.ctx,o.chart.chartArea),e(o.getDataset(),o.chart.options)&&r.dataset.transition(l).draw(),t.canvasHelpers.unclipArea(o.chart.chart.ctx),i=0,n=s.length;i<n;++i)s[i].draw(o.chart.chartArea)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model;o.radius=n.hoverRadius||a.getValueAtIndexOrDefault(e.pointHoverRadius,i,this.chart.options.elements.point.hoverRadius),o.backgroundColor=n.hoverBackgroundColor||a.getValueAtIndexOrDefault(e.pointHoverBackgroundColor,i,a.getHoverColor(o.backgroundColor)),o.borderColor=n.hoverBorderColor||a.getValueAtIndexOrDefault(e.pointHoverBorderColor,i,a.getHoverColor(o.borderColor)),o.borderWidth=n.hoverBorderWidth||a.getValueAtIndexOrDefault(e.pointHoverBorderWidth,i,o.borderWidth)},removeHoverStyle:function(t){var e=this,i=e.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},r=t._model;void 0!==i.radius&&void 0===i.pointRadius&&(i.pointRadius=i.radius),r.radius=o.radius||a.getValueAtIndexOrDefault(i.pointRadius,n,e.chart.options.elements.point.radius),r.backgroundColor=e.getPointBackgroundColor(t,n),r.borderColor=e.getPointBorderColor(t,n),r.borderWidth=e.getPointBorderWidth(t,n)}})}},{}],19:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.polarArea={scale:{type:"radialLinear",lineArc:!0,ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,aspectRatio:1,legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o<i[0].data.length;++o)e.push('<li><span style="background-color:'+i[0].backgroundColor[o]+'"></span>'),n[o]&&e.push(n[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],s=o.data[n],l=s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(r.backgroundColor,n,d.backgroundColor),h=l.borderColor?l.borderColor:u(r.borderColor,n,d.borderColor),f=l.borderWidth?l.borderWidth:u(r.borderWidth,n,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;a<i;++a)n=r.getDatasetMeta(a),n.data[o].hidden=!n.data[o].hidden;r.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}},t.controllers.polarArea=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,update:function(t){var a=this,i=a.chart,n=i.chartArea,o=a.getMeta(),r=i.options,s=r.elements.arc,l=Math.min(n.right-n.left,n.bottom-n.top);i.outerRadius=Math.max((l-s.borderWidth/2)/2,0),i.innerRadius=Math.max(r.cutoutPercentage?i.outerRadius/100*r.cutoutPercentage:1,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),a.outerRadius=i.outerRadius-i.radiusLength*a.index,a.innerRadius=a.outerRadius-i.radiusLength,o.count=a.countVisibleElements(),e.each(o.data,function(e,i){a.updateElement(e,i,t)})},updateElement:function(t,a,i){for(var n=this,o=n.chart,r=n.getDataset(),s=o.options,l=s.animation,u=o.scale,d=e.getValueAtIndexOrDefault,c=o.data.labels,h=n.calculateCircumference(r.data[a]),f=u.xCenter,g=u.yCenter,p=0,m=n.getMeta(),v=0;v<a;++v)isNaN(r.data[v])||m.data[v].hidden||++p;var b=s.startAngle,x=t.hidden?0:u.getDistanceFromCenterForValue(r.data[a]),y=b+h*p,k=y+(t.hidden?0:h),S=l.animateScale?0:u.getDistanceFromCenterForValue(r.data[a]);e.extend(t,{_datasetIndex:n.index,_index:a,_scale:u,_model:{x:f,y:g,innerRadius:0,outerRadius:i?S:x,startAngle:i&&l.animateRotate?b:y,endAngle:i&&l.animateRotate?b:k,label:d(c,a,c[a])}}),n.removeHoverStyle(t),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},countVisibleElements:function(){var t=this.getDataset(),a=this.getMeta(),i=0;return e.each(a.data,function(e,a){isNaN(t.data[a])||e.hidden||i++}),i},calculateCircumference:function(t){var e=this.getMeta().count;return e>0&&!isNaN(t)?2*Math.PI/e:0}})}},{}],20:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.radar={aspectRatio:1,scale:{type:"radialLinear"},elements:{line:{tension:0}}},t.controllers.radar=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,linkScales:e.noop,update:function(t){var a=this,i=a.getMeta(),n=i.dataset,o=i.data,r=n.custom||{},s=a.getDataset(),l=a.chart.options.elements.line,u=a.chart.scale;void 0!==s.tension&&void 0===s.lineTension&&(s.lineTension=s.tension),e.extend(i.dataset,{_datasetIndex:a.index,_children:o,_loop:!0,_model:{tension:r.tension?r.tension:e.getValueOrDefault(s.lineTension,l.tension),backgroundColor:r.backgroundColor?r.backgroundColor:s.backgroundColor||l.backgroundColor,borderWidth:r.borderWidth?r.borderWidth:s.borderWidth||l.borderWidth,borderColor:r.borderColor?r.borderColor:s.borderColor||l.borderColor,fill:r.fill?r.fill:void 0!==s.fill?s.fill:l.fill,borderCapStyle:r.borderCapStyle?r.borderCapStyle:s.borderCapStyle||l.borderCapStyle,borderDash:r.borderDash?r.borderDash:s.borderDash||l.borderDash,borderDashOffset:r.borderDashOffset?r.borderDashOffset:s.borderDashOffset||l.borderDashOffset,borderJoinStyle:r.borderJoinStyle?r.borderJoinStyle:s.borderJoinStyle||l.borderJoinStyle,scaleTop:u.top,scaleBottom:u.bottom,scaleZero:u.getBasePosition()}}),i.dataset.pivot(),e.each(o,function(e,i){a.updateElement(e,i,t)},a),a.updateBezierControlPoints()},updateElement:function(t,a,i){var n=this,o=t.custom||{},r=n.getDataset(),s=n.chart.scale,l=n.chart.options.elements.point,u=s.getPointPositionForValue(a,r.data[a]);e.extend(t,{_datasetIndex:n.index,_index:a,_scale:s,_model:{x:i?s.xCenter:u.x,y:i?s.yCenter:u.y,tension:o.tension?o.tension:e.getValueOrDefault(r.lineTension,n.chart.options.elements.line.tension),radius:o.radius?o.radius:e.getValueAtIndexOrDefault(r.pointRadius,a,l.radius),backgroundColor:o.backgroundColor?o.backgroundColor:e.getValueAtIndexOrDefault(r.pointBackgroundColor,a,l.backgroundColor),borderColor:o.borderColor?o.borderColor:e.getValueAtIndexOrDefault(r.pointBorderColor,a,l.borderColor),borderWidth:o.borderWidth?o.borderWidth:e.getValueAtIndexOrDefault(r.pointBorderWidth,a,l.borderWidth),pointStyle:o.pointStyle?o.pointStyle:e.getValueAtIndexOrDefault(r.pointStyle,a,l.pointStyle),hitRadius:o.hitRadius?o.hitRadius:e.getValueAtIndexOrDefault(r.hitRadius,a,l.hitRadius)}}),t._model.skip=o.skip?o.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,a=this.getMeta();e.each(a.data,function(i,n){var o=i._model,r=e.splineCurve(e.previousItem(a.data,n,!0)._model,o,e.nextItem(a.data,n,!0)._model,o.tension);o.controlPointPreviousX=Math.max(Math.min(r.previous.x,t.right),t.left),o.controlPointPreviousY=Math.max(Math.min(r.previous.y,t.bottom),t.top),o.controlPointNextX=Math.max(Math.min(r.next.x,t.right),t.left),o.controlPointNextY=Math.max(Math.min(r.next.y,t.bottom),t.top),i.pivot()})},draw:function(t){var a=this.getMeta(),i=t||1;e.each(a.data,function(t){t.transition(i)}),a.dataset.transition(i).draw(),e.each(a.data,function(t){t.draw()})},setHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model;o.radius=i.hoverRadius?i.hoverRadius:e.getValueAtIndexOrDefault(a.pointHoverRadius,n,this.chart.options.elements.point.hoverRadius),o.backgroundColor=i.hoverBackgroundColor?i.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.pointHoverBackgroundColor,n,e.getHoverColor(o.backgroundColor)),o.borderColor=i.hoverBorderColor?i.hoverBorderColor:e.getValueAtIndexOrDefault(a.pointHoverBorderColor,n,e.getHoverColor(o.borderColor)),o.borderWidth=i.hoverBorderWidth?i.hoverBorderWidth:e.getValueAtIndexOrDefault(a.pointHoverBorderWidth,n,o.borderWidth)},removeHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model,r=this.chart.options.elements.point;o.radius=i.radius?i.radius:e.getValueAtIndexOrDefault(a.radius,n,r.radius),o.backgroundColor=i.backgroundColor?i.backgroundColor:e.getValueAtIndexOrDefault(a.pointBackgroundColor,n,r.backgroundColor),o.borderColor=i.borderColor?i.borderColor:e.getValueAtIndexOrDefault(a.pointBorderColor,n,r.borderColor),o.borderWidth=i.borderWidth?i.borderWidth:e.getValueAtIndexOrDefault(a.pointBorderWidth,n,r.borderWidth)}})}},{}],21:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.animation={duration:1e3,easing:"easeOutQuart",onProgress:e.noop,onComplete:e.noop},t.Animation=t.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,a,i){var n=this;i||(t.animating=!0);for(var o=0;o<n.animations.length;++o)if(n.animations[o].chartInstance===t)return void(n.animations[o].animationObject=e);n.animations.push({chartInstance:t,animationObject:e}),1===n.animations.length&&n.requestAnimationFrame()},cancelAnimation:function(t){var a=e.findIndex(this.animations,function(e){return e.chartInstance===t});a!==-1&&(this.animations.splice(a,1),t.animating=!1)},requestAnimationFrame:function(){var t=this;null===t.request&&(t.request=e.requestAnimFrame.call(window,function(){t.request=null,t.startDigest()}))},startDigest:function(){var t=this,e=Date.now(),a=0;t.dropFrames>1&&(a=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1);for(var i=0;i<t.animations.length;)null===t.animations[i].animationObject.currentStep&&(t.animations[i].animationObject.currentStep=0),t.animations[i].animationObject.currentStep+=1+a,t.animations[i].animationObject.currentStep>t.animations[i].animationObject.numSteps&&(t.animations[i].animationObject.currentStep=t.animations[i].animationObject.numSteps),t.animations[i].animationObject.render(t.animations[i].chartInstance,t.animations[i].animationObject),t.animations[i].animationObject.onAnimationProgress&&t.animations[i].animationObject.onAnimationProgress.call&&t.animations[i].animationObject.onAnimationProgress.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].animationObject.currentStep===t.animations[i].animationObject.numSteps?(t.animations[i].animationObject.onAnimationComplete&&t.animations[i].animationObject.onAnimationComplete.call&&t.animations[i].animationObject.onAnimationComplete.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].chartInstance.animating=!1,t.animations.splice(i,1)):++i;var n=Date.now(),o=(n-e)/t.frameDuration;t.dropFrames+=o,t.animations.length>0&&t.requestAnimationFrame()}}}},{}],22:[function(t,e,a){"use strict";e.exports=function(t){var e=t.canvasHelpers={};e.drawPoint=function(e,a,i,n,o){var r,s,l,u,d,c;if("object"==typeof a&&(r=a.toString(),"[object HTMLImageElement]"===r||"[object HTMLCanvasElement]"===r))return void e.drawImage(a,n-a.width/2,o-a.height/2);if(!(isNaN(i)||i<=0)){switch(a){default:e.beginPath(),e.arc(n,o,i,0,2*Math.PI),e.closePath(),e.fill();break;case"triangle":e.beginPath(),s=3*i/Math.sqrt(3),d=s*Math.sqrt(3)/2,e.moveTo(n-s/2,o+d/3),e.lineTo(n+s/2,o+d/3),e.lineTo(n,o-2*d/3),e.closePath(),e.fill();break;case"rect":c=1/Math.SQRT2*i,e.beginPath(),e.fillRect(n-c,o-c,2*c,2*c),e.strokeRect(n-c,o-c,2*c,2*c);break;case"rectRounded":var h=i/Math.SQRT2,f=n-h,g=o-h,p=Math.SQRT2*i;t.helpers.drawRoundedRectangle(e,f,g,p,p,i/2),e.fill();break;case"rectRot":c=1/Math.SQRT2*i,e.beginPath(),e.moveTo(n-c,o),e.lineTo(n,o+c),e.lineTo(n+c,o),e.lineTo(n,o-c),e.closePath(),e.fill();break;case"cross":e.beginPath(),e.moveTo(n,o+i),e.lineTo(n,o-i),e.moveTo(n-i,o),e.lineTo(n+i,o),e.closePath();break;case"crossRot":e.beginPath(),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(n-l,o-u),e.lineTo(n+l,o+u),e.moveTo(n-l,o+u),e.lineTo(n+l,o-u),e.closePath();break;case"star":e.beginPath(),e.moveTo(n,o+i),e.lineTo(n,o-i),e.moveTo(n-i,o),e.lineTo(n+i,o),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(n-l,o-u),e.lineTo(n+l,o+u),e.moveTo(n-l,o+u),e.lineTo(n+l,o-u),e.closePath();break;case"line":e.beginPath(),e.moveTo(n-i,o),e.lineTo(n+i,o),e.closePath();break;case"dash":e.beginPath(),e.moveTo(n,o),e.lineTo(n+i,o),e.closePath()}e.stroke()}},e.clipArea=function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},e.unclipArea=function(t){t.restore()}}},{}],23:[function(t,e,a){"use strict";e.exports=function(t){function e(e){e=e||{};var a=e.data=e.data||{};return a.datasets=a.datasets||[],a.labels=a.labels||[],e.options=i.configMerge(t.defaults.global,t.defaults[e.type],e.options||{}),e}function a(t){var e=t.options;e.scale?t.scale.options=e.scale:e.scales&&e.scales.xAxes.concat(e.scales.yAxes).forEach(function(e){t.scales[e.id].options=e}),t.tooltip._options=e.tooltips}var i=t.helpers,n=t.plugins,o=t.platform;t.types={},t.instances={},t.controllers={},t.Controller=function(a,n,r){var s=this;n=e(n);var l=o.acquireContext(a,n),u=l&&l.canvas,d=u&&u.height,c=u&&u.width;return r.ctx=l,r.canvas=u,r.config=n,r.width=c,r.height=d,r.aspectRatio=d?c/d:null,s.id=i.uid(),s.chart=r,s.config=n,s.options=n.options,s._bufferedRender=!1,t.instances[s.id]=s,Object.defineProperty(s,"data",{get:function(){return s.config.data}}),l&&u?(s.initialize(),s.update(),s):(console.error("Failed to create chart: can't acquire context from the given item"),s)},i.extend(t.Controller.prototype,{initialize:function(){var t=this;return n.notify(t,"beforeInit"),i.retinaScale(t.chart),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildScales(),t.initToolTip(),n.notify(t,"afterInit"),t},clear:function(){return i.clear(this.chart),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(t){var e=this,a=e.chart,o=e.options,r=a.canvas,s=o.maintainAspectRatio&&a.aspectRatio||null,l=Math.floor(i.getMaximumWidth(r)),u=Math.floor(s?l/s:i.getMaximumHeight(r));if((a.width!==l||a.height!==u)&&(r.width=a.width=l,r.height=a.height=u,r.style.width=l+"px",r.style.height=u+"px",i.retinaScale(a),!t)){var d={width:l,height:u};n.notify(e,"resize",[d]),e.options.onResize&&e.options.onResize(e,d),e.stop(),e.update(e.options.responsiveAnimationDuration)}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},a=t.scale;i.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),i.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),a&&(a.id=a.id||"scale")},buildScales:function(){var e=this,a=e.options,n=e.scales={},o=[];a.scales&&(o=o.concat((a.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category"}}),(a.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear"}}))),a.scale&&o.push({options:a.scale,dtype:"radialLinear",isDefault:!0}),i.each(o,function(a){var o=a.options,r=i.getValueOrDefault(o.type,a.dtype),s=t.scaleService.getScaleConstructor(r);if(s){var l=new s({id:o.id,options:o,ctx:e.chart.ctx,chart:e});n[l.id]=l,a.isDefault&&(e.scale=l)}}),t.scaleService.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e=this,a=[],n=[];if(i.each(e.data.datasets,function(i,o){var r=e.getDatasetMeta(o);r.type||(r.type=i.type||e.config.type),a.push(r.type),r.controller?r.controller.updateIndex(o):(r.controller=new t.controllers[r.type](e,o),n.push(r.controller))},e),a.length>1)for(var o=1;o<a.length;o++)if(a[o]!==a[o-1]){e.isCombo=!0;break}return n},resetElements:function(){var t=this;i.each(t.data.datasets,function(e,a){t.getDatasetMeta(a).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t,e){var o=this;if(a(o),n.notify(o,"beforeUpdate")!==!1){o.tooltip._data=o.data;var r=o.buildOrUpdateControllers();i.each(o.data.datasets,function(t,e){o.getDatasetMeta(e).controller.buildOrUpdateElements()},o),o.updateLayout(),i.each(r,function(t){t.reset()}),o.updateDatasets(),n.notify(o,"afterUpdate"),o._bufferedRender?o._bufferedRequest={lazy:e,duration:t}:o.render(t,e)}},updateLayout:function(){var e=this;n.notify(e,"beforeLayout")!==!1&&(t.layoutService.update(this,this.chart.width,this.chart.height),n.notify(e,"afterScaleUpdate"),n.notify(e,"afterLayout"))},updateDatasets:function(){var t=this;if(n.notify(t,"beforeDatasetsUpdate")!==!1){for(var e=0,a=t.data.datasets.length;e<a;++e)t.getDatasetMeta(e).controller.update();n.notify(t,"afterDatasetsUpdate")}},render:function(e,a){var o=this;if(n.notify(o,"beforeRender")!==!1){var r=o.options.animation,s=function(){n.notify(o,"afterRender");var t=r&&r.onComplete;t&&t.call&&t.call(o)};if(r&&("undefined"!=typeof e&&0!==e||"undefined"==typeof e&&0!==r.duration)){var l=new t.Animation;l.numSteps=(e||r.duration)/16.66,l.easing=r.easing,l.render=function(t,e){var a=i.easingEffects[e.easing],n=e.currentStep/e.numSteps,o=a(n);t.draw(o,n,e.currentStep)},l.onAnimationProgress=r.onProgress,l.onAnimationComplete=s,t.animationService.addAnimation(o,l,e,a)}else o.draw(),s();return o}},draw:function(t){var e=this;e.clear(),void 0!==t&&null!==t||(t=1),n.notify(e,"beforeDraw",[t])!==!1&&(i.each(e.boxes,function(t){t.draw(e.chartArea)},e),e.scale&&e.scale.draw(),e.drawDatasets(t),e.tooltip.transition(t).draw(),n.notify(e,"afterDraw",[t]))},drawDatasets:function(t){var e=this;n.notify(e,"beforeDatasetsDraw",[t])!==!1&&(i.each(e.data.datasets,function(a,i){e.isDatasetVisible(i)&&e.getDatasetMeta(i).controller.draw(t)},e,!0),n.notify(e,"afterDatasetsDraw",[t]))},getElementAtEvent:function(e){return t.Interaction.modes.single(this,e)},getElementsAtEvent:function(e){return t.Interaction.modes.label(this,e,{intersect:!0})},getElementsAtXAxis:function(e){return t.Interaction.modes["x-axis"](this,e,{intersect:!0})},getElementsAtEventForMode:function(e,a,i){
12
- var n=t.Interaction.modes[a];return"function"==typeof n?n(this,e,i):[]},getDatasetAtEvent:function(e){return t.Interaction.modes.dataset(this,e,{intersect:!0})},getDatasetMeta:function(t){var e=this,a=e.data.datasets[t];a._meta||(a._meta={});var i=a._meta[e.id];return i||(i=a._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,a=this.data.datasets.length;e<a;++e)this.isDatasetVisible(e)&&t++;return t},isDatasetVisible:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroy:function(){var e,a,r,s=this,l=s.chart.canvas;for(s.stop(),a=0,r=s.data.datasets.length;a<r;++a)e=s.getDatasetMeta(a),e.controller&&(e.controller.destroy(),e.controller=null);l&&(s.unbindEvents(),i.clear(s.chart),o.releaseContext(s.chart.ctx),s.chart.canvas=null,s.chart.ctx=null),n.notify(s,"destroy"),delete t.instances[s.id]},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)},initToolTip:function(){var e=this;e.tooltip=new t.Tooltip({_chart:e.chart,_chartInstance:e,_data:e.data,_options:e.options.tooltips},e),e.tooltip.initialize()},bindEvents:function(){var t=this,e=t._listeners={},a=function(){t.eventHandler.apply(t,arguments)};i.each(t.options.events,function(i){o.addEventListener(t,i,a),e[i]=a}),t.options.responsive&&(a=function(){t.resize()},o.addEventListener(t,"resize",a),e.resize=a)},unbindEvents:function(){var t=this,e=t._listeners;e&&(delete t._listeners,i.each(e,function(e,a){o.removeEventListener(t,a,e)}))},updateHoverStyle:function(t,e,a){var i,n,o,r=a?"setHoverStyle":"removeHoverStyle";for(n=0,o=t.length;n<o;++n)i=t[n],i&&this.getDatasetMeta(i._datasetIndex).controller[r](i)},eventHandler:function(t){var e=this,a=e.tooltip;if(n.notify(e,"beforeEvent",[t])!==!1){e._bufferedRender=!0,e._bufferedRequest=null;var i=e.handleEvent(t);i|=a&&a.handleEvent(t),n.notify(e,"afterEvent",[t]);var o=e._bufferedRequest;return o?e.render(o.duration,o.lazy):i&&!e.animating&&(e.stop(),e.render(e.options.hover.animationDuration,!0)),e._bufferedRender=!1,e._bufferedRequest=null,e}},handleEvent:function(t){var e=this,a=e.options||{},n=a.hover,o=!1;return e.lastActive=e.lastActive||[],"mouseout"===t.type?e.active=[]:e.active=e.getElementsAtEventForMode(t,n.mode,n),n.onHover&&n.onHover.call(e,t.native,e.active),"mouseup"!==t.type&&"click"!==t.type||a.onClick&&a.onClick.call(e,t.native,e.active),e.lastActive.length&&e.updateHoverStyle(e.lastActive,n.mode,!1),e.active.length&&n.mode&&e.updateHoverStyle(e.active,n.mode,!0),o=!i.arrayEquals(e.active,e.lastActive),e.lastActive=e.active,o}})}},{}],24:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t._chartjs?void t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),void n.forEach(function(e){var a="onData"+e.charAt(0).toUpperCase()+e.slice(1),n=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),o=n.apply(this,e);return i.each(t._chartjs.listeners,function(t){"function"==typeof t[a]&&t[a].apply(t,e)}),o}})}))}function a(t,e){var a=t._chartjs;if(a){var i=a.listeners,o=i.indexOf(e);o!==-1&&i.splice(o,1),i.length>0||(n.forEach(function(e){delete t[e]}),delete t._chartjs)}}var i=t.helpers,n=["push","pop","shift","splice","unshift"];t.DatasetController=function(t,e){this.initialize(t,e)},i.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var a=this;a.chart=t,a.index=e,a.linkScales(),a.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),a=t.getDataset();null===e.xAxisID&&(e.xAxisID=a.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=a.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},destroy:function(){this._data&&a(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,a=e.dataElementType;return a&&new a({_chart:e.chart.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,a=this,i=a.getMeta(),n=a.getDataset().data||[],o=i.data;for(t=0,e=n.length;t<e;++t)o[t]=o[t]||a.createMetaData(t);i.dataset=i.dataset||a.createMetaDataset()},addElementAndReset:function(t){var e=this.createMetaData(t);this.getMeta().data.splice(t,0,e),this.updateElement(e,t,!0)},buildOrUpdateElements:function(){var t=this,i=t.getDataset(),n=i.data||(i.data=[]);t._data!==n&&(t._data&&a(t._data,t),e(n,t),t._data=n),t.resyncElements()},update:i.noop,draw:function(t){var e,a,i=t||1,n=this.getMeta().data;for(e=0,a=n.length;e<a;++e)n[e].transition(i).draw()},removeHoverStyle:function(t,e){var a=this.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},r=i.getValueAtIndexOrDefault,s=t._model;s.backgroundColor=o.backgroundColor?o.backgroundColor:r(a.backgroundColor,n,e.backgroundColor),s.borderColor=o.borderColor?o.borderColor:r(a.borderColor,n,e.borderColor),s.borderWidth=o.borderWidth?o.borderWidth:r(a.borderWidth,n,e.borderWidth)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],a=t._index,n=t.custom||{},o=i.getValueAtIndexOrDefault,r=i.getHoverColor,s=t._model;s.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:o(e.hoverBackgroundColor,a,r(s.backgroundColor)),s.borderColor=n.hoverBorderColor?n.hoverBorderColor:o(e.hoverBorderColor,a,r(s.borderColor)),s.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:o(e.hoverBorderWidth,a,s.borderWidth)},resyncElements:function(){var t=this,e=t.getMeta(),a=t.getDataset().data,i=e.data.length,n=a.length;n<i?e.data.splice(n,i-n):n>i&&t.insertElements(i,n-i)},insertElements:function(t,e){for(var a=0;a<e;++a)this.addElementAndReset(t+a)},onDataPush:function(){this.insertElements(this.getDataset().data.length-1,arguments.length)},onDataPop:function(){this.getMeta().data.pop()},onDataShift:function(){this.getMeta().data.shift()},onDataSplice:function(t,e){this.getMeta().data.splice(t,e),this.insertElements(t,arguments.length-2)},onDataUnshift:function(){this.insertElements(0,arguments.length)}}),t.DatasetController.extend=i.inherits}},{}],25:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.elements={},t.Element=function(t){e.extend(this,t),this.initialize.apply(this,arguments)},e.extend(t.Element.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=e.clone(t._model)),t._start=e.clone(t._view),t},transition:function(t){var a=this;return a._view||(a._view=e.clone(a._model)),1===t?(a._view=a._model,a._start=null,a):(a._start||a.pivot(),e.each(a._model,function(i,n){if("_"===n[0]);else if(a._view.hasOwnProperty(n))if(i===a._view[n]);else if("string"==typeof i)try{var o=e.color(a._model[n]).mix(e.color(a._start[n]),t);a._view[n]=o.rgbString()}catch(t){a._view[n]=i}else if("number"==typeof i){var r=void 0!==a._start[n]&&isNaN(a._start[n])===!1?a._start[n]:0;a._view[n]=(a._model[n]-r)*t+r}else a._view[n]=i;else"number"!=typeof i||isNaN(a._view[n])?a._view[n]=i:a._view[n]=i*t},a),a)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return e.isNumber(this._model.x)&&e.isNumber(this._model.y)}}),t.Element.extend=e.inherits}},{}],26:[function(t,e,a){"use strict";var i=t(3);e.exports=function(t){function e(t,e,a){var i;return"string"==typeof t?(i=parseInt(t,10),t.indexOf("%")!==-1&&(i=i/100*e.parentNode[a])):i=t,i}function a(t){return void 0!==t&&null!==t&&"none"!==t}function n(t,i,n){var o=document.defaultView,r=t.parentNode,s=o.getComputedStyle(t)[i],l=o.getComputedStyle(r)[i],u=a(s),d=a(l),c=Number.POSITIVE_INFINITY;return u||d?Math.min(u?e(s,t,n):c,d?e(l,r,n):c):"none"}var o=t.helpers={};o.each=function(t,e,a,i){var n,r;if(o.isArray(t))if(r=t.length,i)for(n=r-1;n>=0;n--)e.call(a,t[n],n);else for(n=0;n<r;n++)e.call(a,t[n],n);else if("object"==typeof t){var s=Object.keys(t);for(r=s.length,n=0;n<r;n++)e.call(a,t[s[n]],s[n])}},o.clone=function(t){var e={};return o.each(t,function(t,a){o.isArray(t)?e[a]=t.slice(0):"object"==typeof t&&null!==t?e[a]=o.clone(t):e[a]=t}),e},o.extend=function(t){for(var e=function(e,a){t[a]=e},a=1,i=arguments.length;a<i;a++)o.each(arguments[a],e);return t},o.configMerge=function(e){var a=o.clone(e);return o.each(Array.prototype.slice.call(arguments,1),function(e){o.each(e,function(e,i){var n=a.hasOwnProperty(i),r=n?a[i]:{};"scales"===i?a[i]=o.scaleMerge(r,e):"scale"===i?a[i]=o.configMerge(r,t.scaleService.getScaleDefaults(e.type),e):!n||"object"!=typeof r||o.isArray(r)||null===r||"object"!=typeof e||o.isArray(e)?a[i]=e:a[i]=o.configMerge(r,e)})}),a},o.scaleMerge=function(e,a){var i=o.clone(e);return o.each(a,function(e,a){"xAxes"===a||"yAxes"===a?i.hasOwnProperty(a)?o.each(e,function(e,n){var r=o.getValueOrDefault(e.type,"xAxes"===a?"category":"linear"),s=t.scaleService.getScaleDefaults(r);n>=i[a].length||!i[a][n].type?i[a].push(o.configMerge(s,e)):e.type&&e.type!==i[a][n].type?i[a][n]=o.configMerge(i[a][n],s,e):i[a][n]=o.configMerge(i[a][n],e)}):(i[a]=[],o.each(e,function(e){var n=o.getValueOrDefault(e.type,"xAxes"===a?"category":"linear");i[a].push(o.configMerge(t.scaleService.getScaleDefaults(n),e))})):i.hasOwnProperty(a)&&"object"==typeof i[a]&&null!==i[a]&&"object"==typeof e?i[a]=o.configMerge(i[a],e):i[a]=e}),i},o.getValueAtIndexOrDefault=function(t,e,a){return void 0===t||null===t?a:o.isArray(t)?e<t.length?t[e]:a:t},o.getValueOrDefault=function(t,e){return void 0===t?e:t},o.indexOf=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var a=0,i=t.length;a<i;++a)if(t[a]===e)return a;return-1},o.where=function(t,e){if(o.isArray(t)&&Array.prototype.filter)return t.filter(e);var a=[];return o.each(t,function(t){e(t)&&a.push(t)}),a},o.findIndex=Array.prototype.findIndex?function(t,e,a){return t.findIndex(e,a)}:function(t,e,a){a=void 0===a?t:a;for(var i=0,n=t.length;i<n;++i)if(e.call(a,t[i],i,t))return i;return-1},o.findNextWhere=function(t,e,a){void 0!==a&&null!==a||(a=-1);for(var i=a+1;i<t.length;i++){var n=t[i];if(e(n))return n}},o.findPreviousWhere=function(t,e,a){void 0!==a&&null!==a||(a=t.length);for(var i=a-1;i>=0;i--){var n=t[i];if(e(n))return n}},o.inherits=function(t){var e=this,a=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},i=function(){this.constructor=a};return i.prototype=e.prototype,a.prototype=new i,a.extend=o.inherits,t&&o.extend(a.prototype,t),a.__super__=e.prototype,a},o.noop=function(){},o.uid=function(){var t=0;return function(){return t++}}(),o.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},o.almostEquals=function(t,e,a){return Math.abs(t-e)<a},o.almostWhole=function(t,e){var a=Math.round(t);return a-e<t&&a+e>t},o.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},o.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},o.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},o.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},o.toRadians=function(t){return t*(Math.PI/180)},o.toDegrees=function(t){return t*(180/Math.PI)},o.getAngleFromPoint=function(t,e){var a=e.x-t.x,i=e.y-t.y,n=Math.sqrt(a*a+i*i),o=Math.atan2(i,a);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:n}},o.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},o.aliasPixel=function(t){return t%2===0?0:.5},o.splineCurve=function(t,e,a,i){var n=t.skip?e:t,o=e,r=a.skip?e:a,s=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),l=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2)),u=s/(s+l),d=l/(s+l);u=isNaN(u)?0:u,d=isNaN(d)?0:d;var c=i*u,h=i*d;return{previous:{x:o.x-c*(r.x-n.x),y:o.y-c*(r.y-n.y)},next:{x:o.x+h*(r.x-n.x),y:o.y+h*(r.y-n.y)}}},o.EPSILON=Number.EPSILON||1e-14,o.splineCurveMonotone=function(t){var e,a,i,n,r=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),s=r.length;for(e=0;e<s;++e)if(i=r[e],!i.model.skip){if(a=e>0?r[e-1]:null,n=e<s-1?r[e+1]:null,n&&!n.model.skip){var l=n.model.x-i.model.x;i.deltaK=0!==l?(n.model.y-i.model.y)/l:0}!a||a.model.skip?i.mK=i.deltaK:!n||n.model.skip?i.mK=a.deltaK:this.sign(a.deltaK)!==this.sign(i.deltaK)?i.mK=0:i.mK=(a.deltaK+i.deltaK)/2}var u,d,c,h;for(e=0;e<s-1;++e)i=r[e],n=r[e+1],i.model.skip||n.model.skip||(o.almostEquals(i.deltaK,0,this.EPSILON)?i.mK=n.mK=0:(u=i.mK/i.deltaK,d=n.mK/i.deltaK,h=Math.pow(u,2)+Math.pow(d,2),h<=9||(c=3/Math.sqrt(h),i.mK=u*c*i.deltaK,n.mK=d*c*i.deltaK)));var f;for(e=0;e<s;++e)i=r[e],i.model.skip||(a=e>0?r[e-1]:null,n=e<s-1?r[e+1]:null,a&&!a.model.skip&&(f=(i.model.x-a.model.x)/3,i.model.controlPointPreviousX=i.model.x-f,i.model.controlPointPreviousY=i.model.y-f*i.mK),n&&!n.model.skip&&(f=(n.model.x-i.model.x)/3,i.model.controlPointNextX=i.model.x+f,i.model.controlPointNextY=i.model.y+f*i.mK))},o.nextItem=function(t,e,a){return a?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},o.previousItem=function(t,e,a){return a?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},o.niceNum=function(t,e){var a,i=Math.floor(o.log10(t)),n=t/Math.pow(10,i);return a=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,a*Math.pow(10,i)};var r=o.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:1===(t/=1)?1:(a||(a=.3),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),-(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)))},easeOutElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:1===(t/=1)?1:(a||(a=.3),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((1*t-e)*(2*Math.PI)/a)+1)},easeInOutElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:2===(t/=.5)?1:(a||(a=1*(.3*1.5)),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),t<1?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)):i*Math.pow(2,-10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)*.5+1)},easeInBack:function(t){var e=1.70158;return 1*(t/=1)*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return 1*((t=t/1-1)*t*((e+1)*t+e)+1)},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:function(t){return 1-r.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?1*(7.5625*t*t):t<2/2.75?1*(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return t<.5?.5*r.easeInBounce(2*t):.5*r.easeOutBounce(2*t-1)+.5}};o.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),o.getRelativePosition=function(t,e){var a,i,n=t.originalEvent||t,r=t.currentTarget||t.srcElement,s=r.getBoundingClientRect(),l=n.touches;l&&l.length>0?(a=l[0].clientX,i=l[0].clientY):(a=n.clientX,i=n.clientY);var u=parseFloat(o.getStyle(r,"padding-left")),d=parseFloat(o.getStyle(r,"padding-top")),c=parseFloat(o.getStyle(r,"padding-right")),h=parseFloat(o.getStyle(r,"padding-bottom")),f=s.right-s.left-u-c,g=s.bottom-s.top-d-h;return a=Math.round((a-s.left-u)/f*r.width/e.currentDevicePixelRatio),i=Math.round((i-s.top-d)/g*r.height/e.currentDevicePixelRatio),{x:a,y:i}},o.addEvent=function(t,e,a){t.addEventListener?t.addEventListener(e,a):t.attachEvent?t.attachEvent("on"+e,a):t["on"+e]=a},o.removeEvent=function(t,e,a){t.removeEventListener?t.removeEventListener(e,a,!1):t.detachEvent?t.detachEvent("on"+e,a):t["on"+e]=o.noop},o.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},o.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},o.getMaximumWidth=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-left"),10),i=parseInt(o.getStyle(e,"padding-right"),10),n=e.clientWidth-a-i,r=o.getConstraintWidth(t);return isNaN(r)?n:Math.min(n,r)},o.getMaximumHeight=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-top"),10),i=parseInt(o.getStyle(e,"padding-bottom"),10),n=e.clientHeight-a-i,r=o.getConstraintHeight(t);return isNaN(r)?n:Math.min(n,r)},o.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},o.retinaScale=function(t){var e=t.currentDevicePixelRatio=window.devicePixelRatio||1;if(1!==e){var a=t.canvas,i=t.height,n=t.width;a.height=i*e,a.width=n*e,t.ctx.scale(e,e),a.style.height=i+"px",a.style.width=n+"px"}},o.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},o.fontString=function(t,e,a){return e+" "+t+"px "+a},o.longestText=function(t,e,a,i){i=i||{};var n=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(n=i.data={},r=i.garbageCollect=[],i.font=e),t.font=e;var s=0;o.each(a,function(e){void 0!==e&&null!==e&&o.isArray(e)!==!0?s=o.measureText(t,n,r,s,e):o.isArray(e)&&o.each(e,function(e){void 0===e||null===e||o.isArray(e)||(s=o.measureText(t,n,r,s,e))})});var l=r.length/2;if(l>a.length){for(var u=0;u<l;u++)delete n[r[u]];r.splice(0,l)}return s},o.measureText=function(t,e,a,i,n){var o=e[n];return o||(o=e[n]=t.measureText(n).width,a.push(n)),o>i&&(i=o),i},o.numberOfLabelLines=function(t){var e=1;return o.each(t,function(t){o.isArray(t)&&t.length>e&&(e=t.length)}),e},o.drawRoundedRectangle=function(t,e,a,i,n,o){t.beginPath(),t.moveTo(e+o,a),t.lineTo(e+i-o,a),t.quadraticCurveTo(e+i,a,e+i,a+o),t.lineTo(e+i,a+n-o),t.quadraticCurveTo(e+i,a+n,e+i-o,a+n),t.lineTo(e+o,a+n),t.quadraticCurveTo(e,a+n,e,a+n-o),t.lineTo(e,a+o),t.quadraticCurveTo(e,a,e+o,a),t.closePath()},o.color=function(e){return i?i(e instanceof CanvasGradient?t.defaults.global.defaultColor:e):(console.error("Color.js not found!"),e)},o.isArray=Array.isArray?function(t){return Array.isArray(t)}:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.arrayEquals=function(t,e){var a,i,n,r;if(!t||!e||t.length!==e.length)return!1;for(a=0,i=t.length;a<i;++a)if(n=t[a],r=e[a],n instanceof Array&&r instanceof Array){if(!o.arrayEquals(n,r))return!1}else if(n!==r)return!1;return!0},o.callCallback=function(t,e,a){t&&"function"==typeof t.call&&t.apply(a,e)},o.getHoverColor=function(t){return t instanceof CanvasPattern?t:o.color(t).saturate(.5).darken(.1).rgbString()}}},{3:3}],27:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t.native?{x:t.x,y:t.y}:r.getRelativePosition(t,e)}function a(t,e){var a,i,n,o,r,s=t.data.datasets;for(i=0,o=s.length;i<o;++i)if(t.isDatasetVisible(i))for(a=t.getDatasetMeta(i),n=0,r=a.data.length;n<r;++n){var l=a.data[n];l._view.skip||e(l)}}function i(t,e){var i=[];return a(t,function(t){t.inRange(e.x,e.y)&&i.push(t)}),i}function n(t,e,i,n){var o=Number.POSITIVE_INFINITY,s=[];return n||(n=r.distanceBetweenPoints),a(t,function(t){if(!i||t.inRange(e.x,e.y)){var a=t.getCenterPoint(),r=n(e,a);r<o?(s=[t],o=r):r===o&&s.push(t)}}),s}function o(t,a,o){var r=e(a,t.chart),s=function(t,e){return Math.abs(t.x-e.x)},l=o.intersect?i(t,r):n(t,r,!1,s),u=[];return l.length?(t.data.datasets.forEach(function(e,a){if(t.isDatasetVisible(a)){var i=t.getDatasetMeta(a),n=i.data[l[0]._index];n&&!n._view.skip&&u.push(n)}}),u):[]}var r=t.helpers;t.Interaction={modes:{single:function(t,i){var n=e(i,t.chart),o=[];return a(t,function(t){if(t.inRange(n.x,n.y))return o.push(t),o}),o.slice(0,1)},label:o,index:o,dataset:function(t,a,o){var r=e(a,t.chart),s=o.intersect?i(t,r):n(t,r,!1);return s.length>0&&(s=t.getDatasetMeta(s[0]._datasetIndex).data),s},"x-axis":function(t,e){return o(t,e,!0)},point:function(t,a){var n=e(a,t.chart);return i(t,n)},nearest:function(t,a,i){var o=e(a,t.chart),r=n(t,o,i.intersect);return r.length>1&&r.sort(function(t,e){var a=t.getArea(),i=e.getArea(),n=a-i;return 0===n&&(n=t._datasetIndex-e._datasetIndex),n}),r.slice(0,1)},x:function(t,i,n){var o=e(i,t.chart),r=[],s=!1;return a(t,function(t){t.inXRange(o.x)&&r.push(t),t.inRange(o.x,o.y)&&(s=!0)}),n.intersect&&!s&&(r=[]),r},y:function(t,i,n){var o=e(i,t.chart),r=[],s=!1;return a(t,function(t){t.inYRange(o.y)&&r.push(t),t.inRange(o.x,o.y)&&(s=!0)}),n.intersect&&!s&&(r=[]),r}}}}},{}],28:[function(t,e,a){"use strict";e.exports=function(){var t=function(e,a){return this.controller=new t.Controller(e,a,this),this.controller};return t.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var a=0;a<t.data.datasets.length;a++)e.push('<li><span style="background-color:'+t.data.datasets[a].backgroundColor+'"></span>'),t.data.datasets[a].label&&e.push(t.data.datasets[a].label),e.push("</li>");return e.push("</ul>"),e.join("")}}},t.Chart=t,t}},{}],29:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),t.boxes.push(e)},removeBox:function(t,e){t.boxes&&t.boxes.splice(t.boxes.indexOf(e),1)},update:function(t,a,i){function n(t){var e,a=t.isHorizontal();a?(e=t.update(t.options.fullWidth?x:C,w),I-=e.height):(e=t.update(M,S),C-=e.width),D.push({horizontal:a,minSize:e,box:t})}function o(t){var a=e.findNextWhere(D,function(e){return e.box===t});if(a)if(t.isHorizontal()){var i={left:Math.max(F,A),right:Math.max(V,T),top:0,bottom:0};t.update(t.options.fullWidth?x:C,y/2,i)}else t.update(a.minSize.width,I)}function r(t){var a=e.findNextWhere(D,function(e){return e.box===t}),i={left:0,right:0,top:R,bottom:O};a&&t.update(a.minSize.width,I,i)}function s(t){t.isHorizontal()?(t.left=t.options.fullWidth?d:F,t.right=t.options.fullWidth?a-c:F+C,t.top=E,t.bottom=E+t.height,E=t.bottom):(t.left=N,t.right=N+t.width,t.top=R,t.bottom=R+I,N=t.right)}if(t){var l=t.options.layout,u=l?l.padding:null,d=0,c=0,h=0,f=0;isNaN(u)?(d=u.left||0,c=u.right||0,h=u.top||0,f=u.bottom||0):(d=u,c=u,h=u,f=u);var g=e.where(t.boxes,function(t){return"left"===t.options.position}),p=e.where(t.boxes,function(t){return"right"===t.options.position}),m=e.where(t.boxes,function(t){return"top"===t.options.position}),v=e.where(t.boxes,function(t){return"bottom"===t.options.position}),b=e.where(t.boxes,function(t){return"chartArea"===t.options.position});m.sort(function(t,e){return(e.options.fullWidth?1:0)-(t.options.fullWidth?1:0)}),v.sort(function(t,e){return(t.options.fullWidth?1:0)-(e.options.fullWidth?1:0)});var x=a-d-c,y=i-h-f,k=x/2,S=y/2,M=(a-k)/(g.length+p.length),w=(i-S)/(m.length+v.length),C=x,I=y,D=[];e.each(g.concat(p,m,v),n);var A=0,T=0,P=0,_=0;e.each(m.concat(v),function(t){if(t.getPadding){var e=t.getPadding();A=Math.max(A,e.left),T=Math.max(T,e.right)}}),e.each(g.concat(p),function(t){if(t.getPadding){var e=t.getPadding();P=Math.max(P,e.top),_=Math.max(_,e.bottom)}});var F=d,V=c,R=h,O=f;e.each(g.concat(p),o),e.each(g,function(t){F+=t.width}),e.each(p,function(t){V+=t.width}),e.each(m.concat(v),o),e.each(m,function(t){R+=t.height}),e.each(v,function(t){O+=t.height}),e.each(g.concat(p),r),F=d,V=c,R=h,O=f,e.each(g,function(t){F+=t.width}),e.each(p,function(t){V+=t.width}),e.each(m,function(t){R+=t.height}),e.each(v,function(t){O+=t.height});var L=Math.max(A-F,0);F+=L,V+=Math.max(T-V,0);var B=Math.max(P-R,0);R+=B,O+=Math.max(_-O,0);var z=i-R-O,W=a-F-V;W===C&&z===I||(e.each(g,function(t){t.height=z}),e.each(p,function(t){t.height=z}),e.each(m,function(t){t.options.fullWidth||(t.width=W)}),e.each(v,function(t){t.options.fullWidth||(t.width=W)}),I=z,C=W);var N=d+L,E=h+B;e.each(g.concat(m),s),N+=C,E+=I,e.each(p,s),e.each(v,s),t.chartArea={left:F,top:R,right:F+C,bottom:R+I},e.each(b,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(C,I)})}}}}},{}],30:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}function a(e,a){var i=new t.Legend({ctx:e.chart.ctx,options:a,chart:e});e.legend=i,t.layoutService.addBox(e,i)}var i=t.helpers,n=i.noop;t.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(t,e){var a=e.datasetIndex,i=this.chart,n=i.getDatasetMeta(a);n.hidden=null===n.hidden?!i.data.datasets[a].hidden:null,i.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return i.isArray(e.datasets)?e.datasets.map(function(e,a){return{text:e.label,fillStyle:i.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(a),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:a}},this):[]}}},t.Legend=t.Element.extend({initialize:function(t){i.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:n,update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:n,beforeSetDimensions:n,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:n,beforeBuildLabels:n,buildLabels:function(){var t=this,e=t.options.labels,a=e.generateLabels.call(t,t.chart);e.filter&&(a=a.filter(function(a){return e.filter(a,t.chart.data)})),t.options.reverse&&a.reverse(),t.legendItems=a},afterBuildLabels:n,beforeFit:n,fit:function(){var a=this,n=a.options,o=n.labels,r=n.display,s=a.ctx,l=t.defaults.global,u=i.getValueOrDefault,d=u(o.fontSize,l.defaultFontSize),c=u(o.fontStyle,l.defaultFontStyle),h=u(o.fontFamily,l.defaultFontFamily),f=i.fontString(d,c,h),g=a.legendHitBoxes=[],p=a.minSize,m=a.isHorizontal();if(m?(p.width=a.maxWidth,p.height=r?10:0):(p.width=r?10:0,p.height=a.maxHeight),r)if(s.font=f,m){var v=a.lineWidths=[0],b=a.legendItems.length?d+o.padding:0;s.textAlign="left",s.textBaseline="top",i.each(a.legendItems,function(t,i){var n=e(o,d),r=n+d/2+s.measureText(t.text).width;v[v.length-1]+r+o.padding>=a.width&&(b+=d+o.padding,v[v.length]=a.left),g[i]={left:0,top:0,width:r,height:d},v[v.length-1]+=r+o.padding}),p.height+=b}else{var x=o.padding,y=a.columnWidths=[],k=o.padding,S=0,M=0,w=d+x;i.each(a.legendItems,function(t,a){var i=e(o,d),n=i+d/2+s.measureText(t.text).width;M+w>p.height&&(k+=S+o.padding,y.push(S),S=0,M=0),S=Math.max(S,n),M+=w,g[a]={left:0,top:0,width:n,height:d}}),k+=S,y.push(S),p.width+=k}a.width=p.width,a.height=p.height},afterFit:n,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var a=this,n=a.options,o=n.labels,r=t.defaults.global,s=r.elements.line,l=a.width,u=a.lineWidths;if(n.display){var d,c=a.ctx,h=i.getValueOrDefault,f=h(o.fontColor,r.defaultFontColor),g=h(o.fontSize,r.defaultFontSize),p=h(o.fontStyle,r.defaultFontStyle),m=h(o.fontFamily,r.defaultFontFamily),v=i.fontString(g,p,m);c.textAlign="left",c.textBaseline="top",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=v;var b=e(o,g),x=a.legendHitBoxes,y=function(e,a,i){if(!(isNaN(b)||b<=0)){c.save(),c.fillStyle=h(i.fillStyle,r.defaultColor),c.lineCap=h(i.lineCap,s.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,s.borderDashOffset),c.lineJoin=h(i.lineJoin,s.borderJoinStyle),c.lineWidth=h(i.lineWidth,s.borderWidth),c.strokeStyle=h(i.strokeStyle,r.defaultColor);var o=0===h(i.lineWidth,s.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,s.borderDash)),n.labels&&n.labels.usePointStyle){var l=g*Math.SQRT2/2,u=l/Math.SQRT2,d=e+u,f=a+u;t.canvasHelpers.drawPoint(c,i.pointStyle,l,d,f)}else o||c.strokeRect(e,a,b,g),c.fillRect(e,a,b,g);c.restore()}},k=function(t,e,a,i){c.fillText(a.text,b+g/2+t,e),a.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(b+g/2+t,e+g/2),c.lineTo(b+g/2+t+i,e+g/2),c.stroke())},S=a.isHorizontal();d=S?{x:a.left+(l-u[0])/2,y:a.top+o.padding,line:0}:{x:a.left+o.padding,y:a.top+o.padding,line:0};var M=g+o.padding;i.each(a.legendItems,function(t,e){var i=c.measureText(t.text).width,n=b+g/2+i,r=d.x,s=d.y;S?r+n>=l&&(s=d.y+=M,d.line++,r=d.x=a.left+(l-u[d.line])/2):s+M>a.bottom&&(r=d.x=r+a.columnWidths[d.line]+o.padding,s=d.y=a.top+o.padding,d.line++),y(r,s,t),x[e].left=r,x[e].top=s,k(r,s,t,i),S?d.x+=n+o.padding:d.y+=M})}},handleEvent:function(t){var e=this,a=e.options,i="mouseup"===t.type?"click":t.type,n=!1;if("mousemove"===i){if(!a.onHover)return}else{if("click"!==i)return;if(!a.onClick)return}var o=t.x,r=t.y;if(o>=e.left&&o<=e.right&&r>=e.top&&r<=e.bottom)for(var s=e.legendHitBoxes,l=0;l<s.length;++l){var u=s[l];if(o>=u.left&&o<=u.left+u.width&&r>=u.top&&r<=u.top+u.height){if("click"===i){a.onClick.call(e,t.native,e.legendItems[l]),n=!0;break}if("mousemove"===i){a.onHover.call(e,t.native,e.legendItems[l]),n=!0;break}}}return n}}),t.plugins.register({beforeInit:function(t){var e=t.options.legend;e&&a(t,e)},beforeUpdate:function(e){var n=e.options.legend;n?(n=i.configMerge(t.defaults.global.legend,n),e.legend?e.legend.options=n:a(e,n)):(t.layoutService.removeBox(e,e.legend),delete e.legend)},afterEvent:function(t,e){var a=t.legend;a&&a.handleEvent(e)}})}},{}],31:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.plugins={},t.plugins={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){e.indexOf(t)===-1&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var a=e.indexOf(t);a!==-1&&e.splice(a,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length;
13
- },getAll:function(){return this._plugins},notify:function(t,e,a){var i,n,o,r,s,l=this.descriptors(t),u=l.length;for(i=0;i<u;++i)if(n=l[i],o=n.plugin,s=o[e],"function"==typeof s&&(r=[t].concat(a||[]),r.push(n.options),s.apply(o,r)===!1))return!1;return!0},descriptors:function(a){var i=a._plugins||(a._plugins={});if(i.id===this._cacheId)return i.descriptors;var n=[],o=[],r=a&&a.config||{},s=t.defaults.global.plugins,l=r.options&&r.options.plugins||{};return this._plugins.concat(r.plugins||[]).forEach(function(t){var a=n.indexOf(t);if(a===-1){var i=t.id,r=l[i];r!==!1&&(r===!0&&(r=e.clone(s[i])),n.push(t),o.push({plugin:t,options:r||{}}))}}),i.descriptors=o,i.id=this._cacheId,o}},t.pluginService=t.plugins,t.PluginBase=e.inherits({})}},{}],32:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e,a){return i.isArray(e)?i.longestText(t,a,e):t.measureText(e).width}function a(e){var a=i.getValueOrDefault,n=t.defaults.global,o=a(e.fontSize,n.defaultFontSize),r=a(e.fontStyle,n.defaultFontStyle),s=a(e.fontFamily,n.defaultFontFamily);return{size:o,style:r,family:s,font:i.fontString(o,r,s)}}var i=t.helpers;t.defaults.scale={display:!0,position:"left",gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{labelString:"",display:!1},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:0,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:t.Ticks.formatters.values}},t.Scale=t.Element.extend({getPadding:function(){var t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}},beforeUpdate:function(){i.callCallback(this.options.beforeUpdate,[this])},update:function(t,e,a){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n.margins=i.extend({left:0,right:0,top:0,bottom:0},a),n.longestTextCache=n.longestTextCache||{},n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeDataLimits(),n.determineDataLimits(),n.afterDataLimits(),n.beforeBuildTicks(),n.buildTicks(),n.afterBuildTicks(),n.beforeTickToLabelConversion(),n.convertTicksToLabels(),n.afterTickToLabelConversion(),n.beforeCalculateTickRotation(),n.calculateTickRotation(),n.afterCalculateTickRotation(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:function(){i.callCallback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){i.callCallback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0},afterSetDimensions:function(){i.callCallback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){i.callCallback(this.options.beforeDataLimits,[this])},determineDataLimits:i.noop,afterDataLimits:function(){i.callCallback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){i.callCallback(this.options.beforeBuildTicks,[this])},buildTicks:i.noop,afterBuildTicks:function(){i.callCallback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){i.callCallback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this,e=t.options.ticks;t.ticks=t.ticks.map(e.userCallback||e.callback)},afterTickToLabelConversion:function(){i.callCallback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){i.callCallback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var t=this,e=t.ctx,n=t.options.ticks,o=a(n);e.font=o.font;var r=n.minRotation||0;if(t.options.display&&t.isHorizontal())for(var s,l,u=i.longestText(e,o.font,t.ticks,t.longestTextCache),d=u,c=t.getPixelForTick(1)-t.getPixelForTick(0)-6;d>c&&r<n.maxRotation;){var h=i.toRadians(r);if(s=Math.cos(h),l=Math.sin(h),l*u>t.maxHeight){r--;break}r++,d=s*u}t.labelRotation=r},afterCalculateTickRotation:function(){i.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){i.callCallback(this.options.beforeFit,[this])},fit:function(){var t=this,n=t.minSize={width:0,height:0},o=t.options,r=o.ticks,s=o.scaleLabel,l=o.gridLines,u=o.display,d=t.isHorizontal(),c=a(r),h=1.5*a(s).size,f=o.gridLines.tickMarkLength;if(d?n.width=t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:n.width=u&&l.drawTicks?f:0,d?n.height=u&&l.drawTicks?f:0:n.height=t.maxHeight,s.display&&u&&(d?n.height+=h:n.width+=h),r.display&&u){var g=i.longestText(t.ctx,c.font,t.ticks,t.longestTextCache),p=i.numberOfLabelLines(t.ticks),m=.5*c.size;if(d){t.longestLabelWidth=g;var v=i.toRadians(t.labelRotation),b=Math.cos(v),x=Math.sin(v),y=x*g+c.size*p+m*p;n.height=Math.min(t.maxHeight,n.height+y),t.ctx.font=c.font;var k=t.ticks[0],S=e(t.ctx,k,c.font),M=t.ticks[t.ticks.length-1],w=e(t.ctx,M,c.font);0!==t.labelRotation?(t.paddingLeft="bottom"===o.position?b*S+3:b*m+3,t.paddingRight="bottom"===o.position?b*m+3:b*w+3):(t.paddingLeft=S/2+3,t.paddingRight=w/2+3)}else r.mirror?g=0:g+=t.options.ticks.padding,n.width+=g,t.paddingTop=c.size/2,t.paddingBottom=c.size/2}t.handleMargins(),t.width=n.width,t.height=n.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){i.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){return null===t||"undefined"==typeof t?NaN:"number"!=typeof t||isFinite(t)?"object"==typeof t?t instanceof Date||t.isValid?t:this.getRightValue(this.isHorizontal()?t.x:t.y):t:NaN},getLabelForIndex:i.noop,getPixelForValue:i.noop,getValueForPixel:i.noop,getPixelForTick:function(t,e){var a=this;if(a.isHorizontal()){var i=a.width-(a.paddingLeft+a.paddingRight),n=i/Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),o=n*t+a.paddingLeft;e&&(o+=n/2);var r=a.left+Math.round(o);return r+=a.isFullWidth()?a.margins.left:0}var s=a.height-(a.paddingTop+a.paddingBottom);return a.top+t*(s/(a.ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var a=e.width-(e.paddingLeft+e.paddingRight),i=a*t+e.paddingLeft,n=e.left+Math.round(i);return n+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,a=t.max;return t.beginAtZero?0:e<0&&a<0?a:e>0&&a>0?e:0},draw:function(e){var n=this,o=n.options;if(o.display){var r,s,l=n.ctx,u=t.defaults.global,d=o.ticks,c=o.gridLines,h=o.scaleLabel,f=0!==n.labelRotation,g=d.autoSkip,p=n.isHorizontal();d.maxTicksLimit&&(s=d.maxTicksLimit);var m=i.getValueOrDefault(d.fontColor,u.defaultFontColor),v=a(d),b=c.drawTicks?c.tickMarkLength:0,x=i.getValueOrDefault(c.borderDash,u.borderDash),y=i.getValueOrDefault(c.borderDashOffset,u.borderDashOffset),k=i.getValueOrDefault(h.fontColor,u.defaultFontColor),S=a(h),M=i.toRadians(n.labelRotation),w=Math.cos(M),C=n.longestLabelWidth*w;l.fillStyle=m;var I=[];if(p){if(r=!1,f&&(C/=2),(C+d.autoSkipPadding)*n.ticks.length>n.width-(n.paddingLeft+n.paddingRight)&&(r=1+Math.floor((C+d.autoSkipPadding)*n.ticks.length/(n.width-(n.paddingLeft+n.paddingRight)))),s&&n.ticks.length>s)for(;!r||n.ticks.length/(r||1)>s;)r||(r=1),r+=1;g||(r=!1)}var D="right"===o.position?n.left:n.right-b,A="right"===o.position?n.left+b:n.right,T="bottom"===o.position?n.top:n.bottom-b,P="bottom"===o.position?n.top+b:n.bottom;if(i.each(n.ticks,function(t,a){if(void 0!==t&&null!==t){var s=n.ticks.length===a+1,l=r>1&&a%r>0||a%r===0&&a+r>=n.ticks.length;if((!l||s)&&void 0!==t&&null!==t){var u,h;a===("undefined"!=typeof n.zeroLineIndex?n.zeroLineIndex:0)?(u=c.zeroLineWidth,h=c.zeroLineColor):(u=i.getValueAtIndexOrDefault(c.lineWidth,a),h=i.getValueAtIndexOrDefault(c.color,a));var g,m,v,k,S,w,C,_,F,V,R="middle",O="middle";if(p){"bottom"===o.position?(O=f?"middle":"top",R=f?"right":"center",V=n.top+b):(O=f?"middle":"bottom",R=f?"left":"center",V=n.bottom-b);var L=n.getPixelForTick(a)+i.aliasPixel(u);F=n.getPixelForTick(a,c.offsetGridLines)+d.labelOffset,g=v=S=C=L,m=T,k=P,w=e.top,_=e.bottom}else{var B,z="left"===o.position,W=d.padding;d.mirror?(R=z?"left":"right",B=W):(R=z?"right":"left",B=b+W),F=z?n.right-B:n.left+B;var N=n.getPixelForTick(a);N+=i.aliasPixel(u),V=n.getPixelForTick(a,c.offsetGridLines),g=D,v=A,S=e.left,C=e.right,m=k=w=_=N}I.push({tx1:g,ty1:m,tx2:v,ty2:k,x1:S,y1:w,x2:C,y2:_,labelX:F,labelY:V,glWidth:u,glColor:h,glBorderDash:x,glBorderDashOffset:y,rotation:-1*M,label:t,textBaseline:O,textAlign:R})}}}),i.each(I,function(t){if(c.display&&(l.save(),l.lineWidth=t.glWidth,l.strokeStyle=t.glColor,l.setLineDash&&(l.setLineDash(t.glBorderDash),l.lineDashOffset=t.glBorderDashOffset),l.beginPath(),c.drawTicks&&(l.moveTo(t.tx1,t.ty1),l.lineTo(t.tx2,t.ty2)),c.drawOnChartArea&&(l.moveTo(t.x1,t.y1),l.lineTo(t.x2,t.y2)),l.stroke(),l.restore()),d.display){l.save(),l.translate(t.labelX,t.labelY),l.rotate(t.rotation),l.font=v.font,l.textBaseline=t.textBaseline,l.textAlign=t.textAlign;var e=t.label;if(i.isArray(e))for(var a=0,n=0;a<e.length;++a)l.fillText(""+e[a],0,n),n+=1.5*v.size;else l.fillText(e,0,0);l.restore()}}),h.display){var _,F,V=0;if(p)_=n.left+(n.right-n.left)/2,F="bottom"===o.position?n.bottom-S.size/2:n.top+S.size/2;else{var R="left"===o.position;_=R?n.left+S.size/2:n.right-S.size/2,F=n.top+(n.bottom-n.top)/2,V=R?-.5*Math.PI:.5*Math.PI}l.save(),l.translate(_,F),l.rotate(V),l.textAlign="center",l.textBaseline="middle",l.fillStyle=k,l.font=S.font,l.fillText(h.labelString,0,0),l.restore()}if(c.drawBorder){l.lineWidth=i.getValueAtIndexOrDefault(c.lineWidth,0),l.strokeStyle=i.getValueAtIndexOrDefault(c.color,0);var O=n.left,L=n.right,B=n.top,z=n.bottom,W=i.aliasPixel(l.lineWidth);p?(B=z="top"===o.position?n.bottom:n.top,B+=W,z+=W):(O=L="left"===o.position?n.right:n.left,O+=W,L+=W),l.beginPath(),l.moveTo(O,B),l.lineTo(L,z),l.stroke()}}}})}},{}],33:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.scaleService={constructors:{},defaults:{},registerScaleType:function(t,a,i){this.constructors[t]=a,this.defaults[t]=e.clone(i)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(a){return this.defaults.hasOwnProperty(a)?e.scaleMerge(t.defaults.scale,this.defaults[a]):{}},updateScaleDefaults:function(t,a){var i=this.defaults;i.hasOwnProperty(t)&&(i[t]=e.extend(i[t],a))},addScalesToLayout:function(a){e.each(a.scales,function(e){t.layoutService.addBox(a,e)})}}}},{}],34:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.Ticks={generators:{linear:function(t,a){var i,n=[];if(t.stepSize&&t.stepSize>0)i=t.stepSize;else{var o=e.niceNum(a.max-a.min,!1);i=e.niceNum(o/(t.maxTicks-1),!0)}var r=Math.floor(a.min/i)*i,s=Math.ceil(a.max/i)*i;t.min&&t.max&&t.stepSize&&e.almostWhole((t.max-t.min)/t.stepSize,i/1e3)&&(r=t.min,s=t.max);var l=(s-r)/i;l=e.almostEquals(l,Math.round(l),i/1e3)?Math.round(l):Math.ceil(l),n.push(void 0!==t.min?t.min:r);for(var u=1;u<l;++u)n.push(r+u*i);return n.push(void 0!==t.max?t.max:s),n},logarithmic:function(t,a){var i,n,o=[],r=e.getValueOrDefault,s=r(t.min,Math.pow(10,Math.floor(e.log10(a.min)))),l=Math.floor(e.log10(a.max)),u=Math.ceil(a.max/Math.pow(10,l));0===s?(i=Math.floor(e.log10(a.minNotZero)),n=Math.floor(a.minNotZero/Math.pow(10,i)),o.push(s),s=n*Math.pow(10,i)):(i=Math.floor(e.log10(s)),n=Math.floor(s/Math.pow(10,i)));do o.push(s),++n,10===n&&(n=1,++i),s=n*Math.pow(10,i);while(i<l||i===l&&n<u);var d=r(t.max,s);return o.push(d),o}},formatters:{values:function(t){return e.isArray(t)?t:""+t},linear:function(t,a,i){var n=i.length>3?i[2]-i[1]:i[1]-i[0];Math.abs(n)>1&&t!==Math.floor(t)&&(n=t-Math.floor(t));var o=e.log10(Math.abs(n)),r="";if(0!==t){var s=-1*Math.floor(o);s=Math.max(Math.min(s,20),0),r=t.toFixed(s)}else r="0";return r},logarithmic:function(t,a,i){var n=t/Math.pow(10,Math.floor(e.log10(t)));return 0===t?"0":1===n||2===n||5===n||0===a||a===i.length-1?t.toExponential():""}}}}},{}],35:[function(t,e,a){"use strict";e.exports=function(t){function e(e,a){var i=new t.Title({ctx:e.chart.ctx,options:a,chart:e});e.titleBlock=i,t.layoutService.addBox(e,i)}var a=t.helpers;t.defaults.global.title={display:!1,position:"top",fullWidth:!0,fontStyle:"bold",padding:10,text:""};var i=a.noop;t.Title=t.Element.extend({initialize:function(t){var e=this;a.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:i,update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:i,beforeSetDimensions:i,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:i,beforeBuildLabels:i,buildLabels:i,afterBuildLabels:i,beforeFit:i,fit:function(){var e=this,i=a.getValueOrDefault,n=e.options,o=t.defaults.global,r=n.display,s=i(n.fontSize,o.defaultFontSize),l=e.minSize;e.isHorizontal()?(l.width=e.maxWidth,l.height=r?s+2*n.padding:0):(l.width=r?s+2*n.padding:0,l.height=e.maxHeight),e.width=l.width,e.height=l.height},afterFit:i,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var e=this,i=e.ctx,n=a.getValueOrDefault,o=e.options,r=t.defaults.global;if(o.display){var s,l,u,d=n(o.fontSize,r.defaultFontSize),c=n(o.fontStyle,r.defaultFontStyle),h=n(o.fontFamily,r.defaultFontFamily),f=a.fontString(d,c,h),g=0,p=e.top,m=e.left,v=e.bottom,b=e.right;i.fillStyle=n(o.fontColor,r.defaultFontColor),i.font=f,e.isHorizontal()?(s=m+(b-m)/2,l=p+(v-p)/2,u=b-m):(s="left"===o.position?m+d/2:b-d/2,l=p+(v-p)/2,u=v-p,g=Math.PI*("left"===o.position?-.5:.5)),i.save(),i.translate(s,l),i.rotate(g),i.textAlign="center",i.textBaseline="middle",i.fillText(o.text,0,0,u),i.restore()}}}),t.plugins.register({beforeInit:function(t){var a=t.options.title;a&&e(t,a)},beforeUpdate:function(i){var n=i.options.title;n?(n=a.configMerge(t.defaults.global.title,n),i.titleBlock?i.titleBlock.options=n:e(i,n)):(t.layoutService.removeBox(i,i.titleBlock),delete i.titleBlock)}})}},{}],36:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=l.color(t);return a.alpha(e*a.alpha()).rgbaString()}function a(t,e){return e&&(l.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function i(t){var e=t._xScale,a=t._yScale||t._scale,i=t._index,n=t._datasetIndex;return{xLabel:e?e.getLabelForIndex(i,n):"",yLabel:a?a.getLabelForIndex(i,n):"",index:i,datasetIndex:n,x:t._model.x,y:t._model.y}}function n(e){var a=t.defaults.global,i=l.getValueOrDefault;return{xPadding:e.xPadding,yPadding:e.yPadding,xAlign:e.xAlign,yAlign:e.yAlign,bodyFontColor:e.bodyFontColor,_bodyFontFamily:i(e.bodyFontFamily,a.defaultFontFamily),_bodyFontStyle:i(e.bodyFontStyle,a.defaultFontStyle),_bodyAlign:e.bodyAlign,bodyFontSize:i(e.bodyFontSize,a.defaultFontSize),bodySpacing:e.bodySpacing,titleFontColor:e.titleFontColor,_titleFontFamily:i(e.titleFontFamily,a.defaultFontFamily),_titleFontStyle:i(e.titleFontStyle,a.defaultFontStyle),titleFontSize:i(e.titleFontSize,a.defaultFontSize),_titleAlign:e.titleAlign,titleSpacing:e.titleSpacing,titleMarginBottom:e.titleMarginBottom,footerFontColor:e.footerFontColor,_footerFontFamily:i(e.footerFontFamily,a.defaultFontFamily),_footerFontStyle:i(e.footerFontStyle,a.defaultFontStyle),footerFontSize:i(e.footerFontSize,a.defaultFontSize),_footerAlign:e.footerAlign,footerSpacing:e.footerSpacing,footerMarginTop:e.footerMarginTop,caretSize:e.caretSize,cornerRadius:e.cornerRadius,backgroundColor:e.backgroundColor,opacity:0,legendColorBackground:e.multiKeyBackground,displayColors:e.displayColors}}function o(t,e){var a=t._chart.ctx,i=2*e.yPadding,n=0,o=e.body,r=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);r+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,u=e.footer.length,d=e.titleFontSize,c=e.bodyFontSize,h=e.footerFontSize;i+=s*d,i+=s?(s-1)*e.titleSpacing:0,i+=s?e.titleMarginBottom:0,i+=r*c,i+=r?(r-1)*e.bodySpacing:0,i+=u?e.footerMarginTop:0,i+=u*h,i+=u?(u-1)*e.footerSpacing:0;var f=0,g=function(t){n=Math.max(n,a.measureText(t).width+f)};return a.font=l.fontString(d,e._titleFontStyle,e._titleFontFamily),l.each(e.title,g),a.font=l.fontString(c,e._bodyFontStyle,e._bodyFontFamily),l.each(e.beforeBody.concat(e.afterBody),g),f=e.displayColors?c+2:0,l.each(o,function(t){l.each(t.before,g),l.each(t.lines,g),l.each(t.after,g)}),f=0,a.font=l.fontString(h,e._footerFontStyle,e._footerFontFamily),l.each(e.footer,g),n+=2*e.xPadding,{width:n,height:i}}function r(t,e){var a=t._model,i=t._chart,n=t._chartInstance.chartArea,o="center",r="center";a.y<e.height?r="top":a.y>i.height-e.height&&(r="bottom");var s,l,u,d,c,h=(n.left+n.right)/2,f=(n.top+n.bottom)/2;"center"===r?(s=function(t){return t<=h},l=function(t){return t>h}):(s=function(t){return t<=e.width/2},l=function(t){return t>=i.width-e.width/2}),u=function(t){return t+e.width>i.width},d=function(t){return t-e.width<0},c=function(t){return t<=f?"top":"bottom"},s(a.x)?(o="left",u(a.x)&&(o="center",r=c(a.y))):l(a.x)&&(o="right",d(a.x)&&(o="center",r=c(a.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:o,yAlign:g.yAlign?g.yAlign:r}}function s(t,e,a){var i=t.x,n=t.y,o=t.caretSize,r=t.caretPadding,s=t.cornerRadius,l=a.xAlign,u=a.yAlign,d=o+r,c=s+r;return"right"===l?i-=e.width:"center"===l&&(i-=e.width/2),"top"===u?n+=d:n-="bottom"===u?e.height+d:e.height/2,"center"===u?"left"===l?i+=d:"right"===l&&(i-=d):"left"===l?i-=c:"right"===l&&(i+=c),{x:i,y:n}}var l=t.helpers;t.defaults.global.tooltips={enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,callbacks:{beforeTitle:l.noop,title:function(t,e){var a="",i=e.labels,n=i?i.length:0;if(t.length>0){var o=t[0];o.xLabel?a=o.xLabel:n>0&&o.index<n&&(a=i[o.index])}return a},afterTitle:l.noop,beforeBody:l.noop,beforeLabel:l.noop,label:function(t,e){var a=e.datasets[t.datasetIndex].label||"";return a+": "+t.yLabel},labelColor:function(t,e){var a=e.getDatasetMeta(t.datasetIndex),i=a.data[t.index],n=i._view;return{borderColor:n.borderColor,backgroundColor:n.backgroundColor}},afterLabel:l.noop,afterBody:l.noop,beforeFooter:l.noop,footer:l.noop,afterFooter:l.noop}},t.Tooltip=t.Element.extend({initialize:function(){this._model=n(this._options)},getTitle:function(){var t=this,e=t._options,i=e.callbacks,n=i.beforeTitle.apply(t,arguments),o=i.title.apply(t,arguments),r=i.afterTitle.apply(t,arguments),s=[];return s=a(s,n),s=a(s,o),s=a(s,r)},getBeforeBody:function(){var t=this._options.callbacks.beforeBody.apply(this,arguments);return l.isArray(t)?t:void 0!==t?[t]:[]},getBody:function(t,e){var i=this,n=i._options.callbacks,o=[];return l.each(t,function(t){var r={before:[],lines:[],after:[]};a(r.before,n.beforeLabel.call(i,t,e)),a(r.lines,n.label.call(i,t,e)),a(r.after,n.afterLabel.call(i,t,e)),o.push(r)}),o},getAfterBody:function(){var t=this._options.callbacks.afterBody.apply(this,arguments);return l.isArray(t)?t:void 0!==t?[t]:[]},getFooter:function(){var t=this,e=t._options.callbacks,i=e.beforeFooter.apply(t,arguments),n=e.footer.apply(t,arguments),o=e.afterFooter.apply(t,arguments),r=[];return r=a(r,i),r=a(r,n),r=a(r,o)},update:function(e){var a,u,d=this,c=d._options,h=d._model,f=d._model=n(c),g=d._active,p=d._data,m=d._chartInstance,v={xAlign:h.xAlign,yAlign:h.yAlign},b={x:h.x,y:h.y},x={width:h.width,height:h.height},y={x:h.caretX,y:h.caretY};if(g.length){f.opacity=1;var k=[];y=t.Tooltip.positioners[c.position](g,d._eventPosition);var S=[];for(a=0,u=g.length;a<u;++a)S.push(i(g[a]));c.filter&&(S=S.filter(function(t){return c.filter(t,p)})),c.itemSort&&(S=S.sort(function(t,e){return c.itemSort(t,e,p)})),l.each(S,function(t){k.push(c.callbacks.labelColor.call(d,t,m))}),f.title=d.getTitle(S,p),f.beforeBody=d.getBeforeBody(S,p),f.body=d.getBody(S,p),f.afterBody=d.getAfterBody(S,p),f.footer=d.getFooter(S,p),f.x=Math.round(y.x),f.y=Math.round(y.y),f.caretPadding=l.getValueOrDefault(y.padding,2),f.labelColors=k,f.dataPoints=S,x=o(this,f),v=r(this,x),b=s(f,x,v)}else f.opacity=0;return f.xAlign=v.xAlign,f.yAlign=v.yAlign,f.x=b.x,f.y=b.y,f.width=x.width,f.height=x.height,f.caretX=y.x,f.caretY=y.y,d._model=f,e&&c.custom&&c.custom.call(d,f),d},drawCaret:function(t,a,i){var n,o,r,s,l,u,d=this._view,c=this._chart.ctx,h=d.caretSize,f=d.cornerRadius,g=d.xAlign,p=d.yAlign,m=t.x,v=t.y,b=a.width,x=a.height;"center"===p?("left"===g?(n=m,o=n-h,r=n):(n=m+b,o=n+h,r=n),l=v+x/2,s=l-h,u=l+h):("left"===g?(n=m+f,o=n+h,r=o+h):"right"===g?(n=m+b-f,o=n-h,r=o-h):(o=m+b/2,n=o-h,r=o+h),"top"===p?(s=v,l=s-h,u=s):(s=v+x,l=s+h,u=s)),c.fillStyle=e(d.backgroundColor,i),c.beginPath(),c.moveTo(n,s),c.lineTo(o,l),c.lineTo(r,u),c.closePath(),c.fill()},drawTitle:function(t,a,i,n){var o=a.title;if(o.length){i.textAlign=a._titleAlign,i.textBaseline="top";var r=a.titleFontSize,s=a.titleSpacing;i.fillStyle=e(a.titleFontColor,n),i.font=l.fontString(r,a._titleFontStyle,a._titleFontFamily);var u,d;for(u=0,d=o.length;u<d;++u)i.fillText(o[u],t.x,t.y),t.y+=r+s,u+1===o.length&&(t.y+=a.titleMarginBottom-s)}},drawBody:function(t,a,i,n){var o=a.bodyFontSize,r=a.bodySpacing,s=a.body;i.textAlign=a._bodyAlign,i.textBaseline="top";var u=e(a.bodyFontColor,n);i.fillStyle=u,i.font=l.fontString(o,a._bodyFontStyle,a._bodyFontFamily);var d=0,c=function(e){i.fillText(e,t.x+d,t.y),t.y+=o+r};l.each(a.beforeBody,c);var h=a.displayColors;d=h?o+2:0,l.each(s,function(r,s){l.each(r.before,c),l.each(r.lines,function(r){h&&(i.fillStyle=e(a.legendColorBackground,n),i.fillRect(t.x,t.y,o,o),i.strokeStyle=e(a.labelColors[s].borderColor,n),i.strokeRect(t.x,t.y,o,o),i.fillStyle=e(a.labelColors[s].backgroundColor,n),i.fillRect(t.x+1,t.y+1,o-2,o-2),i.fillStyle=u),c(r)}),l.each(r.after,c)}),d=0,l.each(a.afterBody,c),t.y-=r},drawFooter:function(t,a,i,n){var o=a.footer;o.length&&(t.y+=a.footerMarginTop,i.textAlign=a._footerAlign,i.textBaseline="top",i.fillStyle=e(a.footerFontColor,n),i.font=l.fontString(a.footerFontSize,a._footerFontStyle,a._footerFontFamily),l.each(o,function(e){i.fillText(e,t.x,t.y),t.y+=a.footerFontSize+a.footerSpacing}))},drawBackground:function(t,a,i,n,o){i.fillStyle=e(a.backgroundColor,o),l.drawRoundedRectangle(i,t.x,t.y,n.width,n.height,a.cornerRadius),i.fill()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var a={width:e.width,height:e.height},i={x:e.x,y:e.y},n=Math.abs(e.opacity<.001)?0:e.opacity;this._options.enabled&&(this.drawBackground(i,e,t,a,n),this.drawCaret(i,a,n),i.x+=e.xPadding,i.y+=e.yPadding,this.drawTitle(i,e,t,n),this.drawBody(i,e,t,n),this.drawFooter(i,e,t,n))}},handleEvent:function(t){var e=this,a=e._options,i=!1;if(e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:e._active=e._chartInstance.getElementsAtEventForMode(t,a.mode,a),i=!l.arrayEquals(e._active,e._lastActive),e._lastActive=e._active,a.enabled||a.custom){e._eventPosition={x:t.x,y:t.y};var n=e._model;e.update(!0),e.pivot(),i|=n.x!==e._model.x||n.y!==e._model.y}return i}}),t.Tooltip.positioners={average:function(t){if(!t.length)return!1;var e,a,i=0,n=0,o=0;for(e=0,a=t.length;e<a;++e){var r=t[e];if(r&&r.hasValue()){var s=r.tooltipPosition();i+=s.x,n+=s.y,++o}}return{x:Math.round(i/o),y:Math.round(n/o)}},nearest:function(t,e){var a,i,n,o=e.x,r=e.y,s=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){var u=t[i];if(u&&u.hasValue()){var d=u.getCenterPoint(),c=l.distanceBetweenPoints(e,d);c<s&&(s=c,a=u)}}if(a){var h=a.tooltipPosition();o=h.x,r=h.y}return{x:o,y:r}}}}},{}],37:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global;a.elements.arc={backgroundColor:a.defaultColor,borderColor:"#fff",borderWidth:2},t.elements.Arc=t.Element.extend({inLabelRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2)},inRange:function(t,a){var i=this._view;if(i){for(var n=e.getAngleFromPoint(i,{x:t,y:a}),o=n.angle,r=n.distance,s=i.startAngle,l=i.endAngle;l<s;)l+=2*Math.PI;for(;o>l;)o-=2*Math.PI;for(;o<s;)o+=2*Math.PI;var u=o>=s&&o<=l,d=r>=i.innerRadius&&r<=i.outerRadius;return u&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,a=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,a=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},draw:function(){var t=this._chart.ctx,e=this._view,a=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,a,i),t.arc(e.x,e.y,e.innerRadius,i,a,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})}},{}],38:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global;t.defaults.global.elements.line={tension:.4,backgroundColor:a.defaultColor,borderWidth:3,borderColor:a.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0},t.elements.Line=t.Element.extend({draw:function(){function t(t,e){var a=e._view;e._view.steppedLine===!0?(l.lineTo(a.x,t._view.y),l.lineTo(a.x,a.y)):0===e._view.tension?l.lineTo(a.x,a.y):l.bezierCurveTo(t._view.controlPointNextX,t._view.controlPointNextY,a.controlPointPreviousX,a.controlPointPreviousY,a.x,a.y)}var i=this,n=i._view,o=n.spanGaps,r=n.scaleZero,s=i._loop;s||("top"===n.fill?r=n.scaleTop:"bottom"===n.fill&&(r=n.scaleBottom));var l=i._chart.ctx;l.save();var u=i._children.slice(),d=-1;s&&u.length&&u.push(u[0]);var c,h,f,g;if(u.length&&n.fill){for(l.beginPath(),c=0;c<u.length;++c)h=u[c],f=e.previousItem(u,c),g=h._view,0===c?(s?l.moveTo(r.x,r.y):l.moveTo(g.x,r),g.skip||(d=c,l.lineTo(g.x,g.y))):(f=d===-1?f:u[d],g.skip?o||d!==c-1||(s?l.lineTo(r.x,r.y):l.lineTo(f._view.x,r)):(d!==c-1?o&&d!==-1?t(f,h):s?l.lineTo(g.x,g.y):(l.lineTo(g.x,r),l.lineTo(g.x,g.y)):t(f,h),d=c));s||d===-1||l.lineTo(u[d]._view.x,r),l.fillStyle=n.backgroundColor||a.defaultColor,l.closePath(),l.fill()}var p=a.elements.line;for(l.lineCap=n.borderCapStyle||p.borderCapStyle,l.setLineDash&&l.setLineDash(n.borderDash||p.borderDash),l.lineDashOffset=n.borderDashOffset||p.borderDashOffset,l.lineJoin=n.borderJoinStyle||p.borderJoinStyle,l.lineWidth=n.borderWidth||p.borderWidth,l.strokeStyle=n.borderColor||a.defaultColor,l.beginPath(),d=-1,c=0;c<u.length;++c)h=u[c],f=e.previousItem(u,c),g=h._view,0===c?g.skip||(l.moveTo(g.x,g.y),d=c):(f=d===-1?f:u[d],g.skip||(d!==c-1&&!o||d===-1?l.moveTo(g.x,g.y):t(f,h),d=c));l.stroke(),l.restore()}})}},{}],39:[function(t,e,a){"use strict";e.exports=function(t){function e(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hitRadius,2)}function a(t){var e=this._view;return!!e&&Math.pow(t-e.y,2)<Math.pow(e.radius+e.hitRadius,2)}var i=t.helpers,n=t.defaults.global,o=n.defaultColor;n.elements.point={radius:3,pointStyle:"circle",backgroundColor:o,borderWidth:1,borderColor:o,hitRadius:1,hoverRadius:4,hoverBorderWidth:1},t.elements.Point=t.Element.extend({inRange:function(t,e){var a=this._view;return!!a&&Math.pow(t-a.x,2)+Math.pow(e-a.y,2)<Math.pow(a.hitRadius+a.radius,2)},inLabelRange:e,inXRange:e,inYRange:a,getCenterPoint:function(){var t=this._view;return{x:t.x,y:t.y}},getArea:function(){return Math.PI*Math.pow(this._view.radius,2)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y,padding:t.radius+t.borderWidth}},draw:function(e){var a=this._view,r=this._model,s=this._chart.ctx,l=a.pointStyle,u=a.radius,d=a.x,c=a.y,h=t.helpers.color,f=1.01,g=0;a.skip||(s.strokeStyle=a.borderColor||o,s.lineWidth=i.getValueOrDefault(a.borderWidth,n.elements.point.borderWidth),s.fillStyle=a.backgroundColor||o,void 0!==e&&(r.x<e.left||e.right*f<r.x||r.y<e.top||e.bottom*f<r.y)&&(r.x<e.left?g=(d-r.x)/(e.left-r.x):e.right*f<r.x?g=(r.x-d)/(r.x-e.right):r.y<e.top?g=(c-r.y)/(e.top-r.y):e.bottom*f<r.y&&(g=(r.y-c)/(r.y-e.bottom)),g=Math.round(100*g)/100,s.strokeStyle=h(s.strokeStyle).alpha(g).rgbString(),s.fillStyle=h(s.fillStyle).alpha(g).rgbString()),t.canvasHelpers.drawPoint(s,l,u,d,c))}})}},{}],40:[function(t,e,a){"use strict";e.exports=function(t){function e(t){return void 0!==t._view.width}function a(t){var a,i,n,o,r=t._view;if(e(t)){var s=r.width/2;a=r.x-s,i=r.x+s,n=Math.min(r.y,r.base),o=Math.max(r.y,r.base)}else{var l=r.height/2;a=Math.min(r.x,r.base),i=Math.max(r.x,r.base),n=r.y-l,o=r.y+l}return{left:a,top:n,right:i,bottom:o}}var i=t.defaults.global;i.elements.rectangle={backgroundColor:i.defaultColor,borderWidth:0,borderColor:i.defaultColor,borderSkipped:"bottom"},t.elements.Rectangle=t.Element.extend({draw:function(){function t(t){return v[(x+t)%4]}var e,a,i,n,o,r,s,l=this._chart.ctx,u=this._view,d=u.borderWidth;if(u.horizontal?(e=u.base,a=u.x,i=u.y-u.height/2,n=u.y+u.height/2,o=a>e?1:-1,r=1,s=u.borderSkipped||"left"):(e=u.x-u.width/2,a=u.x+u.width/2,i=u.y,n=u.base,o=1,r=n>i?1:-1,s=u.borderSkipped||"bottom"),d){var c=Math.min(Math.abs(e-a),Math.abs(i-n));d=d>c?c:d;var h=d/2,f=e+("left"!==s?h*o:0),g=a+("right"!==s?-h*o:0),p=i+("top"!==s?h*r:0),m=n+("bottom"!==s?-h*r:0);f!==g&&(i=p,n=m),p!==m&&(e=f,a=g)}l.beginPath(),l.fillStyle=u.backgroundColor,l.strokeStyle=u.borderColor,l.lineWidth=d;var v=[[e,n],[e,i],[a,i],[a,n]],b=["bottom","left","top","right"],x=b.indexOf(s,0);x===-1&&(x=0);var y=t(0);l.moveTo(y[0],y[1]);for(var k=1;k<4;k++)y=t(k),l.lineTo(y[0],y[1]);l.fill(),d&&l.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var i=!1;if(this._view){var n=a(this);i=t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}return i},inLabelRange:function(t,i){var n=this;if(!n._view)return!1;var o=!1,r=a(n);return o=e(n)?t>=r.left&&t<=r.right:i>=r.top&&i<=r.bottom},inXRange:function(t){var e=a(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=a(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,a,i=this._view;return e(this)?(t=i.x,a=(i.y+i.base)/2):(t=(i.x+i.base)/2,a=i.y),{x:t,y:a}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})}},{}],41:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=l.getStyle(t,e),i=a&&a.match(/(\d+)px/);return i?Number(i[1]):void 0}function a(t,a){var i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t._chartjs={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",null===o||""===o){var r=e(t,"width");void 0!==r&&(t.width=r)}if(null===n||""===n)if(""===t.style.height)t.height=t.width/(a.options.aspectRatio||2);else{var s=e(t,"height");void 0!==r&&(t.height=s)}return t}function i(t,e,a,i,n){return{type:t,chart:e,native:n||null,x:void 0!==a?a:null,y:void 0!==i?i:null}}function n(t,e){
14
  var a=u[t.type]||t.type,n=l.getRelativePosition(t,e);return i(a,e,n.x,n.y,t)}function o(t){var e=document.createElement("iframe");return e.className="chartjs-hidden-iframe",e.style.cssText="display:block;overflow:hidden;border:0;margin:0;top:0;left:0;bottom:0;right:0;height:100%;width:100%;position:absolute;pointer-events:none;z-index:-1;",e.tabIndex=-1,l.addEvent(e,"load",function(){l.addEvent(e.contentWindow||e,"resize",t),t()}),e}function r(t,e,a){var n=t._chartjs={ticking:!1},r=function(){n.ticking||(n.ticking=!0,l.requestAnimFrame.call(window,function(){if(n.resizer)return n.ticking=!1,e(i("resize",a))}))};n.resizer=o(r),t.insertBefore(n.resizer,t.firstChild)}function s(t){if(t&&t._chartjs){var e=t._chartjs.resizer;e&&(e.parentNode.removeChild(e),t._chartjs.resizer=null),delete t._chartjs}}var l=t.helpers,u={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};return{acquireContext:function(t,e){if("string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t instanceof HTMLCanvasElement){var i=t.getContext&&t.getContext("2d");if(i instanceof CanvasRenderingContext2D)return a(t,e),i}return null},releaseContext:function(t){var e=t.canvas;if(e._chartjs){var a=e._chartjs.initial;["height","width"].forEach(function(t){var i=a[t];void 0===i||null===i?e.removeAttribute(t):e.setAttribute(t,i)}),l.each(a.style||{},function(t,a){e.style[a]=t}),e.width=e.width,delete e._chartjs}},addEventListener:function(t,e,a){var i=t.chart.canvas;if("resize"===e)return void r(i.parentNode,a,t.chart);var o=a._chartjs||(a._chartjs={}),s=o.proxies||(o.proxies={}),u=s[t.id+"_"+e]=function(e){a(n(e,t.chart))};l.addEvent(i,e,u)},removeEventListener:function(t,e,a){var i=t.chart.canvas;if("resize"===e)return void s(i.parentNode,a);var n=a._chartjs||{},o=n.proxies||{},r=o[t.id+"_"+e];r&&l.removeEvent(i,e,r)}}}},{}],42:[function(t,e,a){"use strict";var i=t(41);e.exports=function(t){t.platform={acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},t.helpers.extend(t.platform,i(t))}},{41:41}],43:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"bottom"},i=t.Scale.extend({getLabels:function(){var t=this.chart.data;return(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,a=t.getLabels();t.minIndex=0,t.maxIndex=a.length-1;var i;void 0!==t.options.ticks.min&&(i=e.indexOf(a,t.options.ticks.min),t.minIndex=i!==-1?i:t.minIndex),void 0!==t.options.ticks.max&&(i=e.indexOf(a,t.options.ticks.max),t.maxIndex=i!==-1?i:t.maxIndex),t.min=a[t.minIndex],t.max=a[t.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var a=this,i=a.chart.data,n=a.isHorizontal();return i.yLabels&&!n?a.getRightValue(i.datasets[e].data[t]):a.ticks[t-a.minIndex]},getPixelForValue:function(t,e,a,i){var n=this,o=Math.max(n.maxIndex+1-n.minIndex-(n.options.gridLines.offsetGridLines?0:1),1);if(void 0!==t&&isNaN(e)){var r=n.getLabels(),s=r.indexOf(t);e=s!==-1?s:e}if(n.isHorizontal()){var l=n.width/o,u=l*(e-n.minIndex);return(n.options.gridLines.offsetGridLines&&i||n.maxIndex===n.minIndex&&i)&&(u+=l/2),n.left+Math.round(u)}var d=n.height/o,c=d*(e-n.minIndex);return n.options.gridLines.offsetGridLines&&i&&(c+=d/2),n.top+Math.round(c)},getPixelForTick:function(t,e){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null,e)},getValueForPixel:function(t){var e,a=this,i=Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),n=a.isHorizontal(),o=(n?a.width:a.height)/i;return t-=n?a.left:a.top,a.options.gridLines.offsetGridLines&&(t-=o/2),e=t<=0?0:Math.round(t/o)},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",i,a)}},{}],44:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.linear}},i=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return s?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=a.chart,o=n.data,r=o.datasets,s=a.isHorizontal();a.min=null,a.max=null;var l=i.stacked;if(void 0===l&&e.each(r,function(e,a){if(!l){var i=n.getDatasetMeta(a);n.isDatasetVisible(a)&&t(i)&&void 0!==i.stack&&(l=!0)}}),i.stacked||l){var u={};e.each(r,function(o,r){var s=n.getDatasetMeta(r),l=[s.type,void 0===i.stacked&&void 0===s.stack?r:"",s.stack].join(".");void 0===u[l]&&(u[l]={positiveValues:[],negativeValues:[]});var d=u[l].positiveValues,c=u[l].negativeValues;n.isDatasetVisible(r)&&t(s)&&e.each(o.data,function(t,e){var n=+a.getRightValue(t);isNaN(n)||s.data[e].hidden||(d[e]=d[e]||0,c[e]=c[e]||0,i.relativePoints?d[e]=100:n<0?c[e]+=n:d[e]+=n)})}),e.each(u,function(t){var i=t.positiveValues.concat(t.negativeValues),n=e.min(i),o=e.max(i);a.min=null===a.min?n:Math.min(a.min,n),a.max=null===a.max?o:Math.max(a.max,o)})}else e.each(r,function(i,o){var r=n.getDatasetMeta(o);n.isDatasetVisible(o)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:i<a.min&&(a.min=i),null===a.max?a.max=i:i>a.max&&(a.max=i))})});this.handleTickRangeOptions()},getTickLimit:function(){var a,i=this,n=i.options.ticks;if(i.isHorizontal())a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.width/50));else{var o=e.getValueOrDefault(n.fontSize,t.defaults.global.defaultFontSize);a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.height/(2*o)))}return a},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,a=this,i=a.start,n=+a.getRightValue(t),o=a.end-i;return a.isHorizontal()?(e=a.left+a.width/o*(n-i),Math.round(e)):(e=a.bottom-a.height/o*(n-i),Math.round(e))},getValueForPixel:function(t){var e=this,a=e.isHorizontal(),i=a?e.width:e.height,n=(a?t-e.left:e.bottom-t)/i;return e.start+(e.end-e.start)*n},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",i,a)}},{}],45:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=e.noop;t.LinearScaleBase=t.Scale.extend({handleTickRangeOptions:function(){var t=this,a=t.options,i=a.ticks;if(i.beginAtZero){var n=e.sign(t.min),o=e.sign(t.max);n<0&&o<0?t.max=0:n>0&&o>0&&(t.min=0)}void 0!==i.min?t.min=i.min:void 0!==i.suggestedMin&&(t.min=Math.min(t.min,i.suggestedMin)),void 0!==i.max?t.max=i.max:void 0!==i.suggestedMax&&(t.max=Math.max(t.max,i.suggestedMax)),t.min===t.max&&(t.max++,i.beginAtZero||t.min--)},getTickLimit:a,handleDirectionalChanges:a,buildTicks:function(){var a=this,i=a.options,n=i.ticks,o=a.getTickLimit();o=Math.max(2,o);var r={maxTicks:o,min:n.min,max:n.max,stepSize:e.getValueOrDefault(n.fixedStepSize,n.stepSize)},s=a.ticks=t.Ticks.generators.linear(r,a);a.handleDirectionalChanges(),a.max=e.max(s),a.min=e.min(s),n.reverse?(s.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{}],46:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.logarithmic}},i=t.Scale.extend({determineDataLimits:function(){function t(t){return u?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=i.ticks,o=a.chart,r=o.data,s=r.datasets,l=e.getValueOrDefault,u=a.isHorizontal();a.min=null,a.max=null,a.minNotZero=null;var d=i.stacked;if(void 0===d&&e.each(s,function(e,a){if(!d){var i=o.getDatasetMeta(a);o.isDatasetVisible(a)&&t(i)&&void 0!==i.stack&&(d=!0)}}),i.stacked||d){var c={};e.each(s,function(n,r){var s=o.getDatasetMeta(r),l=[s.type,void 0===i.stacked&&void 0===s.stack?r:"",s.stack].join(".");o.isDatasetVisible(r)&&t(s)&&(void 0===c[l]&&(c[l]=[]),e.each(n.data,function(t,e){var n=c[l],o=+a.getRightValue(t);isNaN(o)||s.data[e].hidden||(n[e]=n[e]||0,i.relativePoints?n[e]=100:n[e]+=o)}))}),e.each(c,function(t){var i=e.min(t),n=e.max(t);a.min=null===a.min?i:Math.min(a.min,i),a.max=null===a.max?n:Math.max(a.max,n)})}else e.each(s,function(i,n){var r=o.getDatasetMeta(n);o.isDatasetVisible(n)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:i<a.min&&(a.min=i),null===a.max?a.max=i:i>a.max&&(a.max=i),0!==i&&(null===a.minNotZero||i<a.minNotZero)&&(a.minNotZero=i))})});a.min=l(n.min,a.min),a.max=l(n.max,a.max),a.min===a.max&&(0!==a.min&&null!==a.min?(a.min=Math.pow(10,Math.floor(e.log10(a.min))-1),a.max=Math.pow(10,Math.floor(e.log10(a.max))+1)):(a.min=1,a.max=10))},buildTicks:function(){var a=this,i=a.options,n=i.ticks,o={min:n.min,max:n.max},r=a.ticks=t.Ticks.generators.logarithmic(o,a);a.isHorizontal()||r.reverse(),a.max=e.max(r),a.min=e.min(r),n.reverse?(r.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.max)},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),t.Scale.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){return this.getPixelForValue(this.tickValues[t])},getPixelForValue:function(t){var a,i,n,o=this,r=o.start,s=+o.getRightValue(t),l=o.options,u=l.ticks;return o.isHorizontal()?(n=e.log10(o.end)-e.log10(r),0===s?i=o.left:(a=o.width,i=o.left+a/n*(e.log10(s)-e.log10(r)))):(a=o.height,0!==r||u.reverse?0===o.end&&u.reverse?(n=e.log10(o.start)-e.log10(o.minNotZero),i=s===o.end?o.top:s===o.minNotZero?o.top+.02*a:o.top+.02*a+.98*a/n*(e.log10(s)-e.log10(o.minNotZero))):(n=e.log10(o.end)-e.log10(r),a=o.height,i=o.bottom-a/n*(e.log10(s)-e.log10(r))):(n=e.log10(o.end)-e.log10(o.minNotZero),i=s===r?o.bottom:s===o.minNotZero?o.bottom-.02*a:o.bottom-.02*a-.98*a/n*(e.log10(s)-e.log10(o.minNotZero)))),i},getValueForPixel:function(t){var a,i,n=this,o=e.log10(n.end)-e.log10(n.start);return n.isHorizontal()?(i=n.width,a=n.start*Math.pow(10,(t-n.left)*o/i)):(i=n.height,a=Math.pow(10,(n.bottom-t)*o/i)/n.start),a}});t.scaleService.registerScaleType("logarithmic",i,a)}},{}],47:[function(t,e,a){"use strict";e.exports=function(t){function e(t){return t.options.lineArc?0:t.chart.data.labels.length}function a(t){var e=t.options.pointLabels,a=f.getValueOrDefault(e.fontSize,g.defaultFontSize),i=f.getValueOrDefault(e.fontStyle,g.defaultFontStyle),n=f.getValueOrDefault(e.fontFamily,g.defaultFontFamily),o=f.fontString(a,i,n);return{size:a,style:i,family:n,font:o}}function i(t,e,a){return f.isArray(a)?{w:f.longestText(t,t.font,a),h:a.length*e+1.5*(a.length-1)*e}:{w:t.measureText(a).width,h:e}}function n(t,e,a,i,n){return t===i||t===n?{start:e-a/2,end:e+a/2}:t<i||t>n?{start:e-a-5,end:e}:{start:e,end:e+a+5}}function o(t){var o,r,s,l=a(t),u=Math.min(t.height/2,t.width/2),d={l:t.width,r:0,t:t.height,b:0},c={};t.ctx.font=l.font,t._pointLabelSizes=[];var h=e(t);for(o=0;o<h;o++){s=t.getPointPosition(o,u),r=i(t.ctx,l.size,t.pointLabels[o]||""),t._pointLabelSizes[o]=r;var g=t.getIndexAngle(o),p=f.toDegrees(g)%360,m=n(p,s.x,r.w,0,180),v=n(p,s.y,r.h,90,270);m.start<d.l&&(d.l=m.start,c.l=g),m.end>d.r&&(d.r=m.end,c.r=g),v.start<d.t&&(d.t=v.start,c.t=g),v.end>d.b&&(d.b=v.end,c.b=g)}t.setReductions(u,d,c)}function r(t){var e=Math.min(t.height/2,t.width/2);t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0)}function s(t){return 0===t||180===t?"center":t<180?"left":"right"}function l(t,e,a,i){if(f.isArray(e))for(var n=a.y,o=1.5*i,r=0;r<e.length;++r)t.fillText(e[r],a.x,n),n+=o;else t.fillText(e,a.x,a.y)}function u(t,e,a){90===t||270===t?a.y-=e.h/2:(t>270||t<90)&&(a.y-=e.h)}function d(t){var i=t.ctx,n=f.getValueOrDefault,o=t.options,r=o.angleLines,d=o.pointLabels;i.lineWidth=r.lineWidth,i.strokeStyle=r.color;var c=t.getDistanceFromCenterForValue(o.reverse?t.min:t.max),h=a(t);i.textBaseline="top";for(var p=e(t)-1;p>=0;p--){if(r.display){var m=t.getPointPosition(p,c);i.beginPath(),i.moveTo(t.xCenter,t.yCenter),i.lineTo(m.x,m.y),i.stroke(),i.closePath()}var v=t.getPointPosition(p,c+5),b=n(d.fontColor,g.defaultFontColor);i.font=h.font,i.fillStyle=b;var x=t.getIndexAngle(p),y=f.toDegrees(x);i.textAlign=s(y),u(y,t._pointLabelSizes[p],v),l(i,t.pointLabels[p]||"",v,h.size)}}function c(t,a,i,n){var o=t.ctx;if(o.strokeStyle=f.getValueAtIndexOrDefault(a.color,n-1),o.lineWidth=f.getValueAtIndexOrDefault(a.lineWidth,n-1),t.options.lineArc)o.beginPath(),o.arc(t.xCenter,t.yCenter,i,0,2*Math.PI),o.closePath(),o.stroke();else{var r=e(t);if(0===r)return;o.beginPath();var s=t.getPointPosition(0,i);o.moveTo(s.x,s.y);for(var l=1;l<r;l++)s=t.getPointPosition(l,i),o.lineTo(s.x,s.y);o.closePath(),o.stroke()}}function h(t){return f.isNumber(t)?t:0}var f=t.helpers,g=t.defaults.global,p={display:!0,animate:!0,lineArc:!1,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:t.Ticks.formatters.linear},pointLabels:{fontSize:10,callback:function(t){return t}}},m=t.LinearScaleBase.extend({setDimensions:function(){var t=this,e=t.options,a=e.ticks;t.width=t.maxWidth,t.height=t.maxHeight,t.xCenter=Math.round(t.width/2),t.yCenter=Math.round(t.height/2);var i=f.min([t.height,t.width]),n=f.getValueOrDefault(a.fontSize,g.defaultFontSize);t.drawingArea=e.display?i/2-(n/2+a.backdropPaddingY):i/2},determineDataLimits:function(){var t=this,e=t.chart,a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;f.each(e.data.datasets,function(n,o){if(e.isDatasetVisible(o)){var r=e.getDatasetMeta(o);f.each(n.data,function(e,n){var o=+t.getRightValue(e);isNaN(o)||r.data[n].hidden||(a=Math.min(o,a),i=Math.max(o,i))})}}),t.min=a===Number.POSITIVE_INFINITY?0:a,t.max=i===Number.NEGATIVE_INFINITY?0:i,t.handleTickRangeOptions()},getTickLimit:function(){var t=this.options.ticks,e=f.getValueOrDefault(t.fontSize,g.defaultFontSize);return Math.min(t.maxTicksLimit?t.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*e)))},convertTicksToLabels:function(){var e=this;t.LinearScaleBase.prototype.convertTicksToLabels.call(e),e.pointLabels=e.chart.data.labels.map(e.options.pointLabels.callback,e)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){this.options.lineArc?r(this):o(this)},setReductions:function(t,e,a){var i=this,n=e.l/Math.sin(a.l),o=Math.max(e.r-i.width,0)/Math.sin(a.r),r=-e.t/Math.cos(a.t),s=-Math.max(e.b-i.height,0)/Math.cos(a.b);n=h(n),o=h(o),r=h(r),s=h(s),i.drawingArea=Math.min(Math.round(t-(n+o)/2),Math.round(t-(r+s)/2)),i.setCenterPoint(n,o,r,s)},setCenterPoint:function(t,e,a,i){var n=this,o=n.width-e-n.drawingArea,r=t+n.drawingArea,s=a+n.drawingArea,l=n.height-i-n.drawingArea;n.xCenter=Math.round((r+o)/2+n.left),n.yCenter=Math.round((s+l)/2+n.top)},getIndexAngle:function(t){var a=2*Math.PI/e(this),i=this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0,n=i*Math.PI*2/360;return t*a+n},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var a=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*a:(t-e.min)*a},getPointPosition:function(t,e){var a=this,i=a.getIndexAngle(t)-Math.PI/2;return{x:Math.round(Math.cos(i)*e)+a.xCenter,y:Math.round(Math.sin(i)*e)+a.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this,e=t.min,a=t.max;return t.getPointPositionForValue(0,t.beginAtZero?0:e<0&&a<0?a:e>0&&a>0?e:0)},draw:function(){var t=this,e=t.options,a=e.gridLines,i=e.ticks,n=f.getValueOrDefault;if(e.display){var o=t.ctx,r=n(i.fontSize,g.defaultFontSize),s=n(i.fontStyle,g.defaultFontStyle),l=n(i.fontFamily,g.defaultFontFamily),u=f.fontString(r,s,l);f.each(t.ticks,function(s,l){if(l>0||e.reverse){var d=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),h=t.yCenter-d;if(a.display&&0!==l&&c(t,a,d,l),i.display){var f=n(i.fontColor,g.defaultFontColor);if(o.font=u,i.showLabelBackdrop){var p=o.measureText(s).width;o.fillStyle=i.backdropColor,o.fillRect(t.xCenter-p/2-i.backdropPaddingX,h-r/2-i.backdropPaddingY,p+2*i.backdropPaddingX,r+2*i.backdropPaddingY)}o.textAlign="center",o.textBaseline="middle",o.fillStyle=f,o.fillText(s,t.xCenter,h)}}}),e.lineArc||d(t)}}});t.scaleService.registerScaleType("radialLinear",m,p)}},{}],48:[function(t,e,a){"use strict";var i=t(1);i="function"==typeof i?i:window.moment,e.exports=function(t){var e=t.helpers,a={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},n={position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},o=t.Scale.extend({initialize:function(){if(!i)throw new Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");t.Scale.prototype.initialize.call(this)},getLabelMoment:function(t,e){return null===t||null===e?null:"undefined"!=typeof this.labelMoments[t]?this.labelMoments[t][e]:null},getLabelDiff:function(t,e){var a=this;return null===t||null===e?null:(void 0===a.labelDiffs&&a.buildLabelDiffs(),"undefined"!=typeof a.labelDiffs[t]?a.labelDiffs[t][e]:null)},getMomentStartOf:function(t){var e=this;return"week"===e.options.time.unit&&e.options.time.isoWeekday!==!1?t.clone().startOf("isoWeek").isoWeekday(e.options.time.isoWeekday):t.clone().startOf(e.tickUnit)},determineDataLimits:function(){var t=this;t.labelMoments=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0?(e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i))},t),t.firstTick=i.min.call(t,a),t.lastTick=i.max.call(t,a)):(t.firstTick=null,t.lastTick=null),e.each(t.chart.data.datasets,function(n,o){var r=[],s=t.chart.isDatasetVisible(o);"object"==typeof n.data[0]&&null!==n.data[0]?e.each(n.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),r.push(a),s&&(t.firstTick=null!==t.firstTick?i.min(t.firstTick,a):a,t.lastTick=null!==t.lastTick?i.max(t.lastTick,a):a))},t):r=a,t.labelMoments.push(r)},t),t.options.time.min&&(t.firstTick=t.parseTime(t.options.time.min)),t.options.time.max&&(t.lastTick=t.parseTime(t.options.time.max)),t.firstTick=(t.firstTick||i()).clone(),t.lastTick=(t.lastTick||i()).clone()},buildLabelDiffs:function(){var t=this;t.labelDiffs=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0&&e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i.diff(t.firstTick,t.tickUnit,!0)))},t),e.each(t.chart.data.datasets,function(i){var n=[];"object"==typeof i.data[0]&&null!==i.data[0]?e.each(i.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),n.push(a.diff(t.firstTick,t.tickUnit,!0)))},t):n=a,t.labelDiffs.push(n)},t)},buildTicks:function(){var i=this;i.ctx.save();var n=e.getValueOrDefault(i.options.ticks.fontSize,t.defaults.global.defaultFontSize),o=e.getValueOrDefault(i.options.ticks.fontStyle,t.defaults.global.defaultFontStyle),r=e.getValueOrDefault(i.options.ticks.fontFamily,t.defaults.global.defaultFontFamily),s=e.fontString(n,o,r);if(i.ctx.font=s,i.ticks=[],i.unitScale=1,i.scaleSizeInUnits=0,i.options.time.unit)i.tickUnit=i.options.time.unit||"day",i.displayFormat=i.options.time.displayFormats[i.tickUnit],i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,1);else{var l=i.isHorizontal()?i.width:i.height,u=i.tickFormatFunction(i.firstTick,0,[]),d=i.ctx.measureText(u).width,c=Math.cos(e.toRadians(i.options.ticks.maxRotation)),h=Math.sin(e.toRadians(i.options.ticks.maxRotation));d=d*c+n*h;var f=l/d;i.tickUnit=i.options.time.minUnit,i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.displayFormat=i.options.time.displayFormats[i.tickUnit];for(var g=0,p=a.units[g];g<a.units.length;){if(i.unitScale=1,e.isArray(p.steps)&&Math.ceil(i.scaleSizeInUnits/f)<e.max(p.steps)){for(var m=0;m<p.steps.length;++m)if(p.steps[m]>=Math.ceil(i.scaleSizeInUnits/f)){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,p.steps[m]);break}break}if(p.maxStep===!1||Math.ceil(i.scaleSizeInUnits/f)<p.maxStep){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,Math.ceil(i.scaleSizeInUnits/f));break}++g,p=a.units[g],i.tickUnit=p.name;var v=i.firstTick.diff(i.getMomentStartOf(i.firstTick),i.tickUnit,!0),b=i.getMomentStartOf(i.lastTick.clone().add(1,i.tickUnit)).diff(i.lastTick,i.tickUnit,!0);i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)+v+b,i.displayFormat=i.options.time.displayFormats[p.name]}}var x;if(i.options.time.min?x=i.getMomentStartOf(i.firstTick):(i.firstTick=i.getMomentStartOf(i.firstTick),x=i.firstTick),!i.options.time.max){var y=i.getMomentStartOf(i.lastTick),k=y.diff(i.lastTick,i.tickUnit,!0);k<0?i.lastTick=i.getMomentStartOf(i.lastTick.add(1,i.tickUnit)):k>=0&&(i.lastTick=y),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)}i.options.time.displayFormat&&(i.displayFormat=i.options.time.displayFormat),i.ticks.push(i.firstTick.clone());for(var S=i.unitScale;S<=i.scaleSizeInUnits;S+=i.unitScale){var M=x.clone().add(S,i.tickUnit);if(i.options.time.max&&M.diff(i.lastTick,i.tickUnit,!0)>=0)break;i.ticks.push(M)}var w=i.ticks[i.ticks.length-1].diff(i.lastTick,i.tickUnit);0===w&&0!==i.scaleSizeInUnits||(i.options.time.max?(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.ticks[0],i.tickUnit,!0)):(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0))),i.ctx.restore(),i.labelDiffs=void 0},getLabelForIndex:function(t,e){var a=this,i=a.chart.data.labels&&t<a.chart.data.labels.length?a.chart.data.labels[t]:"",n=a.chart.data.datasets[e].data[t];return null!==n&&"object"==typeof n&&(i=a.getRightValue(n)),a.options.time.tooltipFormat&&(i=a.parseTime(i).format(a.options.time.tooltipFormat)),i},tickFormatFunction:function(t,a,i){var n=t.format(this.displayFormat),o=this.options.ticks,r=e.getValueOrDefault(o.callback,o.userCallback);return r?r(n,a,i):n},convertTicksToLabels:function(){var t=this;t.tickMoments=t.ticks,t.ticks=t.ticks.map(t.tickFormatFunction,t)},getPixelForValue:function(t,e,a){var i=this,n=null;if(void 0!==e&&void 0!==a&&(n=i.getLabelDiff(a,e)),null===n&&(t&&t.isValid||(t=i.parseTime(i.getRightValue(t))),t&&t.isValid&&t.isValid()&&(n=t.diff(i.firstTick,i.tickUnit,!0))),null!==n){var o=0!==n?n/i.scaleSizeInUnits:n;if(i.isHorizontal()){var r=i.width*o;return i.left+Math.round(r)}var s=i.height*o;return i.top+Math.round(s)}},getPixelForTick:function(t){return this.getPixelForValue(this.tickMoments[t],null,null)},getValueForPixel:function(t){var e=this,a=e.isHorizontal()?e.width:e.height,n=(t-(e.isHorizontal()?e.left:e.top))/a;return n*=e.scaleSizeInUnits,e.firstTick.clone().add(i.duration(n,e.tickUnit).asSeconds(),"seconds")},parseTime:function(t){var e=this;return"string"==typeof e.options.time.parser?i(t,e.options.time.parser):"function"==typeof e.options.time.parser?e.options.time.parser(t):"function"==typeof t.getMonth||"number"==typeof t?i(t):t.isValid&&t.isValid()?t:"string"!=typeof e.options.time.format&&e.options.time.format.call?(console.warn("options.time.format is deprecated and replaced by options.time.parser. See http://nnnick.github.io/Chart.js/docs-v2/#scales-time-scale"),e.options.time.format(t)):i(t,e.options.time.format)}});t.scaleService.registerScaleType("time",o,n)}},{1:1}]},{},[7])(7)});
1
+ /*!
2
+ * Chart.js
3
+ * http://chartjs.org/
4
+ * Version: 2.5.0
5
+ *
6
+ * Copyright 2017 Nick Downie
7
+ * Released under the MIT license
8
+ * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
9
+ */
10
+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Chart=t()}}(function(){return function t(e,a,i){function n(r,s){if(!a[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(o)return o(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=a[r]={exports:{}};e[r][0].call(d.exports,function(t){var a=e[r][1][t];return n(a?a:t)},d,d.exports,t,e,a,i)}return a[r].exports}for(var o="function"==typeof require&&require,r=0;r<i.length;r++)n(i[r]);return n}({1:[function(t,e,a){},{}],2:[function(t,e,a){function i(t){if(t){var e=/^#([a-fA-F0-9]{3})$/,a=/^#([a-fA-F0-9]{6})$/,i=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,o=/(\w+)/,r=[0,0,0],s=1,l=t.match(e);if(l){l=l[1];for(var u=0;u<r.length;u++)r[u]=parseInt(l[u]+l[u],16)}else if(l=t.match(a)){l=l[1];for(var u=0;u<r.length;u++)r[u]=parseInt(l.slice(2*u,2*u+2),16)}else if(l=t.match(i)){for(var u=0;u<r.length;u++)r[u]=parseInt(l[u+1]);s=parseFloat(l[4])}else if(l=t.match(n)){for(var u=0;u<r.length;u++)r[u]=Math.round(2.55*parseFloat(l[u+1]));s=parseFloat(l[4])}else if(l=t.match(o)){if("transparent"==l[1])return[0,0,0,0];if(r=y[l[1]],!r)return}for(var u=0;u<r.length;u++)r[u]=b(r[u],0,255);return s=s||0==s?b(s,0,1):1,r[3]=s,r}}function n(t){if(t){var e=/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,a=t.match(e);if(a){var i=parseFloat(a[4]),n=b(parseInt(a[1]),0,360),o=b(parseFloat(a[2]),0,100),r=b(parseFloat(a[3]),0,100),s=b(isNaN(i)?1:i,0,1);return[n,o,r,s]}}}function o(t){if(t){var e=/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,a=t.match(e);if(a){var i=parseFloat(a[4]),n=b(parseInt(a[1]),0,360),o=b(parseFloat(a[2]),0,100),r=b(parseFloat(a[3]),0,100),s=b(isNaN(i)?1:i,0,1);return[n,o,r,s]}}}function r(t){var e=i(t);return e&&e.slice(0,3)}function s(t){var e=n(t);return e&&e.slice(0,3)}function l(t){var e=i(t);return e?e[3]:(e=n(t))?e[3]:(e=o(t))?e[3]:void 0}function u(t){return"#"+x(t[0])+x(t[1])+x(t[2])}function d(t,e){return e<1||t[3]&&t[3]<1?c(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function c(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function h(t,e){if(e<1||t[3]&&t[3]<1)return f(t,e);var a=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return"rgb("+a+"%, "+i+"%, "+n+"%)"}function f(t,e){var a=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return"rgba("+a+"%, "+i+"%, "+n+"%, "+(e||t[3]||1)+")"}function g(t,e){return e<1||t[3]&&t[3]<1?p(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function p(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function m(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"}function v(t){return k[t.slice(0,3)]}function b(t,e,a){return Math.min(Math.max(e,t),a)}function x(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var y=t(6);e.exports={getRgba:i,getHsla:n,getRgb:r,getHsl:s,getHwb:o,getAlpha:l,hexString:u,rgbString:d,rgbaString:c,percentString:h,percentaString:f,hslString:g,hslaString:p,hwbString:m,keyword:v};var k={};for(var S in y)k[y[S]]=S},{6:6}],3:[function(t,e,a){var i=t(5),n=t(2),o=function(t){if(t instanceof o)return t;if(!(this instanceof o))return new o(t);this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1};var e;if("string"==typeof t)if(e=n.getRgba(t))this.setValues("rgb",e);else if(e=n.getHsla(t))this.setValues("hsl",e);else{if(!(e=n.getHwb(t)))throw new Error('Unable to parse color from string "'+t+'"');this.setValues("hwb",e)}else if("object"==typeof t)if(e=t,void 0!==e.r||void 0!==e.red)this.setValues("rgb",e);else if(void 0!==e.l||void 0!==e.lightness)this.setValues("hsl",e);else if(void 0!==e.v||void 0!==e.value)this.setValues("hsv",e);else if(void 0!==e.w||void 0!==e.whiteness)this.setValues("hwb",e);else{if(void 0===e.c&&void 0===e.cyan)throw new Error("Unable to parse color from object "+JSON.stringify(t));this.setValues("cmyk",e)}};o.prototype={rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t%=360,t=t<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return n.hexString(this.values.rgb)},rgbString:function(){return n.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return n.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return n.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return n.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return n.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return n.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return n.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],a=0;a<t.length;a++){var i=t[a]/255;e[a]=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),a=t.luminosity();return e>a?(e+.05)/(a+.05):(a+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(299*t[0]+587*t[1]+114*t[2])/1e3;return e<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,a=(e[0]+t)%360;return e[0]=a<0?360+a:a,this.setValues("hsl",e),this},mix:function(t,e){var a=this,i=t,n=void 0===e?.5:e,o=2*n-1,r=a.alpha()-i.alpha(),s=((o*r===-1?o:(o+r)/(1+o*r))+1)/2,l=1-s;return this.rgb(s*a.red()+l*i.red(),s*a.green()+l*i.green(),s*a.blue()+l*i.blue()).alpha(a.alpha()*n+i.alpha()*(1-n))},toJSON:function(){return this.rgb()},clone:function(){var t,e,a=new o,i=this.values,n=a.values;for(var r in i)i.hasOwnProperty(r)&&(t=i[r],e={}.toString.call(t),"[object Array]"===e?n[r]=t.slice(0):"[object Number]"===e?n[r]=t:console.error("unexpected color value:",t));return a}},o.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},o.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},o.prototype.getValues=function(t){for(var e=this.values,a={},i=0;i<t.length;i++)a[t.charAt(i)]=e[t][i];return 1!==e.alpha&&(a.a=e.alpha),a},o.prototype.setValues=function(t,e){var a,n=this.values,o=this.spaces,r=this.maxes,s=1;if("alpha"===t)s=e;else if(e.length)n[t]=e.slice(0,t.length),s=e[t.length];else if(void 0!==e[t.charAt(0)]){for(a=0;a<t.length;a++)n[t][a]=e[t.charAt(a)];s=e.a}else if(void 0!==e[o[t][0]]){var l=o[t];for(a=0;a<t.length;a++)n[t][a]=e[l[a]];s=e.alpha}if(n.alpha=Math.max(0,Math.min(1,void 0===s?n.alpha:s)),"alpha"===t)return!1;var u;for(a=0;a<t.length;a++)u=Math.max(0,Math.min(r[t][a],n[t][a])),n[t][a]=Math.round(u);for(var d in o)d!==t&&(n[d]=i[t][d](n[t]));return!0},o.prototype.setSpace=function(t,e){var a=e[0];return void 0===a?this.getValues(t):("number"==typeof a&&(a=Array.prototype.slice.call(e)),this.setValues(t,a),this)},o.prototype.setChannel=function(t,e,a){var i=this.values[t];return void 0===a?i[e]:a===i[e]?this:(i[e]=a,this.setValues(t,i),this)},"undefined"!=typeof window&&(window.Color=o),e.exports=o},{2:2,5:5}],4:[function(t,e,a){function i(t){var e,a,i,n=t[0]/255,o=t[1]/255,r=t[2]/255,s=Math.min(n,o,r),l=Math.max(n,o,r),u=l-s;return l==s?e=0:n==l?e=(o-r)/u:o==l?e=2+(r-n)/u:r==l&&(e=4+(n-o)/u),e=Math.min(60*e,360),e<0&&(e+=360),i=(s+l)/2,a=l==s?0:i<=.5?u/(l+s):u/(2-l-s),[e,100*a,100*i]}function n(t){var e,a,i,n=t[0],o=t[1],r=t[2],s=Math.min(n,o,r),l=Math.max(n,o,r),u=l-s;return a=0==l?0:u/l*1e3/10,l==s?e=0:n==l?e=(o-r)/u:o==l?e=2+(r-n)/u:r==l&&(e=4+(n-o)/u),e=Math.min(60*e,360),e<0&&(e+=360),i=l/255*1e3/10,[e,a,i]}function o(t){var e=t[0],a=t[1],n=t[2],o=i(t)[0],r=1/255*Math.min(e,Math.min(a,n)),n=1-1/255*Math.max(e,Math.max(a,n));return[o,100*r,100*n]}function s(t){var e,a,i,n,o=t[0]/255,r=t[1]/255,s=t[2]/255;return n=Math.min(1-o,1-r,1-s),e=(1-o-n)/(1-n)||0,a=(1-r-n)/(1-n)||0,i=(1-s-n)/(1-n)||0,[100*e,100*a,100*i,100*n]}function l(t){return Z[JSON.stringify(t)]}function u(t){var e=t[0]/255,a=t[1]/255,i=t[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92;var n=.4124*e+.3576*a+.1805*i,o=.2126*e+.7152*a+.0722*i,r=.0193*e+.1192*a+.9505*i;return[100*n,100*o,100*r]}function d(t){var e,a,i,n=u(t),o=n[0],r=n[1],s=n[2];return o/=95.047,r/=100,s/=108.883,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*r-16,a=500*(o-r),i=200*(r-s),[e,a,i]}function c(t){return z(d(t))}function h(t){var e,a,i,n,o,r=t[0]/360,s=t[1]/100,l=t[2]/100;if(0==s)return o=255*l,[o,o,o];a=l<.5?l*(1+s):l+s-l*s,e=2*l-a,n=[0,0,0];for(var u=0;u<3;u++)i=r+1/3*-(u-1),i<0&&i++,i>1&&i--,o=6*i<1?e+6*(a-e)*i:2*i<1?a:3*i<2?e+(a-e)*(2/3-i)*6:e,n[u]=255*o;return n}function f(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return 0===o?[0,0,0]:(o*=2,n*=o<=1?o:2-o,a=(o+n)/2,e=2*n/(o+n),[i,100*e,100*a])}function p(t){return o(h(t))}function m(t){return s(h(t))}function v(t){return l(h(t))}function x(t){var e=t[0]/60,a=t[1]/100,i=t[2]/100,n=Math.floor(e)%6,o=e-Math.floor(e),r=255*i*(1-a),s=255*i*(1-a*o),l=255*i*(1-a*(1-o)),i=255*i;switch(n){case 0:return[i,l,r];case 1:return[s,i,r];case 2:return[r,i,l];case 3:return[r,s,i];case 4:return[l,r,i];case 5:return[i,r,s]}}function y(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return a=(2-n)*o,e=n*o,e/=a<=1?a:2-a,e=e||0,a/=2,[i,100*e,100*a]}function k(t){return o(x(t))}function S(t){return s(x(t))}function M(t){return l(x(t))}function w(t){var e,a,i,n,o=t[0]/360,s=t[1]/100,l=t[2]/100,u=s+l;switch(u>1&&(s/=u,l/=u),e=Math.floor(6*o),a=1-l,i=6*o-e,0!=(1&e)&&(i=1-i),n=s+i*(a-s),e){default:case 6:case 0:r=a,g=n,b=s;break;case 1:r=n,g=a,b=s;break;case 2:r=s,g=a,b=n;break;case 3:r=s,g=n,b=a;break;case 4:r=n,g=s,b=a;break;case 5:r=a,g=s,b=n}return[255*r,255*g,255*b]}function C(t){return i(w(t))}function I(t){return n(w(t))}function D(t){return s(w(t))}function A(t){return l(w(t))}function T(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100,s=t[3]/100;return e=1-Math.min(1,n*(1-s)+s),a=1-Math.min(1,o*(1-s)+s),i=1-Math.min(1,r*(1-s)+s),[255*e,255*a,255*i]}function P(t){return i(T(t))}function _(t){return n(T(t))}function F(t){return o(T(t))}function V(t){return l(T(t))}function R(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100;return e=3.2406*n+o*-1.5372+r*-.4986,a=n*-.9689+1.8758*o+.0415*r,i=.0557*n+o*-.204+1.057*r,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,e=Math.min(Math.max(0,e),1),a=Math.min(Math.max(0,a),1),i=Math.min(Math.max(0,i),1),[255*e,255*a,255*i]}function O(t){var e,a,i,n=t[0],o=t[1],r=t[2];return n/=95.047,o/=100,r/=108.883,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,e=116*o-16,a=500*(n-o),i=200*(o-r),[e,a,i]}function L(t){return z(O(t))}function B(t){var e,a,i,n,o=t[0],r=t[1],s=t[2];return o<=8?(a=100*o/903.3,n=7.787*(a/100)+16/116):(a=100*Math.pow((o+16)/116,3),n=Math.pow(a/100,1/3)),e=e/95.047<=.008856?e=95.047*(r/500+n-16/116)/7.787:95.047*Math.pow(r/500+n,3),i=i/108.883<=.008859?i=108.883*(n-s/200-16/116)/7.787:108.883*Math.pow(n-s/200,3),[e,a,i]}function z(t){var e,a,i,n=t[0],o=t[1],r=t[2];return e=Math.atan2(r,o),a=360*e/2/Math.PI,a<0&&(a+=360),i=Math.sqrt(o*o+r*r),[n,i,a]}function W(t){return R(B(t))}function N(t){var e,a,i,n=t[0],o=t[1],r=t[2];return i=r/360*2*Math.PI,e=o*Math.cos(i),a=o*Math.sin(i),[n,e,a]}function E(t){return B(N(t))}function H(t){return W(N(t))}function j(t){return G[t]}function U(t){return i(j(t))}function q(t){return n(j(t))}function Y(t){return o(j(t))}function X(t){return s(j(t))}function K(t){return d(j(t))}function J(t){return u(j(t))}e.exports={rgb2hsl:i,rgb2hsv:n,rgb2hwb:o,rgb2cmyk:s,rgb2keyword:l,rgb2xyz:u,rgb2lab:d,rgb2lch:c,hsl2rgb:h,hsl2hsv:f,hsl2hwb:p,hsl2cmyk:m,hsl2keyword:v,hsv2rgb:x,hsv2hsl:y,hsv2hwb:k,hsv2cmyk:S,hsv2keyword:M,hwb2rgb:w,hwb2hsl:C,hwb2hsv:I,hwb2cmyk:D,hwb2keyword:A,cmyk2rgb:T,cmyk2hsl:P,cmyk2hsv:_,cmyk2hwb:F,cmyk2keyword:V,keyword2rgb:j,keyword2hsl:U,keyword2hsv:q,keyword2hwb:Y,keyword2cmyk:X,keyword2lab:K,keyword2xyz:J,xyz2rgb:R,xyz2lab:O,xyz2lch:L,lab2xyz:B,lab2rgb:W,lab2lch:z,lch2lab:N,lch2xyz:E,lch2rgb:H};var G={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Z={};for(var Q in G)Z[JSON.stringify(G[Q])]=Q},{}],5:[function(t,e,a){var i=t(4),n=function(){return new u};for(var o in i){n[o+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(o);var r=/(\w+)2(\w+)/.exec(o),s=r[1],l=r[2];n[s]=n[s]||{},n[s][l]=n[o]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var a=i[t](e);if("string"==typeof a||void 0===a)return a;for(var n=0;n<a.length;n++)a[n]=Math.round(a[n]);return a}}(o)}var u=function(){this.convs={}};u.prototype.routeSpace=function(t,e){var a=e[0];return void 0===a?this.getValues(t):("number"==typeof a&&(a=Array.prototype.slice.call(e)),this.setValues(t,a))},u.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},u.prototype.getValues=function(t){var e=this.convs[t];if(!e){var a=this.space,i=this.convs[a];e=n[a][t](i),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){u.prototype[t]=function(e){return this.routeSpace(t,arguments)}}),e.exports=n},{4:4}],6:[function(t,e,a){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],7:[function(t,e,a){var i=t(28)();t(26)(i),t(42)(i),t(22)(i),t(31)(i),t(25)(i),t(21)(i),t(23)(i),t(24)(i),t(29)(i),t(33)(i),t(34)(i),t(32)(i),t(35)(i),t(30)(i),t(27)(i),t(36)(i),t(37)(i),t(38)(i),t(39)(i),t(40)(i),t(45)(i),t(43)(i),t(44)(i),t(46)(i),t(47)(i),t(48)(i),t(15)(i),t(16)(i),t(17)(i),t(18)(i),t(19)(i),t(20)(i),t(8)(i),t(9)(i),t(10)(i),t(11)(i),t(12)(i),t(13)(i),t(14)(i),window.Chart=e.exports=i},{10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,42:42,43:43,44:44,45:45,46:46,47:47,48:48,8:8,9:9}],8:[function(t,e,a){"use strict";e.exports=function(t){t.Bar=function(e,a){return a.type="bar",new t(e,a)}}},{}],9:[function(t,e,a){"use strict";e.exports=function(t){t.Bubble=function(e,a){return a.type="bubble",new t(e,a)}}},{}],10:[function(t,e,a){"use strict";e.exports=function(t){t.Doughnut=function(e,a){return a.type="doughnut",new t(e,a)}}},{}],11:[function(t,e,a){"use strict";e.exports=function(t){t.Line=function(e,a){return a.type="line",new t(e,a)}}},{}],12:[function(t,e,a){"use strict";e.exports=function(t){t.PolarArea=function(e,a){return a.type="polarArea",new t(e,a)}}},{}],13:[function(t,e,a){"use strict";e.exports=function(t){t.Radar=function(e,a){return a.type="radar",new t(e,a)}}},{}],14:[function(t,e,a){"use strict";e.exports=function(t){var e={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-1"}],yAxes:[{type:"linear",position:"left",id:"y-axis-1"}]},tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}};t.defaults.scatter=e,t.controllers.scatter=t.controllers.line,t.Scatter=function(e,a){return a.type="scatter",new t(e,a)}}},{}],15:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.bar={hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}},t.controllers.bar=t.DatasetController.extend({dataElementType:t.elements.Rectangle,initialize:function(e,a){t.DatasetController.prototype.initialize.call(this,e,a);var i=this,n=i.getMeta(),o=i.getDataset();n.stack=o.stack,n.bar=!0},getStackCount:function(){var t=this,a=t.getMeta(),i=t.getScaleForId(a.yAxisID),n=[];return e.each(t.chart.data.datasets,function(e,a){var o=t.chart.getDatasetMeta(a);o.bar&&t.chart.isDatasetVisible(a)&&(i.options.stacked===!1||i.options.stacked===!0&&n.indexOf(o.stack)===-1||void 0===i.options.stacked&&(void 0===o.stack||n.indexOf(o.stack)===-1))&&n.push(o.stack)},t),n.length},update:function(t){var a=this;e.each(a.getMeta().data,function(e,i){a.updateElement(e,i,t)},a)},updateElement:function(t,a,i){var n=this,o=n.getMeta(),r=n.getScaleForId(o.xAxisID),s=n.getScaleForId(o.yAxisID),l=s.getBasePixel(),u=n.chart.options.elements.rectangle,d=t.custom||{},c=n.getDataset();t._xScale=r,t._yScale=s,t._datasetIndex=n.index,t._index=a;var h=n.getRuler(a);t._model={x:n.calculateBarX(a,n.index,h),y:i?l:n.calculateBarY(a,n.index),label:n.chart.data.labels[a],datasetLabel:c.label,horizontal:!1,base:i?l:n.calculateBarBase(n.index,a),width:n.calculateBarWidth(h),backgroundColor:d.backgroundColor?d.backgroundColor:e.getValueAtIndexOrDefault(c.backgroundColor,a,u.backgroundColor),borderSkipped:d.borderSkipped?d.borderSkipped:u.borderSkipped,borderColor:d.borderColor?d.borderColor:e.getValueAtIndexOrDefault(c.borderColor,a,u.borderColor),borderWidth:d.borderWidth?d.borderWidth:e.getValueAtIndexOrDefault(c.borderWidth,a,u.borderWidth)},t.pivot()},calculateBarBase:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.yAxisID),o=n.getBaseValue(),r=o;if(n.options.stacked===!0||void 0===n.options.stacked&&void 0!==i.stack){for(var s=a.chart,l=s.data.datasets,u=Number(l[t].data[e]),d=0;d<t;d++){var c=l[d],h=s.getDatasetMeta(d);if(h.bar&&h.yAxisID===n.id&&s.isDatasetVisible(d)&&i.stack===h.stack){var f=Number(c.data[e]);o+=u<0?Math.min(f,r):Math.max(f,r)}}return n.getPixelForValue(o)}return n.getBasePixel()},getRuler:function(){var t=this,e=t.getMeta(),a=t.getScaleForId(e.xAxisID),i=t.getStackCount(),n=a.width/a.ticks.length,o=n*a.options.categoryPercentage,r=(n-n*a.options.categoryPercentage)/2,s=o/i,l=s*a.options.barPercentage,u=s-s*a.options.barPercentage;return{stackCount:i,tickWidth:n,categoryWidth:o,categorySpacing:r,fullBarWidth:s,barWidth:l,barSpacing:u}},calculateBarWidth:function(t){var e=this,a=e.getMeta(),i=e.getScaleForId(a.xAxisID);return i.options.barThickness?i.options.barThickness:t.barWidth},getStackIndex:function(t){var e,a,i=this,n=i.chart.getDatasetMeta(t),o=i.getScaleForId(n.yAxisID),r=[n.stack];for(a=0;a<t;++a)e=this.chart.getDatasetMeta(a),e.bar&&this.chart.isDatasetVisible(a)&&(o.options.stacked===!1||o.options.stacked===!0&&r.indexOf(e.stack)===-1||void 0===o.options.stacked&&(void 0===e.stack||r.indexOf(e.stack)===-1))&&r.push(e.stack);return r.length-1},calculateBarX:function(t,e,a){var i=this,n=i.getMeta(),o=i.getScaleForId(n.xAxisID),r=i.getStackIndex(e),s=o.getPixelForValue(null,t,e,i.chart.isCombo);return s-=i.chart.isCombo?a.tickWidth/2:0,s+a.barWidth/2+a.categorySpacing+a.barWidth*r+a.barSpacing/2+a.barSpacing*r},calculateBarY:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.yAxisID),o=Number(a.getDataset().data[t]);if(n.options.stacked||void 0===n.options.stacked&&void 0!==i.stack){for(var r=n.getBaseValue(),s=r,l=r,u=0;u<e;u++){var d=a.chart.data.datasets[u],c=a.chart.getDatasetMeta(u);if(c.bar&&c.yAxisID===n.id&&a.chart.isDatasetVisible(u)&&i.stack===c.stack){var h=Number(d.data[t]);h<0?l+=h||0:s+=h||0}}return o<0?n.getPixelForValue(l+o):n.getPixelForValue(s+o)}return n.getPixelForValue(o)},draw:function(e){var a,i,n=this,o=e||1,r=n.getMeta().data,s=n.getDataset();for(t.canvasHelpers.clipArea(n.chart.chart.ctx,n.chart.chartArea),a=0,i=r.length;a<i;++a){var l=s.data[a];null===l||void 0===l||isNaN(l)||r[a].transition(o).draw()}t.canvasHelpers.unclipArea(n.chart.chart.ctx)},setHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model;o.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.hoverBackgroundColor,i,e.getHoverColor(o.backgroundColor)),o.borderColor=n.hoverBorderColor?n.hoverBorderColor:e.getValueAtIndexOrDefault(a.hoverBorderColor,i,e.getHoverColor(o.borderColor)),o.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:e.getValueAtIndexOrDefault(a.hoverBorderWidth,i,o.borderWidth)},removeHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model,r=this.chart.options.elements.rectangle;o.backgroundColor=n.backgroundColor?n.backgroundColor:e.getValueAtIndexOrDefault(a.backgroundColor,i,r.backgroundColor),o.borderColor=n.borderColor?n.borderColor:e.getValueAtIndexOrDefault(a.borderColor,i,r.borderColor),o.borderWidth=n.borderWidth?n.borderWidth:e.getValueAtIndexOrDefault(a.borderWidth,i,r.borderWidth)}}),t.defaults.horizontalBar={hover:{mode:"label"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{position:"left",type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{callbacks:{title:function(t,e){var a="";return t.length>0&&(t[0].yLabel?a=t[0].yLabel:e.labels.length>0&&t[0].index<e.labels.length&&(a=e.labels[t[0].index])),a},label:function(t,e){var a=e.datasets[t.datasetIndex].label||"";return a+": "+t.xLabel}}}},t.controllers.horizontalBar=t.controllers.bar.extend({getStackCount:function(){var t=this,a=t.getMeta(),i=t.getScaleForId(a.xAxisID),n=[];return e.each(t.chart.data.datasets,function(e,a){var o=t.chart.getDatasetMeta(a);o.bar&&t.chart.isDatasetVisible(a)&&(i.options.stacked===!1||i.options.stacked===!0&&n.indexOf(o.stack)===-1||void 0===i.options.stacked&&(void 0===o.stack||n.indexOf(o.stack)===-1))&&n.push(o.stack)},t),n.length},updateElement:function(t,a,i){var n=this,o=n.getMeta(),r=n.getScaleForId(o.xAxisID),s=n.getScaleForId(o.yAxisID),l=r.getBasePixel(),u=t.custom||{},d=n.getDataset(),c=n.chart.options.elements.rectangle;t._xScale=r,t._yScale=s,t._datasetIndex=n.index,t._index=a;var h=n.getRuler(a);t._model={x:i?l:n.calculateBarX(a,n.index),y:n.calculateBarY(a,n.index,h),label:n.chart.data.labels[a],datasetLabel:d.label,horizontal:!0,base:i?l:n.calculateBarBase(n.index,a),height:n.calculateBarHeight(h),backgroundColor:u.backgroundColor?u.backgroundColor:e.getValueAtIndexOrDefault(d.backgroundColor,a,c.backgroundColor),borderSkipped:u.borderSkipped?u.borderSkipped:c.borderSkipped,borderColor:u.borderColor?u.borderColor:e.getValueAtIndexOrDefault(d.borderColor,a,c.borderColor),
11
+ borderWidth:u.borderWidth?u.borderWidth:e.getValueAtIndexOrDefault(d.borderWidth,a,c.borderWidth)},t.pivot()},calculateBarBase:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.xAxisID),o=n.getBaseValue(),r=o;if(n.options.stacked||void 0===n.options.stacked&&void 0!==i.stack){for(var s=a.chart,l=s.data.datasets,u=Number(l[t].data[e]),d=0;d<t;d++){var c=l[d],h=s.getDatasetMeta(d);if(h.bar&&h.xAxisID===n.id&&s.isDatasetVisible(d)&&i.stack===h.stack){var f=Number(c.data[e]);o+=u<0?Math.min(f,r):Math.max(f,r)}}return n.getPixelForValue(o)}return n.getBasePixel()},getRuler:function(){var t=this,e=t.getMeta(),a=t.getScaleForId(e.yAxisID),i=t.getStackCount(),n=a.height/a.ticks.length,o=n*a.options.categoryPercentage,r=(n-n*a.options.categoryPercentage)/2,s=o/i,l=s*a.options.barPercentage,u=s-s*a.options.barPercentage;return{stackCount:i,tickHeight:n,categoryHeight:o,categorySpacing:r,fullBarHeight:s,barHeight:l,barSpacing:u}},calculateBarHeight:function(t){var e=this,a=e.getMeta(),i=e.getScaleForId(a.yAxisID);return i.options.barThickness?i.options.barThickness:t.barHeight},getStackIndex:function(t){var e,a,i=this,n=i.chart.getDatasetMeta(t),o=i.getScaleForId(n.xAxisID),r=[n.stack];for(a=0;a<t;++a)e=this.chart.getDatasetMeta(a),e.bar&&this.chart.isDatasetVisible(a)&&(o.options.stacked===!1||o.options.stacked===!0&&r.indexOf(e.stack)===-1||void 0===o.options.stacked&&(void 0===e.stack||r.indexOf(e.stack)===-1))&&r.push(e.stack);return r.length-1},calculateBarX:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.xAxisID),o=Number(a.getDataset().data[t]);if(n.options.stacked||void 0===n.options.stacked&&void 0!==i.stack){for(var r=n.getBaseValue(),s=r,l=r,u=0;u<e;u++){var d=a.chart.data.datasets[u],c=a.chart.getDatasetMeta(u);if(c.bar&&c.xAxisID===n.id&&a.chart.isDatasetVisible(u)&&i.stack===c.stack){var h=Number(d.data[t]);h<0?l+=h||0:s+=h||0}}return o<0?n.getPixelForValue(l+o):n.getPixelForValue(s+o)}return n.getPixelForValue(o)},calculateBarY:function(t,e,a){var i=this,n=i.getMeta(),o=i.getScaleForId(n.yAxisID),r=i.getStackIndex(e),s=o.getPixelForValue(null,t,e,i.chart.isCombo);return s-=i.chart.isCombo?a.tickHeight/2:0,s+a.barHeight/2+a.categorySpacing+a.barHeight*r+a.barSpacing/2+a.barSpacing*r}})}},{}],16:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.bubble={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(){return""},label:function(t,e){var a=e.datasets[t.datasetIndex].label||"",i=e.datasets[t.datasetIndex].data[t.index];return a+": ("+t.xLabel+", "+t.yLabel+", "+i.r+")"}}}},t.controllers.bubble=t.DatasetController.extend({dataElementType:t.elements.Point,update:function(t){var a=this,i=a.getMeta(),n=i.data;e.each(n,function(e,i){a.updateElement(e,i,t)})},updateElement:function(a,i,n){var o=this,r=o.getMeta(),s=o.getScaleForId(r.xAxisID),l=o.getScaleForId(r.yAxisID),u=a.custom||{},d=o.getDataset(),c=d.data[i],h=o.chart.options.elements.point,f=o.index;e.extend(a,{_xScale:s,_yScale:l,_datasetIndex:f,_index:i,_model:{x:n?s.getPixelForDecimal(.5):s.getPixelForValue("object"==typeof c?c:NaN,i,f,o.chart.isCombo),y:n?l.getBasePixel():l.getPixelForValue(c,i,f),radius:n?0:u.radius?u.radius:o.getRadius(c),hitRadius:u.hitRadius?u.hitRadius:e.getValueAtIndexOrDefault(d.hitRadius,i,h.hitRadius)}}),t.DatasetController.prototype.removeHoverStyle.call(o,a,h);var g=a._model;g.skip=u.skip?u.skip:isNaN(g.x)||isNaN(g.y),a.pivot()},getRadius:function(t){return t.r||this.chart.options.elements.point.radius},setHoverStyle:function(a){var i=this;t.DatasetController.prototype.setHoverStyle.call(i,a);var n=i.chart.data.datasets[a._datasetIndex],o=a._index,r=a.custom||{},s=a._model;s.radius=r.hoverRadius?r.hoverRadius:e.getValueAtIndexOrDefault(n.hoverRadius,o,i.chart.options.elements.point.hoverRadius)+i.getRadius(n.data[o])},removeHoverStyle:function(e){var a=this;t.DatasetController.prototype.removeHoverStyle.call(a,e,a.chart.options.elements.point);var i=a.chart.data.datasets[e._datasetIndex].data[e._index],n=e.custom||{},o=e._model;o.radius=n.radius?n.radius:a.getRadius(i)}})}},{}],17:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults;a.doughnut={animation:{animateRotate:!0,animateScale:!1},aspectRatio:1,hover:{mode:"single"},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o<i[0].data.length;++o)e.push('<li><span style="background-color:'+i[0].backgroundColor[o]+'"></span>'),n[o]&&e.push(n[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],s=o.data[n],l=s&&s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(r.backgroundColor,n,d.backgroundColor),h=l.borderColor?l.borderColor:u(r.borderColor,n,d.borderColor),f=l.borderWidth?l.borderWidth:u(r.borderWidth,n,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;a<i;++a)n=r.getDatasetMeta(a),n.data[o]&&(n.data[o].hidden=!n.data[o].hidden);r.update()}},cutoutPercentage:50,rotation:Math.PI*-.5,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,a){var i=a.labels[t.index],n=": "+a.datasets[t.datasetIndex].data[t.index];return e.isArray(i)?(i=i.slice(),i[0]+=n):i+=n,i}}}},a.pie=e.clone(a.doughnut),e.extend(a.pie,{cutoutPercentage:0}),t.controllers.doughnut=t.controllers.pie=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,getRingIndex:function(t){for(var e=0,a=0;a<t;++a)this.chart.isDatasetVisible(a)&&++e;return e},update:function(t){var a=this,i=a.chart,n=i.chartArea,o=i.options,r=o.elements.arc,s=n.right-n.left-r.borderWidth,l=n.bottom-n.top-r.borderWidth,u=Math.min(s,l),d={x:0,y:0},c=a.getMeta(),h=o.cutoutPercentage,f=o.circumference;if(f<2*Math.PI){var g=o.rotation%(2*Math.PI);g+=2*Math.PI*(g>=Math.PI?-1:g<-Math.PI?1:0);var p=g+f,m={x:Math.cos(g),y:Math.sin(g)},v={x:Math.cos(p),y:Math.sin(p)},b=g<=0&&0<=p||g<=2*Math.PI&&2*Math.PI<=p,x=g<=.5*Math.PI&&.5*Math.PI<=p||g<=2.5*Math.PI&&2.5*Math.PI<=p,y=g<=-Math.PI&&-Math.PI<=p||g<=Math.PI&&Math.PI<=p,k=g<=.5*-Math.PI&&.5*-Math.PI<=p||g<=1.5*Math.PI&&1.5*Math.PI<=p,S=h/100,M={x:y?-1:Math.min(m.x*(m.x<0?1:S),v.x*(v.x<0?1:S)),y:k?-1:Math.min(m.y*(m.y<0?1:S),v.y*(v.y<0?1:S))},w={x:b?1:Math.max(m.x*(m.x>0?1:S),v.x*(v.x>0?1:S)),y:x?1:Math.max(m.y*(m.y>0?1:S),v.y*(v.y>0?1:S))},C={width:.5*(w.x-M.x),height:.5*(w.y-M.y)};u=Math.min(s/C.width,l/C.height),d={x:(w.x+M.x)*-.5,y:(w.y+M.y)*-.5}}i.borderWidth=a.getMaxBorderWidth(c.data),i.outerRadius=Math.max((u-i.borderWidth)/2,0),i.innerRadius=Math.max(h?i.outerRadius/100*h:0,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),i.offsetX=d.x*i.outerRadius,i.offsetY=d.y*i.outerRadius,c.total=a.calculateTotal(),a.outerRadius=i.outerRadius-i.radiusLength*a.getRingIndex(a.index),a.innerRadius=Math.max(a.outerRadius-i.radiusLength,0),e.each(c.data,function(e,i){a.updateElement(e,i,t)})},updateElement:function(t,a,i){var n=this,o=n.chart,r=o.chartArea,s=o.options,l=s.animation,u=(r.left+r.right)/2,d=(r.top+r.bottom)/2,c=s.rotation,h=s.rotation,f=n.getDataset(),g=i&&l.animateRotate?0:t.hidden?0:n.calculateCircumference(f.data[a])*(s.circumference/(2*Math.PI)),p=i&&l.animateScale?0:n.innerRadius,m=i&&l.animateScale?0:n.outerRadius,v=e.getValueAtIndexOrDefault;e.extend(t,{_datasetIndex:n.index,_index:a,_model:{x:u+o.offsetX,y:d+o.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:m,innerRadius:p,label:v(f.label,a,o.data.labels[a])}});var b=t._model;this.removeHoverStyle(t),i&&l.animateRotate||(0===a?b.startAngle=s.rotation:b.startAngle=n.getMeta().data[a-1]._model.endAngle,b.endAngle=b.startAngle+b.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,a=this.getDataset(),i=this.getMeta(),n=0;return e.each(i.data,function(e,i){t=a.data[i],isNaN(t)||e.hidden||(n+=Math.abs(t))}),n},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,a,i=0,n=this.index,o=t.length,r=0;r<o;r++)e=t[r]._model?t[r]._model.borderWidth:0,a=t[r]._chart?t[r]._chart.config.data.datasets[n].hoverBorderWidth:0,i=e>i?e:i,i=a>i?a:i;return i}})}},{}],18:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return a.getValueOrDefault(t.showLine,e.showLines)}var a=t.helpers;t.defaults.line={showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}},t.controllers.line=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,update:function(t){var i,n,o,r=this,s=r.getMeta(),l=s.dataset,u=s.data||[],d=r.chart.options,c=d.elements.line,h=r.getScaleForId(s.yAxisID),f=r.getDataset(),g=e(f,d);for(g&&(o=l.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),l._scale=h,l._datasetIndex=r.index,l._children=u,l._model={spanGaps:f.spanGaps?f.spanGaps:d.spanGaps,tension:o.tension?o.tension:a.getValueOrDefault(f.lineTension,c.tension),backgroundColor:o.backgroundColor?o.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:o.borderWidth?o.borderWidth:f.borderWidth||c.borderWidth,borderColor:o.borderColor?o.borderColor:f.borderColor||c.borderColor,borderCapStyle:o.borderCapStyle?o.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:o.borderDash?o.borderDash:f.borderDash||c.borderDash,borderDashOffset:o.borderDashOffset?o.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:o.borderJoinStyle?o.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:o.fill?o.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:o.steppedLine?o.steppedLine:a.getValueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:o.cubicInterpolationMode?o.cubicInterpolationMode:a.getValueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode),scaleTop:h.top,scaleBottom:h.bottom,scaleZero:h.getBasePixel()},l.pivot()),i=0,n=u.length;i<n;++i)r.updateElement(u[i],i,t);for(g&&0!==l._model.tension&&r.updateBezierControlPoints(),i=0,n=u.length;i<n;++i)u[i].pivot()},getPointBackgroundColor:function(t,e){var i=this.chart.options.elements.point.backgroundColor,n=this.getDataset(),o=t.custom||{};return o.backgroundColor?i=o.backgroundColor:n.pointBackgroundColor?i=a.getValueAtIndexOrDefault(n.pointBackgroundColor,e,i):n.backgroundColor&&(i=n.backgroundColor),i},getPointBorderColor:function(t,e){var i=this.chart.options.elements.point.borderColor,n=this.getDataset(),o=t.custom||{};return o.borderColor?i=o.borderColor:n.pointBorderColor?i=a.getValueAtIndexOrDefault(n.pointBorderColor,e,i):n.borderColor&&(i=n.borderColor),i},getPointBorderWidth:function(t,e){var i=this.chart.options.elements.point.borderWidth,n=this.getDataset(),o=t.custom||{};return isNaN(o.borderWidth)?isNaN(n.pointBorderWidth)?isNaN(n.borderWidth)||(i=n.borderWidth):i=a.getValueAtIndexOrDefault(n.pointBorderWidth,e,i):i=o.borderWidth,i},updateElement:function(t,e,i){var n,o,r=this,s=r.getMeta(),l=t.custom||{},u=r.getDataset(),d=r.index,c=u.data[e],h=r.getScaleForId(s.yAxisID),f=r.getScaleForId(s.xAxisID),g=r.chart.options.elements.point,p=r.chart.data.labels||[],m=1===p.length||1===u.data.length||r.chart.isCombo;void 0!==u.radius&&void 0===u.pointRadius&&(u.pointRadius=u.radius),void 0!==u.hitRadius&&void 0===u.pointHitRadius&&(u.pointHitRadius=u.hitRadius),n=f.getPixelForValue("object"==typeof c?c:NaN,e,d,m),o=i?h.getBasePixel():r.calculatePointY(c,e,d),t._xScale=f,t._yScale=h,t._datasetIndex=d,t._index=e,t._model={x:n,y:o,skip:l.skip||isNaN(n)||isNaN(o),radius:l.radius||a.getValueAtIndexOrDefault(u.pointRadius,e,g.radius),pointStyle:l.pointStyle||a.getValueAtIndexOrDefault(u.pointStyle,e,g.pointStyle),backgroundColor:r.getPointBackgroundColor(t,e),borderColor:r.getPointBorderColor(t,e),borderWidth:r.getPointBorderWidth(t,e),tension:s.dataset._model?s.dataset._model.tension:0,steppedLine:!!s.dataset._model&&s.dataset._model.steppedLine,hitRadius:l.hitRadius||a.getValueAtIndexOrDefault(u.pointHitRadius,e,g.hitRadius)}},calculatePointY:function(t,e,a){var i,n,o,r=this,s=r.chart,l=r.getMeta(),u=r.getScaleForId(l.yAxisID),d=0,c=0;if(u.options.stacked){for(i=0;i<a;i++)if(n=s.data.datasets[i],o=s.getDatasetMeta(i),"line"===o.type&&o.yAxisID===u.id&&s.isDatasetVisible(i)){var h=Number(u.getRightValue(n.data[e]));h<0?c+=h||0:d+=h||0}var f=Number(u.getRightValue(t));return f<0?u.getPixelForValue(c+f):u.getPixelForValue(d+f)}return u.getPixelForValue(t)},updateBezierControlPoints:function(){function t(t,e,a){return Math.max(Math.min(t,a),e)}var e,i,n,o,r,s=this,l=s.getMeta(),u=s.chart.chartArea,d=l.data||[];if(l.dataset._model.spanGaps&&(d=d.filter(function(t){return!t._model.skip})),"monotone"===l.dataset._model.cubicInterpolationMode)a.splineCurveMonotone(d);else for(e=0,i=d.length;e<i;++e)n=d[e],o=n._model,r=a.splineCurve(a.previousItem(d,e)._model,o,a.nextItem(d,e)._model,l.dataset._model.tension),o.controlPointPreviousX=r.previous.x,o.controlPointPreviousY=r.previous.y,o.controlPointNextX=r.next.x,o.controlPointNextY=r.next.y;if(s.chart.options.elements.line.capBezierPoints)for(e=0,i=d.length;e<i;++e)o=d[e]._model,o.controlPointPreviousX=t(o.controlPointPreviousX,u.left,u.right),o.controlPointPreviousY=t(o.controlPointPreviousY,u.top,u.bottom),o.controlPointNextX=t(o.controlPointNextX,u.left,u.right),o.controlPointNextY=t(o.controlPointNextY,u.top,u.bottom)},draw:function(a){var i,n,o=this,r=o.getMeta(),s=r.data||[],l=a||1;for(i=0,n=s.length;i<n;++i)s[i].transition(l);for(t.canvasHelpers.clipArea(o.chart.chart.ctx,o.chart.chartArea),e(o.getDataset(),o.chart.options)&&r.dataset.transition(l).draw(),t.canvasHelpers.unclipArea(o.chart.chart.ctx),i=0,n=s.length;i<n;++i)s[i].draw(o.chart.chartArea)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model;o.radius=n.hoverRadius||a.getValueAtIndexOrDefault(e.pointHoverRadius,i,this.chart.options.elements.point.hoverRadius),o.backgroundColor=n.hoverBackgroundColor||a.getValueAtIndexOrDefault(e.pointHoverBackgroundColor,i,a.getHoverColor(o.backgroundColor)),o.borderColor=n.hoverBorderColor||a.getValueAtIndexOrDefault(e.pointHoverBorderColor,i,a.getHoverColor(o.borderColor)),o.borderWidth=n.hoverBorderWidth||a.getValueAtIndexOrDefault(e.pointHoverBorderWidth,i,o.borderWidth)},removeHoverStyle:function(t){var e=this,i=e.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},r=t._model;void 0!==i.radius&&void 0===i.pointRadius&&(i.pointRadius=i.radius),r.radius=o.radius||a.getValueAtIndexOrDefault(i.pointRadius,n,e.chart.options.elements.point.radius),r.backgroundColor=e.getPointBackgroundColor(t,n),r.borderColor=e.getPointBorderColor(t,n),r.borderWidth=e.getPointBorderWidth(t,n)}})}},{}],19:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.polarArea={scale:{type:"radialLinear",lineArc:!0,ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,aspectRatio:1,legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o<i[0].data.length;++o)e.push('<li><span style="background-color:'+i[0].backgroundColor[o]+'"></span>'),n[o]&&e.push(n[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],s=o.data[n],l=s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(r.backgroundColor,n,d.backgroundColor),h=l.borderColor?l.borderColor:u(r.borderColor,n,d.borderColor),f=l.borderWidth?l.borderWidth:u(r.borderWidth,n,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;a<i;++a)n=r.getDatasetMeta(a),n.data[o].hidden=!n.data[o].hidden;r.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}},t.controllers.polarArea=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,update:function(t){var a=this,i=a.chart,n=i.chartArea,o=a.getMeta(),r=i.options,s=r.elements.arc,l=Math.min(n.right-n.left,n.bottom-n.top);i.outerRadius=Math.max((l-s.borderWidth/2)/2,0),i.innerRadius=Math.max(r.cutoutPercentage?i.outerRadius/100*r.cutoutPercentage:1,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),a.outerRadius=i.outerRadius-i.radiusLength*a.index,a.innerRadius=a.outerRadius-i.radiusLength,o.count=a.countVisibleElements(),e.each(o.data,function(e,i){a.updateElement(e,i,t)})},updateElement:function(t,a,i){for(var n=this,o=n.chart,r=n.getDataset(),s=o.options,l=s.animation,u=o.scale,d=e.getValueAtIndexOrDefault,c=o.data.labels,h=n.calculateCircumference(r.data[a]),f=u.xCenter,g=u.yCenter,p=0,m=n.getMeta(),v=0;v<a;++v)isNaN(r.data[v])||m.data[v].hidden||++p;var b=s.startAngle,x=t.hidden?0:u.getDistanceFromCenterForValue(r.data[a]),y=b+h*p,k=y+(t.hidden?0:h),S=l.animateScale?0:u.getDistanceFromCenterForValue(r.data[a]);e.extend(t,{_datasetIndex:n.index,_index:a,_scale:u,_model:{x:f,y:g,innerRadius:0,outerRadius:i?S:x,startAngle:i&&l.animateRotate?b:y,endAngle:i&&l.animateRotate?b:k,label:d(c,a,c[a])}}),n.removeHoverStyle(t),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},countVisibleElements:function(){var t=this.getDataset(),a=this.getMeta(),i=0;return e.each(a.data,function(e,a){isNaN(t.data[a])||e.hidden||i++}),i},calculateCircumference:function(t){var e=this.getMeta().count;return e>0&&!isNaN(t)?2*Math.PI/e:0}})}},{}],20:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.radar={aspectRatio:1,scale:{type:"radialLinear"},elements:{line:{tension:0}}},t.controllers.radar=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,linkScales:e.noop,update:function(t){var a=this,i=a.getMeta(),n=i.dataset,o=i.data,r=n.custom||{},s=a.getDataset(),l=a.chart.options.elements.line,u=a.chart.scale;void 0!==s.tension&&void 0===s.lineTension&&(s.lineTension=s.tension),e.extend(i.dataset,{_datasetIndex:a.index,_children:o,_loop:!0,_model:{tension:r.tension?r.tension:e.getValueOrDefault(s.lineTension,l.tension),backgroundColor:r.backgroundColor?r.backgroundColor:s.backgroundColor||l.backgroundColor,borderWidth:r.borderWidth?r.borderWidth:s.borderWidth||l.borderWidth,borderColor:r.borderColor?r.borderColor:s.borderColor||l.borderColor,fill:r.fill?r.fill:void 0!==s.fill?s.fill:l.fill,borderCapStyle:r.borderCapStyle?r.borderCapStyle:s.borderCapStyle||l.borderCapStyle,borderDash:r.borderDash?r.borderDash:s.borderDash||l.borderDash,borderDashOffset:r.borderDashOffset?r.borderDashOffset:s.borderDashOffset||l.borderDashOffset,borderJoinStyle:r.borderJoinStyle?r.borderJoinStyle:s.borderJoinStyle||l.borderJoinStyle,scaleTop:u.top,scaleBottom:u.bottom,scaleZero:u.getBasePosition()}}),i.dataset.pivot(),e.each(o,function(e,i){a.updateElement(e,i,t)},a),a.updateBezierControlPoints()},updateElement:function(t,a,i){var n=this,o=t.custom||{},r=n.getDataset(),s=n.chart.scale,l=n.chart.options.elements.point,u=s.getPointPositionForValue(a,r.data[a]);e.extend(t,{_datasetIndex:n.index,_index:a,_scale:s,_model:{x:i?s.xCenter:u.x,y:i?s.yCenter:u.y,tension:o.tension?o.tension:e.getValueOrDefault(r.lineTension,n.chart.options.elements.line.tension),radius:o.radius?o.radius:e.getValueAtIndexOrDefault(r.pointRadius,a,l.radius),backgroundColor:o.backgroundColor?o.backgroundColor:e.getValueAtIndexOrDefault(r.pointBackgroundColor,a,l.backgroundColor),borderColor:o.borderColor?o.borderColor:e.getValueAtIndexOrDefault(r.pointBorderColor,a,l.borderColor),borderWidth:o.borderWidth?o.borderWidth:e.getValueAtIndexOrDefault(r.pointBorderWidth,a,l.borderWidth),pointStyle:o.pointStyle?o.pointStyle:e.getValueAtIndexOrDefault(r.pointStyle,a,l.pointStyle),hitRadius:o.hitRadius?o.hitRadius:e.getValueAtIndexOrDefault(r.hitRadius,a,l.hitRadius)}}),t._model.skip=o.skip?o.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,a=this.getMeta();e.each(a.data,function(i,n){var o=i._model,r=e.splineCurve(e.previousItem(a.data,n,!0)._model,o,e.nextItem(a.data,n,!0)._model,o.tension);o.controlPointPreviousX=Math.max(Math.min(r.previous.x,t.right),t.left),o.controlPointPreviousY=Math.max(Math.min(r.previous.y,t.bottom),t.top),o.controlPointNextX=Math.max(Math.min(r.next.x,t.right),t.left),o.controlPointNextY=Math.max(Math.min(r.next.y,t.bottom),t.top),i.pivot()})},draw:function(t){var a=this.getMeta(),i=t||1;e.each(a.data,function(t){t.transition(i)}),a.dataset.transition(i).draw(),e.each(a.data,function(t){t.draw()})},setHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model;o.radius=i.hoverRadius?i.hoverRadius:e.getValueAtIndexOrDefault(a.pointHoverRadius,n,this.chart.options.elements.point.hoverRadius),o.backgroundColor=i.hoverBackgroundColor?i.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.pointHoverBackgroundColor,n,e.getHoverColor(o.backgroundColor)),o.borderColor=i.hoverBorderColor?i.hoverBorderColor:e.getValueAtIndexOrDefault(a.pointHoverBorderColor,n,e.getHoverColor(o.borderColor)),o.borderWidth=i.hoverBorderWidth?i.hoverBorderWidth:e.getValueAtIndexOrDefault(a.pointHoverBorderWidth,n,o.borderWidth)},removeHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model,r=this.chart.options.elements.point;o.radius=i.radius?i.radius:e.getValueAtIndexOrDefault(a.radius,n,r.radius),o.backgroundColor=i.backgroundColor?i.backgroundColor:e.getValueAtIndexOrDefault(a.pointBackgroundColor,n,r.backgroundColor),o.borderColor=i.borderColor?i.borderColor:e.getValueAtIndexOrDefault(a.pointBorderColor,n,r.borderColor),o.borderWidth=i.borderWidth?i.borderWidth:e.getValueAtIndexOrDefault(a.pointBorderWidth,n,r.borderWidth)}})}},{}],21:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.animation={duration:1e3,easing:"easeOutQuart",onProgress:e.noop,onComplete:e.noop},t.Animation=t.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,a,i){var n=this;i||(t.animating=!0);for(var o=0;o<n.animations.length;++o)if(n.animations[o].chartInstance===t)return void(n.animations[o].animationObject=e);n.animations.push({chartInstance:t,animationObject:e}),1===n.animations.length&&n.requestAnimationFrame()},cancelAnimation:function(t){var a=e.findIndex(this.animations,function(e){return e.chartInstance===t});a!==-1&&(this.animations.splice(a,1),t.animating=!1)},requestAnimationFrame:function(){var t=this;null===t.request&&(t.request=e.requestAnimFrame.call(window,function(){t.request=null,t.startDigest()}))},startDigest:function(){var t=this,e=Date.now(),a=0;t.dropFrames>1&&(a=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1);for(var i=0;i<t.animations.length;)null===t.animations[i].animationObject.currentStep&&(t.animations[i].animationObject.currentStep=0),t.animations[i].animationObject.currentStep+=1+a,t.animations[i].animationObject.currentStep>t.animations[i].animationObject.numSteps&&(t.animations[i].animationObject.currentStep=t.animations[i].animationObject.numSteps),t.animations[i].animationObject.render(t.animations[i].chartInstance,t.animations[i].animationObject),t.animations[i].animationObject.onAnimationProgress&&t.animations[i].animationObject.onAnimationProgress.call&&t.animations[i].animationObject.onAnimationProgress.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].animationObject.currentStep===t.animations[i].animationObject.numSteps?(t.animations[i].animationObject.onAnimationComplete&&t.animations[i].animationObject.onAnimationComplete.call&&t.animations[i].animationObject.onAnimationComplete.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].chartInstance.animating=!1,t.animations.splice(i,1)):++i;var n=Date.now(),o=(n-e)/t.frameDuration;t.dropFrames+=o,t.animations.length>0&&t.requestAnimationFrame()}}}},{}],22:[function(t,e,a){"use strict";e.exports=function(t){var e=t.canvasHelpers={};e.drawPoint=function(e,a,i,n,o){var r,s,l,u,d,c;if("object"==typeof a&&(r=a.toString(),"[object HTMLImageElement]"===r||"[object HTMLCanvasElement]"===r))return void e.drawImage(a,n-a.width/2,o-a.height/2);if(!(isNaN(i)||i<=0)){switch(a){default:e.beginPath(),e.arc(n,o,i,0,2*Math.PI),e.closePath(),e.fill();break;case"triangle":e.beginPath(),s=3*i/Math.sqrt(3),d=s*Math.sqrt(3)/2,e.moveTo(n-s/2,o+d/3),e.lineTo(n+s/2,o+d/3),e.lineTo(n,o-2*d/3),e.closePath(),e.fill();break;case"rect":c=1/Math.SQRT2*i,e.beginPath(),e.fillRect(n-c,o-c,2*c,2*c),e.strokeRect(n-c,o-c,2*c,2*c);break;case"rectRounded":var h=i/Math.SQRT2,f=n-h,g=o-h,p=Math.SQRT2*i;t.helpers.drawRoundedRectangle(e,f,g,p,p,i/2),e.fill();break;case"rectRot":c=1/Math.SQRT2*i,e.beginPath(),e.moveTo(n-c,o),e.lineTo(n,o+c),e.lineTo(n+c,o),e.lineTo(n,o-c),e.closePath(),e.fill();break;case"cross":e.beginPath(),e.moveTo(n,o+i),e.lineTo(n,o-i),e.moveTo(n-i,o),e.lineTo(n+i,o),e.closePath();break;case"crossRot":e.beginPath(),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(n-l,o-u),e.lineTo(n+l,o+u),e.moveTo(n-l,o+u),e.lineTo(n+l,o-u),e.closePath();break;case"star":e.beginPath(),e.moveTo(n,o+i),e.lineTo(n,o-i),e.moveTo(n-i,o),e.lineTo(n+i,o),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(n-l,o-u),e.lineTo(n+l,o+u),e.moveTo(n-l,o+u),e.lineTo(n+l,o-u),e.closePath();break;case"line":e.beginPath(),e.moveTo(n-i,o),e.lineTo(n+i,o),e.closePath();break;case"dash":e.beginPath(),e.moveTo(n,o),e.lineTo(n+i,o),e.closePath()}e.stroke()}},e.clipArea=function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},e.unclipArea=function(t){t.restore()}}},{}],23:[function(t,e,a){"use strict";e.exports=function(t){function e(e){e=e||{};var a=e.data=e.data||{};return a.datasets=a.datasets||[],a.labels=a.labels||[],e.options=i.configMerge(t.defaults.global,t.defaults[e.type],e.options||{}),e}function a(t){var e=t.options;e.scale?t.scale.options=e.scale:e.scales&&e.scales.xAxes.concat(e.scales.yAxes).forEach(function(e){t.scales[e.id].options=e}),t.tooltip._options=e.tooltips}var i=t.helpers,n=t.plugins,o=t.platform;t.types={},t.instances={},t.controllers={},t.Controller=function(a,n,r){var s=this;n=e(n);var l=o.acquireContext(a,n),u=l&&l.canvas,d=u&&u.height,c=u&&u.width;return r.ctx=l,r.canvas=u,r.config=n,r.width=c,r.height=d,r.aspectRatio=d?c/d:null,s.id=i.uid(),s.chart=r,s.config=n,s.options=n.options,s._bufferedRender=!1,t.instances[s.id]=s,Object.defineProperty(s,"data",{get:function(){return s.config.data}}),l&&u?(s.initialize(),s.update(),s):(console.error("Failed to create chart: can't acquire context from the given item"),s)},i.extend(t.Controller.prototype,{initialize:function(){var t=this;return n.notify(t,"beforeInit"),i.retinaScale(t.chart),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildScales(),t.initToolTip(),n.notify(t,"afterInit"),t},clear:function(){return i.clear(this.chart),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(t){var e=this,a=e.chart,o=e.options,r=a.canvas,s=o.maintainAspectRatio&&a.aspectRatio||null,l=Math.floor(i.getMaximumWidth(r)),u=Math.floor(s?l/s:i.getMaximumHeight(r));if((a.width!==l||a.height!==u)&&(r.width=a.width=l,r.height=a.height=u,r.style.width=l+"px",r.style.height=u+"px",i.retinaScale(a),!t)){var d={width:l,height:u};n.notify(e,"resize",[d]),e.options.onResize&&e.options.onResize(e,d),e.stop(),e.update(e.options.responsiveAnimationDuration)}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},a=t.scale;i.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),i.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),a&&(a.id=a.id||"scale")},buildScales:function(){var e=this,a=e.options,n=e.scales={},o=[];a.scales&&(o=o.concat((a.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category"}}),(a.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear"}}))),a.scale&&o.push({options:a.scale,dtype:"radialLinear",isDefault:!0}),i.each(o,function(a){var o=a.options,r=i.getValueOrDefault(o.type,a.dtype),s=t.scaleService.getScaleConstructor(r);if(s){var l=new s({id:o.id,options:o,ctx:e.chart.ctx,chart:e});n[l.id]=l,a.isDefault&&(e.scale=l)}}),t.scaleService.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e=this,a=[],n=[];if(i.each(e.data.datasets,function(i,o){var r=e.getDatasetMeta(o);r.type||(r.type=i.type||e.config.type),a.push(r.type),r.controller?r.controller.updateIndex(o):(r.controller=new t.controllers[r.type](e,o),n.push(r.controller))},e),a.length>1)for(var o=1;o<a.length;o++)if(a[o]!==a[o-1]){e.isCombo=!0;break}return n},resetElements:function(){var t=this;i.each(t.data.datasets,function(e,a){t.getDatasetMeta(a).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t,e){var o=this;if(a(o),n.notify(o,"beforeUpdate")!==!1){o.tooltip._data=o.data;var r=o.buildOrUpdateControllers();i.each(o.data.datasets,function(t,e){o.getDatasetMeta(e).controller.buildOrUpdateElements()},o),o.updateLayout(),i.each(r,function(t){t.reset()}),o.updateDatasets(),n.notify(o,"afterUpdate"),o._bufferedRender?o._bufferedRequest={lazy:e,duration:t}:o.render(t,e)}},updateLayout:function(){var e=this;n.notify(e,"beforeLayout")!==!1&&(t.layoutService.update(this,this.chart.width,this.chart.height),n.notify(e,"afterScaleUpdate"),n.notify(e,"afterLayout"))},updateDatasets:function(){var t=this;if(n.notify(t,"beforeDatasetsUpdate")!==!1){for(var e=0,a=t.data.datasets.length;e<a;++e)t.getDatasetMeta(e).controller.update();n.notify(t,"afterDatasetsUpdate")}},render:function(e,a){var o=this;if(n.notify(o,"beforeRender")!==!1){var r=o.options.animation,s=function(){n.notify(o,"afterRender");var t=r&&r.onComplete;t&&t.call&&t.call(o)};if(r&&("undefined"!=typeof e&&0!==e||"undefined"==typeof e&&0!==r.duration)){var l=new t.Animation;l.numSteps=(e||r.duration)/16.66,l.easing=r.easing,l.render=function(t,e){var a=i.easingEffects[e.easing],n=e.currentStep/e.numSteps,o=a(n);t.draw(o,n,e.currentStep)},l.onAnimationProgress=r.onProgress,l.onAnimationComplete=s,t.animationService.addAnimation(o,l,e,a)}else o.draw(),s();return o}},draw:function(t){var e=this;e.clear(),void 0!==t&&null!==t||(t=1),n.notify(e,"beforeDraw",[t])!==!1&&(i.each(e.boxes,function(t){t.draw(e.chartArea)},e),e.scale&&e.scale.draw(),e.drawDatasets(t),e.tooltip.transition(t).draw(),n.notify(e,"afterDraw",[t]))},drawDatasets:function(t){var e=this;n.notify(e,"beforeDatasetsDraw",[t])!==!1&&(i.each(e.data.datasets,function(a,i){e.isDatasetVisible(i)&&e.getDatasetMeta(i).controller.draw(t)},e,!0),n.notify(e,"afterDatasetsDraw",[t]))},getElementAtEvent:function(e){return t.Interaction.modes.single(this,e)},getElementsAtEvent:function(e){return t.Interaction.modes.label(this,e,{intersect:!0})},getElementsAtXAxis:function(e){return t.Interaction.modes["x-axis"](this,e,{intersect:!0})},getElementsAtEventForMode:function(e,a,i){
12
+ var n=t.Interaction.modes[a];return"function"==typeof n?n(this,e,i):[]},getDatasetAtEvent:function(e){return t.Interaction.modes.dataset(this,e,{intersect:!0})},getDatasetMeta:function(t){var e=this,a=e.data.datasets[t];a._meta||(a._meta={});var i=a._meta[e.id];return i||(i=a._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,a=this.data.datasets.length;e<a;++e)this.isDatasetVisible(e)&&t++;return t},isDatasetVisible:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroy:function(){var e,a,r,s=this,l=s.chart.canvas;for(s.stop(),a=0,r=s.data.datasets.length;a<r;++a)e=s.getDatasetMeta(a),e.controller&&(e.controller.destroy(),e.controller=null);l&&(s.unbindEvents(),i.clear(s.chart),o.releaseContext(s.chart.ctx),s.chart.canvas=null,s.chart.ctx=null),n.notify(s,"destroy"),delete t.instances[s.id]},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)},initToolTip:function(){var e=this;e.tooltip=new t.Tooltip({_chart:e.chart,_chartInstance:e,_data:e.data,_options:e.options.tooltips},e),e.tooltip.initialize()},bindEvents:function(){var t=this,e=t._listeners={},a=function(){t.eventHandler.apply(t,arguments)};i.each(t.options.events,function(i){o.addEventListener(t,i,a),e[i]=a}),t.options.responsive&&(a=function(){t.resize()},o.addEventListener(t,"resize",a),e.resize=a)},unbindEvents:function(){var t=this,e=t._listeners;e&&(delete t._listeners,i.each(e,function(e,a){o.removeEventListener(t,a,e)}))},updateHoverStyle:function(t,e,a){var i,n,o,r=a?"setHoverStyle":"removeHoverStyle";for(n=0,o=t.length;n<o;++n)i=t[n],i&&this.getDatasetMeta(i._datasetIndex).controller[r](i)},eventHandler:function(t){var e=this,a=e.tooltip;if(n.notify(e,"beforeEvent",[t])!==!1){e._bufferedRender=!0,e._bufferedRequest=null;var i=e.handleEvent(t);i|=a&&a.handleEvent(t),n.notify(e,"afterEvent",[t]);var o=e._bufferedRequest;return o?e.render(o.duration,o.lazy):i&&!e.animating&&(e.stop(),e.render(e.options.hover.animationDuration,!0)),e._bufferedRender=!1,e._bufferedRequest=null,e}},handleEvent:function(t){var e=this,a=e.options||{},n=a.hover,o=!1;return e.lastActive=e.lastActive||[],"mouseout"===t.type?e.active=[]:e.active=e.getElementsAtEventForMode(t,n.mode,n),n.onHover&&n.onHover.call(e,t.native,e.active),"mouseup"!==t.type&&"click"!==t.type||a.onClick&&a.onClick.call(e,t.native,e.active),e.lastActive.length&&e.updateHoverStyle(e.lastActive,n.mode,!1),e.active.length&&n.mode&&e.updateHoverStyle(e.active,n.mode,!0),o=!i.arrayEquals(e.active,e.lastActive),e.lastActive=e.active,o}})}},{}],24:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t._chartjs?void t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),void n.forEach(function(e){var a="onData"+e.charAt(0).toUpperCase()+e.slice(1),n=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),o=n.apply(this,e);return i.each(t._chartjs.listeners,function(t){"function"==typeof t[a]&&t[a].apply(t,e)}),o}})}))}function a(t,e){var a=t._chartjs;if(a){var i=a.listeners,o=i.indexOf(e);o!==-1&&i.splice(o,1),i.length>0||(n.forEach(function(e){delete t[e]}),delete t._chartjs)}}var i=t.helpers,n=["push","pop","shift","splice","unshift"];t.DatasetController=function(t,e){this.initialize(t,e)},i.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var a=this;a.chart=t,a.index=e,a.linkScales(),a.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),a=t.getDataset();null===e.xAxisID&&(e.xAxisID=a.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=a.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},destroy:function(){this._data&&a(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,a=e.dataElementType;return a&&new a({_chart:e.chart.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,a=this,i=a.getMeta(),n=a.getDataset().data||[],o=i.data;for(t=0,e=n.length;t<e;++t)o[t]=o[t]||a.createMetaData(t);i.dataset=i.dataset||a.createMetaDataset()},addElementAndReset:function(t){var e=this.createMetaData(t);this.getMeta().data.splice(t,0,e),this.updateElement(e,t,!0)},buildOrUpdateElements:function(){var t=this,i=t.getDataset(),n=i.data||(i.data=[]);t._data!==n&&(t._data&&a(t._data,t),e(n,t),t._data=n),t.resyncElements()},update:i.noop,draw:function(t){var e,a,i=t||1,n=this.getMeta().data;for(e=0,a=n.length;e<a;++e)n[e].transition(i).draw()},removeHoverStyle:function(t,e){var a=this.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},r=i.getValueAtIndexOrDefault,s=t._model;s.backgroundColor=o.backgroundColor?o.backgroundColor:r(a.backgroundColor,n,e.backgroundColor),s.borderColor=o.borderColor?o.borderColor:r(a.borderColor,n,e.borderColor),s.borderWidth=o.borderWidth?o.borderWidth:r(a.borderWidth,n,e.borderWidth)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],a=t._index,n=t.custom||{},o=i.getValueAtIndexOrDefault,r=i.getHoverColor,s=t._model;s.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:o(e.hoverBackgroundColor,a,r(s.backgroundColor)),s.borderColor=n.hoverBorderColor?n.hoverBorderColor:o(e.hoverBorderColor,a,r(s.borderColor)),s.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:o(e.hoverBorderWidth,a,s.borderWidth)},resyncElements:function(){var t=this,e=t.getMeta(),a=t.getDataset().data,i=e.data.length,n=a.length;n<i?e.data.splice(n,i-n):n>i&&t.insertElements(i,n-i)},insertElements:function(t,e){for(var a=0;a<e;++a)this.addElementAndReset(t+a)},onDataPush:function(){this.insertElements(this.getDataset().data.length-1,arguments.length)},onDataPop:function(){this.getMeta().data.pop()},onDataShift:function(){this.getMeta().data.shift()},onDataSplice:function(t,e){this.getMeta().data.splice(t,e),this.insertElements(t,arguments.length-2)},onDataUnshift:function(){this.insertElements(0,arguments.length)}}),t.DatasetController.extend=i.inherits}},{}],25:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.elements={},t.Element=function(t){e.extend(this,t),this.initialize.apply(this,arguments)},e.extend(t.Element.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=e.clone(t._model)),t._start=e.clone(t._view),t},transition:function(t){var a=this;return a._view||(a._view=e.clone(a._model)),1===t?(a._view=a._model,a._start=null,a):(a._start||a.pivot(),e.each(a._model,function(i,n){if("_"===n[0]);else if(a._view.hasOwnProperty(n))if(i===a._view[n]);else if("string"==typeof i)try{var o=e.color(a._model[n]).mix(e.color(a._start[n]),t);a._view[n]=o.rgbString()}catch(t){a._view[n]=i}else if("number"==typeof i){var r=void 0!==a._start[n]&&isNaN(a._start[n])===!1?a._start[n]:0;a._view[n]=(a._model[n]-r)*t+r}else a._view[n]=i;else"number"!=typeof i||isNaN(a._view[n])?a._view[n]=i:a._view[n]=i*t},a),a)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return e.isNumber(this._model.x)&&e.isNumber(this._model.y)}}),t.Element.extend=e.inherits}},{}],26:[function(t,e,a){"use strict";var i=t(3);e.exports=function(t){function e(t,e,a){var i;return"string"==typeof t?(i=parseInt(t,10),t.indexOf("%")!==-1&&(i=i/100*e.parentNode[a])):i=t,i}function a(t){return void 0!==t&&null!==t&&"none"!==t}function n(t,i,n){var o=document.defaultView,r=t.parentNode,s=o.getComputedStyle(t)[i],l=o.getComputedStyle(r)[i],u=a(s),d=a(l),c=Number.POSITIVE_INFINITY;return u||d?Math.min(u?e(s,t,n):c,d?e(l,r,n):c):"none"}var o=t.helpers={};o.each=function(t,e,a,i){var n,r;if(o.isArray(t))if(r=t.length,i)for(n=r-1;n>=0;n--)e.call(a,t[n],n);else for(n=0;n<r;n++)e.call(a,t[n],n);else if("object"==typeof t){var s=Object.keys(t);for(r=s.length,n=0;n<r;n++)e.call(a,t[s[n]],s[n])}},o.clone=function(t){var e={};return o.each(t,function(t,a){o.isArray(t)?e[a]=t.slice(0):"object"==typeof t&&null!==t?e[a]=o.clone(t):e[a]=t}),e},o.extend=function(t){for(var e=function(e,a){t[a]=e},a=1,i=arguments.length;a<i;a++)o.each(arguments[a],e);return t},o.configMerge=function(e){var a=o.clone(e);return o.each(Array.prototype.slice.call(arguments,1),function(e){o.each(e,function(e,i){var n=a.hasOwnProperty(i),r=n?a[i]:{};"scales"===i?a[i]=o.scaleMerge(r,e):"scale"===i?a[i]=o.configMerge(r,t.scaleService.getScaleDefaults(e.type),e):!n||"object"!=typeof r||o.isArray(r)||null===r||"object"!=typeof e||o.isArray(e)?a[i]=e:a[i]=o.configMerge(r,e)})}),a},o.scaleMerge=function(e,a){var i=o.clone(e);return o.each(a,function(e,a){"xAxes"===a||"yAxes"===a?i.hasOwnProperty(a)?o.each(e,function(e,n){var r=o.getValueOrDefault(e.type,"xAxes"===a?"category":"linear"),s=t.scaleService.getScaleDefaults(r);n>=i[a].length||!i[a][n].type?i[a].push(o.configMerge(s,e)):e.type&&e.type!==i[a][n].type?i[a][n]=o.configMerge(i[a][n],s,e):i[a][n]=o.configMerge(i[a][n],e)}):(i[a]=[],o.each(e,function(e){var n=o.getValueOrDefault(e.type,"xAxes"===a?"category":"linear");i[a].push(o.configMerge(t.scaleService.getScaleDefaults(n),e))})):i.hasOwnProperty(a)&&"object"==typeof i[a]&&null!==i[a]&&"object"==typeof e?i[a]=o.configMerge(i[a],e):i[a]=e}),i},o.getValueAtIndexOrDefault=function(t,e,a){return void 0===t||null===t?a:o.isArray(t)?e<t.length?t[e]:a:t},o.getValueOrDefault=function(t,e){return void 0===t?e:t},o.indexOf=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var a=0,i=t.length;a<i;++a)if(t[a]===e)return a;return-1},o.where=function(t,e){if(o.isArray(t)&&Array.prototype.filter)return t.filter(e);var a=[];return o.each(t,function(t){e(t)&&a.push(t)}),a},o.findIndex=Array.prototype.findIndex?function(t,e,a){return t.findIndex(e,a)}:function(t,e,a){a=void 0===a?t:a;for(var i=0,n=t.length;i<n;++i)if(e.call(a,t[i],i,t))return i;return-1},o.findNextWhere=function(t,e,a){void 0!==a&&null!==a||(a=-1);for(var i=a+1;i<t.length;i++){var n=t[i];if(e(n))return n}},o.findPreviousWhere=function(t,e,a){void 0!==a&&null!==a||(a=t.length);for(var i=a-1;i>=0;i--){var n=t[i];if(e(n))return n}},o.inherits=function(t){var e=this,a=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},i=function(){this.constructor=a};return i.prototype=e.prototype,a.prototype=new i,a.extend=o.inherits,t&&o.extend(a.prototype,t),a.__super__=e.prototype,a},o.noop=function(){},o.uid=function(){var t=0;return function(){return t++}}(),o.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},o.almostEquals=function(t,e,a){return Math.abs(t-e)<a},o.almostWhole=function(t,e){var a=Math.round(t);return a-e<t&&a+e>t},o.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},o.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},o.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},o.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},o.toRadians=function(t){return t*(Math.PI/180)},o.toDegrees=function(t){return t*(180/Math.PI)},o.getAngleFromPoint=function(t,e){var a=e.x-t.x,i=e.y-t.y,n=Math.sqrt(a*a+i*i),o=Math.atan2(i,a);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:n}},o.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},o.aliasPixel=function(t){return t%2===0?0:.5},o.splineCurve=function(t,e,a,i){var n=t.skip?e:t,o=e,r=a.skip?e:a,s=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),l=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2)),u=s/(s+l),d=l/(s+l);u=isNaN(u)?0:u,d=isNaN(d)?0:d;var c=i*u,h=i*d;return{previous:{x:o.x-c*(r.x-n.x),y:o.y-c*(r.y-n.y)},next:{x:o.x+h*(r.x-n.x),y:o.y+h*(r.y-n.y)}}},o.EPSILON=Number.EPSILON||1e-14,o.splineCurveMonotone=function(t){var e,a,i,n,r=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),s=r.length;for(e=0;e<s;++e)if(i=r[e],!i.model.skip){if(a=e>0?r[e-1]:null,n=e<s-1?r[e+1]:null,n&&!n.model.skip){var l=n.model.x-i.model.x;i.deltaK=0!==l?(n.model.y-i.model.y)/l:0}!a||a.model.skip?i.mK=i.deltaK:!n||n.model.skip?i.mK=a.deltaK:this.sign(a.deltaK)!==this.sign(i.deltaK)?i.mK=0:i.mK=(a.deltaK+i.deltaK)/2}var u,d,c,h;for(e=0;e<s-1;++e)i=r[e],n=r[e+1],i.model.skip||n.model.skip||(o.almostEquals(i.deltaK,0,this.EPSILON)?i.mK=n.mK=0:(u=i.mK/i.deltaK,d=n.mK/i.deltaK,h=Math.pow(u,2)+Math.pow(d,2),h<=9||(c=3/Math.sqrt(h),i.mK=u*c*i.deltaK,n.mK=d*c*i.deltaK)));var f;for(e=0;e<s;++e)i=r[e],i.model.skip||(a=e>0?r[e-1]:null,n=e<s-1?r[e+1]:null,a&&!a.model.skip&&(f=(i.model.x-a.model.x)/3,i.model.controlPointPreviousX=i.model.x-f,i.model.controlPointPreviousY=i.model.y-f*i.mK),n&&!n.model.skip&&(f=(n.model.x-i.model.x)/3,i.model.controlPointNextX=i.model.x+f,i.model.controlPointNextY=i.model.y+f*i.mK))},o.nextItem=function(t,e,a){return a?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},o.previousItem=function(t,e,a){return a?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},o.niceNum=function(t,e){var a,i=Math.floor(o.log10(t)),n=t/Math.pow(10,i);return a=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,a*Math.pow(10,i)};var r=o.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:1===(t/=1)?1:(a||(a=.3),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),-(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)))},easeOutElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:1===(t/=1)?1:(a||(a=.3),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((1*t-e)*(2*Math.PI)/a)+1)},easeInOutElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:2===(t/=.5)?1:(a||(a=1*(.3*1.5)),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),t<1?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)):i*Math.pow(2,-10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)*.5+1)},easeInBack:function(t){var e=1.70158;return 1*(t/=1)*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return 1*((t=t/1-1)*t*((e+1)*t+e)+1)},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:function(t){return 1-r.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?1*(7.5625*t*t):t<2/2.75?1*(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return t<.5?.5*r.easeInBounce(2*t):.5*r.easeOutBounce(2*t-1)+.5}};o.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),o.getRelativePosition=function(t,e){var a,i,n=t.originalEvent||t,r=t.currentTarget||t.srcElement,s=r.getBoundingClientRect(),l=n.touches;l&&l.length>0?(a=l[0].clientX,i=l[0].clientY):(a=n.clientX,i=n.clientY);var u=parseFloat(o.getStyle(r,"padding-left")),d=parseFloat(o.getStyle(r,"padding-top")),c=parseFloat(o.getStyle(r,"padding-right")),h=parseFloat(o.getStyle(r,"padding-bottom")),f=s.right-s.left-u-c,g=s.bottom-s.top-d-h;return a=Math.round((a-s.left-u)/f*r.width/e.currentDevicePixelRatio),i=Math.round((i-s.top-d)/g*r.height/e.currentDevicePixelRatio),{x:a,y:i}},o.addEvent=function(t,e,a){t.addEventListener?t.addEventListener(e,a):t.attachEvent?t.attachEvent("on"+e,a):t["on"+e]=a},o.removeEvent=function(t,e,a){t.removeEventListener?t.removeEventListener(e,a,!1):t.detachEvent?t.detachEvent("on"+e,a):t["on"+e]=o.noop},o.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},o.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},o.getMaximumWidth=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-left"),10),i=parseInt(o.getStyle(e,"padding-right"),10),n=e.clientWidth-a-i,r=o.getConstraintWidth(t);return isNaN(r)?n:Math.min(n,r)},o.getMaximumHeight=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-top"),10),i=parseInt(o.getStyle(e,"padding-bottom"),10),n=e.clientHeight-a-i,r=o.getConstraintHeight(t);return isNaN(r)?n:Math.min(n,r)},o.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},o.retinaScale=function(t){var e=t.currentDevicePixelRatio=window.devicePixelRatio||1;if(1!==e){var a=t.canvas,i=t.height,n=t.width;a.height=i*e,a.width=n*e,t.ctx.scale(e,e),a.style.height=i+"px",a.style.width=n+"px"}},o.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},o.fontString=function(t,e,a){return e+" "+t+"px "+a},o.longestText=function(t,e,a,i){i=i||{};var n=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(n=i.data={},r=i.garbageCollect=[],i.font=e),t.font=e;var s=0;o.each(a,function(e){void 0!==e&&null!==e&&o.isArray(e)!==!0?s=o.measureText(t,n,r,s,e):o.isArray(e)&&o.each(e,function(e){void 0===e||null===e||o.isArray(e)||(s=o.measureText(t,n,r,s,e))})});var l=r.length/2;if(l>a.length){for(var u=0;u<l;u++)delete n[r[u]];r.splice(0,l)}return s},o.measureText=function(t,e,a,i,n){var o=e[n];return o||(o=e[n]=t.measureText(n).width,a.push(n)),o>i&&(i=o),i},o.numberOfLabelLines=function(t){var e=1;return o.each(t,function(t){o.isArray(t)&&t.length>e&&(e=t.length)}),e},o.drawRoundedRectangle=function(t,e,a,i,n,o){t.beginPath(),t.moveTo(e+o,a),t.lineTo(e+i-o,a),t.quadraticCurveTo(e+i,a,e+i,a+o),t.lineTo(e+i,a+n-o),t.quadraticCurveTo(e+i,a+n,e+i-o,a+n),t.lineTo(e+o,a+n),t.quadraticCurveTo(e,a+n,e,a+n-o),t.lineTo(e,a+o),t.quadraticCurveTo(e,a,e+o,a),t.closePath()},o.color=function(e){return i?i(e instanceof CanvasGradient?t.defaults.global.defaultColor:e):(console.error("Color.js not found!"),e)},o.isArray=Array.isArray?function(t){return Array.isArray(t)}:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.arrayEquals=function(t,e){var a,i,n,r;if(!t||!e||t.length!==e.length)return!1;for(a=0,i=t.length;a<i;++a)if(n=t[a],r=e[a],n instanceof Array&&r instanceof Array){if(!o.arrayEquals(n,r))return!1}else if(n!==r)return!1;return!0},o.callCallback=function(t,e,a){t&&"function"==typeof t.call&&t.apply(a,e)},o.getHoverColor=function(t){return t instanceof CanvasPattern?t:o.color(t).saturate(.5).darken(.1).rgbString()}}},{3:3}],27:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t.native?{x:t.x,y:t.y}:r.getRelativePosition(t,e)}function a(t,e){var a,i,n,o,r,s=t.data.datasets;for(i=0,o=s.length;i<o;++i)if(t.isDatasetVisible(i))for(a=t.getDatasetMeta(i),n=0,r=a.data.length;n<r;++n){var l=a.data[n];l._view.skip||e(l)}}function i(t,e){var i=[];return a(t,function(t){t.inRange(e.x,e.y)&&i.push(t)}),i}function n(t,e,i,n){var o=Number.POSITIVE_INFINITY,s=[];return n||(n=r.distanceBetweenPoints),a(t,function(t){if(!i||t.inRange(e.x,e.y)){var a=t.getCenterPoint(),r=n(e,a);r<o?(s=[t],o=r):r===o&&s.push(t)}}),s}function o(t,a,o){var r=e(a,t.chart),s=function(t,e){return Math.abs(t.x-e.x)},l=o.intersect?i(t,r):n(t,r,!1,s),u=[];return l.length?(t.data.datasets.forEach(function(e,a){if(t.isDatasetVisible(a)){var i=t.getDatasetMeta(a),n=i.data[l[0]._index];n&&!n._view.skip&&u.push(n)}}),u):[]}var r=t.helpers;t.Interaction={modes:{single:function(t,i){var n=e(i,t.chart),o=[];return a(t,function(t){if(t.inRange(n.x,n.y))return o.push(t),o}),o.slice(0,1)},label:o,index:o,dataset:function(t,a,o){var r=e(a,t.chart),s=o.intersect?i(t,r):n(t,r,!1);return s.length>0&&(s=t.getDatasetMeta(s[0]._datasetIndex).data),s},"x-axis":function(t,e){return o(t,e,!0)},point:function(t,a){var n=e(a,t.chart);return i(t,n)},nearest:function(t,a,i){var o=e(a,t.chart),r=n(t,o,i.intersect);return r.length>1&&r.sort(function(t,e){var a=t.getArea(),i=e.getArea(),n=a-i;return 0===n&&(n=t._datasetIndex-e._datasetIndex),n}),r.slice(0,1)},x:function(t,i,n){var o=e(i,t.chart),r=[],s=!1;return a(t,function(t){t.inXRange(o.x)&&r.push(t),t.inRange(o.x,o.y)&&(s=!0)}),n.intersect&&!s&&(r=[]),r},y:function(t,i,n){var o=e(i,t.chart),r=[],s=!1;return a(t,function(t){t.inYRange(o.y)&&r.push(t),t.inRange(o.x,o.y)&&(s=!0)}),n.intersect&&!s&&(r=[]),r}}}}},{}],28:[function(t,e,a){"use strict";e.exports=function(){var t=function(e,a){return this.controller=new t.Controller(e,a,this),this.controller};return t.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var a=0;a<t.data.datasets.length;a++)e.push('<li><span style="background-color:'+t.data.datasets[a].backgroundColor+'"></span>'),t.data.datasets[a].label&&e.push(t.data.datasets[a].label),e.push("</li>");return e.push("</ul>"),e.join("")}}},t.Chart=t,t}},{}],29:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),t.boxes.push(e)},removeBox:function(t,e){t.boxes&&t.boxes.splice(t.boxes.indexOf(e),1)},update:function(t,a,i){function n(t){var e,a=t.isHorizontal();a?(e=t.update(t.options.fullWidth?x:C,w),I-=e.height):(e=t.update(M,S),C-=e.width),D.push({horizontal:a,minSize:e,box:t})}function o(t){var a=e.findNextWhere(D,function(e){return e.box===t});if(a)if(t.isHorizontal()){var i={left:Math.max(F,A),right:Math.max(V,T),top:0,bottom:0};t.update(t.options.fullWidth?x:C,y/2,i)}else t.update(a.minSize.width,I)}function r(t){var a=e.findNextWhere(D,function(e){return e.box===t}),i={left:0,right:0,top:R,bottom:O};a&&t.update(a.minSize.width,I,i)}function s(t){t.isHorizontal()?(t.left=t.options.fullWidth?d:F,t.right=t.options.fullWidth?a-c:F+C,t.top=E,t.bottom=E+t.height,E=t.bottom):(t.left=N,t.right=N+t.width,t.top=R,t.bottom=R+I,N=t.right)}if(t){var l=t.options.layout,u=l?l.padding:null,d=0,c=0,h=0,f=0;isNaN(u)?(d=u.left||0,c=u.right||0,h=u.top||0,f=u.bottom||0):(d=u,c=u,h=u,f=u);var g=e.where(t.boxes,function(t){return"left"===t.options.position}),p=e.where(t.boxes,function(t){return"right"===t.options.position}),m=e.where(t.boxes,function(t){return"top"===t.options.position}),v=e.where(t.boxes,function(t){return"bottom"===t.options.position}),b=e.where(t.boxes,function(t){return"chartArea"===t.options.position});m.sort(function(t,e){return(e.options.fullWidth?1:0)-(t.options.fullWidth?1:0)}),v.sort(function(t,e){return(t.options.fullWidth?1:0)-(e.options.fullWidth?1:0)});var x=a-d-c,y=i-h-f,k=x/2,S=y/2,M=(a-k)/(g.length+p.length),w=(i-S)/(m.length+v.length),C=x,I=y,D=[];e.each(g.concat(p,m,v),n);var A=0,T=0,P=0,_=0;e.each(m.concat(v),function(t){if(t.getPadding){var e=t.getPadding();A=Math.max(A,e.left),T=Math.max(T,e.right)}}),e.each(g.concat(p),function(t){if(t.getPadding){var e=t.getPadding();P=Math.max(P,e.top),_=Math.max(_,e.bottom)}});var F=d,V=c,R=h,O=f;e.each(g.concat(p),o),e.each(g,function(t){F+=t.width}),e.each(p,function(t){V+=t.width}),e.each(m.concat(v),o),e.each(m,function(t){R+=t.height}),e.each(v,function(t){O+=t.height}),e.each(g.concat(p),r),F=d,V=c,R=h,O=f,e.each(g,function(t){F+=t.width}),e.each(p,function(t){V+=t.width}),e.each(m,function(t){R+=t.height}),e.each(v,function(t){O+=t.height});var L=Math.max(A-F,0);F+=L,V+=Math.max(T-V,0);var B=Math.max(P-R,0);R+=B,O+=Math.max(_-O,0);var z=i-R-O,W=a-F-V;W===C&&z===I||(e.each(g,function(t){t.height=z}),e.each(p,function(t){t.height=z}),e.each(m,function(t){t.options.fullWidth||(t.width=W)}),e.each(v,function(t){t.options.fullWidth||(t.width=W)}),I=z,C=W);var N=d+L,E=h+B;e.each(g.concat(m),s),N+=C,E+=I,e.each(p,s),e.each(v,s),t.chartArea={left:F,top:R,right:F+C,bottom:R+I},e.each(b,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(C,I)})}}}}},{}],30:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}function a(e,a){var i=new t.Legend({ctx:e.chart.ctx,options:a,chart:e});e.legend=i,t.layoutService.addBox(e,i)}var i=t.helpers,n=i.noop;t.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(t,e){var a=e.datasetIndex,i=this.chart,n=i.getDatasetMeta(a);n.hidden=null===n.hidden?!i.data.datasets[a].hidden:null,i.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return i.isArray(e.datasets)?e.datasets.map(function(e,a){return{text:e.label,fillStyle:i.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(a),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:a}},this):[]}}},t.Legend=t.Element.extend({initialize:function(t){i.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:n,update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:n,beforeSetDimensions:n,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:n,beforeBuildLabels:n,buildLabels:function(){var t=this,e=t.options.labels,a=e.generateLabels.call(t,t.chart);e.filter&&(a=a.filter(function(a){return e.filter(a,t.chart.data)})),t.options.reverse&&a.reverse(),t.legendItems=a},afterBuildLabels:n,beforeFit:n,fit:function(){var a=this,n=a.options,o=n.labels,r=n.display,s=a.ctx,l=t.defaults.global,u=i.getValueOrDefault,d=u(o.fontSize,l.defaultFontSize),c=u(o.fontStyle,l.defaultFontStyle),h=u(o.fontFamily,l.defaultFontFamily),f=i.fontString(d,c,h),g=a.legendHitBoxes=[],p=a.minSize,m=a.isHorizontal();if(m?(p.width=a.maxWidth,p.height=r?10:0):(p.width=r?10:0,p.height=a.maxHeight),r)if(s.font=f,m){var v=a.lineWidths=[0],b=a.legendItems.length?d+o.padding:0;s.textAlign="left",s.textBaseline="top",i.each(a.legendItems,function(t,i){var n=e(o,d),r=n+d/2+s.measureText(t.text).width;v[v.length-1]+r+o.padding>=a.width&&(b+=d+o.padding,v[v.length]=a.left),g[i]={left:0,top:0,width:r,height:d},v[v.length-1]+=r+o.padding}),p.height+=b}else{var x=o.padding,y=a.columnWidths=[],k=o.padding,S=0,M=0,w=d+x;i.each(a.legendItems,function(t,a){var i=e(o,d),n=i+d/2+s.measureText(t.text).width;M+w>p.height&&(k+=S+o.padding,y.push(S),S=0,M=0),S=Math.max(S,n),M+=w,g[a]={left:0,top:0,width:n,height:d}}),k+=S,y.push(S),p.width+=k}a.width=p.width,a.height=p.height},afterFit:n,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var a=this,n=a.options,o=n.labels,r=t.defaults.global,s=r.elements.line,l=a.width,u=a.lineWidths;if(n.display){var d,c=a.ctx,h=i.getValueOrDefault,f=h(o.fontColor,r.defaultFontColor),g=h(o.fontSize,r.defaultFontSize),p=h(o.fontStyle,r.defaultFontStyle),m=h(o.fontFamily,r.defaultFontFamily),v=i.fontString(g,p,m);c.textAlign="left",c.textBaseline="top",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=v;var b=e(o,g),x=a.legendHitBoxes,y=function(e,a,i){if(!(isNaN(b)||b<=0)){c.save(),c.fillStyle=h(i.fillStyle,r.defaultColor),c.lineCap=h(i.lineCap,s.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,s.borderDashOffset),c.lineJoin=h(i.lineJoin,s.borderJoinStyle),c.lineWidth=h(i.lineWidth,s.borderWidth),c.strokeStyle=h(i.strokeStyle,r.defaultColor);var o=0===h(i.lineWidth,s.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,s.borderDash)),n.labels&&n.labels.usePointStyle){var l=g*Math.SQRT2/2,u=l/Math.SQRT2,d=e+u,f=a+u;t.canvasHelpers.drawPoint(c,i.pointStyle,l,d,f)}else o||c.strokeRect(e,a,b,g),c.fillRect(e,a,b,g);c.restore()}},k=function(t,e,a,i){c.fillText(a.text,b+g/2+t,e),a.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(b+g/2+t,e+g/2),c.lineTo(b+g/2+t+i,e+g/2),c.stroke())},S=a.isHorizontal();d=S?{x:a.left+(l-u[0])/2,y:a.top+o.padding,line:0}:{x:a.left+o.padding,y:a.top+o.padding,line:0};var M=g+o.padding;i.each(a.legendItems,function(t,e){var i=c.measureText(t.text).width,n=b+g/2+i,r=d.x,s=d.y;S?r+n>=l&&(s=d.y+=M,d.line++,r=d.x=a.left+(l-u[d.line])/2):s+M>a.bottom&&(r=d.x=r+a.columnWidths[d.line]+o.padding,s=d.y=a.top+o.padding,d.line++),y(r,s,t),x[e].left=r,x[e].top=s,k(r,s,t,i),S?d.x+=n+o.padding:d.y+=M})}},handleEvent:function(t){var e=this,a=e.options,i="mouseup"===t.type?"click":t.type,n=!1;if("mousemove"===i){if(!a.onHover)return}else{if("click"!==i)return;if(!a.onClick)return}var o=t.x,r=t.y;if(o>=e.left&&o<=e.right&&r>=e.top&&r<=e.bottom)for(var s=e.legendHitBoxes,l=0;l<s.length;++l){var u=s[l];if(o>=u.left&&o<=u.left+u.width&&r>=u.top&&r<=u.top+u.height){if("click"===i){a.onClick.call(e,t.native,e.legendItems[l]),n=!0;break}if("mousemove"===i){a.onHover.call(e,t.native,e.legendItems[l]),n=!0;break}}}return n}}),t.plugins.register({beforeInit:function(t){var e=t.options.legend;e&&a(t,e)},beforeUpdate:function(e){var n=e.options.legend;n?(n=i.configMerge(t.defaults.global.legend,n),e.legend?e.legend.options=n:a(e,n)):(t.layoutService.removeBox(e,e.legend),delete e.legend)},afterEvent:function(t,e){var a=t.legend;a&&a.handleEvent(e)}})}},{}],31:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.plugins={},t.plugins={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){e.indexOf(t)===-1&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var a=e.indexOf(t);a!==-1&&e.splice(a,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length;
13
+ },getAll:function(){return this._plugins},notify:function(t,e,a){var i,n,o,r,s,l=this.descriptors(t),u=l.length;for(i=0;i<u;++i)if(n=l[i],o=n.plugin,s=o[e],"function"==typeof s&&(r=[t].concat(a||[]),r.push(n.options),s.apply(o,r)===!1))return!1;return!0},descriptors:function(a){var i=a._plugins||(a._plugins={});if(i.id===this._cacheId)return i.descriptors;var n=[],o=[],r=a&&a.config||{},s=t.defaults.global.plugins,l=r.options&&r.options.plugins||{};return this._plugins.concat(r.plugins||[]).forEach(function(t){var a=n.indexOf(t);if(a===-1){var i=t.id,r=l[i];r!==!1&&(r===!0&&(r=e.clone(s[i])),n.push(t),o.push({plugin:t,options:r||{}}))}}),i.descriptors=o,i.id=this._cacheId,o}},t.pluginService=t.plugins,t.PluginBase=e.inherits({})}},{}],32:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e,a){return i.isArray(e)?i.longestText(t,a,e):t.measureText(e).width}function a(e){var a=i.getValueOrDefault,n=t.defaults.global,o=a(e.fontSize,n.defaultFontSize),r=a(e.fontStyle,n.defaultFontStyle),s=a(e.fontFamily,n.defaultFontFamily);return{size:o,style:r,family:s,font:i.fontString(o,r,s)}}var i=t.helpers;t.defaults.scale={display:!0,position:"left",gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{labelString:"",display:!1},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:0,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:t.Ticks.formatters.values}},t.Scale=t.Element.extend({getPadding:function(){var t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}},beforeUpdate:function(){i.callCallback(this.options.beforeUpdate,[this])},update:function(t,e,a){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n.margins=i.extend({left:0,right:0,top:0,bottom:0},a),n.longestTextCache=n.longestTextCache||{},n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeDataLimits(),n.determineDataLimits(),n.afterDataLimits(),n.beforeBuildTicks(),n.buildTicks(),n.afterBuildTicks(),n.beforeTickToLabelConversion(),n.convertTicksToLabels(),n.afterTickToLabelConversion(),n.beforeCalculateTickRotation(),n.calculateTickRotation(),n.afterCalculateTickRotation(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:function(){i.callCallback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){i.callCallback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0},afterSetDimensions:function(){i.callCallback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){i.callCallback(this.options.beforeDataLimits,[this])},determineDataLimits:i.noop,afterDataLimits:function(){i.callCallback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){i.callCallback(this.options.beforeBuildTicks,[this])},buildTicks:i.noop,afterBuildTicks:function(){i.callCallback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){i.callCallback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this,e=t.options.ticks;t.ticks=t.ticks.map(e.userCallback||e.callback)},afterTickToLabelConversion:function(){i.callCallback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){i.callCallback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var t=this,e=t.ctx,n=t.options.ticks,o=a(n);e.font=o.font;var r=n.minRotation||0;if(t.options.display&&t.isHorizontal())for(var s,l,u=i.longestText(e,o.font,t.ticks,t.longestTextCache),d=u,c=t.getPixelForTick(1)-t.getPixelForTick(0)-6;d>c&&r<n.maxRotation;){var h=i.toRadians(r);if(s=Math.cos(h),l=Math.sin(h),l*u>t.maxHeight){r--;break}r++,d=s*u}t.labelRotation=r},afterCalculateTickRotation:function(){i.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){i.callCallback(this.options.beforeFit,[this])},fit:function(){var t=this,n=t.minSize={width:0,height:0},o=t.options,r=o.ticks,s=o.scaleLabel,l=o.gridLines,u=o.display,d=t.isHorizontal(),c=a(r),h=1.5*a(s).size,f=o.gridLines.tickMarkLength;if(d?n.width=t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:n.width=u&&l.drawTicks?f:0,d?n.height=u&&l.drawTicks?f:0:n.height=t.maxHeight,s.display&&u&&(d?n.height+=h:n.width+=h),r.display&&u){var g=i.longestText(t.ctx,c.font,t.ticks,t.longestTextCache),p=i.numberOfLabelLines(t.ticks),m=.5*c.size;if(d){t.longestLabelWidth=g;var v=i.toRadians(t.labelRotation),b=Math.cos(v),x=Math.sin(v),y=x*g+c.size*p+m*p;n.height=Math.min(t.maxHeight,n.height+y),t.ctx.font=c.font;var k=t.ticks[0],S=e(t.ctx,k,c.font),M=t.ticks[t.ticks.length-1],w=e(t.ctx,M,c.font);0!==t.labelRotation?(t.paddingLeft="bottom"===o.position?b*S+3:b*m+3,t.paddingRight="bottom"===o.position?b*m+3:b*w+3):(t.paddingLeft=S/2+3,t.paddingRight=w/2+3)}else r.mirror?g=0:g+=t.options.ticks.padding,n.width+=g,t.paddingTop=c.size/2,t.paddingBottom=c.size/2}t.handleMargins(),t.width=n.width,t.height=n.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){i.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){return null===t||"undefined"==typeof t?NaN:"number"!=typeof t||isFinite(t)?"object"==typeof t?t instanceof Date||t.isValid?t:this.getRightValue(this.isHorizontal()?t.x:t.y):t:NaN},getLabelForIndex:i.noop,getPixelForValue:i.noop,getValueForPixel:i.noop,getPixelForTick:function(t,e){var a=this;if(a.isHorizontal()){var i=a.width-(a.paddingLeft+a.paddingRight),n=i/Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),o=n*t+a.paddingLeft;e&&(o+=n/2);var r=a.left+Math.round(o);return r+=a.isFullWidth()?a.margins.left:0}var s=a.height-(a.paddingTop+a.paddingBottom);return a.top+t*(s/(a.ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var a=e.width-(e.paddingLeft+e.paddingRight),i=a*t+e.paddingLeft,n=e.left+Math.round(i);return n+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,a=t.max;return t.beginAtZero?0:e<0&&a<0?a:e>0&&a>0?e:0},draw:function(e){var n=this,o=n.options;if(o.display){var r,s,l=n.ctx,u=t.defaults.global,d=o.ticks,c=o.gridLines,h=o.scaleLabel,f=0!==n.labelRotation,g=d.autoSkip,p=n.isHorizontal();d.maxTicksLimit&&(s=d.maxTicksLimit);var m=i.getValueOrDefault(d.fontColor,u.defaultFontColor),v=a(d),b=c.drawTicks?c.tickMarkLength:0,x=i.getValueOrDefault(c.borderDash,u.borderDash),y=i.getValueOrDefault(c.borderDashOffset,u.borderDashOffset),k=i.getValueOrDefault(h.fontColor,u.defaultFontColor),S=a(h),M=i.toRadians(n.labelRotation),w=Math.cos(M),C=n.longestLabelWidth*w;l.fillStyle=m;var I=[];if(p){if(r=!1,f&&(C/=2),(C+d.autoSkipPadding)*n.ticks.length>n.width-(n.paddingLeft+n.paddingRight)&&(r=1+Math.floor((C+d.autoSkipPadding)*n.ticks.length/(n.width-(n.paddingLeft+n.paddingRight)))),s&&n.ticks.length>s)for(;!r||n.ticks.length/(r||1)>s;)r||(r=1),r+=1;g||(r=!1)}var D="right"===o.position?n.left:n.right-b,A="right"===o.position?n.left+b:n.right,T="bottom"===o.position?n.top:n.bottom-b,P="bottom"===o.position?n.top+b:n.bottom;if(i.each(n.ticks,function(t,a){if(void 0!==t&&null!==t){var s=n.ticks.length===a+1,l=r>1&&a%r>0||a%r===0&&a+r>=n.ticks.length;if((!l||s)&&void 0!==t&&null!==t){var u,h;a===("undefined"!=typeof n.zeroLineIndex?n.zeroLineIndex:0)?(u=c.zeroLineWidth,h=c.zeroLineColor):(u=i.getValueAtIndexOrDefault(c.lineWidth,a),h=i.getValueAtIndexOrDefault(c.color,a));var g,m,v,k,S,w,C,_,F,V,R="middle",O="middle";if(p){"bottom"===o.position?(O=f?"middle":"top",R=f?"right":"center",V=n.top+b):(O=f?"middle":"bottom",R=f?"left":"center",V=n.bottom-b);var L=n.getPixelForTick(a)+i.aliasPixel(u);F=n.getPixelForTick(a,c.offsetGridLines)+d.labelOffset,g=v=S=C=L,m=T,k=P,w=e.top,_=e.bottom}else{var B,z="left"===o.position,W=d.padding;d.mirror?(R=z?"left":"right",B=W):(R=z?"right":"left",B=b+W),F=z?n.right-B:n.left+B;var N=n.getPixelForTick(a);N+=i.aliasPixel(u),V=n.getPixelForTick(a,c.offsetGridLines),g=D,v=A,S=e.left,C=e.right,m=k=w=_=N}I.push({tx1:g,ty1:m,tx2:v,ty2:k,x1:S,y1:w,x2:C,y2:_,labelX:F,labelY:V,glWidth:u,glColor:h,glBorderDash:x,glBorderDashOffset:y,rotation:-1*M,label:t,textBaseline:O,textAlign:R})}}}),i.each(I,function(t){if(c.display&&(l.save(),l.lineWidth=t.glWidth,l.strokeStyle=t.glColor,l.setLineDash&&(l.setLineDash(t.glBorderDash),l.lineDashOffset=t.glBorderDashOffset),l.beginPath(),c.drawTicks&&(l.moveTo(t.tx1,t.ty1),l.lineTo(t.tx2,t.ty2)),c.drawOnChartArea&&(l.moveTo(t.x1,t.y1),l.lineTo(t.x2,t.y2)),l.stroke(),l.restore()),d.display){l.save(),l.translate(t.labelX,t.labelY),l.rotate(t.rotation),l.font=v.font,l.textBaseline=t.textBaseline,l.textAlign=t.textAlign;var e=t.label;if(i.isArray(e))for(var a=0,n=0;a<e.length;++a)l.fillText(""+e[a],0,n),n+=1.5*v.size;else l.fillText(e,0,0);l.restore()}}),h.display){var _,F,V=0;if(p)_=n.left+(n.right-n.left)/2,F="bottom"===o.position?n.bottom-S.size/2:n.top+S.size/2;else{var R="left"===o.position;_=R?n.left+S.size/2:n.right-S.size/2,F=n.top+(n.bottom-n.top)/2,V=R?-.5*Math.PI:.5*Math.PI}l.save(),l.translate(_,F),l.rotate(V),l.textAlign="center",l.textBaseline="middle",l.fillStyle=k,l.font=S.font,l.fillText(h.labelString,0,0),l.restore()}if(c.drawBorder){l.lineWidth=i.getValueAtIndexOrDefault(c.lineWidth,0),l.strokeStyle=i.getValueAtIndexOrDefault(c.color,0);var O=n.left,L=n.right,B=n.top,z=n.bottom,W=i.aliasPixel(l.lineWidth);p?(B=z="top"===o.position?n.bottom:n.top,B+=W,z+=W):(O=L="left"===o.position?n.right:n.left,O+=W,L+=W),l.beginPath(),l.moveTo(O,B),l.lineTo(L,z),l.stroke()}}}})}},{}],33:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.scaleService={constructors:{},defaults:{},registerScaleType:function(t,a,i){this.constructors[t]=a,this.defaults[t]=e.clone(i)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(a){return this.defaults.hasOwnProperty(a)?e.scaleMerge(t.defaults.scale,this.defaults[a]):{}},updateScaleDefaults:function(t,a){var i=this.defaults;i.hasOwnProperty(t)&&(i[t]=e.extend(i[t],a))},addScalesToLayout:function(a){e.each(a.scales,function(e){t.layoutService.addBox(a,e)})}}}},{}],34:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.Ticks={generators:{linear:function(t,a){var i,n=[];if(t.stepSize&&t.stepSize>0)i=t.stepSize;else{var o=e.niceNum(a.max-a.min,!1);i=e.niceNum(o/(t.maxTicks-1),!0)}var r=Math.floor(a.min/i)*i,s=Math.ceil(a.max/i)*i;t.min&&t.max&&t.stepSize&&e.almostWhole((t.max-t.min)/t.stepSize,i/1e3)&&(r=t.min,s=t.max);var l=(s-r)/i;l=e.almostEquals(l,Math.round(l),i/1e3)?Math.round(l):Math.ceil(l),n.push(void 0!==t.min?t.min:r);for(var u=1;u<l;++u)n.push(r+u*i);return n.push(void 0!==t.max?t.max:s),n},logarithmic:function(t,a){var i,n,o=[],r=e.getValueOrDefault,s=r(t.min,Math.pow(10,Math.floor(e.log10(a.min)))),l=Math.floor(e.log10(a.max)),u=Math.ceil(a.max/Math.pow(10,l));0===s?(i=Math.floor(e.log10(a.minNotZero)),n=Math.floor(a.minNotZero/Math.pow(10,i)),o.push(s),s=n*Math.pow(10,i)):(i=Math.floor(e.log10(s)),n=Math.floor(s/Math.pow(10,i)));do o.push(s),++n,10===n&&(n=1,++i),s=n*Math.pow(10,i);while(i<l||i===l&&n<u);var d=r(t.max,s);return o.push(d),o}},formatters:{values:function(t){return e.isArray(t)?t:""+t},linear:function(t,a,i){var n=i.length>3?i[2]-i[1]:i[1]-i[0];Math.abs(n)>1&&t!==Math.floor(t)&&(n=t-Math.floor(t));var o=e.log10(Math.abs(n)),r="";if(0!==t){var s=-1*Math.floor(o);s=Math.max(Math.min(s,20),0),r=t.toFixed(s)}else r="0";return r},logarithmic:function(t,a,i){var n=t/Math.pow(10,Math.floor(e.log10(t)));return 0===t?"0":1===n||2===n||5===n||0===a||a===i.length-1?t.toExponential():""}}}}},{}],35:[function(t,e,a){"use strict";e.exports=function(t){function e(e,a){var i=new t.Title({ctx:e.chart.ctx,options:a,chart:e});e.titleBlock=i,t.layoutService.addBox(e,i)}var a=t.helpers;t.defaults.global.title={display:!1,position:"top",fullWidth:!0,fontStyle:"bold",padding:10,text:""};var i=a.noop;t.Title=t.Element.extend({initialize:function(t){var e=this;a.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:i,update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:i,beforeSetDimensions:i,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:i,beforeBuildLabels:i,buildLabels:i,afterBuildLabels:i,beforeFit:i,fit:function(){var e=this,i=a.getValueOrDefault,n=e.options,o=t.defaults.global,r=n.display,s=i(n.fontSize,o.defaultFontSize),l=e.minSize;e.isHorizontal()?(l.width=e.maxWidth,l.height=r?s+2*n.padding:0):(l.width=r?s+2*n.padding:0,l.height=e.maxHeight),e.width=l.width,e.height=l.height},afterFit:i,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var e=this,i=e.ctx,n=a.getValueOrDefault,o=e.options,r=t.defaults.global;if(o.display){var s,l,u,d=n(o.fontSize,r.defaultFontSize),c=n(o.fontStyle,r.defaultFontStyle),h=n(o.fontFamily,r.defaultFontFamily),f=a.fontString(d,c,h),g=0,p=e.top,m=e.left,v=e.bottom,b=e.right;i.fillStyle=n(o.fontColor,r.defaultFontColor),i.font=f,e.isHorizontal()?(s=m+(b-m)/2,l=p+(v-p)/2,u=b-m):(s="left"===o.position?m+d/2:b-d/2,l=p+(v-p)/2,u=v-p,g=Math.PI*("left"===o.position?-.5:.5)),i.save(),i.translate(s,l),i.rotate(g),i.textAlign="center",i.textBaseline="middle",i.fillText(o.text,0,0,u),i.restore()}}}),t.plugins.register({beforeInit:function(t){var a=t.options.title;a&&e(t,a)},beforeUpdate:function(i){var n=i.options.title;n?(n=a.configMerge(t.defaults.global.title,n),i.titleBlock?i.titleBlock.options=n:e(i,n)):(t.layoutService.removeBox(i,i.titleBlock),delete i.titleBlock)}})}},{}],36:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=l.color(t);return a.alpha(e*a.alpha()).rgbaString()}function a(t,e){return e&&(l.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function i(t){var e=t._xScale,a=t._yScale||t._scale,i=t._index,n=t._datasetIndex;return{xLabel:e?e.getLabelForIndex(i,n):"",yLabel:a?a.getLabelForIndex(i,n):"",index:i,datasetIndex:n,x:t._model.x,y:t._model.y}}function n(e){var a=t.defaults.global,i=l.getValueOrDefault;return{xPadding:e.xPadding,yPadding:e.yPadding,xAlign:e.xAlign,yAlign:e.yAlign,bodyFontColor:e.bodyFontColor,_bodyFontFamily:i(e.bodyFontFamily,a.defaultFontFamily),_bodyFontStyle:i(e.bodyFontStyle,a.defaultFontStyle),_bodyAlign:e.bodyAlign,bodyFontSize:i(e.bodyFontSize,a.defaultFontSize),bodySpacing:e.bodySpacing,titleFontColor:e.titleFontColor,_titleFontFamily:i(e.titleFontFamily,a.defaultFontFamily),_titleFontStyle:i(e.titleFontStyle,a.defaultFontStyle),titleFontSize:i(e.titleFontSize,a.defaultFontSize),_titleAlign:e.titleAlign,titleSpacing:e.titleSpacing,titleMarginBottom:e.titleMarginBottom,footerFontColor:e.footerFontColor,_footerFontFamily:i(e.footerFontFamily,a.defaultFontFamily),_footerFontStyle:i(e.footerFontStyle,a.defaultFontStyle),footerFontSize:i(e.footerFontSize,a.defaultFontSize),_footerAlign:e.footerAlign,footerSpacing:e.footerSpacing,footerMarginTop:e.footerMarginTop,caretSize:e.caretSize,cornerRadius:e.cornerRadius,backgroundColor:e.backgroundColor,opacity:0,legendColorBackground:e.multiKeyBackground,displayColors:e.displayColors}}function o(t,e){var a=t._chart.ctx,i=2*e.yPadding,n=0,o=e.body,r=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);r+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,u=e.footer.length,d=e.titleFontSize,c=e.bodyFontSize,h=e.footerFontSize;i+=s*d,i+=s?(s-1)*e.titleSpacing:0,i+=s?e.titleMarginBottom:0,i+=r*c,i+=r?(r-1)*e.bodySpacing:0,i+=u?e.footerMarginTop:0,i+=u*h,i+=u?(u-1)*e.footerSpacing:0;var f=0,g=function(t){n=Math.max(n,a.measureText(t).width+f)};return a.font=l.fontString(d,e._titleFontStyle,e._titleFontFamily),l.each(e.title,g),a.font=l.fontString(c,e._bodyFontStyle,e._bodyFontFamily),l.each(e.beforeBody.concat(e.afterBody),g),f=e.displayColors?c+2:0,l.each(o,function(t){l.each(t.before,g),l.each(t.lines,g),l.each(t.after,g)}),f=0,a.font=l.fontString(h,e._footerFontStyle,e._footerFontFamily),l.each(e.footer,g),n+=2*e.xPadding,{width:n,height:i}}function r(t,e){var a=t._model,i=t._chart,n=t._chartInstance.chartArea,o="center",r="center";a.y<e.height?r="top":a.y>i.height-e.height&&(r="bottom");var s,l,u,d,c,h=(n.left+n.right)/2,f=(n.top+n.bottom)/2;"center"===r?(s=function(t){return t<=h},l=function(t){return t>h}):(s=function(t){return t<=e.width/2},l=function(t){return t>=i.width-e.width/2}),u=function(t){return t+e.width>i.width},d=function(t){return t-e.width<0},c=function(t){return t<=f?"top":"bottom"},s(a.x)?(o="left",u(a.x)&&(o="center",r=c(a.y))):l(a.x)&&(o="right",d(a.x)&&(o="center",r=c(a.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:o,yAlign:g.yAlign?g.yAlign:r}}function s(t,e,a){var i=t.x,n=t.y,o=t.caretSize,r=t.caretPadding,s=t.cornerRadius,l=a.xAlign,u=a.yAlign,d=o+r,c=s+r;return"right"===l?i-=e.width:"center"===l&&(i-=e.width/2),"top"===u?n+=d:n-="bottom"===u?e.height+d:e.height/2,"center"===u?"left"===l?i+=d:"right"===l&&(i-=d):"left"===l?i-=c:"right"===l&&(i+=c),{x:i,y:n}}var l=t.helpers;t.defaults.global.tooltips={enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,callbacks:{beforeTitle:l.noop,title:function(t,e){var a="",i=e.labels,n=i?i.length:0;if(t.length>0){var o=t[0];o.xLabel?a=o.xLabel:n>0&&o.index<n&&(a=i[o.index])}return a},afterTitle:l.noop,beforeBody:l.noop,beforeLabel:l.noop,label:function(t,e){var a=e.datasets[t.datasetIndex].label||"";return a+": "+t.yLabel},labelColor:function(t,e){var a=e.getDatasetMeta(t.datasetIndex),i=a.data[t.index],n=i._view;return{borderColor:n.borderColor,backgroundColor:n.backgroundColor}},afterLabel:l.noop,afterBody:l.noop,beforeFooter:l.noop,footer:l.noop,afterFooter:l.noop}},t.Tooltip=t.Element.extend({initialize:function(){this._model=n(this._options)},getTitle:function(){var t=this,e=t._options,i=e.callbacks,n=i.beforeTitle.apply(t,arguments),o=i.title.apply(t,arguments),r=i.afterTitle.apply(t,arguments),s=[];return s=a(s,n),s=a(s,o),s=a(s,r)},getBeforeBody:function(){var t=this._options.callbacks.beforeBody.apply(this,arguments);return l.isArray(t)?t:void 0!==t?[t]:[]},getBody:function(t,e){var i=this,n=i._options.callbacks,o=[];return l.each(t,function(t){var r={before:[],lines:[],after:[]};a(r.before,n.beforeLabel.call(i,t,e)),a(r.lines,n.label.call(i,t,e)),a(r.after,n.afterLabel.call(i,t,e)),o.push(r)}),o},getAfterBody:function(){var t=this._options.callbacks.afterBody.apply(this,arguments);return l.isArray(t)?t:void 0!==t?[t]:[]},getFooter:function(){var t=this,e=t._options.callbacks,i=e.beforeFooter.apply(t,arguments),n=e.footer.apply(t,arguments),o=e.afterFooter.apply(t,arguments),r=[];return r=a(r,i),r=a(r,n),r=a(r,o)},update:function(e){var a,u,d=this,c=d._options,h=d._model,f=d._model=n(c),g=d._active,p=d._data,m=d._chartInstance,v={xAlign:h.xAlign,yAlign:h.yAlign},b={x:h.x,y:h.y},x={width:h.width,height:h.height},y={x:h.caretX,y:h.caretY};if(g.length){f.opacity=1;var k=[];y=t.Tooltip.positioners[c.position](g,d._eventPosition);var S=[];for(a=0,u=g.length;a<u;++a)S.push(i(g[a]));c.filter&&(S=S.filter(function(t){return c.filter(t,p)})),c.itemSort&&(S=S.sort(function(t,e){return c.itemSort(t,e,p)})),l.each(S,function(t){k.push(c.callbacks.labelColor.call(d,t,m))}),f.title=d.getTitle(S,p),f.beforeBody=d.getBeforeBody(S,p),f.body=d.getBody(S,p),f.afterBody=d.getAfterBody(S,p),f.footer=d.getFooter(S,p),f.x=Math.round(y.x),f.y=Math.round(y.y),f.caretPadding=l.getValueOrDefault(y.padding,2),f.labelColors=k,f.dataPoints=S,x=o(this,f),v=r(this,x),b=s(f,x,v)}else f.opacity=0;return f.xAlign=v.xAlign,f.yAlign=v.yAlign,f.x=b.x,f.y=b.y,f.width=x.width,f.height=x.height,f.caretX=y.x,f.caretY=y.y,d._model=f,e&&c.custom&&c.custom.call(d,f),d},drawCaret:function(t,a,i){var n,o,r,s,l,u,d=this._view,c=this._chart.ctx,h=d.caretSize,f=d.cornerRadius,g=d.xAlign,p=d.yAlign,m=t.x,v=t.y,b=a.width,x=a.height;"center"===p?("left"===g?(n=m,o=n-h,r=n):(n=m+b,o=n+h,r=n),l=v+x/2,s=l-h,u=l+h):("left"===g?(n=m+f,o=n+h,r=o+h):"right"===g?(n=m+b-f,o=n-h,r=o-h):(o=m+b/2,n=o-h,r=o+h),"top"===p?(s=v,l=s-h,u=s):(s=v+x,l=s+h,u=s)),c.fillStyle=e(d.backgroundColor,i),c.beginPath(),c.moveTo(n,s),c.lineTo(o,l),c.lineTo(r,u),c.closePath(),c.fill()},drawTitle:function(t,a,i,n){var o=a.title;if(o.length){i.textAlign=a._titleAlign,i.textBaseline="top";var r=a.titleFontSize,s=a.titleSpacing;i.fillStyle=e(a.titleFontColor,n),i.font=l.fontString(r,a._titleFontStyle,a._titleFontFamily);var u,d;for(u=0,d=o.length;u<d;++u)i.fillText(o[u],t.x,t.y),t.y+=r+s,u+1===o.length&&(t.y+=a.titleMarginBottom-s)}},drawBody:function(t,a,i,n){var o=a.bodyFontSize,r=a.bodySpacing,s=a.body;i.textAlign=a._bodyAlign,i.textBaseline="top";var u=e(a.bodyFontColor,n);i.fillStyle=u,i.font=l.fontString(o,a._bodyFontStyle,a._bodyFontFamily);var d=0,c=function(e){i.fillText(e,t.x+d,t.y),t.y+=o+r};l.each(a.beforeBody,c);var h=a.displayColors;d=h?o+2:0,l.each(s,function(r,s){l.each(r.before,c),l.each(r.lines,function(r){h&&(i.fillStyle=e(a.legendColorBackground,n),i.fillRect(t.x,t.y,o,o),i.strokeStyle=e(a.labelColors[s].borderColor,n),i.strokeRect(t.x,t.y,o,o),i.fillStyle=e(a.labelColors[s].backgroundColor,n),i.fillRect(t.x+1,t.y+1,o-2,o-2),i.fillStyle=u),c(r)}),l.each(r.after,c)}),d=0,l.each(a.afterBody,c),t.y-=r},drawFooter:function(t,a,i,n){var o=a.footer;o.length&&(t.y+=a.footerMarginTop,i.textAlign=a._footerAlign,i.textBaseline="top",i.fillStyle=e(a.footerFontColor,n),i.font=l.fontString(a.footerFontSize,a._footerFontStyle,a._footerFontFamily),l.each(o,function(e){i.fillText(e,t.x,t.y),t.y+=a.footerFontSize+a.footerSpacing}))},drawBackground:function(t,a,i,n,o){i.fillStyle=e(a.backgroundColor,o),l.drawRoundedRectangle(i,t.x,t.y,n.width,n.height,a.cornerRadius),i.fill()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var a={width:e.width,height:e.height},i={x:e.x,y:e.y},n=Math.abs(e.opacity<.001)?0:e.opacity;this._options.enabled&&(this.drawBackground(i,e,t,a,n),this.drawCaret(i,a,n),i.x+=e.xPadding,i.y+=e.yPadding,this.drawTitle(i,e,t,n),this.drawBody(i,e,t,n),this.drawFooter(i,e,t,n))}},handleEvent:function(t){var e=this,a=e._options,i=!1;if(e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:e._active=e._chartInstance.getElementsAtEventForMode(t,a.mode,a),i=!l.arrayEquals(e._active,e._lastActive),e._lastActive=e._active,a.enabled||a.custom){e._eventPosition={x:t.x,y:t.y};var n=e._model;e.update(!0),e.pivot(),i|=n.x!==e._model.x||n.y!==e._model.y}return i}}),t.Tooltip.positioners={average:function(t){if(!t.length)return!1;var e,a,i=0,n=0,o=0;for(e=0,a=t.length;e<a;++e){var r=t[e];if(r&&r.hasValue()){var s=r.tooltipPosition();i+=s.x,n+=s.y,++o}}return{x:Math.round(i/o),y:Math.round(n/o)}},nearest:function(t,e){var a,i,n,o=e.x,r=e.y,s=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){var u=t[i];if(u&&u.hasValue()){var d=u.getCenterPoint(),c=l.distanceBetweenPoints(e,d);c<s&&(s=c,a=u)}}if(a){var h=a.tooltipPosition();o=h.x,r=h.y}return{x:o,y:r}}}}},{}],37:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global;a.elements.arc={backgroundColor:a.defaultColor,borderColor:"#fff",borderWidth:2},t.elements.Arc=t.Element.extend({inLabelRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2)},inRange:function(t,a){var i=this._view;if(i){for(var n=e.getAngleFromPoint(i,{x:t,y:a}),o=n.angle,r=n.distance,s=i.startAngle,l=i.endAngle;l<s;)l+=2*Math.PI;for(;o>l;)o-=2*Math.PI;for(;o<s;)o+=2*Math.PI;var u=o>=s&&o<=l,d=r>=i.innerRadius&&r<=i.outerRadius;return u&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,a=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,a=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},draw:function(){var t=this._chart.ctx,e=this._view,a=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,a,i),t.arc(e.x,e.y,e.innerRadius,i,a,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})}},{}],38:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global;t.defaults.global.elements.line={tension:.4,backgroundColor:a.defaultColor,borderWidth:3,borderColor:a.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0},t.elements.Line=t.Element.extend({draw:function(){function t(t,e){var a=e._view;e._view.steppedLine===!0?(l.lineTo(a.x,t._view.y),l.lineTo(a.x,a.y)):0===e._view.tension?l.lineTo(a.x,a.y):l.bezierCurveTo(t._view.controlPointNextX,t._view.controlPointNextY,a.controlPointPreviousX,a.controlPointPreviousY,a.x,a.y)}var i=this,n=i._view,o=n.spanGaps,r=n.scaleZero,s=i._loop;s||("top"===n.fill?r=n.scaleTop:"bottom"===n.fill&&(r=n.scaleBottom));var l=i._chart.ctx;l.save();var u=i._children.slice(),d=-1;s&&u.length&&u.push(u[0]);var c,h,f,g;if(u.length&&n.fill){for(l.beginPath(),c=0;c<u.length;++c)h=u[c],f=e.previousItem(u,c),g=h._view,0===c?(s?l.moveTo(r.x,r.y):l.moveTo(g.x,r),g.skip||(d=c,l.lineTo(g.x,g.y))):(f=d===-1?f:u[d],g.skip?o||d!==c-1||(s?l.lineTo(r.x,r.y):l.lineTo(f._view.x,r)):(d!==c-1?o&&d!==-1?t(f,h):s?l.lineTo(g.x,g.y):(l.lineTo(g.x,r),l.lineTo(g.x,g.y)):t(f,h),d=c));s||d===-1||l.lineTo(u[d]._view.x,r),l.fillStyle=n.backgroundColor||a.defaultColor,l.closePath(),l.fill()}var p=a.elements.line;for(l.lineCap=n.borderCapStyle||p.borderCapStyle,l.setLineDash&&l.setLineDash(n.borderDash||p.borderDash),l.lineDashOffset=n.borderDashOffset||p.borderDashOffset,l.lineJoin=n.borderJoinStyle||p.borderJoinStyle,l.lineWidth=n.borderWidth||p.borderWidth,l.strokeStyle=n.borderColor||a.defaultColor,l.beginPath(),d=-1,c=0;c<u.length;++c)h=u[c],f=e.previousItem(u,c),g=h._view,0===c?g.skip||(l.moveTo(g.x,g.y),d=c):(f=d===-1?f:u[d],g.skip||(d!==c-1&&!o||d===-1?l.moveTo(g.x,g.y):t(f,h),d=c));l.stroke(),l.restore()}})}},{}],39:[function(t,e,a){"use strict";e.exports=function(t){function e(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hitRadius,2)}function a(t){var e=this._view;return!!e&&Math.pow(t-e.y,2)<Math.pow(e.radius+e.hitRadius,2)}var i=t.helpers,n=t.defaults.global,o=n.defaultColor;n.elements.point={radius:3,pointStyle:"circle",backgroundColor:o,borderWidth:1,borderColor:o,hitRadius:1,hoverRadius:4,hoverBorderWidth:1},t.elements.Point=t.Element.extend({inRange:function(t,e){var a=this._view;return!!a&&Math.pow(t-a.x,2)+Math.pow(e-a.y,2)<Math.pow(a.hitRadius+a.radius,2)},inLabelRange:e,inXRange:e,inYRange:a,getCenterPoint:function(){var t=this._view;return{x:t.x,y:t.y}},getArea:function(){return Math.PI*Math.pow(this._view.radius,2)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y,padding:t.radius+t.borderWidth}},draw:function(e){var a=this._view,r=this._model,s=this._chart.ctx,l=a.pointStyle,u=a.radius,d=a.x,c=a.y,h=t.helpers.color,f=1.01,g=0;a.skip||(s.strokeStyle=a.borderColor||o,s.lineWidth=i.getValueOrDefault(a.borderWidth,n.elements.point.borderWidth),s.fillStyle=a.backgroundColor||o,void 0!==e&&(r.x<e.left||e.right*f<r.x||r.y<e.top||e.bottom*f<r.y)&&(r.x<e.left?g=(d-r.x)/(e.left-r.x):e.right*f<r.x?g=(r.x-d)/(r.x-e.right):r.y<e.top?g=(c-r.y)/(e.top-r.y):e.bottom*f<r.y&&(g=(r.y-c)/(r.y-e.bottom)),g=Math.round(100*g)/100,s.strokeStyle=h(s.strokeStyle).alpha(g).rgbString(),s.fillStyle=h(s.fillStyle).alpha(g).rgbString()),t.canvasHelpers.drawPoint(s,l,u,d,c))}})}},{}],40:[function(t,e,a){"use strict";e.exports=function(t){function e(t){return void 0!==t._view.width}function a(t){var a,i,n,o,r=t._view;if(e(t)){var s=r.width/2;a=r.x-s,i=r.x+s,n=Math.min(r.y,r.base),o=Math.max(r.y,r.base)}else{var l=r.height/2;a=Math.min(r.x,r.base),i=Math.max(r.x,r.base),n=r.y-l,o=r.y+l}return{left:a,top:n,right:i,bottom:o}}var i=t.defaults.global;i.elements.rectangle={backgroundColor:i.defaultColor,borderWidth:0,borderColor:i.defaultColor,borderSkipped:"bottom"},t.elements.Rectangle=t.Element.extend({draw:function(){function t(t){return v[(x+t)%4]}var e,a,i,n,o,r,s,l=this._chart.ctx,u=this._view,d=u.borderWidth;if(u.horizontal?(e=u.base,a=u.x,i=u.y-u.height/2,n=u.y+u.height/2,o=a>e?1:-1,r=1,s=u.borderSkipped||"left"):(e=u.x-u.width/2,a=u.x+u.width/2,i=u.y,n=u.base,o=1,r=n>i?1:-1,s=u.borderSkipped||"bottom"),d){var c=Math.min(Math.abs(e-a),Math.abs(i-n));d=d>c?c:d;var h=d/2,f=e+("left"!==s?h*o:0),g=a+("right"!==s?-h*o:0),p=i+("top"!==s?h*r:0),m=n+("bottom"!==s?-h*r:0);f!==g&&(i=p,n=m),p!==m&&(e=f,a=g)}l.beginPath(),l.fillStyle=u.backgroundColor,l.strokeStyle=u.borderColor,l.lineWidth=d;var v=[[e,n],[e,i],[a,i],[a,n]],b=["bottom","left","top","right"],x=b.indexOf(s,0);x===-1&&(x=0);var y=t(0);l.moveTo(y[0],y[1]);for(var k=1;k<4;k++)y=t(k),l.lineTo(y[0],y[1]);l.fill(),d&&l.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var i=!1;if(this._view){var n=a(this);i=t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}return i},inLabelRange:function(t,i){var n=this;if(!n._view)return!1;var o=!1,r=a(n);return o=e(n)?t>=r.left&&t<=r.right:i>=r.top&&i<=r.bottom},inXRange:function(t){var e=a(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=a(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,a,i=this._view;return e(this)?(t=i.x,a=(i.y+i.base)/2):(t=(i.x+i.base)/2,a=i.y),{x:t,y:a}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})}},{}],41:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=l.getStyle(t,e),i=a&&a.match(/(\d+)px/);return i?Number(i[1]):void 0}function a(t,a){var i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t._chartjs={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",null===o||""===o){var r=e(t,"width");void 0!==r&&(t.width=r)}if(null===n||""===n)if(""===t.style.height)t.height=t.width/(a.options.aspectRatio||2);else{var s=e(t,"height");void 0!==r&&(t.height=s)}return t}function i(t,e,a,i,n){return{type:t,chart:e,native:n||null,x:void 0!==a?a:null,y:void 0!==i?i:null}}function n(t,e){
14
  var a=u[t.type]||t.type,n=l.getRelativePosition(t,e);return i(a,e,n.x,n.y,t)}function o(t){var e=document.createElement("iframe");return e.className="chartjs-hidden-iframe",e.style.cssText="display:block;overflow:hidden;border:0;margin:0;top:0;left:0;bottom:0;right:0;height:100%;width:100%;position:absolute;pointer-events:none;z-index:-1;",e.tabIndex=-1,l.addEvent(e,"load",function(){l.addEvent(e.contentWindow||e,"resize",t),t()}),e}function r(t,e,a){var n=t._chartjs={ticking:!1},r=function(){n.ticking||(n.ticking=!0,l.requestAnimFrame.call(window,function(){if(n.resizer)return n.ticking=!1,e(i("resize",a))}))};n.resizer=o(r),t.insertBefore(n.resizer,t.firstChild)}function s(t){if(t&&t._chartjs){var e=t._chartjs.resizer;e&&(e.parentNode.removeChild(e),t._chartjs.resizer=null),delete t._chartjs}}var l=t.helpers,u={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};return{acquireContext:function(t,e){if("string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t instanceof HTMLCanvasElement){var i=t.getContext&&t.getContext("2d");if(i instanceof CanvasRenderingContext2D)return a(t,e),i}return null},releaseContext:function(t){var e=t.canvas;if(e._chartjs){var a=e._chartjs.initial;["height","width"].forEach(function(t){var i=a[t];void 0===i||null===i?e.removeAttribute(t):e.setAttribute(t,i)}),l.each(a.style||{},function(t,a){e.style[a]=t}),e.width=e.width,delete e._chartjs}},addEventListener:function(t,e,a){var i=t.chart.canvas;if("resize"===e)return void r(i.parentNode,a,t.chart);var o=a._chartjs||(a._chartjs={}),s=o.proxies||(o.proxies={}),u=s[t.id+"_"+e]=function(e){a(n(e,t.chart))};l.addEvent(i,e,u)},removeEventListener:function(t,e,a){var i=t.chart.canvas;if("resize"===e)return void s(i.parentNode,a);var n=a._chartjs||{},o=n.proxies||{},r=o[t.id+"_"+e];r&&l.removeEvent(i,e,r)}}}},{}],42:[function(t,e,a){"use strict";var i=t(41);e.exports=function(t){t.platform={acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},t.helpers.extend(t.platform,i(t))}},{41:41}],43:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"bottom"},i=t.Scale.extend({getLabels:function(){var t=this.chart.data;return(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,a=t.getLabels();t.minIndex=0,t.maxIndex=a.length-1;var i;void 0!==t.options.ticks.min&&(i=e.indexOf(a,t.options.ticks.min),t.minIndex=i!==-1?i:t.minIndex),void 0!==t.options.ticks.max&&(i=e.indexOf(a,t.options.ticks.max),t.maxIndex=i!==-1?i:t.maxIndex),t.min=a[t.minIndex],t.max=a[t.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var a=this,i=a.chart.data,n=a.isHorizontal();return i.yLabels&&!n?a.getRightValue(i.datasets[e].data[t]):a.ticks[t-a.minIndex]},getPixelForValue:function(t,e,a,i){var n=this,o=Math.max(n.maxIndex+1-n.minIndex-(n.options.gridLines.offsetGridLines?0:1),1);if(void 0!==t&&isNaN(e)){var r=n.getLabels(),s=r.indexOf(t);e=s!==-1?s:e}if(n.isHorizontal()){var l=n.width/o,u=l*(e-n.minIndex);return(n.options.gridLines.offsetGridLines&&i||n.maxIndex===n.minIndex&&i)&&(u+=l/2),n.left+Math.round(u)}var d=n.height/o,c=d*(e-n.minIndex);return n.options.gridLines.offsetGridLines&&i&&(c+=d/2),n.top+Math.round(c)},getPixelForTick:function(t,e){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null,e)},getValueForPixel:function(t){var e,a=this,i=Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),n=a.isHorizontal(),o=(n?a.width:a.height)/i;return t-=n?a.left:a.top,a.options.gridLines.offsetGridLines&&(t-=o/2),e=t<=0?0:Math.round(t/o)},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",i,a)}},{}],44:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.linear}},i=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return s?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=a.chart,o=n.data,r=o.datasets,s=a.isHorizontal();a.min=null,a.max=null;var l=i.stacked;if(void 0===l&&e.each(r,function(e,a){if(!l){var i=n.getDatasetMeta(a);n.isDatasetVisible(a)&&t(i)&&void 0!==i.stack&&(l=!0)}}),i.stacked||l){var u={};e.each(r,function(o,r){var s=n.getDatasetMeta(r),l=[s.type,void 0===i.stacked&&void 0===s.stack?r:"",s.stack].join(".");void 0===u[l]&&(u[l]={positiveValues:[],negativeValues:[]});var d=u[l].positiveValues,c=u[l].negativeValues;n.isDatasetVisible(r)&&t(s)&&e.each(o.data,function(t,e){var n=+a.getRightValue(t);isNaN(n)||s.data[e].hidden||(d[e]=d[e]||0,c[e]=c[e]||0,i.relativePoints?d[e]=100:n<0?c[e]+=n:d[e]+=n)})}),e.each(u,function(t){var i=t.positiveValues.concat(t.negativeValues),n=e.min(i),o=e.max(i);a.min=null===a.min?n:Math.min(a.min,n),a.max=null===a.max?o:Math.max(a.max,o)})}else e.each(r,function(i,o){var r=n.getDatasetMeta(o);n.isDatasetVisible(o)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:i<a.min&&(a.min=i),null===a.max?a.max=i:i>a.max&&(a.max=i))})});this.handleTickRangeOptions()},getTickLimit:function(){var a,i=this,n=i.options.ticks;if(i.isHorizontal())a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.width/50));else{var o=e.getValueOrDefault(n.fontSize,t.defaults.global.defaultFontSize);a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.height/(2*o)))}return a},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,a=this,i=a.start,n=+a.getRightValue(t),o=a.end-i;return a.isHorizontal()?(e=a.left+a.width/o*(n-i),Math.round(e)):(e=a.bottom-a.height/o*(n-i),Math.round(e))},getValueForPixel:function(t){var e=this,a=e.isHorizontal(),i=a?e.width:e.height,n=(a?t-e.left:e.bottom-t)/i;return e.start+(e.end-e.start)*n},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",i,a)}},{}],45:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=e.noop;t.LinearScaleBase=t.Scale.extend({handleTickRangeOptions:function(){var t=this,a=t.options,i=a.ticks;if(i.beginAtZero){var n=e.sign(t.min),o=e.sign(t.max);n<0&&o<0?t.max=0:n>0&&o>0&&(t.min=0)}void 0!==i.min?t.min=i.min:void 0!==i.suggestedMin&&(t.min=Math.min(t.min,i.suggestedMin)),void 0!==i.max?t.max=i.max:void 0!==i.suggestedMax&&(t.max=Math.max(t.max,i.suggestedMax)),t.min===t.max&&(t.max++,i.beginAtZero||t.min--)},getTickLimit:a,handleDirectionalChanges:a,buildTicks:function(){var a=this,i=a.options,n=i.ticks,o=a.getTickLimit();o=Math.max(2,o);var r={maxTicks:o,min:n.min,max:n.max,stepSize:e.getValueOrDefault(n.fixedStepSize,n.stepSize)},s=a.ticks=t.Ticks.generators.linear(r,a);a.handleDirectionalChanges(),a.max=e.max(s),a.min=e.min(s),n.reverse?(s.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{}],46:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.logarithmic}},i=t.Scale.extend({determineDataLimits:function(){function t(t){return u?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=i.ticks,o=a.chart,r=o.data,s=r.datasets,l=e.getValueOrDefault,u=a.isHorizontal();a.min=null,a.max=null,a.minNotZero=null;var d=i.stacked;if(void 0===d&&e.each(s,function(e,a){if(!d){var i=o.getDatasetMeta(a);o.isDatasetVisible(a)&&t(i)&&void 0!==i.stack&&(d=!0)}}),i.stacked||d){var c={};e.each(s,function(n,r){var s=o.getDatasetMeta(r),l=[s.type,void 0===i.stacked&&void 0===s.stack?r:"",s.stack].join(".");o.isDatasetVisible(r)&&t(s)&&(void 0===c[l]&&(c[l]=[]),e.each(n.data,function(t,e){var n=c[l],o=+a.getRightValue(t);isNaN(o)||s.data[e].hidden||(n[e]=n[e]||0,i.relativePoints?n[e]=100:n[e]+=o)}))}),e.each(c,function(t){var i=e.min(t),n=e.max(t);a.min=null===a.min?i:Math.min(a.min,i),a.max=null===a.max?n:Math.max(a.max,n)})}else e.each(s,function(i,n){var r=o.getDatasetMeta(n);o.isDatasetVisible(n)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:i<a.min&&(a.min=i),null===a.max?a.max=i:i>a.max&&(a.max=i),0!==i&&(null===a.minNotZero||i<a.minNotZero)&&(a.minNotZero=i))})});a.min=l(n.min,a.min),a.max=l(n.max,a.max),a.min===a.max&&(0!==a.min&&null!==a.min?(a.min=Math.pow(10,Math.floor(e.log10(a.min))-1),a.max=Math.pow(10,Math.floor(e.log10(a.max))+1)):(a.min=1,a.max=10))},buildTicks:function(){var a=this,i=a.options,n=i.ticks,o={min:n.min,max:n.max},r=a.ticks=t.Ticks.generators.logarithmic(o,a);a.isHorizontal()||r.reverse(),a.max=e.max(r),a.min=e.min(r),n.reverse?(r.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.max)},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),t.Scale.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){return this.getPixelForValue(this.tickValues[t])},getPixelForValue:function(t){var a,i,n,o=this,r=o.start,s=+o.getRightValue(t),l=o.options,u=l.ticks;return o.isHorizontal()?(n=e.log10(o.end)-e.log10(r),0===s?i=o.left:(a=o.width,i=o.left+a/n*(e.log10(s)-e.log10(r)))):(a=o.height,0!==r||u.reverse?0===o.end&&u.reverse?(n=e.log10(o.start)-e.log10(o.minNotZero),i=s===o.end?o.top:s===o.minNotZero?o.top+.02*a:o.top+.02*a+.98*a/n*(e.log10(s)-e.log10(o.minNotZero))):(n=e.log10(o.end)-e.log10(r),a=o.height,i=o.bottom-a/n*(e.log10(s)-e.log10(r))):(n=e.log10(o.end)-e.log10(o.minNotZero),i=s===r?o.bottom:s===o.minNotZero?o.bottom-.02*a:o.bottom-.02*a-.98*a/n*(e.log10(s)-e.log10(o.minNotZero)))),i},getValueForPixel:function(t){var a,i,n=this,o=e.log10(n.end)-e.log10(n.start);return n.isHorizontal()?(i=n.width,a=n.start*Math.pow(10,(t-n.left)*o/i)):(i=n.height,a=Math.pow(10,(n.bottom-t)*o/i)/n.start),a}});t.scaleService.registerScaleType("logarithmic",i,a)}},{}],47:[function(t,e,a){"use strict";e.exports=function(t){function e(t){return t.options.lineArc?0:t.chart.data.labels.length}function a(t){var e=t.options.pointLabels,a=f.getValueOrDefault(e.fontSize,g.defaultFontSize),i=f.getValueOrDefault(e.fontStyle,g.defaultFontStyle),n=f.getValueOrDefault(e.fontFamily,g.defaultFontFamily),o=f.fontString(a,i,n);return{size:a,style:i,family:n,font:o}}function i(t,e,a){return f.isArray(a)?{w:f.longestText(t,t.font,a),h:a.length*e+1.5*(a.length-1)*e}:{w:t.measureText(a).width,h:e}}function n(t,e,a,i,n){return t===i||t===n?{start:e-a/2,end:e+a/2}:t<i||t>n?{start:e-a-5,end:e}:{start:e,end:e+a+5}}function o(t){var o,r,s,l=a(t),u=Math.min(t.height/2,t.width/2),d={l:t.width,r:0,t:t.height,b:0},c={};t.ctx.font=l.font,t._pointLabelSizes=[];var h=e(t);for(o=0;o<h;o++){s=t.getPointPosition(o,u),r=i(t.ctx,l.size,t.pointLabels[o]||""),t._pointLabelSizes[o]=r;var g=t.getIndexAngle(o),p=f.toDegrees(g)%360,m=n(p,s.x,r.w,0,180),v=n(p,s.y,r.h,90,270);m.start<d.l&&(d.l=m.start,c.l=g),m.end>d.r&&(d.r=m.end,c.r=g),v.start<d.t&&(d.t=v.start,c.t=g),v.end>d.b&&(d.b=v.end,c.b=g)}t.setReductions(u,d,c)}function r(t){var e=Math.min(t.height/2,t.width/2);t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0)}function s(t){return 0===t||180===t?"center":t<180?"left":"right"}function l(t,e,a,i){if(f.isArray(e))for(var n=a.y,o=1.5*i,r=0;r<e.length;++r)t.fillText(e[r],a.x,n),n+=o;else t.fillText(e,a.x,a.y)}function u(t,e,a){90===t||270===t?a.y-=e.h/2:(t>270||t<90)&&(a.y-=e.h)}function d(t){var i=t.ctx,n=f.getValueOrDefault,o=t.options,r=o.angleLines,d=o.pointLabels;i.lineWidth=r.lineWidth,i.strokeStyle=r.color;var c=t.getDistanceFromCenterForValue(o.reverse?t.min:t.max),h=a(t);i.textBaseline="top";for(var p=e(t)-1;p>=0;p--){if(r.display){var m=t.getPointPosition(p,c);i.beginPath(),i.moveTo(t.xCenter,t.yCenter),i.lineTo(m.x,m.y),i.stroke(),i.closePath()}var v=t.getPointPosition(p,c+5),b=n(d.fontColor,g.defaultFontColor);i.font=h.font,i.fillStyle=b;var x=t.getIndexAngle(p),y=f.toDegrees(x);i.textAlign=s(y),u(y,t._pointLabelSizes[p],v),l(i,t.pointLabels[p]||"",v,h.size)}}function c(t,a,i,n){var o=t.ctx;if(o.strokeStyle=f.getValueAtIndexOrDefault(a.color,n-1),o.lineWidth=f.getValueAtIndexOrDefault(a.lineWidth,n-1),t.options.lineArc)o.beginPath(),o.arc(t.xCenter,t.yCenter,i,0,2*Math.PI),o.closePath(),o.stroke();else{var r=e(t);if(0===r)return;o.beginPath();var s=t.getPointPosition(0,i);o.moveTo(s.x,s.y);for(var l=1;l<r;l++)s=t.getPointPosition(l,i),o.lineTo(s.x,s.y);o.closePath(),o.stroke()}}function h(t){return f.isNumber(t)?t:0}var f=t.helpers,g=t.defaults.global,p={display:!0,animate:!0,lineArc:!1,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:t.Ticks.formatters.linear},pointLabels:{fontSize:10,callback:function(t){return t}}},m=t.LinearScaleBase.extend({setDimensions:function(){var t=this,e=t.options,a=e.ticks;t.width=t.maxWidth,t.height=t.maxHeight,t.xCenter=Math.round(t.width/2),t.yCenter=Math.round(t.height/2);var i=f.min([t.height,t.width]),n=f.getValueOrDefault(a.fontSize,g.defaultFontSize);t.drawingArea=e.display?i/2-(n/2+a.backdropPaddingY):i/2},determineDataLimits:function(){var t=this,e=t.chart,a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;f.each(e.data.datasets,function(n,o){if(e.isDatasetVisible(o)){var r=e.getDatasetMeta(o);f.each(n.data,function(e,n){var o=+t.getRightValue(e);isNaN(o)||r.data[n].hidden||(a=Math.min(o,a),i=Math.max(o,i))})}}),t.min=a===Number.POSITIVE_INFINITY?0:a,t.max=i===Number.NEGATIVE_INFINITY?0:i,t.handleTickRangeOptions()},getTickLimit:function(){var t=this.options.ticks,e=f.getValueOrDefault(t.fontSize,g.defaultFontSize);return Math.min(t.maxTicksLimit?t.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*e)))},convertTicksToLabels:function(){var e=this;t.LinearScaleBase.prototype.convertTicksToLabels.call(e),e.pointLabels=e.chart.data.labels.map(e.options.pointLabels.callback,e)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){this.options.lineArc?r(this):o(this)},setReductions:function(t,e,a){var i=this,n=e.l/Math.sin(a.l),o=Math.max(e.r-i.width,0)/Math.sin(a.r),r=-e.t/Math.cos(a.t),s=-Math.max(e.b-i.height,0)/Math.cos(a.b);n=h(n),o=h(o),r=h(r),s=h(s),i.drawingArea=Math.min(Math.round(t-(n+o)/2),Math.round(t-(r+s)/2)),i.setCenterPoint(n,o,r,s)},setCenterPoint:function(t,e,a,i){var n=this,o=n.width-e-n.drawingArea,r=t+n.drawingArea,s=a+n.drawingArea,l=n.height-i-n.drawingArea;n.xCenter=Math.round((r+o)/2+n.left),n.yCenter=Math.round((s+l)/2+n.top)},getIndexAngle:function(t){var a=2*Math.PI/e(this),i=this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0,n=i*Math.PI*2/360;return t*a+n},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var a=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*a:(t-e.min)*a},getPointPosition:function(t,e){var a=this,i=a.getIndexAngle(t)-Math.PI/2;return{x:Math.round(Math.cos(i)*e)+a.xCenter,y:Math.round(Math.sin(i)*e)+a.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this,e=t.min,a=t.max;return t.getPointPositionForValue(0,t.beginAtZero?0:e<0&&a<0?a:e>0&&a>0?e:0)},draw:function(){var t=this,e=t.options,a=e.gridLines,i=e.ticks,n=f.getValueOrDefault;if(e.display){var o=t.ctx,r=n(i.fontSize,g.defaultFontSize),s=n(i.fontStyle,g.defaultFontStyle),l=n(i.fontFamily,g.defaultFontFamily),u=f.fontString(r,s,l);f.each(t.ticks,function(s,l){if(l>0||e.reverse){var d=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),h=t.yCenter-d;if(a.display&&0!==l&&c(t,a,d,l),i.display){var f=n(i.fontColor,g.defaultFontColor);if(o.font=u,i.showLabelBackdrop){var p=o.measureText(s).width;o.fillStyle=i.backdropColor,o.fillRect(t.xCenter-p/2-i.backdropPaddingX,h-r/2-i.backdropPaddingY,p+2*i.backdropPaddingX,r+2*i.backdropPaddingY)}o.textAlign="center",o.textBaseline="middle",o.fillStyle=f,o.fillText(s,t.xCenter,h)}}}),e.lineArc||d(t)}}});t.scaleService.registerScaleType("radialLinear",m,p)}},{}],48:[function(t,e,a){"use strict";var i=t(1);i="function"==typeof i?i:window.moment,e.exports=function(t){var e=t.helpers,a={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},n={position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},o=t.Scale.extend({initialize:function(){if(!i)throw new Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");t.Scale.prototype.initialize.call(this)},getLabelMoment:function(t,e){return null===t||null===e?null:"undefined"!=typeof this.labelMoments[t]?this.labelMoments[t][e]:null},getLabelDiff:function(t,e){var a=this;return null===t||null===e?null:(void 0===a.labelDiffs&&a.buildLabelDiffs(),"undefined"!=typeof a.labelDiffs[t]?a.labelDiffs[t][e]:null)},getMomentStartOf:function(t){var e=this;return"week"===e.options.time.unit&&e.options.time.isoWeekday!==!1?t.clone().startOf("isoWeek").isoWeekday(e.options.time.isoWeekday):t.clone().startOf(e.tickUnit)},determineDataLimits:function(){var t=this;t.labelMoments=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0?(e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i))},t),t.firstTick=i.min.call(t,a),t.lastTick=i.max.call(t,a)):(t.firstTick=null,t.lastTick=null),e.each(t.chart.data.datasets,function(n,o){var r=[],s=t.chart.isDatasetVisible(o);"object"==typeof n.data[0]&&null!==n.data[0]?e.each(n.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),r.push(a),s&&(t.firstTick=null!==t.firstTick?i.min(t.firstTick,a):a,t.lastTick=null!==t.lastTick?i.max(t.lastTick,a):a))},t):r=a,t.labelMoments.push(r)},t),t.options.time.min&&(t.firstTick=t.parseTime(t.options.time.min)),t.options.time.max&&(t.lastTick=t.parseTime(t.options.time.max)),t.firstTick=(t.firstTick||i()).clone(),t.lastTick=(t.lastTick||i()).clone()},buildLabelDiffs:function(){var t=this;t.labelDiffs=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0&&e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i.diff(t.firstTick,t.tickUnit,!0)))},t),e.each(t.chart.data.datasets,function(i){var n=[];"object"==typeof i.data[0]&&null!==i.data[0]?e.each(i.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),n.push(a.diff(t.firstTick,t.tickUnit,!0)))},t):n=a,t.labelDiffs.push(n)},t)},buildTicks:function(){var i=this;i.ctx.save();var n=e.getValueOrDefault(i.options.ticks.fontSize,t.defaults.global.defaultFontSize),o=e.getValueOrDefault(i.options.ticks.fontStyle,t.defaults.global.defaultFontStyle),r=e.getValueOrDefault(i.options.ticks.fontFamily,t.defaults.global.defaultFontFamily),s=e.fontString(n,o,r);if(i.ctx.font=s,i.ticks=[],i.unitScale=1,i.scaleSizeInUnits=0,i.options.time.unit)i.tickUnit=i.options.time.unit||"day",i.displayFormat=i.options.time.displayFormats[i.tickUnit],i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,1);else{var l=i.isHorizontal()?i.width:i.height,u=i.tickFormatFunction(i.firstTick,0,[]),d=i.ctx.measureText(u).width,c=Math.cos(e.toRadians(i.options.ticks.maxRotation)),h=Math.sin(e.toRadians(i.options.ticks.maxRotation));d=d*c+n*h;var f=l/d;i.tickUnit=i.options.time.minUnit,i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.displayFormat=i.options.time.displayFormats[i.tickUnit];for(var g=0,p=a.units[g];g<a.units.length;){if(i.unitScale=1,e.isArray(p.steps)&&Math.ceil(i.scaleSizeInUnits/f)<e.max(p.steps)){for(var m=0;m<p.steps.length;++m)if(p.steps[m]>=Math.ceil(i.scaleSizeInUnits/f)){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,p.steps[m]);break}break}if(p.maxStep===!1||Math.ceil(i.scaleSizeInUnits/f)<p.maxStep){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,Math.ceil(i.scaleSizeInUnits/f));break}++g,p=a.units[g],i.tickUnit=p.name;var v=i.firstTick.diff(i.getMomentStartOf(i.firstTick),i.tickUnit,!0),b=i.getMomentStartOf(i.lastTick.clone().add(1,i.tickUnit)).diff(i.lastTick,i.tickUnit,!0);i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)+v+b,i.displayFormat=i.options.time.displayFormats[p.name]}}var x;if(i.options.time.min?x=i.getMomentStartOf(i.firstTick):(i.firstTick=i.getMomentStartOf(i.firstTick),x=i.firstTick),!i.options.time.max){var y=i.getMomentStartOf(i.lastTick),k=y.diff(i.lastTick,i.tickUnit,!0);k<0?i.lastTick=i.getMomentStartOf(i.lastTick.add(1,i.tickUnit)):k>=0&&(i.lastTick=y),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)}i.options.time.displayFormat&&(i.displayFormat=i.options.time.displayFormat),i.ticks.push(i.firstTick.clone());for(var S=i.unitScale;S<=i.scaleSizeInUnits;S+=i.unitScale){var M=x.clone().add(S,i.tickUnit);if(i.options.time.max&&M.diff(i.lastTick,i.tickUnit,!0)>=0)break;i.ticks.push(M)}var w=i.ticks[i.ticks.length-1].diff(i.lastTick,i.tickUnit);0===w&&0!==i.scaleSizeInUnits||(i.options.time.max?(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.ticks[0],i.tickUnit,!0)):(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0))),i.ctx.restore(),i.labelDiffs=void 0},getLabelForIndex:function(t,e){var a=this,i=a.chart.data.labels&&t<a.chart.data.labels.length?a.chart.data.labels[t]:"",n=a.chart.data.datasets[e].data[t];return null!==n&&"object"==typeof n&&(i=a.getRightValue(n)),a.options.time.tooltipFormat&&(i=a.parseTime(i).format(a.options.time.tooltipFormat)),i},tickFormatFunction:function(t,a,i){var n=t.format(this.displayFormat),o=this.options.ticks,r=e.getValueOrDefault(o.callback,o.userCallback);return r?r(n,a,i):n},convertTicksToLabels:function(){var t=this;t.tickMoments=t.ticks,t.ticks=t.ticks.map(t.tickFormatFunction,t)},getPixelForValue:function(t,e,a){var i=this,n=null;if(void 0!==e&&void 0!==a&&(n=i.getLabelDiff(a,e)),null===n&&(t&&t.isValid||(t=i.parseTime(i.getRightValue(t))),t&&t.isValid&&t.isValid()&&(n=t.diff(i.firstTick,i.tickUnit,!0))),null!==n){var o=0!==n?n/i.scaleSizeInUnits:n;if(i.isHorizontal()){var r=i.width*o;return i.left+Math.round(r)}var s=i.height*o;return i.top+Math.round(s)}},getPixelForTick:function(t){return this.getPixelForValue(this.tickMoments[t],null,null)},getValueForPixel:function(t){var e=this,a=e.isHorizontal()?e.width:e.height,n=(t-(e.isHorizontal()?e.left:e.top))/a;return n*=e.scaleSizeInUnits,e.firstTick.clone().add(i.duration(n,e.tickUnit).asSeconds(),"seconds")},parseTime:function(t){var e=this;return"string"==typeof e.options.time.parser?i(t,e.options.time.parser):"function"==typeof e.options.time.parser?e.options.time.parser(t):"function"==typeof t.getMonth||"number"==typeof t?i(t):t.isValid&&t.isValid()?t:"string"!=typeof e.options.time.format&&e.options.time.format.call?(console.warn("options.time.format is deprecated and replaced by options.time.parser. See http://nnnick.github.io/Chart.js/docs-v2/#scales-time-scale"),e.options.time.format(t)):i(t,e.options.time.format)}});t.scaleService.registerScaleType("time",o,n)}},{1:1}]},{},[7])(7)});
assets/js/wpp-5.0.0.min.js DELETED
@@ -1,3 +0,0 @@
1
- var WordPressPopularPosts=function(){var c=function(){},g=!!HTMLElement.prototype.attachShadow,f=function(b,e,a,c){var d=new XMLHttpRequest;b=-1!=["GET","POST"].indexOf(b)?b:"GET";d.open(b,e+("GET"==b?"?"+a:""),!0);"POST"==b&&d.setRequestHeader("Content-type","application/x-www-form-urlencoded");d.setRequestHeader("X-Requested-With","XMLHttpRequest");d.onreadystatechange=function(){4===d.readyState&&200<=d.status&&300>d.status&&"function"===typeof c&&c.call(void 0,d.response)};d.send("POST"==b?a:
2
- null)};return{get:function(b,e,a){a="function"===typeof a?a:c;f("GET",b,e,a)},post:function(b,e,a){a="function"===typeof a?a:c;f("POST",b,e,a)},ajax:f,theme:function(b){if(g){var e=document.createElement("style"),a=document.createElement("a");b.parentNode.appendChild(a);var c=getComputedStyle(a);e.innerHTML=".wpp-list li a {color: "+c.color+"}";b.parentNode.removeChild(a);a=b.attachShadow({mode:"open"});for(a.append(e);b.firstElementChild;)a.append(b.firstElementChild)}}}}();
3
- if("undefined"!==typeof wpp_params&&0<wpp_params.ID){var do_request=!0;if("1"==wpp_params.sampling_active){var num=Math.floor(Math.random()*wpp_params.sampling_rate)+1;do_request=1===num}do_request&&WordPressPopularPosts.post(wpp_params.ajax_url,"_wpnonce="+wpp_params.token+"&wpp_id="+wpp_params.ID+"&sampling="+wpp_params.sampling_active+"&sampling_rate="+wpp_params.sampling_rate,function(c){wpp_params.debug&&window.console&&window.console.log&&window.console.log(JSON.parse(c))})};
 
 
 
assets/js/wpp-5.2.0.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ var WordPressPopularPosts=function(){var g=function(){},f=!!HTMLElement.prototype.attachShadow,d=function(b,c,a,d){var e=new XMLHttpRequest;b=-1!=["GET","POST"].indexOf(b)?b:"GET";e.open(b,c+("GET"==b?"?"+a:""),!0);"POST"==b&&e.setRequestHeader("Content-type","application/x-www-form-urlencoded");e.setRequestHeader("X-Requested-With","XMLHttpRequest");e.onreadystatechange=function(){4===e.readyState&&200<=e.status&&300>e.status&&"function"===typeof d&&d.call(void 0,e.response)};e.send("POST"==b?a:
2
+ null)};return{get:function(b,c,a){a="function"===typeof a?a:g;d("GET",b,c,a)},post:function(b,c,a){a="function"===typeof a?a:g;d("POST",b,c,a)},ajax:d,theme:function(b){if(f){var c=document.createElement("style"),a=document.createElement("ul");a.innerHTML='<li><a href="#"></a></li>';b.parentNode.appendChild(a);var d=getComputedStyle(a.querySelector("li")),e=getComputedStyle(a.querySelector("li a"));c.innerHTML=".wpp-list li {font-size: "+d.fontSize+"}";c.innerHTML+=".wpp-list li a {color: "+e.color+
3
+ "}";b.parentNode.removeChild(a);a=b.attachShadow({mode:"open"});for(a.append(c);b.firstElementChild;)a.append(b.firstElementChild)}}}}();
4
+ (function(){try{var g=document.querySelector("script#wpp-json"),f=!0;wpp_params=JSON.parse(g.textContent);wpp_params.ID&&("1"==wpp_params.sampling_active&&(f=1===Math.floor(Math.random()*wpp_params.sampling_rate)+1),f&&WordPressPopularPosts.post(wpp_params.ajax_url,"_wpnonce="+wpp_params.token+"&wpp_id="+wpp_params.ID+"&sampling="+wpp_params.sampling_active+"&sampling_rate="+wpp_params.sampling_rate,function(d){wpp_params.debug&&window.console&&window.console.log&&window.console.log(JSON.parse(d))}))}catch(d){console.error("WPP: Couldn't read JSON data")}})();
5
+ document.addEventListener("DOMContentLoaded",function(){function g(b){WordPressPopularPosts.get(wpp_params.ajax_url+"/widget/"+b.getAttribute("data-widget-id").split("-")[1],"is_single="+wpp_params.ID+(wpp_params.lang?"&lang="+wpp_params.lang:""),function(c){b.insertAdjacentHTML("afterend",JSON.parse(c).widget);c=b.parentNode;var a=c.querySelector(".popular-posts-sr");c.removeChild(b);a&&WordPressPopularPosts.theme(a);a=null;"function"===typeof Event?a=new Event("wpp-onload",{bubbles:!0,cancelable:!1}):
6
+ document.createEvent&&(a=document.createEvent("Event"),a.initEvent("wpp-onload",!0,!1));a&&c.dispatchEvent(a)})}var f=document.querySelectorAll(".wpp-widget-placeholder");if(f.length)for(var d=0;d<f.length;d++)g(f[d])});
assets/js/wpp.js CHANGED
@@ -1,95 +1,150 @@
1
- var WordPressPopularPosts = (function(){
2
-
3
- "use strict";
4
-
5
- var noop = function(){};
6
- var supportsShadowDOMV1 = !! HTMLElement.prototype.attachShadow;
7
-
8
- var get = function( url, params, callback ){
9
- callback = ( 'function' === typeof callback ) ? callback : noop;
10
- ajax( "GET", url, params, callback );
11
- };
12
-
13
- var post = function( url, params, callback ){
14
- callback = ( 'function' === typeof callback ) ? callback : noop;
15
- ajax( "POST", url, params, callback );
16
- };
17
-
18
- var ajax = function( method, url, params, callback ){
19
- /* Create XMLHttpRequest object and set variables */
20
- var xhr = new XMLHttpRequest(),
21
- target = url,
22
- args = params,
23
- valid_methods = ["GET", "POST"];
24
- method = -1 != valid_methods.indexOf( method ) ? method : "GET";
25
- /* Set request method and target URL */
26
- xhr.open( method, target + ( "GET" == method ? '?' + args : '' ), true );
27
- /* Set request headers */
28
- if ( "POST" == method ) {
29
- xhr.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
30
- }
31
- xhr.setRequestHeader( "X-Requested-With","XMLHttpRequest" );
32
- /* Hook into onreadystatechange */
33
- xhr.onreadystatechange = function() {
34
- if ( 4 === xhr.readyState && 200 <= xhr.status && 300 > xhr.status ) {
35
- if ( 'function' === typeof callback ) {
36
- callback.call( undefined, xhr.response );
37
- }
38
- }
39
- };
40
- /* Send request */
41
- xhr.send( ( "POST" == method ? args : null ) );
42
- };
43
-
44
- var theme = function(wpp_list) {
45
- if ( supportsShadowDOMV1 ) {
46
- let link_styles = document.createElement('style'),
47
- dummy_link = document.createElement('a');
48
-
49
- wpp_list.parentNode.appendChild(dummy_link);
50
-
51
- let dummy_link_styles = getComputedStyle(dummy_link);
52
- link_styles.innerHTML = '.wpp-list li a {color: '+ dummy_link_styles.color +'}';
53
-
54
- wpp_list.parentNode.removeChild(dummy_link);
55
-
56
- let wpp_list_sr = wpp_list.attachShadow({mode: "open"});
57
-
58
- wpp_list_sr.append(link_styles);
59
-
60
- while(wpp_list.firstElementChild) {
61
- wpp_list_sr.append(wpp_list.firstElementChild);
62
- }
63
- }
64
- };
65
-
66
- return {
67
- get: get,
68
- post: post,
69
- ajax: ajax,
70
- theme: theme
71
- };
72
-
73
- })();
74
-
75
- if (
76
- "undefined" !== typeof wpp_params
77
- && wpp_params.ID > 0
78
- ) {
79
- var do_request = true;
80
-
81
- if ( '1' == wpp_params.sampling_active ) {
82
- var num = Math.floor(Math.random() * wpp_params.sampling_rate) + 1;
83
- do_request = ( 1 === num );
84
- }
85
-
86
- if ( do_request ) {
87
- WordPressPopularPosts.post(
88
- wpp_params.ajax_url,
89
- "_wpnonce=" + wpp_params.token + "&wpp_id=" + wpp_params.ID + "&sampling=" + wpp_params.sampling_active + "&sampling_rate=" + wpp_params.sampling_rate,
90
- function( response ){
91
- wpp_params.debug&&window.console&&window.console.log&&window.console.log(JSON.parse(response));
92
- }
93
- );
94
- }
95
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WordPressPopularPosts = (function(){
2
+
3
+ "use strict";
4
+
5
+ var noop = function(){};
6
+ var supportsShadowDOMV1 = !! HTMLElement.prototype.attachShadow;
7
+
8
+ var get = function( url, params, callback ){
9
+ callback = ( 'function' === typeof callback ) ? callback : noop;
10
+ ajax( "GET", url, params, callback );
11
+ };
12
+
13
+ var post = function( url, params, callback ){
14
+ callback = ( 'function' === typeof callback ) ? callback : noop;
15
+ ajax( "POST", url, params, callback );
16
+ };
17
+
18
+ var ajax = function( method, url, params, callback ){
19
+ /* Create XMLHttpRequest object and set variables */
20
+ var xhr = new XMLHttpRequest(),
21
+ target = url,
22
+ args = params,
23
+ valid_methods = ["GET", "POST"];
24
+ method = -1 != valid_methods.indexOf( method ) ? method : "GET";
25
+ /* Set request method and target URL */
26
+ xhr.open( method, target + ( "GET" == method ? '?' + args : '' ), true );
27
+ /* Set request headers */
28
+ if ( "POST" == method ) {
29
+ xhr.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
30
+ }
31
+ xhr.setRequestHeader( "X-Requested-With","XMLHttpRequest" );
32
+ /* Hook into onreadystatechange */
33
+ xhr.onreadystatechange = function() {
34
+ if ( 4 === xhr.readyState && 200 <= xhr.status && 300 > xhr.status ) {
35
+ if ( 'function' === typeof callback ) {
36
+ callback.call( undefined, xhr.response );
37
+ }
38
+ }
39
+ };
40
+ /* Send request */
41
+ xhr.send( ( "POST" == method ? args : null ) );
42
+ };
43
+
44
+ var theme = function(wpp_list) {
45
+ if ( supportsShadowDOMV1 ) {
46
+ let base_styles = document.createElement('style'),
47
+ dummy_list = document.createElement('ul');
48
+
49
+ dummy_list.innerHTML = '<li><a href="#"></a></li>';
50
+ wpp_list.parentNode.appendChild(dummy_list);
51
+
52
+ let dummy_list_item_styles = getComputedStyle(dummy_list.querySelector('li')),
53
+ dummy_link_item_styles = getComputedStyle(dummy_list.querySelector('li a'));
54
+
55
+ base_styles.innerHTML = '.wpp-list li {font-size: '+ dummy_list_item_styles.fontSize +'}';
56
+ base_styles.innerHTML += '.wpp-list li a {color: '+ dummy_link_item_styles.color +'}';
57
+
58
+ wpp_list.parentNode.removeChild(dummy_list);
59
+
60
+ let wpp_list_sr = wpp_list.attachShadow({mode: "open"});
61
+
62
+ wpp_list_sr.append(base_styles);
63
+
64
+ while(wpp_list.firstElementChild) {
65
+ wpp_list_sr.append(wpp_list.firstElementChild);
66
+ }
67
+ }
68
+ };
69
+
70
+ return {
71
+ get: get,
72
+ post: post,
73
+ ajax: ajax,
74
+ theme: theme
75
+ };
76
+
77
+ })();
78
+
79
+ (function(){
80
+ try {
81
+ var wpp_json = document.querySelector("script#wpp-json"),
82
+ do_request = true;
83
+
84
+ wpp_params = JSON.parse(wpp_json.textContent);
85
+
86
+ if ( wpp_params.ID ) {
87
+ if ( '1' == wpp_params.sampling_active ) {
88
+ var num = Math.floor(Math.random() * wpp_params.sampling_rate) + 1;
89
+ do_request = ( 1 === num );
90
+ }
91
+
92
+ if ( do_request ) {
93
+ WordPressPopularPosts.post(
94
+ wpp_params.ajax_url,
95
+ "_wpnonce=" + wpp_params.token + "&wpp_id=" + wpp_params.ID + "&sampling=" + wpp_params.sampling_active + "&sampling_rate=" + wpp_params.sampling_rate,
96
+ function( response ) {
97
+ wpp_params.debug&&window.console&&window.console.log&&window.console.log(JSON.parse(response));
98
+ }
99
+ );
100
+ }
101
+ }
102
+ } catch (err) {
103
+ console.error("WPP: Couldn't read JSON data");
104
+ }
105
+ })();
106
+
107
+ document.addEventListener('DOMContentLoaded', function() {
108
+ var widget_placeholders = document.querySelectorAll('.wpp-widget-placeholder');
109
+
110
+ if ( widget_placeholders.length ) {
111
+ for( var w = 0; w < widget_placeholders.length; w++ ) {
112
+ fetchWidget(widget_placeholders[w]);
113
+ }
114
+ }
115
+
116
+ function fetchWidget(widget_placeholder) {
117
+ WordPressPopularPosts.get(
118
+ wpp_params.ajax_url + '/widget/' + widget_placeholder.getAttribute('data-widget-id').split('-')[1],
119
+ 'is_single=' + wpp_params.ID + ( wpp_params.lang ? '&lang=' + wpp_params.lang : '' ),
120
+ function(response) {
121
+ widget_placeholder.insertAdjacentHTML('afterend', JSON.parse(response).widget);
122
+
123
+ let parent = widget_placeholder.parentNode,
124
+ sr = parent.querySelector('.popular-posts-sr');
125
+
126
+ parent.removeChild(widget_placeholder);
127
+
128
+ if ( sr ) {
129
+ WordPressPopularPosts.theme(sr);
130
+ }
131
+
132
+ let event = null;
133
+
134
+ if ( 'function' === typeof(Event) ) {
135
+ event = new Event("wpp-onload", {"bubbles": true, "cancelable": false});
136
+ } /* Fallback for older browsers */
137
+ else {
138
+ if ( document.createEvent ) {
139
+ event = document.createEvent('Event');
140
+ event.initEvent("wpp-onload", true, false);
141
+ }
142
+ }
143
+
144
+ if ( event ) {
145
+ parent.dispatchEvent(event);
146
+ }
147
+ }
148
+ );
149
+ }
150
+ });
assets/themes/cards-compact/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Cards Compact",
3
- "description": "A compact card-style popular posts list.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": false,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": true,
25
- "build": "manual",
26
- "width": 75,
27
- "height": 75,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": true,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-cards-compact\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li>{thumb_img}<div class=\"wpp-item-data\">{taxonomy} {title}</div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Cards Compact",
3
+ "description": "A compact card-style popular posts list.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": false,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": true,
25
+ "build": "manual",
26
+ "width": 75,
27
+ "height": 75,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": true,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-cards-compact\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li>{thumb_img}<div class=\"wpp-item-data\"><div class=\"taxonomies\">{taxonomy}</div>{title}</div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/cards-compact/style.css CHANGED
@@ -1,64 +1,64 @@
1
- .wpp-cards-compact {
2
- margin-left: 0;
3
- margin-right: 0;
4
- padding: 0;
5
- }
6
-
7
- .wpp-cards-compact li {
8
- display: flex;
9
- align-items: center;
10
- list-style: none;
11
- margin: 0 0 1.2rem 0;
12
- padding: 0 0 1rem 0;
13
- border-bottom: #ddd 1px solid;
14
- }
15
-
16
- .wpp-cards-compact li:last-of-type,
17
- .wpp-cards-compact li:only-child {
18
- margin: 0;
19
- padding: 0;
20
- border-bottom: none;
21
- }
22
-
23
- .wpp-cards-compact li .wpp-thumbnail {
24
- overflow: hidden;
25
- display: inline-block;
26
- flex-grow: 0;
27
- flex-shrink: 0;
28
- margin-right: 1rem;
29
- font-size: 0.8rem;
30
- line-height: 1;
31
- background: #f0f0f0;
32
- border: none;
33
- }
34
-
35
- .wpp-cards-compact li a {
36
- text-decoration: none;
37
- }
38
-
39
- .wpp-cards-compact li a:hover {
40
- text-decoration: underline;
41
- }
42
-
43
- .wpp-cards-compact li .category,
44
- .wpp-cards-compact li .wpp-post-title {
45
- display: block;
46
- font-weight: bold;
47
- }
48
-
49
- .wpp-cards-compact li .category {
50
- margin-bottom: 0.25rem;
51
- font-size: 0.7rem;
52
- line-height: 1;
53
- }
54
-
55
- .wpp-cards-compact li .wpp-post-title {
56
- margin-bottom: 0.5rem;
57
- font-size: 1.2rem;
58
- line-height: 1.2;
59
- }
60
-
61
- .wpp-cards-compact li .wpp-excerpt {
62
- margin: 0;
63
- font-size: 0.8rem;
64
  }
1
+ .wpp-cards-compact {
2
+ margin-left: 0;
3
+ margin-right: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .wpp-cards-compact li {
8
+ display: flex;
9
+ align-items: center;
10
+ list-style: none;
11
+ margin: 0 0 1.2em 0;
12
+ padding: 0 0 1em 0;
13
+ border-bottom: #ddd 1px solid;
14
+ }
15
+
16
+ .wpp-cards-compact li:last-of-type,
17
+ .wpp-cards-compact li:only-child {
18
+ margin: 0;
19
+ padding: 0;
20
+ border-bottom: none;
21
+ }
22
+
23
+ .wpp-cards-compact li .wpp-thumbnail {
24
+ overflow: hidden;
25
+ display: inline-block;
26
+ flex-grow: 0;
27
+ flex-shrink: 0;
28
+ margin-right: 1em;
29
+ font-size: 0.8em;
30
+ line-height: 1;
31
+ background: #f0f0f0;
32
+ border: none;
33
+ }
34
+
35
+ .wpp-cards-compact li a {
36
+ text-decoration: none;
37
+ }
38
+
39
+ .wpp-cards-compact li a:hover {
40
+ text-decoration: underline;
41
+ }
42
+
43
+ .wpp-cards-compact li .taxonomies,
44
+ .wpp-cards-compact li .wpp-post-title {
45
+ display: block;
46
+ font-weight: bold;
47
+ }
48
+
49
+ .wpp-cards-compact li .taxonomies {
50
+ margin-bottom: 0.25em;
51
+ font-size: 0.7em;
52
+ line-height: 1;
53
+ }
54
+
55
+ .wpp-cards-compact li .wpp-post-title {
56
+ margin-bottom: 0.5em;
57
+ font-size: 1.2em;
58
+ line-height: 1.2;
59
+ }
60
+
61
+ .wpp-cards-compact li .wpp-excerpt {
62
+ margin: 0;
63
+ font-size: 0.8em;
64
  }
assets/themes/cards/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Cards",
3
- "description": "A card-style popular posts list.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": true,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": true,
25
- "build": "manual",
26
- "width": 75,
27
- "height": 75,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": true,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-cards\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li>{thumb_img} <div class=\"wpp-item-data\">{taxonomy} {title} <p class=\"wpp-excerpt\">{excerpt}</p></div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Cards",
3
+ "description": "A card-style popular posts list.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": true,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": true,
25
+ "build": "manual",
26
+ "width": 75,
27
+ "height": 75,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": true,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-cards\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li>{thumb_img} <div class=\"wpp-item-data\"><div class=\"taxonomies\">{taxonomy}</div>{title} <p class=\"wpp-excerpt\">{excerpt}</p></div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/cards/style.css CHANGED
@@ -1,63 +1,63 @@
1
- .wpp-cards {
2
- margin-left: 0;
3
- margin-right: 0;
4
- padding: 0;
5
- }
6
-
7
- .wpp-cards li {
8
- display: flex;
9
- list-style: none;
10
- margin: 0 0 1.2rem 0;
11
- padding: 0 0 1rem 0;
12
- border-bottom: #ddd 1px solid;
13
- }
14
-
15
- .wpp-cards li:last-of-type,
16
- .wpp-cards li:only-child {
17
- margin: 0;
18
- padding: 0;
19
- border-bottom: none;
20
- }
21
-
22
- .wpp-cards li .wpp-thumbnail {
23
- overflow: hidden;
24
- display: inline-block;
25
- flex-grow: 0;
26
- flex-shrink: 0;
27
- margin-right: 1rem;
28
- font-size: 0.8rem;
29
- line-height: 1;
30
- background: #f0f0f0;
31
- border: none;
32
- }
33
-
34
- .wpp-cards li a {
35
- text-decoration: none;
36
- }
37
-
38
- .wpp-cards li a:hover {
39
- text-decoration: underline;
40
- }
41
-
42
- .wpp-cards li .category,
43
- .wpp-cards li .wpp-post-title {
44
- display: block;
45
- font-weight: bold;
46
- }
47
-
48
- .wpp-cards li .category {
49
- margin-bottom: 0.25rem;
50
- font-size: 0.7rem;
51
- line-height: 1;
52
- }
53
-
54
- .wpp-cards li .wpp-post-title {
55
- margin-bottom: 0.5rem;
56
- font-size: 1.2rem;
57
- line-height: 1.2;
58
- }
59
-
60
- .wpp-cards li .wpp-excerpt {
61
- margin: 0;
62
- font-size: 0.8rem;
63
  }
1
+ .wpp-cards {
2
+ margin-left: 0;
3
+ margin-right: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .wpp-cards li {
8
+ display: flex;
9
+ list-style: none;
10
+ margin: 0 0 1.2em 0;
11
+ padding: 0 0 1em 0;
12
+ border-bottom: #ddd 1px solid;
13
+ }
14
+
15
+ .wpp-cards li:last-of-type,
16
+ .wpp-cards li:only-child {
17
+ margin: 0;
18
+ padding: 0;
19
+ border-bottom: none;
20
+ }
21
+
22
+ .wpp-cards li .wpp-thumbnail {
23
+ overflow: hidden;
24
+ display: inline-block;
25
+ flex-grow: 0;
26
+ flex-shrink: 0;
27
+ margin-right: 1em;
28
+ font-size: 0.8em;
29
+ line-height: 1;
30
+ background: #f0f0f0;
31
+ border: none;
32
+ }
33
+
34
+ .wpp-cards li a {
35
+ text-decoration: none;
36
+ }
37
+
38
+ .wpp-cards li a:hover {
39
+ text-decoration: underline;
40
+ }
41
+
42
+ .wpp-cards li .taxonomies,
43
+ .wpp-cards li .wpp-post-title {
44
+ display: block;
45
+ font-weight: bold;
46
+ }
47
+
48
+ .wpp-cards li .taxonomies {
49
+ margin-bottom: 0.25em;
50
+ font-size: 0.7em;
51
+ line-height: 1;
52
+ }
53
+
54
+ .wpp-cards li .wpp-post-title {
55
+ margin-bottom: 0.5em;
56
+ font-size: 1.2em;
57
+ line-height: 1.2;
58
+ }
59
+
60
+ .wpp-cards li .wpp-excerpt {
61
+ margin: 0;
62
+ font-size: 0.8em;
63
  }
assets/themes/cardview-compact/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Cardview Compact",
3
- "description": "A compact cardview-style popular posts list.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": false,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": true,
25
- "build": "manual",
26
- "width": 320,
27
- "height": 165,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": true,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-cardview-compact\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li><div class=\"wpp-thumbnail-container\">{thumb} {taxonomy}</div> <div class=\"wpp-item-data\">{title}</div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Cardview Compact",
3
+ "description": "A compact cardview-style popular posts list.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": false,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": true,
25
+ "build": "manual",
26
+ "width": 320,
27
+ "height": 165,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": true,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-cardview-compact\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li><div class=\"wpp-thumbnail-container\">{thumb}<div class=\"taxonomies\">{taxonomy}</div></div> <div class=\"wpp-item-data\">{title}</div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/cardview-compact/style.css CHANGED
@@ -1,77 +1,71 @@
1
- .wpp-cardview-compact {
2
- margin-left: 0;
3
- margin-right: 0;
4
- padding: 0;
5
- }
6
-
7
- .wpp-cardview-compact li {
8
- list-style: none;
9
- margin: 0 0 1.2rem 0;
10
- padding: 0 0 1rem 0;
11
- border-bottom: #ddd 1px solid;
12
- }
13
-
14
- .wpp-cardview-compact li:last-of-type,
15
- .wpp-cardview-compact li:only-child {
16
- margin: 0;
17
- padding: 0;
18
- border-bottom: none;
19
- }
20
-
21
- .wpp-cardview-compact .wpp-thumbnail-container {
22
- position: relative;
23
- margin-bottom: .8rem;
24
- }
25
-
26
- .wpp-cardview-compact li .wpp-thumbnail {
27
- overflow: hidden;
28
- display: block;
29
- margin: 0;
30
- width: 100%;
31
- height: auto;
32
- font-size: 0.8rem;
33
- line-height: 1;
34
- background: #f0f0f0;
35
- border: none;
36
- }
37
-
38
- .wpp-cardview-compact li a {
39
- text-decoration: none;
40
- }
41
-
42
- .wpp-cardview-compact li a:hover {
43
- text-decoration: underline;
44
- }
45
-
46
- .wpp-cardview-compact li .category,
47
- .wpp-cardview-compact li .wpp-post-title {
48
- display: block;
49
- font-weight: bold;
50
- }
51
-
52
- .wpp-cardview-compact li .category {
53
- position: absolute;
54
- bottom: 0;
55
- left: 0;
56
- padding: 1em;
57
- color: #fff;
58
- font-size: 0.7rem;
59
- line-height: 1;
60
- background: rgba(0, 0, 0, 0.5);
61
- }
62
-
63
- .wpp-cardview-compact li .category:hover {
64
- color: #fff;
65
- background: rgba(0, 0, 0, 0.8);
66
- }
67
-
68
- .wpp-cardview-compact li .wpp-post-title {
69
- margin: 0 0 0.5rem;
70
- font-size: 1.2rem;
71
- line-height: 1.2;
72
- }
73
-
74
- .wpp-cardview-compact li .wpp-excerpt {
75
- margin: 0;
76
- font-size: 0.8rem;
77
- }
1
+ .wpp-cardview-compact {
2
+ margin-left: 0;
3
+ margin-right: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .wpp-cardview-compact li {
8
+ list-style: none;
9
+ margin: 0 0 1.2em 0;
10
+ padding: 0 0 1em 0;
11
+ border-bottom: #ddd 1px solid;
12
+ }
13
+
14
+ .wpp-cardview-compact li:last-of-type,
15
+ .wpp-cardview-compact li:only-child {
16
+ margin: 0;
17
+ padding: 0;
18
+ border-bottom: none;
19
+ }
20
+
21
+ .wpp-cardview-compact .wpp-thumbnail-container {
22
+ position: relative;
23
+ margin-bottom: .8em;
24
+ }
25
+
26
+ .wpp-cardview-compact li .wpp-thumbnail {
27
+ overflow: hidden;
28
+ display: block;
29
+ margin: 0;
30
+ width: 100%;
31
+ height: auto;
32
+ font-size: 0.8em;
33
+ line-height: 1;
34
+ background: #f0f0f0;
35
+ border: none;
36
+ }
37
+
38
+ .wpp-cardview-compact li a {
39
+ text-decoration: none;
40
+ }
41
+
42
+ .wpp-cardview-compact li a:hover {
43
+ text-decoration: underline;
44
+ }
45
+
46
+ .wpp-cardview-compact li .taxonomies,
47
+ .wpp-cardview-compact li .wpp-post-title {
48
+ display: block;
49
+ font-weight: bold;
50
+ }
51
+
52
+ .wpp-cardview-compact li .taxonomies {
53
+ position: absolute;
54
+ bottom: 0;
55
+ left: 0;
56
+ padding: 1em;
57
+ color: #aaa;
58
+ font-size: 0.7em;
59
+ line-height: 1;
60
+ background: rgba(0, 0, 0, 0.5);
61
+ }
62
+
63
+ .wpp-cardview-compact li .taxonomies a {
64
+ color: #fff;
65
+ }
66
+
67
+ .wpp-cardview-compact li .wpp-post-title {
68
+ margin: 0 0 0.5em;
69
+ font-size: 1.2em;
70
+ line-height: 1.2;
71
+ }
 
 
 
 
 
 
assets/themes/cardview/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Cardview",
3
- "description": "A cardview-style popular posts list.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": true,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": true,
25
- "build": "manual",
26
- "width": 320,
27
- "height": 165,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": true,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-cardview\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li><div class=\"wpp-thumbnail-container\">{thumb} {taxonomy}</div> <div class=\"wpp-item-data\">{title} <p class=\"wpp-excerpt\">{excerpt}</p></div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Cardview",
3
+ "description": "A cardview-style popular posts list.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": true,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": true,
25
+ "build": "manual",
26
+ "width": 320,
27
+ "height": 165,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": true,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-cardview\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li><div class=\"wpp-thumbnail-container\">{thumb}<div class=\"taxonomies\">{taxonomy}</div></div> <div class=\"wpp-item-data\">{title} <p class=\"wpp-excerpt\">{excerpt}</p></div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/cardview/style.css CHANGED
@@ -1,77 +1,76 @@
1
- .wpp-cardview {
2
- margin-left: 0;
3
- margin-right: 0;
4
- padding: 0;
5
- }
6
-
7
- .wpp-cardview li {
8
- list-style: none;
9
- margin: 0 0 1.2rem 0;
10
- padding: 0 0 1rem 0;
11
- border-bottom: #ddd 1px solid;
12
- }
13
-
14
- .wpp-cardview li:last-of-type,
15
- .wpp-cardview li:only-child {
16
- margin: 0;
17
- padding: 0;
18
- border-bottom: none;
19
- }
20
-
21
- .wpp-cardview .wpp-thumbnail-container {
22
- position: relative;
23
- margin-bottom: .8rem;
24
- }
25
-
26
- .wpp-cardview li .wpp-thumbnail {
27
- overflow: hidden;
28
- display: block;
29
- margin: 0;
30
- width: 100%;
31
- height: auto;
32
- font-size: 0.8rem;
33
- line-height: 1;
34
- background: #f0f0f0;
35
- border: none;
36
- }
37
-
38
- .wpp-cardview li a {
39
- text-decoration: none;
40
- }
41
-
42
- .wpp-cardview li a:hover {
43
- text-decoration: underline;
44
- }
45
-
46
- .wpp-cardview li .category,
47
- .wpp-cardview li .wpp-post-title {
48
- display: block;
49
- font-weight: bold;
50
- }
51
-
52
- .wpp-cardview li .category {
53
- position: absolute;
54
- bottom: 0;
55
- left: 0;
56
- padding: 1em;
57
- color: #fff;
58
- font-size: 0.7rem;
59
- line-height: 1;
60
- background: rgba(0, 0, 0, 0.5);
61
- }
62
-
63
- .wpp-cardview li .category:hover {
64
- color: #fff;
65
- background: rgba(0, 0, 0, 0.8);
66
- }
67
-
68
- .wpp-cardview li .wpp-post-title {
69
- margin: 0 0 0.5rem;
70
- font-size: 1.2rem;
71
- line-height: 1.2;
72
- }
73
-
74
- .wpp-cardview li .wpp-excerpt {
75
- margin: 0;
76
- font-size: 0.8rem;
77
  }
1
+ .wpp-cardview {
2
+ margin-left: 0;
3
+ margin-right: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .wpp-cardview li {
8
+ list-style: none;
9
+ margin: 0 0 1.2em 0;
10
+ padding: 0 0 1em 0;
11
+ border-bottom: #ddd 1px solid;
12
+ }
13
+
14
+ .wpp-cardview li:last-of-type,
15
+ .wpp-cardview li:only-child {
16
+ margin: 0;
17
+ padding: 0;
18
+ border-bottom: none;
19
+ }
20
+
21
+ .wpp-cardview .wpp-thumbnail-container {
22
+ position: relative;
23
+ margin-bottom: .8em;
24
+ }
25
+
26
+ .wpp-cardview li .wpp-thumbnail {
27
+ overflow: hidden;
28
+ display: block;
29
+ margin: 0;
30
+ width: 100%;
31
+ height: auto;
32
+ font-size: 0.8em;
33
+ line-height: 1;
34
+ background: #f0f0f0;
35
+ border: none;
36
+ }
37
+
38
+ .wpp-cardview li a {
39
+ text-decoration: none;
40
+ }
41
+
42
+ .wpp-cardview li a:hover {
43
+ text-decoration: underline;
44
+ }
45
+
46
+ .wpp-cardview li .taxonomies,
47
+ .wpp-cardview li .wpp-post-title {
48
+ display: block;
49
+ font-weight: bold;
50
+ }
51
+
52
+ .wpp-cardview li .taxonomies {
53
+ position: absolute;
54
+ bottom: 0;
55
+ left: 0;
56
+ padding: 1em;
57
+ color: #aaa;
58
+ font-size: 0.7em;
59
+ line-height: 1;
60
+ background: rgba(0, 0, 0, 0.5);
61
+ }
62
+
63
+ .wpp-cardview li .taxonomies a {
64
+ color: #fff;
65
+ }
66
+
67
+ .wpp-cardview li .wpp-post-title {
68
+ margin: 0 0 0.5em;
69
+ font-size: 1.2em;
70
+ line-height: 1.2;
71
+ }
72
+
73
+ .wpp-cardview li .wpp-excerpt {
74
+ margin: 0;
75
+ font-size: 0.8em;
 
76
  }
assets/themes/evergreen/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Evergreen",
3
- "description": "A simple list of popular posts.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": false,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": false,
25
- "build": "manual",
26
- "width": 75,
27
- "height": 75,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": false,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-evergreen\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Evergreen",
3
+ "description": "A simple list of popular posts.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": false,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": false,
25
+ "build": "manual",
26
+ "width": 75,
27
+ "height": 75,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": false,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-evergreen\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/evergreen/style.css CHANGED
@@ -1,49 +1,49 @@
1
- .wpp-evergreen {
2
- counter-reset: wpp-counter;
3
- margin-left: 0;
4
- margin-right: 0;
5
- padding: 0;
6
- border-right: 6px solid rgb(49, 188, 7);
7
- box-sizing: border-box;
8
- }
9
-
10
- .wpp-evergreen li {
11
- position: relative;
12
- display: flex;
13
- align-items: center;
14
- counter-increment: wpp-counter;
15
- position: relative;
16
- list-style: none;
17
- margin: 0;
18
- padding: 15px 15px 15px 0;
19
- background: rgba(49, 188, 7, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
- box-sizing: border-box;
21
- }
22
-
23
- .wpp-evergreen li .item-position::before {
24
- display: inline-block;
25
- flex: 1 0 0;
26
- content: counter(wpp-counter);
27
- color: rgba(0, 0, 0, 0.15);
28
- width: 40px;
29
- font-size: 18px;
30
- font-weight: 700;
31
- letter-spacing: -1px;
32
- text-align: center;
33
- }
34
-
35
- .wpp-evergreen li .item-data .wpp-post-title {
36
- display: block;
37
- font-size: 15px;
38
- font-weight: 700;
39
- line-height: 1.3;
40
- }
41
-
42
- .wpp-evergreen li .item-data a {
43
- color: #0f470e;
44
- text-decoration: none;
45
- }
46
-
47
- .wpp-evergreen li .item-data a:hover {
48
- text-decoration: underline;
49
  }
1
+ .wpp-evergreen {
2
+ counter-reset: wpp-counter;
3
+ margin-left: 0;
4
+ margin-right: 0;
5
+ padding: 0;
6
+ border-right: 6px solid rgb(49, 188, 7);
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ .wpp-evergreen li {
11
+ position: relative;
12
+ display: flex;
13
+ align-items: center;
14
+ counter-increment: wpp-counter;
15
+ position: relative;
16
+ list-style: none;
17
+ margin: 0;
18
+ padding: 15px 15px 15px 0;
19
+ background: rgba(49, 188, 7, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ .wpp-evergreen li .item-position::before {
24
+ display: inline-block;
25
+ flex: 1 0 0;
26
+ content: counter(wpp-counter);
27
+ color: rgba(0, 0, 0, 0.15);
28
+ width: 40px;
29
+ font-size: 18px;
30
+ font-weight: 700;
31
+ letter-spacing: -1px;
32
+ text-align: center;
33
+ }
34
+
35
+ .wpp-evergreen li .item-data .wpp-post-title {
36
+ display: block;
37
+ font-size: 15px;
38
+ font-weight: 700;
39
+ line-height: 1.3;
40
+ }
41
+
42
+ .wpp-evergreen li .item-data a {
43
+ color: #0f470e;
44
+ text-decoration: none;
45
+ }
46
+
47
+ .wpp-evergreen li .item-data a:hover {
48
+ text-decoration: underline;
49
  }
assets/themes/midnight/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Midnight",
3
- "description": "A simple list of popular posts.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": false,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": false,
25
- "build": "manual",
26
- "width": 75,
27
- "height": 75,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": false,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-midnight\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Midnight",
3
+ "description": "A simple list of popular posts.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": false,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": false,
25
+ "build": "manual",
26
+ "width": 75,
27
+ "height": 75,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": false,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-midnight\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/midnight/style.css CHANGED
@@ -1,49 +1,49 @@
1
- .wpp-midnight {
2
- counter-reset: wpp-counter;
3
- margin-left: 0;
4
- margin-right: 0;
5
- padding: 0;
6
- border-right: 6px solid rgb(0, 51, 51);
7
- box-sizing: border-box;
8
- }
9
-
10
- .wpp-midnight li {
11
- position: relative;
12
- display: flex;
13
- align-items: center;
14
- counter-increment: wpp-counter;
15
- position: relative;
16
- list-style: none;
17
- margin: 0;
18
- padding: 15px 15px 15px 0;
19
- background: rgba(0, 51, 51, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
- box-sizing: border-box;
21
- }
22
-
23
- .wpp-midnight li .item-position::before {
24
- display: inline-block;
25
- flex: 1 0 0;
26
- content: counter(wpp-counter);
27
- color: rgba(255, 255, 255, 0.3);
28
- width: 40px;
29
- font-size: 18px;
30
- font-weight: 700;
31
- letter-spacing: -1px;
32
- text-align: center;
33
- }
34
-
35
- .wpp-midnight li .item-data .wpp-post-title {
36
- display: block;
37
- font-size: 15px;
38
- font-weight: 700;
39
- line-height: 1.3;
40
- }
41
-
42
- .wpp-midnight li .item-data a {
43
- color: #eee;
44
- text-decoration: none;
45
- }
46
-
47
- .wpp-midnight li .item-data a:hover {
48
- text-decoration: underline;
49
  }
1
+ .wpp-midnight {
2
+ counter-reset: wpp-counter;
3
+ margin-left: 0;
4
+ margin-right: 0;
5
+ padding: 0;
6
+ border-right: 6px solid rgb(0, 51, 51);
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ .wpp-midnight li {
11
+ position: relative;
12
+ display: flex;
13
+ align-items: center;
14
+ counter-increment: wpp-counter;
15
+ position: relative;
16
+ list-style: none;
17
+ margin: 0;
18
+ padding: 15px 15px 15px 0;
19
+ background: rgba(0, 51, 51, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ .wpp-midnight li .item-position::before {
24
+ display: inline-block;
25
+ flex: 1 0 0;
26
+ content: counter(wpp-counter);
27
+ color: rgba(255, 255, 255, 0.3);
28
+ width: 40px;
29
+ font-size: 18px;
30
+ font-weight: 700;
31
+ letter-spacing: -1px;
32
+ text-align: center;
33
+ }
34
+
35
+ .wpp-midnight li .item-data .wpp-post-title {
36
+ display: block;
37
+ font-size: 15px;
38
+ font-weight: 700;
39
+ line-height: 1.3;
40
+ }
41
+
42
+ .wpp-midnight li .item-data a {
43
+ color: #eee;
44
+ text-decoration: none;
45
+ }
46
+
47
+ .wpp-midnight li .item-data a:hover {
48
+ text-decoration: underline;
49
  }
assets/themes/sunrise/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Sunrise",
3
- "description": "A simple list of popular posts.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": false,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": false,
25
- "build": "manual",
26
- "width": 75,
27
- "height": 75,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": false,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-sunrise\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Sunrise",
3
+ "description": "A simple list of popular posts.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": false,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": false,
25
+ "build": "manual",
26
+ "width": 75,
27
+ "height": 75,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": false,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-sunrise\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/sunrise/style.css CHANGED
@@ -1,49 +1,49 @@
1
- .wpp-sunrise {
2
- counter-reset: wpp-counter;
3
- margin-left: 0;
4
- margin-right: 0;
5
- padding: 0;
6
- border-right: 6px solid rgb(255, 255, 124);
7
- box-sizing: border-box;
8
- }
9
-
10
- .wpp-sunrise li {
11
- position: relative;
12
- display: flex;
13
- align-items: center;
14
- counter-increment: wpp-counter;
15
- position: relative;
16
- list-style: none;
17
- margin: 0;
18
- padding: 15px 15px 15px 0;
19
- background: rgba(255, 255, 124, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
- box-sizing: border-box;
21
- }
22
-
23
- .wpp-sunrise li .item-position::before {
24
- display: inline-block;
25
- flex: 1 0 0;
26
- content: counter(wpp-counter);
27
- color: rgba(0, 0, 0, 0.15);
28
- width: 40px;
29
- font-size: 18px;
30
- font-weight: 700;
31
- letter-spacing: -1px;
32
- text-align: center;
33
- }
34
-
35
- .wpp-sunrise li .item-data .wpp-post-title {
36
- display: block;
37
- font-size: 15px;
38
- font-weight: 700;
39
- line-height: 1.3;
40
- }
41
-
42
- .wpp-sunrise li .item-data a {
43
- color: #2b2b09;
44
- text-decoration: none;
45
- }
46
-
47
- .wpp-sunrise li .item-data a:hover {
48
- text-decoration: underline;
49
  }
1
+ .wpp-sunrise {
2
+ counter-reset: wpp-counter;
3
+ margin-left: 0;
4
+ margin-right: 0;
5
+ padding: 0;
6
+ border-right: 6px solid rgb(255, 255, 124);
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ .wpp-sunrise li {
11
+ position: relative;
12
+ display: flex;
13
+ align-items: center;
14
+ counter-increment: wpp-counter;
15
+ position: relative;
16
+ list-style: none;
17
+ margin: 0;
18
+ padding: 15px 15px 15px 0;
19
+ background: rgba(255, 255, 124, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ .wpp-sunrise li .item-position::before {
24
+ display: inline-block;
25
+ flex: 1 0 0;
26
+ content: counter(wpp-counter);
27
+ color: rgba(0, 0, 0, 0.15);
28
+ width: 40px;
29
+ font-size: 18px;
30
+ font-weight: 700;
31
+ letter-spacing: -1px;
32
+ text-align: center;
33
+ }
34
+
35
+ .wpp-sunrise li .item-data .wpp-post-title {
36
+ display: block;
37
+ font-size: 15px;
38
+ font-weight: 700;
39
+ line-height: 1.3;
40
+ }
41
+
42
+ .wpp-sunrise li .item-data a {
43
+ color: #2b2b09;
44
+ text-decoration: none;
45
+ }
46
+
47
+ .wpp-sunrise li .item-data a:hover {
48
+ text-decoration: underline;
49
  }
assets/themes/sunset/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Sunset",
3
- "description": "A simple list of popular posts.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": false,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": false,
25
- "build": "manual",
26
- "width": 75,
27
- "height": 75,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": false,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-sunset\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Sunset",
3
+ "description": "A simple list of popular posts.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": false,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": false,
25
+ "build": "manual",
26
+ "width": 75,
27
+ "height": 75,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": false,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-sunset\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li style=\"--item-position: {item_position}; --total-items: {total_items};\"><div class=\"item-position\"></div> <div class=\"item-data\">{title}</div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/sunset/style.css CHANGED
@@ -1,49 +1,49 @@
1
- .wpp-sunset {
2
- counter-reset: wpp-counter;
3
- margin-left: 0;
4
- margin-right: 0;
5
- padding: 0;
6
- border-right: 6px solid rgb(234, 51, 51);
7
- box-sizing: border-box;
8
- }
9
-
10
- .wpp-sunset li {
11
- position: relative;
12
- display: flex;
13
- align-items: center;
14
- counter-increment: wpp-counter;
15
- position: relative;
16
- list-style: none;
17
- margin: 0;
18
- padding: 15px 15px 15px 0;
19
- background: rgba(234, 51, 51, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
- box-sizing: border-box;
21
- }
22
-
23
- .wpp-sunset li .item-position::before {
24
- display: inline-block;
25
- flex: 1 0 0;
26
- content: counter(wpp-counter);
27
- color: rgba(0, 0, 0, 0.15);
28
- width: 40px;
29
- font-size: 18px;
30
- font-weight: 700;
31
- letter-spacing: -1px;
32
- text-align: center;
33
- }
34
-
35
- .wpp-sunset li .item-data .wpp-post-title {
36
- display: block;
37
- font-size: 15px;
38
- font-weight: 700;
39
- line-height: 1.3;
40
- }
41
-
42
- .wpp-sunset li .item-data a {
43
- color: #222;
44
- text-decoration: none;
45
- }
46
-
47
- .wpp-sunset li .item-data a:hover {
48
- text-decoration: underline;
49
  }
1
+ .wpp-sunset {
2
+ counter-reset: wpp-counter;
3
+ margin-left: 0;
4
+ margin-right: 0;
5
+ padding: 0;
6
+ border-right: 6px solid rgb(234, 51, 51);
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ .wpp-sunset li {
11
+ position: relative;
12
+ display: flex;
13
+ align-items: center;
14
+ counter-increment: wpp-counter;
15
+ position: relative;
16
+ list-style: none;
17
+ margin: 0;
18
+ padding: 15px 15px 15px 0;
19
+ background: rgba(234, 51, 51, calc((((var(--total-items) - (var(--item-position) - 1)) * 100)/var(--total-items))/100));
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ .wpp-sunset li .item-position::before {
24
+ display: inline-block;
25
+ flex: 1 0 0;
26
+ content: counter(wpp-counter);
27
+ color: rgba(0, 0, 0, 0.15);
28
+ width: 40px;
29
+ font-size: 18px;
30
+ font-weight: 700;
31
+ letter-spacing: -1px;
32
+ text-align: center;
33
+ }
34
+
35
+ .wpp-sunset li .item-data .wpp-post-title {
36
+ display: block;
37
+ font-size: 15px;
38
+ font-weight: 700;
39
+ line-height: 1.3;
40
+ }
41
+
42
+ .wpp-sunset li .item-data a {
43
+ color: #222;
44
+ text-decoration: none;
45
+ }
46
+
47
+ .wpp-sunset li .item-data a:hover {
48
+ text-decoration: underline;
49
  }
assets/themes/tiles/config.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "Tiles",
3
- "description": "A Tile-styled popular posts list.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "shorten_title": {
13
- "active": false,
14
- "length": 25,
15
- "words": false
16
- },
17
- "post-excerpt": {
18
- "active": false,
19
- "length": 75,
20
- "keep_format": false,
21
- "words": false
22
- },
23
- "thumbnail": {
24
- "active": true,
25
- "build": "manual",
26
- "width": 320,
27
- "height": 160,
28
- "crop": true
29
- },
30
- "rating": false,
31
- "stats_tag": {
32
- "comment_count": false,
33
- "views": false,
34
- "author": false,
35
- "date": {
36
- "active": false,
37
- "format": "F j, Y"
38
- },
39
- "taxonomy": {
40
- "active": true,
41
- "name": "category"
42
- }
43
- },
44
- "markup": {
45
- "wpp-start": "<ul class=\"wpp-list wpp-tiles\">",
46
- "wpp-end": "</ul>",
47
- "post-html": "<li>{thumb}<div class=\"wpp-post-data\">{taxonomy} {title}</div></li>"
48
- }
49
- }
50
- }
1
+ {
2
+ "name": "Tiles",
3
+ "description": "A Tile-styled popular posts list.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "shorten_title": {
13
+ "active": false,
14
+ "length": 25,
15
+ "words": false
16
+ },
17
+ "post-excerpt": {
18
+ "active": false,
19
+ "length": 75,
20
+ "keep_format": false,
21
+ "words": false
22
+ },
23
+ "thumbnail": {
24
+ "active": true,
25
+ "build": "manual",
26
+ "width": 320,
27
+ "height": 160,
28
+ "crop": true
29
+ },
30
+ "rating": false,
31
+ "stats_tag": {
32
+ "comment_count": false,
33
+ "views": false,
34
+ "author": false,
35
+ "date": {
36
+ "active": false,
37
+ "format": "F j, Y"
38
+ },
39
+ "taxonomy": {
40
+ "active": true,
41
+ "name": "category"
42
+ }
43
+ },
44
+ "markup": {
45
+ "wpp-start": "<ul class=\"wpp-list wpp-tiles\">",
46
+ "wpp-end": "</ul>",
47
+ "post-html": "<li>{thumb}<div class=\"wpp-post-data\">{taxonomy} {title}</div></li>"
48
+ }
49
+ }
50
+ }
assets/themes/tiles/style.css CHANGED
@@ -1,65 +1,65 @@
1
- .wpp-tiles {
2
- margin-left: 0;
3
- margin-right: 0;
4
- padding: 0;
5
- }
6
-
7
- .wpp-tiles li {
8
- position: relative;
9
- list-style: none;
10
- margin: 0 0 1.2rem 0;
11
- padding: 0;
12
- }
13
-
14
- .wpp-tiles li:last-of-type {
15
- margin: 0;
16
- }
17
-
18
- .wpp-tiles li .wpp-thumbnail {
19
- overflow: hidden;
20
- display: block;
21
- margin: 0;
22
- width: 100%;
23
- height: auto;
24
- font-size: 0.8rem;
25
- line-height: 1;
26
- background: #f0f0f0;
27
- border: none;
28
- }
29
-
30
- .wpp-tiles li a {
31
- text-decoration: none;
32
- }
33
-
34
- .wpp-tiles li a:hover {
35
- text-decoration: underline;
36
- }
37
-
38
- .wpp-tiles li .wpp-post-data {
39
- position: absolute;
40
- left: 0;
41
- bottom: 0;
42
- padding: .75rem 1rem 1rem;
43
- width: 100%;
44
- box-sizing: border-box;
45
- background: rgba(0, 0, 0, 0.5);
46
- }
47
-
48
- .wpp-tiles li .wpp-post-data .category,
49
- .wpp-tiles li .wpp-post-data .wpp-post-title {
50
- color: #fff;
51
- font-weight: bold;
52
- }
53
-
54
- .wpp-tiles li .wpp-post-data .category {
55
- margin: 0;
56
- font-size: 0.7rem;
57
- line-height: 1;
58
- }
59
-
60
- .wpp-tiles li .wpp-post-data .wpp-post-title {
61
- display: block;
62
- margin: 0 0 0;
63
- font-size: 1rem;
64
- line-height: 1.2;
65
  }
1
+ .wpp-tiles {
2
+ margin-left: 0;
3
+ margin-right: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .wpp-tiles li {
8
+ position: relative;
9
+ list-style: none;
10
+ margin: 0 0 1.2em 0;
11
+ padding: 0;
12
+ }
13
+
14
+ .wpp-tiles li:last-of-type {
15
+ margin: 0;
16
+ }
17
+
18
+ .wpp-tiles li .wpp-thumbnail {
19
+ overflow: hidden;
20
+ display: block;
21
+ margin: 0;
22
+ width: 100%;
23
+ height: auto;
24
+ font-size: 0.8em;
25
+ line-height: 1;
26
+ background: #f0f0f0;
27
+ border: none;
28
+ }
29
+
30
+ .wpp-tiles li a {
31
+ text-decoration: none;
32
+ }
33
+
34
+ .wpp-tiles li a:hover {
35
+ text-decoration: underline;
36
+ }
37
+
38
+ .wpp-tiles li .wpp-post-data {
39
+ position: absolute;
40
+ left: 0;
41
+ bottom: 0;
42
+ padding: .75em 1em 1em;
43
+ width: 100%;
44
+ box-sizing: border-box;
45
+ background: rgba(0, 0, 0, 0.5);
46
+ }
47
+
48
+ .wpp-tiles li .wpp-post-data .category,
49
+ .wpp-tiles li .wpp-post-data .wpp-post-title {
50
+ color: #fff;
51
+ font-weight: bold;
52
+ }
53
+
54
+ .wpp-tiles li .wpp-post-data .category {
55
+ margin: 0;
56
+ font-size: 0.7em;
57
+ line-height: 1;
58
+ }
59
+
60
+ .wpp-tiles li .wpp-post-data .wpp-post-title {
61
+ display: block;
62
+ margin: 0 0 0;
63
+ font-size: 1em;
64
+ line-height: 1.2;
65
  }
assets/themes/tiny/config.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "Tiny",
3
- "description": "A very compact popular posts list.",
4
- "authors": [
5
- {
6
- "name": "Hector Cabrera",
7
- "email": "me@cabrerahector.com",
8
- "role": "Creator / Main Developer"
9
- }
10
- ],
11
- "config": {
12
- "title" : "Trending",
13
- "shorten_title": {
14
- "active": false
15
- },
16
- "post-excerpt": {
17
- "active": false
18
- },
19
- "thumbnail": {
20
- "active": false
21
- },
22
- "rating": false,
23
- "stats_tag": {
24
- "comment_count": false,
25
- "views": false,
26
- "author": false,
27
- "date": {
28
- "active": false
29
- },
30
- "taxonomy": {
31
- "active": true,
32
- "name": "category"
33
- }
34
- },
35
- "markup": {
36
- "wpp-start": "<ul class=\"wpp-list wpp-tiny\">",
37
- "wpp-end": "</ul>",
38
- "post-html": "<li><div class=\"wpp-item-data\">{category}</div> {title}</li>"
39
- }
40
- }
41
- }
1
+ {
2
+ "name": "Tiny",
3
+ "description": "A very compact popular posts list.",
4
+ "authors": [
5
+ {
6
+ "name": "Hector Cabrera",
7
+ "email": "me@cabrerahector.com",
8
+ "role": "Creator / Main Developer"
9
+ }
10
+ ],
11
+ "config": {
12
+ "title" : "Trending",
13
+ "shorten_title": {
14
+ "active": false
15
+ },
16
+ "post-excerpt": {
17
+ "active": false
18
+ },
19
+ "thumbnail": {
20
+ "active": false
21
+ },
22
+ "rating": false,
23
+ "stats_tag": {
24
+ "comment_count": false,
25
+ "views": false,
26
+ "author": false,
27
+ "date": {
28
+ "active": false
29
+ },
30
+ "taxonomy": {
31
+ "active": true,
32
+ "name": "category"
33
+ }
34
+ },
35
+ "markup": {
36
+ "wpp-start": "<ul class=\"wpp-list wpp-tiny\">",
37
+ "wpp-end": "</ul>",
38
+ "post-html": "<li><div class=\"wpp-item-data\">{category}</div> {title}</li>"
39
+ }
40
+ }
41
+ }
assets/themes/tiny/style.css CHANGED
@@ -1,36 +1,36 @@
1
- .wpp-tiny {
2
- margin-left: 0;
3
- margin-right: 0;
4
- padding: 0;
5
- }
6
-
7
- .wpp-tiny li {
8
- list-style: none;
9
- margin: 0 0 1.2rem 0;
10
- padding: 0;
11
- }
12
-
13
- .wpp-tiny li:last-of-type {
14
- margin: 0;
15
- }
16
-
17
- .wpp-tiny li a {
18
- text-decoration: none;
19
- }
20
-
21
- .wpp-tiny li a:hover {
22
- text-decoration: underline;
23
- }
24
-
25
- .wpp-tiny li .wpp-post-title {
26
- font-size: 1.125rem;
27
- font-weight: 700;
28
- letter-spacing: -1px;
29
- line-height: 1.1;
30
- }
31
-
32
- .wpp-tiny li .wpp-item-data {
33
- opacity: 0.5;
34
- font-size: 0.65rem;
35
- text-transform: capitalize;
36
- }
1
+ .wpp-tiny {
2
+ margin-left: 0;
3
+ margin-right: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .wpp-tiny li {
8
+ list-style: none;
9
+ margin: 0 0 1.2rem 0;
10
+ padding: 0;
11
+ }
12
+
13
+ .wpp-tiny li:last-of-type {
14
+ margin: 0;
15
+ }
16
+
17
+ .wpp-tiny li a {
18
+ text-decoration: none;
19
+ }
20
+
21
+ .wpp-tiny li a:hover {
22
+ text-decoration: underline;
23
+ }
24
+
25
+ .wpp-tiny li .wpp-post-title {
26
+ font-size: 1.125rem;
27
+ font-weight: 700;
28
+ letter-spacing: -1px;
29
+ line-height: 1.1;
30
+ }
31
+
32
+ .wpp-tiny li .wpp-item-data {
33
+ opacity: 0.5;
34
+ font-size: 0.65rem;
35
+ text-transform: capitalize;
36
+ }
i18n/wordpress-popular-posts.pot CHANGED
@@ -1,1204 +1,1196 @@
1
- # Copyright (C) 2014 Wordpress Popular Posts
2
- # This file is distributed under the same license as the Wordpress Popular Posts package.
3
- #, fuzzy
4
- 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-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"
12
- "Language: en\n"
13
- "MIME-Version: 1.0\n"
14
- "Content-Type: text/plain; charset=UTF-8\n"
15
- "Content-Transfer-Encoding: 8bit\n"
16
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
- "X-Generator: Poedit 2.2.4\n"
18
- "X-Poedit-KeywordsList: _e;__;__ngettext;__ngettext_noop;_n_noop;_x;_nx;_nx_noop;_ex;"
19
- "esc_attr__;esc_attr_e;esc_attr_x;esc_html__;esc_html_e;esc_html_x;_c;_nc;_n:1,2\n"
20
- "X-Poedit-Basepath: .\n"
21
- "X-Poedit-SourceCharset: UTF-8\n"
22
- "X-Poedit-SearchPath-0: .\n"
23
- "X-Poedit-SearchPath-1: ..\n"
24
-
25
- #: ../src/Admin/Admin.php:371
26
- #, php-format
27
- msgid "%s view in the last hour"
28
- msgid_plural "%s views in the last hour"
29
- msgstr[0] ""
30
- msgstr[1] ""
31
-
32
- #: ../src/Admin/Admin.php:405 ../src/Admin/admin-page.php:349
33
- msgid "Trending now"
34
- msgstr ""
35
-
36
- #: ../src/Admin/Admin.php:493
37
- msgid "View more"
38
- msgstr ""
39
-
40
- #: ../src/Admin/Admin.php:522
41
- msgid "Use this image"
42
- msgstr ""
43
-
44
- #: ../src/Admin/Admin.php:575
45
- msgid "Overview"
46
- msgstr ""
47
-
48
- #: ../src/Admin/Admin.php:576
49
- msgid ""
50
- "Welcome to WordPress Popular Posts' Dashboard! In this screen you will find statistics "
51
- "on what's popular on your site, tools to further tweak WPP to your needs, and more!"
52
- msgstr ""
53
-
54
- #: ../src/Admin/Admin.php:582
55
- msgid "Like this plugin?"
56
- msgstr ""
57
-
58
- #: ../src/Admin/Admin.php:584
59
- msgid ""
60
- "Each donation motivates me to keep releasing free stuff for the WordPress community!"
61
- msgstr ""
62
-
63
- #: ../src/Admin/Admin.php:591
64
- #, php-format
65
- msgid "You can <a href=\"%s\" target=\"_blank\">leave a review</a>, too!"
66
- msgstr ""
67
-
68
- #: ../src/Admin/Admin.php:598
69
- #, php-format
70
- msgid ""
71
- "<p><strong>For more information:</strong></p><ul><li><a href=\"%1$s\">Documentation</"
72
- "a></li><li><a href=\"%2$s\">Support</a></li></ul>"
73
- msgstr ""
74
-
75
- #: ../src/Admin/Admin.php:622
76
- 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:722
81
- #, php-format
82
- msgid "%s view"
83
- msgid_plural "%s views"
84
- 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:705
89
- #, php-format
90
- msgid "%s comment"
91
- msgid_plural "%s comments"
92
- msgstr[0] ""
93
- msgstr[1] ""
94
-
95
- #: ../src/Admin/Admin.php:720 ../src/Widget/form.php:21
96
- msgid "Comments"
97
- msgstr ""
98
-
99
- #: ../src/Admin/Admin.php:724
100
- msgid "Views"
101
- msgstr ""
102
-
103
- #: ../src/Admin/Admin.php:1094
104
- msgid "View"
105
- msgstr ""
106
-
107
- #: ../src/Admin/Admin.php:1094
108
- msgid "Edit"
109
- msgstr ""
110
-
111
- #: ../src/Admin/Admin.php:1105
112
- msgid ""
113
- "Looks like your site's activity is a little low right now. <br />Spread the word and "
114
- "come back later!"
115
- msgstr ""
116
-
117
- #: ../src/Admin/Admin.php:1367
118
- #, php-format
119
- msgid ""
120
- "<strong>WordPress Popular Posts:</strong> It seems your site is popular (great!) You "
121
- "may want to check <a href=\"%s\">these suggestions</a> to make sure your website's "
122
- "performance stays up to par."
123
- msgstr ""
124
-
125
- #: ../src/Admin/admin-page.php:6 ../src/Admin/admin-page.php:240
126
- msgid "Stats"
127
- msgstr ""
128
-
129
- #: ../src/Admin/admin-page.php:7 ../src/Admin/admin-page.php:241
130
- msgid "Tools"
131
- msgstr ""
132
-
133
- #: ../src/Admin/admin-page.php:8 ../src/Admin/admin-page.php:242
134
- msgid "Parameters"
135
- msgstr ""
136
-
137
- #: ../src/Admin/admin-page.php:30 ../src/Admin/admin-page.php:41
138
- #: ../src/Admin/admin-page.php:67 ../src/Admin/admin-page.php:103
139
- msgid "Settings saved."
140
- msgstr ""
141
-
142
- #: ../src/Admin/admin-page.php:52
143
- msgid "Please provide the name of your custom field."
144
- msgstr ""
145
-
146
- #: ../src/Admin/admin-page.php:121
147
- msgid ""
148
- "This operation will delete all entries from WordPress Popular Posts' cache table and "
149
- "cannot be undone."
150
- msgstr ""
151
-
152
- #: ../src/Admin/admin-page.php:121 ../src/Admin/admin-page.php:160
153
- #: ../src/Admin/admin-page.php:199
154
- msgid "Do you want to continue?"
155
- msgstr ""
156
-
157
- #: ../src/Admin/admin-page.php:133
158
- msgid "Success! The cache table has been cleared!"
159
- msgstr ""
160
-
161
- #: ../src/Admin/admin-page.php:137
162
- msgid "Error: cache table does not exist."
163
- msgstr ""
164
-
165
- #: ../src/Admin/admin-page.php:141 ../src/Admin/admin-page.php:149
166
- #: ../src/Admin/admin-page.php:180 ../src/Admin/admin-page.php:188
167
- #: ../src/Admin/admin-page.php:218 ../src/Admin/admin-page.php:226
168
- msgid "Invalid action."
169
- msgstr ""
170
-
171
- #: ../src/Admin/admin-page.php:145 ../src/Admin/admin-page.php:184
172
- #: ../src/Admin/admin-page.php:222
173
- msgid ""
174
- "Sorry, you do not have enough permissions to do this. Please contact the site "
175
- "administrator for support."
176
- msgstr ""
177
-
178
- #: ../src/Admin/admin-page.php:160
179
- msgid ""
180
- "This operation will delete all stored info from WordPress Popular Posts' data tables "
181
- "and cannot be undone."
182
- msgstr ""
183
-
184
- #: ../src/Admin/admin-page.php:172
185
- msgid "Success! All data have been cleared!"
186
- msgstr ""
187
-
188
- #: ../src/Admin/admin-page.php:176
189
- msgid "Error: one or both data tables are missing."
190
- msgstr ""
191
-
192
- #: ../src/Admin/admin-page.php:199
193
- msgid "This operation will delete all cached thumbnails and cannot be undone."
194
- msgstr ""
195
-
196
- #: ../src/Admin/admin-page.php:210
197
- msgid "Success! All files have been deleted!"
198
- msgstr ""
199
-
200
- #: ../src/Admin/admin-page.php:214
201
- msgid "The thumbnail cache is already empty!"
202
- msgstr ""
203
-
204
- #: ../src/Admin/admin-page.php:239
205
- msgid "Menu"
206
- msgstr ""
207
-
208
- #: ../src/Admin/admin-page.php:266
209
- msgid "Post type"
210
- msgstr ""
211
-
212
- #: ../src/Admin/admin-page.php:269
213
- msgid "Limit"
214
- msgstr ""
215
-
216
- #: ../src/Admin/admin-page.php:272 ../src/Widget/form.php:52
217
- msgid "Display only posts published within the selected Time Range"
218
- msgstr ""
219
-
220
- #: ../src/Admin/admin-page.php:278 ../src/Admin/admin-page.php:310
221
- #: ../src/Admin/admin-page.php:462 ../src/Admin/admin-page.php:569
222
- #: ../src/Admin/admin-page.php:609
223
- msgid "Apply"
224
- msgstr ""
225
-
226
- #: ../src/Admin/admin-page.php:279 ../src/Admin/admin-page.php:313
227
- msgid "Cancel"
228
- msgstr ""
229
-
230
- #: ../src/Admin/admin-page.php:288
231
- msgid "Custom Time Range"
232
- msgstr ""
233
-
234
- #: ../src/Admin/admin-page.php:289
235
- msgid "Date Range"
236
- msgstr ""
237
-
238
- #: ../src/Admin/admin-page.php:296 ../src/Admin/admin-page.php:535
239
- #: ../src/Widget/form.php:45
240
- msgid "Minute(s)"
241
- msgstr ""
242
-
243
- #: ../src/Admin/admin-page.php:297 ../src/Admin/admin-page.php:536
244
- #: ../src/Widget/form.php:46
245
- msgid "Hour(s)"
246
- msgstr ""
247
-
248
- #: ../src/Admin/admin-page.php:298 ../src/Admin/admin-page.php:537
249
- #: ../src/Widget/form.php:47
250
- msgid "Day(s)"
251
- msgstr ""
252
-
253
- #: ../src/Admin/admin-page.php:303
254
- msgid "Select a date..."
255
- msgstr ""
256
-
257
- #: ../src/Admin/admin-page.php:323
258
- msgid "Today"
259
- msgstr ""
260
-
261
- #: ../src/Admin/admin-page.php:324 ../src/Widget/form.php:34
262
- msgid "Last 24 hours"
263
- msgstr ""
264
-
265
- #: ../src/Admin/admin-page.php:325 ../src/Widget/form.php:35
266
- msgid "Last 7 days"
267
- msgstr ""
268
-
269
- #: ../src/Admin/admin-page.php:326 ../src/Widget/form.php:36
270
- msgid "Last 30 days"
271
- msgstr ""
272
-
273
- #: ../src/Admin/admin-page.php:327 ../src/Widget/form.php:38
274
- msgid "Custom"
275
- msgstr ""
276
-
277
- #: ../src/Admin/admin-page.php:331
278
- #, php-format
279
- msgid ""
280
- "Err... A nice little chart is supposed to be here, instead you are seeing this because "
281
- "your browser is too old. <br /> Please <a href=\"%s\" target=\"_blank\">get a better "
282
- "browser</a>."
283
- msgstr ""
284
-
285
- #: ../src/Admin/admin-page.php:347
286
- msgid "Most viewed"
287
- msgstr ""
288
-
289
- #: ../src/Admin/admin-page.php:348
290
- msgid "Most commented"
291
- msgstr ""
292
-
293
- #: ../src/Admin/admin-page.php:350
294
- msgid "Hall of Fame"
295
- msgstr ""
296
-
297
- #: ../src/Admin/admin-page.php:390
298
- msgid "Thumbnails"
299
- msgstr ""
300
-
301
- #: ../src/Admin/admin-page.php:396
302
- msgid "Default thumbnail"
303
- msgstr ""
304
-
305
- #: ../src/Admin/admin-page.php:402
306
- msgid "Change thumbnail"
307
- msgstr ""
308
-
309
- #: ../src/Admin/admin-page.php:405
310
- msgid "This image will be displayed when no thumbnail is available"
311
- msgstr ""
312
-
313
- #: ../src/Admin/admin-page.php:409
314
- msgid "Pick image from"
315
- msgstr ""
316
-
317
- #: ../src/Admin/admin-page.php:412
318
- msgid "Featured image"
319
- msgstr ""
320
-
321
- #: ../src/Admin/admin-page.php:413
322
- msgid "First image on post"
323
- msgstr ""
324
-
325
- #: ../src/Admin/admin-page.php:414
326
- msgid "First attachment"
327
- msgstr ""
328
-
329
- #: ../src/Admin/admin-page.php:415
330
- msgid "Custom field"
331
- msgstr ""
332
-
333
- #: ../src/Admin/admin-page.php:418
334
- msgid "Tell WordPress Popular Posts where it should get thumbnails from"
335
- msgstr ""
336
-
337
- #: ../src/Admin/admin-page.php:422
338
- msgid "Lazy load"
339
- msgstr ""
340
-
341
- #: ../src/Admin/admin-page.php:422 ../src/Admin/admin-page.php:519
342
- #: ../src/Admin/admin-page.php:547 ../src/Widget/form.php:7 ../src/Widget/form.php:54
343
- #: ../src/Widget/form.php:60 ../src/Widget/form.php:88 ../src/Widget/form.php:98
344
- #: ../src/Widget/form.php:190
345
- msgid "What is this?"
346
- msgstr ""
347
-
348
- #: ../src/Admin/admin-page.php:425
349
- msgid "No"
350
- msgstr ""
351
-
352
- #: ../src/Admin/admin-page.php:426 ../src/Admin/admin-page.php:441
353
- msgid "Yes"
354
- msgstr ""
355
-
356
- #: ../src/Admin/admin-page.php:431
357
- msgid "Custom field name"
358
- msgstr ""
359
-
360
- #: ../src/Admin/admin-page.php:437
361
- msgid "Resize image from Custom field?"
362
- msgstr ""
363
-
364
- #: ../src/Admin/admin-page.php:440
365
- msgid "No, I will upload my own thumbnail"
366
- msgstr ""
367
-
368
- #: ../src/Admin/admin-page.php:452
369
- msgid "Empty image cache"
370
- msgstr ""
371
-
372
- #: ../src/Admin/admin-page.php:453
373
- msgid "Use this button to clear WPP's thumbnails cache"
374
- msgstr ""
375
-
376
- #: ../src/Admin/admin-page.php:473
377
- msgid "Data"
378
- msgstr ""
379
-
380
- #: ../src/Admin/admin-page.php:479
381
- msgid "Log views from"
382
- msgstr ""
383
-
384
- #: ../src/Admin/admin-page.php:482
385
- msgid "Visitors only"
386
- msgstr ""
387
-
388
- #: ../src/Admin/admin-page.php:483
389
- msgid "Logged-in users only"
390
- msgstr ""
391
-
392
- #: ../src/Admin/admin-page.php:484
393
- msgid "Everyone"
394
- msgstr ""
395
-
396
- #: ../src/Admin/admin-page.php:490
397
- msgid "Log limit"
398
- msgstr ""
399
-
400
- #: ../src/Admin/admin-page.php:493 ../src/Admin/admin-page.php:510
401
- #: ../src/Admin/admin-page.php:550 ../src/Admin/admin-page.php:600
402
- msgid "Disabled"
403
- msgstr ""
404
-
405
- #: ../src/Admin/admin-page.php:494
406
- msgid "Keep data for"
407
- msgstr ""
408
-
409
- #: ../src/Admin/admin-page.php:498
410
- msgid "day(s)"
411
- msgstr ""
412
-
413
- #: ../src/Admin/admin-page.php:501
414
- msgid "Data older than the specified time frame will be automatically discarded"
415
- msgstr ""
416
-
417
- #: ../src/Admin/admin-page.php:507
418
- msgid "Ajaxify widget"
419
- msgstr ""
420
-
421
- #: ../src/Admin/admin-page.php:511 ../src/Admin/admin-page.php:551
422
- #: ../src/Admin/admin-page.php:599
423
- msgid "Enabled"
424
- msgstr ""
425
-
426
- #: ../src/Admin/admin-page.php:515
427
- msgid ""
428
- "If you are using a caching plugin such as WP Super Cache, enabling this feature will "
429
- "keep the popular list from being cached by it"
430
- msgstr ""
431
-
432
- #: ../src/Admin/admin-page.php:519
433
- msgid "Data Caching"
434
- msgstr ""
435
-
436
- #: ../src/Admin/admin-page.php:522
437
- msgid "Never cache"
438
- msgstr ""
439
-
440
- #: ../src/Admin/admin-page.php:523
441
- msgid "Enable caching"
442
- msgstr ""
443
-
444
- #: ../src/Admin/admin-page.php:527
445
- msgid ""
446
- "WPP can cache the popular list for a specified amount of time. Recommended for large / "
447
- "high traffic sites"
448
- msgstr ""
449
-
450
- #: ../src/Admin/admin-page.php:531
451
- msgid "Refresh cache every"
452
- msgstr ""
453
-
454
- #: ../src/Admin/admin-page.php:538
455
- msgid "Week(s)"
456
- msgstr ""
457
-
458
- #: ../src/Admin/admin-page.php:539
459
- msgid "Month(s)"
460
- msgstr ""
461
-
462
- #: ../src/Admin/admin-page.php:540
463
- msgid "Year(s)"
464
- msgstr ""
465
-
466
- #: ../src/Admin/admin-page.php:543
467
- msgid "Really? That long?"
468
- msgstr ""
469
-
470
- #: ../src/Admin/admin-page.php:547
471
- msgid "Data Sampling"
472
- msgstr ""
473
-
474
- #: ../src/Admin/admin-page.php:555
475
- #, php-format
476
- msgid ""
477
- "By default, WordPress Popular Posts stores in database every single visit your site "
478
- "receives. For small / medium sites this is generally OK, but on large / high traffic "
479
- "sites the constant writing to the database may have an impact on performance. With <a "
480
- "href=\"%1$s\" target=\"_blank\">data sampling</a>, WordPress Popular Posts will store "
481
- "only a subset of your traffic and report on the tendencies detected in that sample set "
482
- "(for more, <a href=\"%2$s\" target=\"_blank\">please read here</a>)"
483
- msgstr ""
484
-
485
- #: ../src/Admin/admin-page.php:559
486
- msgid "Sample Rate"
487
- msgstr ""
488
-
489
- #: ../src/Admin/admin-page.php:563
490
- #, php-format
491
- msgid ""
492
- "A sampling rate of %d is recommended for large / high traffic sites. For lower traffic "
493
- "sites, you should lower the value"
494
- msgstr ""
495
-
496
- #: ../src/Admin/admin-page.php:580
497
- msgid "Miscellaneous"
498
- msgstr ""
499
-
500
- #: ../src/Admin/admin-page.php:586
501
- msgid "Open links in"
502
- msgstr ""
503
-
504
- #: ../src/Admin/admin-page.php:589
505
- msgid "Current window"
506
- msgstr ""
507
-
508
- #: ../src/Admin/admin-page.php:590
509
- msgid "New tab/window"
510
- msgstr ""
511
-
512
- #: ../src/Admin/admin-page.php:596
513
- msgid "Use plugin's stylesheet"
514
- msgstr ""
515
-
516
- #: ../src/Admin/admin-page.php:603
517
- msgid ""
518
- "By default, the plugin includes a stylesheet called wpp.css which you can use to style "
519
- "your popular posts listing. If you wish to use your own stylesheet or do not want it "
520
- "to have it included in the header section of your site, use this."
521
- msgstr ""
522
-
523
- #: ../src/Admin/admin-page.php:623
524
- msgid ""
525
- "WordPress Popular Posts maintains data in two separate tables: one for storing the "
526
- "most popular entries on a daily basis (from now on, \"cache\"), and another one to "
527
- "keep the All-time data (from now on, \"historical data\" or just \"data\"). If for "
528
- "some reason you need to clear the cache table, or even both historical and cache "
529
- "tables, please use the buttons below to do so."
530
- msgstr ""
531
-
532
- #: ../src/Admin/admin-page.php:624
533
- msgid "Empty cache"
534
- msgstr ""
535
-
536
- #: ../src/Admin/admin-page.php:624
537
- msgid "Use this button to manually clear entries from WPP cache only"
538
- msgstr ""
539
-
540
- #: ../src/Admin/admin-page.php:625
541
- msgid "Clear all data"
542
- msgstr ""
543
-
544
- #: ../src/Admin/admin-page.php:625
545
- msgid "Use this button to manually clear entries from all WPP data tables"
546
- msgstr ""
547
-
548
- #: ../src/Admin/admin-page.php:633
549
- #, php-format
550
- msgid ""
551
- "With the following parameters you can customize the popular posts list when using "
552
- "either the <a href=\"%1$s\">wpp_get_mostpopular() template tag</a> or the <a href="
553
- "\"%2$s\">[wpp] shortcode</a>."
554
- msgstr ""
555
-
556
- #: ../src/Admin/admin-page.php:643
557
- msgid "Parameter"
558
- msgstr ""
559
-
560
- #: ../src/Admin/admin-page.php:644
561
- msgid "What it does "
562
- msgstr ""
563
-
564
- #: ../src/Admin/admin-page.php:645
565
- msgid "Possible values"
566
- msgstr ""
567
-
568
- #: ../src/Admin/admin-page.php:646
569
- msgid "Defaults to"
570
- msgstr ""
571
-
572
- #: ../src/Admin/admin-page.php:647
573
- msgid "Example"
574
- msgstr ""
575
-
576
- #: ../src/Admin/admin-page.php:653
577
- msgid "Sets a heading for the list"
578
- msgstr ""
579
-
580
- #: ../src/Admin/admin-page.php:654 ../src/Admin/admin-page.php:661
581
- #: ../src/Admin/admin-page.php:668 ../src/Admin/admin-page.php:717
582
- #: ../src/Admin/admin-page.php:724 ../src/Admin/admin-page.php:731
583
- #: ../src/Admin/admin-page.php:738 ../src/Admin/admin-page.php:745
584
- #: ../src/Admin/admin-page.php:752 ../src/Admin/admin-page.php:843
585
- #: ../src/Admin/admin-page.php:864 ../src/Admin/admin-page.php:871
586
- msgid "Text string"
587
- msgstr ""
588
-
589
- #: ../src/Admin/admin-page.php:655 ../src/Admin/admin-page.php:725
590
- #: ../src/Admin/admin-page.php:732 ../src/Admin/admin-page.php:739
591
- #: ../src/Admin/admin-page.php:746 ../src/Admin/admin-page.php:753
592
- #: ../src/Widget/form.php:226
593
- msgid "None"
594
- msgstr ""
595
-
596
- #: ../src/Admin/admin-page.php:656 ../src/Admin/admin-page.php:663
597
- #: ../src/Admin/admin-page.php:670 ../src/Admin/admin-page.php:677
598
- #: ../src/Admin/admin-page.php:684 ../src/Admin/admin-page.php:691
599
- #: ../src/Admin/admin-page.php:698 ../src/Admin/admin-page.php:705
600
- #: ../src/Admin/admin-page.php:712 ../src/Admin/admin-page.php:719
601
- #: ../src/Admin/admin-page.php:726 ../src/Admin/admin-page.php:733
602
- #: ../src/Admin/admin-page.php:740 ../src/Admin/admin-page.php:747
603
- #: ../src/Admin/admin-page.php:754 ../src/Admin/admin-page.php:761
604
- #: ../src/Admin/admin-page.php:768 ../src/Admin/admin-page.php:775
605
- #: ../src/Admin/admin-page.php:782 ../src/Admin/admin-page.php:789
606
- #: ../src/Admin/admin-page.php:796 ../src/Admin/admin-page.php:803
607
- #: ../src/Admin/admin-page.php:810 ../src/Admin/admin-page.php:817
608
- #: ../src/Admin/admin-page.php:824 ../src/Admin/admin-page.php:831
609
- #: ../src/Admin/admin-page.php:838 ../src/Admin/admin-page.php:845
610
- #: ../src/Admin/admin-page.php:852 ../src/Admin/admin-page.php:859
611
- #: ../src/Admin/admin-page.php:866 ../src/Admin/admin-page.php:873
612
- #: ../src/Admin/admin-page.php:880
613
- msgid "With wpp_get_mostpopular():"
614
- msgstr ""
615
-
616
- #: ../src/Admin/admin-page.php:656 ../src/Admin/admin-page.php:663
617
- #: ../src/Admin/admin-page.php:670 ../src/Admin/admin-page.php:677
618
- #: ../src/Admin/admin-page.php:684 ../src/Admin/admin-page.php:691
619
- #: ../src/Admin/admin-page.php:698 ../src/Admin/admin-page.php:705
620
- #: ../src/Admin/admin-page.php:712 ../src/Admin/admin-page.php:719
621
- #: ../src/Admin/admin-page.php:726 ../src/Admin/admin-page.php:733
622
- #: ../src/Admin/admin-page.php:740 ../src/Admin/admin-page.php:747
623
- #: ../src/Admin/admin-page.php:754 ../src/Admin/admin-page.php:761
624
- #: ../src/Admin/admin-page.php:768 ../src/Admin/admin-page.php:775
625
- #: ../src/Admin/admin-page.php:782 ../src/Admin/admin-page.php:789
626
- #: ../src/Admin/admin-page.php:796 ../src/Admin/admin-page.php:803
627
- #: ../src/Admin/admin-page.php:810 ../src/Admin/admin-page.php:817
628
- #: ../src/Admin/admin-page.php:824 ../src/Admin/admin-page.php:831
629
- #: ../src/Admin/admin-page.php:838 ../src/Admin/admin-page.php:845
630
- #: ../src/Admin/admin-page.php:852 ../src/Admin/admin-page.php:859
631
- #: ../src/Admin/admin-page.php:866 ../src/Admin/admin-page.php:873
632
- #: ../src/Admin/admin-page.php:880
633
- msgid "With the [wpp] shortcode:"
634
- msgstr ""
635
-
636
- #: ../src/Admin/admin-page.php:660
637
- msgid "Set the opening tag for the heading of the list"
638
- msgstr ""
639
-
640
- #: ../src/Admin/admin-page.php:667
641
- msgid "Set the closing tag for the heading of the list"
642
- msgstr ""
643
-
644
- #: ../src/Admin/admin-page.php:674
645
- msgid "Sets the maximum number of popular posts to be shown on the listing"
646
- msgstr ""
647
-
648
- #: ../src/Admin/admin-page.php:675 ../src/Admin/admin-page.php:689
649
- #: ../src/Admin/admin-page.php:759 ../src/Admin/admin-page.php:773
650
- #: ../src/Admin/admin-page.php:794 ../src/Admin/admin-page.php:801
651
- msgid "Positive integer"
652
- msgstr ""
653
-
654
- #: ../src/Admin/admin-page.php:681
655
- msgid ""
656
- "Tells WordPress Popular Posts to retrieve the most popular entries within the time "
657
- "range specified by you"
658
- msgstr ""
659
-
660
- #: ../src/Admin/admin-page.php:688
661
- msgid "Especifies the number of time units of the custom time range"
662
- msgstr ""
663
-
664
- #: ../src/Admin/admin-page.php:695
665
- msgid "Especifies the time unit of the custom time range"
666
- msgstr ""
667
-
668
- #: ../src/Admin/admin-page.php:702
669
- msgid ""
670
- "Tells WordPress Popular Posts to retrieve the most popular entries published within "
671
- "the time range specified by you"
672
- msgstr ""
673
-
674
- #: ../src/Admin/admin-page.php:709
675
- msgid "Sets the sorting option of the popular posts"
676
- msgstr ""
677
-
678
- #: ../src/Admin/admin-page.php:710
679
- msgid "(for average views per day)"
680
- msgstr ""
681
-
682
- #: ../src/Admin/admin-page.php:716
683
- msgid "Defines the type of posts to show on the listing"
684
- msgstr ""
685
-
686
- #: ../src/Admin/admin-page.php:723
687
- msgid ""
688
- "If set, WordPress Popular Posts will exclude the specified post(s) ID(s) form the "
689
- "listing."
690
- msgstr ""
691
-
692
- #: ../src/Admin/admin-page.php:730
693
- msgid ""
694
- "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
695
- "category ID(s). If a minus sign is used, entries associated to the category will be "
696
- "excluded instead."
697
- msgstr ""
698
-
699
- #: ../src/Admin/admin-page.php:737
700
- msgid "If set, WordPress Popular Posts will filter posts by a given taxonomy."
701
- msgstr ""
702
-
703
- #: ../src/Admin/admin-page.php:744
704
- msgid ""
705
- "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
706
- "term ID(s). If a minus sign is used, entries associated to the term(s) will be "
707
- "excluded instead."
708
- msgstr ""
709
-
710
- #: ../src/Admin/admin-page.php:751
711
- msgid ""
712
- "If set, WordPress Popular Posts will retrieve all entries created by specified "
713
- "author(s) ID(s)."
714
- msgstr ""
715
-
716
- #: ../src/Admin/admin-page.php:758
717
- msgid ""
718
- "If set, WordPress Popular Posts will shorten each post title to \"n\" characters "
719
- "whenever possible"
720
- msgstr ""
721
-
722
- #: ../src/Admin/admin-page.php:765
723
- msgid ""
724
- "If set to 1, WordPress Popular Posts will shorten each post title to \"n\" words "
725
- "instead of characters"
726
- msgstr ""
727
-
728
- #: ../src/Admin/admin-page.php:772
729
- msgid ""
730
- "If set, WordPress Popular Posts will build and include an excerpt of \"n\" characters "
731
- "long from the content of each post listed as popular"
732
- msgstr ""
733
-
734
- #: ../src/Admin/admin-page.php:779
735
- msgid ""
736
- "If set, WordPress Popular Posts will maintaing all styling tags (strong, italic, etc) "
737
- "and hyperlinks found in the excerpt"
738
- msgstr ""
739
-
740
- #: ../src/Admin/admin-page.php:786
741
- msgid ""
742
- "If set to 1, WordPress Popular Posts will shorten the excerpt to \"n\" words instead "
743
- "of characters"
744
- msgstr ""
745
-
746
- #: ../src/Admin/admin-page.php:793
747
- msgid ""
748
- "If set, and if your current server configuration allows it, you will be able to "
749
- "display thumbnails of your posts. This attribute sets the width for thumbnails"
750
- msgstr ""
751
-
752
- #: ../src/Admin/admin-page.php:800
753
- msgid ""
754
- "If set, and if your current server configuration allows it, you will be able to "
755
- "display thumbnails of your posts. This attribute sets the height for thumbnails"
756
- msgstr ""
757
-
758
- #: ../src/Admin/admin-page.php:807
759
- msgid ""
760
- "If set, and if the WP-PostRatings plugin is installed and enabled on your blog, "
761
- "WordPress Popular Posts will show how your visitors are rating your entries"
762
- msgstr ""
763
-
764
- #: ../src/Admin/admin-page.php:814
765
- msgid ""
766
- "If set, WordPress Popular Posts will show how many comments each popular post has got "
767
- "during the specified time range"
768
- msgstr ""
769
-
770
- #: ../src/Admin/admin-page.php:821
771
- msgid ""
772
- "If set, WordPress Popular Posts will show how many views each popular post has got "
773
- "during the specified time range"
774
- msgstr ""
775
-
776
- #: ../src/Admin/admin-page.php:828
777
- msgid ""
778
- "If set, WordPress Popular Posts will show who published each popular post on the list"
779
- msgstr ""
780
-
781
- #: ../src/Admin/admin-page.php:835
782
- msgid ""
783
- "If set, WordPress Popular Posts will display the date when each popular post on the "
784
- "list was published"
785
- msgstr ""
786
-
787
- #: ../src/Admin/admin-page.php:842
788
- msgid "Sets the date format"
789
- msgstr ""
790
-
791
- #: ../src/Admin/admin-page.php:849
792
- msgid ""
793
- "If set, WordPress Popular Posts will display the categories associated to each entry"
794
- msgstr ""
795
-
796
- #: ../src/Admin/admin-page.php:856
797
- msgid ""
798
- "If set, WordPress Popular Posts will display the taxonomies associated to each entry"
799
- msgstr ""
800
-
801
- #: ../src/Admin/admin-page.php:863
802
- msgid "Sets the opening tag for the listing"
803
- msgstr ""
804
-
805
- #: ../src/Admin/admin-page.php:870
806
- msgid "Sets the closing tag for the listing"
807
- msgstr ""
808
-
809
- #: ../src/Admin/admin-page.php:877
810
- msgid "Sets the HTML structure of each post"
811
- msgstr ""
812
-
813
- #: ../src/Admin/admin-page.php:878
814
- msgid "Text string, custom HTML"
815
- msgstr ""
816
-
817
- #: ../src/Admin/admin-page.php:878
818
- msgid "Available Content Tags"
819
- msgstr ""
820
-
821
- #: ../src/Admin/admin-page.php:878
822
- msgid ""
823
- "returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height"
824
- msgstr ""
825
-
826
- #: ../src/Admin/admin-page.php:878
827
- msgid ""
828
- "returns thumbnail image without linking to post/page, requires thumbnail_width & "
829
- "thumbnail_height"
830
- msgstr ""
831
-
832
- #: ../src/Admin/admin-page.php:878
833
- msgid "returns thumbnail url, requires thumbnail_width & thumbnail_height"
834
- msgstr ""
835
-
836
- #: ../src/Admin/admin-page.php:878
837
- msgid "returns linked post/page title"
838
- msgstr ""
839
-
840
- #: ../src/Admin/admin-page.php:878
841
- msgid "returns the post/page ID"
842
- msgstr ""
843
-
844
- #: ../src/Admin/admin-page.php:878
845
- msgid "returns post/page excerpt, and requires excerpt_length to be greater than 0"
846
- msgstr ""
847
-
848
- #: ../src/Admin/admin-page.php:878
849
- msgid "returns the default stats tags"
850
- msgstr ""
851
-
852
- #: ../src/Admin/admin-page.php:878
853
- msgid "returns post/page current rating, requires WP-PostRatings installed and enabled"
854
- msgstr ""
855
-
856
- #: ../src/Admin/admin-page.php:878
857
- msgid ""
858
- "returns post/page current rating as an integer, requires WP-PostRatings installed and "
859
- "enabled"
860
- msgstr ""
861
-
862
- #: ../src/Admin/admin-page.php:878
863
- msgid "returns the URL of the post/page"
864
- msgstr ""
865
-
866
- #: ../src/Admin/admin-page.php:878
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 ""
877
-
878
- #: ../src/Admin/admin-page.php:878
879
- msgid "returns linked category name, requires stats_category=1"
880
- msgstr ""
881
-
882
- #: ../src/Admin/admin-page.php:878
883
- msgid "returns linked taxonomy names, requires stats_taxonomy=1"
884
- msgstr ""
885
-
886
- #: ../src/Admin/admin-page.php:878
887
- msgid "returns views count only, no text"
888
- msgstr ""
889
-
890
- #: ../src/Admin/admin-page.php:878
891
- msgid "returns comments count only, no text, requires stats_comments=1"
892
- msgstr ""
893
-
894
- #: ../src/Admin/admin-page.php:878
895
- msgid "returns post/page date, requires stats_date=1"
896
- msgstr ""
897
-
898
- #: ../src/Admin/admin-page.php:878
899
- msgid "outputs number of popular posts found"
900
- msgstr ""
901
-
902
- #: ../src/Admin/admin-page.php:878
903
- msgid "outputs the position of the post in the listing"
904
- msgstr ""
905
-
906
- #: ../src/Output.php:237
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
-
1005
- #: ../src/Widget/Widget.php:77
1006
- msgid "The most Popular Posts on your blog."
1007
- msgstr ""
1008
-
1009
- #: ../src/Widget/Widget.php:167
1010
- #, php-format
1011
- msgid ""
1012
- "Error: cannot ajaxify WordPress Popular Posts on this sidebar. It's missing the "
1013
- "<em>id</em> attribute on before_widget (see <a href=\"%s\" target=\"_blank\" rel="
1014
- "\"nofollow\">register_sidebar</a> for more)"
1015
- msgstr ""
1016
-
1017
- #: ../src/Widget/form.php:7
1018
- msgid "Title"
1019
- msgstr ""
1020
-
1021
- #: ../src/Widget/form.php:13
1022
- msgid "Show up to"
1023
- msgstr ""
1024
-
1025
- #: ../src/Widget/form.php:14
1026
- msgid "posts"
1027
- msgstr ""
1028
-
1029
- #: ../src/Widget/form.php:19
1030
- msgid "Sort posts by"
1031
- msgstr ""
1032
-
1033
- #: ../src/Widget/form.php:22
1034
- msgid "Total views"
1035
- msgstr ""
1036
-
1037
- #: ../src/Widget/form.php:23
1038
- msgid "Avg. daily views"
1039
- msgstr ""
1040
-
1041
- #: ../src/Widget/form.php:30
1042
- msgid "Filters"
1043
- msgstr ""
1044
-
1045
- #: ../src/Widget/form.php:32
1046
- msgid "Time Range"
1047
- msgstr ""
1048
-
1049
- #: ../src/Widget/form.php:37
1050
- msgid "All-time"
1051
- msgstr ""
1052
-
1053
- #: ../src/Widget/form.php:54
1054
- msgid "Post type(s)"
1055
- msgstr ""
1056
-
1057
- #: ../src/Widget/form.php:57
1058
- msgid "Post ID(s) to exclude"
1059
- msgstr ""
1060
-
1061
- #: ../src/Widget/form.php:60
1062
- msgid "Taxonomy"
1063
- msgstr ""
1064
-
1065
- #: ../src/Widget/form.php:82
1066
- #, php-format
1067
- msgid "%s IDs, separated by comma (prefix a minus sign to exclude)"
1068
- msgstr ""
1069
-
1070
- #: ../src/Widget/form.php:88
1071
- msgid "Author ID(s)"
1072
- msgstr ""
1073
-
1074
- #: ../src/Widget/form.php:94
1075
- msgid "Posts settings"
1076
- msgstr ""
1077
-
1078
- #: ../src/Widget/form.php:98
1079
- msgid "Display post rating"
1080
- msgstr ""
1081
-
1082
- #: ../src/Widget/form.php:101
1083
- msgid "Shorten title"
1084
- msgstr ""
1085
-
1086
- #: ../src/Widget/form.php:104
1087
- msgid "Shorten title to"
1088
- msgstr ""
1089
-
1090
- #: ../src/Widget/form.php:105 ../src/Widget/form.php:115
1091
- msgid "characters"
1092
- msgstr ""
1093
-
1094
- #: ../src/Widget/form.php:106 ../src/Widget/form.php:116
1095
- msgid "words"
1096
- msgstr ""
1097
-
1098
- #: ../src/Widget/form.php:109
1099
- msgid "Display post excerpt"
1100
- msgstr ""
1101
-
1102
- #: ../src/Widget/form.php:112
1103
- msgid "Keep text format and links"
1104
- msgstr ""
1105
-
1106
- #: ../src/Widget/form.php:113
1107
- msgid "Excerpt length"
1108
- msgstr ""
1109
-
1110
- #: ../src/Widget/form.php:119
1111
- msgid "Display post thumbnail"
1112
- msgstr ""
1113
-
1114
- #: ../src/Widget/form.php:122
1115
- msgid "Use predefined size"
1116
- msgstr ""
1117
-
1118
- #: ../src/Widget/form.php:134
1119
- msgid "Set size manually"
1120
- msgstr ""
1121
-
1122
- #: ../src/Widget/form.php:136
1123
- msgid "Width"
1124
- msgstr ""
1125
-
1126
- #: ../src/Widget/form.php:139
1127
- msgid "Height"
1128
- msgstr ""
1129
-
1130
- #: ../src/Widget/form.php:146
1131
- msgid "Stats Tag settings"
1132
- msgstr ""
1133
-
1134
- #: ../src/Widget/form.php:148
1135
- msgid "Display comment count"
1136
- msgstr ""
1137
-
1138
- #: ../src/Widget/form.php:150
1139
- msgid "Display views"
1140
- msgstr ""
1141
-
1142
- #: ../src/Widget/form.php:152
1143
- msgid "Display author"
1144
- msgstr ""
1145
-
1146
- #: ../src/Widget/form.php:154
1147
- msgid "Display date"
1148
- msgstr ""
1149
-
1150
- #: ../src/Widget/form.php:157
1151
- msgid "Date Format"
1152
- msgstr ""
1153
-
1154
- #: ../src/Widget/form.php:159
1155
- msgid "Relative"
1156
- msgstr ""
1157
-
1158
- #: ../src/Widget/form.php:160
1159
- msgid "WordPress Date Format"
1160
- msgstr ""
1161
-
1162
- #: ../src/Widget/form.php:167
1163
- msgid "Display taxonomy"
1164
- msgstr ""
1165
-
1166
- #: ../src/Widget/form.php:188
1167
- msgid "HTML Markup settings"
1168
- msgstr ""
1169
-
1170
- #: ../src/Widget/form.php:190
1171
- msgid "Use custom HTML Markup"
1172
- msgstr ""
1173
-
1174
- #: ../src/Widget/form.php:205
1175
- msgid "Before / after title"
1176
- msgstr ""
1177
-
1178
- #: ../src/Widget/form.php:208
1179
- msgid "Before / after Popular Posts"
1180
- msgstr ""
1181
-
1182
- #: ../src/Widget/form.php:211
1183
- msgid "Post HTML Markup"
1184
- msgstr ""
1185
-
1186
- #: ../src/Widget/form.php:218
1187
- msgid "Theme"
1188
- msgstr ""
1189
-
1190
- #: ../src/Widget/form.php:218
1191
- #, php-format
1192
- msgid "see a <a href=\"%s\">list of supported browsers</a>"
1193
- msgstr ""
1194
-
1195
- #: ../src/Widget/form.php:234
1196
- msgid "Please save this widget (or reload this page) to enable WPP themes."
1197
- msgstr ""
1198
-
1199
- #: ../wordpress-popular-posts.php:52
1200
- #, php-format
1201
- msgid ""
1202
- "WordPress Popular Posts requires at least PHP %1$s and WordPress %2$s to function "
1203
- "correctly. Your site uses PHP %3$s and WordPress %4$s."
1204
- msgstr ""
1
+ # Copyright (C) 2014 Wordpress Popular Posts
2
+ # This file is distributed under the same license as the Wordpress Popular Posts package.
3
+ #, fuzzy
4
+ 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-07-11 17:14-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"
12
+ "Language: en\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
+ "X-Generator: Poedit 2.3.1\n"
18
+ "X-Poedit-KeywordsList: _e;__;__ngettext;__ngettext_noop;_n_noop;_x;_nx;_nx_noop;_ex;"
19
+ "esc_attr__;esc_attr_e;esc_attr_x;esc_html__;esc_html_e;esc_html_x;_c;_nc;_n:1,2\n"
20
+ "X-Poedit-Basepath: .\n"
21
+ "X-Poedit-SourceCharset: UTF-8\n"
22
+ "X-Poedit-SearchPath-0: .\n"
23
+ "X-Poedit-SearchPath-1: ..\n"
24
+
25
+ #: ../src/Admin/Admin.php:371
26
+ #, php-format
27
+ msgid "%s view in the last hour"
28
+ msgid_plural "%s views in the last hour"
29
+ msgstr[0] ""
30
+ msgstr[1] ""
31
+
32
+ #: ../src/Admin/Admin.php:405 ../src/Admin/admin-page.php:349
33
+ msgid "Trending now"
34
+ msgstr ""
35
+
36
+ #: ../src/Admin/Admin.php:493
37
+ msgid "View more"
38
+ msgstr ""
39
+
40
+ #: ../src/Admin/Admin.php:522
41
+ msgid "Use this image"
42
+ msgstr ""
43
+
44
+ #: ../src/Admin/Admin.php:575
45
+ msgid "Overview"
46
+ msgstr ""
47
+
48
+ #: ../src/Admin/Admin.php:576
49
+ msgid ""
50
+ "Welcome to WordPress Popular Posts' Dashboard! In this screen you will find statistics "
51
+ "on what's popular on your site, tools to further tweak WPP to your needs, and more!"
52
+ msgstr ""
53
+
54
+ #: ../src/Admin/Admin.php:582
55
+ msgid "Like this plugin?"
56
+ msgstr ""
57
+
58
+ #: ../src/Admin/Admin.php:584
59
+ msgid ""
60
+ "Each donation motivates me to keep releasing free stuff for the WordPress community!"
61
+ msgstr ""
62
+
63
+ #: ../src/Admin/Admin.php:591
64
+ #, php-format
65
+ msgid "You can <a href=\"%s\" target=\"_blank\">leave a review</a>, too!"
66
+ msgstr ""
67
+
68
+ #: ../src/Admin/Admin.php:598
69
+ #, php-format
70
+ msgid ""
71
+ "<p><strong>For more information:</strong></p><ul><li><a href=\"%1$s\">Documentation</"
72
+ "a></li><li><a href=\"%2$s\">Support</a></li></ul>"
73
+ msgstr ""
74
+
75
+ #: ../src/Admin/Admin.php:622
76
+ 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:735
81
+ #, php-format
82
+ msgid "%s view"
83
+ msgid_plural "%s views"
84
+ 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:718
89
+ #, php-format
90
+ msgid "%s comment"
91
+ msgid_plural "%s comments"
92
+ msgstr[0] ""
93
+ msgstr[1] ""
94
+
95
+ #: ../src/Admin/Admin.php:720 ../src/Widget/form.php:21
96
+ msgid "Comments"
97
+ msgstr ""
98
+
99
+ #: ../src/Admin/Admin.php:724
100
+ msgid "Views"
101
+ msgstr ""
102
+
103
+ #: ../src/Admin/Admin.php:1094
104
+ msgid "View"
105
+ msgstr ""
106
+
107
+ #: ../src/Admin/Admin.php:1094
108
+ msgid "Edit"
109
+ msgstr ""
110
+
111
+ #: ../src/Admin/Admin.php:1105
112
+ msgid ""
113
+ "Looks like your site's activity is a little low right now. <br />Spread the word and "
114
+ "come back later!"
115
+ msgstr ""
116
+
117
+ #: ../src/Admin/Admin.php:1367
118
+ #, php-format
119
+ msgid ""
120
+ "<strong>WordPress Popular Posts:</strong> It seems your site is popular (great!) You "
121
+ "may want to check <a href=\"%s\">these suggestions</a> to make sure your website's "
122
+ "performance stays up to par."
123
+ msgstr ""
124
+
125
+ #: ../src/Admin/admin-page.php:6 ../src/Admin/admin-page.php:240
126
+ msgid "Stats"
127
+ msgstr ""
128
+
129
+ #: ../src/Admin/admin-page.php:7 ../src/Admin/admin-page.php:241
130
+ msgid "Tools"
131
+ msgstr ""
132
+
133
+ #: ../src/Admin/admin-page.php:8 ../src/Admin/admin-page.php:242
134
+ msgid "Parameters"
135
+ msgstr ""
136
+
137
+ #: ../src/Admin/admin-page.php:30 ../src/Admin/admin-page.php:41
138
+ #: ../src/Admin/admin-page.php:67 ../src/Admin/admin-page.php:103
139
+ msgid "Settings saved."
140
+ msgstr ""
141
+
142
+ #: ../src/Admin/admin-page.php:52
143
+ msgid "Please provide the name of your custom field."
144
+ msgstr ""
145
+
146
+ #: ../src/Admin/admin-page.php:121
147
+ msgid ""
148
+ "This operation will delete all entries from WordPress Popular Posts' cache table and "
149
+ "cannot be undone."
150
+ msgstr ""
151
+
152
+ #: ../src/Admin/admin-page.php:121 ../src/Admin/admin-page.php:160
153
+ #: ../src/Admin/admin-page.php:199
154
+ msgid "Do you want to continue?"
155
+ msgstr ""
156
+
157
+ #: ../src/Admin/admin-page.php:133
158
+ msgid "Success! The cache table has been cleared!"
159
+ msgstr ""
160
+
161
+ #: ../src/Admin/admin-page.php:137
162
+ msgid "Error: cache table does not exist."
163
+ msgstr ""
164
+
165
+ #: ../src/Admin/admin-page.php:141 ../src/Admin/admin-page.php:149
166
+ #: ../src/Admin/admin-page.php:180 ../src/Admin/admin-page.php:188
167
+ #: ../src/Admin/admin-page.php:218 ../src/Admin/admin-page.php:226
168
+ msgid "Invalid action."
169
+ msgstr ""
170
+
171
+ #: ../src/Admin/admin-page.php:145 ../src/Admin/admin-page.php:184
172
+ #: ../src/Admin/admin-page.php:222
173
+ msgid ""
174
+ "Sorry, you do not have enough permissions to do this. Please contact the site "
175
+ "administrator for support."
176
+ msgstr ""
177
+
178
+ #: ../src/Admin/admin-page.php:160
179
+ msgid ""
180
+ "This operation will delete all stored info from WordPress Popular Posts' data tables "
181
+ "and cannot be undone."
182
+ msgstr ""
183
+
184
+ #: ../src/Admin/admin-page.php:172
185
+ msgid "Success! All data have been cleared!"
186
+ msgstr ""
187
+
188
+ #: ../src/Admin/admin-page.php:176
189
+ msgid "Error: one or both data tables are missing."
190
+ msgstr ""
191
+
192
+ #: ../src/Admin/admin-page.php:199
193
+ msgid "This operation will delete all cached thumbnails and cannot be undone."
194
+ msgstr ""
195
+
196
+ #: ../src/Admin/admin-page.php:210
197
+ msgid "Success! All files have been deleted!"
198
+ msgstr ""
199
+
200
+ #: ../src/Admin/admin-page.php:214
201
+ msgid "The thumbnail cache is already empty!"
202
+ msgstr ""
203
+
204
+ #: ../src/Admin/admin-page.php:239
205
+ msgid "Menu"
206
+ msgstr ""
207
+
208
+ #: ../src/Admin/admin-page.php:266
209
+ msgid "Post type"
210
+ msgstr ""
211
+
212
+ #: ../src/Admin/admin-page.php:269
213
+ msgid "Limit"
214
+ msgstr ""
215
+
216
+ #: ../src/Admin/admin-page.php:272 ../src/Widget/form.php:52
217
+ msgid "Display only posts published within the selected Time Range"
218
+ msgstr ""
219
+
220
+ #: ../src/Admin/admin-page.php:278 ../src/Admin/admin-page.php:310
221
+ #: ../src/Admin/admin-page.php:462 ../src/Admin/admin-page.php:569
222
+ #: ../src/Admin/admin-page.php:609
223
+ msgid "Apply"
224
+ msgstr ""
225
+
226
+ #: ../src/Admin/admin-page.php:279 ../src/Admin/admin-page.php:313
227
+ msgid "Cancel"
228
+ msgstr ""
229
+
230
+ #: ../src/Admin/admin-page.php:288
231
+ msgid "Custom Time Range"
232
+ msgstr ""
233
+
234
+ #: ../src/Admin/admin-page.php:289
235
+ msgid "Date Range"
236
+ msgstr ""
237
+
238
+ #: ../src/Admin/admin-page.php:296 ../src/Admin/admin-page.php:535
239
+ #: ../src/Widget/form.php:45
240
+ msgid "Minute(s)"
241
+ msgstr ""
242
+
243
+ #: ../src/Admin/admin-page.php:297 ../src/Admin/admin-page.php:536
244
+ #: ../src/Widget/form.php:46
245
+ msgid "Hour(s)"
246
+ msgstr ""
247
+
248
+ #: ../src/Admin/admin-page.php:298 ../src/Admin/admin-page.php:537
249
+ #: ../src/Widget/form.php:47
250
+ msgid "Day(s)"
251
+ msgstr ""
252
+
253
+ #: ../src/Admin/admin-page.php:303
254
+ msgid "Select a date..."
255
+ msgstr ""
256
+
257
+ #: ../src/Admin/admin-page.php:323
258
+ msgid "Today"
259
+ msgstr ""
260
+
261
+ #: ../src/Admin/admin-page.php:324 ../src/Widget/form.php:34
262
+ msgid "Last 24 hours"
263
+ msgstr ""
264
+
265
+ #: ../src/Admin/admin-page.php:325 ../src/Widget/form.php:35
266
+ msgid "Last 7 days"
267
+ msgstr ""
268
+
269
+ #: ../src/Admin/admin-page.php:326 ../src/Widget/form.php:36
270
+ msgid "Last 30 days"
271
+ msgstr ""
272
+
273
+ #: ../src/Admin/admin-page.php:327 ../src/Widget/form.php:38
274
+ msgid "Custom"
275
+ msgstr ""
276
+
277
+ #: ../src/Admin/admin-page.php:331
278
+ #, php-format
279
+ msgid ""
280
+ "Err... A nice little chart is supposed to be here, instead you are seeing this because "
281
+ "your browser is too old. <br /> Please <a href=\"%s\" target=\"_blank\">get a better "
282
+ "browser</a>."
283
+ msgstr ""
284
+
285
+ #: ../src/Admin/admin-page.php:347
286
+ msgid "Most viewed"
287
+ msgstr ""
288
+
289
+ #: ../src/Admin/admin-page.php:348
290
+ msgid "Most commented"
291
+ msgstr ""
292
+
293
+ #: ../src/Admin/admin-page.php:350
294
+ msgid "Hall of Fame"
295
+ msgstr ""
296
+
297
+ #: ../src/Admin/admin-page.php:390
298
+ msgid "Thumbnails"
299
+ msgstr ""
300
+
301
+ #: ../src/Admin/admin-page.php:396
302
+ msgid "Default thumbnail"
303
+ msgstr ""
304
+
305
+ #: ../src/Admin/admin-page.php:402
306
+ msgid "Change thumbnail"
307
+ msgstr ""
308
+
309
+ #: ../src/Admin/admin-page.php:405
310
+ msgid "This image will be displayed when no thumbnail is available"
311
+ msgstr ""
312
+
313
+ #: ../src/Admin/admin-page.php:409
314
+ msgid "Pick image from"
315
+ msgstr ""
316
+
317
+ #: ../src/Admin/admin-page.php:412
318
+ msgid "Featured image"
319
+ msgstr ""
320
+
321
+ #: ../src/Admin/admin-page.php:413
322
+ msgid "First image on post"
323
+ msgstr ""
324
+
325
+ #: ../src/Admin/admin-page.php:414
326
+ msgid "First attachment"
327
+ msgstr ""
328
+
329
+ #: ../src/Admin/admin-page.php:415
330
+ msgid "Custom field"
331
+ msgstr ""
332
+
333
+ #: ../src/Admin/admin-page.php:418
334
+ msgid "Tell WordPress Popular Posts where it should get thumbnails from"
335
+ msgstr ""
336
+
337
+ #: ../src/Admin/admin-page.php:422
338
+ msgid "Lazy load"
339
+ msgstr ""
340
+
341
+ #: ../src/Admin/admin-page.php:422 ../src/Admin/admin-page.php:519
342
+ #: ../src/Admin/admin-page.php:547 ../src/Widget/form.php:7 ../src/Widget/form.php:54
343
+ #: ../src/Widget/form.php:60 ../src/Widget/form.php:88 ../src/Widget/form.php:98
344
+ #: ../src/Widget/form.php:190
345
+ msgid "What is this?"
346
+ msgstr ""
347
+
348
+ #: ../src/Admin/admin-page.php:425
349
+ msgid "No"
350
+ msgstr ""
351
+
352
+ #: ../src/Admin/admin-page.php:426 ../src/Admin/admin-page.php:441
353
+ msgid "Yes"
354
+ msgstr ""
355
+
356
+ #: ../src/Admin/admin-page.php:431
357
+ msgid "Custom field name"
358
+ msgstr ""
359
+
360
+ #: ../src/Admin/admin-page.php:437
361
+ msgid "Resize image from Custom field?"
362
+ msgstr ""
363
+
364
+ #: ../src/Admin/admin-page.php:440
365
+ msgid "No, use image as is"
366
+ msgstr ""
367
+
368
+ #: ../src/Admin/admin-page.php:452
369
+ msgid "Empty image cache"
370
+ msgstr ""
371
+
372
+ #: ../src/Admin/admin-page.php:453
373
+ msgid "Use this button to clear WPP's thumbnails cache"
374
+ msgstr ""
375
+
376
+ #: ../src/Admin/admin-page.php:473
377
+ msgid "Data"
378
+ msgstr ""
379
+
380
+ #: ../src/Admin/admin-page.php:479
381
+ msgid "Log views from"
382
+ msgstr ""
383
+
384
+ #: ../src/Admin/admin-page.php:482
385
+ msgid "Visitors only"
386
+ msgstr ""
387
+
388
+ #: ../src/Admin/admin-page.php:483
389
+ msgid "Logged-in users only"
390
+ msgstr ""
391
+
392
+ #: ../src/Admin/admin-page.php:484
393
+ msgid "Everyone"
394
+ msgstr ""
395
+
396
+ #: ../src/Admin/admin-page.php:490
397
+ msgid "Log limit"
398
+ msgstr ""
399
+
400
+ #: ../src/Admin/admin-page.php:493 ../src/Admin/admin-page.php:510
401
+ #: ../src/Admin/admin-page.php:550 ../src/Admin/admin-page.php:600
402
+ msgid "Disabled"
403
+ msgstr ""
404
+
405
+ #: ../src/Admin/admin-page.php:494
406
+ msgid "Keep data for"
407
+ msgstr ""
408
+
409
+ #: ../src/Admin/admin-page.php:498
410
+ msgid "day(s)"
411
+ msgstr ""
412
+
413
+ #: ../src/Admin/admin-page.php:501
414
+ msgid "Data older than the specified time frame will be automatically discarded"
415
+ msgstr ""
416
+
417
+ #: ../src/Admin/admin-page.php:507
418
+ msgid "Ajaxify widget"
419
+ msgstr ""
420
+
421
+ #: ../src/Admin/admin-page.php:511 ../src/Admin/admin-page.php:551
422
+ #: ../src/Admin/admin-page.php:599
423
+ msgid "Enabled"
424
+ msgstr ""
425
+
426
+ #: ../src/Admin/admin-page.php:515
427
+ msgid ""
428
+ "If you are using a caching plugin such as WP Super Cache, enabling this feature will "
429
+ "keep the popular list from being cached by it"
430
+ msgstr ""
431
+
432
+ #: ../src/Admin/admin-page.php:519
433
+ msgid "Data Caching"
434
+ msgstr ""
435
+
436
+ #: ../src/Admin/admin-page.php:522
437
+ msgid "Never cache"
438
+ msgstr ""
439
+
440
+ #: ../src/Admin/admin-page.php:523
441
+ msgid "Enable caching"
442
+ msgstr ""
443
+
444
+ #: ../src/Admin/admin-page.php:527
445
+ msgid ""
446
+ "WPP can cache the popular list for a specified amount of time. Recommended for large / "
447
+ "high traffic sites"
448
+ msgstr ""
449
+
450
+ #: ../src/Admin/admin-page.php:531
451
+ msgid "Refresh cache every"
452
+ msgstr ""
453
+
454
+ #: ../src/Admin/admin-page.php:538
455
+ msgid "Week(s)"
456
+ msgstr ""
457
+
458
+ #: ../src/Admin/admin-page.php:539
459
+ msgid "Month(s)"
460
+ msgstr ""
461
+
462
+ #: ../src/Admin/admin-page.php:540
463
+ msgid "Year(s)"
464
+ msgstr ""
465
+
466
+ #: ../src/Admin/admin-page.php:543
467
+ msgid "Really? That long?"
468
+ msgstr ""
469
+
470
+ #: ../src/Admin/admin-page.php:547
471
+ msgid "Data Sampling"
472
+ msgstr ""
473
+
474
+ #: ../src/Admin/admin-page.php:555
475
+ #, php-format
476
+ msgid ""
477
+ "By default, WordPress Popular Posts stores in database every single visit your site "
478
+ "receives. For small / medium sites this is generally OK, but on large / high traffic "
479
+ "sites the constant writing to the database may have an impact on performance. With <a "
480
+ "href=\"%1$s\" target=\"_blank\">data sampling</a>, WordPress Popular Posts will store "
481
+ "only a subset of your traffic and report on the tendencies detected in that sample set "
482
+ "(for more, <a href=\"%2$s\" target=\"_blank\">please read here</a>)"
483
+ msgstr ""
484
+
485
+ #: ../src/Admin/admin-page.php:559
486
+ msgid "Sample Rate"
487
+ msgstr ""
488
+
489
+ #: ../src/Admin/admin-page.php:563
490
+ #, php-format
491
+ msgid ""
492
+ "A sampling rate of %d is recommended for large / high traffic sites. For lower traffic "
493
+ "sites, you should lower the value"
494
+ msgstr ""
495
+
496
+ #: ../src/Admin/admin-page.php:580
497
+ msgid "Miscellaneous"
498
+ msgstr ""
499
+
500
+ #: ../src/Admin/admin-page.php:586
501
+ msgid "Open links in"
502
+ msgstr ""
503
+
504
+ #: ../src/Admin/admin-page.php:589
505
+ msgid "Current window"
506
+ msgstr ""
507
+
508
+ #: ../src/Admin/admin-page.php:590
509
+ msgid "New tab/window"
510
+ msgstr ""
511
+
512
+ #: ../src/Admin/admin-page.php:596
513
+ msgid "Use plugin's stylesheet"
514
+ msgstr ""
515
+
516
+ #: ../src/Admin/admin-page.php:603
517
+ msgid ""
518
+ "By default, the plugin includes a stylesheet called wpp.css which you can use to style "
519
+ "your popular posts listing. If you wish to use your own stylesheet or do not want it "
520
+ "to have it included in the header section of your site, use this."
521
+ msgstr ""
522
+
523
+ #: ../src/Admin/admin-page.php:623
524
+ msgid ""
525
+ "WordPress Popular Posts maintains data in two separate tables: one for storing the "
526
+ "most popular entries on a daily basis (from now on, \"cache\"), and another one to "
527
+ "keep the All-time data (from now on, \"historical data\" or just \"data\"). If for "
528
+ "some reason you need to clear the cache table, or even both historical and cache "
529
+ "tables, please use the buttons below to do so."
530
+ msgstr ""
531
+
532
+ #: ../src/Admin/admin-page.php:624
533
+ msgid "Empty cache"
534
+ msgstr ""
535
+
536
+ #: ../src/Admin/admin-page.php:624
537
+ msgid "Use this button to manually clear entries from WPP cache only"
538
+ msgstr ""
539
+
540
+ #: ../src/Admin/admin-page.php:625
541
+ msgid "Clear all data"
542
+ msgstr ""
543
+
544
+ #: ../src/Admin/admin-page.php:625
545
+ msgid "Use this button to manually clear entries from all WPP data tables"
546
+ msgstr ""
547
+
548
+ #: ../src/Admin/admin-page.php:633
549
+ #, php-format
550
+ msgid ""
551
+ "With the following parameters you can customize the popular posts list when using "
552
+ "either the <a href=\"%1$s\">wpp_get_mostpopular() template tag</a> or the <a href="
553
+ "\"%2$s\">[wpp] shortcode</a>."
554
+ msgstr ""
555
+
556
+ #: ../src/Admin/admin-page.php:643
557
+ msgid "Parameter"
558
+ msgstr ""
559
+
560
+ #: ../src/Admin/admin-page.php:644
561
+ msgid "What it does "
562
+ msgstr ""
563
+
564
+ #: ../src/Admin/admin-page.php:645
565
+ msgid "Possible values"
566
+ msgstr ""
567
+
568
+ #: ../src/Admin/admin-page.php:646
569
+ msgid "Defaults to"
570
+ msgstr ""
571
+
572
+ #: ../src/Admin/admin-page.php:647
573
+ msgid "Example"
574
+ msgstr ""
575
+
576
+ #: ../src/Admin/admin-page.php:653
577
+ msgid "Sets a heading for the list"
578
+ msgstr ""
579
+
580
+ #: ../src/Admin/admin-page.php:654 ../src/Admin/admin-page.php:661
581
+ #: ../src/Admin/admin-page.php:668 ../src/Admin/admin-page.php:717
582
+ #: ../src/Admin/admin-page.php:724 ../src/Admin/admin-page.php:731
583
+ #: ../src/Admin/admin-page.php:738 ../src/Admin/admin-page.php:745
584
+ #: ../src/Admin/admin-page.php:752 ../src/Admin/admin-page.php:843
585
+ #: ../src/Admin/admin-page.php:864 ../src/Admin/admin-page.php:871
586
+ msgid "Text string"
587
+ msgstr ""
588
+
589
+ #: ../src/Admin/admin-page.php:655 ../src/Admin/admin-page.php:725
590
+ #: ../src/Admin/admin-page.php:732 ../src/Admin/admin-page.php:739
591
+ #: ../src/Admin/admin-page.php:746 ../src/Admin/admin-page.php:753
592
+ #: ../src/Widget/form.php:226
593
+ msgid "None"
594
+ msgstr ""
595
+
596
+ #: ../src/Admin/admin-page.php:656 ../src/Admin/admin-page.php:663
597
+ #: ../src/Admin/admin-page.php:670 ../src/Admin/admin-page.php:677
598
+ #: ../src/Admin/admin-page.php:684 ../src/Admin/admin-page.php:691
599
+ #: ../src/Admin/admin-page.php:698 ../src/Admin/admin-page.php:705
600
+ #: ../src/Admin/admin-page.php:712 ../src/Admin/admin-page.php:719
601
+ #: ../src/Admin/admin-page.php:726 ../src/Admin/admin-page.php:733
602
+ #: ../src/Admin/admin-page.php:740 ../src/Admin/admin-page.php:747
603
+ #: ../src/Admin/admin-page.php:754 ../src/Admin/admin-page.php:761
604
+ #: ../src/Admin/admin-page.php:768 ../src/Admin/admin-page.php:775
605
+ #: ../src/Admin/admin-page.php:782 ../src/Admin/admin-page.php:789
606
+ #: ../src/Admin/admin-page.php:796 ../src/Admin/admin-page.php:803
607
+ #: ../src/Admin/admin-page.php:810 ../src/Admin/admin-page.php:817
608
+ #: ../src/Admin/admin-page.php:824 ../src/Admin/admin-page.php:831
609
+ #: ../src/Admin/admin-page.php:838 ../src/Admin/admin-page.php:845
610
+ #: ../src/Admin/admin-page.php:852 ../src/Admin/admin-page.php:859
611
+ #: ../src/Admin/admin-page.php:866 ../src/Admin/admin-page.php:873
612
+ #: ../src/Admin/admin-page.php:880
613
+ msgid "With wpp_get_mostpopular():"
614
+ msgstr ""
615
+
616
+ #: ../src/Admin/admin-page.php:656 ../src/Admin/admin-page.php:663
617
+ #: ../src/Admin/admin-page.php:670 ../src/Admin/admin-page.php:677
618
+ #: ../src/Admin/admin-page.php:684 ../src/Admin/admin-page.php:691
619
+ #: ../src/Admin/admin-page.php:698 ../src/Admin/admin-page.php:705
620
+ #: ../src/Admin/admin-page.php:712 ../src/Admin/admin-page.php:719
621
+ #: ../src/Admin/admin-page.php:726 ../src/Admin/admin-page.php:733
622
+ #: ../src/Admin/admin-page.php:740 ../src/Admin/admin-page.php:747
623
+ #: ../src/Admin/admin-page.php:754 ../src/Admin/admin-page.php:761
624
+ #: ../src/Admin/admin-page.php:768 ../src/Admin/admin-page.php:775
625
+ #: ../src/Admin/admin-page.php:782 ../src/Admin/admin-page.php:789
626
+ #: ../src/Admin/admin-page.php:796 ../src/Admin/admin-page.php:803
627
+ #: ../src/Admin/admin-page.php:810 ../src/Admin/admin-page.php:817
628
+ #: ../src/Admin/admin-page.php:824 ../src/Admin/admin-page.php:831
629
+ #: ../src/Admin/admin-page.php:838 ../src/Admin/admin-page.php:845
630
+ #: ../src/Admin/admin-page.php:852 ../src/Admin/admin-page.php:859
631
+ #: ../src/Admin/admin-page.php:866 ../src/Admin/admin-page.php:873
632
+ #: ../src/Admin/admin-page.php:880
633
+ msgid "With the [wpp] shortcode:"
634
+ msgstr ""
635
+
636
+ #: ../src/Admin/admin-page.php:660
637
+ msgid "Set the opening tag for the heading of the list"
638
+ msgstr ""
639
+
640
+ #: ../src/Admin/admin-page.php:667
641
+ msgid "Set the closing tag for the heading of the list"
642
+ msgstr ""
643
+
644
+ #: ../src/Admin/admin-page.php:674
645
+ msgid "Sets the maximum number of popular posts to be shown on the listing"
646
+ msgstr ""
647
+
648
+ #: ../src/Admin/admin-page.php:675 ../src/Admin/admin-page.php:689
649
+ #: ../src/Admin/admin-page.php:759 ../src/Admin/admin-page.php:773
650
+ #: ../src/Admin/admin-page.php:794 ../src/Admin/admin-page.php:801
651
+ msgid "Positive integer"
652
+ msgstr ""
653
+
654
+ #: ../src/Admin/admin-page.php:681
655
+ msgid ""
656
+ "Tells WordPress Popular Posts to retrieve the most popular entries within the time "
657
+ "range specified by you"
658
+ msgstr ""
659
+
660
+ #: ../src/Admin/admin-page.php:688
661
+ msgid "Especifies the number of time units of the custom time range"
662
+ msgstr ""
663
+
664
+ #: ../src/Admin/admin-page.php:695
665
+ msgid "Especifies the time unit of the custom time range"
666
+ msgstr ""
667
+
668
+ #: ../src/Admin/admin-page.php:702
669
+ msgid ""
670
+ "Tells WordPress Popular Posts to retrieve the most popular entries published within "
671
+ "the time range specified by you"
672
+ msgstr ""
673
+
674
+ #: ../src/Admin/admin-page.php:709
675
+ msgid "Sets the sorting option of the popular posts"
676
+ msgstr ""
677
+
678
+ #: ../src/Admin/admin-page.php:710
679
+ msgid "(for average views per day)"
680
+ msgstr ""
681
+
682
+ #: ../src/Admin/admin-page.php:716
683
+ msgid "Defines the type of posts to show on the listing"
684
+ msgstr ""
685
+
686
+ #: ../src/Admin/admin-page.php:723
687
+ msgid ""
688
+ "If set, WordPress Popular Posts will exclude the specified post(s) ID(s) form the "
689
+ "listing."
690
+ msgstr ""
691
+
692
+ #: ../src/Admin/admin-page.php:730
693
+ msgid ""
694
+ "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
695
+ "category ID(s). If a minus sign is used, entries associated to the category will be "
696
+ "excluded instead."
697
+ msgstr ""
698
+
699
+ #: ../src/Admin/admin-page.php:737
700
+ msgid "If set, WordPress Popular Posts will filter posts by a given taxonomy."
701
+ msgstr ""
702
+
703
+ #: ../src/Admin/admin-page.php:744
704
+ msgid ""
705
+ "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
706
+ "term ID(s). If a minus sign is used, entries associated to the term(s) will be "
707
+ "excluded instead."
708
+ msgstr ""
709
+
710
+ #: ../src/Admin/admin-page.php:751
711
+ msgid ""
712
+ "If set, WordPress Popular Posts will retrieve all entries created by specified "
713
+ "author(s) ID(s)."
714
+ msgstr ""
715
+
716
+ #: ../src/Admin/admin-page.php:758
717
+ msgid ""
718
+ "If set, WordPress Popular Posts will shorten each post title to \"n\" characters "
719
+ "whenever possible"
720
+ msgstr ""
721
+
722
+ #: ../src/Admin/admin-page.php:765
723
+ msgid ""
724
+ "If set to 1, WordPress Popular Posts will shorten each post title to \"n\" words "
725
+ "instead of characters"
726
+ msgstr ""
727
+
728
+ #: ../src/Admin/admin-page.php:772
729
+ msgid ""
730
+ "If set, WordPress Popular Posts will build and include an excerpt of \"n\" characters "
731
+ "long from the content of each post listed as popular"
732
+ msgstr ""
733
+
734
+ #: ../src/Admin/admin-page.php:779
735
+ msgid ""
736
+ "If set, WordPress Popular Posts will maintaing all styling tags (strong, italic, etc) "
737
+ "and hyperlinks found in the excerpt"
738
+ msgstr ""
739
+
740
+ #: ../src/Admin/admin-page.php:786
741
+ msgid ""
742
+ "If set to 1, WordPress Popular Posts will shorten the excerpt to \"n\" words instead "
743
+ "of characters"
744
+ msgstr ""
745
+
746
+ #: ../src/Admin/admin-page.php:793
747
+ msgid ""
748
+ "If set, and if your current server configuration allows it, you will be able to "
749
+ "display thumbnails of your posts. This attribute sets the width for thumbnails"
750
+ msgstr ""
751
+
752
+ #: ../src/Admin/admin-page.php:800
753
+ msgid ""
754
+ "If set, and if your current server configuration allows it, you will be able to "
755
+ "display thumbnails of your posts. This attribute sets the height for thumbnails"
756
+ msgstr ""
757
+
758
+ #: ../src/Admin/admin-page.php:807
759
+ msgid ""
760
+ "If set, and if the WP-PostRatings plugin is installed and enabled on your blog, "
761
+ "WordPress Popular Posts will show how your visitors are rating your entries"
762
+ msgstr ""
763
+
764
+ #: ../src/Admin/admin-page.php:814
765
+ msgid ""
766
+ "If set, WordPress Popular Posts will show how many comments each popular post has got "
767
+ "during the specified time range"
768
+ msgstr ""
769
+
770
+ #: ../src/Admin/admin-page.php:821
771
+ msgid ""
772
+ "If set, WordPress Popular Posts will show how many views each popular post has got "
773
+ "during the specified time range"
774
+ msgstr ""
775
+
776
+ #: ../src/Admin/admin-page.php:828
777
+ msgid ""
778
+ "If set, WordPress Popular Posts will show who published each popular post on the list"
779
+ msgstr ""
780
+
781
+ #: ../src/Admin/admin-page.php:835
782
+ msgid ""
783
+ "If set, WordPress Popular Posts will display the date when each popular post on the "
784
+ "list was published"
785
+ msgstr ""
786
+
787
+ #: ../src/Admin/admin-page.php:842
788
+ msgid "Sets the date format"
789
+ msgstr ""
790
+
791
+ #: ../src/Admin/admin-page.php:849
792
+ msgid ""
793
+ "If set, WordPress Popular Posts will display the categories associated to each entry"
794
+ msgstr ""
795
+
796
+ #: ../src/Admin/admin-page.php:856
797
+ msgid ""
798
+ "If set, WordPress Popular Posts will display the taxonomies associated to each entry"
799
+ msgstr ""
800
+
801
+ #: ../src/Admin/admin-page.php:863
802
+ msgid "Sets the opening tag for the listing"
803
+ msgstr ""
804
+
805
+ #: ../src/Admin/admin-page.php:870
806
+ msgid "Sets the closing tag for the listing"
807
+ msgstr ""
808
+
809
+ #: ../src/Admin/admin-page.php:877
810
+ msgid "Sets the HTML structure of each post"
811
+ msgstr ""
812
+
813
+ #: ../src/Admin/admin-page.php:878
814
+ msgid "Text string, custom HTML"
815
+ msgstr ""
816
+
817
+ #: ../src/Admin/admin-page.php:878
818
+ msgid "Available Content Tags"
819
+ msgstr ""
820
+
821
+ #: ../src/Admin/admin-page.php:878
822
+ msgid ""
823
+ "returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height"
824
+ msgstr ""
825
+
826
+ #: ../src/Admin/admin-page.php:878
827
+ msgid ""
828
+ "returns thumbnail image without linking to post/page, requires thumbnail_width & "
829
+ "thumbnail_height"
830
+ msgstr ""
831
+
832
+ #: ../src/Admin/admin-page.php:878
833
+ msgid "returns thumbnail url, requires thumbnail_width & thumbnail_height"
834
+ msgstr ""
835
+
836
+ #: ../src/Admin/admin-page.php:878
837
+ msgid "returns linked post/page title"
838
+ msgstr ""
839
+
840
+ #: ../src/Admin/admin-page.php:878
841
+ msgid "returns the post/page ID"
842
+ msgstr ""
843
+
844
+ #: ../src/Admin/admin-page.php:878
845
+ msgid "returns post/page excerpt, and requires excerpt_length to be greater than 0"
846
+ msgstr ""
847
+
848
+ #: ../src/Admin/admin-page.php:878
849
+ msgid "returns the default stats tags"
850
+ msgstr ""
851
+
852
+ #: ../src/Admin/admin-page.php:878
853
+ msgid "returns post/page current rating, requires WP-PostRatings installed and enabled"
854
+ msgstr ""
855
+
856
+ #: ../src/Admin/admin-page.php:878
857
+ msgid ""
858
+ "returns post/page current rating as an integer, requires WP-PostRatings installed and "
859
+ "enabled"
860
+ msgstr ""
861
+
862
+ #: ../src/Admin/admin-page.php:878
863
+ msgid "returns the URL of the post/page"
864
+ msgstr ""
865
+
866
+ #: ../src/Admin/admin-page.php:878
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 ""
877
+
878
+ #: ../src/Admin/admin-page.php:878
879
+ msgid "returns linked category name, requires stats_category=1"
880
+ msgstr ""
881
+
882
+ #: ../src/Admin/admin-page.php:878
883
+ msgid "returns linked taxonomy names, requires stats_taxonomy=1"
884
+ msgstr ""
885
+
886
+ #: ../src/Admin/admin-page.php:878
887
+ msgid "returns views count only, no text"
888
+ msgstr ""
889
+
890
+ #: ../src/Admin/admin-page.php:878
891
+ msgid "returns comments count only, no text, requires stats_comments=1"
892
+ msgstr ""
893
+
894
+ #: ../src/Admin/admin-page.php:878
895
+ msgid "returns post/page date, requires stats_date=1"
896
+ msgstr ""
897
+
898
+ #: ../src/Admin/admin-page.php:878
899
+ msgid "outputs number of popular posts found"
900
+ msgstr ""
901
+
902
+ #: ../src/Admin/admin-page.php:878
903
+ msgid "outputs the position of the post in the listing"
904
+ msgstr ""
905
+
906
+ #: ../src/Output.php:243
907
+ msgid "Sorry. No data so far."
908
+ msgstr ""
909
+
910
+ #: ../src/Output.php:729
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:758
918
+ #, php-format
919
+ msgid "by %s"
920
+ msgstr ""
921
+
922
+ #: ../src/Output.php:764
923
+ #, php-format
924
+ msgid "posted %s"
925
+ msgstr ""
926
+
927
+ #: ../src/Output.php:764
928
+ #, php-format
929
+ msgid "posted on %s"
930
+ msgstr ""
931
+
932
+ #: ../src/Output.php:772
933
+ #, php-format
934
+ msgid "under %s"
935
+ msgstr ""
936
+
937
+ #: ../src/Rest/Controller.php:306
938
+ msgid "Invalid Widget Instance ID"
939
+ msgstr ""
940
+
941
+ #: ../src/Rest/Controller.php:416
942
+ msgid "Return popular posts from specified custom post type(s)."
943
+ msgstr ""
944
+
945
+ #: ../src/Rest/Controller.php:423
946
+ msgid "The maximum number of popular posts to return."
947
+ msgstr ""
948
+
949
+ #: ../src/Rest/Controller.php:431
950
+ msgid "Retrieve the most popular entries published within the specified time range."
951
+ msgstr ""
952
+
953
+ #: ../src/Rest/Controller.php:439
954
+ msgid "An offset point for the collection."
955
+ msgstr ""
956
+
957
+ #: ../src/Rest/Controller.php:447
958
+ msgid "Set the sorting option of the popular posts."
959
+ msgstr ""
960
+
961
+ #: ../src/Rest/Controller.php:455
962
+ msgid "Return popular posts from a specified time range."
963
+ msgstr ""
964
+
965
+ #: ../src/Rest/Controller.php:463
966
+ msgid "Specifies the time unit of the custom time range."
967
+ msgstr ""
968
+
969
+ #: ../src/Rest/Controller.php:471
970
+ msgid "Specifies the number of time units of the custom time range."
971
+ msgstr ""
972
+
973
+ #: ../src/Rest/Controller.php:479
974
+ msgid "Post IDs to exclude from the listing."
975
+ msgstr ""
976
+
977
+ #: ../src/Rest/Controller.php:487
978
+ msgid "Include posts in a specified taxonomy."
979
+ msgstr ""
980
+
981
+ #: ../src/Rest/Controller.php:495
982
+ msgid "Taxonomy IDs, separated by comma (prefix a minus sign to exclude)."
983
+ msgstr ""
984
+
985
+ #: ../src/Rest/Controller.php:503
986
+ msgid "Include popular posts from author ID(s)."
987
+ msgstr ""
988
+
989
+ #: ../src/Rest/Controller.php:524
990
+ msgid "Security nonce."
991
+ msgstr ""
992
+
993
+ #: ../src/Rest/Controller.php:530
994
+ msgid "The post / page ID."
995
+ msgstr ""
996
+
997
+ #: ../src/Rest/Controller.php:537
998
+ msgid "Enables Data Sampling."
999
+ msgstr ""
1000
+
1001
+ #: ../src/Rest/Controller.php:544
1002
+ msgid "Sets the Sampling Rate."
1003
+ msgstr ""
1004
+
1005
+ #: ../src/Widget/Widget.php:77
1006
+ msgid "The most Popular Posts on your blog."
1007
+ msgstr ""
1008
+
1009
+ #: ../src/Widget/form.php:7
1010
+ msgid "Title"
1011
+ msgstr ""
1012
+
1013
+ #: ../src/Widget/form.php:13
1014
+ msgid "Show up to"
1015
+ msgstr ""
1016
+
1017
+ #: ../src/Widget/form.php:14
1018
+ msgid "posts"
1019
+ msgstr ""
1020
+
1021
+ #: ../src/Widget/form.php:19
1022
+ msgid "Sort posts by"
1023
+ msgstr ""
1024
+
1025
+ #: ../src/Widget/form.php:22
1026
+ msgid "Total views"
1027
+ msgstr ""
1028
+
1029
+ #: ../src/Widget/form.php:23
1030
+ msgid "Avg. daily views"
1031
+ msgstr ""
1032
+
1033
+ #: ../src/Widget/form.php:30
1034
+ msgid "Filters"
1035
+ msgstr ""
1036
+
1037
+ #: ../src/Widget/form.php:32
1038
+ msgid "Time Range"
1039
+ msgstr ""
1040
+
1041
+ #: ../src/Widget/form.php:37
1042
+ msgid "All-time"
1043
+ msgstr ""
1044
+
1045
+ #: ../src/Widget/form.php:54
1046
+ msgid "Post type(s)"
1047
+ msgstr ""
1048
+
1049
+ #: ../src/Widget/form.php:57
1050
+ msgid "Post ID(s) to exclude"
1051
+ msgstr ""
1052
+
1053
+ #: ../src/Widget/form.php:60
1054
+ msgid "Taxonomy"
1055
+ msgstr ""
1056
+
1057
+ #: ../src/Widget/form.php:82
1058
+ #, php-format
1059
+ msgid "%s IDs, separated by comma (prefix a minus sign to exclude)"
1060
+ msgstr ""
1061
+
1062
+ #: ../src/Widget/form.php:88
1063
+ msgid "Author ID(s)"
1064
+ msgstr ""
1065
+
1066
+ #: ../src/Widget/form.php:94
1067
+ msgid "Posts settings"
1068
+ msgstr ""
1069
+
1070
+ #: ../src/Widget/form.php:98
1071
+ msgid "Display post rating"
1072
+ msgstr ""
1073
+
1074
+ #: ../src/Widget/form.php:101
1075
+ msgid "Shorten title"
1076
+ msgstr ""
1077
+
1078
+ #: ../src/Widget/form.php:104
1079
+ msgid "Shorten title to"
1080
+ msgstr ""
1081
+
1082
+ #: ../src/Widget/form.php:105 ../src/Widget/form.php:115
1083
+ msgid "characters"
1084
+ msgstr ""
1085
+
1086
+ #: ../src/Widget/form.php:106 ../src/Widget/form.php:116
1087
+ msgid "words"
1088
+ msgstr ""
1089
+
1090
+ #: ../src/Widget/form.php:109
1091
+ msgid "Display post excerpt"
1092
+ msgstr ""
1093
+
1094
+ #: ../src/Widget/form.php:112
1095
+ msgid "Keep text format and links"
1096
+ msgstr ""
1097
+
1098
+ #: ../src/Widget/form.php:113
1099
+ msgid "Excerpt length"
1100
+ msgstr ""
1101
+
1102
+ #: ../src/Widget/form.php:119
1103
+ msgid "Display post thumbnail"
1104
+ msgstr ""
1105
+
1106
+ #: ../src/Widget/form.php:122
1107
+ msgid "Use predefined size"
1108
+ msgstr ""
1109
+
1110
+ #: ../src/Widget/form.php:134
1111
+ msgid "Set size manually"
1112
+ msgstr ""
1113
+
1114
+ #: ../src/Widget/form.php:136
1115
+ msgid "Width"
1116
+ msgstr ""
1117
+
1118
+ #: ../src/Widget/form.php:139
1119
+ msgid "Height"
1120
+ msgstr ""
1121
+
1122
+ #: ../src/Widget/form.php:146
1123
+ msgid "Stats Tag settings"
1124
+ msgstr ""
1125
+
1126
+ #: ../src/Widget/form.php:148
1127
+ msgid "Display comment count"
1128
+ msgstr ""
1129
+
1130
+ #: ../src/Widget/form.php:150
1131
+ msgid "Display views"
1132
+ msgstr ""
1133
+
1134
+ #: ../src/Widget/form.php:152
1135
+ msgid "Display author"
1136
+ msgstr ""
1137
+
1138
+ #: ../src/Widget/form.php:154
1139
+ msgid "Display date"
1140
+ msgstr ""
1141
+
1142
+ #: ../src/Widget/form.php:157
1143
+ msgid "Date Format"
1144
+ msgstr ""
1145
+
1146
+ #: ../src/Widget/form.php:159
1147
+ msgid "Relative"
1148
+ msgstr ""
1149
+
1150
+ #: ../src/Widget/form.php:160
1151
+ msgid "WordPress Date Format"
1152
+ msgstr ""
1153
+
1154
+ #: ../src/Widget/form.php:167
1155
+ msgid "Display taxonomy"
1156
+ msgstr ""
1157
+
1158
+ #: ../src/Widget/form.php:188
1159
+ msgid "HTML Markup settings"
1160
+ msgstr ""
1161
+
1162
+ #: ../src/Widget/form.php:190
1163
+ msgid "Use custom HTML Markup"
1164
+ msgstr ""
1165
+
1166
+ #: ../src/Widget/form.php:205
1167
+ msgid "Before / after title"
1168
+ msgstr ""
1169
+
1170
+ #: ../src/Widget/form.php:208
1171
+ msgid "Before / after Popular Posts"
1172
+ msgstr ""
1173
+
1174
+ #: ../src/Widget/form.php:211
1175
+ msgid "Post HTML Markup"
1176
+ msgstr ""
1177
+
1178
+ #: ../src/Widget/form.php:218
1179
+ msgid "Theme"
1180
+ msgstr ""
1181
+
1182
+ #: ../src/Widget/form.php:218
1183
+ #, php-format
1184
+ msgid "see a <a href=\"%s\">list of supported browsers</a>"
1185
+ msgstr ""
1186
+
1187
+ #: ../src/Widget/form.php:234
1188
+ msgid "Please save this widget (or reload this page) to enable WPP themes."
1189
+ msgstr ""
1190
+
1191
+ #: ../wordpress-popular-posts.php:52
1192
+ #, php-format
1193
+ msgid ""
1194
+ "WordPress Popular Posts requires at least PHP %1$s and WordPress %2$s to function "
1195
+ "correctly. Your site uses PHP %3$s and WordPress %4$s."
1196
+ msgstr ""
 
 
 
 
 
 
 
 
index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
- // Silence is golden
1
+ <?php
2
+ // Silence is golden
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&currency_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,6 +89,20 @@ The FAQ section has been moved [here](https://github.com/cabrerahector/wordpress
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.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin&currency_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.2
7
  Requires PHP: 5.4
8
+ Stable tag: 5.2.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.2.0 =
93
+
94
+ **If you're using a caching plugin, flushing its cache right after installing / upgrading to this version is required.**
95
+
96
+ - JavaScript based Lazy Loading superseded by Native Lazing Loading.
97
+ - Improved Pageviews Cache.
98
+ - Views/comments count will be prettified now!
99
+ - Fixed a few layout issues found in widget themes.
100
+ - Improved compatibility with Content Security Policy (CSP).
101
+ - Added support for ACF images.
102
+ - Other minor improvements and fixes.
103
+
104
+ [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-2-is-here)
105
+
106
  = 5.1.0 =
107
 
108
  - The /popular-posts GET API endpoint is now being cached as well.
src/Activation/Activator.php CHANGED
@@ -1,129 +1,129 @@
1
- <?php
2
-
3
- /**
4
- * Fired during plugin activation
5
- *
6
- * @since 1.0.0
7
- * @package WordPressPopularPosts
8
- */
9
-
10
- /**
11
- * Fired during plugin activation.
12
- *
13
- * This class defines all code necessary to run during the plugin's activation.
14
- *
15
- * @since 1.0.0
16
- * @package WordPressPopularPosts
17
- * @author Hector Cabrera <me@cabrerahector.com>
18
- */
19
-
20
- namespace WordPressPopularPosts\Activation;
21
-
22
- class Activator {
23
- /**
24
- * Fired when the plugin is activated.
25
- *
26
- * @since 1.0.0
27
- * @param bool $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
28
- * @global object $wpdb
29
- */
30
- public static function activate($network_wide)
31
- {
32
- global $wpdb;
33
-
34
- if ( function_exists('is_multisite') && \is_multisite() ) {
35
- // run activation for each blog in the network
36
- if ( $network_wide ) {
37
- $original_blog_id = \get_current_blog_id();
38
- $blogs_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
39
-
40
- foreach( $blogs_ids as $blog_id ) {
41
- \switch_to_blog($blog_id);
42
- self::plugin_activate();
43
- }
44
-
45
- // switch back to current blog
46
- \switch_to_blog($original_blog_id);
47
-
48
- return;
49
- }
50
- }
51
-
52
- self::plugin_activate();
53
- }
54
-
55
- /**
56
- * When a new MU site is added, generate its WPP DB tables.
57
- *
58
- * @since 1.0.0
59
- */
60
- public static function track_new_site()
61
- {
62
- self::plugin_activate();
63
- }
64
-
65
- /**
66
- * On plugin activation, checks that the WPP database tables are present.
67
- *
68
- * @since 1.0.0
69
- * @global object $wpdb
70
- */
71
- private static function plugin_activate()
72
- {
73
- $wpp_ver = \get_option('wpp_ver');
74
-
75
- if (
76
- ! $wpp_ver
77
- || version_compare($wpp_ver, WPP_VERSION, '<')
78
- ) {
79
- global $wpdb;
80
-
81
- $prefix = $wpdb->prefix . "popularposts";
82
- self::do_db_tables($prefix);
83
- }
84
- }
85
-
86
- /**
87
- * Creates/updates the database tables.
88
- *
89
- * @since 1.0.0
90
- * @param string $prefix
91
- * @global object $wpdb
92
- */
93
- private static function do_db_tables($prefix)
94
- {
95
- global $wpdb;
96
- $charset_collate = "";
97
-
98
- if ( !empty($wpdb->charset) )
99
- $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset} ";
100
-
101
- if ( !empty($wpdb->collate) )
102
- $charset_collate .= "COLLATE {$wpdb->collate}";
103
-
104
- $sql = "
105
- CREATE TABLE {$prefix}data (
106
- postid bigint(20) NOT NULL,
107
- day datetime NOT NULL,
108
- last_viewed datetime NOT NULL,
109
- pageviews bigint(20) DEFAULT 1,
110
- PRIMARY KEY (postid)
111
- ) {$charset_collate} ENGINE=InnoDB;
112
- CREATE TABLE {$prefix}summary (
113
- ID bigint(20) NOT NULL AUTO_INCREMENT,
114
- postid bigint(20) NOT NULL,
115
- pageviews bigint(20) NOT NULL DEFAULT 1,
116
- view_date date NOT NULL,
117
- view_datetime datetime NOT NULL,
118
- PRIMARY KEY (ID),
119
- KEY postid (postid),
120
- KEY view_date (view_date),
121
- KEY view_datetime (view_datetime)
122
- ) {$charset_collate} ENGINE=InnoDB;";
123
-
124
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
125
- \dbDelta($sql);
126
-
127
- \update_option('wpp_ver', WPP_VERSION);
128
- }
129
- }
1
+ <?php
2
+
3
+ /**
4
+ * Fired during plugin activation
5
+ *
6
+ * @since 1.0.0
7
+ * @package WordPressPopularPosts
8
+ */
9
+
10
+ /**
11
+ * Fired during plugin activation.
12
+ *
13
+ * This class defines all code necessary to run during the plugin's activation.
14
+ *
15
+ * @since 1.0.0
16
+ * @package WordPressPopularPosts
17
+ * @author Hector Cabrera <me@cabrerahector.com>
18
+ */
19
+
20
+ namespace WordPressPopularPosts\Activation;
21
+
22
+ class Activator {
23
+ /**
24
+ * Fired when the plugin is activated.
25
+ *
26
+ * @since 1.0.0
27
+ * @param bool $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
28
+ * @global object $wpdb
29
+ */
30
+ public static function activate($network_wide)
31
+ {
32
+ global $wpdb;
33
+
34
+ if ( function_exists('is_multisite') && \is_multisite() ) {
35
+ // run activation for each blog in the network
36
+ if ( $network_wide ) {
37
+ $original_blog_id = \get_current_blog_id();
38
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
39
+
40
+ foreach( $blogs_ids as $blog_id ) {
41
+ \switch_to_blog($blog_id);
42
+ self::plugin_activate();
43
+ }
44
+
45
+ // switch back to current blog
46
+ \switch_to_blog($original_blog_id);
47
+
48
+ return;
49
+ }
50
+ }
51
+
52
+ self::plugin_activate();
53
+ }
54
+
55
+ /**
56
+ * When a new MU site is added, generate its WPP DB tables.
57
+ *
58
+ * @since 1.0.0
59
+ */
60
+ public static function track_new_site()
61
+ {
62
+ self::plugin_activate();
63
+ }
64
+
65
+ /**
66
+ * On plugin activation, checks that the WPP database tables are present.
67
+ *
68
+ * @since 1.0.0
69
+ * @global object $wpdb
70
+ */
71
+ private static function plugin_activate()
72
+ {
73
+ $wpp_ver = \get_option('wpp_ver');
74
+
75
+ if (
76
+ ! $wpp_ver
77
+ || version_compare($wpp_ver, WPP_VERSION, '<')
78
+ ) {
79
+ global $wpdb;
80
+
81
+ $prefix = $wpdb->prefix . "popularposts";
82
+ self::do_db_tables($prefix);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Creates/updates the database tables.
88
+ *
89
+ * @since 1.0.0
90
+ * @param string $prefix
91
+ * @global object $wpdb
92
+ */
93
+ private static function do_db_tables($prefix)
94
+ {
95
+ global $wpdb;
96
+ $charset_collate = "";
97
+
98
+ if ( !empty($wpdb->charset) )
99
+ $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset} ";
100
+
101
+ if ( !empty($wpdb->collate) )
102
+ $charset_collate .= "COLLATE {$wpdb->collate}";
103
+
104
+ $sql = "
105
+ CREATE TABLE {$prefix}data (
106
+ postid bigint(20) NOT NULL,
107
+ day datetime NOT NULL,
108
+ last_viewed datetime NOT NULL,
109
+ pageviews bigint(20) DEFAULT 1,
110
+ PRIMARY KEY (postid)
111
+ ) {$charset_collate} ENGINE=InnoDB;
112
+ CREATE TABLE {$prefix}summary (
113
+ ID bigint(20) NOT NULL AUTO_INCREMENT,
114
+ postid bigint(20) NOT NULL,
115
+ pageviews bigint(20) NOT NULL DEFAULT 1,
116
+ view_date date NOT NULL,
117
+ view_datetime datetime NOT NULL,
118
+ PRIMARY KEY (ID),
119
+ KEY postid (postid),
120
+ KEY view_date (view_date),
121
+ KEY view_datetime (view_datetime)
122
+ ) {$charset_collate} ENGINE=InnoDB;";
123
+
124
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
125
+ \dbDelta($sql);
126
+
127
+ \update_option('wpp_ver', WPP_VERSION);
128
+ }
129
+ }
src/Activation/Deactivator.php CHANGED
@@ -1,66 +1,66 @@
1
- <?php
2
- /**
3
- * Fired during plugin deactivation
4
- *
5
- * @link https://cabrerahector.com
6
- * @since 4.0.0
7
- *
8
- * @package WordPressPopularPosts
9
- */
10
-
11
- /**
12
- * Fired during plugin deactivation.
13
- *
14
- * This class defines all code necessary to run during the plugin's deactivation.
15
- *
16
- * @since 4.0.0
17
- * @package WordPressPopularPosts
18
- * @author Hector Cabrera <me@cabrerahector.com>
19
- */
20
- namespace WordPressPopularPosts\Activation;
21
-
22
- class Deactivator {
23
- /**
24
- * Fired when the plugin is deactivated.
25
- *
26
- * @since 1.0.0
27
- * @global object wpbd
28
- * @param bool network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
29
- */
30
- public static function deactivate($network_wide)
31
- {
32
- global $wpdb;
33
-
34
- if ( function_exists('is_multisite') && is_multisite() ) {
35
- // Run deactivation for each blog in the network
36
- if ( $network_wide ) {
37
- $original_blog_id = get_current_blog_id();
38
- $blogs_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
39
-
40
- foreach( $blogs_ids as $blog_id ) {
41
- switch_to_blog($blog_id);
42
- self::plugin_deactivate();
43
- }
44
-
45
- // Switch back to current blog
46
- switch_to_blog($original_blog_id);
47
-
48
- return;
49
- }
50
- }
51
-
52
- self::plugin_deactivate();
53
- }
54
-
55
- /**
56
- * On plugin deactivation, disables the shortcode and removes the scheduled task.
57
- *
58
- * @since 2.4.0
59
- */
60
- private static function plugin_deactivate()
61
- {
62
- remove_shortcode('wpp');
63
- wp_clear_scheduled_hook('wpp_cache_event');
64
- wp_clear_scheduled_hook('wpp_maybe_performance_nag');
65
- }
66
- }
1
+ <?php
2
+ /**
3
+ * Fired during plugin deactivation
4
+ *
5
+ * @link https://cabrerahector.com
6
+ * @since 4.0.0
7
+ *
8
+ * @package WordPressPopularPosts
9
+ */
10
+
11
+ /**
12
+ * Fired during plugin deactivation.
13
+ *
14
+ * This class defines all code necessary to run during the plugin's deactivation.
15
+ *
16
+ * @since 4.0.0
17
+ * @package WordPressPopularPosts
18
+ * @author Hector Cabrera <me@cabrerahector.com>
19
+ */
20
+ namespace WordPressPopularPosts\Activation;
21
+
22
+ class Deactivator {
23
+ /**
24
+ * Fired when the plugin is deactivated.
25
+ *
26
+ * @since 1.0.0
27
+ * @global object wpbd
28
+ * @param bool network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
29
+ */
30
+ public static function deactivate($network_wide)
31
+ {
32
+ global $wpdb;
33
+
34
+ if ( function_exists('is_multisite') && is_multisite() ) {
35
+ // Run deactivation for each blog in the network
36
+ if ( $network_wide ) {
37
+ $original_blog_id = get_current_blog_id();
38
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
39
+
40
+ foreach( $blogs_ids as $blog_id ) {
41
+ switch_to_blog($blog_id);
42
+ self::plugin_deactivate();
43
+ }
44
+
45
+ // Switch back to current blog
46
+ switch_to_blog($original_blog_id);
47
+
48
+ return;
49
+ }
50
+ }
51
+
52
+ self::plugin_deactivate();
53
+ }
54
+
55
+ /**
56
+ * On plugin deactivation, disables the shortcode and removes the scheduled task.
57
+ *
58
+ * @since 2.4.0
59
+ */
60
+ private static function plugin_deactivate()
61
+ {
62
+ remove_shortcode('wpp');
63
+ wp_clear_scheduled_hook('wpp_cache_event');
64
+ wp_clear_scheduled_hook('wpp_maybe_performance_nag');
65
+ }
66
+ }
src/Admin/Admin.php CHANGED
@@ -1,1379 +1,1379 @@
1
- <?php
2
- /**
3
- * The admin-facing functionality of the plugin.
4
- *
5
- * Defines hooks to enqueue the admin-specific stylesheet and JavaScript,
6
- * plugin settings and other admin stuff.
7
- *
8
- * @package WordPressPopularPosts
9
- * @subpackage WordPressPopularPosts/Admin
10
- * @author Hector Cabrera <me@cabrerahector.com>
11
- */
12
-
13
- namespace WordPressPopularPosts\Admin;
14
-
15
- use WordPressPopularPosts\Helper;
16
- use WordPressPopularPosts\Output;
17
- use WordPressPopularPosts\Query;
18
-
19
- class Admin {
20
-
21
- /**
22
- * Slug of the plugin screen.
23
- *
24
- * @since 3.0.0
25
- * @var string
26
- */
27
- protected $screen_hook_suffix = NULL;
28
-
29
- /**
30
- * Plugin options.
31
- *
32
- * @var array $config
33
- * @access private
34
- */
35
- private $config;
36
-
37
- /**
38
- * Image object
39
- *
40
- * @since 4.0.2
41
- * @var WordPressPopularPosts\Image
42
- */
43
- private $thumbnail;
44
-
45
- /**
46
- * Construct.
47
- *
48
- * @since 5.0.0
49
- * @param array $config Admin settings.
50
- * @param \WordPressPopularPosts\Image $thumbnail Image class.
51
- */
52
- public function __construct(array $config, \WordPressPopularPosts\Image $thumbnail)
53
- {
54
- $this->config = $config;
55
- $this->thumbnail = $thumbnail;
56
-
57
- // Delete old data on demand
58
- if ( 1 == $this->config['tools']['log']['limit'] ) {
59
- if ( ! wp_next_scheduled('wpp_cache_event') ) {
60
- $midnight = strtotime('midnight') - ( get_option('gmt_offset') * HOUR_IN_SECONDS ) + DAY_IN_SECONDS;
61
- wp_schedule_event($midnight, 'daily', 'wpp_cache_event');
62
- }
63
- } else {
64
- // Remove the scheduled event if exists
65
- if ( $timestamp = wp_next_scheduled('wpp_cache_event') ) {
66
- wp_unschedule_event($timestamp, 'wpp_cache_event');
67
- }
68
- }
69
-
70
- // Allow WP themers / coders to override data sampling status (active/inactive)
71
- $this->config['tools']['sampling']['active'] = apply_filters('wpp_data_sampling', $this->config['tools']['sampling']['active']);
72
-
73
- if (
74
- ! ( wp_using_ext_object_cache() && defined('WPP_CACHE_VIEWS') && WPP_CACHE_VIEWS ) // Not using a persistent object cache
75
- && ! $this->config['tools']['sampling']['active'] // Not using Data Sampling
76
- ) {
77
- // Schedule performance nag
78
- if ( ! wp_next_scheduled('wpp_maybe_performance_nag') ) {
79
- wp_schedule_event(time(), 'hourly', 'wpp_maybe_performance_nag');
80
- }
81
- } else {
82
- // Remove the scheduled performance nag if found
83
- if ( $timestamp = wp_next_scheduled('wpp_maybe_performance_nag') ) {
84
- wp_unschedule_event($timestamp, 'wpp_maybe_performance_nag');
85
- }
86
- }
87
- }
88
-
89
- /**
90
- * WordPress public-facing hooks.
91
- *
92
- * @since 5.0.0
93
- */
94
- public function hooks()
95
- {
96
- // Upgrade check
97
- add_action('init', [$this, 'upgrade_check']);
98
- // Hook fired when a new blog is activated on WP Multisite
99
- add_action('wpmu_new_blog', [$this, 'activate_new_site']);
100
- // Hook fired when a blog is deleted on WP Multisite
101
- add_filter('wpmu_drop_tables', [$this, 'delete_site_data'], 10, 2);
102
- // At-A-Glance
103
- add_filter('dashboard_glance_items', [$this, 'at_a_glance_stats']);
104
- add_action('admin_head', [$this, 'at_a_glance_stats_css']);
105
- // Dashboard Trending Now widget
106
- //if ( current_user_can('edit_published_posts') )
107
- add_action('wp_dashboard_setup', [$this, 'add_dashboard_widgets']);
108
- // Load WPP's admin styles and scripts
109
- add_action('admin_enqueue_scripts', [$this, 'enqueue_assets']);
110
- // Add admin screen
111
- add_action('admin_menu', [$this, 'add_plugin_admin_menu']);
112
- // Contextual help
113
- add_action('admin_head', [$this, 'add_contextual_help']);
114
- // Add plugin settings link
115
- add_filter('plugin_action_links', [$this, 'add_plugin_settings_link'], 10, 2);
116
- // Update chart
117
- add_action('wp_ajax_wpp_update_chart', [$this, 'update_chart']);
118
- // Get lists
119
- add_action('wp_ajax_wpp_get_most_viewed', [$this, 'get_popular_items']);
120
- add_action('wp_ajax_wpp_get_most_commented', [$this, 'get_popular_items']);
121
- add_action('wp_ajax_wpp_get_trending', [$this, 'get_popular_items']);
122
- // Delete plugin data
123
- add_action('wp_ajax_wpp_clear_data', [$this, 'clear_data']);
124
- // Empty plugin's images cache
125
- add_action('wp_ajax_wpp_clear_thumbnail', [$this, 'clear_thumbnails']);
126
- // Flush cached thumbnail on featured image change/deletion
127
- add_action('updated_post_meta', [$this, 'updated_post_meta'], 10, 4);
128
- add_action('deleted_post_meta', [$this, 'deleted_post_meta'], 10, 4);
129
- // Purge post data on post/page deletion
130
- add_action('admin_init', [$this, 'purge_post_data']);
131
- // Purge old data on demand
132
- add_action('wpp_cache_event', [$this, 'purge_data']);
133
- // Maybe performance nag
134
- add_action('wpp_maybe_performance_nag', [$this, 'performance_check']);
135
- // Show notices
136
- add_action('admin_notices', [$this, 'notices']);
137
- }
138
-
139
- /**
140
- * Checks if an upgrade procedure is required.
141
- *
142
- * @since 2.4.0
143
- */
144
- public function upgrade_check()
145
- {
146
- $this->upgrade_site();
147
- }
148
-
149
- /**
150
- * Checks whether a performance tweak may be necessary.
151
- *
152
- * @since 5.0.2
153
- */
154
- public function performance_check()
155
- {
156
- $performance_nag = get_option('wpp_performance_nag');
157
-
158
- if ( ! $performance_nag ) {
159
- $performance_nag = [
160
- 'status' => 0,
161
- 'last_checked' => null
162
- ];
163
- add_option('wpp_performance_nag', $performance_nag);
164
- }
165
-
166
- if ( 3 != $performance_nag['status'] ) { // 0 = inactive, 1 = active, 2 = remind me later, 3 = dismissed
167
- global $wpdb;
168
-
169
- $views_count = $wpdb->get_var(
170
- $wpdb->prepare(
171
- "SELECT IFNULL(SUM(pageviews), 0) AS views FROM {$wpdb->prefix}popularpostssummary WHERE view_datetime > DATE_SUB(%s, INTERVAL 1 HOUR);",
172
- Helper::now()
173
- )
174
- );
175
-
176
- // This site is probably a mid/high traffic one,
177
- // display performance nag
178
- if ( $views_count >= 420 ) {
179
- if ( 0 == $performance_nag['status'] ) {
180
- $performance_nag['status'] = 1;
181
- $performance_nag['last_checked'] = Helper::timestamp();
182
- update_option('wpp_performance_nag', $performance_nag);
183
- }
184
- }
185
- }
186
- }
187
-
188
- /**
189
- * Upgrades single site.
190
- *
191
- * @since 4.0.7
192
- */
193
- private function upgrade_site()
194
- {
195
- // Get WPP version
196
- $wpp_ver = get_option('wpp_ver');
197
-
198
- if ( ! $wpp_ver ) {
199
- add_option('wpp_ver', WPP_VERSION);
200
- } elseif ( version_compare($wpp_ver, WPP_VERSION, '<') ) {
201
- $this->upgrade();
202
- }
203
- }
204
-
205
- /**
206
- * On plugin upgrade, performs a number of actions: update WPP database tables structures (if needed),
207
- * run the setup wizard (if needed), and some other checks.
208
- *
209
- * @since 2.4.0
210
- * @access private
211
- * @global object $wpdb
212
- */
213
- private function upgrade()
214
- {
215
- $now = Helper::now();
216
-
217
- // Keep the upgrade process from running too many times
218
- if ( $wpp_update = get_option('wpp_update') ) {
219
- $from_time = strtotime($wpp_update);
220
- $to_time = strtotime($now);
221
- $difference_in_minutes = round(abs($to_time - $from_time)/60, 2);
222
-
223
- // Upgrade flag is still valid, abort
224
- if ( $difference_in_minutes <= 15 )
225
- return;
226
- // Upgrade flag expired, delete it and continue
227
- delete_option('wpp_update');
228
- }
229
-
230
- global $wpdb;
231
-
232
- // Upgrade flag
233
- add_option('wpp_update', $now);
234
-
235
- // Set table name
236
- $prefix = $wpdb->prefix . "popularposts";
237
-
238
- // Update data table structure and indexes
239
- $dataFields = $wpdb->get_results("SHOW FIELDS FROM {$prefix}data;");
240
-
241
- foreach ( $dataFields as $column ) {
242
- if ( "day" == $column->Field ) {
243
- $wpdb->query("ALTER TABLE {$prefix}data ALTER COLUMN day DROP DEFAULT;");
244
- }
245
-
246
- if ( "last_viewed" == $column->Field ) {
247
- $wpdb->query("ALTER TABLE {$prefix}data ALTER COLUMN last_viewed DROP DEFAULT;");
248
- }
249
- }
250
-
251
- // Update summary table structure and indexes
252
- $summaryFields = $wpdb->get_results("SHOW FIELDS FROM {$prefix}summary;");
253
-
254
- foreach ( $summaryFields as $column ) {
255
- if ( "last_viewed" == $column->Field ) {
256
- $wpdb->query("ALTER TABLE {$prefix}summary CHANGE last_viewed view_datetime datetime NOT NULL, ADD KEY view_datetime (view_datetime);");
257
- }
258
-
259
- if ( "view_date" == $column->Field ) {
260
- $wpdb->query("ALTER TABLE {$prefix}summary ALTER COLUMN view_date DROP DEFAULT;");
261
- }
262
-
263
- if ( "view_datetime" == $column->Field ) {
264
- $wpdb->query("ALTER TABLE {$prefix}summary ALTER COLUMN view_datetime DROP DEFAULT;");
265
- }
266
- }
267
-
268
- $summaryIndexes = $wpdb->get_results("SHOW INDEX FROM {$prefix}summary;");
269
-
270
- foreach( $summaryIndexes as $index ) {
271
- if ( 'ID_date' == $index->Key_name ) {
272
- $wpdb->query("ALTER TABLE {$prefix}summary DROP INDEX ID_date;");
273
- }
274
-
275
- if ( 'last_viewed' == $index->Key_name ) {
276
- $wpdb->query("ALTER TABLE {$prefix}summary DROP INDEX last_viewed;");
277
- }
278
- }
279
-
280
- // Validate the structure of the tables, create missing tables / fields if necessary
281
- \WordPressPopularPosts\Activation\Activator::track_new_site();
282
-
283
- // Check storage engine
284
- $storage_engine_data = $wpdb->get_var("SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}data';");
285
-
286
- if ( 'InnoDB' != $storage_engine_data ) {
287
- $wpdb->query("ALTER TABLE {$prefix}data ENGINE=InnoDB;");
288
- }
289
-
290
- $storage_engine_summary = $wpdb->get_var("SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}summary';");
291
-
292
- if ( 'InnoDB' != $storage_engine_summary ) {
293
- $wpdb->query("ALTER TABLE {$prefix}summary ENGINE=InnoDB;");
294
- }
295
-
296
- // Update WPP version
297
- update_option('wpp_ver', WPP_VERSION);
298
- // Remove upgrade flag
299
- delete_option('wpp_update');
300
- }
301
-
302
- /**
303
- * Fired when a new blog is activated on WP Multisite.
304
- *
305
- * @since 3.0.0
306
- * @param int $blog_id New blog ID
307
- */
308
- public function activate_new_site($blog_id)
309
- {
310
- if ( 1 !== did_action('wpmu_new_blog') )
311
- return;
312
-
313
- // run activation for the new blog
314
- switch_to_blog($blog_id);
315
- \WordPressPopularPosts\Activation\Activator::track_new_site();
316
- // switch back to current blog
317
- restore_current_blog();
318
- }
319
-
320
- /**
321
- * Fired when a blog is deleted on WP Multisite.
322
- *
323
- * @since 4.0.0
324
- * @param array $tables
325
- * @param int $blog_id
326
- * @return array
327
- */
328
- public function delete_site_data($tables, $blog_id)
329
- {
330
- global $wpdb;
331
-
332
- $tables[] = $wpdb->prefix . 'popularpostsdata';
333
- $tables[] = $wpdb->prefix . 'popularpostssummary';
334
-
335
- return $tables;
336
- }
337
-
338
- /**
339
- * Display some statistics at the "At a Glance" box from the Dashboard.
340
- *
341
- * @since 4.1.0
342
- */
343
- public function at_a_glance_stats()
344
- {
345
- global $wpdb;
346
-
347
- $glances = [];
348
- $args = ['post', 'page'];
349
- $post_type_placeholders = '%s, %s';
350
-
351
- if (
352
- isset($this->config['stats']['post_type'])
353
- && ! empty($this->config['stats']['post_type'])
354
- ) {
355
- $args = array_map('trim', explode(',', $this->config['stats']['post_type']));
356
- $post_type_placeholders = implode(', ', array_fill(0, count($args), '%s'));
357
- }
358
-
359
- $args[] = Helper::now();
360
-
361
- $query = $wpdb->prepare(
362
- "SELECT SUM(pageviews) AS total
363
- FROM `{$wpdb->prefix}popularpostssummary` v LEFT JOIN `{$wpdb->prefix}posts` p ON v.postid = p.ID
364
- WHERE p.post_type IN({$post_type_placeholders}) AND p.post_status = 'publish' AND p.post_password = '' AND v.view_datetime > DATE_SUB(%s, INTERVAL 1 HOUR);"
365
- , $args
366
- );
367
-
368
- $total_views = $wpdb->get_var($query);
369
-
370
- $pageviews = sprintf(
371
- _n('%s view in the last hour', '%s views in the last hour', $total_views, 'wordpress-popular-posts'),
372
- number_format_i18n($total_views)
373
- );
374
-
375
- if ( current_user_can('edit_published_posts') ) {
376
- $glances[] = '<a class="wpp-views-count" href="' . admin_url('options-general.php?page=wordpress-popular-posts') . '">' . $pageviews . '</a>';
377
- }
378
- else {
379
- $glances[] = '<span class="wpp-views-count">' . $pageviews . '</a>';
380
- }
381
-
382
- return $glances;
383
- }
384
-
385
- /**
386
- * Add custom inline CSS styles for At a Glance stats.
387
- *
388
- * @since 4.1.0
389
- */
390
- public function at_a_glance_stats_css()
391
- {
392
- echo '<style>#dashboard_right_now a.wpp-views-count:before, #dashboard_right_now span.wpp-views-count:before {content: "\f177";}</style>';
393
- }
394
-
395
- /**
396
- * Adds a widget to the dashboard.
397
- *
398
- * @since 5.0.0
399
- */
400
- public function add_dashboard_widgets()
401
- {
402
- if ( current_user_can('edit_published_posts') ) {
403
- wp_add_dashboard_widget(
404
- 'wpp_trending_dashboard_widget',
405
- __('Trending now', 'wordpress-popular-posts'),
406
- [$this, 'trending_dashboard_widget']
407
- );
408
- }
409
- }
410
-
411
- /**
412
- * Outputs the contents of our Trending Dashboard Widget.
413
- *
414
- * @since 5.0.0
415
- */
416
- function trending_dashboard_widget()
417
- {
418
- ?>
419
- <style>
420
- #wpp_trending_dashboard_widget .inside {
421
- overflow: hidden;
422
- position: relative;
423
- min-height: 150px;
424
- padding-bottom: 22px;
425
- }
426
-
427
- #wpp_trending_dashboard_widget .inside::after {
428
- position: absolute;
429
- top: 0;
430
- left: 0;
431
- opacity: 0.2;
432
- display: block;
433
- content: '';
434
- width: 100%;
435
- height: 100%;
436
- z-index: 1;
437
- background-image: url('<?php echo plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/images/flame.png'; ?>');
438
- background-position: right bottom;
439
- background-repeat: no-repeat;
440
- background-size: 34% auto;
441
- }
442
-
443
- #wpp_trending_dashboard_widget .inside .no-data {
444
- position: absolute;
445
- top: calc(50% - 11px);
446
- left: 50%;
447
- z-index: 2;
448
- margin: 0;
449
- padding: 0;
450
- width: 96%;
451
- transform: translate(-50.0001%, -50.0001%);
452
- }
453
-
454
- #wpp_trending_dashboard_widget .inside .popular-posts-list,
455
- #wpp_trending_dashboard_widget .inside p#wpp_read_more {
456
- position: relative;
457
- z-index: 2;
458
- }
459
-
460
- #wpp_trending_dashboard_widget .inside .popular-posts-list {
461
- margin: 1em 0;
462
- }
463
-
464
- #wpp_trending_dashboard_widget .inside p#wpp_read_more {
465
- position: absolute;
466
- left: 0;
467
- bottom: 0;
468
- width: 100%;
469
- text-align: center;
470
- }
471
- </style>
472
- <?php
473
- $args = [
474
- 'range' => 'custom',
475
- 'time_quantity' => 1,
476
- 'time_unit' => 'HOUR',
477
- 'post_type' => $this->config['stats']['post_type'],
478
- 'limit' => 5,
479
- 'stats_tag' => [
480
- 'views' => 1,
481
- 'comment_count' => 1
482
- ]
483
- ];
484
- $options = apply_filters('wpp_trending_dashboard_widget_args', []);
485
-
486
- if ( is_array($options) && ! empty($options) )
487
- $args = Helper::merge_array_r($args, $options);
488
-
489
- $trending = new Query($args);
490
- $posts = $trending->get_posts();
491
-
492
- $this->render_list($posts, 'trending');
493
- echo '<p id="wpp_read_more"><a href="' . admin_url('options-general.php?page=wordpress-popular-posts') . '">' . __('View more', 'wordpress-popular-posts') . '</a><p>';
494
-
495
- }
496
-
497
- /**
498
- * Enqueues admin facing assets.
499
- *
500
- * @since 5.0.0
501
- */
502
- public function enqueue_assets()
503
- {
504
- $screen = get_current_screen();
505
-
506
- if ( isset($screen->id) ) {
507
- if ( $screen->id == $this->screen_hook_suffix ) {
508
- wp_enqueue_style('wpp-datepicker-theme', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/datepicker.css', [], WPP_VERSION, 'all');
509
-
510
- wp_enqueue_media();
511
- wp_enqueue_script('jquery-ui-datepicker');
512
- wp_enqueue_script('chartjs', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/vendor/Chart.min.js', [], WPP_VERSION);
513
-
514
- wp_register_script('wpp-chart', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/chart.js', ['chartjs'], WPP_VERSION);
515
- wp_localize_script('wpp-chart', 'wpp_chart_params', [
516
- 'colors' => $this->get_admin_color_scheme()
517
- ]);
518
- wp_enqueue_script('wpp-chart');
519
-
520
- wp_register_script('wordpress-popular-posts-admin-script', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/admin.js', ['jquery'], WPP_VERSION, true);
521
- wp_localize_script('wordpress-popular-posts-admin-script', 'wpp_admin_params', [
522
- 'label_media_upload_button' => __("Use this image", "wordpress-popular-posts"),
523
- 'nonce' => wp_create_nonce("wpp_admin_nonce")
524
- ]);
525
- wp_enqueue_script('wordpress-popular-posts-admin-script');
526
- }
527
-
528
- if ( $screen->id == $this->screen_hook_suffix || 'dashboard' == $screen->id ) {
529
- // Fontello icons
530
- wp_enqueue_style('wpp-fontello', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/fontello.css', [], WPP_VERSION, 'all');
531
- wp_enqueue_style('wordpress-popular-posts-admin-styles', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/admin.css', [], WPP_VERSION, 'all');
532
- }
533
- }
534
- }
535
-
536
- /**
537
- * Register the administration menu for this plugin into the WordPress Dashboard menu.
538
- *
539
- * @since 1.0.0
540
- */
541
- public function add_plugin_admin_menu()
542
- {
543
- $this->screen_hook_suffix = add_options_page(
544
- 'WordPress Popular Posts',
545
- 'WordPress Popular Posts',
546
- 'edit_published_posts',
547
- 'wordpress-popular-posts',
548
- [$this, 'display_plugin_admin_page']
549
- );
550
- }
551
-
552
- /**
553
- * Render the settings page for this plugin.
554
- *
555
- * @since 1.0.0
556
- */
557
- public function display_plugin_admin_page()
558
- {
559
- include_once plugin_dir_path(__FILE__) . 'admin-page.php';
560
- }
561
-
562
- /**
563
- * Adds contextual help menu.
564
- *
565
- * @since 4.0.0
566
- */
567
- public function add_contextual_help()
568
- {
569
- $screen = get_current_screen();
570
-
571
- if ( isset($screen->id) && $screen->id == $this->screen_hook_suffix ){
572
- $screen->add_help_tab(
573
- [
574
- 'id' => 'wpp_help_overview',
575
- 'title' => __('Overview', 'wordpress-popular-posts'),
576
- 'content' => "<p>" . __("Welcome to WordPress Popular Posts' Dashboard! In this screen you will find statistics on what's popular on your site, tools to further tweak WPP to your needs, and more!", "wordpress-popular-posts") . "</p>"
577
- ]
578
- );
579
- $screen->add_help_tab(
580
- [
581
- 'id' => 'wpp_help_donate',
582
- 'title' => __('Like this plugin?', 'wordpress-popular-posts'),
583
- 'content' => '
584
- <p style="text-align: center;">' . __('Each donation motivates me to keep releasing free stuff for the WordPress community!', 'wordpress-popular-posts') . '</p>
585
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="margin: 0; padding: 0; text-align: center;">
586
- <input type="hidden" name="cmd" value="_s-xclick">
587
- <input type="hidden" name="hosted_button_id" value="RP9SK8KVQHRKS">
588
- <input type="image" src="//www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" style="display: inline; margin: 0;">
589
- <img alt="" border="0" src="//www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
590
- </form>
591
- <p style="text-align: center;">' . sprintf(__('You can <a href="%s" target="_blank">leave a review</a>, too!', 'wordpress-popular-posts'), 'https://wordpress.org/support/view/plugin-reviews/wordpress-popular-posts?rate=5#postform') . '</p>'
592
- ]
593
- );
594
-
595
- // Help sidebar
596
- $screen->set_help_sidebar(
597
- sprintf(
598
- __('<p><strong>For more information:</strong></p><ul><li><a href="%1$s">Documentation</a></li><li><a href="%2$s">Support</a></li></ul>', 'wordpress-popular-posts'),
599
- "https://github.com/cabrerahector/wordpress-popular-posts/",
600
- "https://wordpress.org/support/plugin/wordpress-popular-posts/"
601
- )
602
- );
603
- }
604
- }
605
-
606
- /**
607
- * Registers Settings link on plugin description.
608
- *
609
- * @since 2.3.3
610
- * @param array $links
611
- * @param string $file
612
- * @return array
613
- */
614
- public function add_plugin_settings_link($links, $file)
615
- {
616
- $plugin_file = 'wordpress-popular-posts/wordpress-popular-posts.php';
617
-
618
- if (
619
- is_plugin_active($plugin_file)
620
- && $plugin_file == $file
621
- ) {
622
- $links[] = '<a href="' . admin_url('options-general.php?page=wordpress-popular-posts') . '">' . __('Settings') . '</a>';
623
- }
624
-
625
- return $links;
626
- }
627
-
628
- /**
629
- * Gets current admin color scheme.
630
- *
631
- * @since 4.0.0
632
- * @return array
633
- */
634
- private function get_admin_color_scheme()
635
- {
636
- global $_wp_admin_css_colors;
637
-
638
- if (
639
- is_array($_wp_admin_css_colors)
640
- && count($_wp_admin_css_colors)
641
- ) {
642
- $current_user = wp_get_current_user();
643
- $color_scheme = get_user_option('admin_color', $current_user->ID);
644
-
645
- if (
646
- empty($color_scheme)
647
- || ! isset($_wp_admin_css_colors[ $color_scheme])
648
- ) {
649
- $color_scheme = 'fresh';
650
- }
651
-
652
- if ( isset($_wp_admin_css_colors[$color_scheme]) && isset($_wp_admin_css_colors[$color_scheme]->colors) ) {
653
- return $_wp_admin_css_colors[$color_scheme]->colors;
654
- }
655
-
656
- }
657
-
658
- // Fallback, just in case
659
- return ['#333', '#999', '#881111', '#a80000'];
660
- }
661
-
662
- /**
663
- * Fetches chart data.
664
- *
665
- * @since 4.0.0
666
- * @return string
667
- */
668
- public function get_chart_data($range = 'last7days', $time_unit = 'HOUR', $time_quantity = 24)
669
- {
670
- $dates = $this->get_dates($range, $time_unit, $time_quantity);
671
- $start_date = $dates[0];
672
- $end_date = $dates[count($dates) - 1];
673
- $date_range = Helper::get_date_range($start_date, $end_date, 'Y-m-d H:i:s');
674
- $views_data = $this->get_range_item_count($start_date, $end_date, 'views');
675
- $views = [];
676
- $comments_data = $this->get_range_item_count($start_date, $end_date, 'comments');
677
- $comments = [];
678
-
679
- if ( 'today' != $range ) {
680
- foreach($date_range as $date) {
681
- $key = date('Y-m-d', strtotime($date));
682
- $views[] = ( ! isset($views_data[$key]) ) ? 0 : $views_data[$key]->pageviews;
683
- $comments[] = ( ! isset($comments_data[$key]) ) ? 0 : $comments_data[$key]->comments;
684
- }
685
- } else {
686
- $key = date('Y-m-d', strtotime($dates[0]));
687
- $views[] = ( ! isset($views_data[$key]) ) ? 0 : $views_data[$key]->pageviews;
688
- $comments[] = ( ! isset($comments_data[$key]) ) ? 0 : $comments_data[$key]->comments;
689
- }
690
-
691
- if ( $start_date != $end_date )
692
- $label_date_range = date_i18n('M, D d', strtotime($start_date)) . ' &mdash; ' . date_i18n('M, D d', strtotime($end_date));
693
- else
694
- $label_date_range = date_i18n('M, D d', strtotime($start_date));
695
-
696
- $total_views = array_sum($views);
697
- $total_comments = array_sum($comments);
698
-
699
- $label_summary = sprintf(_n('%s view', '%s views', $total_views, 'wordpress-popular-posts'), '<strong>' . number_format_i18n($total_views) . '</strong>') . '<br style="display: none;" /> / ' . sprintf(_n('%s comment', '%s comments', $total_comments, 'wordpress-popular-posts'), '<strong>' . number_format_i18n($total_comments) . '</strong>');
700
-
701
- // Format labels
702
- if ( 'today' != $range ) {
703
- $date_range = array_map(function($d){
704
- return date_i18n('D d', strtotime($d));
705
- }, $date_range);
706
- } else {
707
- $date_range = [date_i18n('D d', strtotime($date_range[0]))];
708
- $comments = [array_sum($comments)];
709
- $views = [array_sum($views)];
710
- }
711
-
712
- $response = [
713
- 'totals' => [
714
- 'label_summary' => $label_summary,
715
- 'label_date_range' => $label_date_range,
716
- ],
717
- 'labels' => $date_range,
718
- 'datasets' => [
719
- [
720
- 'label' => __("Comments", "wordpress-popular-posts"),
721
- 'data' => $comments
722
- ],
723
- [
724
- 'label' => __("Views", "wordpress-popular-posts"),
725
- 'data' => $views
726
- ]
727
- ]
728
- ];
729
-
730
- return json_encode($response);
731
- }
732
-
733
- /**
734
- * Returns an array of dates.
735
- *
736
- * @since 5.0.0
737
- * @return array|bool
738
- */
739
- private function get_dates($range = 'last7days', $time_unit = 'HOUR', $time_quantity = 24)
740
- {
741
- $valid_ranges = ['today', 'daily', 'last24hours', 'weekly', 'last7days', 'monthly', 'last30days', 'all', 'custom'];
742
- $range = in_array($range, $valid_ranges) ? $range : 'last7days';
743
- $now = new \DateTime(Helper::now(), new \DateTimeZone(Helper::get_timezone()));
744
-
745
- // Determine time range
746
- switch( $range ){
747
- case "last24hours":
748
- case "daily":
749
- $end_date = $now->format('Y-m-d H:i:s');
750
- $start_date = $now->modify('-1 day')->format('Y-m-d H:i:s');
751
- break;
752
-
753
- case "today":
754
- $start_date = $now->format('Y-m-d') . ' 00:00:00';
755
- $end_date = $now->format('Y-m-d') . ' 23:59:59';
756
- break;
757
-
758
- case "last7days":
759
- case "weekly":
760
- $end_date = $now->format('Y-m-d') . ' 23:59:59';
761
- $start_date = $now->modify('-6 day')->format('Y-m-d') . ' 00:00:00';
762
- break;
763
-
764
- case "last30days":
765
- case "monthly":
766
- $end_date = $now->format('Y-m-d') . ' 23:59:59';
767
- $start_date = $now->modify('-29 day')->format('Y-m-d') . ' 00:00:00';
768
- break;
769
-
770
- case "custom":
771
- $end_date = $now->format('Y-m-d H:i:s');
772
-
773
- if (
774
- Helper::is_number($time_quantity)
775
- && $time_quantity >= 1
776
- ) {
777
- $end_date = $now->format('Y-m-d H:i:s');
778
- $time_unit = strtoupper($time_unit);
779
-
780
- if ( 'MINUTE' == $time_unit ) {
781
- $start_date = $now->sub(new \DateInterval('PT' . (60 * $time_quantity) . 'S'))->format('Y-m-d H:i:s');
782
- } elseif ( 'HOUR' == $time_unit ) {
783
- $start_date = $now->sub(new \DateInterval('PT' . ((60 * $time_quantity) - 1) . 'M59S'))->format('Y-m-d H:i:s');
784
- } else {
785
- $end_date = $now->format('Y-m-d') . ' 23:59:59';
786
- $start_date = $now->sub(new \DateInterval('P' . ($time_quantity - 1) . 'D'))->format('Y-m-d') . ' 00:00:00';
787
- }
788
- } // fallback to last 24 hours
789
- else {
790
- $start_date = $now->modify('-1 day')->format('Y-m-d H:i:s');
791
- }
792
-
793
- // Check if custom date range has been requested
794
- $dates = null;
795
-
796
- if ( isset($_GET['dates']) ) {
797
- $dates = explode(" ~ ", $_GET['dates']);
798
-
799
- if (
800
- ! is_array($dates)
801
- || empty($dates)
802
- || ! Helper::is_valid_date($dates[0])
803
- ) {
804
- $dates = null;
805
- } else {
806
- if (
807
- ! isset($dates[1])
808
- || ! Helper::is_valid_date($dates[1])
809
- ) {
810
- $dates[1] = $dates[0];
811
- }
812
-
813
- $start_date = $dates[0] . ' 00:00:00';
814
- $end_date = $dates[1] . ' 23:59:59';
815
- }
816
- }
817
-
818
- break;
819
-
820
- default:
821
- $end_date = $now->format('Y-m-d') . ' 23:59:59';
822
- $start_date = $now->modify('-6 day')->format('Y-m-d') . ' 00:00:00';
823
- break;
824
- }
825
-
826
- return [$start_date, $end_date];
827
- }
828
-
829
- /**
830
- * Returns an array of dates with views/comments count.
831
- *
832
- * @since 5.0.0
833
- * @param string $start_date
834
- * @param string $end_date
835
- * @param string $item
836
- * @return array
837
- */
838
- public function get_range_item_count($start_date, $end_date, $item = 'views')
839
- {
840
- global $wpdb;
841
-
842
- $args = array_map('trim', explode(',', $this->config['stats']['post_type']));
843
-
844
- if ( empty($args) ) {
845
- $args = ['post', 'page'];
846
- }
847
-
848
- $post_type_placeholders = array_fill(0, count($args), '%s');
849
-
850
- if ( $this->config['stats']['freshness'] ) {
851
- $args[] = $start_date;
852
- }
853
-
854
- // Append dates to arguments list
855
- array_unshift($args, $start_date, $end_date);
856
-
857
- if ( $item == 'comments' ) {
858
- $query = $wpdb->prepare(
859
- "SELECT DATE(`c`.`comment_date_gmt`) AS `c_date`, COUNT(*) AS `comments`
860
- FROM `{$wpdb->comments}` c INNER JOIN `{$wpdb->posts}` p ON `c`.`comment_post_ID` = `p`.`ID`
861
- WHERE (`c`.`comment_date_gmt` BETWEEN %s AND %s) AND `c`.`comment_approved` = '1' AND `p`.`post_type` IN (". implode(", ", $post_type_placeholders) . ") AND `p`.`post_status` = 'publish' AND `p`.`post_password` = ''
862
- " . ( $this->config['stats']['freshness'] ? " AND `p`.`post_date` >= %s" : "" ) . "
863
- GROUP BY `c_date` ORDER BY `c_date` DESC;",
864
- $args
865
- );
866
- } else {
867
- $query = $wpdb->prepare(
868
- "SELECT `v`.`view_date`, SUM(`v`.`pageviews`) AS `pageviews`
869
- FROM `{$wpdb->prefix}popularpostssummary` v INNER JOIN `{$wpdb->posts}` p ON `v`.`postid` = `p`.`ID`
870
- WHERE (`v`.`view_datetime` BETWEEN %s AND %s) AND `p`.`post_type` IN (". implode(", ", $post_type_placeholders) . ") AND `p`.`post_status` = 'publish' AND `p`.`post_password` = ''
871
- " . ( $this->config['stats']['freshness'] ? " AND `p`.`post_date` >= %s" : "" ) . "
872
- GROUP BY `v`.`view_date` ORDER BY `v`.`view_date` DESC;",
873
- $args
874
- );
875
-
876
- //error_log($query);
877
- }
878
-
879
- return $wpdb->get_results($query, OBJECT_K);
880
- }
881
-
882
- /**
883
- * Updates chart via AJAX.
884
- *
885
- * @since 4.0.0
886
- */
887
- public function update_chart()
888
- {
889
- $response = [
890
- 'status' => 'error'
891
- ];
892
- $nonce = isset($_GET['nonce']) ? $_GET['nonce'] : null;
893
-
894
- if ( wp_verify_nonce($nonce, 'wpp_admin_nonce') ) {
895
-
896
- $valid_ranges = ['today', 'daily', 'last24hours', 'weekly', 'last7days', 'monthly', 'last30days', 'all', 'custom'];
897
- $time_units = ["MINUTE", "HOUR", "DAY"];
898
-
899
- $range = ( isset($_GET['range']) && in_array($_GET['range'], $valid_ranges) ) ? $_GET['range'] : 'last7days';
900
- $time_quantity = ( isset($_GET['time_quantity']) && filter_var($_GET['time_quantity'], FILTER_VALIDATE_INT) ) ? $_GET['time_quantity'] : 24;
901
- $time_unit = ( isset($_GET['time_unit']) && in_array(strtoupper($_GET['time_unit']), $time_units) ) ? $_GET['time_unit'] : 'hour';
902
-
903
- $this->config['stats']['range'] = $range;
904
- $this->config['stats']['time_quantity'] = $time_quantity;
905
- $this->config['stats']['time_unit'] = $time_unit;
906
-
907
- update_option('wpp_settings_config', $this->config);
908
-
909
- $response = [
910
- 'status' => 'ok',
911
- 'data' => json_decode(
912
- $this->get_chart_data($this->config['stats']['range'], $this->config['stats']['time_unit'], $this->config['stats']['time_quantity']),
913
- true
914
- )
915
- ];
916
- }
917
-
918
- wp_send_json($response);
919
- }
920
-
921
- /**
922
- * Fetches most viewed/commented/trending posts via AJAX.
923
- *
924
- * @since 5.0.0
925
- */
926
- public function get_popular_items()
927
- {
928
- $items = isset($_GET['items']) ? $_GET['items'] : null;
929
- $nonce = isset($_GET['nonce']) ? $_GET['nonce'] : null;
930
-
931
- if ( wp_verify_nonce($nonce, 'wpp_admin_nonce') ) {
932
- $args = [
933
- 'range' => $this->config['stats']['range'],
934
- 'time_quantity' => $this->config['stats']['time_quantity'],
935
- 'time_unit' => $this->config['stats']['time_unit'],
936
- 'post_type' => $this->config['stats']['post_type'],
937
- 'freshness' => $this->config['stats']['freshness'],
938
- 'limit' => $this->config['stats']['limit'],
939
- 'stats_tag' => [
940
- 'date' => [
941
- 'active' => 1
942
- ]
943
- ]
944
- ];
945
-
946
- if ( 'most-commented' == $items ) {
947
- $args['order_by'] = 'comments';
948
- $args['stats_tag']['comment_count'] = 1;
949
- $args['stats_tag']['views'] = 0;
950
- } elseif ( 'trending' == $items ) {
951
- $args['range'] = 'custom';
952
- $args['time_quantity'] = 1;
953
- $args['time_unit'] = 'HOUR';
954
- $args['stats_tag']['comment_count'] = 1;
955
- $args['stats_tag']['views'] = 1;
956
- } else {
957
- $args['stats_tag']['comment_count'] = 0;
958
- $args['stats_tag']['views'] = 1;
959
- }
960
-
961
- if ( 'trending' != $items ) {
962
-
963
- add_filter('wpp_query_join', function($join, $options) use ($items)
964
- {
965
- global $wpdb;
966
- $dates = null;
967
-
968
- if ( isset($_GET['dates']) ) {
969
- $dates = explode(" ~ ", $_GET['dates']);
970
-
971
- if (
972
- ! is_array($dates)
973
- || empty($dates)
974
- || ! Helper::is_valid_date($dates[0])
975
- ) {
976
- $dates = null;
977
- } else {
978
- if (
979
- ! isset($dates[1])
980
- || ! Helper::is_valid_date($dates[1])
981
- ) {
982
- $dates[1] = $dates[0];
983
- }
984
-
985
- $start_date = $dates[0];
986
- $end_date = $dates[1];
987
- }
988
-
989
- }
990
-
991
- if ( $dates ) {
992
- if ( 'most-commented' == $items ) {
993
- return "INNER JOIN (SELECT comment_post_ID, COUNT(comment_post_ID) AS comment_count, comment_date_gmt FROM `{$wpdb->comments}` WHERE comment_date_gmt BETWEEN '{$dates[0]} 00:00:00' AND '{$dates[1]} 23:59:59' AND comment_approved = '1' GROUP BY comment_post_ID) c ON p.ID = c.comment_post_ID";
994
- }
995
-
996
- return "INNER JOIN (SELECT SUM(pageviews) AS pageviews, view_date, postid FROM `{$wpdb->prefix}popularpostssummary` WHERE view_datetime BETWEEN '{$dates[0]} 00:00:00' AND '{$dates[1]} 23:59:59' GROUP BY postid) v ON p.ID = v.postid";
997
- }
998
-
999
- $now = Helper::now();
1000
-
1001
- // Determine time range
1002
- switch( $options['range'] ){
1003
- case "last24hours":
1004
- case "daily":
1005
- $interval = "24 HOUR";
1006
- break;
1007
-
1008
- case "today":
1009
- $hours = date('H', strtotime($now));
1010
- $minutes = $hours * 60 + (int) date( 'i', strtotime($now) );
1011
- $interval = "{$minutes} MINUTE";
1012
- break;
1013
-
1014
- case "last7days":
1015
- case "weekly":
1016
- $interval = "6 DAY";
1017
- break;
1018
-
1019
- case "last30days":
1020
- case "monthly":
1021
- $interval = "29 DAY";
1022
- break;
1023
-
1024
- case "custom":
1025
- $time_units = ["MINUTE", "HOUR", "DAY"];
1026
- $interval = "24 HOUR";
1027
-
1028
- // Valid time unit
1029
- if (
1030
- isset($options['time_unit'])
1031
- && in_array(strtoupper($options['time_unit']), $time_units)
1032
- && isset($options['time_quantity'])
1033
- && filter_var($options['time_quantity'], FILTER_VALIDATE_INT)
1034
- && $options['time_quantity'] > 0
1035
- ) {
1036
- $interval = "{$options['time_quantity']} " . strtoupper($options['time_unit']);
1037
- }
1038
-
1039
- break;
1040
-
1041
- default:
1042
- $interval = "1 DAY";
1043
- break;
1044
- }
1045
-
1046
- if ( 'most-commented' == $items ) {
1047
- return "INNER JOIN (SELECT comment_post_ID, COUNT(comment_post_ID) AS comment_count, comment_date_gmt FROM `{$wpdb->comments}` WHERE comment_date_gmt > DATE_SUB('{$now}', INTERVAL {$interval}) AND comment_approved = '1' GROUP BY comment_post_ID) c ON p.ID = c.comment_post_ID";
1048
- }
1049
-
1050
- return "INNER JOIN (SELECT SUM(pageviews) AS pageviews, view_date, postid FROM `{$wpdb->prefix}popularpostssummary` WHERE view_datetime > DATE_SUB('{$now}', INTERVAL {$interval}) GROUP BY postid) v ON p.ID = v.postid";
1051
- }, 1, 2);
1052
-
1053
- }
1054
-
1055
- $popular_items = new \WordPressPopularPosts\Query($args);
1056
- $posts = $popular_items->get_posts();
1057
-
1058
- if ( 'trending' != $items ) {
1059
- remove_all_filters('wpp_query_join', 1);
1060
- }
1061
-
1062
- $this->render_list($posts, $items);
1063
- }
1064
-
1065
- wp_die();
1066
- }
1067
-
1068
- /**
1069
- * Renders popular posts lists.
1070
- *
1071
- * @since 5.0.0
1072
- * @param array
1073
- */
1074
- public function render_list($posts, $list = 'most-viewed')
1075
- {
1076
- if (
1077
- is_array($posts)
1078
- && ! empty($posts)
1079
- ) {
1080
- ?>
1081
- <ol class="popular-posts-list">
1082
- <?php
1083
- foreach( $posts as $post ) { ?>
1084
- <li>
1085
- <a href="<?php echo get_permalink($post->id); ?>" class="wpp-title"><?php echo sanitize_text_field(apply_filters('the_title', $post->title, $post->id)); ?></a>
1086
- <div>
1087
- <?php if ( 'most-viewed' == $list ) : ?>
1088
- <span><?php printf(_n('%s view', '%s views', $post->pageviews, 'wordpress-popular-posts' ), number_format_i18n($post->pageviews)); ?></span>
1089
- <?php elseif ( 'most-commented' == $list ) : ?>
1090
- <span><?php printf(_n('%s comment', '%s comments', $post->comment_count, 'wordpress-popular-posts'), number_format_i18n($post->comment_count)); ?></span>
1091
- <?php else : ?>
1092
- <span><?php printf(_n('%s view', '%s views', $post->pageviews, 'wordpress-popular-posts' ), number_format_i18n($post->pageviews)); ?></span>, <span><?php printf(_n('%s comment', '%s comments', $post->comment_count, 'wordpress-popular-posts'), number_format_i18n($post->comment_count)); ?></span>
1093
- <?php endif; ?>
1094
- <small> &mdash; <a href="<?php echo get_permalink($post->id); ?>"><?php _e("View"); ?></a><?php if ( current_user_can('edit_others_posts') ): ?> | <a href="<?php echo get_edit_post_link($post->id); ?>"><?php _e("Edit"); ?></a><?php endif; ?></small>
1095
- </div>
1096
- </li>
1097
- <?php
1098
- }
1099
- ?>
1100
- </ol>
1101
- <?php
1102
- }
1103
- else {
1104
- ?>
1105
- <p class="no-data" style="text-align: center;"><?php _e("Looks like your site's activity is a little low right now. <br />Spread the word and come back later!", "wordpress-popular-posts"); ?></p>
1106
- <?php
1107
- }
1108
- }
1109
-
1110
- /**
1111
- * Truncates data and cache on demand.
1112
- *
1113
- * @since 2.0.0
1114
- * @global object $wpdb
1115
- */
1116
- public function clear_data()
1117
- {
1118
- $token = $_POST['token'];
1119
- $clear = isset($_POST['clear']) ? $_POST['clear'] : null;
1120
- $key = get_option("wpp_rand");
1121
-
1122
- if (
1123
- current_user_can('manage_options')
1124
- && ( $token === $key )
1125
- && $clear
1126
- ) {
1127
- global $wpdb;
1128
-
1129
- // set table name
1130
- $prefix = $wpdb->prefix . "popularposts";
1131
-
1132
- if ( $clear == 'cache' ) {
1133
- if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
1134
- $wpdb->query("TRUNCATE TABLE {$prefix}summary;");
1135
- $this->flush_transients();
1136
-
1137
- echo 1;
1138
- } else {
1139
- echo 2;
1140
- }
1141
- } elseif ( $clear == 'all' ) {
1142
- if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}data'") && $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
1143
- $wpdb->query("TRUNCATE TABLE {$prefix}data;");
1144
- $wpdb->query("TRUNCATE TABLE {$prefix}summary;");
1145
- $this->flush_transients();
1146
-
1147
- echo 1;
1148
- } else {
1149
- echo 2;
1150
- }
1151
- } else {
1152
- echo 3;
1153
- }
1154
- } else {
1155
- echo 4;
1156
- }
1157
-
1158
- wp_die();
1159
- }
1160
-
1161
- /**
1162
- * Deletes cached (transient) data.
1163
- *
1164
- * @since 3.0.0
1165
- * @access private
1166
- */
1167
- private function flush_transients()
1168
- {
1169
- $wpp_transients = get_option('wpp_transients');
1170
-
1171
- if ( $wpp_transients && is_array($wpp_transients) && ! empty($wpp_transients) ) {
1172
- for ( $t=0; $t < count($wpp_transients); $t++ )
1173
- delete_transient($wpp_transients[$t]);
1174
-
1175
- update_option('wpp_transients', []);
1176
- }
1177
- }
1178
-
1179
- /**
1180
- * Truncates thumbnails cache on demand.
1181
- *
1182
- * @since 2.0.0
1183
- * @global object wpdb
1184
- */
1185
- public function clear_thumbnails()
1186
- {
1187
- $wpp_uploads_dir = $this->thumbnail->get_plugin_uploads_dir();
1188
-
1189
- if ( is_array($wpp_uploads_dir) && ! empty($wpp_uploads_dir) ) {
1190
- $token = isset($_POST['token']) ? $_POST['token'] : null;
1191
- $key = get_option("wpp_rand");
1192
-
1193
- if (
1194
- current_user_can('edit_published_posts')
1195
- && ( $token === $key )
1196
- ) {
1197
- if ( is_dir($wpp_uploads_dir['basedir']) ) {
1198
- $files = glob("{$wpp_uploads_dir['basedir']}/*"); // get all related images
1199
-
1200
- if ( is_array($files) && ! empty($files) ) {
1201
- foreach( $files as $file ){ // iterate files
1202
- if ( is_file($file) ) {
1203
- @unlink($file); // delete file
1204
- }
1205
- }
1206
- echo 1;
1207
- } else {
1208
- echo 2;
1209
- }
1210
- } else {
1211
- echo 3;
1212
- }
1213
- } else {
1214
- echo 4;
1215
- }
1216
- }
1217
-
1218
- wp_die();
1219
- }
1220
-
1221
- /**
1222
- * Fires immediately after deleting metadata of a post.
1223
- *
1224
- * @since 5.0.0
1225
- *
1226
- * @param int $meta_id Metadata ID.
1227
- * @param int $post_id Post ID.
1228
- * @param string $meta_key Meta key.
1229
- * @param mixed $meta_value Meta value.
1230
- */
1231
- public function updated_post_meta($meta_id, $post_id, $meta_key, $meta_value)
1232
- {
1233
- if ( '_thumbnail_id' == $meta_key ) {
1234
- $this->flush_post_thumbnail($post_id);
1235
- }
1236
- }
1237
-
1238
- /**
1239
- * Fires immediately after deleting metadata of a post.
1240
- *
1241
- * @since 5.0.0
1242
- *
1243
- * @param array $meta_ids An array of deleted metadata entry IDs.
1244
- * @param int $post_id Post ID.
1245
- * @param string $meta_key Meta key.
1246
- * @param mixed $meta_value Meta value.
1247
- */
1248
- public function deleted_post_meta($meta_ids, $post_id, $meta_key, $meta_value)
1249
- {
1250
- if ( '_thumbnail_id' == $meta_key ) {
1251
- $this->flush_post_thumbnail($post_id);
1252
- }
1253
- }
1254
-
1255
- /**
1256
- * Flushes post's cached thumbnail(s).
1257
- *
1258
- * @since 3.3.4
1259
- *
1260
- * @param integer $post_id Post ID
1261
- */
1262
- public function flush_post_thumbnail($post_id)
1263
- {
1264
- $wpp_uploads_dir = $this->thumbnail->get_plugin_uploads_dir();
1265
-
1266
- if ( is_array($wpp_uploads_dir) && ! empty($wpp_uploads_dir) ) {
1267
- $files = glob("{$wpp_uploads_dir['basedir']}/{$post_id}-*.*"); // get all related images
1268
-
1269
- if ( is_array($files) && ! empty($files) ) {
1270
- foreach( $files as $file ){ // iterate files
1271
- if ( is_file($file) ) {
1272
- @unlink($file); // delete file
1273
- }
1274
- }
1275
- }
1276
- }
1277
- }
1278
-
1279
- /**
1280
- * Purges post from data/summary tables.
1281
- *
1282
- * @since 3.3.0
1283
- */
1284
- public function purge_post_data()
1285
- {
1286
- if ( current_user_can('delete_posts') )
1287
- add_action('delete_post', [$this, 'purge_post']);
1288
- }
1289
-
1290
- /**
1291
- * Purges post from data/summary tables.
1292
- *
1293
- * @since 3.3.0
1294
- * @global object $wpdb
1295
- */
1296
- public function purge_post($post_ID)
1297
- {
1298
- global $wpdb;
1299
-
1300
- if ( $wpdb->get_var($wpdb->prepare("SELECT postid FROM {$wpdb->prefix}popularpostsdata WHERE postid = %d", $post_ID)) ) {
1301
- // Delete from data table
1302
- $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}popularpostsdata WHERE postid = %d;", $post_ID));
1303
- // Delete from summary table
1304
- $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}popularpostssummary WHERE postid = %d;", $post_ID));
1305
- }
1306
-
1307
- // Delete cached thumbnail(s) as well
1308
- $this->flush_post_thumbnail($post_ID);
1309
- }
1310
-
1311
- /**
1312
- * Purges old post data from summary table.
1313
- *
1314
- * @since 2.0.0
1315
- * @global object $wpdb
1316
- */
1317
- public function purge_data()
1318
- {
1319
- global $wpdb;
1320
- $wpdb->query("DELETE FROM {$wpdb->prefix}popularpostssummary WHERE view_date < DATE_SUB('" . Helper::curdate() . "', INTERVAL {$this->config['tools']['log']['expires_after']} DAY);");
1321
- }
1322
-
1323
- /**
1324
- * Displays admin notices.
1325
- *
1326
- * @since 5.0.2
1327
- */
1328
- public function notices()
1329
- {
1330
- /** Performance nag */
1331
- $performance_nag = get_option('wpp_performance_nag');
1332
-
1333
- if (
1334
- isset($performance_nag['status'])
1335
- && 3 != $performance_nag['status'] // 0 = inactive, 1 = active, 2 = remind me later, 3 = dismissed
1336
- ) {
1337
- $now = Helper::timestamp();
1338
-
1339
- if ( isset($_GET['wpp_dismiss_performance_notice']) || isset($_GET['wpp_remind_performance_notice']) ) {
1340
- // User dismissed the notice
1341
- if ( isset($_GET['wpp_dismiss_performance_notice']) ) {
1342
- $performance_nag['status'] = 3;
1343
- } // User asked us to remind them later
1344
- else {
1345
- $performance_nag['status'] = 2;
1346
- $performance_nag['last_checked'] = $now;
1347
- }
1348
-
1349
- update_option('wpp_performance_nag', $performance_nag);
1350
- echo '<script>window.location.replace("'. esc_url(remove_query_arg(['wpp_dismiss_performance_notice', 'wpp_remind_performance_notice'])) .'");</script>';
1351
- } // Maybe display the notice
1352
- else {
1353
- // How much time has passed since the notice was last displayed?
1354
- $last_checked = $performance_nag['last_checked'];
1355
-
1356
- if ( $last_checked ) {
1357
- $last_checked = ($now - $last_checked) / (60 * 60);
1358
- }
1359
-
1360
- if (
1361
- 1 == $performance_nag['status']
1362
- || ( 2 == $performance_nag['status'] && $last_checked && $last_checked >= 24 )
1363
- ) {
1364
- ?>
1365
- <div class="notice notice-warning">
1366
- <p><?php printf(
1367
- __("<strong>WordPress Popular Posts:</strong> It seems your site is popular (great!) You may want to check <a href=\"%s\">these suggestions</a> to make sure your website's performance stays up to par.", 'wordpress-popular-posts'),
1368
- 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance'
1369
- ) ?></p>
1370
- <?php if ( current_user_can('manage_options') ) : ?>
1371
- <p><a href="<?php echo add_query_arg('wpp_dismiss_performance_notice', '1'); ?>">Dismiss</a> | <a href="<?php echo add_query_arg('wpp_remind_performance_notice', '1'); ?>">Remind me later</a></p>
1372
- <?php endif; ?>
1373
- </div>
1374
- <?php
1375
- }
1376
- }
1377
- }
1378
- }
1379
- }
1
+ <?php
2
+ /**
3
+ * The admin-facing functionality of the plugin.
4
+ *
5
+ * Defines hooks to enqueue the admin-specific stylesheet and JavaScript,
6
+ * plugin settings and other admin stuff.
7
+ *
8
+ * @package WordPressPopularPosts
9
+ * @subpackage WordPressPopularPosts/Admin
10
+ * @author Hector Cabrera <me@cabrerahector.com>
11
+ */
12
+
13
+ namespace WordPressPopularPosts\Admin;
14
+
15
+ use WordPressPopularPosts\Helper;
16
+ use WordPressPopularPosts\Output;
17
+ use WordPressPopularPosts\Query;
18
+
19
+ class Admin {
20
+
21
+ /**
22
+ * Slug of the plugin screen.
23
+ *
24
+ * @since 3.0.0
25
+ * @var string
26
+ */
27
+ protected $screen_hook_suffix = NULL;
28
+
29
+ /**
30
+ * Plugin options.
31
+ *
32
+ * @var array $config
33
+ * @access private
34
+ */
35
+ private $config;
36
+
37
+ /**
38
+ * Image object
39
+ *
40
+ * @since 4.0.2
41
+ * @var WordPressPopularPosts\Image
42
+ */
43
+ private $thumbnail;
44
+
45
+ /**
46
+ * Construct.
47
+ *
48
+ * @since 5.0.0
49
+ * @param array $config Admin settings.
50
+ * @param \WordPressPopularPosts\Image $thumbnail Image class.
51
+ */
52
+ public function __construct(array $config, \WordPressPopularPosts\Image $thumbnail)
53
+ {
54
+ $this->config = $config;
55
+ $this->thumbnail = $thumbnail;
56
+
57
+ // Delete old data on demand
58
+ if ( 1 == $this->config['tools']['log']['limit'] ) {
59
+ if ( ! wp_next_scheduled('wpp_cache_event') ) {
60
+ $midnight = strtotime('midnight') - ( get_option('gmt_offset') * HOUR_IN_SECONDS ) + DAY_IN_SECONDS;
61
+ wp_schedule_event($midnight, 'daily', 'wpp_cache_event');
62
+ }
63
+ } else {
64
+ // Remove the scheduled event if exists
65
+ if ( $timestamp = wp_next_scheduled('wpp_cache_event') ) {
66
+ wp_unschedule_event($timestamp, 'wpp_cache_event');
67
+ }
68
+ }
69
+
70
+ // Allow WP themers / coders to override data sampling status (active/inactive)
71
+ $this->config['tools']['sampling']['active'] = apply_filters('wpp_data_sampling', $this->config['tools']['sampling']['active']);
72
+
73
+ if (
74
+ ! ( wp_using_ext_object_cache() && defined('WPP_CACHE_VIEWS') && WPP_CACHE_VIEWS ) // Not using a persistent object cache
75
+ && ! $this->config['tools']['sampling']['active'] // Not using Data Sampling
76
+ ) {
77
+ // Schedule performance nag
78
+ if ( ! wp_next_scheduled('wpp_maybe_performance_nag') ) {
79
+ wp_schedule_event(time(), 'hourly', 'wpp_maybe_performance_nag');
80
+ }
81
+ } else {
82
+ // Remove the scheduled performance nag if found
83
+ if ( $timestamp = wp_next_scheduled('wpp_maybe_performance_nag') ) {
84
+ wp_unschedule_event($timestamp, 'wpp_maybe_performance_nag');
85
+ }
86
+ }
87
+ }
88
+
89
+ /**
90
+ * WordPress public-facing hooks.
91
+ *
92
+ * @since 5.0.0
93
+ */
94
+ public function hooks()
95
+ {
96
+ // Upgrade check
97
+ add_action('init', [$this, 'upgrade_check']);
98
+ // Hook fired when a new blog is activated on WP Multisite
99
+ add_action('wpmu_new_blog', [$this, 'activate_new_site']);
100
+ // Hook fired when a blog is deleted on WP Multisite
101
+ add_filter('wpmu_drop_tables', [$this, 'delete_site_data'], 10, 2);
102
+ // At-A-Glance
103
+ add_filter('dashboard_glance_items', [$this, 'at_a_glance_stats']);
104
+ add_action('admin_head', [$this, 'at_a_glance_stats_css']);
105
+ // Dashboard Trending Now widget
106
+ //if ( current_user_can('edit_published_posts') )
107
+ add_action('wp_dashboard_setup', [$this, 'add_dashboard_widgets']);
108
+ // Load WPP's admin styles and scripts
109
+ add_action('admin_enqueue_scripts', [$this, 'enqueue_assets']);
110
+ // Add admin screen
111
+ add_action('admin_menu', [$this, 'add_plugin_admin_menu']);
112
+ // Contextual help
113
+ add_action('admin_head', [$this, 'add_contextual_help']);
114
+ // Add plugin settings link
115
+ add_filter('plugin_action_links', [$this, 'add_plugin_settings_link'], 10, 2);
116
+ // Update chart
117
+ add_action('wp_ajax_wpp_update_chart', [$this, 'update_chart']);
118
+ // Get lists
119
+ add_action('wp_ajax_wpp_get_most_viewed', [$this, 'get_popular_items']);
120
+ add_action('wp_ajax_wpp_get_most_commented', [$this, 'get_popular_items']);
121
+ add_action('wp_ajax_wpp_get_trending', [$this, 'get_popular_items']);
122
+ // Delete plugin data
123
+ add_action('wp_ajax_wpp_clear_data', [$this, 'clear_data']);
124
+ // Empty plugin's images cache
125
+ add_action('wp_ajax_wpp_clear_thumbnail', [$this, 'clear_thumbnails']);
126
+ // Flush cached thumbnail on featured image change/deletion
127
+ add_action('updated_post_meta', [$this, 'updated_post_meta'], 10, 4);
128
+ add_action('deleted_post_meta', [$this, 'deleted_post_meta'], 10, 4);
129
+ // Purge post data on post/page deletion
130
+ add_action('admin_init', [$this, 'purge_post_data']);
131
+ // Purge old data on demand
132
+ add_action('wpp_cache_event', [$this, 'purge_data']);
133
+ // Maybe performance nag
134
+ add_action('wpp_maybe_performance_nag', [$this, 'performance_check']);
135
+ // Show notices
136
+ add_action('admin_notices', [$this, 'notices']);
137
+ }
138
+
139
+ /**
140
+ * Checks if an upgrade procedure is required.
141
+ *
142
+ * @since 2.4.0
143
+ */
144
+ public function upgrade_check()
145
+ {
146
+ $this->upgrade_site();
147
+ }
148
+
149
+ /**
150
+ * Checks whether a performance tweak may be necessary.
151
+ *
152
+ * @since 5.0.2
153
+ */
154
+ public function performance_check()
155
+ {
156
+ $performance_nag = get_option('wpp_performance_nag');
157
+
158
+ if ( ! $performance_nag ) {
159
+ $performance_nag = [
160
+ 'status' => 0,
161
+ 'last_checked' => null
162
+ ];
163
+ add_option('wpp_performance_nag', $performance_nag);
164
+ }
165
+
166
+ if ( 3 != $performance_nag['status'] ) { // 0 = inactive, 1 = active, 2 = remind me later, 3 = dismissed
167
+ global $wpdb;
168
+
169
+ $views_count = $wpdb->get_var(
170
+ $wpdb->prepare(
171
+ "SELECT IFNULL(SUM(pageviews), 0) AS views FROM {$wpdb->prefix}popularpostssummary WHERE view_datetime > DATE_SUB(%s, INTERVAL 1 HOUR);",
172
+ Helper::now()
173
+ )
174
+ );
175
+
176
+ // This site is probably a mid/high traffic one,
177
+ // display performance nag
178
+ if ( $views_count >= 420 ) {
179
+ if ( 0 == $performance_nag['status'] ) {
180
+ $performance_nag['status'] = 1;
181
+ $performance_nag['last_checked'] = Helper::timestamp();
182
+ update_option('wpp_performance_nag', $performance_nag);
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ /**
189
+ * Upgrades single site.
190
+ *
191
+ * @since 4.0.7
192
+ */
193
+ private function upgrade_site()
194
+ {
195
+ // Get WPP version
196
+ $wpp_ver = get_option('wpp_ver');
197
+
198
+ if ( ! $wpp_ver ) {
199
+ add_option('wpp_ver', WPP_VERSION);
200
+ } elseif ( version_compare($wpp_ver, WPP_VERSION, '<') ) {
201
+ $this->upgrade();
202
+ }
203
+ }
204
+
205
+ /**
206
+ * On plugin upgrade, performs a number of actions: update WPP database tables structures (if needed),
207
+ * run the setup wizard (if needed), and some other checks.
208
+ *
209
+ * @since 2.4.0
210
+ * @access private
211
+ * @global object $wpdb
212
+ */
213
+ private function upgrade()
214
+ {
215
+ $now = Helper::now();
216
+
217
+ // Keep the upgrade process from running too many times
218
+ if ( $wpp_update = get_option('wpp_update') ) {
219
+ $from_time = strtotime($wpp_update);
220
+ $to_time = strtotime($now);
221
+ $difference_in_minutes = round(abs($to_time - $from_time)/60, 2);
222
+
223
+ // Upgrade flag is still valid, abort
224
+ if ( $difference_in_minutes <= 15 )
225
+ return;
226
+ // Upgrade flag expired, delete it and continue
227
+ delete_option('wpp_update');
228
+ }
229
+
230
+ global $wpdb;
231
+
232
+ // Upgrade flag
233
+ add_option('wpp_update', $now);
234
+
235
+ // Set table name
236
+ $prefix = $wpdb->prefix . "popularposts";
237
+
238
+ // Update data table structure and indexes
239
+ $dataFields = $wpdb->get_results("SHOW FIELDS FROM {$prefix}data;");
240
+
241
+ foreach ( $dataFields as $column ) {
242
+ if ( "day" == $column->Field ) {
243
+ $wpdb->query("ALTER TABLE {$prefix}data ALTER COLUMN day DROP DEFAULT;");
244
+ }
245
+
246
+ if ( "last_viewed" == $column->Field ) {
247
+ $wpdb->query("ALTER TABLE {$prefix}data ALTER COLUMN last_viewed DROP DEFAULT;");
248
+ }
249
+ }
250
+
251
+ // Update summary table structure and indexes
252
+ $summaryFields = $wpdb->get_results("SHOW FIELDS FROM {$prefix}summary;");
253
+
254
+ foreach ( $summaryFields as $column ) {
255
+ if ( "last_viewed" == $column->Field ) {
256
+ $wpdb->query("ALTER TABLE {$prefix}summary CHANGE last_viewed view_datetime datetime NOT NULL, ADD KEY view_datetime (view_datetime);");
257
+ }
258
+
259
+ if ( "view_date" == $column->Field ) {
260
+ $wpdb->query("ALTER TABLE {$prefix}summary ALTER COLUMN view_date DROP DEFAULT;");
261
+ }
262
+
263
+ if ( "view_datetime" == $column->Field ) {
264
+ $wpdb->query("ALTER TABLE {$prefix}summary ALTER COLUMN view_datetime DROP DEFAULT;");
265
+ }
266
+ }
267
+
268
+ $summaryIndexes = $wpdb->get_results("SHOW INDEX FROM {$prefix}summary;");
269
+
270
+ foreach( $summaryIndexes as $index ) {
271
+ if ( 'ID_date' == $index->Key_name ) {
272
+ $wpdb->query("ALTER TABLE {$prefix}summary DROP INDEX ID_date;");
273
+ }
274
+
275
+ if ( 'last_viewed' == $index->Key_name ) {
276
+ $wpdb->query("ALTER TABLE {$prefix}summary DROP INDEX last_viewed;");
277
+ }
278
+ }
279
+
280
+ // Validate the structure of the tables, create missing tables / fields if necessary
281
+ \WordPressPopularPosts\Activation\Activator::track_new_site();
282
+
283
+ // Check storage engine
284
+ $storage_engine_data = $wpdb->get_var("SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}data';");
285
+
286
+ if ( 'InnoDB' != $storage_engine_data ) {
287
+ $wpdb->query("ALTER TABLE {$prefix}data ENGINE=InnoDB;");
288
+ }
289
+
290
+ $storage_engine_summary = $wpdb->get_var("SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}summary';");
291
+
292
+ if ( 'InnoDB' != $storage_engine_summary ) {
293
+ $wpdb->query("ALTER TABLE {$prefix}summary ENGINE=InnoDB;");
294
+ }
295
+
296
+ // Update WPP version
297
+ update_option('wpp_ver', WPP_VERSION);
298
+ // Remove upgrade flag
299
+ delete_option('wpp_update');
300
+ }
301
+
302
+ /**
303
+ * Fired when a new blog is activated on WP Multisite.
304
+ *
305
+ * @since 3.0.0
306
+ * @param int $blog_id New blog ID
307
+ */
308
+ public function activate_new_site($blog_id)
309
+ {
310
+ if ( 1 !== did_action('wpmu_new_blog') )
311
+ return;
312
+
313
+ // run activation for the new blog
314
+ switch_to_blog($blog_id);
315
+ \WordPressPopularPosts\Activation\Activator::track_new_site();
316
+ // switch back to current blog
317
+ restore_current_blog();
318
+ }
319
+
320
+ /**
321
+ * Fired when a blog is deleted on WP Multisite.
322
+ *
323
+ * @since 4.0.0
324
+ * @param array $tables
325
+ * @param int $blog_id
326
+ * @return array
327
+ */
328
+ public function delete_site_data($tables, $blog_id)
329
+ {
330
+ global $wpdb;
331
+
332
+ $tables[] = $wpdb->prefix . 'popularpostsdata';
333
+ $tables[] = $wpdb->prefix . 'popularpostssummary';
334
+
335
+ return $tables;
336
+ }
337
+
338
+ /**
339
+ * Display some statistics at the "At a Glance" box from the Dashboard.
340
+ *
341
+ * @since 4.1.0
342
+ */
343
+ public function at_a_glance_stats()
344
+ {
345
+ global $wpdb;
346
+
347
+ $glances = [];
348
+ $args = ['post', 'page'];
349
+ $post_type_placeholders = '%s, %s';
350
+
351
+ if (
352
+ isset($this->config['stats']['post_type'])
353
+ && ! empty($this->config['stats']['post_type'])
354
+ ) {
355
+ $args = array_map('trim', explode(',', $this->config['stats']['post_type']));
356
+ $post_type_placeholders = implode(', ', array_fill(0, count($args), '%s'));
357
+ }
358
+
359
+ $args[] = Helper::now();
360
+
361
+ $query = $wpdb->prepare(
362
+ "SELECT SUM(pageviews) AS total
363
+ FROM `{$wpdb->prefix}popularpostssummary` v LEFT JOIN `{$wpdb->prefix}posts` p ON v.postid = p.ID
364
+ WHERE p.post_type IN({$post_type_placeholders}) AND p.post_status = 'publish' AND p.post_password = '' AND v.view_datetime > DATE_SUB(%s, INTERVAL 1 HOUR);"
365
+ , $args
366
+ );
367
+
368
+ $total_views = $wpdb->get_var($query);
369
+
370
+ $pageviews = sprintf(
371
+ _n('%s view in the last hour', '%s views in the last hour', $total_views, 'wordpress-popular-posts'),
372
+ number_format_i18n($total_views)
373
+ );
374
+
375
+ if ( current_user_can('edit_published_posts') ) {
376
+ $glances[] = '<a class="wpp-views-count" href="' . admin_url('options-general.php?page=wordpress-popular-posts') . '">' . $pageviews . '</a>';
377
+ }
378
+ else {
379
+ $glances[] = '<span class="wpp-views-count">' . $pageviews . '</a>';
380
+ }
381
+
382
+ return $glances;
383
+ }
384
+
385
+ /**
386
+ * Add custom inline CSS styles for At a Glance stats.
387
+ *
388
+ * @since 4.1.0
389
+ */
390
+ public function at_a_glance_stats_css()
391
+ {
392
+ echo '<style>#dashboard_right_now a.wpp-views-count:before, #dashboard_right_now span.wpp-views-count:before {content: "\f177";}</style>';
393
+ }
394
+
395
+ /**
396
+ * Adds a widget to the dashboard.
397
+ *
398
+ * @since 5.0.0
399
+ */
400
+ public function add_dashboard_widgets()
401
+ {
402
+ if ( current_user_can('edit_published_posts') ) {
403
+ wp_add_dashboard_widget(
404
+ 'wpp_trending_dashboard_widget',
405
+ __('Trending now', 'wordpress-popular-posts'),
406
+ [$this, 'trending_dashboard_widget']
407
+ );
408
+ }
409
+ }
410
+
411
+ /**
412
+ * Outputs the contents of our Trending Dashboard Widget.
413
+ *
414
+ * @since 5.0.0
415
+ */
416
+ function trending_dashboard_widget()
417
+ {
418
+ ?>
419
+ <style>
420
+ #wpp_trending_dashboard_widget .inside {
421
+ overflow: hidden;
422
+ position: relative;
423
+ min-height: 150px;
424
+ padding-bottom: 22px;
425
+ }
426
+
427
+ #wpp_trending_dashboard_widget .inside::after {
428
+ position: absolute;
429
+ top: 0;
430
+ left: 0;
431
+ opacity: 0.2;
432
+ display: block;
433
+ content: '';
434
+ width: 100%;
435
+ height: 100%;
436
+ z-index: 1;
437
+ background-image: url('<?php echo plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/images/flame.png'; ?>');
438
+ background-position: right bottom;
439
+ background-repeat: no-repeat;
440
+ background-size: 34% auto;
441
+ }
442
+
443
+ #wpp_trending_dashboard_widget .inside .no-data {
444
+ position: absolute;
445
+ top: calc(50% - 11px);
446
+ left: 50%;
447
+ z-index: 2;
448
+ margin: 0;
449
+ padding: 0;
450
+ width: 96%;
451
+ transform: translate(-50.0001%, -50.0001%);
452
+ }
453
+
454
+ #wpp_trending_dashboard_widget .inside .popular-posts-list,
455
+ #wpp_trending_dashboard_widget .inside p#wpp_read_more {
456
+ position: relative;
457
+ z-index: 2;
458
+ }
459
+
460
+ #wpp_trending_dashboard_widget .inside .popular-posts-list {
461
+ margin: 1em 0;
462
+ }
463
+
464
+ #wpp_trending_dashboard_widget .inside p#wpp_read_more {
465
+ position: absolute;
466
+ left: 0;
467
+ bottom: 0;
468
+ width: 100%;
469
+ text-align: center;
470
+ }
471
+ </style>
472
+ <?php
473
+ $args = [
474
+ 'range' => 'custom',
475
+ 'time_quantity' => 1,
476
+ 'time_unit' => 'HOUR',
477
+ 'post_type' => $this->config['stats']['post_type'],
478
+ 'limit' => 5,
479
+ 'stats_tag' => [
480
+ 'views' => 1,
481
+ 'comment_count' => 1
482
+ ]
483
+ ];
484
+ $options = apply_filters('wpp_trending_dashboard_widget_args', []);
485
+
486
+ if ( is_array($options) && ! empty($options) )
487
+ $args = Helper::merge_array_r($args, $options);
488
+
489
+ $trending = new Query($args);
490
+ $posts = $trending->get_posts();
491
+
492
+ $this->render_list($posts, 'trending');
493
+ echo '<p id="wpp_read_more"><a href="' . admin_url('options-general.php?page=wordpress-popular-posts') . '">' . __('View more', 'wordpress-popular-posts') . '</a><p>';
494
+
495
+ }
496
+
497
+ /**
498
+ * Enqueues admin facing assets.
499
+ *
500
+ * @since 5.0.0
501
+ */
502
+ public function enqueue_assets()
503
+ {
504
+ $screen = get_current_screen();
505
+
506
+ if ( isset($screen->id) ) {
507
+ if ( $screen->id == $this->screen_hook_suffix ) {
508
+ wp_enqueue_style('wpp-datepicker-theme', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/datepicker.css', [], WPP_VERSION, 'all');
509
+
510
+ wp_enqueue_media();
511
+ wp_enqueue_script('jquery-ui-datepicker');
512
+ wp_enqueue_script('chartjs', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/vendor/Chart.min.js', [], WPP_VERSION);
513
+
514
+ wp_register_script('wpp-chart', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/chart.js', ['chartjs'], WPP_VERSION);
515
+ wp_localize_script('wpp-chart', 'wpp_chart_params', [
516
+ 'colors' => $this->get_admin_color_scheme()
517
+ ]);
518
+ wp_enqueue_script('wpp-chart');
519
+
520
+ wp_register_script('wordpress-popular-posts-admin-script', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/admin.js', ['jquery'], WPP_VERSION, true);
521
+ wp_localize_script('wordpress-popular-posts-admin-script', 'wpp_admin_params', [
522
+ 'label_media_upload_button' => __("Use this image", "wordpress-popular-posts"),
523
+ 'nonce' => wp_create_nonce("wpp_admin_nonce")
524
+ ]);
525
+ wp_enqueue_script('wordpress-popular-posts-admin-script');
526
+ }
527
+
528
+ if ( $screen->id == $this->screen_hook_suffix || 'dashboard' == $screen->id ) {
529
+ // Fontello icons
530
+ wp_enqueue_style('wpp-fontello', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/fontello.css', [], WPP_VERSION, 'all');
531
+ wp_enqueue_style('wordpress-popular-posts-admin-styles', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/admin.css', [], WPP_VERSION, 'all');
532
+ }
533
+ }
534
+ }
535
+
536
+ /**
537
+ * Register the administration menu for this plugin into the WordPress Dashboard menu.
538
+ *
539
+ * @since 1.0.0
540
+ */
541
+ public function add_plugin_admin_menu()
542
+ {
543
+ $this->screen_hook_suffix = add_options_page(
544
+ 'WordPress Popular Posts',
545
+ 'WordPress Popular Posts',
546
+ 'edit_published_posts',
547
+ 'wordpress-popular-posts',
548
+ [$this, 'display_plugin_admin_page']
549
+ );
550
+ }
551
+
552
+ /**
553
+ * Render the settings page for this plugin.
554
+ *
555
+ * @since 1.0.0
556
+ */
557
+ public function display_plugin_admin_page()
558
+ {
559
+ include_once plugin_dir_path(__FILE__) . 'admin-page.php';
560
+ }
561
+
562
+ /**
563
+ * Adds contextual help menu.
564
+ *
565
+ * @since 4.0.0
566
+ */
567
+ public function add_contextual_help()
568
+ {
569
+ $screen = get_current_screen();
570
+
571
+ if ( isset($screen->id) && $screen->id == $this->screen_hook_suffix ){
572
+ $screen->add_help_tab(
573
+ [
574
+ 'id' => 'wpp_help_overview',
575
+ 'title' => __('Overview', 'wordpress-popular-posts'),
576
+ 'content' => "<p>" . __("Welcome to WordPress Popular Posts' Dashboard! In this screen you will find statistics on what's popular on your site, tools to further tweak WPP to your needs, and more!", "wordpress-popular-posts") . "</p>"
577
+ ]
578
+ );
579
+ $screen->add_help_tab(
580
+ [
581
+ 'id' => 'wpp_help_donate',
582
+ 'title' => __('Like this plugin?', 'wordpress-popular-posts'),
583
+ 'content' => '
584
+ <p style="text-align: center;">' . __('Each donation motivates me to keep releasing free stuff for the WordPress community!', 'wordpress-popular-posts') . '</p>
585
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="margin: 0; padding: 0; text-align: center;">
586
+ <input type="hidden" name="cmd" value="_s-xclick">
587
+ <input type="hidden" name="hosted_button_id" value="RP9SK8KVQHRKS">
588
+ <input type="image" src="//www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" style="display: inline; margin: 0;">
589
+ <img alt="" border="0" src="//www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
590
+ </form>
591
+ <p style="text-align: center;">' . sprintf(__('You can <a href="%s" target="_blank">leave a review</a>, too!', 'wordpress-popular-posts'), 'https://wordpress.org/support/view/plugin-reviews/wordpress-popular-posts?rate=5#postform') . '</p>'
592
+ ]
593
+ );
594
+
595
+ // Help sidebar
596
+ $screen->set_help_sidebar(
597
+ sprintf(
598
+ __('<p><strong>For more information:</strong></p><ul><li><a href="%1$s">Documentation</a></li><li><a href="%2$s">Support</a></li></ul>', 'wordpress-popular-posts'),
599
+ "https://github.com/cabrerahector/wordpress-popular-posts/",
600
+ "https://wordpress.org/support/plugin/wordpress-popular-posts/"
601
+ )
602
+ );
603
+ }
604
+ }
605
+
606
+ /**
607
+ * Registers Settings link on plugin description.
608
+ *
609
+ * @since 2.3.3
610
+ * @param array $links
611
+ * @param string $file
612
+ * @return array
613
+ */
614
+ public function add_plugin_settings_link($links, $file)
615
+ {
616
+ $plugin_file = 'wordpress-popular-posts/wordpress-popular-posts.php';
617
+
618
+ if (
619
+ is_plugin_active($plugin_file)
620
+ && $plugin_file == $file
621
+ ) {
622
+ $links[] = '<a href="' . admin_url('options-general.php?page=wordpress-popular-posts') . '">' . __('Settings') . '</a>';
623
+ }
624
+
625
+ return $links;
626
+ }
627
+
628
+ /**
629
+ * Gets current admin color scheme.
630
+ *
631
+ * @since 4.0.0
632
+ * @return array
633
+ */
634
+ private function get_admin_color_scheme()
635
+ {
636
+ global $_wp_admin_css_colors;
637
+
638
+ if (
639
+ is_array($_wp_admin_css_colors)
640
+ && count($_wp_admin_css_colors)
641
+ ) {
642
+ $current_user = wp_get_current_user();
643
+ $color_scheme = get_user_option('admin_color', $current_user->ID);
644
+
645
+ if (
646
+ empty($color_scheme)
647
+ || ! isset($_wp_admin_css_colors[ $color_scheme])
648
+ ) {
649
+ $color_scheme = 'fresh';
650
+ }
651
+
652
+ if ( isset($_wp_admin_css_colors[$color_scheme]) && isset($_wp_admin_css_colors[$color_scheme]->colors) ) {
653
+ return $_wp_admin_css_colors[$color_scheme]->colors;
654
+ }
655
+
656
+ }
657
+
658
+ // Fallback, just in case
659
+ return ['#333', '#999', '#881111', '#a80000'];
660
+ }
661
+
662
+ /**
663
+ * Fetches chart data.
664
+ *
665
+ * @since 4.0.0
666
+ * @return string
667
+ */
668
+ public function get_chart_data($range = 'last7days', $time_unit = 'HOUR', $time_quantity = 24)
669
+ {
670
+ $dates = $this->get_dates($range, $time_unit, $time_quantity);
671
+ $start_date = $dates[0];
672
+ $end_date = $dates[count($dates) - 1];
673
+ $date_range = Helper::get_date_range($start_date, $end_date, 'Y-m-d H:i:s');
674
+ $views_data = $this->get_range_item_count($start_date, $end_date, 'views');
675
+ $views = [];
676
+ $comments_data = $this->get_range_item_count($start_date, $end_date, 'comments');
677
+ $comments = [];
678
+
679
+ if ( 'today' != $range ) {
680
+ foreach($date_range as $date) {
681
+ $key = date('Y-m-d', strtotime($date));
682
+ $views[] = ( ! isset($views_data[$key]) ) ? 0 : $views_data[$key]->pageviews;
683
+ $comments[] = ( ! isset($comments_data[$key]) ) ? 0 : $comments_data[$key]->comments;
684
+ }
685
+ } else {
686
+ $key = date('Y-m-d', strtotime($dates[0]));
687
+ $views[] = ( ! isset($views_data[$key]) ) ? 0 : $views_data[$key]->pageviews;
688
+ $comments[] = ( ! isset($comments_data[$key]) ) ? 0 : $comments_data[$key]->comments;
689
+ }
690
+
691
+ if ( $start_date != $end_date )
692
+ $label_date_range = date_i18n('M, D d', strtotime($start_date)) . ' &mdash; ' . date_i18n('M, D d', strtotime($end_date));
693
+ else
694
+ $label_date_range = date_i18n('M, D d', strtotime($start_date));
695
+
696
+ $total_views = array_sum($views);
697
+ $total_comments = array_sum($comments);
698
+
699
+ $label_summary = sprintf(_n('%s view', '%s views', $total_views, 'wordpress-popular-posts'), '<strong>' . number_format_i18n($total_views) . '</strong>') . '<br style="display: none;" /> / ' . sprintf(_n('%s comment', '%s comments', $total_comments, 'wordpress-popular-posts'), '<strong>' . number_format_i18n($total_comments) . '</strong>');
700
+
701
+ // Format labels
702
+ if ( 'today' != $range ) {
703
+ $date_range = array_map(function($d){
704
+ return date_i18n('D d', strtotime($d));
705
+ }, $date_range);
706
+ } else {
707
+ $date_range = [date_i18n('D d', strtotime($date_range[0]))];
708
+ $comments = [array_sum($comments)];
709
+ $views = [array_sum($views)];
710
+ }
711
+
712
+ $response = [
713
+ 'totals' => [
714
+ 'label_summary' => $label_summary,
715
+ 'label_date_range' => $label_date_range,
716
+ ],
717
+ 'labels' => $date_range,
718
+ 'datasets' => [
719
+ [
720
+ 'label' => __("Comments", "wordpress-popular-posts"),
721
+ 'data' => $comments
722
+ ],
723
+ [
724
+ 'label' => __("Views", "wordpress-popular-posts"),
725
+ 'data' => $views
726
+ ]
727
+ ]
728
+ ];
729
+
730
+ return json_encode($response);
731
+ }
732
+
733
+ /**
734
+ * Returns an array of dates.
735
+ *
736
+ * @since 5.0.0
737
+ * @return array|bool
738
+ */
739
+ private function get_dates($range = 'last7days', $time_unit = 'HOUR', $time_quantity = 24)
740
+ {
741
+ $valid_ranges = ['today', 'daily', 'last24hours', 'weekly', 'last7days', 'monthly', 'last30days', 'all', 'custom'];
742
+ $range = in_array($range, $valid_ranges) ? $range : 'last7days';
743
+ $now = new \DateTime(Helper::now(), new \DateTimeZone(Helper::get_timezone()));
744
+
745
+ // Determine time range
746
+ switch( $range ){
747
+ case "last24hours":
748
+ case "daily":
749
+ $end_date = $now->format('Y-m-d H:i:s');
750
+ $start_date = $now->modify('-1 day')->format('Y-m-d H:i:s');
751
+ break;
752
+
753
+ case "today":
754
+ $start_date = $now->format('Y-m-d') . ' 00:00:00';
755
+ $end_date = $now->format('Y-m-d') . ' 23:59:59';
756
+ break;
757
+
758
+ case "last7days":
759
+ case "weekly":
760
+ $end_date = $now->format('Y-m-d') . ' 23:59:59';
761
+ $start_date = $now->modify('-6 day')->format('Y-m-d') . ' 00:00:00';
762
+ break;
763
+
764
+ case "last30days":
765
+ case "monthly":
766
+ $end_date = $now->format('Y-m-d') . ' 23:59:59';
767
+ $start_date = $now->modify('-29 day')->format('Y-m-d') . ' 00:00:00';
768
+ break;
769
+
770
+ case "custom":
771
+ $end_date = $now->format('Y-m-d H:i:s');
772
+
773
+ if (
774
+ Helper::is_number($time_quantity)
775
+ && $time_quantity >= 1
776
+ ) {
777
+ $end_date = $now->format('Y-m-d H:i:s');
778
+ $time_unit = strtoupper($time_unit);
779
+
780
+ if ( 'MINUTE' == $time_unit ) {
781
+ $start_date = $now->sub(new \DateInterval('PT' . (60 * $time_quantity) . 'S'))->format('Y-m-d H:i:s');
782
+ } elseif ( 'HOUR' == $time_unit ) {
783
+ $start_date = $now->sub(new \DateInterval('PT' . ((60 * $time_quantity) - 1) . 'M59S'))->format('Y-m-d H:i:s');
784
+ } else {
785
+ $end_date = $now->format('Y-m-d') . ' 23:59:59';
786
+ $start_date = $now->sub(new \DateInterval('P' . ($time_quantity - 1) . 'D'))->format('Y-m-d') . ' 00:00:00';
787
+ }
788
+ } // fallback to last 24 hours
789
+ else {
790
+ $start_date = $now->modify('-1 day')->format('Y-m-d H:i:s');
791
+ }
792
+
793
+ // Check if custom date range has been requested
794
+ $dates = null;
795
+
796
+ if ( isset($_GET['dates']) ) {
797
+ $dates = explode(" ~ ", $_GET['dates']);
798
+
799
+ if (
800
+ ! is_array($dates)
801
+ || empty($dates)
802
+ || ! Helper::is_valid_date($dates[0])
803
+ ) {
804
+ $dates = null;
805
+ } else {
806
+ if (
807
+ ! isset($dates[1])
808
+ || ! Helper::is_valid_date($dates[1])
809
+ ) {
810
+ $dates[1] = $dates[0];
811
+ }
812
+
813
+ $start_date = $dates[0] . ' 00:00:00';
814
+ $end_date = $dates[1] . ' 23:59:59';
815
+ }
816
+ }
817
+
818
+ break;
819
+
820
+ default:
821
+ $end_date = $now->format('Y-m-d') . ' 23:59:59';
822
+ $start_date = $now->modify('-6 day')->format('Y-m-d') . ' 00:00:00';
823
+ break;
824
+ }
825
+
826
+ return [$start_date, $end_date];
827
+ }
828
+
829
+ /**
830
+ * Returns an array of dates with views/comments count.
831
+ *
832
+ * @since 5.0.0
833
+ * @param string $start_date
834
+ * @param string $end_date
835
+ * @param string $item
836
+ * @return array
837
+ */
838
+ public function get_range_item_count($start_date, $end_date, $item = 'views')
839
+ {
840
+ global $wpdb;
841
+
842
+ $args = array_map('trim', explode(',', $this->config['stats']['post_type']));
843
+
844
+ if ( empty($args) ) {
845
+ $args = ['post', 'page'];
846
+ }
847
+
848
+ $post_type_placeholders = array_fill(0, count($args), '%s');
849
+
850
+ if ( $this->config['stats']['freshness'] ) {
851
+ $args[] = $start_date;
852
+ }
853
+
854
+ // Append dates to arguments list
855
+ array_unshift($args, $start_date, $end_date);
856
+
857
+ if ( $item == 'comments' ) {
858
+ $query = $wpdb->prepare(
859
+ "SELECT DATE(`c`.`comment_date_gmt`) AS `c_date`, COUNT(*) AS `comments`
860
+ FROM `{$wpdb->comments}` c INNER JOIN `{$wpdb->posts}` p ON `c`.`comment_post_ID` = `p`.`ID`
861
+ WHERE (`c`.`comment_date_gmt` BETWEEN %s AND %s) AND `c`.`comment_approved` = '1' AND `p`.`post_type` IN (". implode(", ", $post_type_placeholders) . ") AND `p`.`post_status` = 'publish' AND `p`.`post_password` = ''
862
+ " . ( $this->config['stats']['freshness'] ? " AND `p`.`post_date` >= %s" : "" ) . "
863
+ GROUP BY `c_date` ORDER BY `c_date` DESC;",
864
+ $args
865
+ );
866
+ } else {
867
+ $query = $wpdb->prepare(
868
+ "SELECT `v`.`view_date`, SUM(`v`.`pageviews`) AS `pageviews`
869
+ FROM `{$wpdb->prefix}popularpostssummary` v INNER JOIN `{$wpdb->posts}` p ON `v`.`postid` = `p`.`ID`
870
+ WHERE (`v`.`view_datetime` BETWEEN %s AND %s) AND `p`.`post_type` IN (". implode(", ", $post_type_placeholders) . ") AND `p`.`post_status` = 'publish' AND `p`.`post_password` = ''
871
+ " . ( $this->config['stats']['freshness'] ? " AND `p`.`post_date` >= %s" : "" ) . "
872
+ GROUP BY `v`.`view_date` ORDER BY `v`.`view_date` DESC;",
873
+ $args
874
+ );
875
+
876
+ //error_log($query);
877
+ }
878
+
879
+ return $wpdb->get_results($query, OBJECT_K);
880
+ }
881
+
882
+ /**
883
+ * Updates chart via AJAX.
884
+ *
885
+ * @since 4.0.0
886
+ */
887
+ public function update_chart()
888
+ {
889
+ $response = [
890
+ 'status' => 'error'
891
+ ];
892
+ $nonce = isset($_GET['nonce']) ? $_GET['nonce'] : null;
893
+
894
+ if ( wp_verify_nonce($nonce, 'wpp_admin_nonce') ) {
895
+
896
+ $valid_ranges = ['today', 'daily', 'last24hours', 'weekly', 'last7days', 'monthly', 'last30days', 'all', 'custom'];
897
+ $time_units = ["MINUTE", "HOUR", "DAY"];
898
+
899
+ $range = ( isset($_GET['range']) && in_array($_GET['range'], $valid_ranges) ) ? $_GET['range'] : 'last7days';
900
+ $time_quantity = ( isset($_GET['time_quantity']) && filter_var($_GET['time_quantity'], FILTER_VALIDATE_INT) ) ? $_GET['time_quantity'] : 24;
901
+ $time_unit = ( isset($_GET['time_unit']) && in_array(strtoupper($_GET['time_unit']), $time_units) ) ? $_GET['time_unit'] : 'hour';
902
+
903
+ $this->config['stats']['range'] = $range;
904
+ $this->config['stats']['time_quantity'] = $time_quantity;
905
+ $this->config['stats']['time_unit'] = $time_unit;
906
+
907
+ update_option('wpp_settings_config', $this->config);
908
+
909
+ $response = [
910
+ 'status' => 'ok',
911
+ 'data' => json_decode(
912
+ $this->get_chart_data($this->config['stats']['range'], $this->config['stats']['time_unit'], $this->config['stats']['time_quantity']),
913
+ true
914
+ )
915
+ ];
916
+ }
917
+
918
+ wp_send_json($response);
919
+ }
920
+
921
+ /**
922
+ * Fetches most viewed/commented/trending posts via AJAX.
923
+ *
924
+ * @since 5.0.0
925
+ */
926
+ public function get_popular_items()
927
+ {
928
+ $items = isset($_GET['items']) ? $_GET['items'] : null;
929
+ $nonce = isset($_GET['nonce']) ? $_GET['nonce'] : null;
930
+
931
+ if ( wp_verify_nonce($nonce, 'wpp_admin_nonce') ) {
932
+ $args = [
933
+ 'range' => $this->config['stats']['range'],
934
+ 'time_quantity' => $this->config['stats']['time_quantity'],
935
+ 'time_unit' => $this->config['stats']['time_unit'],
936
+ 'post_type' => $this->config['stats']['post_type'],
937
+ 'freshness' => $this->config['stats']['freshness'],
938
+ 'limit' => $this->config['stats']['limit'],
939
+ 'stats_tag' => [
940
+ 'date' => [
941
+ 'active' => 1
942
+ ]
943
+ ]
944
+ ];
945
+
946
+ if ( 'most-commented' == $items ) {
947
+ $args['order_by'] = 'comments';
948
+ $args['stats_tag']['comment_count'] = 1;
949
+ $args['stats_tag']['views'] = 0;
950
+ } elseif ( 'trending' == $items ) {
951
+ $args['range'] = 'custom';
952
+ $args['time_quantity'] = 1;
953
+ $args['time_unit'] = 'HOUR';
954
+ $args['stats_tag']['comment_count'] = 1;
955
+ $args['stats_tag']['views'] = 1;
956
+ } else {
957
+ $args['stats_tag']['comment_count'] = 0;
958
+ $args['stats_tag']['views'] = 1;
959
+ }
960
+
961
+ if ( 'trending' != $items ) {
962
+
963
+ add_filter('wpp_query_join', function($join, $options) use ($items)
964
+ {
965
+ global $wpdb;
966
+ $dates = null;
967
+
968
+ if ( isset($_GET['dates']) ) {
969
+ $dates = explode(" ~ ", $_GET['dates']);
970
+
971
+ if (
972
+ ! is_array($dates)
973
+ || empty($dates)
974
+ || ! Helper::is_valid_date($dates[0])
975
+ ) {
976
+ $dates = null;
977
+ } else {
978
+ if (
979
+ ! isset($dates[1])
980
+ || ! Helper::is_valid_date($dates[1])
981
+ ) {
982
+ $dates[1] = $dates[0];
983
+ }
984
+
985
+ $start_date = $dates[0];
986
+ $end_date = $dates[1];
987
+ }
988
+
989
+ }
990
+
991
+ if ( $dates ) {
992
+ if ( 'most-commented' == $items ) {
993
+ return "INNER JOIN (SELECT comment_post_ID, COUNT(comment_post_ID) AS comment_count, comment_date_gmt FROM `{$wpdb->comments}` WHERE comment_date_gmt BETWEEN '{$dates[0]} 00:00:00' AND '{$dates[1]} 23:59:59' AND comment_approved = '1' GROUP BY comment_post_ID) c ON p.ID = c.comment_post_ID";
994
+ }
995
+
996
+ return "INNER JOIN (SELECT SUM(pageviews) AS pageviews, view_date, postid FROM `{$wpdb->prefix}popularpostssummary` WHERE view_datetime BETWEEN '{$dates[0]} 00:00:00' AND '{$dates[1]} 23:59:59' GROUP BY postid) v ON p.ID = v.postid";
997
+ }
998
+
999
+ $now = Helper::now();
1000
+
1001
+ // Determine time range
1002
+ switch( $options['range'] ){
1003
+ case "last24hours":
1004
+ case "daily":
1005
+ $interval = "24 HOUR";
1006
+ break;
1007
+
1008
+ case "today":
1009
+ $hours = date('H', strtotime($now));
1010
+ $minutes = $hours * 60 + (int) date( 'i', strtotime($now) );
1011
+ $interval = "{$minutes} MINUTE";
1012
+ break;
1013
+
1014
+ case "last7days":
1015
+ case "weekly":
1016
+ $interval = "6 DAY";
1017
+ break;
1018
+
1019
+ case "last30days":
1020
+ case "monthly":
1021
+ $interval = "29 DAY";
1022
+ break;
1023
+
1024
+ case "custom":
1025
+ $time_units = ["MINUTE", "HOUR", "DAY"];
1026
+ $interval = "24 HOUR";
1027
+
1028
+ // Valid time unit
1029
+ if (
1030
+ isset($options['time_unit'])
1031
+ && in_array(strtoupper($options['time_unit']), $time_units)
1032
+ && isset($options['time_quantity'])
1033
+ && filter_var($options['time_quantity'], FILTER_VALIDATE_INT)
1034
+ && $options['time_quantity'] > 0
1035
+ ) {
1036
+ $interval = "{$options['time_quantity']} " . strtoupper($options['time_unit']);
1037
+ }
1038
+
1039
+ break;
1040
+
1041
+ default:
1042
+ $interval = "1 DAY";
1043
+ break;
1044
+ }
1045
+
1046
+ if ( 'most-commented' == $items ) {
1047
+ return "INNER JOIN (SELECT comment_post_ID, COUNT(comment_post_ID) AS comment_count, comment_date_gmt FROM `{$wpdb->comments}` WHERE comment_date_gmt > DATE_SUB('{$now}', INTERVAL {$interval}) AND comment_approved = '1' GROUP BY comment_post_ID) c ON p.ID = c.comment_post_ID";
1048
+ }
1049
+
1050
+ return "INNER JOIN (SELECT SUM(pageviews) AS pageviews, view_date, postid FROM `{$wpdb->prefix}popularpostssummary` WHERE view_datetime > DATE_SUB('{$now}', INTERVAL {$interval}) GROUP BY postid) v ON p.ID = v.postid";
1051
+ }, 1, 2);
1052
+
1053
+ }
1054
+
1055
+ $popular_items = new \WordPressPopularPosts\Query($args);
1056
+ $posts = $popular_items->get_posts();
1057
+
1058
+ if ( 'trending' != $items ) {
1059
+ remove_all_filters('wpp_query_join', 1);
1060
+ }
1061
+
1062
+ $this->render_list($posts, $items);
1063
+ }
1064
+
1065
+ wp_die();
1066
+ }
1067
+
1068
+ /**
1069
+ * Renders popular posts lists.
1070
+ *
1071
+ * @since 5.0.0
1072
+ * @param array
1073
+ */
1074
+ public function render_list($posts, $list = 'most-viewed')
1075
+ {
1076
+ if (
1077
+ is_array($posts)
1078
+ && ! empty($posts)
1079
+ ) {
1080
+ ?>
1081
+ <ol class="popular-posts-list">
1082
+ <?php
1083
+ foreach( $posts as $post ) { ?>
1084
+ <li>
1085
+ <a href="<?php echo get_permalink($post->id); ?>" class="wpp-title"><?php echo sanitize_text_field(apply_filters('the_title', $post->title, $post->id)); ?></a>
1086
+ <div>
1087
+ <?php if ( 'most-viewed' == $list ) : ?>
1088
+ <span><?php printf(_n('%s view', '%s views', $post->pageviews, 'wordpress-popular-posts' ), number_format_i18n($post->pageviews)); ?></span>
1089
+ <?php elseif ( 'most-commented' == $list ) : ?>
1090
+ <span><?php printf(_n('%s comment', '%s comments', $post->comment_count, 'wordpress-popular-posts'), number_format_i18n($post->comment_count)); ?></span>
1091
+ <?php else : ?>
1092
+ <span><?php printf(_n('%s view', '%s views', $post->pageviews, 'wordpress-popular-posts' ), number_format_i18n($post->pageviews)); ?></span>, <span><?php printf(_n('%s comment', '%s comments', $post->comment_count, 'wordpress-popular-posts'), number_format_i18n($post->comment_count)); ?></span>
1093
+ <?php endif; ?>
1094
+ <small> &mdash; <a href="<?php echo get_permalink($post->id); ?>"><?php _e("View"); ?></a><?php if ( current_user_can('edit_others_posts') ): ?> | <a href="<?php echo get_edit_post_link($post->id); ?>"><?php _e("Edit"); ?></a><?php endif; ?></small>
1095
+ </div>
1096
+ </li>
1097
+ <?php
1098
+ }
1099
+ ?>
1100
+ </ol>
1101
+ <?php
1102
+ }
1103
+ else {
1104
+ ?>
1105
+ <p class="no-data" style="text-align: center;"><?php _e("Looks like your site's activity is a little low right now. <br />Spread the word and come back later!", "wordpress-popular-posts"); ?></p>
1106
+ <?php
1107
+ }
1108
+ }
1109
+
1110
+ /**
1111
+ * Truncates data and cache on demand.
1112
+ *
1113
+ * @since 2.0.0
1114
+ * @global object $wpdb
1115
+ */
1116
+ public function clear_data()
1117
+ {
1118
+ $token = $_POST['token'];
1119
+ $clear = isset($_POST['clear']) ? $_POST['clear'] : null;
1120
+ $key = get_option("wpp_rand");
1121
+
1122
+ if (
1123
+ current_user_can('manage_options')
1124
+ && ( $token === $key )
1125
+ && $clear
1126
+ ) {
1127
+ global $wpdb;
1128
+
1129
+ // set table name
1130
+ $prefix = $wpdb->prefix . "popularposts";
1131
+
1132
+ if ( $clear == 'cache' ) {
1133
+ if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
1134
+ $wpdb->query("TRUNCATE TABLE {$prefix}summary;");
1135
+ $this->flush_transients();
1136
+
1137
+ echo 1;
1138
+ } else {
1139
+ echo 2;
1140
+ }
1141
+ } elseif ( $clear == 'all' ) {
1142
+ if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}data'") && $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
1143
+ $wpdb->query("TRUNCATE TABLE {$prefix}data;");
1144
+ $wpdb->query("TRUNCATE TABLE {$prefix}summary;");
1145
+ $this->flush_transients();
1146
+
1147
+ echo 1;
1148
+ } else {
1149
+ echo 2;
1150
+ }
1151
+ } else {
1152
+ echo 3;
1153
+ }
1154
+ } else {
1155
+ echo 4;
1156
+ }
1157
+
1158
+ wp_die();
1159
+ }
1160
+
1161
+ /**
1162
+ * Deletes cached (transient) data.
1163
+ *
1164
+ * @since 3.0.0
1165
+ * @access private
1166
+ */
1167
+ private function flush_transients()
1168
+ {
1169
+ $wpp_transients = get_option('wpp_transients');
1170
+
1171
+ if ( $wpp_transients && is_array($wpp_transients) && ! empty($wpp_transients) ) {
1172
+ for ( $t=0; $t < count($wpp_transients); $t++ )
1173
+ delete_transient($wpp_transients[$t]);
1174
+
1175
+ update_option('wpp_transients', []);
1176
+ }
1177
+ }
1178
+
1179
+ /**
1180
+ * Truncates thumbnails cache on demand.
1181
+ *
1182
+ * @since 2.0.0
1183
+ * @global object wpdb
1184
+ */
1185
+ public function clear_thumbnails()
1186
+ {
1187
+ $wpp_uploads_dir = $this->thumbnail->get_plugin_uploads_dir();
1188
+
1189
+ if ( is_array($wpp_uploads_dir) && ! empty($wpp_uploads_dir) ) {
1190
+ $token = isset($_POST['token']) ? $_POST['token'] : null;
1191
+ $key = get_option("wpp_rand");
1192
+
1193
+ if (
1194
+ current_user_can('edit_published_posts')
1195
+ && ( $token === $key )
1196
+ ) {
1197
+ if ( is_dir($wpp_uploads_dir['basedir']) ) {
1198
+ $files = glob("{$wpp_uploads_dir['basedir']}/*"); // get all related images
1199
+
1200
+ if ( is_array($files) && ! empty($files) ) {
1201
+ foreach( $files as $file ){ // iterate files
1202
+ if ( is_file($file) ) {
1203
+ @unlink($file); // delete file
1204
+ }
1205
+ }
1206
+ echo 1;
1207
+ } else {
1208
+ echo 2;
1209
+ }
1210
+ } else {
1211
+ echo 3;
1212
+ }
1213
+ } else {
1214
+ echo 4;
1215
+ }
1216
+ }
1217
+
1218
+ wp_die();
1219
+ }
1220
+
1221
+ /**
1222
+ * Fires immediately after deleting metadata of a post.
1223
+ *
1224
+ * @since 5.0.0
1225
+ *
1226
+ * @param int $meta_id Metadata ID.
1227
+ * @param int $post_id Post ID.
1228
+ * @param string $meta_key Meta key.
1229
+ * @param mixed $meta_value Meta value.
1230
+ */
1231
+ public function updated_post_meta($meta_id, $post_id, $meta_key, $meta_value)
1232
+ {
1233
+ if ( '_thumbnail_id' == $meta_key ) {
1234
+ $this->flush_post_thumbnail($post_id);
1235
+ }
1236
+ }
1237
+
1238
+ /**
1239
+ * Fires immediately after deleting metadata of a post.
1240
+ *
1241
+ * @since 5.0.0
1242
+ *
1243
+ * @param array $meta_ids An array of deleted metadata entry IDs.
1244
+ * @param int $post_id Post ID.
1245
+ * @param string $meta_key Meta key.
1246
+ * @param mixed $meta_value Meta value.
1247
+ */
1248
+ public function deleted_post_meta($meta_ids, $post_id, $meta_key, $meta_value)
1249
+ {
1250
+ if ( '_thumbnail_id' == $meta_key ) {
1251
+ $this->flush_post_thumbnail($post_id);
1252
+ }
1253
+ }
1254
+
1255
+ /**
1256
+ * Flushes post's cached thumbnail(s).
1257
+ *
1258
+ * @since 3.3.4
1259
+ *
1260
+ * @param integer $post_id Post ID
1261
+ */
1262
+ public function flush_post_thumbnail($post_id)
1263
+ {
1264
+ $wpp_uploads_dir = $this->thumbnail->get_plugin_uploads_dir();
1265
+
1266
+ if ( is_array($wpp_uploads_dir) && ! empty($wpp_uploads_dir) ) {
1267
+ $files = glob("{$wpp_uploads_dir['basedir']}/{$post_id}-*.*"); // get all related images
1268
+
1269
+ if ( is_array($files) && ! empty($files) ) {
1270
+ foreach( $files as $file ){ // iterate files
1271
+ if ( is_file($file) ) {
1272
+ @unlink($file); // delete file
1273
+ }
1274
+ }
1275
+ }
1276
+ }
1277
+ }
1278
+
1279
+ /**
1280
+ * Purges post from data/summary tables.
1281
+ *
1282
+ * @since 3.3.0
1283
+ */
1284
+ public function purge_post_data()
1285
+ {
1286
+ if ( current_user_can('delete_posts') )
1287
+ add_action('delete_post', [$this, 'purge_post']);
1288
+ }
1289
+
1290
+ /**
1291
+ * Purges post from data/summary tables.
1292
+ *
1293
+ * @since 3.3.0
1294
+ * @global object $wpdb
1295
+ */
1296
+ public function purge_post($post_ID)
1297
+ {
1298
+ global $wpdb;
1299
+
1300
+ if ( $wpdb->get_var($wpdb->prepare("SELECT postid FROM {$wpdb->prefix}popularpostsdata WHERE postid = %d", $post_ID)) ) {
1301
+ // Delete from data table
1302
+ $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}popularpostsdata WHERE postid = %d;", $post_ID));
1303
+ // Delete from summary table
1304
+ $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}popularpostssummary WHERE postid = %d;", $post_ID));
1305
+ }
1306
+
1307
+ // Delete cached thumbnail(s) as well
1308
+ $this->flush_post_thumbnail($post_ID);
1309
+ }
1310
+
1311
+ /**
1312
+ * Purges old post data from summary table.
1313
+ *
1314
+ * @since 2.0.0
1315
+ * @global object $wpdb
1316
+ */
1317
+ public function purge_data()
1318
+ {
1319
+ global $wpdb;
1320
+ $wpdb->query("DELETE FROM {$wpdb->prefix}popularpostssummary WHERE view_date < DATE_SUB('" . Helper::curdate() . "', INTERVAL {$this->config['tools']['log']['expires_after']} DAY);");
1321
+ }
1322
+
1323
+ /**
1324
+ * Displays admin notices.
1325
+ *
1326
+ * @since 5.0.2
1327
+ */
1328
+ public function notices()
1329
+ {
1330
+ /** Performance nag */
1331
+ $performance_nag = get_option('wpp_performance_nag');
1332
+
1333
+ if (
1334
+ isset($performance_nag['status'])
1335
+ && 3 != $performance_nag['status'] // 0 = inactive, 1 = active, 2 = remind me later, 3 = dismissed
1336
+ ) {
1337
+ $now = Helper::timestamp();
1338
+
1339
+ if ( isset($_GET['wpp_dismiss_performance_notice']) || isset($_GET['wpp_remind_performance_notice']) ) {
1340
+ // User dismissed the notice
1341
+ if ( isset($_GET['wpp_dismiss_performance_notice']) ) {
1342
+ $performance_nag['status'] = 3;
1343
+ } // User asked us to remind them later
1344
+ else {
1345
+ $performance_nag['status'] = 2;
1346
+ $performance_nag['last_checked'] = $now;
1347
+ }
1348
+
1349
+ update_option('wpp_performance_nag', $performance_nag);
1350
+ echo '<script>window.location.replace("'. esc_url(remove_query_arg(['wpp_dismiss_performance_notice', 'wpp_remind_performance_notice'])) .'");</script>';
1351
+ } // Maybe display the notice
1352
+ else {
1353
+ // How much time has passed since the notice was last displayed?
1354
+ $last_checked = $performance_nag['last_checked'];
1355
+
1356
+ if ( $last_checked ) {
1357
+ $last_checked = ($now - $last_checked) / (60 * 60);
1358
+ }
1359
+
1360
+ if (
1361
+ 1 == $performance_nag['status']
1362
+ || ( 2 == $performance_nag['status'] && $last_checked && $last_checked >= 24 )
1363
+ ) {
1364
+ ?>
1365
+ <div class="notice notice-warning">
1366
+ <p><?php printf(
1367
+ __("<strong>WordPress Popular Posts:</strong> It seems your site is popular (great!) You may want to check <a href=\"%s\">these suggestions</a> to make sure your website's performance stays up to par.", 'wordpress-popular-posts'),
1368
+ 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance'
1369
+ ) ?></p>
1370
+ <?php if ( current_user_can('manage_options') ) : ?>
1371
+ <p><a href="<?php echo add_query_arg('wpp_dismiss_performance_notice', '1'); ?>">Dismiss</a> | <a href="<?php echo add_query_arg('wpp_remind_performance_notice', '1'); ?>">Remind me later</a></p>
1372
+ <?php endif; ?>
1373
+ </div>
1374
+ <?php
1375
+ }
1376
+ }
1377
+ }
1378
+ }
1379
+ }
src/Admin/admin-page.php CHANGED
@@ -1,952 +1,952 @@
1
- <?php
2
- if ( basename($_SERVER['SCRIPT_NAME']) == basename(__FILE__) )
3
- exit('Please do not load this page directly');
4
-
5
- $tabs = [
6
- 'stats' => __('Stats', 'wordpress-popular-posts'),
7
- 'tools' => __('Tools', 'wordpress-popular-posts'),
8
- 'params' => __('Parameters', 'wordpress-popular-posts'),
9
- 'debug' => 'Debug'
10
- ];
11
-
12
- // Set active tab
13
- if ( isset($_GET['tab'] ) && isset($tabs[$_GET['tab']] ) )
14
- $current = $_GET['tab'];
15
- else
16
- $current = 'stats';
17
-
18
- // Update options on form submission
19
- if ( isset($_POST['section']) ) {
20
-
21
- if ( "stats" == $_POST['section'] ) {
22
- $current = 'stats';
23
-
24
- if ( isset($_POST['wpp-admin-token']) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-stats-options') ) {
25
- $this->config['stats']['limit'] = ( \WordPressPopularPosts\Helper::is_number($_POST['stats_limit']) && $_POST['stats_limit'] > 0 ) ? $_POST['stats_limit'] : 10;
26
- $this->config['stats']['post_type'] = empty($_POST['stats_type']) ? "post,page" : $_POST['stats_type'];
27
- $this->config['stats']['freshness'] = empty($_POST['stats_freshness']) ? false : $_POST['stats_freshness'];
28
-
29
- update_option('wpp_settings_config', $this->config);
30
- echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
31
- }
32
- }
33
- elseif ( "misc" == $_POST['section'] ) {
34
- $current = 'tools';
35
-
36
- if ( isset($_POST['wpp-admin-token'] ) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-misc-options') ) {
37
- $this->config['tools']['link']['target'] = $_POST['link_target'];
38
- $this->config['tools']['css'] = $_POST['css'];
39
-
40
- update_option('wpp_settings_config', $this->config);
41
- echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
42
- }
43
- }
44
- elseif ( "thumb" == $_POST['section'] ) {
45
- $current = 'tools';
46
-
47
- if ( isset($_POST['wpp-admin-token']) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-thumbnail-options') ) {
48
- if (
49
- $_POST['thumb_source'] == "custom_field"
50
- && ( ! isset($_POST['thumb_field']) || empty($_POST['thumb_field']) )
51
- ) {
52
- echo '<div id="wpp-message" class="error fade"><p>' . __('Please provide the name of your custom field.', 'wordpress-popular-posts') . '</p></div>';
53
- }
54
- else {
55
- // thumbnail settings changed, flush transients
56
- if ( $this->config['tools']['cache']['active'] ) {
57
- $this->flush_transients();
58
- }
59
-
60
- $this->config['tools']['thumbnail']['source'] = $_POST['thumb_source'];
61
- $this->config['tools']['thumbnail']['field'] = ( ! empty($_POST['thumb_field']) ) ? $_POST['thumb_field'] : "wpp_thumbnail";
62
- $this->config['tools']['thumbnail']['default'] = ( ! empty($_POST['upload_thumb_src']) ) ? $_POST['upload_thumb_src'] : "";
63
- $this->config['tools']['thumbnail']['resize'] = $_POST['thumb_field_resize'];
64
- $this->config['tools']['thumbnail']['lazyload'] = (bool) $_POST['thumb_lazy_load'];
65
-
66
- update_option('wpp_settings_config', $this->config );
67
- echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
68
- }
69
- }
70
- }
71
- elseif ( "data" == $_POST['section'] && current_user_can('manage_options') ) {
72
- $current = 'tools';
73
-
74
- if ( isset($_POST['wpp-admin-token'] ) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-data-options') ) {
75
- $this->config['tools']['log']['level'] = $_POST['log_option'];
76
- $this->config['tools']['log']['limit'] = $_POST['log_limit'];
77
- $this->config['tools']['log']['expires_after'] = ( \WordPressPopularPosts\Helper::is_number($_POST['log_expire_time']) && $_POST['log_expire_time'] > 0 )
78
- ? $_POST['log_expire_time']
79
- : 180;
80
- $this->config['tools']['ajax'] = $_POST['ajax'];
81
-
82
- // if any of the caching settings was updated, destroy all transients created by the plugin
83
- if (
84
- $this->config['tools']['cache']['active'] != $_POST['cache']
85
- || $this->config['tools']['cache']['interval']['time'] != $_POST['cache_interval_time']
86
- || $this->config['tools']['cache']['interval']['value'] != $_POST['cache_interval_value']
87
- ) {
88
- $this->flush_transients();
89
- }
90
-
91
- $this->config['tools']['cache']['active'] = $_POST['cache'];
92
- $this->config['tools']['cache']['interval']['time'] = $_POST['cache_interval_time'];
93
- $this->config['tools']['cache']['interval']['value'] = ( isset($_POST['cache_interval_value']) && \WordPressPopularPosts\Helper::is_number($_POST['cache_interval_value']) && $_POST['cache_interval_value'] > 0 )
94
- ? $_POST['cache_interval_value']
95
- : 1;
96
-
97
- $this->config['tools']['sampling']['active'] = $_POST['sampling'];
98
- $this->config['tools']['sampling']['rate'] = ( isset($_POST['sample_rate']) && \WordPressPopularPosts\Helper::is_number($_POST['sample_rate']) && $_POST['sample_rate'] > 0 )
99
- ? $_POST['sample_rate']
100
- : 100;
101
-
102
- update_option('wpp_settings_config', $this->config);
103
- echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
104
- }
105
- }
106
-
107
- }
108
-
109
- $rand = md5(uniqid(rand(), true));
110
-
111
- if ( ! $wpp_rand = get_option("wpp_rand") ) {
112
- add_option("wpp_rand", $rand);
113
- } else {
114
- update_option("wpp_rand", $rand);
115
- }
116
-
117
- ?>
118
- <script type="text/javascript">
119
- // TOOLS
120
- function confirm_reset_cache() {
121
- if ( confirm("<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("This operation will delete all entries from WordPress Popular Posts' cache table and cannot be undone.", 'wordpress-popular-posts'); ?> \n\n" + "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("Do you want to continue?", 'wordpress-popular-posts'); ?>") ) {
122
- jQuery.post(
123
- ajaxurl,
124
- {
125
- action: 'wpp_clear_data',
126
- token: '<?php echo get_option("wpp_rand"); ?>',
127
- clear: 'cache'
128
- }, function(data){
129
- var response = "";
130
-
131
- switch( data ) {
132
- case "1":
133
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Success! The cache table has been cleared!', 'wordpress-popular-posts'); ?>";
134
- break;
135
-
136
- case "2":
137
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Error: cache table does not exist.', 'wordpress-popular-posts'); ?>";
138
- break;
139
-
140
- case "3":
141
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
142
- break;
143
-
144
- case "4":
145
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts'); ?>";
146
- break;
147
-
148
- default:
149
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
150
- break;
151
- }
152
-
153
- alert(response);
154
- }
155
- );
156
- }
157
- }
158
-
159
- function confirm_reset_all() {
160
- if ( confirm("<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("This operation will delete all stored info from WordPress Popular Posts' data tables and cannot be undone.", 'wordpress-popular-posts'); ?> \n\n" + "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("Do you want to continue?", 'wordpress-popular-posts'); ?>")) {
161
- jQuery.post(
162
- ajaxurl,
163
- {
164
- action: 'wpp_clear_data',
165
- token: '<?php echo get_option("wpp_rand"); ?>',
166
- clear: 'all'
167
- }, function(data){
168
- var response = "";
169
-
170
- switch( data ) {
171
- case "1":
172
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Success! All data have been cleared!', 'wordpress-popular-posts'); ?>";
173
- break;
174
-
175
- case "2":
176
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Error: one or both data tables are missing.', 'wordpress-popular-posts'); ?>";
177
- break;
178
-
179
- case "3":
180
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
181
- break;
182
-
183
- case "4":
184
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts'); ?>";
185
- break;
186
-
187
- default:
188
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
189
- break;
190
- }
191
-
192
- alert(response);
193
- }
194
- );
195
- }
196
- }
197
-
198
- function confirm_clear_image_cache() {
199
- if ( confirm("<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("This operation will delete all cached thumbnails and cannot be undone.", 'wordpress-popular-posts'); ?> \n\n" + "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("Do you want to continue?", 'wordpress-popular-posts'); ?>") ) {
200
- jQuery.post(
201
- ajaxurl,
202
- {
203
- action: 'wpp_clear_thumbnail',
204
- token: '<?php echo get_option("wpp_rand"); ?>'
205
- }, function(data){
206
- var response = "";
207
-
208
- switch( data ) {
209
- case "1":
210
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Success! All files have been deleted!', 'wordpress-popular-posts'); ?>";
211
- break;
212
-
213
- case "2":
214
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('The thumbnail cache is already empty!', 'wordpress-popular-posts'); ?>";
215
- break;
216
-
217
- case "3":
218
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
219
- break;
220
-
221
- case "4":
222
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts'); ?>";
223
- break;
224
-
225
- default:
226
- response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
227
- break;
228
- }
229
-
230
- alert(response);
231
- }
232
- );
233
- }
234
- }
235
- </script>
236
-
237
- <nav id="wpp-menu">
238
- <ul>
239
- <li><a href="#" title="<?php esc_attr_e('Menu'); ?>"><span><?php _e('Menu'); ?></span></a></li>
240
- <li <?php echo ('stats' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=stats'); ?>" title="<?php esc_attr_e('Stats', 'wordpress-popular-posts'); ?>"><span><?php _e('Stats', 'wordpress-popular-posts'); ?></span></a></li>
241
- <li <?php echo ('tools' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=tools'); ?>" title="<?php esc_attr_e('Tools', 'wordpress-popular-posts'); ?>"><span><?php _e('Tools', 'wordpress-popular-posts'); ?></span></a></li>
242
- <li <?php echo ('params' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=params'); ?>" title="<?php esc_attr_e('Parameters', 'wordpress-popular-posts'); ?>"><span><?php _e('Parameters', 'wordpress-popular-posts'); ?></span></a></li>
243
- <li <?php echo ('debug' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=debug'); ?>" title="Debug"><span>Debug</span></a></li>
244
- </ul>
245
- </nav>
246
-
247
- <div class="wpp-wrapper wpp-section-<?php echo $current; ?>">
248
- <div class="wpp-header">
249
- <h2>WordPress Popular Posts</h2>
250
- <h3><?php echo $tabs[$current]; ?></h3>
251
- </div>
252
-
253
- <?php
254
- // Stats chart
255
- if ( 'stats' == $current ) {
256
- $chart_data = json_decode(
257
- $this->get_chart_data($this->config['stats']['range'], strtoupper($this->config['stats']['time_unit']), $this->config['stats']['time_quantity']),
258
- true
259
- );
260
- ?>
261
-
262
- <a href="#" id="wpp-stats-config-btn" class="dashicons dashicons-admin-generic"></a>
263
-
264
- <div id="wpp-stats-config" class="wpp-lightbox">
265
- <form action="" method="post" id="wpp_stats_options" name="wpp_stats_options">
266
- <label for="stats_type"><?php _e("Post type", 'wordpress-popular-posts'); ?>:</label>
267
- <input type="text" name="stats_type" value="<?php echo esc_attr($this->config['stats']['post_type']); ?>" size="15">
268
-
269
- <label for="stats_limits"><?php _e("Limit", 'wordpress-popular-posts'); ?>:</label>
270
- <input type="text" name="stats_limit" value="<?php echo $this->config['stats']['limit']; ?>" size="5">
271
-
272
- <label for="stats_freshness"><input type="checkbox" class="checkbox" <?php echo ($this->config['stats']['freshness']) ? 'checked="checked"' : ''; ?> id="stats_freshness" name="stats_freshness"> <small><?php _e('Display only posts published within the selected Time Range', 'wordpress-popular-posts'); ?></small></label>
273
-
274
- <div class="clear"></div>
275
- <br /><br />
276
-
277
- <input type="hidden" name="section" value="stats">
278
- <button type="submit" class="button-primary action"><?php _e("Apply", 'wordpress-popular-posts'); ?></button>
279
- <button class="button-secondary action right"><?php _e("Cancel"); ?></button>
280
-
281
- <?php wp_nonce_field('wpp-update-stats-options', 'wpp-admin-token'); ?>
282
- </form>
283
- </div>
284
-
285
- <div id="wpp-stats-range" class="wpp-lightbox">
286
- <form action="" method="post">
287
- <ul class="wpp-lightbox-tabs">
288
- <li class="active"><a href="#"><?php _e('Custom Time Range', 'wordpress-popular-posts'); ?></a></li>
289
- <li><a href="#"><?php _e('Date Range', 'wordpress-popular-posts'); ?></a></li>
290
- </ul>
291
-
292
- <div class="wpp-lightbox-tab-content wpp-lightbox-tab-content-active" id="custom-time-range">
293
- <input type="text" id="stats_range_time_quantity" name="stats_range_time_quantity" value="<?php echo $this->config['stats']['time_quantity']; ?>">
294
-
295
- <select id="stats_range_time_unit" name="stats_range_time_unit">
296
- <option <?php if ($this->config['stats']['time_unit'] == "minute") { ?>selected="selected"<?php } ?> value="minute"><?php _e("Minute(s)", 'wordpress-popular-posts'); ?></option>
297
- <option <?php if ($this->config['stats']['time_unit'] == "hour") { ?>selected="selected"<?php } ?> value="hour"><?php _e("Hour(s)", 'wordpress-popular-posts'); ?></option>
298
- <option <?php if ($this->config['stats']['time_unit'] == "day") { ?>selected="selected"<?php } ?> value="day"><?php _e("Day(s)", 'wordpress-popular-posts'); ?></option>
299
- </select>
300
- </div>
301
-
302
- <div class="wpp-lightbox-tab-content" id="custom-date-range">
303
- <input type="text" id="stats_range_date" name="stats_range_date" value="" placeholder="<?php esc_attr_e('Select a date...', 'wordpress-popular-posts'); ?>" readonly>
304
- </div>
305
-
306
- <div class="clear"></div>
307
- <br />
308
-
309
- <button type="submit" class="button-primary action">
310
- <?php _e("Apply", 'wordpress-popular-posts'); ?>
311
- </button>
312
- <button class="button-secondary action right">
313
- <?php _e("Cancel"); ?>
314
- </button>
315
- </form>
316
- </div>
317
-
318
- <div id="wpp-chart-wrapper">
319
- <h4><?php echo $chart_data['totals']['label_summary']; ?></h4>
320
- <h5><?php echo $chart_data['totals']['label_date_range']; ?></h5>
321
-
322
- <ul class="wpp-header-nav" id="wpp-time-ranges">
323
- <li <?php echo ('daily' == $this->config['stats']['range'] || 'today' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="today" title="<?php esc_attr_e('Today', 'wordpress-popular-posts'); ?>"><?php _e('Today', 'wordpress-popular-posts'); ?></a></li>
324
- <li <?php echo ('daily' == $this->config['stats']['range'] || 'last24hours' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="last24hours" title="<?php esc_attr_e('Last 24 hours', 'wordpress-popular-posts'); ?>">24h</a></li>
325
- <li <?php echo ('weekly' == $this->config['stats']['range'] || 'last7days' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="last7days" title="<?php esc_attr_e('Last 7 days', 'wordpress-popular-posts'); ?>">7d</a></li>
326
- <li <?php echo ('monthly' == $this->config['stats']['range'] || 'last30days' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="last30days" title="<?php esc_attr_e('Last 30 days', 'wordpress-popular-posts'); ?>">30d</a></li>
327
- <li <?php echo ('custom' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="custom" title="<?php esc_attr_e('Custom', 'wordpress-popular-posts'); ?>"><?php _e('Custom', 'wordpress-popular-posts'); ?></a></li>
328
- </ul>
329
-
330
- <div id="wpp-chart">
331
- <p><?php echo sprintf( __('Err... A nice little chart is supposed to be here, instead you are seeing this because your browser is too old. <br /> Please <a href="%s" target="_blank">get a better browser</a>.', 'wordpress-popular-posts'), 'https://browsehappy.com/'); ?></p>
332
-
333
- <script>
334
- if ( WPPChart.canRender() ) {
335
- jQuery("#wpp-chart p").remove();
336
- WPPChart.init('wpp-chart');
337
- }
338
- </script>
339
- </div>
340
- </div>
341
- <?php
342
- } // End stats chart
343
- ?>
344
-
345
- <div id="wpp-listing" class="wpp-content"<?php echo ('stats' == $current ) ? '' : ' style="display: none;"'; ?>>
346
- <ul class="wpp-tabbed-nav">
347
- <li class="active"><a href="#" title="<?php esc_attr_e('Most viewed', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-eye"></span><span><?php _e('Most viewed', 'wordpress-popular-posts'); ?></span></a></li>
348
- <li><a href="#" title="<?php esc_attr_e('Most commented', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-comment"></span><span><?php _e('Most commented', 'wordpress-popular-posts'); ?></span></a></li>
349
- <li><a href="#" title="<?php esc_attr_e('Trending now', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-rocket"></span><span><?php _e('Trending now', 'wordpress-popular-posts'); ?></span></a></li>
350
- <li><a href="#" title="<?php esc_attr_e('Hall of Fame', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-award"></span><span><?php _e('Hall of Fame', 'wordpress-popular-posts'); ?></span></a></li>
351
- </ul>
352
-
353
- <div class="wpp-tab-content wpp-tab-content-active">
354
- <span class="spinner"></span>
355
- </div>
356
-
357
- <div class="wpp-tab-content">
358
- <span class="spinner"></span>
359
- </div>
360
-
361
- <div class="wpp-tab-content">
362
- <span class="spinner"></span>
363
- </div>
364
-
365
- <div class="wpp-tab-content">
366
- <?php
367
- $args = [
368
- 'range' => 'all',
369
- 'post_type' => $this->config['stats']['post_type'],
370
- 'order_by' => 'views',
371
- 'limit' => $this->config['stats']['limit'],
372
- 'stats_tag' => [
373
- 'comment_count' => 1,
374
- 'views' => 1,
375
- 'date' => [
376
- 'active' => 1
377
- ]
378
- ]
379
- ];
380
- $hof = new \WordPressPopularPosts\Query($args);
381
- $posts = $hof->get_posts();
382
-
383
- $this->render_list($posts, 'hof');
384
- ?>
385
- </div>
386
- </div>
387
-
388
- <!-- Start tools -->
389
- <div id="wpp_tools" <?php echo ( "tools" == $current ) ? '' : ' style="display: none;"'; ?>>
390
- <h3 class="wmpp-subtitle"><?php _e("Thumbnails", 'wordpress-popular-posts'); ?></h3>
391
-
392
- <form action="" method="post" id="wpp_thumbnail_options" name="wpp_thumbnail_options">
393
- <table class="form-table">
394
- <tbody>
395
- <tr valign="top">
396
- <th scope="row"><label for="thumb_default"><?php _e("Default thumbnail", 'wordpress-popular-posts'); ?>:</label></th>
397
- <td>
398
- <div id="thumb-review">
399
- <img src="<?php echo ($this->config['tools']['thumbnail']['default'] ) ? str_replace(parse_url($this->config['tools']['thumbnail']['default'], PHP_URL_SCHEME) . ':', '', $this->config['tools']['thumbnail']['default']) : plugins_url() . '/wordpress-popular-posts/assets/images/no_thumb.jpg'; ?>" alt="" />
400
- </div>
401
-
402
- <input id="upload_thumb_button" type="button" class="button" value="<?php _e("Change thumbnail", 'wordpress-popular-posts'); ?>">
403
- <input type="hidden" id="upload_thumb_src" name="upload_thumb_src" value="">
404
-
405
- <p class="description"><?php _e("This image will be displayed when no thumbnail is available", 'wordpress-popular-posts'); ?>.</p>
406
- </td>
407
- </tr>
408
- <tr valign="top">
409
- <th scope="row"><label for="thumb_source"><?php _e("Pick image from", 'wordpress-popular-posts'); ?>:</label></th>
410
- <td>
411
- <select name="thumb_source" id="thumb_source">
412
- <option <?php if ($this->config['tools']['thumbnail']['source'] == "featured") { ?>selected="selected"<?php } ?> value="featured"><?php _e("Featured image", 'wordpress-popular-posts'); ?></option>
413
- <option <?php if ($this->config['tools']['thumbnail']['source'] == "first_image") { ?>selected="selected"<?php } ?> value="first_image"><?php _e("First image on post", 'wordpress-popular-posts'); ?></option>
414
- <option <?php if ($this->config['tools']['thumbnail']['source'] == "first_attachment") { ?>selected="selected"<?php } ?> value="first_attachment"><?php _e("First attachment", 'wordpress-popular-posts'); ?></option>
415
- <option <?php if ($this->config['tools']['thumbnail']['source'] == "custom_field") { ?>selected="selected"<?php } ?> value="custom_field"><?php _e("Custom field", 'wordpress-popular-posts'); ?></option>
416
- </select>
417
- <br />
418
- <p class="description"><?php _e("Tell WordPress Popular Posts where it should get thumbnails from", 'wordpress-popular-posts'); ?>.</p>
419
- </td>
420
- </tr>
421
- <tr valign="top">
422
- <th scope="row"><label for="thumb_lazy_load"><?php _e("Lazy load", 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#lazy-loading" target="_blank" title="<?php _e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
423
- <td>
424
- <select name="thumb_lazy_load" id="thumb_lazy_load">
425
- <option <?php if ( ! $this->config['tools']['thumbnail']['lazyload'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("No", 'wordpress-popular-posts'); ?></option>
426
- <option <?php if ( $this->config['tools']['thumbnail']['lazyload'] ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Yes", 'wordpress-popular-posts'); ?></option>
427
- </select>
428
- </td>
429
- </tr>
430
- <tr valign="top" <?php if ($this->config['tools']['thumbnail']['source'] != "custom_field") { ?>style="display: none;"<?php } ?> id="row_custom_field">
431
- <th scope="row"><label for="thumb_field"><?php _e("Custom field name", 'wordpress-popular-posts'); ?>:</label></th>
432
- <td>
433
- <input type="text" id="thumb_field" name="thumb_field" value="<?php echo esc_attr($this->config['tools']['thumbnail']['field']); ?>" size="10" <?php if ($this->config['tools']['thumbnail']['source'] != "custom_field") { ?>style="display: none;"<?php } ?> />
434
- </td>
435
- </tr>
436
- <tr valign="top" <?php if ($this->config['tools']['thumbnail']['source'] != "custom_field") { ?>style="display: none;"<?php } ?> id="row_custom_field_resize">
437
- <th scope="row"><label for="thumb_field_resize"><?php _e("Resize image from Custom field?", 'wordpress-popular-posts'); ?>:</label></th>
438
- <td>
439
- <select name="thumb_field_resize" id="thumb_field_resize">
440
- <option <?php if ( !$this->config['tools']['thumbnail']['resize'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("No, I will upload my own thumbnail", 'wordpress-popular-posts'); ?></option>
441
- <option <?php if ($this->config['tools']['thumbnail']['resize'] == 1 ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Yes", 'wordpress-popular-posts'); ?></option>
442
- </select>
443
- </td>
444
- </tr>
445
- <?php
446
- $wp_upload_dir = wp_get_upload_dir();
447
- if ( is_dir($wp_upload_dir['basedir'] . "/" . 'wordpress-popular-posts') ) :
448
- ?>
449
- <tr valign="top">
450
- <th scope="row"></th>
451
- <td>
452
- <input type="button" name="wpp-reset-cache" id="wpp-reset-cache" class="button-secondary" value="<?php _e("Empty image cache", 'wordpress-popular-posts'); ?>" onclick="confirm_clear_image_cache()">
453
- <p class="description"><?php _e("Use this button to clear WPP's thumbnails cache", 'wordpress-popular-posts'); ?>.</p>
454
- </td>
455
- </tr>
456
- <?php
457
- endif;
458
- ?>
459
- <tr valign="top">
460
- <td colspan="2">
461
- <input type="hidden" name="section" value="thumb">
462
- <input type="submit" class="button-primary action" id="btn_th_ops" value="<?php _e("Apply", 'wordpress-popular-posts'); ?>" name="">
463
- </td>
464
- </tr>
465
- </tbody>
466
- </table>
467
-
468
- <?php wp_nonce_field('wpp-update-thumbnail-options', 'wpp-admin-token'); ?>
469
- </form>
470
- <br />
471
- <p style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>; float:none; clear:both;">&nbsp;</p>
472
-
473
- <h3 class="wmpp-subtitle" style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>"><?php _e("Data", 'wordpress-popular-posts'); ?></h3>
474
-
475
- <form action="" method="post" id="wpp_ajax_options" name="wpp_ajax_options" style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>">
476
- <table class="form-table">
477
- <tbody>
478
- <tr valign="top">
479
- <th scope="row"><label for="log_option"><?php _e("Log views from", 'wordpress-popular-posts'); ?>:</label></th>
480
- <td>
481
- <select name="log_option" id="log_option">
482
- <option <?php if ($this->config['tools']['log']['level'] == 0) { ?>selected="selected"<?php } ?> value="0"><?php _e("Visitors only", 'wordpress-popular-posts'); ?></option>
483
- <option <?php if ($this->config['tools']['log']['level'] == 2) { ?>selected="selected"<?php } ?> value="2"><?php _e("Logged-in users only", 'wordpress-popular-posts'); ?></option>
484
- <option <?php if ($this->config['tools']['log']['level'] == 1) { ?>selected="selected"<?php } ?> value="1"><?php _e("Everyone", 'wordpress-popular-posts'); ?></option>
485
- </select>
486
- <br />
487
- </td>
488
- </tr>
489
- <tr valign="top">
490
- <th scope="row"><label for="log_limit"><?php _e("Log limit", 'wordpress-popular-posts'); ?>:</label></th>
491
- <td>
492
- <select name="log_limit" id="log_limit">
493
- <option <?php if ($this->config['tools']['log']['limit'] == 0) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
494
- <option <?php if ($this->config['tools']['log']['limit'] == 1) { ?>selected="selected"<?php } ?> value="1"><?php _e("Keep data for", 'wordpress-popular-posts'); ?></option>
495
- </select>
496
-
497
- <label for="log_expire_time"<?php echo ($this->config['tools']['log']['limit'] == 0) ? ' style="display: none;"' : ''; ?>>
498
- <input type="text" id="log_expire_time" name="log_expire_time" value="<?php echo esc_attr($this->config['tools']['log']['expires_after']); ?>" size="3"> <?php _e("day(s)", 'wordpress-popular-posts'); ?>
499
- </label>
500
-
501
- <p class="description"<?php echo ($this->config['tools']['log']['limit'] == 0) ? ' style="display: none;"' : ''; ?>><?php _e("Data older than the specified time frame will be automatically discarded", 'wordpress-popular-posts'); ?>.</p>
502
-
503
- <br <?php echo (1 == $this->config['tools']['log']['limit']) ? 'style="display: none;"' : ''; ?>/>
504
- </td>
505
- </tr>
506
- <tr valign="top">
507
- <th scope="row"><label for="ajax"><?php _e("Ajaxify widget", 'wordpress-popular-posts'); ?>:</label></th>
508
- <td>
509
- <select name="ajax" id="ajax">
510
- <option <?php if (! $this->config['tools']['ajax']) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
511
- <option <?php if ($this->config['tools']['ajax']) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enabled", 'wordpress-popular-posts'); ?></option>
512
- </select>
513
-
514
- <br />
515
- <p class="description"><?php _e("If you are using a caching plugin such as WP Super Cache, enabling this feature will keep the popular list from being cached by it", 'wordpress-popular-posts'); ?>.</p>
516
- </td>
517
- </tr>
518
- <tr valign="top">
519
- <th scope="row"><label for="cache"><?php _e("Data Caching", 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#caching" target="_blank" title="<?php _e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
520
- <td>
521
- <select name="cache" id="cache">
522
- <option <?php if ( ! $this->config['tools']['cache']['active'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("Never cache", 'wordpress-popular-posts'); ?></option>
523
- <option <?php if ( $this->config['tools']['cache']['active'] ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enable caching", 'wordpress-popular-posts'); ?></option>
524
- </select>
525
-
526
- <br />
527
- <p class="description"><?php _e("WPP can cache the popular list for a specified amount of time. Recommended for large / high traffic sites", 'wordpress-popular-posts'); ?>.</p>
528
- </td>
529
- </tr>
530
- <tr valign="top" <?php if ( ! $this->config['tools']['cache']['active'] ) { ?>style="display: none;"<?php } ?> id="cache_refresh_interval">
531
- <th scope="row"><label for="cache_interval_value"><?php _e("Refresh cache every", 'wordpress-popular-posts'); ?>:</label></th>
532
- <td>
533
- <input name="cache_interval_value" type="text" id="cache_interval_value" value="<?php echo ( isset($this->config['tools']['cache']['interval']['value']) ) ? (int) $this->config['tools']['cache']['interval']['value'] : 1; ?>" class="small-text">
534
- <select name="cache_interval_time" id="cache_interval_time">
535
- <option <?php if ($this->config['tools']['cache']['interval']['time'] == "minute") { ?>selected="selected"<?php } ?> value="minute"><?php _e("Minute(s)", 'wordpress-popular-posts'); ?></option>
536
- <option <?php if ($this->config['tools']['cache']['interval']['time'] == "hour") { ?>selected="selected"<?php } ?> value="hour"><?php _e("Hour(s)", 'wordpress-popular-posts'); ?></option>
537
- <option <?php if ($this->config['tools']['cache']['interval']['time'] == "day") { ?>selected="selected"<?php } ?> value="day"><?php _e("Day(s)", 'wordpress-popular-posts'); ?></option>
538
- <option <?php if ($this->config['tools']['cache']['interval']['time'] == "week") { ?>selected="selected"<?php } ?> value="week"><?php _e("Week(s)", 'wordpress-popular-posts'); ?></option>
539
- <option <?php if ($this->config['tools']['cache']['interval']['time'] == "month") { ?>selected="selected"<?php } ?> value="month"><?php _e("Month(s)", 'wordpress-popular-posts'); ?></option>
540
- <option <?php if ($this->config['tools']['cache']['interval']['time'] == "year") { ?>selected="selected"<?php } ?> value="month"><?php _e("Year(s)", 'wordpress-popular-posts'); ?></option>
541
- </select>
542
- <br />
543
- <p class="description" style="display: none;" id="cache_too_long"><?php _e("Really? That long?", 'wordpress-popular-posts'); ?></p>
544
- </td>
545
- </tr>
546
- <tr valign="top">
547
- <th scope="row"><label for="sampling"><?php _e("Data Sampling", 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#data-sampling" target="_blank" title="<?php _e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
548
- <td>
549
- <select name="sampling" id="sampling">
550
- <option <?php if ( !$this->config['tools']['sampling']['active'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
551
- <option <?php if ( $this->config['tools']['sampling']['active'] ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enabled", 'wordpress-popular-posts'); ?></option>
552
- </select>
553
-
554
- <br />
555
- <p class="description"><?php echo sprintf( __('By default, WordPress Popular Posts stores in database every single visit your site receives. For small / medium sites this is generally OK, but on large / high traffic sites the constant writing to the database may have an impact on performance. With <a href="%1$s" target="_blank">data sampling</a>, WordPress Popular Posts will store only a subset of your traffic and report on the tendencies detected in that sample set (for more, <a href="%2$s" target="_blank">please read here</a>)', 'wordpress-popular-posts'), 'http://en.wikipedia.org/wiki/Sample_%28statistics%29', 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#data-sampling'); ?>.</p>
556
- </td>
557
- </tr>
558
- <tr valign="top" <?php if ( ! $this->config['tools']['sampling']['active'] ) { ?>style="display: none;"<?php } ?>>
559
- <th scope="row"><label for="sample_rate"><?php _e("Sample Rate", 'wordpress-popular-posts'); ?>:</label></th>
560
- <td>
561
- <input name="sample_rate" type="text" id="sample_rate" value="<?php echo ( isset($this->config['tools']['sampling']['rate']) ) ? (int) $this->config['tools']['sampling']['rate'] : 100; ?>" class="small-text">
562
- <br />
563
- <p class="description"><?php echo sprintf(__("A sampling rate of %d is recommended for large / high traffic sites. For lower traffic sites, you should lower the value", 'wordpress-popular-posts'), 100); ?>.</p>
564
- </td>
565
- </tr>
566
- <tr valign="top">
567
- <td colspan="2">
568
- <input type="hidden" name="section" value="data">
569
- <input type="submit" class="button-primary action" id="btn_ajax_ops" value="<?php _e("Apply", 'wordpress-popular-posts'); ?>" name="">
570
- </td>
571
- </tr>
572
- </tbody>
573
- </table>
574
-
575
- <?php wp_nonce_field('wpp-update-data-options', 'wpp-admin-token'); ?>
576
- </form>
577
- <br />
578
- <p style="display: block; float:none; clear: both;">&nbsp;</p>
579
-
580
- <h3 class="wmpp-subtitle"><?php _e("Miscellaneous", 'wordpress-popular-posts'); ?></h3>
581
-
582
- <form action="" method="post" id="wpp_link_options" name="wpp_link_options">
583
- <table class="form-table">
584
- <tbody>
585
- <tr valign="top">
586
- <th scope="row"><label for="link_target"><?php _e("Open links in", 'wordpress-popular-posts'); ?>:</label></th>
587
- <td>
588
- <select name="link_target" id="link_target">
589
- <option <?php if ($this->config['tools']['link']['target'] == '_self') { ?>selected="selected"<?php } ?> value="_self"><?php _e("Current window", 'wordpress-popular-posts'); ?></option>
590
- <option <?php if ($this->config['tools']['link']['target'] == '_blank') { ?>selected="selected"<?php } ?> value="_blank"><?php _e("New tab/window", 'wordpress-popular-posts'); ?></option>
591
- </select>
592
- <br />
593
- </td>
594
- </tr>
595
- <tr valign="top">
596
- <th scope="row"><label for="css"><?php _e("Use plugin's stylesheet", 'wordpress-popular-posts'); ?>:</label></th>
597
- <td>
598
- <select name="css" id="css">
599
- <option <?php if ($this->config['tools']['css']) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enabled", 'wordpress-popular-posts'); ?></option>
600
- <option <?php if (!$this->config['tools']['css']) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
601
- </select>
602
- <br />
603
- <p class="description"><?php _e("By default, the plugin includes a stylesheet called wpp.css which you can use to style your popular posts listing. If you wish to use your own stylesheet or do not want it to have it included in the header section of your site, use this.", 'wordpress-popular-posts'); ?></p>
604
- </td>
605
- </tr>
606
- <tr valign="top">
607
- <td colspan="2">
608
- <input type="hidden" name="section" value="misc">
609
- <input type="submit" class="button-primary action" value="<?php _e("Apply", 'wordpress-popular-posts'); ?>" name="">
610
- </td>
611
- </tr>
612
- </tbody>
613
- </table>
614
-
615
- <?php wp_nonce_field('wpp-update-misc-options', 'wpp-admin-token'); ?>
616
- </form>
617
- <br />
618
- <p style="display: block; float: none; clear: both;">&nbsp;</p>
619
-
620
- <div style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>">
621
- <br /><br />
622
-
623
- <p><?php _e('WordPress Popular Posts maintains data in two separate tables: one for storing the most popular entries on a daily basis (from now on, "cache"), and another one to keep the All-time data (from now on, "historical data" or just "data"). If for some reason you need to clear the cache table, or even both historical and cache tables, please use the buttons below to do so.', 'wordpress-popular-posts') ?></p>
624
- <p><input type="button" name="wpp-reset-cache" id="wpp-reset-cache" class="button-secondary" value="<?php _e("Empty cache", 'wordpress-popular-posts'); ?>" onclick="confirm_reset_cache()"> <label for="wpp-reset-cache"><small><?php _e('Use this button to manually clear entries from WPP cache only', 'wordpress-popular-posts'); ?></small></label></p>
625
- <p><input type="button" name="wpp-reset-all" id="wpp-reset-all" class="button-secondary" value="<?php _e("Clear all data", 'wordpress-popular-posts'); ?>" onclick="confirm_reset_all()"> <label for="wpp-reset-all"><small><?php _e('Use this button to manually clear entries from all WPP data tables', 'wordpress-popular-posts'); ?></small></label></p>
626
- </div>
627
- </div>
628
- <!-- End tools -->
629
-
630
- <!-- Start params -->
631
- <div id="wpp_params" <?php echo ( "params" == $current ) ? '' : ' style="display: none;"'; ?>>
632
- <div>
633
- <p><?php printf( __('With the following parameters you can customize the popular posts list when using either the <a href="%1$s">wpp_get_mostpopular() template tag</a> or the <a href="%2$s">[wpp] shortcode</a>.', 'wordpress-popular-posts'),
634
- 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags#wpp_get_mostpopular',
635
- 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/1.-Using-WPP-on-posts-&-pages'
636
- ); ?></p>
637
- <br />
638
-
639
- <div style="overflow-x: auto;">
640
- <table cellspacing="0" class="wp-list-table">
641
- <thead>
642
- <tr>
643
- <th class="manage-column column-title"><?php _e('Parameter', 'wordpress-popular-posts'); ?></th>
644
- <th class="manage-column column-title"><?php _e('What it does ', 'wordpress-popular-posts'); ?></th>
645
- <th class="manage-column column-title"><?php _e('Possible values', 'wordpress-popular-posts'); ?></th>
646
- <th class="manage-column column-title"><?php _e('Defaults to', 'wordpress-popular-posts'); ?></th>
647
- <th class="manage-column column-title"><?php _e('Example', 'wordpress-popular-posts'); ?></th>
648
- </tr>
649
- </thead>
650
- <tbody>
651
- <tr>
652
- <td><strong>header</strong></td>
653
- <td><?php _e('Sets a heading for the list', 'wordpress-popular-posts'); ?></td>
654
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
655
- <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
656
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'header' => 'Popular Posts'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp header='Popular Posts']<br /><br /></td>
657
- </tr>
658
- <tr class="alternate">
659
- <td><strong>header_start</strong></td>
660
- <td><?php _e('Set the opening tag for the heading of the list', 'wordpress-popular-posts'); ?></td>
661
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
662
- <td>&lt;h2&gt;</td>
663
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'header' => 'Popular Posts', <br />&nbsp;&nbsp;&nbsp;&nbsp;'header_start' => '&lt;h3 class="title"&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'header_end' => '&lt;/h3&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp header='Popular Posts' header_start='&lt;h3 class="title"&gt;' header_end='&lt;/h3&gt;']<br /><br /></td>
664
- </tr>
665
- <tr>
666
- <td><strong>header_end</strong></td>
667
- <td><?php _e('Set the closing tag for the heading of the list', 'wordpress-popular-posts'); ?></td>
668
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
669
- <td>&lt;/h2&gt;</td>
670
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'header' => 'Popular Posts', <br />&nbsp;&nbsp;&nbsp;&nbsp;'header_start' => '&lt;h3 class="title"&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'header_end' => '&lt;/h3&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp header='Popular Posts' header_start='&lt;h3 class="title"&gt;' header_end='&lt;/h3&gt;']<br /><br /></td>
671
- </tr>
672
- <tr class="alternate">
673
- <td><strong>limit</strong></td>
674
- <td><?php _e('Sets the maximum number of popular posts to be shown on the listing', 'wordpress-popular-posts'); ?></td>
675
- <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
676
- <td>10</td>
677
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'limit' => 5<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp limit=5]<br /><br /></td>
678
- </tr>
679
- <tr>
680
- <td><strong>range</strong></td>
681
- <td><?php _e('Tells WordPress Popular Posts to retrieve the most popular entries within the time range specified by you', 'wordpress-popular-posts'); ?></td>
682
- <td>"last24hours", "last7days", "last30days", "all", "custom"</td>
683
- <td>last24hours</td>
684
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'last7days'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='last7days']<br /><br /></td>
685
- </tr>
686
- <tr class="alternate">
687
- <td><strong>time_quantity</strong></td>
688
- <td><?php _e('Especifies the number of time units of the custom time range', 'wordpress-popular-posts'); ?></td>
689
- <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
690
- <td>24</td>
691
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'custom',<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_quantity' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_unit' => 'hour'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='custom' time_quantity=1 time_unit='hour']<br /><br /></td>
692
- </tr>
693
- <tr>
694
- <td><strong>time_unit</strong></td>
695
- <td><?php _e('Especifies the time unit of the custom time range', 'wordpress-popular-posts'); ?></td>
696
- <td>minute, hour, day, week, month</td>
697
- <td>hour</td>
698
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'custom',<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_quantity' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_unit' => 'hour'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='custom' time_quantity=1 time_unit='hour']<br /><br /></td>
699
- </tr>
700
- <tr class="alternate">
701
- <td><strong>freshness</strong></td>
702
- <td><?php _e('Tells WordPress Popular Posts to retrieve the most popular entries published within the time range specified by you', 'wordpress-popular-posts'); ?></td>
703
- <td>1 (true), 0 (false)</td>
704
- <td>0</td>
705
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'weekly',<br />&nbsp;&nbsp;&nbsp;&nbsp;'freshness' => 1<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='last7days' freshness=1]<br /><br /></td>
706
- </tr>
707
- <tr>
708
- <td><strong>order_by</strong></td>
709
- <td><?php _e('Sets the sorting option of the popular posts', 'wordpress-popular-posts'); ?></td>
710
- <td>"comments", "views", "avg" <?php _e('(for average views per day)', 'wordpress-popular-posts'); ?></td>
711
- <td>views</td>
712
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'order_by' => 'comments'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp order_by='comments']<br /><br /></td>
713
- </tr>
714
- <tr class="alternate">
715
- <td><strong>post_type</strong></td>
716
- <td><?php _e('Defines the type of posts to show on the listing', 'wordpress-popular-posts'); ?></td>
717
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
718
- <td>post</td>
719
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_type' => 'post,page,your-custom-post-type'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp post_type='post,page,your-custom-post-type']<br /><br /></td>
720
- </tr>
721
- <tr>
722
- <td><strong>pid</strong></td>
723
- <td><?php _e('If set, WordPress Popular Posts will exclude the specified post(s) ID(s) form the listing.', 'wordpress-popular-posts'); ?></td>
724
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
725
- <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
726
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'pid' => '60,25,31'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp pid='60,25,31']<br /><br /></td>
727
- </tr>
728
- <tr class="alternate">
729
- <td><strong>cat</strong></td>
730
- <td><?php _e('If set, WordPress Popular Posts will retrieve all entries that belong to the specified category ID(s). If a minus sign is used, entries associated to the category will be excluded instead.', 'wordpress-popular-posts'); ?></td>
731
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
732
- <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
733
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'cat' => '1,55,-74'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp cat='1,55,-74']<br /><br /></td>
734
- </tr>
735
- <tr>
736
- <td><strong>taxonomy</strong></td>
737
- <td><?php _e('If set, WordPress Popular Posts will filter posts by a given taxonomy.', 'wordpress-popular-posts'); ?></td>
738
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
739
- <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
740
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' => 'post_tag',<br />&nbsp;&nbsp;&nbsp;&nbsp;'term_id' => '118,75,15'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' => 'category; post_tag',<br />&nbsp;&nbsp;&nbsp;&nbsp;'term_id' => '1,55,-74; 118,75,15'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp taxonomy='post_tag' term_id='118,75,15']<br /><br />[wpp taxonomy='category; post_tag' term_id='1,55,-74; 118,75,15']<br /><br /></td>
741
- </tr>
742
- <tr class="alternate">
743
- <td><strong>term_id</strong></td>
744
- <td><?php _e('If set, WordPress Popular Posts will retrieve all entries that belong to the specified term ID(s). If a minus sign is used, entries associated to the term(s) will be excluded instead.', 'wordpress-popular-posts'); ?></td>
745
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
746
- <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
747
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' => 'post_tag',<br />&nbsp;&nbsp;&nbsp;&nbsp;'term_id' => '118,75,15'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp taxonomy='post_tag' term_id='118,75,15']<br /><br /></td>
748
- </tr>
749
- <tr>
750
- <td><strong>author</strong></td>
751
- <td><?php _e('If set, WordPress Popular Posts will retrieve all entries created by specified author(s) ID(s).', 'wordpress-popular-posts'); ?></td>
752
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
753
- <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
754
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'author' => '75,8,120'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp author='75,8,120']<br /><br /></td>
755
- </tr>
756
- <tr class="alternate">
757
- <td><strong>title_length</strong></td>
758
- <td><?php _e('If set, WordPress Popular Posts will shorten each post title to "n" characters whenever possible', 'wordpress-popular-posts'); ?></td>
759
- <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
760
- <td>25</td>
761
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'title_length' => 25<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp title_length=25]<br /><br /></td>
762
- </tr>
763
- <tr>
764
- <td><strong>title_by_words</strong></td>
765
- <td><?php _e('If set to 1, WordPress Popular Posts will shorten each post title to "n" words instead of characters', 'wordpress-popular-posts'); ?></td>
766
- <td>1 (true), (0) false</td>
767
- <td>0</td>
768
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'title_by_words' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'title_length' => 25<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp title_by_words=1 title_length=25]<br /><br /></td>
769
- </tr>
770
- <tr class="alternate">
771
- <td><strong>excerpt_length</strong></td>
772
- <td><?php _e('If set, WordPress Popular Posts will build and include an excerpt of "n" characters long from the content of each post listed as popular', 'wordpress-popular-posts'); ?></td>
773
- <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
774
- <td>0</td>
775
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_length' => 55,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} {title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp excerpt_length=25 post_html='&lt;li&gt;{thumb} {title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;']<br /><br /></td>
776
- </tr>
777
- <tr>
778
- <td><strong>excerpt_format</strong></td>
779
- <td><?php _e('If set, WordPress Popular Posts will maintaing all styling tags (strong, italic, etc) and hyperlinks found in the excerpt', 'wordpress-popular-posts'); ?></td>
780
- <td>1 (true), (0) false</td>
781
- <td>0</td>
782
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_format' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_length' => 55,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} {title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp excerpt_format=1 excerpt_length=25 post_html='&lt;li&gt;{thumb} {title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;']<br /><br /></td>
783
- </tr>
784
- <tr class="alternate">
785
- <td><strong>excerpt_by_words</strong></td>
786
- <td><?php _e('If set to 1, WordPress Popular Posts will shorten the excerpt to "n" words instead of characters', 'wordpress-popular-posts'); ?></td>
787
- <td>1 (true), (0) false</td>
788
- <td>0</td>
789
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_by_words' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_length' => 55,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} {title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp excerpt_by_words=1 excerpt_length=55 post_html='&lt;li&gt;{thumb} {title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;']<br /><br /></td>
790
- </tr>
791
- <tr>
792
- <td><strong>thumbnail_width</strong></td>
793
- <td><?php _e('If set, and if your current server configuration allows it, you will be able to display thumbnails of your posts. This attribute sets the width for thumbnails', 'wordpress-popular-posts'); ?></td>
794
- <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
795
- <td>0</td>
796
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_width' => 30,<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_height' => 30<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp thumbnail_width=30 thumbnail_height=30]<br /><br /></td>
797
- </tr>
798
- <tr class="alternate">
799
- <td><strong>thumbnail_height</strong></td>
800
- <td><?php _e('If set, and if your current server configuration allows it, you will be able to display thumbnails of your posts. This attribute sets the height for thumbnails', 'wordpress-popular-posts'); ?></td>
801
- <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
802
- <td>0</td>
803
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_width' => 30,<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_height' => 30<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp thumbnail_width=30 thumbnail_height=30]<br /><br /></td>
804
- </tr>
805
- <tr>
806
- <td><strong>rating</strong></td>
807
- <td><?php _e('If set, and if the WP-PostRatings plugin is installed and enabled on your blog, WordPress Popular Posts will show how your visitors are rating your entries', 'wordpress-popular-posts'); ?></td>
808
- <td>1 (true), (0) false</td>
809
- <td>0</td>
810
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'rating' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} {title} {rating}&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp rating=1 post_html='&lt;li&gt;{thumb} {title} {rating}&lt;/li&gt;']<br /><br /></td>
811
- </tr>
812
- <tr class="alternate">
813
- <td><strong>stats_comments</strong></td>
814
- <td><?php _e('If set, WordPress Popular Posts will show how many comments each popular post has got during the specified time range', 'wordpress-popular-posts'); ?></td>
815
- <td>1 (true), 0 (false)</td>
816
- <td>0</td>
817
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_comments' => 1<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_comments=1]<br /><br /></td>
818
- </tr>
819
- <tr>
820
- <td><strong>stats_views</strong></td>
821
- <td><?php _e('If set, WordPress Popular Posts will show how many views each popular post has got during the specified time range', 'wordpress-popular-posts'); ?></td>
822
- <td>1 (true), (0) false</td>
823
- <td>1</td>
824
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_views' => 0<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_views=0]<br /><br /></td>
825
- </tr>
826
- <tr class="alternate">
827
- <td><strong>stats_author</strong></td>
828
- <td><?php _e('If set, WordPress Popular Posts will show who published each popular post on the list', 'wordpress-popular-posts'); ?></td>
829
- <td>1 (true), (0) false</td>
830
- <td>0</td>
831
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_author' => 1<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_author=1]<br /><br /></td>
832
- </tr>
833
- <tr>
834
- <td><strong>stats_date</strong></td>
835
- <td><?php _e('If set, WordPress Popular Posts will display the date when each popular post on the list was published', 'wordpress-popular-posts'); ?></td>
836
- <td>1 (true), (0) false</td>
837
- <td>0</td>
838
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_date' => 1<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_date=1]<br /><br /></td>
839
- </tr>
840
- <tr class="alternate">
841
- <td><strong>stats_date_format</strong></td>
842
- <td><?php _e('Sets the date format', 'wordpress-popular-posts'); ?></td>
843
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
844
- <td>0</td>
845
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_date' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_date_format' => 'F j, Y'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_date=1 stats_date_format='F j, Y']<br /><br /></td>
846
- </tr>
847
- <tr>
848
- <td><strong>stats_category</strong></td>
849
- <td><?php _e('If set, WordPress Popular Posts will display the categories associated to each entry', 'wordpress-popular-posts'); ?></td>
850
- <td>1 (true), (0) false</td>
851
- <td>0</td>
852
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_category' => 1, <br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {category}&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_taxonomy=1 post_html='&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {category}&lt;/li&gt;']<br /><br /></td>
853
- </tr>
854
- <tr class="alternate">
855
- <td><strong>stats_taxonomy</strong></td>
856
- <td><?php _e('If set, WordPress Popular Posts will display the taxonomies associated to each entry', 'wordpress-popular-posts'); ?></td>
857
- <td>1 (true), (0) false</td>
858
- <td>0</td>
859
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_taxonomy' => 1, <br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {taxonomy}&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_taxonomy=1 post_html='&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {taxonomy}&lt;/li&gt;']<br /><br /></td>
860
- </tr>
861
- <tr>
862
- <td><strong>wpp_start</strong></td>
863
- <td><?php _e('Sets the opening tag for the listing', 'wordpress-popular-posts'); ?></td>
864
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
865
- <td>&lt;ul&gt;</td>
866
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_start' => '&lt;ol&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_end' => '&lt;/ol&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp wpp_start='&lt;ol&gt;' wpp_end='&lt;/ol&gt;']<br /><br /></td>
867
- </tr>
868
- <tr class="alternate">
869
- <td><strong>wpp_end</strong></td>
870
- <td><?php _e('Sets the closing tag for the listing', 'wordpress-popular-posts'); ?></td>
871
- <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
872
- <td>&lt;/ul&gt;</td>
873
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_start' => '&lt;ol&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_end' => '&lt;/ol&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp wpp_start='&lt;ol&gt;' wpp_end='&lt;/ol&gt;']<br /><br /></td>
874
- </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>&lt;li&gt;{thumb} {title} &lt;span class="wpp-meta post-stats"&gt;{stats}&lt;/span&gt;&lt;/li&gt;</td>
880
- <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt;&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args );<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp post_html='&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt;&lt;/li&gt;']<br /><br /></td>
881
- </tr>
882
- </tbody>
883
- </table>
884
- </div>
885
- </div>
886
- </div>
887
- <!-- End params -->
888
-
889
- <!-- Start debug -->
890
- <?php
891
- global $wpdb, $wp_version;
892
-
893
- $my_theme = wp_get_theme();
894
- $site_plugins = get_plugins();
895
- $plugin_names = [];
896
- $performance_nag = get_option('wpp_performance_nag');
897
-
898
- if ( ! $performance_nag ) {
899
- $performance_nag = [
900
- 'status' => 0,
901
- 'last_checked' => null
902
- ];
903
- }
904
-
905
- switch($performance_nag['status']) {
906
- case 0:
907
- $performance_nag_status = 'Inactive';
908
- break;
909
- case 1:
910
- $performance_nag_status = 'Active';
911
- break;
912
- case 2:
913
- $performance_nag_status = 'Remind me later';
914
- break;
915
- case 3:
916
- $performance_nag_status = 'Dismissed';
917
- break;
918
- default:
919
- $performance_nag_status = 'Inactive';
920
- break;
921
- }
922
-
923
- foreach( $site_plugins as $main_file => $plugin_meta ) :
924
- if ( ! is_plugin_active($main_file) )
925
- continue;
926
- $plugin_names[] = sanitize_text_field($plugin_meta['Name'] . ' ' . $plugin_meta['Version']);
927
- endforeach;
928
- ?>
929
- <div id="wpp_debug" <?php echo ( "debug" == $current ) ? '' : ' style="display: none;"'; ?>>
930
- <h3>Plugin Configuration</h3>
931
- <p><strong>Performance Nag:</strong> <?php echo $performance_nag_status; ?></p>
932
- <p><strong>Log Limit:</strong> <?php echo ( $this->config['tools']['log']['limit'] ) ? 'Yes, keep data for ' . $this->config['tools']['log']['expires_after'] . ' days' : 'No'; ?></p>
933
- <p><strong>Log Views From:</strong> <?php echo ( 0 == $this->config['tools']['log']['level'] ) ? 'Visitors only' : ( (2 == $this->config['tools']['log']['level']) ? 'Logged-in users only' : 'Everyone' ); ?></p>
934
- <p><strong>Data Caching:</strong> <?php echo ( $this->config['tools']['cache']['active'] ) ? 'Yes, ' . $this->config['tools']['cache']['interval']['value'] . ' ' . $this->config['tools']['cache']['interval']['time'] : 'No'; ?></p>
935
- <p><strong>Data Sampling:</strong> <?php echo ( $this->config['tools']['sampling']['active'] ) ? 'Yes, with a rate of ' . $this->config['tools']['sampling']['rate'] : 'No'; ?></p>
936
- <p><strong>External object cache:</strong> <?php echo ( wp_using_ext_object_cache() ) ? 'Yes' : 'No'; ?></p>
937
- <p><strong>WPP_CACHE_VIEWS:</strong> <?php echo ( defined('WPP_CACHE_VIEWS') && WPP_CACHE_VIEWS ) ? 'Yes' : 'No'; ?></p>
938
-
939
- <br />
940
-
941
- <h3>System Info</h3>
942
- <p><strong>PHP version:</strong> <?php echo phpversion(); ?></p>
943
- <p><strong>PHP extensions:</strong> <?php echo implode(', ', get_loaded_extensions()); ?></p>
944
- <p><strong>Database version:</strong> <?php echo $wpdb->get_var("SELECT VERSION();"); ?></p>
945
- <p><strong>InnoDB availability:</strong> <?php echo $wpdb->get_var("SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE = 'InnoDB';"); ?></p>
946
- <p><strong>WordPress version:</strong> <?php echo $wp_version; ?></p>
947
- <p><strong>Multisite:</strong> <?php echo ( function_exists('is_multisite') && is_multisite() ) ? 'Yes' : 'No'; ?></p>
948
- <p><strong>Active plugins:</strong> <?php echo implode(', ', $plugin_names); ?></p>
949
- <p><strong>Theme:</strong> <?php echo $my_theme->get('Name') . ' (' . $my_theme->get('Version') . ') by ' . $my_theme->get('Author'); ?></p>
950
- </div>
951
- <!-- End debug -->
952
  </div>
1
+ <?php
2
+ if ( basename($_SERVER['SCRIPT_NAME']) == basename(__FILE__) )
3
+ exit('Please do not load this page directly');
4
+
5
+ $tabs = [
6
+ 'stats' => __('Stats', 'wordpress-popular-posts'),
7
+ 'tools' => __('Tools', 'wordpress-popular-posts'),
8
+ 'params' => __('Parameters', 'wordpress-popular-posts'),
9
+ 'debug' => 'Debug'
10
+ ];
11
+
12
+ // Set active tab
13
+ if ( isset($_GET['tab'] ) && isset($tabs[$_GET['tab']] ) )
14
+ $current = $_GET['tab'];
15
+ else
16
+ $current = 'stats';
17
+
18
+ // Update options on form submission
19
+ if ( isset($_POST['section']) ) {
20
+
21
+ if ( "stats" == $_POST['section'] ) {
22
+ $current = 'stats';
23
+
24
+ if ( isset($_POST['wpp-admin-token']) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-stats-options') ) {
25
+ $this->config['stats']['limit'] = ( \WordPressPopularPosts\Helper::is_number($_POST['stats_limit']) && $_POST['stats_limit'] > 0 ) ? $_POST['stats_limit'] : 10;
26
+ $this->config['stats']['post_type'] = empty($_POST['stats_type']) ? "post,page" : $_POST['stats_type'];
27
+ $this->config['stats']['freshness'] = empty($_POST['stats_freshness']) ? false : $_POST['stats_freshness'];
28
+
29
+ update_option('wpp_settings_config', $this->config);
30
+ echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
31
+ }
32
+ }
33
+ elseif ( "misc" == $_POST['section'] ) {
34
+ $current = 'tools';
35
+
36
+ if ( isset($_POST['wpp-admin-token'] ) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-misc-options') ) {
37
+ $this->config['tools']['link']['target'] = $_POST['link_target'];
38
+ $this->config['tools']['css'] = $_POST['css'];
39
+
40
+ update_option('wpp_settings_config', $this->config);
41
+ echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
42
+ }
43
+ }
44
+ elseif ( "thumb" == $_POST['section'] ) {
45
+ $current = 'tools';
46
+
47
+ if ( isset($_POST['wpp-admin-token']) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-thumbnail-options') ) {
48
+ if (
49
+ $_POST['thumb_source'] == "custom_field"
50
+ && ( ! isset($_POST['thumb_field']) || empty($_POST['thumb_field']) )
51
+ ) {
52
+ echo '<div id="wpp-message" class="error fade"><p>' . __('Please provide the name of your custom field.', 'wordpress-popular-posts') . '</p></div>';
53
+ }
54
+ else {
55
+ // thumbnail settings changed, flush transients
56
+ if ( $this->config['tools']['cache']['active'] ) {
57
+ $this->flush_transients();
58
+ }
59
+
60
+ $this->config['tools']['thumbnail']['source'] = $_POST['thumb_source'];
61
+ $this->config['tools']['thumbnail']['field'] = ( ! empty($_POST['thumb_field']) ) ? $_POST['thumb_field'] : "wpp_thumbnail";
62
+ $this->config['tools']['thumbnail']['default'] = ( ! empty($_POST['upload_thumb_src']) ) ? $_POST['upload_thumb_src'] : "";
63
+ $this->config['tools']['thumbnail']['resize'] = $_POST['thumb_field_resize'];
64
+ $this->config['tools']['thumbnail']['lazyload'] = (bool) $_POST['thumb_lazy_load'];
65
+
66
+ update_option('wpp_settings_config', $this->config );
67
+ echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
68
+ }
69
+ }
70
+ }
71
+ elseif ( "data" == $_POST['section'] && current_user_can('manage_options') ) {
72
+ $current = 'tools';
73
+
74
+ if ( isset($_POST['wpp-admin-token'] ) && wp_verify_nonce($_POST['wpp-admin-token'], 'wpp-update-data-options') ) {
75
+ $this->config['tools']['log']['level'] = $_POST['log_option'];
76
+ $this->config['tools']['log']['limit'] = $_POST['log_limit'];
77
+ $this->config['tools']['log']['expires_after'] = ( \WordPressPopularPosts\Helper::is_number($_POST['log_expire_time']) && $_POST['log_expire_time'] > 0 )
78
+ ? $_POST['log_expire_time']
79
+ : 180;
80
+ $this->config['tools']['ajax'] = $_POST['ajax'];
81
+
82
+ // if any of the caching settings was updated, destroy all transients created by the plugin
83
+ if (
84
+ $this->config['tools']['cache']['active'] != $_POST['cache']
85
+ || $this->config['tools']['cache']['interval']['time'] != $_POST['cache_interval_time']
86
+ || $this->config['tools']['cache']['interval']['value'] != $_POST['cache_interval_value']
87
+ ) {
88
+ $this->flush_transients();
89
+ }
90
+
91
+ $this->config['tools']['cache']['active'] = $_POST['cache'];
92
+ $this->config['tools']['cache']['interval']['time'] = $_POST['cache_interval_time'];
93
+ $this->config['tools']['cache']['interval']['value'] = ( isset($_POST['cache_interval_value']) && \WordPressPopularPosts\Helper::is_number($_POST['cache_interval_value']) && $_POST['cache_interval_value'] > 0 )
94
+ ? $_POST['cache_interval_value']
95
+ : 1;
96
+
97
+ $this->config['tools']['sampling']['active'] = $_POST['sampling'];
98
+ $this->config['tools']['sampling']['rate'] = ( isset($_POST['sample_rate']) && \WordPressPopularPosts\Helper::is_number($_POST['sample_rate']) && $_POST['sample_rate'] > 0 )
99
+ ? $_POST['sample_rate']
100
+ : 100;
101
+
102
+ update_option('wpp_settings_config', $this->config);
103
+ echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __('Settings saved.', 'wordpress-popular-posts') . "</strong></p></div>";
104
+ }
105
+ }
106
+
107
+ }
108
+
109
+ $rand = md5(uniqid(rand(), true));
110
+
111
+ if ( ! $wpp_rand = get_option("wpp_rand") ) {
112
+ add_option("wpp_rand", $rand);
113
+ } else {
114
+ update_option("wpp_rand", $rand);
115
+ }
116
+
117
+ ?>
118
+ <script type="text/javascript">
119
+ // TOOLS
120
+ function confirm_reset_cache() {
121
+ if ( confirm("<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("This operation will delete all entries from WordPress Popular Posts' cache table and cannot be undone.", 'wordpress-popular-posts'); ?> \n\n" + "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("Do you want to continue?", 'wordpress-popular-posts'); ?>") ) {
122
+ jQuery.post(
123
+ ajaxurl,
124
+ {
125
+ action: 'wpp_clear_data',
126
+ token: '<?php echo get_option("wpp_rand"); ?>',
127
+ clear: 'cache'
128
+ }, function(data){
129
+ var response = "";
130
+
131
+ switch( data ) {
132
+ case "1":
133
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Success! The cache table has been cleared!', 'wordpress-popular-posts'); ?>";
134
+ break;
135
+
136
+ case "2":
137
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Error: cache table does not exist.', 'wordpress-popular-posts'); ?>";
138
+ break;
139
+
140
+ case "3":
141
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
142
+ break;
143
+
144
+ case "4":
145
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts'); ?>";
146
+ break;
147
+
148
+ default:
149
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
150
+ break;
151
+ }
152
+
153
+ alert(response);
154
+ }
155
+ );
156
+ }
157
+ }
158
+
159
+ function confirm_reset_all() {
160
+ if ( confirm("<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("This operation will delete all stored info from WordPress Popular Posts' data tables and cannot be undone.", 'wordpress-popular-posts'); ?> \n\n" + "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("Do you want to continue?", 'wordpress-popular-posts'); ?>")) {
161
+ jQuery.post(
162
+ ajaxurl,
163
+ {
164
+ action: 'wpp_clear_data',
165
+ token: '<?php echo get_option("wpp_rand"); ?>',
166
+ clear: 'all'
167
+ }, function(data){
168
+ var response = "";
169
+
170
+ switch( data ) {
171
+ case "1":
172
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Success! All data have been cleared!', 'wordpress-popular-posts'); ?>";
173
+ break;
174
+
175
+ case "2":
176
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Error: one or both data tables are missing.', 'wordpress-popular-posts'); ?>";
177
+ break;
178
+
179
+ case "3":
180
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
181
+ break;
182
+
183
+ case "4":
184
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts'); ?>";
185
+ break;
186
+
187
+ default:
188
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
189
+ break;
190
+ }
191
+
192
+ alert(response);
193
+ }
194
+ );
195
+ }
196
+ }
197
+
198
+ function confirm_clear_image_cache() {
199
+ if ( confirm("<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("This operation will delete all cached thumbnails and cannot be undone.", 'wordpress-popular-posts'); ?> \n\n" + "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e("Do you want to continue?", 'wordpress-popular-posts'); ?>") ) {
200
+ jQuery.post(
201
+ ajaxurl,
202
+ {
203
+ action: 'wpp_clear_thumbnail',
204
+ token: '<?php echo get_option("wpp_rand"); ?>'
205
+ }, function(data){
206
+ var response = "";
207
+
208
+ switch( data ) {
209
+ case "1":
210
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Success! All files have been deleted!', 'wordpress-popular-posts'); ?>";
211
+ break;
212
+
213
+ case "2":
214
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('The thumbnail cache is already empty!', 'wordpress-popular-posts'); ?>";
215
+ break;
216
+
217
+ case "3":
218
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
219
+ break;
220
+
221
+ case "4":
222
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts'); ?>";
223
+ break;
224
+
225
+ default:
226
+ response = "<?php /*translators: Special characters (such as accents) must be replaced with Javascript Octal codes (eg. \341 is the Octal code for small a with acute accent) */ _e('Invalid action.', 'wordpress-popular-posts'); ?>";
227
+ break;
228
+ }
229
+
230
+ alert(response);
231
+ }
232
+ );
233
+ }
234
+ }
235
+ </script>
236
+
237
+ <nav id="wpp-menu">
238
+ <ul>
239
+ <li><a href="#" title="<?php esc_attr_e('Menu'); ?>"><span><?php _e('Menu'); ?></span></a></li>
240
+ <li <?php echo ('stats' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=stats'); ?>" title="<?php esc_attr_e('Stats', 'wordpress-popular-posts'); ?>"><span><?php _e('Stats', 'wordpress-popular-posts'); ?></span></a></li>
241
+ <li <?php echo ('tools' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=tools'); ?>" title="<?php esc_attr_e('Tools', 'wordpress-popular-posts'); ?>"><span><?php _e('Tools', 'wordpress-popular-posts'); ?></span></a></li>
242
+ <li <?php echo ('params' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=params'); ?>" title="<?php esc_attr_e('Parameters', 'wordpress-popular-posts'); ?>"><span><?php _e('Parameters', 'wordpress-popular-posts'); ?></span></a></li>
243
+ <li <?php echo ('debug' == $current ) ? 'class="current"' : ''; ?>><a href="<?php echo admin_url('options-general.php?page=wordpress-popular-posts&tab=debug'); ?>" title="Debug"><span>Debug</span></a></li>
244
+ </ul>
245
+ </nav>
246
+
247
+ <div class="wpp-wrapper wpp-section-<?php echo $current; ?>">
248
+ <div class="wpp-header">
249
+ <h2>WordPress Popular Posts</h2>
250
+ <h3><?php echo $tabs[$current]; ?></h3>
251
+ </div>
252
+
253
+ <?php
254
+ // Stats chart
255
+ if ( 'stats' == $current ) {
256
+ $chart_data = json_decode(
257
+ $this->get_chart_data($this->config['stats']['range'], strtoupper($this->config['stats']['time_unit']), $this->config['stats']['time_quantity']),
258
+ true
259
+ );
260
+ ?>
261
+
262
+ <a href="#" id="wpp-stats-config-btn" class="dashicons dashicons-admin-generic"></a>
263
+
264
+ <div id="wpp-stats-config" class="wpp-lightbox">
265
+ <form action="" method="post" id="wpp_stats_options" name="wpp_stats_options">
266
+ <label for="stats_type"><?php _e("Post type", 'wordpress-popular-posts'); ?>:</label>
267
+ <input type="text" name="stats_type" value="<?php echo esc_attr($this->config['stats']['post_type']); ?>" size="15">
268
+
269
+ <label for="stats_limits"><?php _e("Limit", 'wordpress-popular-posts'); ?>:</label>
270
+ <input type="text" name="stats_limit" value="<?php echo $this->config['stats']['limit']; ?>" size="5">
271
+
272
+ <label for="stats_freshness"><input type="checkbox" class="checkbox" <?php echo ($this->config['stats']['freshness']) ? 'checked="checked"' : ''; ?> id="stats_freshness" name="stats_freshness"> <small><?php _e('Display only posts published within the selected Time Range', 'wordpress-popular-posts'); ?></small></label>
273
+
274
+ <div class="clear"></div>
275
+ <br /><br />
276
+
277
+ <input type="hidden" name="section" value="stats">
278
+ <button type="submit" class="button-primary action"><?php _e("Apply", 'wordpress-popular-posts'); ?></button>
279
+ <button class="button-secondary action right"><?php _e("Cancel"); ?></button>
280
+
281
+ <?php wp_nonce_field('wpp-update-stats-options', 'wpp-admin-token'); ?>
282
+ </form>
283
+ </div>
284
+
285
+ <div id="wpp-stats-range" class="wpp-lightbox">
286
+ <form action="" method="post">
287
+ <ul class="wpp-lightbox-tabs">
288
+ <li class="active"><a href="#"><?php _e('Custom Time Range', 'wordpress-popular-posts'); ?></a></li>
289
+ <li><a href="#"><?php _e('Date Range', 'wordpress-popular-posts'); ?></a></li>
290
+ </ul>
291
+
292
+ <div class="wpp-lightbox-tab-content wpp-lightbox-tab-content-active" id="custom-time-range">
293
+ <input type="text" id="stats_range_time_quantity" name="stats_range_time_quantity" value="<?php echo $this->config['stats']['time_quantity']; ?>">
294
+
295
+ <select id="stats_range_time_unit" name="stats_range_time_unit">
296
+ <option <?php if ($this->config['stats']['time_unit'] == "minute") { ?>selected="selected"<?php } ?> value="minute"><?php _e("Minute(s)", 'wordpress-popular-posts'); ?></option>
297
+ <option <?php if ($this->config['stats']['time_unit'] == "hour") { ?>selected="selected"<?php } ?> value="hour"><?php _e("Hour(s)", 'wordpress-popular-posts'); ?></option>
298
+ <option <?php if ($this->config['stats']['time_unit'] == "day") { ?>selected="selected"<?php } ?> value="day"><?php _e("Day(s)", 'wordpress-popular-posts'); ?></option>
299
+ </select>
300
+ </div>
301
+
302
+ <div class="wpp-lightbox-tab-content" id="custom-date-range">
303
+ <input type="text" id="stats_range_date" name="stats_range_date" value="" placeholder="<?php esc_attr_e('Select a date...', 'wordpress-popular-posts'); ?>" readonly>
304
+ </div>
305
+
306
+ <div class="clear"></div>
307
+ <br />
308
+
309
+ <button type="submit" class="button-primary action">
310
+ <?php _e("Apply", 'wordpress-popular-posts'); ?>
311
+ </button>
312
+ <button class="button-secondary action right">
313
+ <?php _e("Cancel"); ?>
314
+ </button>
315
+ </form>
316
+ </div>
317
+
318
+ <div id="wpp-chart-wrapper">
319
+ <h4><?php echo $chart_data['totals']['label_summary']; ?></h4>
320
+ <h5><?php echo $chart_data['totals']['label_date_range']; ?></h5>
321
+
322
+ <ul class="wpp-header-nav" id="wpp-time-ranges">
323
+ <li <?php echo ('daily' == $this->config['stats']['range'] || 'today' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="today" title="<?php esc_attr_e('Today', 'wordpress-popular-posts'); ?>"><?php _e('Today', 'wordpress-popular-posts'); ?></a></li>
324
+ <li <?php echo ('daily' == $this->config['stats']['range'] || 'last24hours' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="last24hours" title="<?php esc_attr_e('Last 24 hours', 'wordpress-popular-posts'); ?>">24h</a></li>
325
+ <li <?php echo ('weekly' == $this->config['stats']['range'] || 'last7days' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="last7days" title="<?php esc_attr_e('Last 7 days', 'wordpress-popular-posts'); ?>">7d</a></li>
326
+ <li <?php echo ('monthly' == $this->config['stats']['range'] || 'last30days' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="last30days" title="<?php esc_attr_e('Last 30 days', 'wordpress-popular-posts'); ?>">30d</a></li>
327
+ <li <?php echo ('custom' == $this->config['stats']['range'] ) ? ' class="current"' : ''; ?>><a href="#" data-range="custom" title="<?php esc_attr_e('Custom', 'wordpress-popular-posts'); ?>"><?php _e('Custom', 'wordpress-popular-posts'); ?></a></li>
328
+ </ul>
329
+
330
+ <div id="wpp-chart">
331
+ <p><?php echo sprintf( __('Err... A nice little chart is supposed to be here, instead you are seeing this because your browser is too old. <br /> Please <a href="%s" target="_blank">get a better browser</a>.', 'wordpress-popular-posts'), 'https://browsehappy.com/'); ?></p>
332
+
333
+ <script>
334
+ if ( WPPChart.canRender() ) {
335
+ jQuery("#wpp-chart p").remove();
336
+ WPPChart.init('wpp-chart');
337
+ }
338
+ </script>
339
+ </div>
340
+ </div>
341
+ <?php
342
+ } // End stats chart
343
+ ?>
344
+
345
+ <div id="wpp-listing" class="wpp-content"<?php echo ('stats' == $current ) ? '' : ' style="display: none;"'; ?>>
346
+ <ul class="wpp-tabbed-nav">
347
+ <li class="active"><a href="#" title="<?php esc_attr_e('Most viewed', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-eye"></span><span><?php _e('Most viewed', 'wordpress-popular-posts'); ?></span></a></li>
348
+ <li><a href="#" title="<?php esc_attr_e('Most commented', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-comment"></span><span><?php _e('Most commented', 'wordpress-popular-posts'); ?></span></a></li>
349
+ <li><a href="#" title="<?php esc_attr_e('Trending now', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-rocket"></span><span><?php _e('Trending now', 'wordpress-popular-posts'); ?></span></a></li>
350
+ <li><a href="#" title="<?php esc_attr_e('Hall of Fame', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-award"></span><span><?php _e('Hall of Fame', 'wordpress-popular-posts'); ?></span></a></li>
351
+ </ul>
352
+
353
+ <div class="wpp-tab-content wpp-tab-content-active">
354
+ <span class="spinner"></span>
355
+ </div>
356
+
357
+ <div class="wpp-tab-content">
358
+ <span class="spinner"></span>
359
+ </div>
360
+
361
+ <div class="wpp-tab-content">
362
+ <span class="spinner"></span>
363
+ </div>
364
+
365
+ <div class="wpp-tab-content">
366
+ <?php
367
+ $args = [
368
+ 'range' => 'all',
369
+ 'post_type' => $this->config['stats']['post_type'],
370
+ 'order_by' => 'views',
371
+ 'limit' => $this->config['stats']['limit'],
372
+ 'stats_tag' => [
373
+ 'comment_count' => 1,
374
+ 'views' => 1,
375
+ 'date' => [
376
+ 'active' => 1
377
+ ]
378
+ ]
379
+ ];
380
+ $hof = new \WordPressPopularPosts\Query($args);
381
+ $posts = $hof->get_posts();
382
+
383
+ $this->render_list($posts, 'hof');
384
+ ?>
385
+ </div>
386
+ </div>
387
+
388
+ <!-- Start tools -->
389
+ <div id="wpp_tools" <?php echo ( "tools" == $current ) ? '' : ' style="display: none;"'; ?>>
390
+ <h3 class="wmpp-subtitle"><?php _e("Thumbnails", 'wordpress-popular-posts'); ?></h3>
391
+
392
+ <form action="" method="post" id="wpp_thumbnail_options" name="wpp_thumbnail_options">
393
+ <table class="form-table">
394
+ <tbody>
395
+ <tr valign="top">
396
+ <th scope="row"><label for="thumb_default"><?php _e("Default thumbnail", 'wordpress-popular-posts'); ?>:</label></th>
397
+ <td>
398
+ <div id="thumb-review">
399
+ <img src="<?php echo ($this->config['tools']['thumbnail']['default'] ) ? str_replace(parse_url($this->config['tools']['thumbnail']['default'], PHP_URL_SCHEME) . ':', '', $this->config['tools']['thumbnail']['default']) : plugins_url() . '/wordpress-popular-posts/assets/images/no_thumb.jpg'; ?>" alt="" />
400
+ </div>
401
+
402
+ <input id="upload_thumb_button" type="button" class="button" value="<?php _e("Change thumbnail", 'wordpress-popular-posts'); ?>">
403
+ <input type="hidden" id="upload_thumb_src" name="upload_thumb_src" value="">
404
+
405
+ <p class="description"><?php _e("This image will be displayed when no thumbnail is available", 'wordpress-popular-posts'); ?>.</p>
406
+ </td>
407
+ </tr>
408
+ <tr valign="top">
409
+ <th scope="row"><label for="thumb_source"><?php _e("Pick image from", 'wordpress-popular-posts'); ?>:</label></th>
410
+ <td>
411
+ <select name="thumb_source" id="thumb_source">
412
+ <option <?php if ($this->config['tools']['thumbnail']['source'] == "featured") { ?>selected="selected"<?php } ?> value="featured"><?php _e("Featured image", 'wordpress-popular-posts'); ?></option>
413
+ <option <?php if ($this->config['tools']['thumbnail']['source'] == "first_image") { ?>selected="selected"<?php } ?> value="first_image"><?php _e("First image on post", 'wordpress-popular-posts'); ?></option>
414
+ <option <?php if ($this->config['tools']['thumbnail']['source'] == "first_attachment") { ?>selected="selected"<?php } ?> value="first_attachment"><?php _e("First attachment", 'wordpress-popular-posts'); ?></option>
415
+ <option <?php if ($this->config['tools']['thumbnail']['source'] == "custom_field") { ?>selected="selected"<?php } ?> value="custom_field"><?php _e("Custom field", 'wordpress-popular-posts'); ?></option>
416
+ </select>
417
+ <br />
418
+ <p class="description"><?php _e("Tell WordPress Popular Posts where it should get thumbnails from", 'wordpress-popular-posts'); ?>.</p>
419
+ </td>
420
+ </tr>
421
+ <tr valign="top">
422
+ <th scope="row"><label for="thumb_lazy_load"><?php _e("Lazy load", 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#lazy-loading" target="_blank" title="<?php _e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
423
+ <td>
424
+ <select name="thumb_lazy_load" id="thumb_lazy_load">
425
+ <option <?php if ( ! $this->config['tools']['thumbnail']['lazyload'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("No", 'wordpress-popular-posts'); ?></option>
426
+ <option <?php if ( $this->config['tools']['thumbnail']['lazyload'] ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Yes", 'wordpress-popular-posts'); ?></option>
427
+ </select>
428
+ </td>
429
+ </tr>
430
+ <tr valign="top" <?php if ($this->config['tools']['thumbnail']['source'] != "custom_field") { ?>style="display: none;"<?php } ?> id="row_custom_field">
431
+ <th scope="row"><label for="thumb_field"><?php _e("Custom field name", 'wordpress-popular-posts'); ?>:</label></th>
432
+ <td>
433
+ <input type="text" id="thumb_field" name="thumb_field" value="<?php echo esc_attr($this->config['tools']['thumbnail']['field']); ?>" size="10" <?php if ($this->config['tools']['thumbnail']['source'] != "custom_field") { ?>style="display: none;"<?php } ?> />
434
+ </td>
435
+ </tr>
436
+ <tr valign="top" <?php if ($this->config['tools']['thumbnail']['source'] != "custom_field") { ?>style="display: none;"<?php } ?> id="row_custom_field_resize">
437
+ <th scope="row"><label for="thumb_field_resize"><?php _e("Resize image from Custom field?", 'wordpress-popular-posts'); ?>:</label></th>
438
+ <td>
439
+ <select name="thumb_field_resize" id="thumb_field_resize">
440
+ <option <?php if ( !$this->config['tools']['thumbnail']['resize'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("No, use image as is", 'wordpress-popular-posts'); ?></option>
441
+ <option <?php if ($this->config['tools']['thumbnail']['resize'] == 1 ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Yes", 'wordpress-popular-posts'); ?></option>
442
+ </select>
443
+ </td>
444
+ </tr>
445
+ <?php
446
+ $wp_upload_dir = wp_get_upload_dir();
447
+ if ( is_dir($wp_upload_dir['basedir'] . "/" . 'wordpress-popular-posts') ) :
448
+ ?>
449
+ <tr valign="top">
450
+ <th scope="row"></th>
451
+ <td>
452
+ <input type="button" name="wpp-reset-cache" id="wpp-reset-cache" class="button-secondary" value="<?php _e("Empty image cache", 'wordpress-popular-posts'); ?>" onclick="confirm_clear_image_cache()">
453
+ <p class="description"><?php _e("Use this button to clear WPP's thumbnails cache", 'wordpress-popular-posts'); ?>.</p>
454
+ </td>
455
+ </tr>
456
+ <?php
457
+ endif;
458
+ ?>
459
+ <tr valign="top">
460
+ <td colspan="2">
461
+ <input type="hidden" name="section" value="thumb">
462
+ <input type="submit" class="button-primary action" id="btn_th_ops" value="<?php _e("Apply", 'wordpress-popular-posts'); ?>" name="">
463
+ </td>
464
+ </tr>
465
+ </tbody>
466
+ </table>
467
+
468
+ <?php wp_nonce_field('wpp-update-thumbnail-options', 'wpp-admin-token'); ?>
469
+ </form>
470
+ <br />
471
+ <p style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>; float:none; clear:both;">&nbsp;</p>
472
+
473
+ <h3 class="wmpp-subtitle" style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>"><?php _e("Data", 'wordpress-popular-posts'); ?></h3>
474
+
475
+ <form action="" method="post" id="wpp_ajax_options" name="wpp_ajax_options" style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>">
476
+ <table class="form-table">
477
+ <tbody>
478
+ <tr valign="top">
479
+ <th scope="row"><label for="log_option"><?php _e("Log views from", 'wordpress-popular-posts'); ?>:</label></th>
480
+ <td>
481
+ <select name="log_option" id="log_option">
482
+ <option <?php if ($this->config['tools']['log']['level'] == 0) { ?>selected="selected"<?php } ?> value="0"><?php _e("Visitors only", 'wordpress-popular-posts'); ?></option>
483
+ <option <?php if ($this->config['tools']['log']['level'] == 2) { ?>selected="selected"<?php } ?> value="2"><?php _e("Logged-in users only", 'wordpress-popular-posts'); ?></option>
484
+ <option <?php if ($this->config['tools']['log']['level'] == 1) { ?>selected="selected"<?php } ?> value="1"><?php _e("Everyone", 'wordpress-popular-posts'); ?></option>
485
+ </select>
486
+ <br />
487
+ </td>
488
+ </tr>
489
+ <tr valign="top">
490
+ <th scope="row"><label for="log_limit"><?php _e("Log limit", 'wordpress-popular-posts'); ?>:</label></th>
491
+ <td>
492
+ <select name="log_limit" id="log_limit">
493
+ <option <?php if ($this->config['tools']['log']['limit'] == 0) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
494
+ <option <?php if ($this->config['tools']['log']['limit'] == 1) { ?>selected="selected"<?php } ?> value="1"><?php _e("Keep data for", 'wordpress-popular-posts'); ?></option>
495
+ </select>
496
+
497
+ <label for="log_expire_time"<?php echo ($this->config['tools']['log']['limit'] == 0) ? ' style="display: none;"' : ''; ?>>
498
+ <input type="text" id="log_expire_time" name="log_expire_time" value="<?php echo esc_attr($this->config['tools']['log']['expires_after']); ?>" size="3"> <?php _e("day(s)", 'wordpress-popular-posts'); ?>
499
+ </label>
500
+
501
+ <p class="description"<?php echo ($this->config['tools']['log']['limit'] == 0) ? ' style="display: none;"' : ''; ?>><?php _e("Data older than the specified time frame will be automatically discarded", 'wordpress-popular-posts'); ?>.</p>
502
+
503
+ <br <?php echo (1 == $this->config['tools']['log']['limit']) ? 'style="display: none;"' : ''; ?>/>
504
+ </td>
505
+ </tr>
506
+ <tr valign="top">
507
+ <th scope="row"><label for="ajax"><?php _e("Ajaxify widget", 'wordpress-popular-posts'); ?>:</label></th>
508
+ <td>
509
+ <select name="ajax" id="ajax">
510
+ <option <?php if (! $this->config['tools']['ajax']) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
511
+ <option <?php if ($this->config['tools']['ajax']) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enabled", 'wordpress-popular-posts'); ?></option>
512
+ </select>
513
+
514
+ <br />
515
+ <p class="description"><?php _e("If you are using a caching plugin such as WP Super Cache, enabling this feature will keep the popular list from being cached by it", 'wordpress-popular-posts'); ?>.</p>
516
+ </td>
517
+ </tr>
518
+ <tr valign="top">
519
+ <th scope="row"><label for="cache"><?php _e("Data Caching", 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#caching" target="_blank" title="<?php _e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
520
+ <td>
521
+ <select name="cache" id="cache">
522
+ <option <?php if ( ! $this->config['tools']['cache']['active'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("Never cache", 'wordpress-popular-posts'); ?></option>
523
+ <option <?php if ( $this->config['tools']['cache']['active'] ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enable caching", 'wordpress-popular-posts'); ?></option>
524
+ </select>
525
+
526
+ <br />
527
+ <p class="description"><?php _e("WPP can cache the popular list for a specified amount of time. Recommended for large / high traffic sites", 'wordpress-popular-posts'); ?>.</p>
528
+ </td>
529
+ </tr>
530
+ <tr valign="top" <?php if ( ! $this->config['tools']['cache']['active'] ) { ?>style="display: none;"<?php } ?> id="cache_refresh_interval">
531
+ <th scope="row"><label for="cache_interval_value"><?php _e("Refresh cache every", 'wordpress-popular-posts'); ?>:</label></th>
532
+ <td>
533
+ <input name="cache_interval_value" type="text" id="cache_interval_value" value="<?php echo ( isset($this->config['tools']['cache']['interval']['value']) ) ? (int) $this->config['tools']['cache']['interval']['value'] : 1; ?>" class="small-text">
534
+ <select name="cache_interval_time" id="cache_interval_time">
535
+ <option <?php if ($this->config['tools']['cache']['interval']['time'] == "minute") { ?>selected="selected"<?php } ?> value="minute"><?php _e("Minute(s)", 'wordpress-popular-posts'); ?></option>
536
+ <option <?php if ($this->config['tools']['cache']['interval']['time'] == "hour") { ?>selected="selected"<?php } ?> value="hour"><?php _e("Hour(s)", 'wordpress-popular-posts'); ?></option>
537
+ <option <?php if ($this->config['tools']['cache']['interval']['time'] == "day") { ?>selected="selected"<?php } ?> value="day"><?php _e("Day(s)", 'wordpress-popular-posts'); ?></option>
538
+ <option <?php if ($this->config['tools']['cache']['interval']['time'] == "week") { ?>selected="selected"<?php } ?> value="week"><?php _e("Week(s)", 'wordpress-popular-posts'); ?></option>
539
+ <option <?php if ($this->config['tools']['cache']['interval']['time'] == "month") { ?>selected="selected"<?php } ?> value="month"><?php _e("Month(s)", 'wordpress-popular-posts'); ?></option>
540
+ <option <?php if ($this->config['tools']['cache']['interval']['time'] == "year") { ?>selected="selected"<?php } ?> value="month"><?php _e("Year(s)", 'wordpress-popular-posts'); ?></option>
541
+ </select>
542
+ <br />
543
+ <p class="description" style="display: none;" id="cache_too_long"><?php _e("Really? That long?", 'wordpress-popular-posts'); ?></p>
544
+ </td>
545
+ </tr>
546
+ <tr valign="top">
547
+ <th scope="row"><label for="sampling"><?php _e("Data Sampling", 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#data-sampling" target="_blank" title="<?php _e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
548
+ <td>
549
+ <select name="sampling" id="sampling">
550
+ <option <?php if ( !$this->config['tools']['sampling']['active'] ) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
551
+ <option <?php if ( $this->config['tools']['sampling']['active'] ) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enabled", 'wordpress-popular-posts'); ?></option>
552
+ </select>
553
+
554
+ <br />
555
+ <p class="description"><?php echo sprintf( __('By default, WordPress Popular Posts stores in database every single visit your site receives. For small / medium sites this is generally OK, but on large / high traffic sites the constant writing to the database may have an impact on performance. With <a href="%1$s" target="_blank">data sampling</a>, WordPress Popular Posts will store only a subset of your traffic and report on the tendencies detected in that sample set (for more, <a href="%2$s" target="_blank">please read here</a>)', 'wordpress-popular-posts'), 'http://en.wikipedia.org/wiki/Sample_%28statistics%29', 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#data-sampling'); ?>.</p>
556
+ </td>
557
+ </tr>
558
+ <tr valign="top" <?php if ( ! $this->config['tools']['sampling']['active'] ) { ?>style="display: none;"<?php } ?>>
559
+ <th scope="row"><label for="sample_rate"><?php _e("Sample Rate", 'wordpress-popular-posts'); ?>:</label></th>
560
+ <td>
561
+ <input name="sample_rate" type="text" id="sample_rate" value="<?php echo ( isset($this->config['tools']['sampling']['rate']) ) ? (int) $this->config['tools']['sampling']['rate'] : 100; ?>" class="small-text">
562
+ <br />
563
+ <p class="description"><?php echo sprintf(__("A sampling rate of %d is recommended for large / high traffic sites. For lower traffic sites, you should lower the value", 'wordpress-popular-posts'), 100); ?>.</p>
564
+ </td>
565
+ </tr>
566
+ <tr valign="top">
567
+ <td colspan="2">
568
+ <input type="hidden" name="section" value="data">
569
+ <input type="submit" class="button-primary action" id="btn_ajax_ops" value="<?php _e("Apply", 'wordpress-popular-posts'); ?>" name="">
570
+ </td>
571
+ </tr>
572
+ </tbody>
573
+ </table>
574
+
575
+ <?php wp_nonce_field('wpp-update-data-options', 'wpp-admin-token'); ?>
576
+ </form>
577
+ <br />
578
+ <p style="display: block; float:none; clear: both;">&nbsp;</p>
579
+
580
+ <h3 class="wmpp-subtitle"><?php _e("Miscellaneous", 'wordpress-popular-posts'); ?></h3>
581
+
582
+ <form action="" method="post" id="wpp_link_options" name="wpp_link_options">
583
+ <table class="form-table">
584
+ <tbody>
585
+ <tr valign="top">
586
+ <th scope="row"><label for="link_target"><?php _e("Open links in", 'wordpress-popular-posts'); ?>:</label></th>
587
+ <td>
588
+ <select name="link_target" id="link_target">
589
+ <option <?php if ($this->config['tools']['link']['target'] == '_self') { ?>selected="selected"<?php } ?> value="_self"><?php _e("Current window", 'wordpress-popular-posts'); ?></option>
590
+ <option <?php if ($this->config['tools']['link']['target'] == '_blank') { ?>selected="selected"<?php } ?> value="_blank"><?php _e("New tab/window", 'wordpress-popular-posts'); ?></option>
591
+ </select>
592
+ <br />
593
+ </td>
594
+ </tr>
595
+ <tr valign="top">
596
+ <th scope="row"><label for="css"><?php _e("Use plugin's stylesheet", 'wordpress-popular-posts'); ?>:</label></th>
597
+ <td>
598
+ <select name="css" id="css">
599
+ <option <?php if ($this->config['tools']['css']) { ?>selected="selected"<?php } ?> value="1"><?php _e("Enabled", 'wordpress-popular-posts'); ?></option>
600
+ <option <?php if (!$this->config['tools']['css']) { ?>selected="selected"<?php } ?> value="0"><?php _e("Disabled", 'wordpress-popular-posts'); ?></option>
601
+ </select>
602
+ <br />
603
+ <p class="description"><?php _e("By default, the plugin includes a stylesheet called wpp.css which you can use to style your popular posts listing. If you wish to use your own stylesheet or do not want it to have it included in the header section of your site, use this.", 'wordpress-popular-posts'); ?></p>
604
+ </td>
605
+ </tr>
606
+ <tr valign="top">
607
+ <td colspan="2">
608
+ <input type="hidden" name="section" value="misc">
609
+ <input type="submit" class="button-primary action" value="<?php _e("Apply", 'wordpress-popular-posts'); ?>" name="">
610
+ </td>
611
+ </tr>
612
+ </tbody>
613
+ </table>
614
+
615
+ <?php wp_nonce_field('wpp-update-misc-options', 'wpp-admin-token'); ?>
616
+ </form>
617
+ <br />
618
+ <p style="display: block; float: none; clear: both;">&nbsp;</p>
619
+
620
+ <div style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>">
621
+ <br /><br />
622
+
623
+ <p><?php _e('WordPress Popular Posts maintains data in two separate tables: one for storing the most popular entries on a daily basis (from now on, "cache"), and another one to keep the All-time data (from now on, "historical data" or just "data"). If for some reason you need to clear the cache table, or even both historical and cache tables, please use the buttons below to do so.', 'wordpress-popular-posts') ?></p>
624
+ <p><input type="button" name="wpp-reset-cache" id="wpp-reset-cache" class="button-secondary" value="<?php _e("Empty cache", 'wordpress-popular-posts'); ?>" onclick="confirm_reset_cache()"> <label for="wpp-reset-cache"><small><?php _e('Use this button to manually clear entries from WPP cache only', 'wordpress-popular-posts'); ?></small></label></p>
625
+ <p><input type="button" name="wpp-reset-all" id="wpp-reset-all" class="button-secondary" value="<?php _e("Clear all data", 'wordpress-popular-posts'); ?>" onclick="confirm_reset_all()"> <label for="wpp-reset-all"><small><?php _e('Use this button to manually clear entries from all WPP data tables', 'wordpress-popular-posts'); ?></small></label></p>
626
+ </div>
627
+ </div>
628
+ <!-- End tools -->
629
+
630
+ <!-- Start params -->
631
+ <div id="wpp_params" <?php echo ( "params" == $current ) ? '' : ' style="display: none;"'; ?>>
632
+ <div>
633
+ <p><?php printf( __('With the following parameters you can customize the popular posts list when using either the <a href="%1$s">wpp_get_mostpopular() template tag</a> or the <a href="%2$s">[wpp] shortcode</a>.', 'wordpress-popular-posts'),
634
+ 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags#wpp_get_mostpopular',
635
+ 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/1.-Using-WPP-on-posts-&-pages'
636
+ ); ?></p>
637
+ <br />
638
+
639
+ <div style="overflow-x: auto;">
640
+ <table cellspacing="0" class="wp-list-table">
641
+ <thead>
642
+ <tr>
643
+ <th class="manage-column column-title"><?php _e('Parameter', 'wordpress-popular-posts'); ?></th>
644
+ <th class="manage-column column-title"><?php _e('What it does ', 'wordpress-popular-posts'); ?></th>
645
+ <th class="manage-column column-title"><?php _e('Possible values', 'wordpress-popular-posts'); ?></th>
646
+ <th class="manage-column column-title"><?php _e('Defaults to', 'wordpress-popular-posts'); ?></th>
647
+ <th class="manage-column column-title"><?php _e('Example', 'wordpress-popular-posts'); ?></th>
648
+ </tr>
649
+ </thead>
650
+ <tbody>
651
+ <tr>
652
+ <td><strong>header</strong></td>
653
+ <td><?php _e('Sets a heading for the list', 'wordpress-popular-posts'); ?></td>
654
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
655
+ <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
656
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'header' => 'Popular Posts'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp header='Popular Posts']<br /><br /></td>
657
+ </tr>
658
+ <tr class="alternate">
659
+ <td><strong>header_start</strong></td>
660
+ <td><?php _e('Set the opening tag for the heading of the list', 'wordpress-popular-posts'); ?></td>
661
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
662
+ <td>&lt;h2&gt;</td>
663
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'header' => 'Popular Posts', <br />&nbsp;&nbsp;&nbsp;&nbsp;'header_start' => '&lt;h3 class="title"&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'header_end' => '&lt;/h3&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp header='Popular Posts' header_start='&lt;h3 class="title"&gt;' header_end='&lt;/h3&gt;']<br /><br /></td>
664
+ </tr>
665
+ <tr>
666
+ <td><strong>header_end</strong></td>
667
+ <td><?php _e('Set the closing tag for the heading of the list', 'wordpress-popular-posts'); ?></td>
668
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
669
+ <td>&lt;/h2&gt;</td>
670
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'header' => 'Popular Posts', <br />&nbsp;&nbsp;&nbsp;&nbsp;'header_start' => '&lt;h3 class="title"&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'header_end' => '&lt;/h3&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp header='Popular Posts' header_start='&lt;h3 class="title"&gt;' header_end='&lt;/h3&gt;']<br /><br /></td>
671
+ </tr>
672
+ <tr class="alternate">
673
+ <td><strong>limit</strong></td>
674
+ <td><?php _e('Sets the maximum number of popular posts to be shown on the listing', 'wordpress-popular-posts'); ?></td>
675
+ <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
676
+ <td>10</td>
677
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'limit' => 5<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp limit=5]<br /><br /></td>
678
+ </tr>
679
+ <tr>
680
+ <td><strong>range</strong></td>
681
+ <td><?php _e('Tells WordPress Popular Posts to retrieve the most popular entries within the time range specified by you', 'wordpress-popular-posts'); ?></td>
682
+ <td>"last24hours", "last7days", "last30days", "all", "custom"</td>
683
+ <td>last24hours</td>
684
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'last7days'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='last7days']<br /><br /></td>
685
+ </tr>
686
+ <tr class="alternate">
687
+ <td><strong>time_quantity</strong></td>
688
+ <td><?php _e('Especifies the number of time units of the custom time range', 'wordpress-popular-posts'); ?></td>
689
+ <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
690
+ <td>24</td>
691
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'custom',<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_quantity' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_unit' => 'hour'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='custom' time_quantity=1 time_unit='hour']<br /><br /></td>
692
+ </tr>
693
+ <tr>
694
+ <td><strong>time_unit</strong></td>
695
+ <td><?php _e('Especifies the time unit of the custom time range', 'wordpress-popular-posts'); ?></td>
696
+ <td>minute, hour, day, week, month</td>
697
+ <td>hour</td>
698
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'custom',<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_quantity' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'time_unit' => 'hour'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='custom' time_quantity=1 time_unit='hour']<br /><br /></td>
699
+ </tr>
700
+ <tr class="alternate">
701
+ <td><strong>freshness</strong></td>
702
+ <td><?php _e('Tells WordPress Popular Posts to retrieve the most popular entries published within the time range specified by you', 'wordpress-popular-posts'); ?></td>
703
+ <td>1 (true), 0 (false)</td>
704
+ <td>0</td>
705
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'range' => 'weekly',<br />&nbsp;&nbsp;&nbsp;&nbsp;'freshness' => 1<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp range='last7days' freshness=1]<br /><br /></td>
706
+ </tr>
707
+ <tr>
708
+ <td><strong>order_by</strong></td>
709
+ <td><?php _e('Sets the sorting option of the popular posts', 'wordpress-popular-posts'); ?></td>
710
+ <td>"comments", "views", "avg" <?php _e('(for average views per day)', 'wordpress-popular-posts'); ?></td>
711
+ <td>views</td>
712
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'order_by' => 'comments'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp order_by='comments']<br /><br /></td>
713
+ </tr>
714
+ <tr class="alternate">
715
+ <td><strong>post_type</strong></td>
716
+ <td><?php _e('Defines the type of posts to show on the listing', 'wordpress-popular-posts'); ?></td>
717
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
718
+ <td>post</td>
719
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_type' => 'post,page,your-custom-post-type'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp post_type='post,page,your-custom-post-type']<br /><br /></td>
720
+ </tr>
721
+ <tr>
722
+ <td><strong>pid</strong></td>
723
+ <td><?php _e('If set, WordPress Popular Posts will exclude the specified post(s) ID(s) form the listing.', 'wordpress-popular-posts'); ?></td>
724
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
725
+ <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
726
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'pid' => '60,25,31'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp pid='60,25,31']<br /><br /></td>
727
+ </tr>
728
+ <tr class="alternate">
729
+ <td><strong>cat</strong></td>
730
+ <td><?php _e('If set, WordPress Popular Posts will retrieve all entries that belong to the specified category ID(s). If a minus sign is used, entries associated to the category will be excluded instead.', 'wordpress-popular-posts'); ?></td>
731
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
732
+ <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
733
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'cat' => '1,55,-74'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp cat='1,55,-74']<br /><br /></td>
734
+ </tr>
735
+ <tr>
736
+ <td><strong>taxonomy</strong></td>
737
+ <td><?php _e('If set, WordPress Popular Posts will filter posts by a given taxonomy.', 'wordpress-popular-posts'); ?></td>
738
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
739
+ <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
740
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' => 'post_tag',<br />&nbsp;&nbsp;&nbsp;&nbsp;'term_id' => '118,75,15'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' => 'category; post_tag',<br />&nbsp;&nbsp;&nbsp;&nbsp;'term_id' => '1,55,-74; 118,75,15'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp taxonomy='post_tag' term_id='118,75,15']<br /><br />[wpp taxonomy='category; post_tag' term_id='1,55,-74; 118,75,15']<br /><br /></td>
741
+ </tr>
742
+ <tr class="alternate">
743
+ <td><strong>term_id</strong></td>
744
+ <td><?php _e('If set, WordPress Popular Posts will retrieve all entries that belong to the specified term ID(s). If a minus sign is used, entries associated to the term(s) will be excluded instead.', 'wordpress-popular-posts'); ?></td>
745
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
746
+ <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
747
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' => 'post_tag',<br />&nbsp;&nbsp;&nbsp;&nbsp;'term_id' => '118,75,15'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp taxonomy='post_tag' term_id='118,75,15']<br /><br /></td>
748
+ </tr>
749
+ <tr>
750
+ <td><strong>author</strong></td>
751
+ <td><?php _e('If set, WordPress Popular Posts will retrieve all entries created by specified author(s) ID(s).', 'wordpress-popular-posts'); ?></td>
752
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
753
+ <td><?php _e('None', 'wordpress-popular-posts'); ?></td>
754
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'author' => '75,8,120'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp author='75,8,120']<br /><br /></td>
755
+ </tr>
756
+ <tr class="alternate">
757
+ <td><strong>title_length</strong></td>
758
+ <td><?php _e('If set, WordPress Popular Posts will shorten each post title to "n" characters whenever possible', 'wordpress-popular-posts'); ?></td>
759
+ <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
760
+ <td>25</td>
761
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'title_length' => 25<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp title_length=25]<br /><br /></td>
762
+ </tr>
763
+ <tr>
764
+ <td><strong>title_by_words</strong></td>
765
+ <td><?php _e('If set to 1, WordPress Popular Posts will shorten each post title to "n" words instead of characters', 'wordpress-popular-posts'); ?></td>
766
+ <td>1 (true), (0) false</td>
767
+ <td>0</td>
768
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'title_by_words' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'title_length' => 25<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp title_by_words=1 title_length=25]<br /><br /></td>
769
+ </tr>
770
+ <tr class="alternate">
771
+ <td><strong>excerpt_length</strong></td>
772
+ <td><?php _e('If set, WordPress Popular Posts will build and include an excerpt of "n" characters long from the content of each post listed as popular', 'wordpress-popular-posts'); ?></td>
773
+ <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
774
+ <td>0</td>
775
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_length' => 55,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp excerpt_length=25 post_html='&lt;li&gt;{title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;']<br /><br /></td>
776
+ </tr>
777
+ <tr>
778
+ <td><strong>excerpt_format</strong></td>
779
+ <td><?php _e('If set, WordPress Popular Posts will maintaing all styling tags (strong, italic, etc) and hyperlinks found in the excerpt', 'wordpress-popular-posts'); ?></td>
780
+ <td>1 (true), (0) false</td>
781
+ <td>0</td>
782
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_format' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_length' => 55,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp excerpt_format=1 excerpt_length=25 post_html='&lt;li&gt;{title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;']<br /><br /></td>
783
+ </tr>
784
+ <tr class="alternate">
785
+ <td><strong>excerpt_by_words</strong></td>
786
+ <td><?php _e('If set to 1, WordPress Popular Posts will shorten the excerpt to "n" words instead of characters', 'wordpress-popular-posts'); ?></td>
787
+ <td>1 (true), (0) false</td>
788
+ <td>0</td>
789
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_by_words' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'excerpt_length' => 55,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp excerpt_by_words=1 excerpt_length=55 post_html='&lt;li&gt;{title} &lt;span class="wpp-excerpt"&gt;{summary}&lt;/span&gt;&lt;/li&gt;']<br /><br /></td>
790
+ </tr>
791
+ <tr>
792
+ <td><strong>thumbnail_width</strong></td>
793
+ <td><?php _e('If set, and if your current server configuration allows it, you will be able to display thumbnails of your posts. This attribute sets the width for thumbnails', 'wordpress-popular-posts'); ?></td>
794
+ <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
795
+ <td>0</td>
796
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_width' => 30,<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_height' => 30<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp thumbnail_width=30 thumbnail_height=30]<br /><br /></td>
797
+ </tr>
798
+ <tr class="alternate">
799
+ <td><strong>thumbnail_height</strong></td>
800
+ <td><?php _e('If set, and if your current server configuration allows it, you will be able to display thumbnails of your posts. This attribute sets the height for thumbnails', 'wordpress-popular-posts'); ?></td>
801
+ <td><?php _e('Positive integer', 'wordpress-popular-posts'); ?></td>
802
+ <td>0</td>
803
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_width' => 30,<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_height' => 30<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp thumbnail_width=30 thumbnail_height=30]<br /><br /></td>
804
+ </tr>
805
+ <tr>
806
+ <td><strong>rating</strong></td>
807
+ <td><?php _e('If set, and if the WP-PostRatings plugin is installed and enabled on your blog, WordPress Popular Posts will show how your visitors are rating your entries', 'wordpress-popular-posts'); ?></td>
808
+ <td>1 (true), (0) false</td>
809
+ <td>0</td>
810
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'rating' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{title} {rating}&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp rating=1 post_html='&lt;li&gt;{title} {rating}&lt;/li&gt;']<br /><br /></td>
811
+ </tr>
812
+ <tr class="alternate">
813
+ <td><strong>stats_comments</strong></td>
814
+ <td><?php _e('If set, WordPress Popular Posts will show how many comments each popular post has got during the specified time range', 'wordpress-popular-posts'); ?></td>
815
+ <td>1 (true), 0 (false)</td>
816
+ <td>0</td>
817
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_comments' => 1<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_comments=1]<br /><br /></td>
818
+ </tr>
819
+ <tr>
820
+ <td><strong>stats_views</strong></td>
821
+ <td><?php _e('If set, WordPress Popular Posts will show how many views each popular post has got during the specified time range', 'wordpress-popular-posts'); ?></td>
822
+ <td>1 (true), (0) false</td>
823
+ <td>1</td>
824
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_views' => 0<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_views=0]<br /><br /></td>
825
+ </tr>
826
+ <tr class="alternate">
827
+ <td><strong>stats_author</strong></td>
828
+ <td><?php _e('If set, WordPress Popular Posts will show who published each popular post on the list', 'wordpress-popular-posts'); ?></td>
829
+ <td>1 (true), (0) false</td>
830
+ <td>0</td>
831
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_author' => 1<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_author=1]<br /><br /></td>
832
+ </tr>
833
+ <tr>
834
+ <td><strong>stats_date</strong></td>
835
+ <td><?php _e('If set, WordPress Popular Posts will display the date when each popular post on the list was published', 'wordpress-popular-posts'); ?></td>
836
+ <td>1 (true), (0) false</td>
837
+ <td>0</td>
838
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_date' => 1<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_date=1]<br /><br /></td>
839
+ </tr>
840
+ <tr class="alternate">
841
+ <td><strong>stats_date_format</strong></td>
842
+ <td><?php _e('Sets the date format', 'wordpress-popular-posts'); ?></td>
843
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
844
+ <td>0</td>
845
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_date' => 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_date_format' => 'F j, Y'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_date=1 stats_date_format='F j, Y']<br /><br /></td>
846
+ </tr>
847
+ <tr>
848
+ <td><strong>stats_category</strong></td>
849
+ <td><?php _e('If set, WordPress Popular Posts will display the categories associated to each entry', 'wordpress-popular-posts'); ?></td>
850
+ <td>1 (true), (0) false</td>
851
+ <td>0</td>
852
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_category' => 1, <br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;&lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {category}&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_taxonomy=1 post_html='&lt;li&gt;&lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {category}&lt;/li&gt;']<br /><br /></td>
853
+ </tr>
854
+ <tr class="alternate">
855
+ <td><strong>stats_taxonomy</strong></td>
856
+ <td><?php _e('If set, WordPress Popular Posts will display the taxonomies associated to each entry', 'wordpress-popular-posts'); ?></td>
857
+ <td>1 (true), (0) false</td>
858
+ <td>0</td>
859
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'stats_taxonomy' => 1, <br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;&lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {taxonomy}&lt;/li&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp stats_taxonomy=1 post_html='&lt;li&gt;&lt;a href="{url}"&gt;{text_title}&lt;/a&gt; {taxonomy}&lt;/li&gt;']<br /><br /></td>
860
+ </tr>
861
+ <tr>
862
+ <td><strong>wpp_start</strong></td>
863
+ <td><?php _e('Sets the opening tag for the listing', 'wordpress-popular-posts'); ?></td>
864
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
865
+ <td>&lt;ul&gt;</td>
866
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_start' => '&lt;ol&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_end' => '&lt;/ol&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp wpp_start='&lt;ol&gt;' wpp_end='&lt;/ol&gt;']<br /><br /></td>
867
+ </tr>
868
+ <tr class="alternate">
869
+ <td><strong>wpp_end</strong></td>
870
+ <td><?php _e('Sets the closing tag for the listing', 'wordpress-popular-posts'); ?></td>
871
+ <td><?php _e('Text string', 'wordpress-popular-posts'); ?></td>
872
+ <td>&lt;/ul&gt;</td>
873
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_start' => '&lt;ol&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'wpp_end' => '&lt;/ol&gt;'<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp wpp_start='&lt;ol&gt;' wpp_end='&lt;/ol&gt;']<br /><br /></td>
874
+ </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>&lt;li&gt;{thumb} {title} &lt;span class="wpp-meta post-stats"&gt;{stats}&lt;/span&gt;&lt;/li&gt;</td>
880
+ <td><strong><?php _e('With wpp_get_mostpopular():', 'wordpress-popular-posts'); ?></strong><br /><br />&lt;?php<br />$args = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;'post_html' => '&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt;&lt;/li&gt;',<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_width' => 100,<br />&nbsp;&nbsp;&nbsp;&nbsp;'thumbnail_height' => 75<br />);<br /><br />wpp_get_mostpopular($args);<br />?&gt;<br /><br /><hr /><br /><strong><?php _e('With the [wpp] shortcode:', 'wordpress-popular-posts'); ?></strong><br /><br />[wpp thumbnail_width=100 thumbnail_height=75 post_html='&lt;li&gt;{thumb} &lt;a href="{url}"&gt;{text_title}&lt;/a&gt;&lt;/li&gt;']<br /><br /></td>
881
+ </tr>
882
+ </tbody>
883
+ </table>
884
+ </div>
885
+ </div>
886
+ </div>
887
+ <!-- End params -->
888
+
889
+ <!-- Start debug -->
890
+ <?php
891
+ global $wpdb, $wp_version;
892
+
893
+ $my_theme = wp_get_theme();
894
+ $site_plugins = get_plugins();
895
+ $plugin_names = [];
896
+ $performance_nag = get_option('wpp_performance_nag');
897
+
898
+ if ( ! $performance_nag ) {
899
+ $performance_nag = [
900
+ 'status' => 0,
901
+ 'last_checked' => null
902
+ ];
903
+ }
904
+
905
+ switch($performance_nag['status']) {
906
+ case 0:
907
+ $performance_nag_status = 'Inactive';
908
+ break;
909
+ case 1:
910
+ $performance_nag_status = 'Active';
911
+ break;
912
+ case 2:
913
+ $performance_nag_status = 'Remind me later';
914
+ break;
915
+ case 3:
916
+ $performance_nag_status = 'Dismissed';
917
+ break;
918
+ default:
919
+ $performance_nag_status = 'Inactive';
920
+ break;
921
+ }
922
+
923
+ foreach( $site_plugins as $main_file => $plugin_meta ) :
924
+ if ( ! is_plugin_active($main_file) )
925
+ continue;
926
+ $plugin_names[] = sanitize_text_field($plugin_meta['Name'] . ' ' . $plugin_meta['Version']);
927
+ endforeach;
928
+ ?>
929
+ <div id="wpp_debug" <?php echo ( "debug" == $current ) ? '' : ' style="display: none;"'; ?>>
930
+ <h3>Plugin Configuration</h3>
931
+ <p><strong>Performance Nag:</strong> <?php echo $performance_nag_status; ?></p>
932
+ <p><strong>Log Limit:</strong> <?php echo ( $this->config['tools']['log']['limit'] ) ? 'Yes, keep data for ' . $this->config['tools']['log']['expires_after'] . ' days' : 'No'; ?></p>
933
+ <p><strong>Log Views From:</strong> <?php echo ( 0 == $this->config['tools']['log']['level'] ) ? 'Visitors only' : ( (2 == $this->config['tools']['log']['level']) ? 'Logged-in users only' : 'Everyone' ); ?></p>
934
+ <p><strong>Data Caching:</strong> <?php echo ( $this->config['tools']['cache']['active'] ) ? 'Yes, ' . $this->config['tools']['cache']['interval']['value'] . ' ' . $this->config['tools']['cache']['interval']['time'] : 'No'; ?></p>
935
+ <p><strong>Data Sampling:</strong> <?php echo ( $this->config['tools']['sampling']['active'] ) ? 'Yes, with a rate of ' . $this->config['tools']['sampling']['rate'] : 'No'; ?></p>
936
+ <p><strong>External object cache:</strong> <?php echo ( wp_using_ext_object_cache() ) ? 'Yes' : 'No'; ?></p>
937
+ <p><strong>WPP_CACHE_VIEWS:</strong> <?php echo ( defined('WPP_CACHE_VIEWS') && WPP_CACHE_VIEWS ) ? 'Yes' : 'No'; ?></p>
938
+
939
+ <br />
940
+
941
+ <h3>System Info</h3>
942
+ <p><strong>PHP version:</strong> <?php echo phpversion(); ?></p>
943
+ <p><strong>PHP extensions:</strong> <?php echo implode(', ', get_loaded_extensions()); ?></p>
944
+ <p><strong>Database version:</strong> <?php echo $wpdb->get_var("SELECT VERSION();"); ?></p>
945
+ <p><strong>InnoDB availability:</strong> <?php echo $wpdb->get_var("SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE = 'InnoDB';"); ?></p>
946
+ <p><strong>WordPress version:</strong> <?php echo $wp_version; ?></p>
947
+ <p><strong>Multisite:</strong> <?php echo ( function_exists('is_multisite') && is_multisite() ) ? 'Yes' : 'No'; ?></p>
948
+ <p><strong>Active plugins:</strong> <?php echo implode(', ', $plugin_names); ?></p>
949
+ <p><strong>Theme:</strong> <?php echo $my_theme->get('Name') . ' (' . $my_theme->get('Version') . ') by ' . $my_theme->get('Author'); ?></p>
950
+ </div>
951
+ <!-- End debug -->
952
  </div>
src/Bootstrap.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
- /**
3
- * Plugin bootstrap file.
4
- */
5
- namespace WordPressPopularPosts;
6
-
7
- /** Composer autoloder */
8
- require __DIR__ . '/../vendor/autoload.php';
9
-
10
- register_activation_hook($wpp_main_plugin_file, [__NAMESPACE__ . '\Activation\Activator', 'activate']);
11
- register_deactivation_hook($wpp_main_plugin_file, [__NAMESPACE__ . '\Activation\Deactivator', 'deactivate']);
12
-
13
- $container = new Container\Container();
14
- $container->configure([
15
- new Container\WordPressPopularPostsConfiguration()
16
- ]);
17
-
18
- $WordPressPopularPosts = $container['wpp'];
19
- add_action('plugins_loaded', [$WordPressPopularPosts, 'init']);
20
-
21
- // WPP's template tags
22
- require __DIR__ . '/template-tags.php';
23
-
24
- // Deprecated functions/classes
25
- require __DIR__ . '/deprecated.php';
1
+ <?php
2
+ /**
3
+ * Plugin bootstrap file.
4
+ */
5
+ namespace WordPressPopularPosts;
6
+
7
+ /** Composer autoloder */
8
+ require __DIR__ . '/../vendor/autoload.php';
9
+
10
+ register_activation_hook($wpp_main_plugin_file, [__NAMESPACE__ . '\Activation\Activator', 'activate']);
11
+ register_deactivation_hook($wpp_main_plugin_file, [__NAMESPACE__ . '\Activation\Deactivator', 'deactivate']);
12
+
13
+ $container = new Container\Container();
14
+ $container->configure([
15
+ new Container\WordPressPopularPostsConfiguration()
16
+ ]);
17
+
18
+ $WordPressPopularPosts = $container['wpp'];
19
+ add_action('plugins_loaded', [$WordPressPopularPosts, 'init']);
20
+
21
+ // WPP's template tags
22
+ require __DIR__ . '/template-tags.php';
23
+
24
+ // Deprecated functions/classes
25
+ require __DIR__ . '/deprecated.php';
src/Cache.php CHANGED
@@ -1,112 +1,112 @@
1
- <?php
2
-
3
- /**
4
- * Helper class to store data in cache for a fixed amount of time.
5
- *
6
- * @link https://cabrerahector.com
7
- * @since 4.1.2
8
- *
9
- * @package WordPressPopularPosts
10
- * @subpackage WordPressPopularPosts/includes
11
- */
12
-
13
- /**
14
- * Helper class to store data in cache for a fixed amount of time.
15
- *
16
- * Stores data in cache via WordPress Transients (or any other available
17
- * method in the future) for a fixed amount of time to reduce the number
18
- * of database calls.
19
- *
20
- * @package WordPressPopularPosts
21
- * @subpackage WordPressPopularPosts/includes
22
- * @author Hector Cabrera <me@cabrerahector.com>
23
- */
24
-
25
- namespace WordPressPopularPosts;
26
-
27
- class Cache {
28
-
29
- /**
30
- * Retrieves cached data.
31
- *
32
- * @since 4.1.2
33
- * @access public
34
- * @param string $key The name of the cached data.
35
- * @return mixed
36
- */
37
- public static function get($key)
38
- {
39
- return get_transient($key);
40
- }
41
-
42
- /**
43
- * Retrieves cached data.
44
- *
45
- * @since 4.1.2
46
- * @access public
47
- * @param string $key The name of the cached data.
48
- * @param mixed $data The data being stored.
49
- */
50
- public static function set($key = null, $data = [], $time_value = 1, $time_unit = 'minute')
51
- {
52
- if ( !$key )
53
- return false;
54
-
55
- if (
56
- false === filter_var($time_value, FILTER_VALIDATE_INT)
57
- || $time_value <= 0
58
- ) {
59
- $time_value = 1;
60
- }
61
-
62
- switch( $time_unit ){
63
-
64
- case 'minute':
65
- $time = 60;
66
- break;
67
-
68
- case 'hour':
69
- $time = 60 * 60;
70
- break;
71
-
72
- case 'day':
73
- $time = 60 * 60 * 24;
74
- break;
75
-
76
- case 'week':
77
- $time = 60 * 60 * 24 * 7;
78
- break;
79
-
80
- case 'month':
81
- $time = 60 * 60 * 24 * 30;
82
- break;
83
-
84
- case 'year':
85
- $time = 60 * 60 * 24 * 365;
86
- break;
87
-
88
- default:
89
- $time = 60;
90
- break;
91
-
92
- }
93
-
94
- $expiration = $time * $time_value;
95
-
96
- // Store transient
97
- set_transient($key, $data, $expiration);
98
-
99
- // Store transient in WPP transients array for garbage collection
100
- $wpp_transients = get_option('wpp_transients');
101
-
102
- if ( !$wpp_transients ) {
103
- $wpp_transients = [$key];
104
- add_option('wpp_transients', $wpp_transients);
105
- } else {
106
- if ( !in_array($key, $wpp_transients) ) {
107
- $wpp_transients[] = $key;
108
- update_option('wpp_transients', $wpp_transients);
109
- }
110
- }
111
- }
112
  }
1
+ <?php
2
+
3
+ /**
4
+ * Helper class to store data in cache for a fixed amount of time.
5
+ *
6
+ * @link https://cabrerahector.com
7
+ * @since 4.1.2
8
+ *
9
+ * @package WordPressPopularPosts
10
+ * @subpackage WordPressPopularPosts/includes
11
+ */
12
+
13
+ /**
14
+ * Helper class to store data in cache for a fixed amount of time.
15
+ *
16
+ * Stores data in cache via WordPress Transients (or any other available
17
+ * method in the future) for a fixed amount of time to reduce the number
18
+ * of database calls.
19
+ *
20
+ * @package WordPressPopularPosts
21
+ * @subpackage WordPressPopularPosts/includes
22
+ * @author Hector Cabrera <me@cabrerahector.com>
23
+ */
24
+
25
+ namespace WordPressPopularPosts;
26
+
27
+ class Cache {
28
+
29
+ /**
30
+ * Retrieves cached data.
31
+ *
32
+ * @since 4.1.2
33
+ * @access public
34
+ * @param string $key The name of the cached data.
35
+ * @return mixed
36
+ */
37
+ public static function get($key)
38
+ {
39
+ return get_transient($key);
40
+ }
41
+
42
+ /**
43
+ * Retrieves cached data.
44
+ *
45
+ * @since 4.1.2
46
+ * @access public
47
+ * @param string $key The name of the cached data.
48
+ * @param mixed $data The data being stored.
49
+ */
50
+ public static function set($key = null, $data = [], $time_value = 1, $time_unit = 'minute')
51
+ {
52
+ if ( !$key )
53
+ return false;
54
+
55
+ if (
56
+ false === filter_var($time_value, FILTER_VALIDATE_INT)
57
+ || $time_value <= 0
58
+ ) {
59
+ $time_value = 1;
60
+ }
61
+
62
+ switch( $time_unit ){
63
+
64
+ case 'minute':
65
+ $time = 60;
66
+ break;
67
+
68
+ case 'hour':
69
+ $time = 60 * 60;
70
+ break;
71
+
72
+ case 'day':
73
+ $time = 60 * 60 * 24;
74
+ break;
75
+
76
+ case 'week':
77
+ $time = 60 * 60 * 24 * 7;
78
+ break;
79
+
80
+ case 'month':
81
+ $time = 60 * 60 * 24 * 30;
82
+ break;
83
+
84
+ case 'year':
85
+ $time = 60 * 60 * 24 * 365;
86
+ break;
87
+
88
+ default:
89
+ $time = 60;
90
+ break;
91
+
92
+ }
93
+
94
+ $expiration = $time * $time_value;
95
+
96
+ // Store transient
97
+ set_transient($key, $data, $expiration);
98
+
99
+ // Store transient in WPP transients array for garbage collection
100
+ $wpp_transients = get_option('wpp_transients');
101
+
102
+ if ( !$wpp_transients ) {
103
+ $wpp_transients = [$key];
104
+ add_option('wpp_transients', $wpp_transients);
105
+ } else {
106
+ if ( !in_array($key, $wpp_transients) ) {
107
+ $wpp_transients[] = $key;
108
+ update_option('wpp_transients', $wpp_transients);
109
+ }
110
+ }
111
+ }
112
  }
src/Container/Container.php CHANGED
@@ -1,110 +1,110 @@
1
- <?php
2
- /**
3
- * A Simple Dependency Injector Container (DIC).
4
- *
5
- * Largely based on Carl Alexander's Dependency Injection Container.
6
- * @link https://carlalexander.ca/dependency-injection-wordpress/
7
- */
8
-
9
- namespace WordPressPopularPosts\Container;
10
-
11
- class Container implements \ArrayAccess
12
- {
13
- /**
14
- * Values stored inside the container.
15
- *
16
- * @var array
17
- */
18
- private $values;
19
-
20
- /**
21
- * Constructor.
22
- *
23
- * @param array $values
24
- */
25
- public function __construct(array $values = [])
26
- {
27
- $this->values = $values;
28
- }
29
-
30
- /**
31
- * Configure the container using the given container configuration objects.
32
- *
33
- * @param array $configurations
34
- */
35
- public function configure(array $configurations)
36
- {
37
- foreach ($configurations as $configuration) {
38
- if ( $configuration instanceof ContainerConfigurationInterface )
39
- $configuration->modify($this);
40
- }
41
- }
42
-
43
- /**
44
- * Checks if there's a value in the container for the given key.
45
- *
46
- * @param mixed $key
47
- *
48
- * @return bool
49
- */
50
- public function offsetExists($key)
51
- {
52
- return array_key_exists($key, $this->values);
53
- }
54
-
55
- /**
56
- * Sets a value inside of the container.
57
- *
58
- * @param mixed $key
59
- * @param mixed $value
60
- */
61
- public function offsetSet($key, $value)
62
- {
63
- $this->values[$key] = $value;
64
- }
65
-
66
- /**
67
- * Unset the value in the container for the given key.
68
- *
69
- * @param mixed $key
70
- */
71
- public function offsetUnset($key)
72
- {
73
- unset($this->values[$key]);
74
- }
75
-
76
- /**
77
- * Get a value from the container.
78
- *
79
- * @param mixed $key
80
- *
81
- * @return mixed
82
- */
83
- public function offsetGet($key)
84
- {
85
- if ( ! $this->offsetExists($key) ) {
86
- throw new \InvalidArgumentException(sprintf('Container doesn\'t have a value stored for the "%s" key.', $key));
87
- }
88
- return $this->values[$key] instanceof \Closure ? $this->values[$key]($this) : $this->values[$key];
89
- }
90
-
91
- /**
92
- * Creates a closure used for creating a service using the given callable.
93
- *
94
- * @param \Closure $closure
95
- *
96
- * @return \Closure
97
- */
98
- public function service(\Closure $closure)
99
- {
100
- return function(Container $container) use ($closure) {
101
- static $object;
102
-
103
- if ( null === $object ) {
104
- $object = $closure($container);
105
- }
106
-
107
- return $object;
108
- };
109
- }
110
- }
1
+ <?php
2
+ /**
3
+ * A Simple Dependency Injector Container (DIC).
4
+ *
5
+ * Largely based on Carl Alexander's Dependency Injection Container.
6
+ * @link https://carlalexander.ca/dependency-injection-wordpress/
7
+ */
8
+
9
+ namespace WordPressPopularPosts\Container;
10
+
11
+ class Container implements \ArrayAccess
12
+ {
13
+ /**
14
+ * Values stored inside the container.
15
+ *
16
+ * @var array
17
+ */
18
+ private $values;
19
+
20
+ /**
21
+ * Constructor.
22
+ *
23
+ * @param array $values
24
+ */
25
+ public function __construct(array $values = [])
26
+ {
27
+ $this->values = $values;
28
+ }
29
+
30
+ /**
31
+ * Configure the container using the given container configuration objects.
32
+ *
33
+ * @param array $configurations
34
+ */
35
+ public function configure(array $configurations)
36
+ {
37
+ foreach ($configurations as $configuration) {
38
+ if ( $configuration instanceof ContainerConfigurationInterface )
39
+ $configuration->modify($this);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Checks if there's a value in the container for the given key.
45
+ *
46
+ * @param mixed $key
47
+ *
48
+ * @return bool
49
+ */
50
+ public function offsetExists($key)
51
+ {
52
+ return array_key_exists($key, $this->values);
53
+ }
54
+
55
+ /**
56
+ * Sets a value inside of the container.
57
+ *
58
+ * @param mixed $key
59
+ * @param mixed $value
60
+ */
61
+ public function offsetSet($key, $value)
62
+ {
63
+ $this->values[$key] = $value;
64
+ }
65
+
66
+ /**
67
+ * Unset the value in the container for the given key.
68
+ *
69
+ * @param mixed $key
70
+ */
71
+ public function offsetUnset($key)
72
+ {
73
+ unset($this->values[$key]);
74
+ }
75
+
76
+ /**
77
+ * Get a value from the container.
78
+ *
79
+ * @param mixed $key
80
+ *
81
+ * @return mixed
82
+ */
83
+ public function offsetGet($key)
84
+ {
85
+ if ( ! $this->offsetExists($key) ) {
86
+ throw new \InvalidArgumentException(sprintf('Container doesn\'t have a value stored for the "%s" key.', $key));
87
+ }
88
+ return $this->values[$key] instanceof \Closure ? $this->values[$key]($this) : $this->values[$key];
89
+ }
90
+
91
+ /**
92
+ * Creates a closure used for creating a service using the given callable.
93
+ *
94
+ * @param \Closure $closure
95
+ *
96
+ * @return \Closure
97
+ */
98
+ public function service(\Closure $closure)
99
+ {
100
+ return function(Container $container) use ($closure) {
101
+ static $object;
102
+
103
+ if ( null === $object ) {
104
+ $object = $closure($container);
105
+ }
106
+
107
+ return $object;
108
+ };
109
+ }
110
+ }
src/Container/ContainerConfigurationInterface.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- /**
3
- * Contract to modify the DIC.
4
- */
5
-
6
- namespace WordPressPopularPosts\Container;
7
-
8
- interface ContainerConfigurationInterface
9
- {
10
- /**
11
- * Modifies the given dependency injection container.
12
- *
13
- * @since 5.0.0
14
- * @param Container $container
15
- */
16
- public function modify(Container $container);
17
- }
1
+ <?php
2
+ /**
3
+ * Contract to modify the DIC.
4
+ */
5
+
6
+ namespace WordPressPopularPosts\Container;
7
+
8
+ interface ContainerConfigurationInterface
9
+ {
10
+ /**
11
+ * Modifies the given dependency injection container.
12
+ *
13
+ * @since 5.0.0
14
+ * @param Container $container
15
+ */
16
+ public function modify(Container $container);
17
+ }
src/Container/WordPressPopularPostsConfiguration.php CHANGED
@@ -1,59 +1,59 @@
1
- <?php
2
- namespace WordPressPopularPosts\Container;
3
-
4
- use WordPressPopularPosts\Settings;
5
-
6
- class WordPressPopularPostsConfiguration implements ContainerConfigurationInterface
7
- {
8
- /**
9
- * Modifies the given dependency injection container.
10
- *
11
- * @since 5.0.0
12
- * @param Container $container
13
- */
14
- public function modify(Container $container)
15
- {
16
- $container['admin_options'] = Settings::get('admin_options');
17
- $container['widget_options'] = Settings::get('widget_options');
18
-
19
- $container['i18n'] = $container->service(function(Container $container) {
20
- return new \WordPressPopularPosts\I18N();
21
- });
22
-
23
- $container['translate'] = $container->service(function(Container $container) {
24
- return new \WordPressPopularPosts\Translate();
25
- });
26
-
27
- $container['image'] = $container->service(function(Container $container) {
28
- return new \WordPressPopularPosts\Image($container['admin_options']);
29
- });
30
-
31
- $container['themer'] = $container->service(function(Container $container) {
32
- return new \WordPressPopularPosts\Themer();
33
- });
34
-
35
- $container['output'] = $container->service(function(Container $container) {
36
- return new \WordPressPopularPosts\Output($container['widget_options'], $container['admin_options'], $container['image'], $container['translate'], $container['themer']);
37
- });
38
-
39
- $container['widget'] = $container->service(function(Container $container) {
40
- return new \WordPressPopularPosts\Widget\Widget($container['widget_options'], $container['admin_options'], $container['output'], $container['image'], $container['translate'], $container['themer']);
41
- });
42
-
43
- $container['rest'] = $container->service(function(Container $container) {
44
- return new \WordPressPopularPosts\Rest\Controller($container['admin_options'], $container['translate'], $container['output']);
45
- });
46
-
47
- $container['admin'] = $container->service(function(Container $container) {
48
- return new \WordPressPopularPosts\Admin\Admin($container['admin_options'], $container['image']);
49
- });
50
-
51
- $container['front'] = $container->service(function(Container $container) {
52
- return new \WordPressPopularPosts\Front\Front($container['admin_options'], $container['translate'], $container['output']);
53
- });
54
-
55
- $container['wpp'] = $container->service(function(Container $container) {
56
- return new \WordPressPopularPosts\WordPressPopularPosts($container['i18n'], $container['rest'], $container['admin'], $container['front'], $container['widget']);
57
- });
58
- }
59
- }
1
+ <?php
2
+ namespace WordPressPopularPosts\Container;
3
+
4
+ use WordPressPopularPosts\Settings;
5
+
6
+ class WordPressPopularPostsConfiguration implements ContainerConfigurationInterface
7
+ {
8
+ /**
9
+ * Modifies the given dependency injection container.
10
+ *
11
+ * @since 5.0.0
12
+ * @param Container $container
13
+ */
14
+ public function modify(Container $container)
15
+ {
16
+ $container['admin_options'] = Settings::get('admin_options');
17
+ $container['widget_options'] = Settings::get('widget_options');
18
+
19
+ $container['i18n'] = $container->service(function(Container $container) {
20
+ return new \WordPressPopularPosts\I18N();
21
+ });
22
+
23
+ $container['translate'] = $container->service(function(Container $container) {
24
+ return new \WordPressPopularPosts\Translate();
25
+ });
26
+
27
+ $container['image'] = $container->service(function(Container $container) {
28
+ return new \WordPressPopularPosts\Image($container['admin_options']);
29
+ });
30
+
31
+ $container['themer'] = $container->service(function(Container $container) {
32
+ return new \WordPressPopularPosts\Themer();
33
+ });
34
+
35
+ $container['output'] = $container->service(function(Container $container) {
36
+ return new \WordPressPopularPosts\Output($container['widget_options'], $container['admin_options'], $container['image'], $container['translate'], $container['themer']);
37
+ });
38
+
39
+ $container['widget'] = $container->service(function(Container $container) {
40
+ return new \WordPressPopularPosts\Widget\Widget($container['widget_options'], $container['admin_options'], $container['output'], $container['image'], $container['translate'], $container['themer']);
41
+ });
42
+
43
+ $container['rest'] = $container->service(function(Container $container) {
44
+ return new \WordPressPopularPosts\Rest\Controller($container['admin_options'], $container['translate'], $container['output']);
45
+ });
46
+
47
+ $container['admin'] = $container->service(function(Container $container) {
48
+ return new \WordPressPopularPosts\Admin\Admin($container['admin_options'], $container['image']);
49
+ });
50
+
51
+ $container['front'] = $container->service(function(Container $container) {
52
+ return new \WordPressPopularPosts\Front\Front($container['admin_options'], $container['translate'], $container['output']);
53
+ });
54
+
55
+ $container['wpp'] = $container->service(function(Container $container) {
56
+ return new \WordPressPopularPosts\WordPressPopularPosts($container['i18n'], $container['rest'], $container['admin'], $container['front'], $container['widget']);
57
+ });
58
+ }
59
+ }
src/Front/Front.php CHANGED
@@ -1,567 +1,465 @@
1
- <?php
2
- /**
3
- * The public-facing functionality of the plugin.
4
- *
5
- * Defines hooks to enqueue the public-specific stylesheet and JavaScript.
6
- *
7
- * @package WordPressPopularPosts
8
- * @subpackage WordPressPopularPosts/Front
9
- * @author Hector Cabrera <me@cabrerahector.com>
10
- */
11
-
12
- namespace WordPressPopularPosts\Front;
13
-
14
- use WordPressPopularPosts\Helper;
15
- use WordPressPopularPosts\Output;
16
- use WordPressPopularPosts\Query;
17
-
18
- class Front {
19
-
20
- /**
21
- * Plugin options.
22
- *
23
- * @var array $config
24
- * @access private
25
- */
26
- private $config;
27
-
28
- /**
29
- * Translate object.
30
- *
31
- * @var \WordPressPopularPosts\Translate $translate
32
- * @access private
33
- */
34
- private $translate;
35
-
36
- /**
37
- * Output object.
38
- *
39
- * @var \WordPressPopularPosts\Output $output
40
- * @access private
41
- */
42
- private $output;
43
-
44
- /**
45
- * Construct.
46
- *
47
- * @since 5.0.0
48
- * @param array $config Admin settings.
49
- * @param \WordPressPopularPosts\Translate $translate Translate class.
50
- */
51
- public function __construct(array $config, \WordPressPopularPosts\Translate $translate, \WordPressPopularPosts\Output $output)
52
- {
53
- $this->config = $config;
54
- $this->translate = $translate;
55
- $this->output = $output;
56
- }
57
-
58
- /**
59
- * WordPress public-facing hooks.
60
- *
61
- * @since 5.0.0
62
- */
63
- public function hooks()
64
- {
65
- add_shortcode('wpp', [$this, 'wpp_shortcode']);
66
- add_action('wp_ajax_update_views_ajax', [$this, 'update_views']);
67
- add_action('wp_ajax_nopriv_update_views_ajax', [$this, 'update_views']);
68
- add_action('wp_enqueue_scripts', [$this, 'enqueue_assets']);
69
-
70
- add_action('wp_footer', [$this, 'theme_widgets']);
71
-
72
- if ( $this->config['tools']['thumbnail']['lazyload'] ) {
73
- add_action('wp_footer', [$this, 'lazyload_images']);
74
- }
75
- }
76
-
77
- /**
78
- * Enqueues public facing assets.
79
- *
80
- * @since 5.0.0
81
- */
82
- public function enqueue_assets()
83
- {
84
- // Enqueue WPP's stylesheet.
85
- if ( $this->config['tools']['css'] ) {
86
- $theme_file = get_stylesheet_directory() . '/wpp.css';
87
-
88
- if ( @is_file($theme_file) ) {
89
- wp_enqueue_style('wordpress-popular-posts-css', get_stylesheet_directory_uri() . "/wpp.css", [], WPP_VERSION, 'all');
90
- } // Load stock stylesheet
91
- else {
92
- wp_enqueue_style('wordpress-popular-posts-css', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/wpp.css', [], WPP_VERSION, 'all');
93
- }
94
- }
95
-
96
- // Enqueue WPP's library.
97
- $is_single = 0;
98
-
99
- if (
100
- ( 0 == $this->config['tools']['log']['level'] && !is_user_logged_in() )
101
- || ( 1 == $this->config['tools']['log']['level'] )
102
- || ( 2 == $this->config['tools']['log']['level'] && is_user_logged_in() )
103
- ) {
104
- $is_single = Helper::is_single();
105
- }
106
-
107
- wp_register_script('wpp-js', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/wpp-5.0.0.min.js', [], WPP_VERSION, false);
108
- $params = [
109
- 'sampling_active' => (int) $this->config['tools']['sampling']['active'],
110
- 'sampling_rate' => $this->config['tools']['sampling']['rate'],
111
- 'ajax_url' => esc_url_raw(rest_url('wordpress-popular-posts/v1/popular-posts')),
112
- 'ID' => $is_single,
113
- 'token' => wp_create_nonce('wp_rest'),
114
- 'debug' => WP_DEBUG
115
- ];
116
- wp_localize_script('wpp-js', 'wpp_params', $params);
117
- wp_enqueue_script('wpp-js');
118
- }
119
-
120
- /**
121
- * Updates views count on page load via AJAX.
122
- *
123
- * @since 2.0.0
124
- */
125
- public function update_views()
126
- {
127
- if ( ! wp_verify_nonce($_POST['token'], 'wpp-token') || ! Helper::is_number($_POST['wpp_id']) ) {
128
- die( "WPP: Oops, invalid request!" );
129
- }
130
-
131
- $nonce = $_POST['token'];
132
- $post_ID = $_POST['wpp_id'];
133
- $exec_time = 0;
134
-
135
- $start = Helper::microtime_float();
136
- $result = $this->update_views_count($post_ID);
137
- $end = Helper::microtime_float();
138
- $exec_time += round($end - $start, 6);
139
-
140
- if ( $result ) {
141
- die("WPP: OK. Execution time: " . $exec_time . " seconds");
142
- }
143
-
144
- die("WPP: Oops, could not update the views count!");
145
- }
146
-
147
- /**
148
- * Updates views count.
149
- *
150
- * @since 1.4.0
151
- * @access private
152
- * @global object $wpdb
153
- * @param int $post_ID
154
- * @return bool|int FALSE if query failed, TRUE on success
155
- */
156
- private function update_views_count($post_ID) {
157
- /*
158
- TODO:
159
- For WordPress Multisite, we must define the DIEONDBERROR constant for database errors to display like so:
160
- <?php define( 'DIEONDBERROR', true ); ?>
161
- */
162
- global $wpdb;
163
- $table = $wpdb->prefix . "popularposts";
164
- $wpdb->show_errors();
165
-
166
- // Get translated object ID
167
- $post_ID = $this->translate->get_object_id(
168
- $post_ID,
169
- get_post_type($post_ID),
170
- true,
171
- $this->translate->get_default_language()
172
- );
173
- $now = Helper::now();
174
- $curdate = Helper::curdate();
175
- $views = ( $this->config['tools']['sampling']['active'] )
176
- ? $this->config['tools']['sampling']['rate']
177
- : 1;
178
-
179
- // Allow WP themers / coders perform an action
180
- // before updating views count
181
- if ( has_action('wpp_pre_update_views') )
182
- do_action('wpp_pre_update_views', $post_ID, $views);
183
-
184
- // Update all-time table
185
- $result1 = $wpdb->query($wpdb->prepare(
186
- "INSERT INTO {$table}data
187
- (postid, day, last_viewed, pageviews) VALUES (%d, %s, %s, %d)
188
- ON DUPLICATE KEY UPDATE pageviews = pageviews + %d, last_viewed = %s;",
189
- $post_ID,
190
- $now,
191
- $now,
192
- $views,
193
- $views,
194
- $now
195
- ));
196
-
197
- // Update range (summary) table
198
- $result2 = $wpdb->query($wpdb->prepare(
199
- "INSERT INTO {$table}summary
200
- (postid, pageviews, view_date, view_datetime) VALUES (%d, %d, %s, %s)
201
- ON DUPLICATE KEY UPDATE pageviews = pageviews + %d, view_datetime = %s;",
202
- $post_ID,
203
- $views,
204
- $curdate,
205
- $now,
206
- $views,
207
- $now
208
- ));
209
-
210
- if ( !$result1 || !$result2 )
211
- return false;
212
-
213
- // Allow WP themers / coders perform an action
214
- // after updating views count
215
- if ( has_action('wpp_post_update_views' ))
216
- do_action('wpp_post_update_views', $post_ID);
217
-
218
- return true;
219
- }
220
-
221
- /**
222
- * WPP shortcode handler.
223
- *
224
- * @since 1.4.0
225
- * @param array $atts User defined attributes in shortcode tag
226
- * @return string
227
- */
228
- public function wpp_shortcode($atts = null) {
229
- /**
230
- * @var string $header
231
- * @var int $limit
232
- * @var int $offset
233
- * @var string $range
234
- * @var bool $freshness
235
- * @var string $order_by
236
- * @var string $post_type
237
- * @var string $pid
238
- * @var string $cat
239
- * @var string $author
240
- * @var int $title_length
241
- * @var int $title_by_words
242
- * @var int $excerpt_length
243
- * @var int $excerpt_format
244
- * @var int $excerpt_by_words
245
- * @var int $thumbnail_width
246
- * @var int $thumbnail_height
247
- * @var bool $rating
248
- * @var bool $stats_comments
249
- * @var bool $stats_views
250
- * @var bool $stats_author
251
- * @var bool $stats_date
252
- * @var string $stats_date_format
253
- * @var bool $stats_category
254
- * @var string $wpp_start
255
- * @var string $wpp_end
256
- * @var string $header_start
257
- * @var string $header_end
258
- * @var string $post_html
259
- * @var bool $php
260
- */
261
- extract(shortcode_atts([
262
- 'header' => '',
263
- 'limit' => 10,
264
- 'offset' => 0,
265
- 'range' => 'daily',
266
- 'time_unit' => 'hour',
267
- 'time_quantity' => 24,
268
- 'freshness' => false,
269
- 'order_by' => 'views',
270
- 'post_type' => 'post',
271
- 'pid' => '',
272
- 'cat' => '',
273
- 'taxonomy' => 'category',
274
- 'term_id' => '',
275
- 'author' => '',
276
- 'title_length' => 0,
277
- 'title_by_words' => 0,
278
- 'excerpt_length' => 0,
279
- 'excerpt_format' => 0,
280
- 'excerpt_by_words' => 0,
281
- 'thumbnail_width' => 0,
282
- 'thumbnail_height' => 0,
283
- 'rating' => false,
284
- 'stats_comments' => false,
285
- 'stats_views' => true,
286
- 'stats_author' => false,
287
- 'stats_date' => false,
288
- 'stats_date_format' => 'F j, Y',
289
- 'stats_category' => false,
290
- 'stats_taxonomy' => false,
291
- 'wpp_start' => '<ul class="wpp-list">',
292
- 'wpp_end' => '</ul>',
293
- 'header_start' => '<h2>',
294
- 'header_end' => '</h2>',
295
- 'post_html' => '',
296
- 'php' => false
297
- ], $atts, 'wpp'));
298
-
299
- // possible values for "Time Range" and "Order by"
300
- $time_units = ["minute", "hour", "day", "week", "month"];
301
- $range_values = ["daily", "last24hours", "weekly", "last7days", "monthly", "last30days", "all", "custom"];
302
- $order_by_values = ["comments", "views", "avg"];
303
-
304
- $shortcode_ops = [
305
- 'title' => strip_tags($header),
306
- 'limit' => ( ! empty($limit ) && Helper::is_number($limit) && $limit > 0 ) ? $limit : 10,
307
- 'offset' => ( ! empty($offset) && Helper::is_number($offset) && $offset >= 0 ) ? $offset : 0,
308
- 'range' => ( in_array($range, $range_values) ) ? $range : 'daily',
309
- 'time_quantity' => ( ! empty($time_quantity ) && Helper::is_number($time_quantity) && $time_quantity > 0 ) ? $time_quantity : 24,
310
- 'time_unit' => ( in_array($time_unit, $time_units) ) ? $time_unit : 'hour',
311
- 'freshness' => empty($freshness) ? false : $freshness,
312
- 'order_by' => ( in_array($order_by, $order_by_values) ) ? $order_by : 'views',
313
- 'post_type' => empty($post_type) ? 'post,page' : $post_type,
314
- 'pid' => rtrim(preg_replace('|[^0-9,]|', '', $pid), ","),
315
- 'cat' => rtrim(preg_replace('|[^0-9,-]|', '', $cat), ","),
316
- 'taxonomy' => empty($taxonomy) ? 'category' : $taxonomy,
317
- 'term_id' => rtrim(preg_replace('|[^0-9,;-]|', '', $term_id), ","),
318
- 'author' => rtrim(preg_replace('|[^0-9,]|', '', $author), ","),
319
- 'shorten_title' => [
320
- 'active' => ( ! empty($title_length) && Helper::is_number($title_length) && $title_length > 0 ),
321
- 'length' => ( ! empty($title_length) && Helper::is_number($title_length) ) ? $title_length : 0,
322
- 'words' => ( ! empty($title_by_words) && Helper::is_number($title_by_words) && $title_by_words > 0 ),
323
- ],
324
- 'post-excerpt' => [
325
- 'active' => ( ! empty($excerpt_length) && Helper::is_number($excerpt_length) && $excerpt_length > 0 ),
326
- 'length' => ( ! empty($excerpt_length) && Helper::is_number($excerpt_length) ) ? $excerpt_length : 0,
327
- 'keep_format' => ( ! empty($excerpt_format) && Helper::is_number($excerpt_format) && $excerpt_format > 0 ),
328
- 'words' => ( ! empty($excerpt_by_words) && Helper::is_number($excerpt_by_words) && $excerpt_by_words > 0 ),
329
- ],
330
- 'thumbnail' => [
331
- 'active' => ( ! empty($thumbnail_width) && Helper::is_number($thumbnail_width) && $thumbnail_width > 0 ),
332
- 'width' => ( ! empty($thumbnail_width) && Helper::is_number($thumbnail_width) && $thumbnail_width > 0 ) ? $thumbnail_width : 0,
333
- 'height' => ( ! empty($thumbnail_height) && Helper::is_number($thumbnail_height) && $thumbnail_height > 0 ) ? $thumbnail_height : 0,
334
- ],
335
- 'rating' => empty($rating) ? false : $rating,
336
- 'stats_tag' => [
337
- 'comment_count' => empty($stats_comments) ? false : $stats_comments,
338
- 'views' => empty($stats_views) ? false : $stats_views,
339
- 'author' => empty($stats_author) ? false : $stats_author,
340
- 'date' => [
341
- 'active' => empty($stats_date) ? false : $stats_date,
342
- 'format' => empty($stats_date_format) ? 'F j, Y' : $stats_date_format
343
- ],
344
- 'category' => empty($stats_category) ? false : $stats_category,
345
- 'taxonomy' => [
346
- 'active' => empty($stats_taxonomy) ? false : $stats_taxonomy,
347
- 'name' => empty($taxonomy) ? 'category' : $taxonomy,
348
- ]
349
- ],
350
- 'markup' => [
351
- 'custom_html' => true,
352
- 'wpp-start' => empty($wpp_start) ? '' : $wpp_start,
353
- 'wpp-end' => empty($wpp_end) ? '' : $wpp_end,
354
- 'title-start' => empty($header_start) ? '' : $header_start,
355
- 'title-end' => empty($header_end) ? '' : $header_end,
356
- 'post-html' => empty($post_html) ? '<li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li>' : $post_html
357
- ]
358
- ];
359
-
360
- // Post / Page / CTP filter
361
- $ids = array_filter(explode(",", $shortcode_ops['pid']), 'is_numeric');
362
- // Got no valid IDs, clear
363
- if ( empty($ids) ) {
364
- $shortcode_ops['pid'] = '';
365
- }
366
-
367
- // Category filter
368
- $ids = array_filter(explode(",", $shortcode_ops['cat']), 'is_numeric');
369
- // Got no valid IDs, clear
370
- if ( empty($ids) ) {
371
- $shortcode_ops['cat'] = '';
372
- }
373
-
374
- // Author filter
375
- $ids = array_filter(explode( ",", $shortcode_ops['author']), 'is_numeric');
376
- // Got no valid IDs, clear
377
- if ( empty($ids) ) {
378
- $shortcode_ops['author'] = '';
379
- }
380
-
381
- $shortcode_content = '';
382
-
383
- // is there a title defined by user?
384
- if (
385
- ! empty($header)
386
- && ! empty($header_start)
387
- && ! empty($header_end)
388
- ) {
389
- $shortcode_content .= htmlspecialchars_decode($header_start, ENT_QUOTES) . $header . htmlspecialchars_decode($header_end, ENT_QUOTES);
390
- }
391
-
392
- $cached = false;
393
-
394
- // Return cached results
395
- if ( $this->config['tools']['cache']['active'] ) {
396
-
397
- $key = md5(json_encode($shortcode_ops));
398
- $popular_posts = \WordPressPopularPosts\Cache::get($key);
399
-
400
- if ( false === $popular_posts ) {
401
- $popular_posts = new Query($shortcode_ops);
402
-
403
- $time_value = $this->config['tools']['cache']['interval']['value']; // eg. 5
404
- $time_unit = $this->config['tools']['cache']['interval']['time']; // eg. 'minute'
405
-
406
- // No popular posts found, check again in 1 minute
407
- if ( ! $popular_posts->get_posts() ) {
408
- $time_value = 1;
409
- $time_unit = 'minute';
410
- }
411
-
412
- \WordPressPopularPosts\Cache::set(
413
- $key,
414
- $popular_posts,
415
- $time_value,
416
- $time_unit
417
- );
418
- }
419
-
420
- $cached = true;
421
-
422
- } // Get popular posts
423
- else {
424
- $popular_posts = new Query($shortcode_ops);
425
- }
426
-
427
- $this->output->set_data($popular_posts->get_posts());
428
- $this->output->set_public_options($shortcode_ops);
429
- $this->output->build_output();
430
-
431
- $shortcode_content .= $this->output->get_output();
432
-
433
- return $shortcode_content;
434
- }
435
-
436
- /**
437
- * Themes widgets.
438
- *
439
- * @since 5.0.0
440
- */
441
- public function theme_widgets()
442
- {
443
- ?>
444
- <script type="text/javascript">
445
- (function(){
446
- document.addEventListener('DOMContentLoaded', function(){
447
- let wpp_widgets = document.querySelectorAll('.popular-posts-sr');
448
-
449
- if ( wpp_widgets ) {
450
- for (let i = 0; i < wpp_widgets.length; i++) {
451
- let wpp_widget = wpp_widgets[i];
452
- WordPressPopularPosts.theme(wpp_widget);
453
- }
454
- }
455
- });
456
- })();
457
- </script>
458
- <?php
459
- }
460
-
461
- /**
462
- * Lazy loads WPP's images.
463
- *
464
- * @since 5.0.0
465
- */
466
- public function lazyload_images()
467
- {
468
- ?>
469
- <script>
470
- var WPPImageObserver = null;
471
-
472
- function wpp_load_img(img) {
473
- if ( ! 'imgSrc' in img.dataset || ! img.dataset.imgSrc )
474
- return;
475
-
476
- img.src = img.dataset.imgSrc;
477
-
478
- if ( 'imgSrcset' in img.dataset ) {
479
- img.srcset = img.dataset.imgSrcset;
480
- img.removeAttribute('data-img-srcset');
481
- }
482
-
483
- img.classList.remove('wpp-lazyload');
484
- img.removeAttribute('data-img-src');
485
- img.classList.add('wpp-lazyloaded');
486
- }
487
-
488
- function wpp_observe_imgs(){
489
- let wpp_images = document.querySelectorAll('img.wpp-lazyload'),
490
- wpp_widgets = document.querySelectorAll('.popular-posts-sr');
491
-
492
- if ( wpp_images.length || wpp_widgets.length ) {
493
- if ( 'IntersectionObserver' in window ) {
494
- WPPImageObserver = new IntersectionObserver(function(entries, observer) {
495
- entries.forEach(function(entry) {
496
- if (entry.isIntersecting) {
497
- let img = entry.target;
498
- wpp_load_img(img);
499
- WPPImageObserver.unobserve(img);
500
- }
501
- });
502
- });
503
-
504
- if ( wpp_images.length ) {
505
- wpp_images.forEach(function(image) {
506
- WPPImageObserver.observe(image);
507
- });
508
- }
509
-
510
- if ( wpp_widgets.length ) {
511
- for (var i = 0; i < wpp_widgets.length; i++) {
512
- let wpp_widget_images = wpp_widgets[i].querySelectorAll('img.wpp-lazyload');
513
-
514
- if ( ! wpp_widget_images.length && wpp_widgets[i].shadowRoot ) {
515
- wpp_widget_images = wpp_widgets[i].shadowRoot.querySelectorAll('img.wpp-lazyload');
516
- }
517
-
518
- if ( wpp_widget_images.length ) {
519
- wpp_widget_images.forEach(function(image) {
520
- WPPImageObserver.observe(image);
521
- });
522
- }
523
- }
524
- }
525
- } /** Fallback for older browsers */
526
- else {
527
- if ( wpp_images.length ) {
528
- for (var i = 0; i < wpp_images.length; i++) {
529
- wpp_load_img(wpp_images[i]);
530
- wpp_images[i].classList.remove('wpp-lazyloaded');
531
- }
532
- }
533
-
534
- if ( wpp_widgets.length ) {
535
- for (var j = 0; j < wpp_widgets.length; j++) {
536
- let wpp_widget = wpp_widgets[j],
537
- wpp_widget_images = wpp_widget.querySelectorAll('img.wpp-lazyload');
538
-
539
- if ( ! wpp_widget_images.length && wpp_widget.shadowRoot ) {
540
- wpp_widget_images = wpp_widget.shadowRoot.querySelectorAll('img.wpp-lazyload');
541
- }
542
-
543
- if ( wpp_widget_images.length ) {
544
- for (var k = 0; k < wpp_widget_images.length; k++) {
545
- wpp_load_img(wpp_widget_images[k]);
546
- wpp_widget_images[k].classList.remove('wpp-lazyloaded');
547
- }
548
- }
549
- }
550
- }
551
- }
552
- }
553
- }
554
-
555
- document.addEventListener('DOMContentLoaded', function() {
556
- wpp_observe_imgs();
557
-
558
- // When an ajaxified WPP widget loads,
559
- // Lazy load its images
560
- document.addEventListener('wpp-onload', function(){
561
- wpp_observe_imgs();
562
- });
563
- });
564
- </script>
565
- <?php
566
- }
567
- }
1
+ <?php
2
+ /**
3
+ * The public-facing functionality of the plugin.
4
+ *
5
+ * Defines hooks to enqueue the public-specific stylesheet and JavaScript.
6
+ *
7
+ * @package WordPressPopularPosts
8
+ * @subpackage WordPressPopularPosts/Front
9
+ * @author Hector Cabrera <me@cabrerahector.com>
10
+ */
11
+
12
+ namespace WordPressPopularPosts\Front;
13
+
14
+ use WordPressPopularPosts\Helper;
15
+ use WordPressPopularPosts\Output;
16
+ use WordPressPopularPosts\Query;
17
+
18
+ class Front {
19
+
20
+ /**
21
+ * Plugin options.
22
+ *
23
+ * @var array $config
24
+ * @access private
25
+ */
26
+ private $config;
27
+
28
+ /**
29
+ * Translate object.
30
+ *
31
+ * @var \WordPressPopularPosts\Translate $translate
32
+ * @access private
33
+ */
34
+ private $translate;
35
+
36
+ /**
37
+ * Output object.
38
+ *
39
+ * @var \WordPressPopularPosts\Output $output
40
+ * @access private
41
+ */
42
+ private $output;
43
+
44
+ /**
45
+ * Construct.
46
+ *
47
+ * @since 5.0.0
48
+ * @param array $config Admin settings.
49
+ * @param \WordPressPopularPosts\Translate $translate Translate class.
50
+ */
51
+ public function __construct(array $config, \WordPressPopularPosts\Translate $translate, \WordPressPopularPosts\Output $output)
52
+ {
53
+ $this->config = $config;
54
+ $this->translate = $translate;
55
+ $this->output = $output;
56
+ }
57
+
58
+ /**
59
+ * WordPress public-facing hooks.
60
+ *
61
+ * @since 5.0.0
62
+ */
63
+ public function hooks()
64
+ {
65
+ add_shortcode('wpp', [$this, 'wpp_shortcode']);
66
+ add_action('wp_ajax_update_views_ajax', [$this, 'update_views']);
67
+ add_action('wp_ajax_nopriv_update_views_ajax', [$this, 'update_views']);
68
+ add_action('wp_enqueue_scripts', [$this, 'enqueue_assets']);
69
+ add_filter('script_loader_tag', [$this, 'convert_inline_js_into_json'], 10, 3);
70
+ }
71
+
72
+ /**
73
+ * Enqueues public facing assets.
74
+ *
75
+ * @since 5.0.0
76
+ */
77
+ public function enqueue_assets()
78
+ {
79
+ // Enqueue WPP's stylesheet.
80
+ if ( $this->config['tools']['css'] ) {
81
+ $theme_file = get_stylesheet_directory() . '/wpp.css';
82
+
83
+ if ( @is_file($theme_file) ) {
84
+ wp_enqueue_style('wordpress-popular-posts-css', get_stylesheet_directory_uri() . "/wpp.css", [], WPP_VERSION, 'all');
85
+ } // Load stock stylesheet
86
+ else {
87
+ wp_enqueue_style('wordpress-popular-posts-css', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/wpp.css', [], WPP_VERSION, 'all');
88
+ }
89
+ }
90
+
91
+ // Enqueue WPP's library.
92
+ $is_single = 0;
93
+
94
+ if (
95
+ ( 0 == $this->config['tools']['log']['level'] && !is_user_logged_in() )
96
+ || ( 1 == $this->config['tools']['log']['level'] )
97
+ || ( 2 == $this->config['tools']['log']['level'] && is_user_logged_in() )
98
+ ) {
99
+ $is_single = Helper::is_single();
100
+ }
101
+
102
+ wp_register_script('wpp-js', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/wpp-5.2.0.min.js', [], WPP_VERSION, false);
103
+ $params = [
104
+ 'sampling_active' => (int) $this->config['tools']['sampling']['active'],
105
+ 'sampling_rate' => $this->config['tools']['sampling']['rate'],
106
+ 'ajax_url' => esc_url_raw(rest_url('wordpress-popular-posts/v1/popular-posts')),
107
+ 'ID' => $is_single,
108
+ 'token' => wp_create_nonce('wp_rest'),
109
+ 'lang' => function_exists('PLL') ? $this->translate->get_current_language() : null,
110
+ 'debug' => WP_DEBUG
111
+ ];
112
+ wp_enqueue_script('wpp-js');
113
+ wp_add_inline_script('wpp-js', json_encode($params), 'before');
114
+ }
115
+
116
+ /**
117
+ * Converts inline script tag into type=application/json.
118
+ *
119
+ * This function mods the original script tag as printed
120
+ * by WordPress which contains the data for the wpp_params
121
+ * object into a JSON script. This improves compatibility
122
+ * with Content Security Policy (CSP).
123
+ *
124
+ * @since 5.2.0
125
+ * @param string $tag
126
+ * @param string $handle
127
+ * @param string $src
128
+ * @return string $tag
129
+ */
130
+ function convert_inline_js_into_json($tag, $handle, $src)
131
+ {
132
+ if ( 'wpp-js' === $handle ) {
133
+ $dom = new \DOMDocument();
134
+ @$dom->loadHTML('<html>' . $tag .'</html>', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
135
+ $script_tag = $dom->getElementsByTagName('script')->item(0);
136
+
137
+ $json_script_tag = $dom->createElement('script', $script_tag->nodeValue);
138
+ $json_script_tag->setAttribute('type', 'application/json');
139
+ $json_script_tag->setAttribute('id', 'wpp-json');
140
+
141
+ $script_tag->parentNode->replaceChild($json_script_tag, $script_tag);
142
+
143
+ $tag = str_replace(['<html>', '</html>'], '', $dom->saveHTML());
144
+ }
145
+
146
+ return $tag;
147
+ }
148
+
149
+ /**
150
+ * Updates views count on page load via AJAX.
151
+ *
152
+ * @since 2.0.0
153
+ */
154
+ public function update_views()
155
+ {
156
+ if ( ! wp_verify_nonce($_POST['token'], 'wpp-token') || ! Helper::is_number($_POST['wpp_id']) ) {
157
+ die( "WPP: Oops, invalid request!" );
158
+ }
159
+
160
+ $nonce = $_POST['token'];
161
+ $post_ID = $_POST['wpp_id'];
162
+ $exec_time = 0;
163
+
164
+ $start = Helper::microtime_float();
165
+ $result = $this->update_views_count($post_ID);
166
+ $end = Helper::microtime_float();
167
+ $exec_time += round($end - $start, 6);
168
+
169
+ if ( $result ) {
170
+ die("WPP: OK. Execution time: " . $exec_time . " seconds");
171
+ }
172
+
173
+ die("WPP: Oops, could not update the views count!");
174
+ }
175
+
176
+ /**
177
+ * Updates views count.
178
+ *
179
+ * @since 1.4.0
180
+ * @access private
181
+ * @global object $wpdb
182
+ * @param int $post_ID
183
+ * @return bool|int FALSE if query failed, TRUE on success
184
+ */
185
+ private function update_views_count($post_ID) {
186
+ /*
187
+ TODO:
188
+ For WordPress Multisite, we must define the DIEONDBERROR constant for database errors to display like so:
189
+ <?php define( 'DIEONDBERROR', true ); ?>
190
+ */
191
+ global $wpdb;
192
+ $table = $wpdb->prefix . "popularposts";
193
+ $wpdb->show_errors();
194
+
195
+ // Get translated object ID
196
+ $post_ID = $this->translate->get_object_id(
197
+ $post_ID,
198
+ get_post_type($post_ID),
199
+ true,
200
+ $this->translate->get_default_language()
201
+ );
202
+ $now = Helper::now();
203
+ $curdate = Helper::curdate();
204
+ $views = ( $this->config['tools']['sampling']['active'] )
205
+ ? $this->config['tools']['sampling']['rate']
206
+ : 1;
207
+
208
+ // Allow WP themers / coders perform an action
209
+ // before updating views count
210
+ if ( has_action('wpp_pre_update_views') )
211
+ do_action('wpp_pre_update_views', $post_ID, $views);
212
+
213
+ // Update all-time table
214
+ $result1 = $wpdb->query($wpdb->prepare(
215
+ "INSERT INTO {$table}data
216
+ (postid, day, last_viewed, pageviews) VALUES (%d, %s, %s, %d)
217
+ ON DUPLICATE KEY UPDATE pageviews = pageviews + %d, last_viewed = %s;",
218
+ $post_ID,
219
+ $now,
220
+ $now,
221
+ $views,
222
+ $views,
223
+ $now
224
+ ));
225
+
226
+ // Update range (summary) table
227
+ $result2 = $wpdb->query($wpdb->prepare(
228
+ "INSERT INTO {$table}summary
229
+ (postid, pageviews, view_date, view_datetime) VALUES (%d, %d, %s, %s)
230
+ ON DUPLICATE KEY UPDATE pageviews = pageviews + %d, view_datetime = %s;",
231
+ $post_ID,
232
+ $views,
233
+ $curdate,
234
+ $now,
235
+ $views,
236
+ $now
237
+ ));
238
+
239
+ if ( !$result1 || !$result2 )
240
+ return false;
241
+
242
+ // Allow WP themers / coders perform an action
243
+ // after updating views count
244
+ if ( has_action('wpp_post_update_views' ))
245
+ do_action('wpp_post_update_views', $post_ID);
246
+
247
+ return true;
248
+ }
249
+
250
+ /**
251
+ * WPP shortcode handler.
252
+ *
253
+ * @since 1.4.0
254
+ * @param array $atts User defined attributes in shortcode tag
255
+ * @return string
256
+ */
257
+ public function wpp_shortcode($atts = null) {
258
+ /**
259
+ * @var string $header
260
+ * @var int $limit
261
+ * @var int $offset
262
+ * @var string $range
263
+ * @var bool $freshness
264
+ * @var string $order_by
265
+ * @var string $post_type
266
+ * @var string $pid
267
+ * @var string $cat
268
+ * @var string $author
269
+ * @var int $title_length
270
+ * @var int $title_by_words
271
+ * @var int $excerpt_length
272
+ * @var int $excerpt_format
273
+ * @var int $excerpt_by_words
274
+ * @var int $thumbnail_width
275
+ * @var int $thumbnail_height
276
+ * @var bool $rating
277
+ * @var bool $stats_comments
278
+ * @var bool $stats_views
279
+ * @var bool $stats_author
280
+ * @var bool $stats_date
281
+ * @var string $stats_date_format
282
+ * @var bool $stats_category
283
+ * @var string $wpp_start
284
+ * @var string $wpp_end
285
+ * @var string $header_start
286
+ * @var string $header_end
287
+ * @var string $post_html
288
+ * @var bool $php
289
+ */
290
+ extract(shortcode_atts([
291
+ 'header' => '',
292
+ 'limit' => 10,
293
+ 'offset' => 0,
294
+ 'range' => 'daily',
295
+ 'time_unit' => 'hour',
296
+ 'time_quantity' => 24,
297
+ 'freshness' => false,
298
+ 'order_by' => 'views',
299
+ 'post_type' => 'post',
300
+ 'pid' => '',
301
+ 'cat' => '',
302
+ 'taxonomy' => 'category',
303
+ 'term_id' => '',
304
+ 'author' => '',
305
+ 'title_length' => 0,
306
+ 'title_by_words' => 0,
307
+ 'excerpt_length' => 0,
308
+ 'excerpt_format' => 0,
309
+ 'excerpt_by_words' => 0,
310
+ 'thumbnail_width' => 0,
311
+ 'thumbnail_height' => 0,
312
+ 'rating' => false,
313
+ 'stats_comments' => false,
314
+ 'stats_views' => true,
315
+ 'stats_author' => false,
316
+ 'stats_date' => false,
317
+ 'stats_date_format' => 'F j, Y',
318
+ 'stats_category' => false,
319
+ 'stats_taxonomy' => false,
320
+ 'wpp_start' => '<ul class="wpp-list">',
321
+ 'wpp_end' => '</ul>',
322
+ 'header_start' => '<h2>',
323
+ 'header_end' => '</h2>',
324
+ 'post_html' => '',
325
+ 'php' => false
326
+ ], $atts, 'wpp'));
327
+
328
+ // possible values for "Time Range" and "Order by"
329
+ $time_units = ["minute", "hour", "day", "week", "month"];
330
+ $range_values = ["daily", "last24hours", "weekly", "last7days", "monthly", "last30days", "all", "custom"];
331
+ $order_by_values = ["comments", "views", "avg"];
332
+
333
+ $shortcode_ops = [
334
+ 'title' => strip_tags($header),
335
+ 'limit' => ( ! empty($limit ) && Helper::is_number($limit) && $limit > 0 ) ? $limit : 10,
336
+ 'offset' => ( ! empty($offset) && Helper::is_number($offset) && $offset >= 0 ) ? $offset : 0,
337
+ 'range' => ( in_array($range, $range_values) ) ? $range : 'daily',
338
+ 'time_quantity' => ( ! empty($time_quantity ) && Helper::is_number($time_quantity) && $time_quantity > 0 ) ? $time_quantity : 24,
339
+ 'time_unit' => ( in_array($time_unit, $time_units) ) ? $time_unit : 'hour',
340
+ 'freshness' => empty($freshness) ? false : $freshness,
341
+ 'order_by' => ( in_array($order_by, $order_by_values) ) ? $order_by : 'views',
342
+ 'post_type' => empty($post_type) ? 'post,page' : $post_type,
343
+ 'pid' => rtrim(preg_replace('|[^0-9,]|', '', $pid), ","),
344
+ 'cat' => rtrim(preg_replace('|[^0-9,-]|', '', $cat), ","),
345
+ 'taxonomy' => empty($taxonomy) ? 'category' : $taxonomy,
346
+ 'term_id' => rtrim(preg_replace('|[^0-9,;-]|', '', $term_id), ","),
347
+ 'author' => rtrim(preg_replace('|[^0-9,]|', '', $author), ","),
348
+ 'shorten_title' => [
349
+ 'active' => ( ! empty($title_length) && Helper::is_number($title_length) && $title_length > 0 ),
350
+ 'length' => ( ! empty($title_length) && Helper::is_number($title_length) ) ? $title_length : 0,
351
+ 'words' => ( ! empty($title_by_words) && Helper::is_number($title_by_words) && $title_by_words > 0 ),
352
+ ],
353
+ 'post-excerpt' => [
354
+ 'active' => ( ! empty($excerpt_length) && Helper::is_number($excerpt_length) && $excerpt_length > 0 ),
355
+ 'length' => ( ! empty($excerpt_length) && Helper::is_number($excerpt_length) ) ? $excerpt_length : 0,
356
+ 'keep_format' => ( ! empty($excerpt_format) && Helper::is_number($excerpt_format) && $excerpt_format > 0 ),
357
+ 'words' => ( ! empty($excerpt_by_words) && Helper::is_number($excerpt_by_words) && $excerpt_by_words > 0 ),
358
+ ],
359
+ 'thumbnail' => [
360
+ 'active' => ( ! empty($thumbnail_width) && Helper::is_number($thumbnail_width) && $thumbnail_width > 0 ),
361
+ 'width' => ( ! empty($thumbnail_width) && Helper::is_number($thumbnail_width) && $thumbnail_width > 0 ) ? $thumbnail_width : 0,
362
+ 'height' => ( ! empty($thumbnail_height) && Helper::is_number($thumbnail_height) && $thumbnail_height > 0 ) ? $thumbnail_height : 0,
363
+ ],
364
+ 'rating' => empty($rating) ? false : $rating,
365
+ 'stats_tag' => [
366
+ 'comment_count' => empty($stats_comments) ? false : $stats_comments,
367
+ 'views' => empty($stats_views) ? false : $stats_views,
368
+ 'author' => empty($stats_author) ? false : $stats_author,
369
+ 'date' => [
370
+ 'active' => empty($stats_date) ? false : $stats_date,
371
+ 'format' => empty($stats_date_format) ? 'F j, Y' : $stats_date_format
372
+ ],
373
+ 'category' => empty($stats_category) ? false : $stats_category,
374
+ 'taxonomy' => [
375
+ 'active' => empty($stats_taxonomy) ? false : $stats_taxonomy,
376
+ 'name' => empty($taxonomy) ? 'category' : $taxonomy,
377
+ ]
378
+ ],
379
+ 'markup' => [
380
+ 'custom_html' => true,
381
+ 'wpp-start' => empty($wpp_start) ? '' : $wpp_start,
382
+ 'wpp-end' => empty($wpp_end) ? '' : $wpp_end,
383
+ 'title-start' => empty($header_start) ? '' : $header_start,
384
+ 'title-end' => empty($header_end) ? '' : $header_end,
385
+ 'post-html' => empty($post_html) ? '<li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li>' : $post_html
386
+ ]
387
+ ];
388
+
389
+ // Post / Page / CTP filter
390
+ $ids = array_filter(explode(",", $shortcode_ops['pid']), 'is_numeric');
391
+ // Got no valid IDs, clear
392
+ if ( empty($ids) ) {
393
+ $shortcode_ops['pid'] = '';
394
+ }
395
+
396
+ // Category filter
397
+ $ids = array_filter(explode(",", $shortcode_ops['cat']), 'is_numeric');
398
+ // Got no valid IDs, clear
399
+ if ( empty($ids) ) {
400
+ $shortcode_ops['cat'] = '';
401
+ }
402
+
403
+ // Author filter
404
+ $ids = array_filter(explode( ",", $shortcode_ops['author']), 'is_numeric');
405
+ // Got no valid IDs, clear
406
+ if ( empty($ids) ) {
407
+ $shortcode_ops['author'] = '';
408
+ }
409
+
410
+ $shortcode_content = '';
411
+
412
+ // is there a title defined by user?
413
+ if (
414
+ ! empty($header)
415
+ && ! empty($header_start)
416
+ && ! empty($header_end)
417
+ ) {
418
+ $shortcode_content .= htmlspecialchars_decode($header_start, ENT_QUOTES) . $header . htmlspecialchars_decode($header_end, ENT_QUOTES);
419
+ }
420
+
421
+ $cached = false;
422
+
423
+ // Return cached results
424
+ if ( $this->config['tools']['cache']['active'] ) {
425
+
426
+ $key = md5(json_encode($shortcode_ops));
427
+ $popular_posts = \WordPressPopularPosts\Cache::get($key);
428
+
429
+ if ( false === $popular_posts ) {
430
+ $popular_posts = new Query($shortcode_ops);
431
+
432
+ $time_value = $this->config['tools']['cache']['interval']['value']; // eg. 5
433
+ $time_unit = $this->config['tools']['cache']['interval']['time']; // eg. 'minute'
434
+
435
+ // No popular posts found, check again in 1 minute
436
+ if ( ! $popular_posts->get_posts() ) {
437
+ $time_value = 1;
438
+ $time_unit = 'minute';
439
+ }
440
+
441
+ \WordPressPopularPosts\Cache::set(
442
+ $key,
443
+ $popular_posts,
444
+ $time_value,
445
+ $time_unit
446
+ );
447
+ }
448
+
449
+ $cached = true;
450
+
451
+ } // Get popular posts
452
+ else {
453
+ $popular_posts = new Query($shortcode_ops);
454
+ }
455
+
456
+ $this->output->set_data($popular_posts->get_posts());
457
+ $this->output->set_public_options($shortcode_ops);
458
+ $this->output->build_output();
459
+
460
+ $shortcode_content .= $this->output->get_output();
461
+
462
+ return $shortcode_content;
463
+ }
464
+
465
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/Helper.php CHANGED
@@ -1,272 +1,335 @@
1
- <?php
2
-
3
- namespace WordPressPopularPosts;
4
-
5
- class Helper {
6
-
7
- /**
8
- * Checks for valid number.
9
- *
10
- * @since 2.1.6
11
- * @param int number
12
- * @return bool
13
- */
14
- public static function is_number($number)
15
- {
16
- return !empty($number) && is_numeric($number) && (intval($number) == floatval($number));
17
- }
18
-
19
- /**
20
- * Checks for valid date.
21
- *
22
- * @since 4.0.0
23
- * @param string $date
24
- * @param string $format
25
- * @return bool
26
- */
27
- public static function is_valid_date($date = null, $format = 'Y-m-d')
28
- {
29
- $d = \DateTime::createFromFormat($format, $date);
30
- return $d && $d->format($format) === $date;
31
- }
32
-
33
- /**
34
- * Returns an array of dates between two dates.
35
- *
36
- * @since 4.0.0
37
- * @param string $start_date
38
- * @param string $end_date
39
- * @param string $format
40
- * @return array|bool
41
- */
42
- public static function get_date_range($start_date = null, $end_date = null, $format = 'Y-m-d')
43
- {
44
- if (
45
- self::is_valid_date($start_date, $format)
46
- && self::is_valid_date($end_date, $format)
47
- ) {
48
- $dates = [];
49
-
50
- $begin = new \DateTime($start_date, new \DateTimeZone(Helper::get_timezone()));
51
- $end = new \DateTime($end_date, new \DateTimeZone(Helper::get_timezone()));
52
-
53
- if ( $begin < $end ) {
54
- while( $begin <= $end ) {
55
- $dates[] = $begin->format($format);
56
- $begin->modify('+1 day');
57
- }
58
- }
59
- else {
60
- while( $begin >= $end ) {
61
- $dates[] = $begin->format($format);
62
- $begin->modify('-1 day');
63
- }
64
- }
65
-
66
- return $dates;
67
- }
68
-
69
- return false;
70
- }
71
-
72
- /**
73
- * Returns server date.
74
- *
75
- * @since 2.1.6
76
- * @access private
77
- * @return string
78
- */
79
- public static function curdate()
80
- {
81
- return current_time('Y-m-d', false);
82
- }
83
-
84
- /**
85
- * Returns mysql datetime.
86
- *
87
- * @since 2.1.6
88
- * @access private
89
- * @return string
90
- */
91
- public static function now()
92
- {
93
- return current_time('mysql');
94
- }
95
-
96
- /**
97
- * Returns current timestamp.
98
- *
99
- * @since 5.0.2
100
- * @return string
101
- */
102
- public static function timestamp()
103
- {
104
- // current_datetime() is WP 5.3+
105
- return ( function_exists('current_datetime') ) ? current_datetime()->getTimestamp() : current_time('timestamp');
106
- }
107
-
108
- /**
109
- * Returns site's timezone.
110
- *
111
- * Code borrowed from Rarst's awesome WpDateTime class: https://github.com/Rarst/wpdatetime
112
- *
113
- * @since 5.0.0
114
- * @return string
115
- */
116
- public static function get_timezone()
117
- {
118
- $timezone_string = get_option('timezone_string');
119
-
120
- if ( ! empty($timezone_string) ) {
121
- return $timezone_string;
122
- }
123
-
124
- $offset = get_option('gmt_offset');
125
- $sign = $offset < 0 ? '-' : '+';
126
- $hours = (int) $offset;
127
- $minutes = abs(($offset - (int) $offset) * 60);
128
- $offset = sprintf('%s%02d:%02d', $sign, abs($hours), $minutes);
129
-
130
- return $offset;
131
- }
132
-
133
- /**
134
- * Returns time.
135
- *
136
- * @since 2.3.0
137
- * @return string
138
- */
139
- public static function microtime_float()
140
- {
141
- list($msec, $sec) = explode(' ', microtime());
142
- return (float) $msec + (float) $sec;
143
- }
144
-
145
- /**
146
- * Merges two associative arrays recursively.
147
- *
148
- * @since 2.3.4
149
- * @link http://www.php.net/manual/en/function.array-merge-recursive.php#92195
150
- * @param array array1
151
- * @param array array2
152
- * @return array
153
- */
154
- public static function merge_array_r(array $array1, array $array2)
155
- {
156
- $merged = $array1;
157
-
158
- foreach( $array2 as $key => &$value ) {
159
- if ( is_array($value) && isset($merged[$key]) && is_array($merged[$key]) ) {
160
- $merged[$key] = self::merge_array_r($merged[$key], $value);
161
- } else {
162
- $merged[$key] = $value;
163
- }
164
- }
165
-
166
- return $merged;
167
- }
168
-
169
- /**
170
- * Debug function.
171
- *
172
- * @since 3.0.0
173
- * @param mixed $v variable to display with var_dump()
174
- * @param mixed $v,... unlimited optional number of variables to display with var_dump()
175
- */
176
- public static function debug($v)
177
- {
178
- if ( !defined('WPP_DEBUG') || !WPP_DEBUG )
179
- return;
180
-
181
- foreach( func_get_args() as $arg ) {
182
- print "<pre>";
183
- var_dump($arg);
184
- print "</pre>";
185
- }
186
- }
187
-
188
- /**
189
- * Truncates text.
190
- *
191
- * @since 4.0.0
192
- * @param string $text
193
- * @param int $length
194
- * @param bool $truncate_by_words
195
- * @return string
196
- */
197
- public static function truncate($text = '', $length = 25, $truncate_by_words = false, $more = '...')
198
- {
199
- if ( '' !== $text ) {
200
- // Truncate by words
201
- if ( $truncate_by_words ) {
202
- $words = explode(" ", $text, $length + 1);
203
-
204
- if ( count($words) > $length ) {
205
- array_pop($words);
206
- $text = rtrim(implode(" ", $words), ",.") . " {$more}";
207
- }
208
- }
209
- // Truncate by characters
210
- elseif ( strlen($text) > $length ) {
211
- $text = rtrim(mb_substr($text, 0, $length , get_bloginfo('charset')), " ,.") . $more;
212
- }
213
- }
214
-
215
- return $text;
216
- }
217
-
218
- /**
219
- * Gets post/page ID if current page is singular
220
- *
221
- * @since 3.1.2
222
- */
223
- public static function is_single()
224
- {
225
- $trackable = [];
226
- $registered_post_types = get_post_types(['public' => true], 'names');
227
-
228
- foreach( $registered_post_types as $post_type ) {
229
- $trackable[] = $post_type;
230
- }
231
-
232
- $trackable = apply_filters('wpp_trackable_post_types', $trackable);
233
-
234
- if (
235
- is_singular($trackable)
236
- && !is_front_page()
237
- && !is_preview()
238
- && !is_trackback()
239
- && !is_feed()
240
- && !is_robots()
241
- && !is_customize_preview()
242
- ) {
243
- return get_queried_object_id();
244
- }
245
-
246
- return false;
247
- }
248
-
249
- /**
250
- * Adds scheme to a given URL.
251
- *
252
- * @since 5.0.0
253
- * @param string $url
254
- * @param string $scheme
255
- * @return string|bool
256
- */
257
- static function add_scheme($url = null, $scheme = 'https://')
258
- {
259
- $url_args = parse_url($url);
260
-
261
- if ( $url_args ) {
262
- // No need to do anything, URL is fine
263
- if ( isset($url_args['scheme']) )
264
- return $url;
265
- // Return URL with scheme
266
- return $scheme . $url_args['host'] . $url_args['path'];
267
- }
268
-
269
- // Invalid/malformed URL
270
- return false;
271
- }
272
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WordPressPopularPosts;
4
+
5
+ class Helper {
6
+
7
+ /**
8
+ * Checks for valid number.
9
+ *
10
+ * @since 2.1.6
11
+ * @param int number
12
+ * @return bool
13
+ */
14
+ public static function is_number($number)
15
+ {
16
+ return !empty($number) && is_numeric($number) && (intval($number) == floatval($number));
17
+ }
18
+
19
+ /**
20
+ * Converts a number into a short version, eg: 1000 -> 1k
21
+ *
22
+ * @see https://gist.github.com/RadGH/84edff0cc81e6326029c
23
+ * @since 5.2.0
24
+ * @param int
25
+ * @param int
26
+ * @return mixed string|bool
27
+ */
28
+ public static function prettify_number($number, $precision = 1)
29
+ {
30
+ if ( ! is_numeric($number) )
31
+ return false;
32
+
33
+ if ( $number < 900 ) {
34
+ // 0 - 900
35
+ $n_format = number_format($number, $precision);
36
+ $suffix = '';
37
+ } elseif ( $number < 900000 ) {
38
+ // 0.9k-850k
39
+ $n_format = number_format($number / 1000, $precision);
40
+ $suffix = 'k';
41
+ } elseif ( $number < 900000000 ) {
42
+ // 0.9m-850m
43
+ $n_format = number_format($number / 1000000, $precision);
44
+ $suffix = 'm';
45
+ } elseif ( $number < 900000000000 ) {
46
+ // 0.9b-850b
47
+ $n_format = number_format($number / 1000000000, $precision);
48
+ $suffix = 'b';
49
+ } else {
50
+ // 0.9t+
51
+ $n_format = number_format($number / 1000000000000, $precision);
52
+ $suffix = 't';
53
+ }
54
+
55
+ // Remove unnecessary zeroes after decimal. "1.0" -> "1"; "1.00" -> "1"
56
+ // Intentionally does not affect partials, eg "1.50" -> "1.50"
57
+ if ( $precision > 0 ) {
58
+ $dotzero = '.' . str_repeat('0', $precision);
59
+ $n_format = str_replace($dotzero, '', $n_format);
60
+ }
61
+
62
+ return $n_format . $suffix;
63
+ }
64
+
65
+ /**
66
+ * Checks for valid date.
67
+ *
68
+ * @since 4.0.0
69
+ * @param string $date
70
+ * @param string $format
71
+ * @return bool
72
+ */
73
+ public static function is_valid_date($date = null, $format = 'Y-m-d')
74
+ {
75
+ $d = \DateTime::createFromFormat($format, $date);
76
+ return $d && $d->format($format) === $date;
77
+ }
78
+
79
+ /**
80
+ * Returns an array of dates between two dates.
81
+ *
82
+ * @since 4.0.0
83
+ * @param string $start_date
84
+ * @param string $end_date
85
+ * @param string $format
86
+ * @return array|bool
87
+ */
88
+ public static function get_date_range($start_date = null, $end_date = null, $format = 'Y-m-d')
89
+ {
90
+ if (
91
+ self::is_valid_date($start_date, $format)
92
+ && self::is_valid_date($end_date, $format)
93
+ ) {
94
+ $dates = [];
95
+
96
+ $begin = new \DateTime($start_date, new \DateTimeZone(Helper::get_timezone()));
97
+ $end = new \DateTime($end_date, new \DateTimeZone(Helper::get_timezone()));
98
+
99
+ if ( $begin < $end ) {
100
+ while( $begin <= $end ) {
101
+ $dates[] = $begin->format($format);
102
+ $begin->modify('+1 day');
103
+ }
104
+ }
105
+ else {
106
+ while( $begin >= $end ) {
107
+ $dates[] = $begin->format($format);
108
+ $begin->modify('-1 day');
109
+ }
110
+ }
111
+
112
+ return $dates;
113
+ }
114
+
115
+ return false;
116
+ }
117
+
118
+ /**
119
+ * Returns server date.
120
+ *
121
+ * @since 2.1.6
122
+ * @access private
123
+ * @return string
124
+ */
125
+ public static function curdate()
126
+ {
127
+ return current_time('Y-m-d', false);
128
+ }
129
+
130
+ /**
131
+ * Returns mysql datetime.
132
+ *
133
+ * @since 2.1.6
134
+ * @access private
135
+ * @return string
136
+ */
137
+ public static function now()
138
+ {
139
+ return current_time('mysql');
140
+ }
141
+
142
+ /**
143
+ * Returns current timestamp.
144
+ *
145
+ * @since 5.0.2
146
+ * @return string
147
+ */
148
+ public static function timestamp()
149
+ {
150
+ // current_datetime() is WP 5.3+
151
+ return ( function_exists('current_datetime') ) ? current_datetime()->getTimestamp() : current_time('timestamp');
152
+ }
153
+
154
+ /**
155
+ * Checks whether a string is a valid timestamp.
156
+ *
157
+ * @since 5.2.0
158
+ * @param string $string
159
+ * @return bool
160
+ */
161
+ public static function is_timestamp($string)
162
+ {
163
+ try {
164
+ new \DateTime('@' . $string);
165
+ } catch(\Exception $e) {
166
+ return false;
167
+ }
168
+ return true;
169
+ }
170
+
171
+ /**
172
+ * Returns site's timezone.
173
+ *
174
+ * Code borrowed from Rarst's awesome WpDateTime class: https://github.com/Rarst/wpdatetime
175
+ *
176
+ * @since 5.0.0
177
+ * @return string
178
+ */
179
+ public static function get_timezone()
180
+ {
181
+ $timezone_string = get_option('timezone_string');
182
+
183
+ if ( ! empty($timezone_string) ) {
184
+ return $timezone_string;
185
+ }
186
+
187
+ $offset = get_option('gmt_offset');
188
+ $sign = $offset < 0 ? '-' : '+';
189
+ $hours = (int) $offset;
190
+ $minutes = abs(($offset - (int) $offset) * 60);
191
+ $offset = sprintf('%s%02d:%02d', $sign, abs($hours), $minutes);
192
+
193
+ return $offset;
194
+ }
195
+
196
+ /**
197
+ * Returns time.
198
+ *
199
+ * @since 2.3.0
200
+ * @return string
201
+ */
202
+ public static function microtime_float()
203
+ {
204
+ list($msec, $sec) = explode(' ', microtime());
205
+ return (float) $msec + (float) $sec;
206
+ }
207
+
208
+ /**
209
+ * Merges two associative arrays recursively.
210
+ *
211
+ * @since 2.3.4
212
+ * @link http://www.php.net/manual/en/function.array-merge-recursive.php#92195
213
+ * @param array array1
214
+ * @param array array2
215
+ * @return array
216
+ */
217
+ public static function merge_array_r(array $array1, array $array2)
218
+ {
219
+ $merged = $array1;
220
+
221
+ foreach( $array2 as $key => &$value ) {
222
+ if ( is_array($value) && isset($merged[$key]) && is_array($merged[$key]) ) {
223
+ $merged[$key] = self::merge_array_r($merged[$key], $value);
224
+ } else {
225
+ $merged[$key] = $value;
226
+ }
227
+ }
228
+
229
+ return $merged;
230
+ }
231
+
232
+ /**
233
+ * Debug function.
234
+ *
235
+ * @since 3.0.0
236
+ * @param mixed $v variable to display with var_dump()
237
+ * @param mixed $v,... unlimited optional number of variables to display with var_dump()
238
+ */
239
+ public static function debug($v)
240
+ {
241
+ if ( !defined('WPP_DEBUG') || !WPP_DEBUG )
242
+ return;
243
+
244
+ foreach( func_get_args() as $arg ) {
245
+ print "<pre>";
246
+ var_dump($arg);
247
+ print "</pre>";
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Truncates text.
253
+ *
254
+ * @since 4.0.0
255
+ * @param string $text
256
+ * @param int $length
257
+ * @param bool $truncate_by_words
258
+ * @return string
259
+ */
260
+ public static function truncate($text = '', $length = 25, $truncate_by_words = false, $more = '...')
261
+ {
262
+ if ( '' !== $text ) {
263
+ // Truncate by words
264
+ if ( $truncate_by_words ) {
265
+ $words = explode(" ", $text, $length + 1);
266
+
267
+ if ( count($words) > $length ) {
268
+ array_pop($words);
269
+ $text = rtrim(implode(" ", $words), ",.") . " {$more}";
270
+ }
271
+ }
272
+ // Truncate by characters
273
+ elseif ( strlen($text) > $length ) {
274
+ $text = rtrim(mb_substr($text, 0, $length , get_bloginfo('charset')), " ,.") . $more;
275
+ }
276
+ }
277
+
278
+ return $text;
279
+ }
280
+
281
+ /**
282
+ * Gets post/page ID if current page is singular
283
+ *
284
+ * @since 3.1.2
285
+ */
286
+ public static function is_single()
287
+ {
288
+ $trackable = [];
289
+ $registered_post_types = get_post_types(['public' => true], 'names');
290
+
291
+ foreach( $registered_post_types as $post_type ) {
292
+ $trackable[] = $post_type;
293
+ }
294
+
295
+ $trackable = apply_filters('wpp_trackable_post_types', $trackable);
296
+
297
+ if (
298
+ is_singular($trackable)
299
+ && !is_front_page()
300
+ && !is_preview()
301
+ && !is_trackback()
302
+ && !is_feed()
303
+ && !is_robots()
304
+ && !is_customize_preview()
305
+ ) {
306
+ return get_queried_object_id();
307
+ }
308
+
309
+ return false;
310
+ }
311
+
312
+ /**
313
+ * Adds scheme to a given URL.
314
+ *
315
+ * @since 5.0.0
316
+ * @param string $url
317
+ * @param string $scheme
318
+ * @return string|bool
319
+ */
320
+ static function add_scheme($url = null, $scheme = 'https://')
321
+ {
322
+ $url_args = parse_url($url);
323
+
324
+ if ( $url_args ) {
325
+ // No need to do anything, URL is fine
326
+ if ( isset($url_args['scheme']) )
327
+ return $url;
328
+ // Return URL with scheme
329
+ return $scheme . $url_args['host'] . $url_args['path'];
330
+ }
331
+
332
+ // Invalid/malformed URL
333
+ return false;
334
+ }
335
+ }
src/I18N.php CHANGED
@@ -1,36 +1,36 @@
1
- <?php
2
- /**
3
- * Define the internationalization functionality
4
- *
5
- * Loads and defines the internationalization files for this plugin
6
- * so that it is ready for translation.
7
- *
8
- * @since 4.0.0
9
- *
10
- * @package WordPressPopularPosts
11
- */
12
-
13
- namespace WordPressPopularPosts;
14
-
15
- class I18N {
16
- /**
17
- * WordPress hooks.
18
- *
19
- * @since 5.0.0
20
- */
21
- public function hooks()
22
- {
23
- add_action('plugins_loaded', [$this, 'load_plugin_textdomain']);
24
- }
25
-
26
- /**
27
- * Load the plugin text domain for translation.
28
- *
29
- * @since 1.0.0
30
- */
31
- public function load_plugin_textdomain()
32
- {
33
- $locale = apply_filters('plugin_locale', get_locale(), 'wordpress-popular-posts');
34
- load_textdomain('wordpress-popular-posts', WP_LANG_DIR . '/' . 'wordpress-popular-posts' . '/' . 'wordpress-popular-posts' . '-' . $locale . '.mo');
35
- }
36
- }
1
+ <?php
2
+ /**
3
+ * Define the internationalization functionality
4
+ *
5
+ * Loads and defines the internationalization files for this plugin
6
+ * so that it is ready for translation.
7
+ *
8
+ * @since 4.0.0
9
+ *
10
+ * @package WordPressPopularPosts
11
+ */
12
+
13
+ namespace WordPressPopularPosts;
14
+
15
+ class I18N {
16
+ /**
17
+ * WordPress hooks.
18
+ *
19
+ * @since 5.0.0
20
+ */
21
+ public function hooks()
22
+ {
23
+ add_action('plugins_loaded', [$this, 'load_plugin_textdomain']);
24
+ }
25
+
26
+ /**
27
+ * Load the plugin text domain for translation.
28
+ *
29
+ * @since 1.0.0
30
+ */
31
+ public function load_plugin_textdomain()
32
+ {
33
+ $locale = apply_filters('plugin_locale', get_locale(), 'wordpress-popular-posts');
34
+ load_textdomain('wordpress-popular-posts', WP_LANG_DIR . '/' . 'wordpress-popular-posts' . '/' . 'wordpress-popular-posts' . '-' . $locale . '.mo');
35
+ }
36
+ }
src/Image.php CHANGED
@@ -1,795 +1,806 @@
1
- <?php
2
- /**
3
- * This class builds/retrieves the thumbnail image of each popular posts.
4
- *
5
- *
6
- * @package WordPressPopularPosts
7
- * @author Hector Cabrera <me@cabrerahector.com>
8
- */
9
-
10
- namespace WordPressPopularPosts;
11
-
12
- class Image {
13
-
14
- /**
15
- * Default thumbnail.
16
- *
17
- * @since 2.2.0
18
- * @var string
19
- */
20
- private $default_thumbnail = '';
21
-
22
- /**
23
- * Plugin uploads directory.
24
- *
25
- * @since 3.0.4
26
- * @var array
27
- */
28
- private $uploads_dir = [];
29
-
30
- /**
31
- * Admin settings.
32
- *
33
- * @since 5.0.0
34
- * @var array
35
- */
36
- private $admin_options = [];
37
-
38
- /**
39
- * Available image sizes.
40
- *
41
- * @since 5.0.0
42
- * @var array
43
- */
44
- private $available_sizes = [];
45
-
46
- /**
47
- * Construct.
48
- *
49
- * @since 4.0.0
50
- * @param array $admin_options
51
- */
52
- public function __construct(array $admin_options)
53
- {
54
- $this->admin_options = $admin_options;
55
-
56
- // Set default thumbnail
57
- $this->default_thumbnail = plugins_url() . "/wordpress-popular-posts/assets/images/no_thumb.jpg";
58
-
59
- if ( $this->is_image_url($this->admin_options['tools']['thumbnail']['default']) )
60
- $this->default_thumbnail = $this->admin_options['tools']['thumbnail']['default'];
61
-
62
- // Set uploads folder
63
- $wp_upload_dir = wp_get_upload_dir();
64
- $this->uploads_dir['basedir'] = $wp_upload_dir['basedir'] . "/" . 'wordpress-popular-posts';
65
- $this->uploads_dir['baseurl'] = $wp_upload_dir['baseurl'] . "/" . 'wordpress-popular-posts';
66
-
67
- if ( ! is_dir($this->uploads_dir['basedir']) ) {
68
- // Couldn't create the folder, store thumbnails in Uploads
69
- if ( ! wp_mkdir_p($this->uploads_dir['basedir']) ) {
70
- $this->uploads_dir['basedir'] = $wp_upload_dir['basedir'];
71
- $this->uploads_dir['baseurl'] = $wp_upload_dir['baseurl'];
72
- }
73
- }
74
- }
75
-
76
- /**
77
- * Get WPP's uploads folder.
78
- *
79
- * @since 4.0.0
80
- * @access public
81
- * @return array|bool
82
- */
83
- public function get_plugin_uploads_dir()
84
- {
85
- if ( is_array($this->uploads_dir) && ! empty($this->uploads_dir) )
86
- return $this->uploads_dir;
87
- return false;
88
- }
89
-
90
- /**
91
- * Returns an image.
92
- *
93
- * @since 5.0.0
94
- * @param \stdClass $post_object Post object
95
- * @param array $size Image size (width & height)
96
- * @param string $source Image source
97
- * @param bool $crop Whether to crop the image or not
98
- * @param string $build Whether to build the image or get an existing one
99
- * @return string
100
- */
101
- public function get($post_object, $size, $source, $crop = true, $build = 'manual')
102
- {
103
- // Bail, $post_object is not an actual object
104
- if ( false === $post_object instanceof \stdClass || ! isset($post_object->id) ) {
105
- return '';
106
- }
107
-
108
- $alt = '';
109
- $classes = ['wpp-thumbnail', 'wpp_' . $source];
110
- $filename = $post_object->id . '-' . $source . '-' . $size[0] . 'x' . $size[1];
111
- $cached = $this->exists($filename);
112
-
113
- if ( $this->admin_options['tools']['thumbnail']['lazyload'] ) {
114
- array_push($classes, 'wpp-lazyload');
115
- }
116
-
117
- // We have a thumbnail already, return it
118
- if ( $cached ) {
119
- $classes[] = 'wpp_cached_thumb';
120
-
121
- /**
122
- * Filters CSS classes assigned to the thumbnail
123
- *
124
- * @since 5.0.0
125
- * @param array CSS classes
126
- * @param int The post ID
127
- * @return array The new CSS classes
128
- */
129
- $classes = apply_filters(
130
- 'wpp_thumbnail_class_attribute',
131
- $classes,
132
- $post_object->id
133
- );
134
-
135
- /**
136
- * Filters CSS classes assigned to the thumbnail
137
- *
138
- * @since 5.0.0
139
- * @param string Original ALT attribute
140
- * @param int The post ID
141
- * @return string The new ALT attribute
142
- */
143
- $alt = apply_filters(
144
- 'wpp_thumbnail_alt_attribute',
145
- $this->get_alt_attribute($post_object->id, $source),
146
- $post_object->id
147
- );
148
-
149
- return $this->render(
150
- $cached,
151
- $size,
152
- is_array($classes) ? implode(' ', $classes) : 'wpp-thumbnail wpp_' . $source,
153
- is_string($alt) ? $alt : ''
154
- );
155
- }
156
-
157
- $thumb_url = null;
158
-
159
- // Return image as-is, no need to create a new thumbnail
160
- if (
161
- ( 'custom_field' == $source && ! $this->admin_options['tools']['thumbnail']['resize'] )
162
- || ( 'featured' == $source && 'predefined' == $build )
163
- ){
164
- /**
165
- * Filters CSS classes assigned to the thumbnail
166
- *
167
- * @since 5.0.0
168
- * @param array CSS classes
169
- * @param int The post ID
170
- * @return array The new CSS classes
171
- */
172
- $classes = apply_filters(
173
- 'wpp_thumbnail_class_attribute',
174
- $classes,
175
- $post_object->id
176
- );
177
-
178
- // Get custom field image URL
179
- if ( 'custom_field' == $source && ! $this->admin_options['tools']['thumbnail']['resize'] ) {
180
- $thumb_url = get_post_meta(
181
- $post_object->id,
182
- $this->admin_options['tools']['thumbnail']['field'],
183
- true
184
- );
185
-
186
- if ( ! $thumb_url || ! $this->is_image_url($thumb_url) ) {
187
- $thumb_url = null;
188
- } else {
189
- /**
190
- * Filters CSS classes assigned to the thumbnail
191
- *
192
- * @since 5.0.0
193
- * @param string Original ALT attribute
194
- * @param int The post ID
195
- * @return string The new ALT attribute
196
- */
197
- $alt = apply_filters(
198
- 'wpp_thumbnail_alt_attribute',
199
- '',
200
- $post_object->id
201
- );
202
- }
203
- }
204
- // Get Post Thumbnail
205
- else {
206
- if (
207
- current_theme_supports('post-thumbnails')
208
- && has_post_thumbnail($post_object->id)
209
- ) {
210
- // Find corresponding image size
211
- $stock_size = null;
212
- $images_sizes = $this->get_sizes();
213
-
214
- foreach ( $images_sizes as $name => $attr ) :
215
- if (
216
- $attr['width'] == $size[0]
217
- && $attr['height'] == $size[1]
218
- && $attr['crop'] == $crop
219
- ) {
220
- $stock_size = $name;
221
- break;
222
- }
223
- endforeach;
224
-
225
- // Couldn't find a matching size so let's go with width/height combo instead
226
- // (this should never happen but better safe than sorry!)
227
- if ( null == $stock_size ) {
228
- $stock_size = $size;
229
- }
230
-
231
- $featured_image = get_the_post_thumbnail(
232
- $post_object->id,
233
- $stock_size
234
- );
235
-
236
- if ( strpos($featured_image, 'class="') && is_array($classes) && ! empty($classes) )
237
- $featured_image = str_replace('class="', 'class="'. esc_attr(implode(' ', $classes)) . ' ', $featured_image);
238
-
239
- if ( $this->admin_options['tools']['thumbnail']['lazyload'] ) {
240
- $featured_image = str_replace('src="', 'data-img-src="', $featured_image);
241
- $featured_image = str_replace('srcset="', 'data-img-srcset="', $featured_image);
242
- }
243
-
244
- return $featured_image;
245
- }
246
- }
247
- }
248
- // Build a new thumbnail and return it
249
- else {
250
- $file_path = null;
251
-
252
- if ( 'custom_field' == $source && $this->admin_options['tools']['thumbnail']['resize'] ) {
253
- $thumb_url = get_post_meta(
254
- $post_object->id,
255
- $this->admin_options['tools']['thumbnail']['field'],
256
- true
257
- );
258
-
259
- if ( $thumb_url && $this->is_image_url($thumb_url) ) {
260
- $file_path = $this->url_to_path($thumb_url, $post_object->id);
261
- }
262
- } else {
263
- $file_meta = $this->get_file_meta($post_object->id, $source);
264
-
265
- if ( is_array($file_meta) && isset($file_meta['path']) ) {
266
- $alt = isset($file_meta['alt']) ? $file_meta['alt'] : '';
267
- $file_path = $file_meta['path'];
268
- }
269
- }
270
-
271
- if ( $file_path ) {
272
- $extension = pathinfo($file_path, PATHINFO_EXTENSION);
273
- $thumb_url = $this->resize(
274
- $file_path,
275
- $filename . '.' . $extension,
276
- $size,
277
- $crop
278
- );
279
- }
280
- }
281
-
282
- if ( ! $thumb_url ) {
283
- $classes[] = 'wpp_def_no_src';
284
- $thumb_url = $this->get_default_url($post_object->id);
285
- }
286
-
287
- return $this->render(
288
- $thumb_url,
289
- $size,
290
- is_array($classes) ? implode(' ', $classes) : 'wpp-thumbnail wpp_' . $source,
291
- is_string($alt) ? $alt : ''
292
- );
293
- }
294
-
295
- /**
296
- * Checks whether a given thumbnail exists.
297
- *
298
- * @since 5.0.0
299
- * @access private
300
- * @param string $filename
301
- * @return string|bool Full URL to image
302
- */
303
- private function exists($filename)
304
- {
305
- // Do we have thumbnail already?
306
- $file = $this->resolve(trailingslashit($this->get_plugin_uploads_dir()['basedir']) . $filename);
307
-
308
- if ( $file && is_file($file) ) {
309
- $extension = pathinfo($file, PATHINFO_EXTENSION);
310
- return trailingslashit($this->get_plugin_uploads_dir()['baseurl']) . $filename . '.' . $extension;
311
- }
312
-
313
- return false;
314
- }
315
-
316
- /**
317
- * Resolves filename.
318
- *
319
- * @since 5.0.0
320
- * @access private
321
- * @author Ioan Chiriac
322
- * @link https://stackoverflow.com/a/29468093/9131961
323
- * @param string $name
324
- * @return string|bool Resolved path, or false if not found
325
- */
326
- private function resolve($name)
327
- {
328
- $info = pathinfo($name);
329
-
330
- // File already contains an extension, return it
331
- if ( isset($info['extension']) && ! empty($info['extension']) ) {
332
- return $name;
333
- }
334
-
335
- $filename = $info['filename'];
336
- $len = strlen($filename);
337
-
338
- // open the folder
339
- $dh = opendir($info['dirname']);
340
-
341
- if ( ! $dh ) {
342
- return false;
343
- }
344
-
345
- // scan each file in the folder
346
- while ( ($file = readdir($dh)) !== false ) {
347
- if ( strncmp($file, $filename, $len) === 0 ) {
348
- if ( strlen($name) > $len ) {
349
- // if name contains a directory part
350
- $name = substr($name, 0, strlen($name) - $len) . $file;
351
- } else {
352
- // if the name is at the path root
353
- $name = $file;
354
- }
355
-
356
- closedir($dh);
357
- return $name;
358
- }
359
- }
360
-
361
- // file not found
362
- closedir($dh);
363
- return false;
364
- }
365
-
366
- /**
367
- * Retrieves local path to image.
368
- *
369
- * @since 5.0.0
370
- * @access private
371
- * @param string $url
372
- * @param integer $post_ID
373
- * @return string|boolean Path to image, or false if not found
374
- */
375
- private function url_to_path($url, $post_ID = null)
376
- {
377
- if ( $this->is_image_url($url) ) {
378
- $attachment_id = $this->get_attachment_id($url);
379
-
380
- // Image is hosted locally
381
- if ( $attachment_id ) {
382
- return get_attached_file($attachment_id);
383
- }
384
-
385
- // Image hosted elsewhere?
386
- if ( $post_ID && Helper::is_number($post_ID) )
387
- return $this->fetch_external_image($post_ID, $url);
388
- }
389
-
390
- return false;
391
- }
392
-
393
- /**
394
- * Gets image meta.
395
- *
396
- * @since 5.0.0
397
- * @access private
398
- * @param int $id Post ID
399
- * @param string $source Image source
400
- * @return array|bool
401
- */
402
- private function get_file_meta($id, $source)
403
- {
404
- // get thumbnail path from the Featured Image
405
- if ( "featured" == $source ) {
406
- if ( $thumbnail_id = get_post_thumbnail_id($id) ) {
407
- // image path
408
- return [
409
- 'path' => get_attached_file($thumbnail_id),
410
- 'alt' => get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true)
411
- ];
412
- }
413
- }
414
- // get thumbnail path from first image attachment
415
- elseif ( "first_attachment" == $source ) {
416
- $args = [
417
- 'numberposts' => 1,
418
- 'order' => 'ASC',
419
- 'post_parent' => $id,
420
- 'post_type' => 'attachment',
421
- 'post_mime_type' => 'image'
422
- ];
423
- $post_attachments = get_children($args);
424
-
425
- if ( ! empty($post_attachments) ) {
426
- $first_img = array_shift($post_attachments);
427
-
428
- return [
429
- 'path' => get_attached_file($first_img->ID),
430
- 'alt' => get_post_meta($first_img->ID, '_wp_attachment_image_alt', true)
431
- ];
432
- }
433
- }
434
- // get thumbnail path from post content
435
- elseif ( "first_image" == $source ) {
436
- /** @var wpdb $wpdb */
437
- global $wpdb;
438
-
439
- if ( $content = $wpdb->get_var("SELECT post_content FROM {$wpdb->posts} WHERE ID = {$id};") ) {
440
- // at least one image has been found
441
- if ( preg_match('/<img[^>]+>/i', $content, $img) ) {
442
- // get img src attribute from the first image found
443
- preg_match('/(src)="([^"]*)"/i', $img[0], $src_attr);
444
-
445
- if ( isset($src_attr[2]) && ! empty($src_attr[2]) ) {
446
- // get img alt attribute from the first image found
447
- $alt = '';
448
- preg_match('/(alt)="([^"]*)"/i', $img[0], $alt_attr);
449
-
450
- if ( isset($alt_attr[2]) && !empty($alt_attr[2]) ) {
451
- $alt = $alt_attr[2];
452
- }
453
-
454
- // image from Media Library
455
- if ( $attachment_id = $this->get_attachment_id($src_attr[2]) ) {
456
- return [
457
- 'path' => get_attached_file($attachment_id),
458
- 'alt' => $alt
459
- ];
460
- } // external image?
461
- else {
462
- return [
463
- 'path' => $this->fetch_external_image($id, $src_attr[2]),
464
- 'alt' => $alt
465
- ];
466
- }
467
- }
468
- }
469
- }
470
- }
471
-
472
- return false;
473
- }
474
-
475
- /**
476
- * Gets image ALT attribute.
477
- *
478
- * @since 5.0.0
479
- * @access private
480
- * @param int $id Post ID
481
- * @param string $source Image source
482
- * @return string
483
- */
484
- private function get_alt_attribute($id, $source)
485
- {
486
- $alt = '';
487
-
488
- // get thumbnail path from the Featured Image
489
- if ( "featured" == $source ) {
490
- if ( $thumbnail_id = get_post_thumbnail_id($id) ) {
491
- // image path
492
- $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
493
- }
494
- }
495
- // get thumbnail path from first image attachment
496
- elseif ( "first_attachment" == $source ) {
497
- $args = [
498
- 'numberposts' => 1,
499
- 'order' => 'ASC',
500
- 'post_parent' => $id,
501
- 'post_type' => 'attachment',
502
- 'post_mime_type' => 'image'
503
- ];
504
- $post_attachments = get_children($args);
505
-
506
- if ( ! empty($post_attachments) ) {
507
- $first_img = array_shift($post_attachments);
508
- $alt = get_post_meta($first_img->ID, '_wp_attachment_image_alt', true);
509
- }
510
- }
511
- // get thumbnail path from post content
512
- elseif ( "first_image" == $source ) {
513
- /** @var wpdb $wpdb */
514
- global $wpdb;
515
-
516
- if ( $content = $wpdb->get_var("SELECT post_content FROM {$wpdb->posts} WHERE ID = {$id};") ) {
517
- // at least one image has been found
518
- if ( preg_match('/<img[^>]+>/i', $content, $img) ) {
519
- // get img alt attribute from the first image found
520
- preg_match('/(alt)="([^"]*)"/i', $img[0], $alt_attr);
521
-
522
- if ( isset($alt_attr[2]) && !empty($alt_attr[2]) ) {
523
- $alt = $alt_attr[2];
524
- }
525
- }
526
- }
527
- }
528
-
529
- return $alt;
530
- }
531
-
532
- /**
533
- * Get the Attachment ID for a given image URL.
534
- *
535
- * @since 3.0.0
536
- * @access private
537
- * @author Frankie Jarrett
538
- * @link http://frankiejarrett.com/get-an-attachment-id-by-url-in-wordpress/
539
- * @param string $url
540
- * @return int|null
541
- */
542
- private function get_attachment_id($url)
543
- {
544
- $url = Helper::add_scheme(
545
- $url,
546
- is_ssl() ? 'https://' : 'http://'
547
- );
548
-
549
- // Split the $url into two parts with the wp-content directory as the separator.
550
- $parse_url = explode(parse_url(WP_CONTENT_URL, PHP_URL_PATH), $url);
551
-
552
- // Get the host of the current site and the host of the $url, ignoring www.
553
- $this_host = str_ireplace('www.', '', parse_url(home_url(), PHP_URL_HOST));
554
- $file_host = str_ireplace('www.', '', parse_url($url, PHP_URL_HOST));
555
-
556
- // Return nothing if there aren't any $url parts or if the current host and $url host do not match.
557
- if (
558
- ! isset($parse_url[1])
559
- || empty($parse_url[1])
560
- || ($this_host != $file_host)
561
- ) {
562
- return false;
563
- }
564
-
565
- // Now we're going to quickly search the DB for any attachment GUID with a partial path match.
566
- // Example: /uploads/2013/05/test-image.jpg
567
- global $wpdb;
568
-
569
- if ( ! $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;", $parse_url[1])) ) {
570
- // Maybe it's a resized image, so try to get the full one
571
- $parse_url[1] = preg_replace('/-[0-9]{1,4}x[0-9]{1,4}\.(jpg|jpeg|png|gif|bmp)$/i', '.$1', $parse_url[1]);
572
- $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;", $parse_url[1]));
573
- }
574
-
575
- // Returns null if no attachment is found.
576
- return isset($attachment[0]) ? $attachment[0] : NULL;
577
- }
578
-
579
- /**
580
- * Fetchs external images.
581
- *
582
- * @since 2.3.3
583
- * @access private
584
- * @param int $id Post ID.
585
- * @param string $url Image url.
586
- * @return string|bool Image path, or false on failure.
587
- */
588
- private function fetch_external_image($id, $url)
589
- {
590
- $full_image_path = trailingslashit($this->get_plugin_uploads_dir()['basedir']) . "{$id}_" . sanitize_file_name(rawurldecode(wp_basename($url)));
591
-
592
- // if the file exists already, return URL and path
593
- if ( file_exists($full_image_path) )
594
- return $full_image_path;
595
-
596
- $url = Helper::add_scheme(
597
- $url,
598
- is_ssl() ? 'https://' : 'http://'
599
- );
600
-
601
- $accepted_status_codes = [200, 301, 302];
602
- $response = wp_remote_head($url, ['timeout' => 5, 'sslverify' => false]);
603
-
604
- if (
605
- ! is_wp_error($response)
606
- && in_array(wp_remote_retrieve_response_code($response), $accepted_status_codes)
607
- ) {
608
- require_once(ABSPATH . 'wp-admin/includes/file.php');
609
-
610
- $url = str_replace('https://', 'http://', $url);
611
- $tmp = download_url($url);
612
-
613
- // File was downloaded successfully
614
- if ( ! is_wp_error($tmp) ) {
615
- // Determine image type
616
- if ( function_exists('exif_imagetype') ) {
617
- $image_type = exif_imagetype($tmp);
618
- } else {
619
- $image_type = getimagesize($tmp);
620
- $image_type = ( isset($image_type[2]) ) ? $image_type[2] : NULL;
621
- }
622
-
623
- // Valid image, save it
624
- if ( in_array($image_type, [IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG]) ) {
625
- // move file to Uploads
626
- if ( @rename($tmp, $full_image_path) ) {
627
- // borrowed from WP - set correct file permissions
628
- $stat = stat(dirname($full_image_path));
629
- $perms = $stat['mode'] & 0000644;
630
- @chmod($full_image_path, $perms);
631
-
632
- return $full_image_path;
633
- }
634
- }
635
-
636
- // Invalid file, remove it
637
- @unlink($tmp);
638
- }
639
- }
640
-
641
- return false;
642
- }
643
-
644
- /**
645
- * Resizes image.
646
- *
647
- * @since 3.0.0
648
- * @access private
649
- * @param string $path Image path
650
- * @param string $filename Image filename
651
- * @param array $size Image size
652
- * @param bool $crop Whether to crop the image or not
653
- * @return string|bool Image URL on success, false on error
654
- */
655
- private function resize($path, $filename, $size, $crop = true)
656
- {
657
- $image = wp_get_image_editor($path);
658
-
659
- // valid image, create thumbnail
660
- if ( ! is_wp_error($image) ) {
661
- /**
662
- * Hook to change the image compression quality of WPP's thumbnails.
663
- * @since 4.2.1
664
- */
665
- $quality = apply_filters('wpp_thumbnail_compression_quality', null);
666
-
667
- if ( ! ctype_digit($quality) )
668
- $quality = null; // Fallback to core's default
669
-
670
- $image->set_quality($quality);
671
-
672
- $image->resize($size[0], $size[1], $crop);
673
- $new_img = $image->save(trailingslashit($this->get_plugin_uploads_dir()['basedir']) . $filename);
674
-
675
- if ( ! is_wp_error($new_img) )
676
- return trailingslashit($this->get_plugin_uploads_dir()['baseurl']) . $filename;
677
- }
678
-
679
- return false;
680
- }
681
-
682
- /**
683
- * Render image tag.
684
- *
685
- * @since 3.0.0
686
- * @access public
687
- * @param string $src Image URL
688
- * @param array $dimension Image's width and height
689
- * @param string $class CSS class
690
- * @param object $alt Alternative text
691
- * @param string $error Error, if the image could not be created
692
- * @return string
693
- */
694
- public function render($src, $size, $class, $alt = '', $error = null)
695
- {
696
- $img_tag = '';
697
-
698
- if ( $error ) {
699
- $img_tag = '<!-- ' . $error . ' --> ';
700
- }
701
-
702
- if ( $this->admin_options['tools']['thumbnail']['lazyload'] ) {
703
- $src = 'data-img-src="' . esc_url(is_ssl() ? str_ireplace("http://", "https://", $src) : $src) . '"';
704
- } else {
705
- $src = 'src="' . esc_url(is_ssl() ? str_ireplace("http://", "https://", $src) : $src) . '"';
706
- }
707
-
708
- $img_tag .= '<img ' . $src . ' width="' . $size[0] . '" height="' . $size[1] . '" alt="' . esc_attr($alt) . '" class="' . esc_attr($class) . '" />';
709
-
710
- return apply_filters('wpp_render_image', $img_tag);
711
- }
712
-
713
- /**
714
- * Gets list of available thumbnails sizes
715
- *
716
- * @since 3.2.0
717
- * @link http://codex.wordpress.org/Function_Reference/get_intermediate_image_sizes
718
- * @param string $size
719
- * @return array|bool
720
- */
721
- public function get_sizes($size = '')
722
- {
723
- if ( ! is_array($this->available_sizes) || empty($this->available_sizes) ) {
724
- global $_wp_additional_image_sizes;
725
-
726
- $this->available_sizes = [];
727
- $get_intermediate_image_sizes = get_intermediate_image_sizes();
728
-
729
- // Create the full array with sizes and crop info
730
- foreach( $get_intermediate_image_sizes as $_size ) {
731
- if ( in_array($_size, ['thumbnail', 'medium', 'large']) ) {
732
- $this->available_sizes[$_size]['width'] = get_option($_size . '_size_w');
733
- $this->available_sizes[$_size]['height'] = get_option($_size . '_size_h');
734
- $this->available_sizes[$_size]['crop'] = (bool) get_option($_size . '_crop');
735
- } elseif ( isset($_wp_additional_image_sizes[$_size]) ) {
736
- $this->available_sizes[$_size] = [
737
- 'width' => $_wp_additional_image_sizes[$_size]['width'],
738
- 'height' => $_wp_additional_image_sizes[$_size]['height'],
739
- 'crop' => $_wp_additional_image_sizes[$_size]['crop']
740
- ];
741
- }
742
- }
743
- }
744
-
745
- // Get only 1 size if found
746
- if ( $size ) {
747
- if ( isset($this->available_sizes[$size]) ) {
748
- return $this->available_sizes[$size];
749
- }
750
- return false;
751
- }
752
-
753
- return $this->available_sizes;
754
- }
755
-
756
- /**
757
- * Returns the URL of the default thumbnail image.
758
- *
759
- * @since 5.0.0
760
- * @param int|null
761
- * @return string
762
- */
763
- public function get_default_url($post_ID = null)
764
- {
765
- if ( has_filter('wpp_default_thumbnail_url') ) {
766
- $default_thumbnail_url = apply_filters('wpp_default_thumbnail_url', $this->default_thumbnail, $post_ID);
767
-
768
- if ( $default_thumbnail_url != $this->default_thumbnail && $this->is_image_url($default_thumbnail_url) )
769
- return $default_thumbnail_url;
770
- }
771
-
772
- return $this->default_thumbnail;
773
- }
774
-
775
- /**
776
- * Checks whether an URL points to an actual image.
777
- *
778
- * @since 5.0.0
779
- * @access private
780
- * @param string
781
- * @return array|bool
782
- */
783
- private function is_image_url($url)
784
- {
785
- if ( ! filter_var($url, FILTER_VALIDATE_URL) )
786
- return false;
787
-
788
- // sanitize URL, just in case
789
- $image_url = esc_url($url);
790
- // remove querystring
791
- preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $image_url, $matches);
792
-
793
- return ( is_array($matches) && ! empty($matches) ) ? $matches : false;
794
- }
795
- }
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This class builds/retrieves the thumbnail image of each popular posts.
4
+ *
5
+ *
6
+ * @package WordPressPopularPosts
7
+ * @author Hector Cabrera <me@cabrerahector.com>
8
+ */
9
+
10
+ namespace WordPressPopularPosts;
11
+
12
+ class Image {
13
+
14
+ /**
15
+ * Default thumbnail.
16
+ *
17
+ * @since 2.2.0
18
+ * @var string
19
+ */
20
+ private $default_thumbnail = '';
21
+
22
+ /**
23
+ * Plugin uploads directory.
24
+ *
25
+ * @since 3.0.4
26
+ * @var array
27
+ */
28
+ private $uploads_dir = [];
29
+
30
+ /**
31
+ * Admin settings.
32
+ *
33
+ * @since 5.0.0
34
+ * @var array
35
+ */
36
+ private $admin_options = [];
37
+
38
+ /**
39
+ * Available image sizes.
40
+ *
41
+ * @since 5.0.0
42
+ * @var array
43
+ */
44
+ private $available_sizes = [];
45
+
46
+ /**
47
+ * Construct.
48
+ *
49
+ * @since 4.0.0
50
+ * @param array $admin_options
51
+ */
52
+ public function __construct(array $admin_options)
53
+ {
54
+ $this->admin_options = $admin_options;
55
+
56
+ // Set default thumbnail
57
+ $this->default_thumbnail = plugins_url() . "/wordpress-popular-posts/assets/images/no_thumb.jpg";
58
+
59
+ if ( $this->is_image_url($this->admin_options['tools']['thumbnail']['default']) )
60
+ $this->default_thumbnail = $this->admin_options['tools']['thumbnail']['default'];
61
+
62
+ // Set uploads folder
63
+ $wp_upload_dir = wp_get_upload_dir();
64
+ $this->uploads_dir['basedir'] = $wp_upload_dir['basedir'] . "/" . 'wordpress-popular-posts';
65
+ $this->uploads_dir['baseurl'] = $wp_upload_dir['baseurl'] . "/" . 'wordpress-popular-posts';
66
+
67
+ if ( ! is_dir($this->uploads_dir['basedir']) ) {
68
+ // Couldn't create the folder, store thumbnails in Uploads
69
+ if ( ! wp_mkdir_p($this->uploads_dir['basedir']) ) {
70
+ $this->uploads_dir['basedir'] = $wp_upload_dir['basedir'];
71
+ $this->uploads_dir['baseurl'] = $wp_upload_dir['baseurl'];
72
+ }
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Get WPP's uploads folder.
78
+ *
79
+ * @since 4.0.0
80
+ * @access public
81
+ * @return array|bool
82
+ */
83
+ public function get_plugin_uploads_dir()
84
+ {
85
+ if ( is_array($this->uploads_dir) && ! empty($this->uploads_dir) )
86
+ return $this->uploads_dir;
87
+ return false;
88
+ }
89
+
90
+ /**
91
+ * Returns an image.
92
+ *
93
+ * @since 5.0.0
94
+ * @param \stdClass $post_object Post object
95
+ * @param array $size Image size (width & height)
96
+ * @param string $source Image source
97
+ * @param bool $crop Whether to crop the image or not
98
+ * @param string $build Whether to build the image or get an existing one
99
+ * @return string
100
+ */
101
+ public function get($post_object, $size, $source, $crop = true, $build = 'manual')
102
+ {
103
+ // Bail, $post_object is not an actual object
104
+ if ( false === $post_object instanceof \stdClass || ! isset($post_object->id) ) {
105
+ return '';
106
+ }
107
+
108
+ $alt = '';
109
+ $classes = ['wpp-thumbnail', 'wpp_' . $source];
110
+ $filename = $post_object->id . '-' . $source . '-' . $size[0] . 'x' . $size[1];
111
+ $cached = $this->exists($filename);
112
+
113
+ // We have a thumbnail already, return it
114
+ if ( $cached ) {
115
+ $classes[] = 'wpp_cached_thumb';
116
+
117
+ /**
118
+ * Filters CSS classes assigned to the thumbnail
119
+ *
120
+ * @since 5.0.0
121
+ * @param array CSS classes
122
+ * @param int The post ID
123
+ * @return array The new CSS classes
124
+ */
125
+ $classes = apply_filters(
126
+ 'wpp_thumbnail_class_attribute',
127
+ $classes,
128
+ $post_object->id
129
+ );
130
+
131
+ /**
132
+ * Filters CSS classes assigned to the thumbnail
133
+ *
134
+ * @since 5.0.0
135
+ * @param string Original ALT attribute
136
+ * @param int The post ID
137
+ * @return string The new ALT attribute
138
+ */
139
+ $alt = apply_filters(
140
+ 'wpp_thumbnail_alt_attribute',
141
+ $this->get_alt_attribute($post_object->id, $source),
142
+ $post_object->id
143
+ );
144
+
145
+ return $this->render(
146
+ $cached,
147
+ $size,
148
+ is_array($classes) ? implode(' ', $classes) : 'wpp-thumbnail wpp_' . $source,
149
+ is_string($alt) ? $alt : ''
150
+ );
151
+ }
152
+
153
+ $thumb_url = null;
154
+
155
+ // Return image as-is, no need to create a new thumbnail
156
+ if (
157
+ ( 'custom_field' == $source && ! $this->admin_options['tools']['thumbnail']['resize'] )
158
+ || ( 'featured' == $source && 'predefined' == $build )
159
+ ){
160
+ /**
161
+ * Filters CSS classes assigned to the thumbnail
162
+ *
163
+ * @since 5.0.0
164
+ * @param array CSS classes
165
+ * @param int The post ID
166
+ * @return array The new CSS classes
167
+ */
168
+ $classes = apply_filters(
169
+ 'wpp_thumbnail_class_attribute',
170
+ $classes,
171
+ $post_object->id
172
+ );
173
+
174
+ // Get custom field image URL
175
+ if ( 'custom_field' == $source && ! $this->admin_options['tools']['thumbnail']['resize'] ) {
176
+ $thumb_url = get_post_meta(
177
+ $post_object->id,
178
+ $this->admin_options['tools']['thumbnail']['field'],
179
+ true
180
+ );
181
+
182
+ if ( ! $thumb_url || ! $this->is_image_url($thumb_url) ) {
183
+ // Is this an attachment ID instead of an image URL?
184
+ if ( Helper::is_number($thumb_url) ) {
185
+ $thumb_url = wp_get_attachment_image_src($thumb_url, 'full');
186
+ $thumb_url = is_array($thumb_url) ? $thumb_url[0] : null;
187
+ } else {
188
+ $thumb_url = null;
189
+ }
190
+ }
191
+
192
+ if ( $thumb_url ) {
193
+ /**
194
+ * Filters CSS classes assigned to the thumbnail
195
+ *
196
+ * @since 5.0.0
197
+ * @param string Original ALT attribute
198
+ * @param int The post ID
199
+ * @return string The new ALT attribute
200
+ */
201
+ $alt = apply_filters(
202
+ 'wpp_thumbnail_alt_attribute',
203
+ '',
204
+ $post_object->id
205
+ );
206
+ }
207
+ }
208
+ // Get Post Thumbnail
209
+ else {
210
+ if (
211
+ current_theme_supports('post-thumbnails')
212
+ && has_post_thumbnail($post_object->id)
213
+ ) {
214
+ // Find corresponding image size
215
+ $stock_size = null;
216
+ $images_sizes = $this->get_sizes();
217
+
218
+ foreach ( $images_sizes as $name => $attr ) :
219
+ if (
220
+ $attr['width'] == $size[0]
221
+ && $attr['height'] == $size[1]
222
+ && $attr['crop'] == $crop
223
+ ) {
224
+ $stock_size = $name;
225
+ break;
226
+ }
227
+ endforeach;
228
+
229
+ // Couldn't find a matching size so let's go with width/height combo instead
230
+ // (this should never happen but better safe than sorry!)
231
+ if ( null == $stock_size ) {
232
+ $stock_size = $size;
233
+ }
234
+
235
+ $featured_image = get_the_post_thumbnail(
236
+ $post_object->id,
237
+ $stock_size
238
+ );
239
+
240
+ if ( strpos($featured_image, 'class="') && is_array($classes) && ! empty($classes) )
241
+ $featured_image = str_replace('class="', 'class="'. esc_attr(implode(' ', $classes)) . ' ', $featured_image);
242
+
243
+ if ( $this->admin_options['tools']['thumbnail']['lazyload'] && false == strpos($featured_image, 'loading="lazy"') ) {
244
+ $featured_image = str_replace('src="', 'loading="lazy" src="', $featured_image);
245
+ }
246
+
247
+ return $featured_image;
248
+ }
249
+ }
250
+ }
251
+ // Build a new thumbnail and return it
252
+ else {
253
+ $file_path = null;
254
+
255
+ if ( 'custom_field' == $source && $this->admin_options['tools']['thumbnail']['resize'] ) {
256
+ $thumb_url = get_post_meta(
257
+ $post_object->id,
258
+ $this->admin_options['tools']['thumbnail']['field'],
259
+ true
260
+ );
261
+
262
+ if ( ! $thumb_url || ! $this->is_image_url($thumb_url) ) {
263
+ // Is this an attachment ID instead of an image URL?
264
+ // If so, try to fetch the image
265
+ if ( Helper::is_number($thumb_url) ) {
266
+ $thumb_url = wp_get_attachment_image_src($thumb_url, 'full');
267
+ $thumb_url = is_array($thumb_url) ? $thumb_url[0] : null;
268
+ } else {
269
+ $thumb_url = null;
270
+ }
271
+ }
272
+
273
+ if ( $thumb_url && $this->is_image_url($thumb_url) ) {
274
+ $file_path = $this->url_to_path($thumb_url, $post_object->id);
275
+ }
276
+ } else {
277
+ $file_meta = $this->get_file_meta($post_object->id, $source);
278
+
279
+ if ( is_array($file_meta) && isset($file_meta['path']) ) {
280
+ $alt = isset($file_meta['alt']) ? $file_meta['alt'] : '';
281
+ $file_path = $file_meta['path'];
282
+ }
283
+ }
284
+
285
+ if ( $file_path ) {
286
+ $extension = pathinfo($file_path, PATHINFO_EXTENSION);
287
+ $thumb_url = $this->resize(
288
+ $file_path,
289
+ $filename . '.' . $extension,
290
+ $size,
291
+ $crop
292
+ );
293
+ }
294
+ }
295
+
296
+ if ( ! $thumb_url ) {
297
+ $classes[] = 'wpp_def_no_src';
298
+ $thumb_url = $this->get_default_url($post_object->id);
299
+ }
300
+
301
+ return $this->render(
302
+ $thumb_url,
303
+ $size,
304
+ is_array($classes) ? implode(' ', $classes) : 'wpp-thumbnail wpp_' . $source,
305
+ is_string($alt) ? $alt : ''
306
+ );
307
+ }
308
+
309
+ /**
310
+ * Checks whether a given thumbnail exists.
311
+ *
312
+ * @since 5.0.0
313
+ * @access private
314
+ * @param string $filename
315
+ * @return string|bool Full URL to image
316
+ */
317
+ private function exists($filename)
318
+ {
319
+ // Do we have thumbnail already?
320
+ $file = $this->resolve(trailingslashit($this->get_plugin_uploads_dir()['basedir']) . $filename);
321
+
322
+ if ( $file && is_file($file) ) {
323
+ $extension = pathinfo($file, PATHINFO_EXTENSION);
324
+ return trailingslashit($this->get_plugin_uploads_dir()['baseurl']) . $filename . '.' . $extension;
325
+ }
326
+
327
+ return false;
328
+ }
329
+
330
+ /**
331
+ * Resolves filename.
332
+ *
333
+ * @since 5.0.0
334
+ * @access private
335
+ * @author Ioan Chiriac
336
+ * @link https://stackoverflow.com/a/29468093/9131961
337
+ * @param string $name
338
+ * @return string|bool Resolved path, or false if not found
339
+ */
340
+ private function resolve($name)
341
+ {
342
+ $info = pathinfo($name);
343
+
344
+ // File already contains an extension, return it
345
+ if ( isset($info['extension']) && ! empty($info['extension']) ) {
346
+ return $name;
347
+ }
348
+
349
+ $filename = $info['filename'];
350
+ $len = strlen($filename);
351
+
352
+ // open the folder
353
+ $dh = opendir($info['dirname']);
354
+
355
+ if ( ! $dh ) {
356
+ return false;
357
+ }
358
+
359
+ // scan each file in the folder
360
+ while ( ($file = readdir($dh)) !== false ) {
361
+ if ( strncmp($file, $filename, $len) === 0 ) {
362
+ if ( strlen($name) > $len ) {
363
+ // if name contains a directory part
364
+ $name = substr($name, 0, strlen($name) - $len) . $file;
365
+ } else {
366
+ // if the name is at the path root
367
+ $name = $file;
368
+ }
369
+
370
+ closedir($dh);
371
+ return $name;
372
+ }
373
+ }
374
+
375
+ // file not found
376
+ closedir($dh);
377
+ return false;
378
+ }
379
+
380
+ /**
381
+ * Retrieves local path to image.
382
+ *
383
+ * @since 5.0.0
384
+ * @access private
385
+ * @param string $url
386
+ * @param integer $post_ID
387
+ * @return string|boolean Path to image, or false if not found
388
+ */
389
+ private function url_to_path($url, $post_ID = null)
390
+ {
391
+ if ( $this->is_image_url($url) ) {
392
+ $attachment_id = $this->get_attachment_id($url);
393
+
394
+ // Image is hosted locally
395
+ if ( $attachment_id ) {
396
+ return get_attached_file($attachment_id);
397
+ }
398
+
399
+ // Image hosted elsewhere?
400
+ if ( $post_ID && Helper::is_number($post_ID) )
401
+ return $this->fetch_external_image($post_ID, $url);
402
+ }
403
+
404
+ return false;
405
+ }
406
+
407
+ /**
408
+ * Gets image meta.
409
+ *
410
+ * @since 5.0.0
411
+ * @access private
412
+ * @param int $id Post ID
413
+ * @param string $source Image source
414
+ * @return array|bool
415
+ */
416
+ private function get_file_meta($id, $source)
417
+ {
418
+ // get thumbnail path from the Featured Image
419
+ if ( "featured" == $source ) {
420
+ if ( $thumbnail_id = get_post_thumbnail_id($id) ) {
421
+ // image path
422
+ return [
423
+ 'path' => get_attached_file($thumbnail_id),
424
+ 'alt' => get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true)
425
+ ];
426
+ }
427
+ }
428
+ // get thumbnail path from first image attachment
429
+ elseif ( "first_attachment" == $source ) {
430
+ $args = [
431
+ 'numberposts' => 1,
432
+ 'order' => 'ASC',
433
+ 'post_parent' => $id,
434
+ 'post_type' => 'attachment',
435
+ 'post_mime_type' => 'image'
436
+ ];
437
+ $post_attachments = get_children($args);
438
+
439
+ if ( ! empty($post_attachments) ) {
440
+ $first_img = array_shift($post_attachments);
441
+
442
+ return [
443
+ 'path' => get_attached_file($first_img->ID),
444
+ 'alt' => get_post_meta($first_img->ID, '_wp_attachment_image_alt', true)
445
+ ];
446
+ }
447
+ }
448
+ // get thumbnail path from post content
449
+ elseif ( "first_image" == $source ) {
450
+ /** @var wpdb $wpdb */
451
+ global $wpdb;
452
+
453
+ if ( $content = $wpdb->get_var("SELECT post_content FROM {$wpdb->posts} WHERE ID = {$id};") ) {
454
+ // at least one image has been found
455
+ if ( preg_match('/<img[^>]+>/i', $content, $img) ) {
456
+ // get img src attribute from the first image found
457
+ preg_match('/(src)="([^"]*)"/i', $img[0], $src_attr);
458
+
459
+ if ( isset($src_attr[2]) && ! empty($src_attr[2]) ) {
460
+ // get img alt attribute from the first image found
461
+ $alt = '';
462
+ preg_match('/(alt)="([^"]*)"/i', $img[0], $alt_attr);
463
+
464
+ if ( isset($alt_attr[2]) && !empty($alt_attr[2]) ) {
465
+ $alt = $alt_attr[2];
466
+ }
467
+
468
+ // image from Media Library
469
+ if ( $attachment_id = $this->get_attachment_id($src_attr[2]) ) {
470
+ return [
471
+ 'path' => get_attached_file($attachment_id),
472
+ 'alt' => $alt
473
+ ];
474
+ } // external image?
475
+ else {
476
+ return [
477
+ 'path' => $this->fetch_external_image($id, $src_attr[2]),
478
+ 'alt' => $alt
479
+ ];
480
+ }
481
+ }
482
+ }
483
+ }
484
+ }
485
+
486
+ return false;
487
+ }
488
+
489
+ /**
490
+ * Gets image ALT attribute.
491
+ *
492
+ * @since 5.0.0
493
+ * @access private
494
+ * @param int $id Post ID
495
+ * @param string $source Image source
496
+ * @return string
497
+ */
498
+ private function get_alt_attribute($id, $source)
499
+ {
500
+ $alt = '';
501
+
502
+ // get thumbnail path from the Featured Image
503
+ if ( "featured" == $source ) {
504
+ if ( $thumbnail_id = get_post_thumbnail_id($id) ) {
505
+ // image path
506
+ $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
507
+ }
508
+ }
509
+ // get thumbnail path from first image attachment
510
+ elseif ( "first_attachment" == $source ) {
511
+ $args = [
512
+ 'numberposts' => 1,
513
+ 'order' => 'ASC',
514
+ 'post_parent' => $id,
515
+ 'post_type' => 'attachment',
516
+ 'post_mime_type' => 'image'
517
+ ];
518
+ $post_attachments = get_children($args);
519
+
520
+ if ( ! empty($post_attachments) ) {
521
+ $first_img = array_shift($post_attachments);
522
+ $alt = get_post_meta($first_img->ID, '_wp_attachment_image_alt', true);
523
+ }
524
+ }
525
+ // get thumbnail path from post content
526
+ elseif ( "first_image" == $source ) {
527
+ /** @var wpdb $wpdb */
528
+ global $wpdb;
529
+
530
+ if ( $content = $wpdb->get_var("SELECT post_content FROM {$wpdb->posts} WHERE ID = {$id};") ) {
531
+ // at least one image has been found
532
+ if ( preg_match('/<img[^>]+>/i', $content, $img) ) {
533
+ // get img alt attribute from the first image found
534
+ preg_match('/(alt)="([^"]*)"/i', $img[0], $alt_attr);
535
+
536
+ if ( isset($alt_attr[2]) && !empty($alt_attr[2]) ) {
537
+ $alt = $alt_attr[2];
538
+ }
539
+ }
540
+ }
541
+ }
542
+
543
+ return $alt;
544
+ }
545
+
546
+ /**
547
+ * Get the Attachment ID for a given image URL.
548
+ *
549
+ * @since 3.0.0
550
+ * @access private
551
+ * @author Frankie Jarrett
552
+ * @link http://frankiejarrett.com/get-an-attachment-id-by-url-in-wordpress/
553
+ * @param string $url
554
+ * @return int|null
555
+ */
556
+ private function get_attachment_id($url)
557
+ {
558
+ $url = Helper::add_scheme(
559
+ $url,
560
+ is_ssl() ? 'https://' : 'http://'
561
+ );
562
+
563
+ // Split the $url into two parts with the wp-content directory as the separator.
564
+ $parse_url = explode(parse_url(WP_CONTENT_URL, PHP_URL_PATH), $url);
565
+
566
+ // Get the host of the current site and the host of the $url, ignoring www.
567
+ $this_host = str_ireplace('www.', '', parse_url(home_url(), PHP_URL_HOST));
568
+ $file_host = str_ireplace('www.', '', parse_url($url, PHP_URL_HOST));
569
+
570
+ // Return nothing if there aren't any $url parts or if the current host and $url host do not match.
571
+ if (
572
+ ! isset($parse_url[1])
573
+ || empty($parse_url[1])
574
+ || ($this_host != $file_host)
575
+ ) {
576
+ return false;
577
+ }
578
+
579
+ // Now we're going to quickly search the DB for any attachment GUID with a partial path match.
580
+ // Example: /uploads/2013/05/test-image.jpg
581
+ global $wpdb;
582
+
583
+ if ( ! $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;", $parse_url[1])) ) {
584
+ // Maybe it's a resized image, so try to get the full one
585
+ $parse_url[1] = preg_replace('/-[0-9]{1,4}x[0-9]{1,4}\.(jpg|jpeg|png|gif|bmp)$/i', '.$1', $parse_url[1]);
586
+ $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;", $parse_url[1]));
587
+ }
588
+
589
+ // Returns null if no attachment is found.
590
+ return isset($attachment[0]) ? $attachment[0] : NULL;
591
+ }
592
+
593
+ /**
594
+ * Fetchs external images.
595
+ *
596
+ * @since 2.3.3
597
+ * @access private
598
+ * @param int $id Post ID.
599
+ * @param string $url Image url.
600
+ * @return string|bool Image path, or false on failure.
601
+ */
602
+ private function fetch_external_image($id, $url)
603
+ {
604
+ $full_image_path = trailingslashit($this->get_plugin_uploads_dir()['basedir']) . "{$id}_" . sanitize_file_name(rawurldecode(wp_basename($url)));
605
+
606
+ // if the file exists already, return URL and path
607
+ if ( file_exists($full_image_path) )
608
+ return $full_image_path;
609
+
610
+ $url = Helper::add_scheme(
611
+ $url,
612
+ is_ssl() ? 'https://' : 'http://'
613
+ );
614
+
615
+ $accepted_status_codes = [200, 301, 302];
616
+ $response = wp_remote_head($url, ['timeout' => 5, 'sslverify' => false]);
617
+
618
+ if (
619
+ ! is_wp_error($response)
620
+ && in_array(wp_remote_retrieve_response_code($response), $accepted_status_codes)
621
+ ) {
622
+ require_once(ABSPATH . 'wp-admin/includes/file.php');
623
+
624
+ $url = str_replace('https://', 'http://', $url);
625
+ $tmp = download_url($url);
626
+
627
+ // File was downloaded successfully
628
+ if ( ! is_wp_error($tmp) ) {
629
+ // Determine image type
630
+ if ( function_exists('exif_imagetype') ) {
631
+ $image_type = exif_imagetype($tmp);
632
+ } else {
633
+ $image_type = getimagesize($tmp);
634
+ $image_type = ( isset($image_type[2]) ) ? $image_type[2] : NULL;
635
+ }
636
+
637
+ // Valid image, save it
638
+ if ( in_array($image_type, [IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG]) ) {
639
+ // move file to Uploads
640
+ if ( @rename($tmp, $full_image_path) ) {
641
+ // borrowed from WP - set correct file permissions
642
+ $stat = stat(dirname($full_image_path));
643
+ $perms = $stat['mode'] & 0000644;
644
+ @chmod($full_image_path, $perms);
645
+
646
+ return $full_image_path;
647
+ }
648
+ }
649
+
650
+ // Invalid file, remove it
651
+ @unlink($tmp);
652
+ }
653
+ }
654
+
655
+ return false;
656
+ }
657
+
658
+ /**
659
+ * Resizes image.
660
+ *
661
+ * @since 3.0.0
662
+ * @access private
663
+ * @param string $path Image path
664
+ * @param string $filename Image filename
665
+ * @param array $size Image size
666
+ * @param bool $crop Whether to crop the image or not
667
+ * @return string|bool Image URL on success, false on error
668
+ */
669
+ private function resize($path, $filename, $size, $crop = true)
670
+ {
671
+ $image = wp_get_image_editor($path);
672
+
673
+ // valid image, create thumbnail
674
+ if ( ! is_wp_error($image) ) {
675
+ /**
676
+ * Hook to change the image compression quality of WPP's thumbnails.
677
+ * @since 4.2.1
678
+ */
679
+ $quality = apply_filters('wpp_thumbnail_compression_quality', null);
680
+
681
+ if ( ! ctype_digit($quality) )
682
+ $quality = null; // Fallback to core's default
683
+
684
+ $image->set_quality($quality);
685
+
686
+ $image->resize($size[0], $size[1], $crop);
687
+ $new_img = $image->save(trailingslashit($this->get_plugin_uploads_dir()['basedir']) . $filename);
688
+
689
+ if ( ! is_wp_error($new_img) )
690
+ return trailingslashit($this->get_plugin_uploads_dir()['baseurl']) . $filename;
691
+ }
692
+
693
+ return false;
694
+ }
695
+
696
+ /**
697
+ * Render image tag.
698
+ *
699
+ * @since 3.0.0
700
+ * @access public
701
+ * @param string $src Image URL
702
+ * @param array $dimension Image's width and height
703
+ * @param string $class CSS class
704
+ * @param object $alt Alternative text
705
+ * @param string $error Error, if the image could not be created
706
+ * @return string
707
+ */
708
+ public function render($src, $size, $class, $alt = '', $error = null)
709
+ {
710
+ $img_tag = '';
711
+
712
+ if ( $error ) {
713
+ $img_tag = '<!-- ' . $error . ' --> ';
714
+ }
715
+
716
+ $src = 'src="' . esc_url(is_ssl() ? str_ireplace("http://", "https://", $src) : $src) . '"';
717
+ $lazyload = ( $this->admin_options['tools']['thumbnail']['lazyload'] ) ? ' loading="lazy"' : '';
718
+
719
+ $img_tag .= '<img ' . $src . ' width="' . $size[0] . '" height="' . $size[1] . '" alt="' . esc_attr($alt) . '" class="' . esc_attr($class) . '"' . $lazyload . ' />';
720
+
721
+ return apply_filters('wpp_render_image', $img_tag);
722
+ }
723
+
724
+ /**
725
+ * Gets list of available thumbnails sizes
726
+ *
727
+ * @since 3.2.0
728
+ * @link http://codex.wordpress.org/Function_Reference/get_intermediate_image_sizes
729
+ * @param string $size
730
+ * @return array|bool
731
+ */
732
+ public function get_sizes($size = '')
733
+ {
734
+ if ( ! is_array($this->available_sizes) || empty($this->available_sizes) ) {
735
+ global $_wp_additional_image_sizes;
736
+
737
+ $this->available_sizes = [];
738
+ $get_intermediate_image_sizes = get_intermediate_image_sizes();
739
+
740
+ // Create the full array with sizes and crop info
741
+ foreach( $get_intermediate_image_sizes as $_size ) {
742
+ if ( in_array($_size, ['thumbnail', 'medium', 'large']) ) {
743
+ $this->available_sizes[$_size]['width'] = get_option($_size . '_size_w');
744
+ $this->available_sizes[$_size]['height'] = get_option($_size . '_size_h');
745
+ $this->available_sizes[$_size]['crop'] = (bool) get_option($_size . '_crop');
746
+ } elseif ( isset($_wp_additional_image_sizes[$_size]) ) {
747
+ $this->available_sizes[$_size] = [
748
+ 'width' => $_wp_additional_image_sizes[$_size]['width'],
749
+ 'height' => $_wp_additional_image_sizes[$_size]['height'],
750
+ 'crop' => $_wp_additional_image_sizes[$_size]['crop']
751
+ ];
752
+ }
753
+ }
754
+ }
755
+
756
+ // Get only 1 size if found
757
+ if ( $size ) {
758
+ if ( isset($this->available_sizes[$size]) ) {
759
+ return $this->available_sizes[$size];
760
+ }
761
+ return false;
762
+ }
763
+
764
+ return $this->available_sizes;
765
+ }
766
+
767
+ /**
768
+ * Returns the URL of the default thumbnail image.
769
+ *
770
+ * @since 5.0.0
771
+ * @param int|null
772
+ * @return string
773
+ */
774
+ public function get_default_url($post_ID = null)
775
+ {
776
+ if ( has_filter('wpp_default_thumbnail_url') ) {
777
+ $default_thumbnail_url = apply_filters('wpp_default_thumbnail_url', $this->default_thumbnail, $post_ID);
778
+
779
+ if ( $default_thumbnail_url != $this->default_thumbnail && $this->is_image_url($default_thumbnail_url) )
780
+ return $default_thumbnail_url;
781
+ }
782
+
783
+ return $this->default_thumbnail;
784
+ }
785
+
786
+ /**
787
+ * Checks whether an URL points to an actual image.
788
+ *
789
+ * @since 5.0.0
790
+ * @access private
791
+ * @param string
792
+ * @return array|bool
793
+ */
794
+ private function is_image_url($url)
795
+ {
796
+ if ( ! filter_var($url, FILTER_VALIDATE_URL) )
797
+ return false;
798
+
799
+ // sanitize URL, just in case
800
+ $image_url = esc_url($url);
801
+ // remove querystring
802
+ preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $image_url, $matches);
803
+
804
+ return ( is_array($matches) && ! empty($matches) ) ? $matches : false;
805
+ }
806
+ }
src/Moment/CustomFormats/MomentJs.php CHANGED
@@ -1,152 +1,152 @@
1
- <?php
2
-
3
- namespace WordPressPopularPosts\Moment\CustomFormats;
4
-
5
- use Moment\FormatsInterface;
6
-
7
- /**
8
- * Class MomentJs
9
- * @package Moment\CustomFormats
10
- */
11
- class MomentJs implements FormatsInterface
12
- {
13
- /**
14
- * @var array
15
- */
16
- protected $tokens = array(
17
- "M" => "n", // 1 2 ... 11 12
18
- "Mo" => "nS", // month: 1st 2nd ... 11th 12th
19
- "MM" => "m", // 01 02 ... 11 12
20
- "MMM" => "M", // Jan Feb ... Nov Dec
21
- "MMMM" => "F", // January February ... November December
22
- "D" => "j", // 1 2 ... 30 30
23
- "Do" => "jS", // day: 1st 2nd ... 30th 31st
24
- "DD" => "d", // 01 02 ... 30 31
25
- "DDD" => "z", // 1 2 ... 364 365
26
- "DDDo" => "zS", // day of year: 1st 2nd ... 364th 365th
27
- "DDDD" => "zS", // day of year: 1st 2nd ... 364th 365th
28
- "d" => "w", // 0 1 ... 5 6
29
- "do" => "wS", // day of week: 0th 1st ... 5th 6th
30
- "dd" => "D", // ***Su Mo ... Fr Sa
31
- "ddd" => "D", // Sun Mon ... Fri Sat
32
- "dddd" => "l", // Sunday Monday ... Friday Saturday
33
- "e" => "w", // 0 1 ... 5 6
34
- "E" => "N", // 1 2 ... 6 7
35
- "w" => "W", // 1 2 ... 52 53
36
- "wo" => "WS", // week of year: 1st 2nd ... 52nd 53rd
37
- "ww" => "W", // ***01 02 ... 52 53
38
- "W" => "W", // 1 2 ... 52 53
39
- "Wo" => "WS", // week of year: 1st 2nd ... 52nd 53rd
40
- "WW" => "W", // ***01 02 ... 52 53
41
- "YY" => "y", // 70 71 ... 29 30
42
- "YYYY" => "Y", // 1970 1971 ... 2029 2030
43
- "gg" => "o", // 70 71 ... 29 30
44
- "gggg" => "o", // ***1970 1971 ... 2029 2030
45
- "GG" => "o", // 70 71 ... 29 30
46
- "GGGG" => "o", // ***1970 1971 ... 2029 2030
47
- "A" => "A", // AM PM
48
- "a" => "a", // am pm
49
- "H" => "G", // 0 1 ... 22 23
50
- "HH" => "H", // 00 01 ... 22 23
51
- "h" => "g", // 1 2 ... 11 12
52
- "hh" => "h", // 01 02 ... 11 12
53
- "m" => "i", // 0 1 ... 58 59
54
- "mm" => "i", // ***00 01 ... 58 59
55
- "s" => "s", // 0 1 ... 58 59
56
- "ss" => "s", // ***00 01 ... 58 59
57
- "S" => "", // 0 1 ... 8 9
58
- "SS" => "", // 0 1 ... 98 99
59
- "SSS" => "", // 0 1 ... 998 999
60
- "z or zz" => "T", // EST CST ... MST PST 
61
- "Z" => "P", // -07:00 -06:00 ... +06:00 +07:00
62
- "ZZ" => "O", // -0700 -0600 ... +0600 +0700
63
- "X" => "U", // 1360013296
64
- "LTS" => "g:i:s A", // 8:30:15 PM
65
- "LT" => "g:i A", // 8:30 PM
66
- "L" => "m/d/Y", // 09/04/1986
67
- "l" => "n/j/Y", // 9/4/1986
68
- "LL" => "F jS Y", // September 4th 1986
69
- "ll" => "M j Y", // Sep 4 1986
70
- "LLL" => "F jS Y g:i A", // September 4th 1986 8:30 PM
71
- "lll" => "M j Y g:i A", // Sep 4 1986 8:30 PM
72
- "LLLL" => "l, F jS Y g:i A", // Thursday, September 4th 1986 8:30 PM
73
- "llll" => "D, M j Y g:i A", // Thu, Sep 4 1986 8:30 PM
74
- );
75
-
76
- /**
77
- * @param $format
78
- *
79
- * @return string
80
- */
81
- public function format($format)
82
- {
83
- return $this->momentJsToPhp($format);
84
- }
85
-
86
- /**
87
- * @return array
88
- */
89
- public function getTokens()
90
- {
91
- return (array)$this->tokens;
92
- }
93
-
94
- /**
95
- * @param array $options
96
- *
97
- * @return MomentJs
98
- */
99
- public function setTokens(array $options)
100
- {
101
- $this->tokens = array_merge($this->tokens, $options);
102
-
103
- return $this;
104
- }
105
-
106
- /**
107
- * @param String $format
108
- *
109
- * @return string
110
- */
111
- protected function momentJsToPhp($format)
112
- {
113
- $tokens = $this->getTokens();
114
-
115
- // find all tokens from string, using regular expression
116
- $regExp = "/(\[[^\[]*\])|(\\\\)?(LTS?|LL?L?L?|l{1,4}|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/";
117
- $matches = array();
118
- preg_match_all($regExp, $format, $matches);
119
-
120
- // if there is no match found then return the string as it is
121
- // TODO: might return escaped string
122
- if (empty($matches) || is_array($matches) === false)
123
- {
124
- return $format;
125
- }
126
-
127
- // to match with extracted tokens
128
- $momentTokens = array_keys($tokens);
129
- $phpMatches = array();
130
-
131
- // ----------------------------------
132
-
133
- foreach ($matches[0] as $id => $match)
134
- {
135
- // if there is a matching php token in token list
136
- if (in_array($match, $momentTokens))
137
- {
138
- // use the php token instead
139
- $string = $tokens[$match];
140
- }
141
- else
142
- {
143
- $string = $match;
144
- }
145
-
146
- $phpMatches[$id] = $string;
147
- }
148
-
149
- // join and return php specific tokens
150
- return implode("", $phpMatches);
151
- }
152
- }
1
+ <?php
2
+
3
+ namespace WordPressPopularPosts\Moment\CustomFormats;
4
+
5
+ use Moment\FormatsInterface;
6
+
7
+ /**
8
+ * Class MomentJs
9
+ * @package Moment\CustomFormats
10
+ */
11
+ class MomentJs implements FormatsInterface
12
+ {
13
+ /**
14
+ * @var array
15
+ */
16
+ protected $tokens = array(
17
+ "M" => "n", // 1 2 ... 11 12
18
+ "Mo" => "nS", // month: 1st 2nd ... 11th 12th
19
+ "MM" => "m", // 01 02 ... 11 12
20
+ "MMM" => "M", // Jan Feb ... Nov Dec
21
+ "MMMM" => "F", // January February ... November December
22
+ "D" => "j", // 1 2 ... 30 30
23
+ "Do" => "jS", // day: 1st 2nd ... 30th 31st
24
+ "DD" => "d", // 01 02 ... 30 31
25
+ "DDD" => "z", // 1 2 ... 364 365
26
+ "DDDo" => "zS", // day of year: 1st 2nd ... 364th 365th
27
+ "DDDD" => "zS", // day of year: 1st 2nd ... 364th 365th
28
+ "d" => "w", // 0 1 ... 5 6
29
+ "do" => "wS", // day of week: 0th 1st ... 5th 6th
30
+ "dd" => "D", // ***Su Mo ... Fr Sa
31
+ "ddd" => "D", // Sun Mon ... Fri Sat
32
+ "dddd" => "l", // Sunday Monday ... Friday Saturday
33
+ "e" => "w", // 0 1 ... 5 6
34
+ "E" => "N", // 1 2 ... 6 7
35
+ "w" => "W", // 1 2 ... 52 53
36
+ "wo" => "WS", // week of year: 1st 2nd ... 52nd 53rd
37
+ "ww" => "W", // ***01 02 ... 52 53
38
+ "W" => "W", // 1 2 ... 52 53
39
+ "Wo" => "WS", // week of year: 1st 2nd ... 52nd 53rd
40
+ "WW" => "W", // ***01 02 ... 52 53
41
+ "YY" => "y", // 70 71 ... 29 30
42
+ "YYYY" => "Y", // 1970 1971 ... 2029 2030
43
+ "gg" => "o", // 70 71 ... 29 30
44
+ "gggg" => "o", // ***1970 1971 ... 2029 2030
45
+ "GG" => "o", // 70 71 ... 29 30
46
+ "GGGG" => "o", // ***1970 1971 ... 2029 2030
47
+ "A" => "A", // AM PM
48
+ "a" => "a", // am pm
49
+ "H" => "G", // 0 1 ... 22 23
50
+ "HH" => "H", // 00 01 ... 22 23
51
+ "h" => "g", // 1 2 ... 11 12
52
+ "hh" => "h", // 01 02 ... 11 12
53
+ "m" => "i", // 0 1 ... 58 59
54
+ "mm" => "i", // ***00 01 ... 58 59
55
+ "s" => "s", // 0 1 ... 58 59
56
+ "ss" => "s", // ***00 01 ... 58 59
57
+ "S" => "", // 0 1 ... 8 9
58
+ "SS" => "", // 0 1 ... 98 99
59
+ "SSS" => "", // 0 1 ... 998 999
60
+ "z or zz" => "T", // EST CST ... MST PST 
61
+ "Z" => "P", // -07:00 -06:00 ... +06:00 +07:00
62
+ "ZZ" => "O", // -0700 -0600 ... +0600 +0700
63
+ "X" => "U", // 1360013296
64
+ "LTS" => "g:i:s A", // 8:30:15 PM
65
+ "LT" => "g:i A", // 8:30 PM
66
+ "L" => "m/d/Y", // 09/04/1986
67
+ "l" => "n/j/Y", // 9/4/1986
68
+ "LL" => "F jS Y", // September 4th 1986
69
+ "ll" => "M j Y", // Sep 4 1986
70
+ "LLL" => "F jS Y g:i A", // September 4th 1986 8:30 PM
71
+ "lll" => "M j Y g:i A", // Sep 4 1986 8:30 PM
72
+ "LLLL" => "l, F jS Y g:i A", // Thursday, September 4th 1986 8:30 PM
73
+ "llll" => "D, M j Y g:i A", // Thu, Sep 4 1986 8:30 PM
74
+ );
75
+
76
+ /**
77
+ * @param $format
78
+ *
79
+ * @return string
80
+ */
81
+ public function format($format)
82
+ {
83
+ return $this->momentJsToPhp($format);
84
+ }
85
+
86
+ /**
87
+ * @return array
88
+ */
89
+ public function getTokens()
90
+ {
91
+ return (array)$this->tokens;
92
+ }
93
+
94
+ /**
95
+ * @param array $options
96
+ *
97
+ * @return MomentJs
98
+ */
99
+ public function setTokens(array $options)
100
+ {
101
+ $this->tokens = array_merge($this->tokens, $options);
102
+
103
+ return $this;
104
+ }
105
+
106
+ /**
107
+ * @param String $format
108
+ *
109
+ * @return string
110
+ */
111
+ protected function momentJsToPhp($format)
112
+ {
113
+ $tokens = $this->getTokens();
114
+
115
+ // find all tokens from string, using regular expression
116
+ $regExp = "/(\[[^\[]*\])|(\\\\)?(LTS?|LL?L?L?|l{1,4}|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/";
117
+ $matches = array();
118
+ preg_match_all($regExp, $format, $matches);
119
+
120
+ // if there is no match found then return the string as it is
121
+ // TODO: might return escaped string
122
+ if (empty($matches) || is_array($matches) === false)
123
+ {
124
+ return $format;
125
+ }
126
+
127
+ // to match with extracted tokens
128
+ $momentTokens = array_keys($tokens);
129
+ $phpMatches = array();
130
+
131
+ // ----------------------------------
132
+
133
+ foreach ($matches[0] as $id => $match)
134
+ {
135
+ // if there is a matching php token in token list
136
+ if (in_array($match, $momentTokens))
137
+ {
138
+ // use the php token instead
139
+ $string = $tokens[$match];
140
+ }
141
+ else
142
+ {
143
+ $string = $match;
144
+ }
145
+
146
+ $phpMatches[$id] = $string;
147
+ }
148
+
149
+ // join and return php specific tokens
150
+ return implode("", $phpMatches);
151
+ }
152
+ }
src/Moment/FormatsInterface.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
-
3
- namespace WordPressPopularPosts\Moment;
4
-
5
- /**
6
- * Interface FormatsInterface
7
- * @package Moment
8
- */
9
- interface FormatsInterface
10
- {
11
- /**
12
- * @param string $format
13
- *
14
- * @return FormatsInterface
15
- */
16
- public function format($format);
17
-
18
- /**
19
- * @param array $customFormats
20
- *
21
- * @return FormatsInterface
22
- */
23
- public function setTokens(array $customFormats);
24
  }
1
+ <?php
2
+
3
+ namespace WordPressPopularPosts\Moment;
4
+
5
+ /**
6
+ * Interface FormatsInterface
7
+ * @package Moment
8
+ */
9
+ interface FormatsInterface
10
+ {
11
+ /**
12
+ * @param string $format
13
+ *
14
+ * @return FormatsInterface
15
+ */
16
+ public function format($format);
17
+
18
+ /**
19
+ * @param array $customFormats
20
+ *
21
+ * @return FormatsInterface
22
+ */
23
+ public function setTokens(array $customFormats);
24
  }
src/Moment/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- Moment.php is freely distributable under the terms of the MIT license.
2
-
3
- Copyright (c) 2074 Tino Ehrich
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Moment.php is freely distributable under the terms of the MIT license.
2
+
3
+ Copyright (c) 2074 Tino Ehrich
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
src/Moment/Locales/ar_TN.php CHANGED
@@ -1,44 +1,44 @@
1
- <?php
2
-
3
- // locale: arabic (tn)
4
- // author: Tarek Morgéne https://www.satoripop.com/
5
-
6
- return array(
7
- "months" => explode('_', 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'),
8
- "monthsShort" => explode('_', 'جانفي_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'),
9
- "weekdays" => explode('_', 'الاثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت_الأحد'),
10
- "weekdaysShort" => explode('_', 'أحد_اثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'),
11
- "calendar" => array(
12
- "sameDay" => '[اليوم]',
13
- "nextDay" => '[غدا ]',
14
- "lastDay" => '[أمس ]',
15
- "lastWeek" => 'l [الماضي]',
16
- "sameElse" => 'l',
17
- "withTime" => '[على الساعة] H:i',
18
- "default" => 'd/m/Y',
19
- ),
20
- "relativeTime" => array(
21
- "future" => 'في %s',
22
- "past" => 'منذ %s',
23
- "s" => 'ثوان',
24
- "ss" => '%d ثانية',
25
- "m" => 'دقيقة',
26
- "mm" => '%d دقائق',
27
- "h" => 'ساعة',
28
- "hh" => '%d ساعات',
29
- "d" => 'يوم',
30
- "dd" => '%d أيام',
31
- "M" => 'شهر',
32
- "MM" => '%d أشهر',
33
- "y" => 'سنة',
34
- "yy" => '%d سنوات',
35
- ),
36
- "ordinal" => function ($number)
37
- {
38
- return $number . ($number === 1 ? '[er]' : '');
39
- },
40
- "week" => array(
41
- "dow" => 1, // Monday is the first day of the week.
42
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
43
- ),
44
- );
1
+ <?php
2
+
3
+ // locale: arabic (tn)
4
+ // author: Tarek Morgéne https://www.satoripop.com/
5
+
6
+ return array(
7
+ "months" => explode('_', 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'),
8
+ "monthsShort" => explode('_', 'جانفي_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'),
9
+ "weekdays" => explode('_', 'الاثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت_الأحد'),
10
+ "weekdaysShort" => explode('_', 'أحد_اثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'),
11
+ "calendar" => array(
12
+ "sameDay" => '[اليوم]',
13
+ "nextDay" => '[غدا ]',
14
+ "lastDay" => '[أمس ]',
15
+ "lastWeek" => 'l [الماضي]',
16
+ "sameElse" => 'l',
17
+ "withTime" => '[على الساعة] H:i',
18
+ "default" => 'd/m/Y',
19
+ ),
20
+ "relativeTime" => array(
21
+ "future" => 'في %s',
22
+ "past" => 'منذ %s',
23
+ "s" => 'ثوان',
24
+ "ss" => '%d ثانية',
25
+ "m" => 'دقيقة',
26
+ "mm" => '%d دقائق',
27
+ "h" => 'ساعة',
28
+ "hh" => '%d ساعات',
29
+ "d" => 'يوم',
30
+ "dd" => '%d أيام',
31
+ "M" => 'شهر',
32
+ "MM" => '%d أشهر',
33
+ "y" => 'سنة',
34
+ "yy" => '%d سنوات',
35
+ ),
36
+ "ordinal" => function ($number)
37
+ {
38
+ return $number . ($number === 1 ? '[er]' : '');
39
+ },
40
+ "week" => array(
41
+ "dow" => 1, // Monday is the first day of the week.
42
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
43
+ ),
44
+ );
src/Moment/Locales/ca_ES.php CHANGED
@@ -1,65 +1,65 @@
1
- <?php
2
-
3
- // locale: Catalan (ca_ES)
4
- // author: CROWD Studio https://github.com/crowd-studio
5
-
6
- use Moment\Moment;
7
-
8
- return array(
9
- "months" => explode('_', 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'),
10
- "monthsShort" => explode('_', 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'),
11
- "weekdays" => explode('_', 'dilluns_dimarts_dimecres_dijous_divendres_dissabte_diumenge'),
12
- "weekdaysShort" => explode('_', 'dl._dt._dc._dj._dv._ds._dg.'),
13
- "calendar" => array(
14
- "sameDay" => '[avui]',
15
- "nextDay" => '[demà]',
16
- "lastDay" => '[ahir]',
17
- "lastWeek" => '[el] l',
18
- "sameElse" => 'l',
19
- "withTime" => function (Moment $moment) { return '[a' . ($moment->getHour() != 1 ? ' les ' : ' l\'') . ']G.i [h]'; },
20
- "default" => 'd/m/Y',
21
- ),
22
- "relativeTime" => array(
23
- "future" => 'en %s',
24
- "past" => 'fa %s',
25
- "s" => 'uns segons',
26
- "ss" => '%d segons',
27
- "m" => 'un minut',
28
- "mm" => '%d minuts',
29
- "h" => 'una hora',
30
- "hh" => '%d hores',
31
- "d" => 'un dia',
32
- "dd" => '%d dies',
33
- "M" => 'un mes',
34
- "MM" => '%d mesos',
35
- "y" => 'un any',
36
- "yy" => '%d anys',
37
- ),
38
- "ordinal" => function ($number)
39
- {
40
-
41
- switch ($number) {
42
- case 1:
43
- $output = 'r';
44
- break;
45
- case 2:
46
- $output = 'n';
47
- break;
48
- case 3:
49
- $output = 'r';
50
- break;
51
- case 4:
52
- $output = 't';
53
- break;
54
- default:
55
- $output = 'è';
56
- break;
57
- }
58
-
59
- return $number . '[' . $output . ']';
60
- },
61
- "week" => array(
62
- "dow" => 1, // Monday is the first day of the week.
63
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
64
- ),
65
- );
1
+ <?php
2
+
3
+ // locale: Catalan (ca_ES)
4
+ // author: CROWD Studio https://github.com/crowd-studio
5
+
6
+ use Moment\Moment;
7
+
8
+ return array(
9
+ "months" => explode('_', 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'),
10
+ "monthsShort" => explode('_', 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'),
11
+ "weekdays" => explode('_', 'dilluns_dimarts_dimecres_dijous_divendres_dissabte_diumenge'),
12
+ "weekdaysShort" => explode('_', 'dl._dt._dc._dj._dv._ds._dg.'),
13
+ "calendar" => array(
14
+ "sameDay" => '[avui]',
15
+ "nextDay" => '[demà]',
16
+ "lastDay" => '[ahir]',
17
+ "lastWeek" => '[el] l',
18
+ "sameElse" => 'l',
19
+ "withTime" => function (Moment $moment) { return '[a' . ($moment->getHour() != 1 ? ' les ' : ' l\'') . ']G.i [h]'; },
20
+ "default" => 'd/m/Y',
21
+ ),
22
+ "relativeTime" => array(
23
+ "future" => 'en %s',
24
+ "past" => 'fa %s',
25
+ "s" => 'uns segons',
26
+ "ss" => '%d segons',
27
+ "m" => 'un minut',
28
+ "mm" => '%d minuts',
29
+ "h" => 'una hora',
30
+ "hh" => '%d hores',
31
+ "d" => 'un dia',
32
+ "dd" => '%d dies',
33
+ "M" => 'un mes',
34
+ "MM" => '%d mesos',
35
+ "y" => 'un any',
36
+ "yy" => '%d anys',
37
+ ),
38
+ "ordinal" => function ($number)
39
+ {
40
+
41
+ switch ($number) {
42
+ case 1:
43
+ $output = 'r';
44
+ break;
45
+ case 2:
46
+ $output = 'n';
47
+ break;
48
+ case 3:
49
+ $output = 'r';
50
+ break;
51
+ case 4:
52
+ $output = 't';
53
+ break;
54
+ default:
55
+ $output = 'è';
56
+ break;
57
+ }
58
+
59
+ return $number . '[' . $output . ']';
60
+ },
61
+ "week" => array(
62
+ "dow" => 1, // Monday is the first day of the week.
63
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
64
+ ),
65
+ );
src/Moment/Locales/cs_CZ.php CHANGED
@@ -1,107 +1,107 @@
1
- <?php
2
-
3
- // locale: Czech (Czech Republic) (cs_CZ)
4
- // author: Jan Ptacek https://github.com/ptica
5
-
6
- use Moment\Moment;
7
-
8
- /**
9
- * @param string $direction
10
- * @param string $trueString
11
- * @param string $falseString
12
- *
13
- * @return string
14
- */
15
- $ifPast = function ($direction, $trueString, $falseString)
16
- {
17
- return $direction === 'past' ? $trueString : $falseString;
18
- };
19
-
20
- /**
21
- * @param int $count
22
- * @param int $countSmallerThan
23
- * @param string $trueString
24
- * @param string $falseString
25
- *
26
- * @return string
27
- */
28
- $ifCountSmaller = function ($count, $countSmallerThan, $trueString, $falseString)
29
- {
30
- return $count < $countSmallerThan ? $trueString : $falseString;
31
- };
32
-
33
- return array(
34
- "months" => explode('_', 'ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince'),
35
- "monthsShort" => explode('_', 'Led_Úno_Bře_Dub_Kvě_Čer_Čvc_Srp_Zář_Říj_Lis_Pro'),
36
- "weekdays" => explode('_', 'pondělí_úterý_středa_čtvrtek_pátek_sobota_neděle'),
37
- "weekdaysShort" => explode('_', 'po_út_st_čt_pá_so_ne'),
38
- "calendar" => array(
39
- "sameDay" => '[dnes]',
40
- "nextDay" => '[zítra]',
41
- "lastDay" => '[včera]',
42
- "lastWeek" => '[minulý] l',
43
- "sameElse" => 'l',
44
- "withTime" => '[v] H:i',
45
- "default" => 'd.m.Y',
46
- ),
47
- "relativeTime" => array(
48
- "future" => 'za %s',
49
- "past" => 'před %s',
50
- "s" => function ($count, $direction, Moment $m) use ($ifPast)
51
- {
52
- return $ifPast($direction, 'okamžikem', 'okamžik');
53
- },
54
- "ss" => function ($count, $direction, Moment $m) use ($ifPast)
55
- {
56
- return $ifPast($direction, 'okamžikem', 'okamžik');
57
- },
58
- "m" => function ($count, $direction, Moment $m) use ($ifPast)
59
- {
60
- return $ifPast($direction, 'minutou', 'minutu');
61
- },
62
- "mm" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
63
- {
64
- return $ifPast($direction, '%d minutami', $ifCountSmaller($count, 5, '%d minuty', '%d minut'));
65
- },
66
- "h" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
67
- {
68
- return $ifPast($direction, 'hodinou', 'hodinu');
69
- },
70
- "hh" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
71
- {
72
- return $ifPast($direction, '%d hodinami', $ifCountSmaller($count, 5, '%d hodiny', '%d hodin'));
73
- },
74
- "d" => function ($count, $direction, Moment $m) use ($ifPast)
75
- {
76
- return $ifPast($direction, 'dnem', 'den');
77
- },
78
- "dd" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
79
- {
80
- return $ifPast($direction, '%d dny', $ifCountSmaller($count, 5, '%d dny', '%d dnů'));
81
- },
82
- "M" => function ($count, $direction, Moment $m) use ($ifPast)
83
- {
84
- return $ifPast($direction, 'měsícem', 'měsíc');
85
- },
86
- "MM" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
87
- {
88
- return $ifPast($direction, '%d měsíci', $ifCountSmaller($count, 5, '%d měsíce', '%d měsíců'));
89
- },
90
- "y" => function ($count, $direction, Moment $m) use ($ifPast)
91
- {
92
- return $ifPast($direction, 'rokem', 'rok');
93
- },
94
- "yy" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
95
- {
96
- return $ifPast($direction, $ifCountSmaller($count, 5, '%d roky', '%d lety'), $ifCountSmaller($count, 5, '%d roky', '%d let'));
97
- },
98
- ),
99
- "ordinal" => function ($number)
100
- {
101
- return $number . '.';
102
- },
103
- "week" => array(
104
- "dow" => 1, // Monday is the first day of the week.
105
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
106
- ),
107
- );
1
+ <?php
2
+
3
+ // locale: Czech (Czech Republic) (cs_CZ)
4
+ // author: Jan Ptacek https://github.com/ptica
5
+
6
+ use Moment\Moment;
7
+
8
+ /**
9
+ * @param string $direction
10
+ * @param string $trueString
11
+ * @param string $falseString
12
+ *
13
+ * @return string
14
+ */
15
+ $ifPast = function ($direction, $trueString, $falseString)
16
+ {
17
+ return $direction === 'past' ? $trueString : $falseString;
18
+ };
19
+
20
+ /**
21
+ * @param int $count
22
+ * @param int $countSmallerThan
23
+ * @param string $trueString
24
+ * @param string $falseString
25
+ *
26
+ * @return string
27
+ */
28
+ $ifCountSmaller = function ($count, $countSmallerThan, $trueString, $falseString)
29
+ {
30
+ return $count < $countSmallerThan ? $trueString : $falseString;
31
+ };
32
+
33
+ return array(
34
+ "months" => explode('_', 'ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince'),
35
+ "monthsShort" => explode('_', 'Led_Úno_Bře_Dub_Kvě_Čer_Čvc_Srp_Zář_Říj_Lis_Pro'),
36
+ "weekdays" => explode('_', 'pondělí_úterý_středa_čtvrtek_pátek_sobota_neděle'),
37
+ "weekdaysShort" => explode('_', 'po_út_st_čt_pá_so_ne'),
38
+ "calendar" => array(
39
+ "sameDay" => '[dnes]',
40
+ "nextDay" => '[zítra]',
41
+ "lastDay" => '[včera]',
42
+ "lastWeek" => '[minulý] l',
43
+ "sameElse" => 'l',
44
+ "withTime" => '[v] H:i',
45
+ "default" => 'd.m.Y',
46
+ ),
47
+ "relativeTime" => array(
48
+ "future" => 'za %s',
49
+ "past" => 'před %s',
50
+ "s" => function ($count, $direction, Moment $m) use ($ifPast)
51
+ {
52
+ return $ifPast($direction, 'okamžikem', 'okamžik');
53
+ },
54
+ "ss" => function ($count, $direction, Moment $m) use ($ifPast)
55
+ {
56
+ return $ifPast($direction, 'okamžikem', 'okamžik');
57
+ },
58
+ "m" => function ($count, $direction, Moment $m) use ($ifPast)
59
+ {
60
+ return $ifPast($direction, 'minutou', 'minutu');
61
+ },
62
+ "mm" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
63
+ {
64
+ return $ifPast($direction, '%d minutami', $ifCountSmaller($count, 5, '%d minuty', '%d minut'));
65
+ },
66
+ "h" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
67
+ {
68
+ return $ifPast($direction, 'hodinou', 'hodinu');
69
+ },
70
+ "hh" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
71
+ {
72
+ return $ifPast($direction, '%d hodinami', $ifCountSmaller($count, 5, '%d hodiny', '%d hodin'));
73
+ },
74
+ "d" => function ($count, $direction, Moment $m) use ($ifPast)
75
+ {
76
+ return $ifPast($direction, 'dnem', 'den');
77
+ },
78
+ "dd" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
79
+ {
80
+ return $ifPast($direction, '%d dny', $ifCountSmaller($count, 5, '%d dny', '%d dnů'));
81
+ },
82
+ "M" => function ($count, $direction, Moment $m) use ($ifPast)
83
+ {
84
+ return $ifPast($direction, 'měsícem', 'měsíc');
85
+ },
86
+ "MM" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
87
+ {
88
+ return $ifPast($direction, '%d měsíci', $ifCountSmaller($count, 5, '%d měsíce', '%d měsíců'));
89
+ },
90
+ "y" => function ($count, $direction, Moment $m) use ($ifPast)
91
+ {
92
+ return $ifPast($direction, 'rokem', 'rok');
93
+ },
94
+ "yy" => function ($count, $direction, Moment $m) use ($ifPast, $ifCountSmaller)
95
+ {
96
+ return $ifPast($direction, $ifCountSmaller($count, 5, '%d roky', '%d lety'), $ifCountSmaller($count, 5, '%d roky', '%d let'));
97
+ },
98
+ ),
99
+ "ordinal" => function ($number)
100
+ {
101
+ return $number . '.';
102
+ },
103
+ "week" => array(
104
+ "dow" => 1, // Monday is the first day of the week.
105
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
106
+ ),
107
+ );
src/Moment/Locales/da_DK.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
-
3
- // locale: danish (da-dk)
4
- // author: Morten Wulff https://github.com/wulff
5
-
6
- return array(
7
- "months" => explode('_', 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'),
8
- "monthsShort" => explode('_', 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'),
9
- "weekdays" => explode('_', 'mandag_tirsdag_onsdag_torsdag_fredag_lørdag_søndag'),
10
- "weekdaysShort" => explode('_', 'man_tir_ons_tor_fre_lør_søn'),
11
- "calendar" => array(
12
- "sameDay" => '[I dag]',
13
- "nextDay" => '[I morgen]',
14
- "lastDay" => '[I går]',
15
- "lastWeek" => '[Sidste] l',
16
- "sameElse" => 'l',
17
- "withTime" => '[kl] H:i',
18
- "default" => 'd/m/Y',
19
- ),
20
- "relativeTime" => array(
21
- "future" => 'om %s',
22
- "past" => '%s siden',
23
- "s" => 'få sekunder',
24
- "ss" => '%d sekunder',
25
- "m" => 'et minut',
26
- "mm" => '%d minutter',
27
- "h" => 'en time',
28
- "hh" => '%d timer',
29
- "d" => 'en dag',
30
- "dd" => '%d dage',
31
- "M" => 'en måned',
32
- "MM" => '%d måneder',
33
- "y" => 'et år',
34
- "yy" => '%d år',
35
- ),
36
- "ordinal" => function ($number) {
37
- return $number . '.';
38
- },
39
- "week" => array(
40
- "dow" => 1, // Monday is the first day of the week.
41
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
42
- ),
43
- );
1
+ <?php
2
+
3
+ // locale: danish (da-dk)
4
+ // author: Morten Wulff https://github.com/wulff
5
+
6
+ return array(
7
+ "months" => explode('_', 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'),
8
+ "monthsShort" => explode('_', 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'),
9
+ "weekdays" => explode('_', 'mandag_tirsdag_onsdag_torsdag_fredag_lørdag_søndag'),
10
+ "weekdaysShort" => explode('_', 'man_tir_ons_tor_fre_lør_søn'),
11
+ "calendar" => array(
12
+ "sameDay" => '[I dag]',
13
+ "nextDay" => '[I morgen]',
14
+ "lastDay" => '[I går]',
15
+ "lastWeek" => '[Sidste] l',
16
+ "sameElse" => 'l',
17
+ "withTime" => '[kl] H:i',
18
+ "default" => 'd/m/Y',
19
+ ),
20
+ "relativeTime" => array(
21
+ "future" => 'om %s',
22
+ "past" => '%s siden',
23
+ "s" => 'få sekunder',
24
+ "ss" => '%d sekunder',
25
+ "m" => 'et minut',
26
+ "mm" => '%d minutter',
27
+ "h" => 'en time',
28
+ "hh" => '%d timer',
29
+ "d" => 'en dag',
30
+ "dd" => '%d dage',
31
+ "M" => 'en måned',
32
+ "MM" => '%d måneder',
33
+ "y" => 'et år',
34
+ "yy" => '%d år',
35
+ ),
36
+ "ordinal" => function ($number) {
37
+ return $number . '.';
38
+ },
39
+ "week" => array(
40
+ "dow" => 1, // Monday is the first day of the week.
41
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
42
+ ),
43
+ );
src/Moment/Locales/de_DE.php CHANGED
@@ -1,44 +1,44 @@
1
- <?php
2
-
3
- // locale: German (Germany) (de_DE)
4
- // author: Tino Ehrich (tino@bigpun.me)
5
-
6
- return array(
7
- "months" => explode('_', 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'),
8
- "monthsShort" => explode('_', 'Jan_Feb_Mär_Apr_Mai_Jun_Jul_Aug_Sep_Okt_Nov_Dez'),
9
- "weekdays" => explode('_', 'Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag_Sonntag'),
10
- "weekdaysShort" => explode('_', 'Mo_Di_Mi_Do_Fr_Sa_So'),
11
- "calendar" => array(
12
- "sameDay" => '[Heute]',
13
- "nextDay" => '[Morgen]',
14
- "lastDay" => '[Gestern]',
15
- "lastWeek" => '[Letzten] l',
16
- "sameElse" => 'l',
17
- "withTime" => '[um] G:i [Uhr]',
18
- "default" => 'd.m.Y',
19
- ),
20
- "relativeTime" => array(
21
- "future" => 'in %s',
22
- "past" => 'vor %s',
23
- "s" => 'ein paar Sekunden',
24
- "ss" => '%d Sekunden',
25
- "m" => 'einer Minute',
26
- "mm" => '%d Minuten',
27
- "h" => 'einer Stunde',
28
- "hh" => '%d Stunden',
29
- "d" => 'einem Tag',
30
- "dd" => '%d Tagen',
31
- "M" => 'einem Monat',
32
- "MM" => '%d Monaten',
33
- "y" => 'einem Jahr',
34
- "yy" => '%d Jahren',
35
- ),
36
- "ordinal" => function ($number)
37
- {
38
- return $number . '.';
39
- },
40
- "week" => array(
41
- "dow" => 1, // Monday is the first day of the week.
42
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
43
- ),
44
- );
1
+ <?php
2
+
3
+ // locale: German (Germany) (de_DE)
4
+ // author: Tino Ehrich (tino@bigpun.me)
5
+
6
+ return array(
7
+ "months" => explode('_', 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'),
8
+ "monthsShort" => explode('_', 'Jan_Feb_Mär_Apr_Mai_Jun_Jul_Aug_Sep_Okt_Nov_Dez'),
9
+ "weekdays" => explode('_', 'Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag_Sonntag'),
10
+ "weekdaysShort" => explode('_', 'Mo_Di_Mi_Do_Fr_Sa_So'),
11
+ "calendar" => array(
12
+ "sameDay" => '[Heute]',
13
+ "nextDay" => '[Morgen]',
14
+ "lastDay" => '[Gestern]',
15
+ "lastWeek" => '[Letzten] l',
16
+ "sameElse" => 'l',
17
+ "withTime" => '[um] G:i [Uhr]',
18
+ "default" => 'd.m.Y',
19
+ ),
20
+ "relativeTime" => array(
21
+ "future" => 'in %s',
22
+ "past" => 'vor %s',
23
+ "s" => 'ein paar Sekunden',
24
+ "ss" => '%d Sekunden',
25
+ "m" => 'einer Minute',
26
+ "mm" => '%d Minuten',
27
+ "h" => 'einer Stunde',
28
+ "hh" => '%d Stunden',
29
+ "d" => 'einem Tag',
30
+ "dd" => '%d Tagen',
31
+ "M" => 'einem Monat',
32
+ "MM" => '%d Monaten',
33
+ "y" => 'einem Jahr',
34
+ "yy" => '%d Jahren',
35
+ ),
36
+ "ordinal" => function ($number)
37
+ {
38
+ return $number . '.';
39
+ },
40
+ "week" => array(
41
+ "dow" => 1, // Monday is the first day of the week.
42
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
43
+ ),
44
+ );
src/Moment/Locales/en_GB.php CHANGED
@@ -1,65 +1,65 @@
1
- <?php
2
-
3
- // locale: great britain english (en-gb)
4
- // author: Chris Gedrim https://github.com/chrisgedrim
5
-
6
- return array(
7
- "months" => explode('_', 'January_February_March_April_May_June_July_August_September_October_November_December'),
8
- "monthsNominative" => explode('_', 'January_February_March_April_May_June_July_August_September_October_November_December'),
9
- "monthsShort" => explode('_', 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'),
10
- "weekdays" => explode('_', 'Monday_Tuesday_Wednesday_Thursday_Friday_Saturday_Sunday'),
11
- "weekdaysShort" => explode('_', 'Mon_Tue_Wed_Thu_Fri_Sat_Sun'),
12
- "calendar" => array(
13
- "sameDay" => '[Today]',
14
- "nextDay" => '[Tomorrow]',
15
- "lastDay" => '[Yesterday]',
16
- "lastWeek" => '[Last] l',
17
- "sameElse" => 'l',
18
- "withTime" => '[at] H:i',
19
- "default" => 'd/m/Y',
20
- ),
21
- "relativeTime" => array(
22
- "future" => 'in %s',
23
- "past" => '%s ago',
24
- "s" => 'a few seconds',
25
- "ss" => '%d seconds',
26
- "m" => 'a minute',
27
- "mm" => '%d minutes',
28
- "h" => 'an hour',
29
- "hh" => '%d hours',
30
- "d" => 'a day',
31
- "dd" => '%d days',
32
- "M" => 'a month',
33
- "MM" => '%d months',
34
- "y" => 'a year',
35
- "yy" => '%d years',
36
- ),
37
- "ordinal" => function ($number)
38
- {
39
- $n = $number % 100;
40
- $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th');
41
-
42
- if ($n >= 11 && $n <= 13)
43
- {
44
- return $number . '[th]';
45
- }
46
-
47
- return $number . '[' . $ends[$number % 10] . ']';
48
- },
49
- "week" => array(
50
- "dow" => 1, // Monday is the first day of the week.
51
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
52
- ),
53
- "customFormats" => array(
54
- "LT" => "G:i", // 22:00
55
- "LTS" => "G:i:s", // 22:00:00
56
- "L" => "d/m/Y", // 12/06/2010
57
- "l" => "j/n/Y", // 12/6/2010
58
- "LL" => "j F Y", // 12 June 2010
59
- "ll" => "j M Y", // 12 Jun 2010
60
- "LLL" => "j F Y G:i", // 12 June 2010 22:00
61
- "lll" => "j M Y G:i", // 12 Jun 2010 22:00
62
- "LLLL" => "l, j F F Y G:i", // Saturday, 12 June June 2010 22:00
63
- "llll" => "D, j M Y G:i", // Sat, 12 Jun 2010 22:00
64
- ),
65
  );
1
+ <?php
2
+
3
+ // locale: great britain english (en-gb)
4
+ // author: Chris Gedrim https://github.com/chrisgedrim
5
+
6
+ return array(
7
+ "months" => explode('_', 'January_February_March_April_May_June_July_August_September_October_November_December'),
8
+ "monthsNominative" => explode('_', 'January_February_March_April_May_June_July_August_September_October_November_December'),
9
+ "monthsShort" => explode('_', 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'),
10
+ "weekdays" => explode('_', 'Monday_Tuesday_Wednesday_Thursday_Friday_Saturday_Sunday'),
11
+ "weekdaysShort" => explode('_', 'Mon_Tue_Wed_Thu_Fri_Sat_Sun'),
12
+ "calendar" => array(
13
+ "sameDay" => '[Today]',
14
+ "nextDay" => '[Tomorrow]',
15
+ "lastDay" => '[Yesterday]',
16
+ "lastWeek" => '[Last] l',
17
+ "sameElse" => 'l',
18
+ "withTime" => '[at] H:i',
19
+ "default" => 'd/m/Y',
20
+ ),
21
+ "relativeTime" => array(
22
+ "future" => 'in %s',
23
+ "past" => '%s ago',
24
+ "s" => 'a few seconds',
25
+ "ss" => '%d seconds',
26
+ "m" => 'a minute',
27
+ "mm" => '%d minutes',
28
+ "h" => 'an hour',
29
+ "hh" => '%d hours',
30
+ "d" => 'a day',
31
+ "dd" => '%d days',
32
+ "M" => 'a month',
33
+ "MM" => '%d months',
34
+ "y" => 'a year',
35
+ "yy" => '%d years',
36
+ ),
37
+ "ordinal" => function ($number)
38
+ {
39
+ $n = $number % 100;
40
+ $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th');
41
+
42
+ if ($n >= 11 && $n <= 13)
43
+ {
44
+ return $number . '[th]';
45
+ }
46
+
47
+ return $number . '[' . $ends[$number % 10] . ']';
48
+ },
49
+ "week" => array(
50
+ "dow" => 1, // Monday is the first day of the week.
51
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
52
+ ),
53
+ "customFormats" => array(
54
+ "LT" => "G:i", // 22:00
55
+ "LTS" => "G:i:s", // 22:00:00
56
+ "L" => "d/m/Y", // 12/06/2010
57
+ "l" => "j/n/Y", // 12/6/2010
58
+ "LL" => "j F Y", // 12 June 2010
59
+ "ll" => "j M Y", // 12 Jun 2010
60
+ "LLL" => "j F Y G:i", // 12 June 2010 22:00
61
+ "lll" => "j M Y G:i", // 12 Jun 2010 22:00
62
+ "LLLL" => "l, j F F Y G:i", // Saturday, 12 June June 2010 22:00
63
+ "llll" => "D, j M Y G:i", // Sat, 12 Jun 2010 22:00
64
+ ),
65
  );
src/Moment/Locales/en_US.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
-
3
- // locale: american english (en_US)
4
-
5
- $locale = require __DIR__ . '/en_GB.php';
6
- $locale['calendar']['withTime'] = '[at] h:i A';
7
- $locale['calendar']['default'] = 'm/d/Y';
8
- $locale['week']['dow'] = 7;
9
- $locale["customFormats"] = array(
10
- "LT" => "g:i A", // 8:30 PM
11
- "L" => "m/d/Y", // 09/04/1986
12
- "l" => "n/j/Y", // 9/4/1986
13
- "LL" => "F j, Y", // September 4, 1986
14
- "ll" => "M j, Y", // Sep 4, 1986
15
- "LLL" => "F j, Y g:i A", // September 4, 1986 8:30 PM
16
- "lll" => "M j, Y g:i A", // Sep 4, 1986 8:30 PM
17
- "LLLL" => "l, F j, Y g:i A", // Thursday, September 4, 1986 8:30 PM
18
- "llll" => "D, M j, Y g:i A", // Thu, Sep 4, 1986 8:30 PM
19
- );
20
-
21
  return $locale;
1
+ <?php
2
+
3
+ // locale: american english (en_US)
4
+
5
+ $locale = require __DIR__ . '/en_GB.php';
6
+ $locale['calendar']['withTime'] = '[at] h:i A';
7
+ $locale['calendar']['default'] = 'm/d/Y';
8
+ $locale['week']['dow'] = 7;
9
+ $locale["customFormats"] = array(
10
+ "LT" => "g:i A", // 8:30 PM
11
+ "L" => "m/d/Y", // 09/04/1986
12
+ "l" => "n/j/Y", // 9/4/1986
13
+ "LL" => "F j, Y", // September 4, 1986
14
+ "ll" => "M j, Y", // Sep 4, 1986
15
+ "LLL" => "F j, Y g:i A", // September 4, 1986 8:30 PM
16
+ "lll" => "M j, Y g:i A", // Sep 4, 1986 8:30 PM
17
+ "LLLL" => "l, F j, Y g:i A", // Thursday, September 4, 1986 8:30 PM
18
+ "llll" => "D, M j, Y g:i A", // Thu, Sep 4, 1986 8:30 PM
19
+ );
20
+
21
  return $locale;
src/Moment/Locales/es_ES.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
- // locale: spanish (es)
4
- // author: Julio Napurí https://github.com/julionc
5
-
6
- use Moment\Moment;
7
-
8
- return array(
9
- "months" => explode('_', 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'),
10
- "monthsShort" => explode('_', 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'),
11
- "weekdays" => explode('_', 'lunes_martes_miércoles_jueves_viernes_sábado_domingo'),
12
- "weekdaysShort" => explode('_', 'lun._mar._mié._jue._vie._sáb._dom.'),
13
- "calendar" => array(
14
- "sameDay" => '[hoy]',
15
- "nextDay" => '[mañana]',
16
- "lastDay" => '[ayer]',
17
- "lastWeek" => '[el] l',
18
- "sameElse" => 'l',
19
- "withTime" => function (Moment $moment) { return '[a la' . ($moment->getHour() != 1 ? 's' : null) . '] G:i [h]'; },
20
- "default" => 'd/m/Y',
21
- ),
22
- "relativeTime" => array(
23
- "future" => 'en %s',
24
- "past" => 'hace %s',
25
- "s" => 'unos segundos',
26
- "ss" => '%d segundos',
27
- "m" => 'un minuto',
28
- "mm" => '%d minutos',
29
- "h" => 'una hora',
30
- "hh" => '%d horas',
31
- "d" => 'un día',
32
- "dd" => '%d días',
33
- "M" => 'un mes',
34
- "MM" => '%d meses',
35
- "y" => 'un año',
36
- "yy" => '%d años',
37
- ),
38
- "ordinal" => function ($number)
39
- {
40
- return $number . 'º';
41
- },
42
- "week" => array(
43
- "dow" => 1, // Monday is the first day of the week.
44
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
45
- ),
46
- );
1
+ <?php
2
+
3
+ // locale: spanish (es)
4
+ // author: Julio Napurí https://github.com/julionc
5
+
6
+ use Moment\Moment;
7
+
8
+ return array(
9
+ "months" => explode('_', 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'),
10
+ "monthsShort" => explode('_', 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'),
11
+ "weekdays" => explode('_', 'lunes_martes_miércoles_jueves_viernes_sábado_domingo'),
12
+ "weekdaysShort" => explode('_', 'lun._mar._mié._jue._vie._sáb._dom.'),
13
+ "calendar" => array(
14
+ "sameDay" => '[hoy]',
15
+ "nextDay" => '[mañana]',
16
+ "lastDay" => '[ayer]',
17
+ "lastWeek" => '[el] l',
18
+ "sameElse" => 'l',
19
+ "withTime" => function (Moment $moment) { return '[a la' . ($moment->getHour() != 1 ? 's' : null) . '] G:i [h]'; },
20
+ "default" => 'd/m/Y',
21
+ ),
22
+ "relativeTime" => array(
23
+ "future" => 'en %s',
24
+ "past" => 'hace %s',
25
+ "s" => 'unos segundos',
26
+ "ss" => '%d segundos',
27
+ "m" => 'un minuto',
28
+ "mm" => '%d minutos',
29
+ "h" => 'una hora',
30
+ "hh" => '%d horas',
31
+ "d" => 'un día',
32
+ "dd" => '%d días',
33
+ "M" => 'un mes',
34
+ "MM" => '%d meses',
35
+ "y" => 'un año',
36
+ "yy" => '%d años',
37
+ ),
38
+ "ordinal" => function ($number)
39
+ {
40
+ return $number . 'º';
41
+ },
42
+ "week" => array(
43
+ "dow" => 1, // Monday is the first day of the week.
44
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
45
+ ),
46
+ );
src/Moment/Locales/fr_FR.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
-
3
- // locale: french (fr)
4
- // author: John Fischer https://github.com/jfroffice
5
-
6
- return array(
7
- "months" => explode('_', 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'),
8
- "monthsShort" => explode('_', 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'),
9
- "weekdays" => explode('_', 'lundi_mardi_mercredi_jeudi_vendredi_samedi_dimanche'),
10
- "weekdaysShort" => explode('_', 'lun._mar._mer._jeu._ven._sam._dim.'),
11
- "calendar" => array(
12
- "sameDay" => '[Aujourd\'hui]',
13
- "nextDay" => '[Demain]',
14
- "lastDay" => '[Hier]',
15
- "lastWeek" => 'l [dernier]',
16
- "sameElse" => 'l',
17
- "withTime" => '[à] G [h] i',
18
- "default" => 'd/m/Y',
19
- ),
20
- "relativeTime" => array(
21
- "future" => 'dans %s',
22
- "past" => 'il y a %s',
23
- "s" => 'quelques secondes',
24
- "ss" => '%d secondes',
25
- "m" => 'une minute',
26
- "mm" => '%d minutes',
27
- "h" => 'une heure',
28
- "hh" => '%d heures',
29
- "d" => 'un jour',
30
- "dd" => '%d jours',
31
- "M" => 'un mois',
32
- "MM" => '%d mois',
33
- "y" => 'un an',
34
- "yy" => '%d ans',
35
- ),
36
- "ordinal" => function ($number)
37
- {
38
- return $number . ($number === 1 || $number === '1' ? '[er]' : '');
39
- },
40
- "week" => array(
41
- "dow" => 1, // Monday is the first day of the week.
42
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
43
- ),
44
- "customFormats" => array(
45
- "LT" => "G:i", // 20:30
46
- "L" => "d/m/Y", // 04/09/1986
47
- "l" => "j/n/Y", // 4/9/1986
48
- "LL" => "jS F Y", // 4 Septembre 1986
49
- "ll" => "j M Y", // 4 Sep 1986
50
- "LLL" => "jS F Y G:i", // 4 Septembre 1986 20:30
51
- "lll" => "j M Y G:i", // 4 Sep 1986 20:30
52
- "LLLL" => "l, jS F Y G:i", // Jeudi, 4 Septembre 1986 20:30
53
- "llll" => "D, j M Y G:i", // Jeu, 4 Sep 1986 20:30
54
- ),
55
- );
1
+ <?php
2
+
3
+ // locale: french (fr)
4
+ // author: John Fischer https://github.com/jfroffice
5
+
6
+ return array(
7
+ "months" => explode('_', 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'),
8
+ "monthsShort" => explode('_', 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'),
9
+ "weekdays" => explode('_', 'lundi_mardi_mercredi_jeudi_vendredi_samedi_dimanche'),
10
+ "weekdaysShort" => explode('_', 'lun._mar._mer._jeu._ven._sam._dim.'),
11
+ "calendar" => array(
12
+ "sameDay" => '[Aujourd\'hui]',
13
+ "nextDay" => '[Demain]',
14
+ "lastDay" => '[Hier]',
15
+ "lastWeek" => 'l [dernier]',
16
+ "sameElse" => 'l',
17
+ "withTime" => '[à] G [h] i',
18
+ "default" => 'd/m/Y',
19
+ ),
20
+ "relativeTime" => array(
21
+ "future" => 'dans %s',
22
+ "past" => 'il y a %s',
23
+ "s" => 'quelques secondes',
24
+ "ss" => '%d secondes',
25
+ "m" => 'une minute',
26
+ "mm" => '%d minutes',
27
+ "h" => 'une heure',
28
+ "hh" => '%d heures',
29
+ "d" => 'un jour',
30
+ "dd" => '%d jours',
31
+ "M" => 'un mois',
32
+ "MM" => '%d mois',
33
+ "y" => 'un an',
34
+ "yy" => '%d ans',
35
+ ),
36
+ "ordinal" => function ($number)
37
+ {
38
+ return $number . ($number === 1 || $number === '1' ? '[er]' : '');
39
+ },
40
+ "week" => array(
41
+ "dow" => 1, // Monday is the first day of the week.
42
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
43
+ ),
44
+ "customFormats" => array(
45
+ "LT" => "G:i", // 20:30
46
+ "L" => "d/m/Y", // 04/09/1986
47
+ "l" => "j/n/Y", // 4/9/1986
48
+ "LL" => "jS F Y", // 4 Septembre 1986
49
+ "ll" => "j M Y", // 4 Sep 1986
50
+ "LLL" => "jS F Y G:i", // 4 Septembre 1986 20:30
51
+ "lll" => "j M Y G:i", // 4 Sep 1986 20:30
52
+ "LLLL" => "l, jS F Y G:i", // Jeudi, 4 Septembre 1986 20:30
53
+ "llll" => "D, j M Y G:i", // Jeu, 4 Sep 1986 20:30
54
+ ),
55
+ );
src/Moment/Locales/hu_HU.php CHANGED
@@ -1,72 +1,72 @@
1
- <?php
2
-
3
- // locale: hungarian (hu)
4
- // author: David Joseph Guzsik https://github.com/seinopsys
5
-
6
- return array(
7
- "months" => explode('_', 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'),
8
-
9
- "monthsShort" => explode('_', 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'),
10
- "weekdays" => explode('_', 'hétfő_kedd_szerda_csütörtök_péntek_szombat_vasárnap'),
11
- "weekdaysShort" => explode('_', 'hét_kedd_sze_csüt_pén_szo_vas'),
12
- "calendar" => array(
13
- "sameDay" => '[ma] l[-kor]',
14
- "nextDay" => '[holnap] l[-kor]',
15
- "lastDay" => '[tegnap] l[-kor]',
16
- "lastWeek" => function($n, $dir, \Moment\Moment $Moment){
17
- $weekEndings = explode('_','vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton');
18
- return '[múlt] [' . $weekEndings[$Moment->getDay()] . '] l[-kor]';
19
- },
20
- "sameElse" => 'l',
21
- "withTime" => 'H:i[-kor]',
22
- "default" => 'Y.m.d.',
23
- ),
24
- "relativeTime" => array(
25
- "future" => '%s múlva',
26
- "past" => '%s',
27
- "s" => function($n, $dir){
28
- return ($dir === 'future') ? 'néhány másodperc' : 'néhány másodperce';
29
- },
30
- "ss" => function($n, $dir){
31
- return "$n " . ($dir === 'future' ? 'másodperc' : 'másodperce');
32
- },
33
- "m" => function($n, $dir){
34
- return 'egy ' . ($dir === 'future' ? 'perc' : 'perce');
35
- },
36
- "mm" => function($n, $dir){
37
- return "$n " . ($dir === 'future' ? 'perc' : 'perce');
38
- },
39
- "h" => function($n, $dir){
40
- return 'egy ' . ($dir === 'future' ? 'óra' : 'órája');
41
- },
42
- "hh" => function($n, $dir){
43
- return "$n " . ($dir === 'future' ? 'óra' : 'órája');
44
- },
45
- "d" => function($n, $dir){
46
- return 'egy ' . ($dir === 'future' ? 'nap' : 'napja');
47
- },
48
- "dd" => function($n, $dir){
49
- return "$n " . ($dir === 'future' ? 'nap' : 'napja');
50
- },
51
- "M" => function($n, $dir){
52
- return 'egy' . ($dir === 'future' ? 'hónap' : 'hónapja');
53
- },
54
- "MM" => function($n, $dir){
55
- return "$n " . ($dir === 'future' ? 'hónap' : 'hónapja');
56
- },
57
- "y" => function($n, $dir){
58
- return 'egy' . ($dir === 'future' ? 'év' : 'éve');
59
- },
60
- "yy" => function($n, $dir){
61
- return "$n " . ($dir === 'future' ? 'év' : 'éve');
62
- },
63
- ),
64
- "ordinal" => function ($number)
65
- {
66
- return "$number.";
67
- },
68
- "week" => array(
69
- "dow" => 1, // Monday is the first day of the week.
70
- "doy" => 7 // The week that contains Jan 1st is the first week of the year.
71
- ),
72
- );
1
+ <?php
2
+
3
+ // locale: hungarian (hu)
4
+ // author: David Joseph Guzsik https://github.com/seinopsys
5
+
6
+ return array(
7
+ "months" => explode('_', 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'),
8
+
9
+ "monthsShort" => explode('_', 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'),
10
+ "weekdays" => explode('_', 'hétfő_kedd_szerda_csütörtök_péntek_szombat_vasárnap'),
11
+ "weekdaysShort" => explode('_', 'hét_kedd_sze_csüt_pén_szo_vas'),
12
+ "calendar" => array(
13
+ "sameDay" => '[ma] l[-kor]',
14
+ "nextDay" => '[holnap] l[-kor]',
15
+ "lastDay" => '[tegnap] l[-kor]',
16
+ "lastWeek" => function($n, $dir, \Moment\Moment $Moment){
17
+ $weekEndings = explode('_','vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton');
18
+ return '[múlt] [' . $weekEndings[$Moment->getDay()] . '] l[-kor]';
19
+ },
20
+ "sameElse" => 'l',
21
+ "withTime" => 'H:i[-kor]',
22
+ "default" => 'Y.m.d.',
23
+ ),
24
+ "relativeTime" => array(
25
+ "future" => '%s múlva',
26
+ "past" => '%s',
27
+ "s" => function($n, $dir){
28
+ return ($dir === 'future') ? 'néhány másodperc' : 'néhány másodperce';
29
+ },
30
+ "ss" => function($n, $dir){
31
+ return "$n " . ($dir === 'future' ? 'másodperc' : 'másodperce');
32
+ },
33
+ "m" => function($n, $dir){
34
+ return 'egy ' . ($dir === 'future' ? 'perc' : 'perce');
35
+ },
36
+ "mm" => function($n, $dir){
37
+ return "$n " . ($dir === 'future' ? 'perc' : 'perce');
38
+ },
39
+ "h" => function($n, $dir){
40
+ return 'egy ' . ($dir === 'future' ? 'óra' : 'órája');
41
+ },
42
+ "hh" => function($n, $dir){
43
+ return "$n " . ($dir === 'future' ? 'óra' : 'órája');
44
+ },
45
+ "d" => function($n, $dir){
46
+ return 'egy ' . ($dir === 'future' ? 'nap' : 'napja');
47
+ },
48
+ "dd" => function($n, $dir){
49
+ return "$n " . ($dir === 'future' ? 'nap' : 'napja');
50
+ },
51
+ "M" => function($n, $dir){
52
+ return 'egy' . ($dir === 'future' ? 'hónap' : 'hónapja');
53
+ },
54
+ "MM" => function($n, $dir){
55
+ return "$n " . ($dir === 'future' ? 'hónap' : 'hónapja');
56
+ },
57
+ "y" => function($n, $dir){
58
+ return 'egy' . ($dir === 'future' ? 'év' : 'éve');
59
+ },
60
+ "yy" => function($n, $dir){
61
+ return "$n " . ($dir === 'future' ? 'év' : 'éve');
62
+ },
63
+ ),
64
+ "ordinal" => function ($number)
65
+ {
66
+ return "$number.";
67
+ },
68
+ "week" => array(
69
+ "dow" => 1, // Monday is the first day of the week.
70
+ "doy" => 7 // The week that contains Jan 1st is the first week of the year.
71
+ ),
72
+ );
src/Moment/Locales/id_ID.php CHANGED
@@ -1,45 +1,45 @@
1
- <?php
2
-
3
- // locale: Indonesian (Indonesia) (id-id)
4
- // author: Yuda Sukmana https://github.com/ydatech
5
-
6
- return array(
7
- "months" => explode('_', 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'),
8
- "monthsShort" => explode('_', 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agu_Sep_Okt_Nov_Des'),
9
- "weekdays" => explode('_', 'Senin_Selasa_Rabu_Kamis_Jum\'at_Sabtu_Minggu'),
10
- "weekdaysShort" => explode('_', 'Sen_Sel_Rab_Kam_Jum_Sab_Ming'),
11
- "calendar" => array(
12
- "sameDay" => '[Hari ini]',
13
- "nextDay" => '[Besok]',
14
- "lastDay" => '[Kemarin]',
15
- "lastWeek" => 'l [Kemarin]',
16
- "sameElse" => 'l',
17
- "withTime" => '[pukul] H:i',
18
- "default" => 'd/m/Y',
19
- ),
20
- "relativeTime" => array(
21
- "future" => 'dalam %s',
22
- "past" => '%s yang lalu',
23
- "s" => 'beberapa detik',
24
- "ss" => '%d detik',
25
- "m" => 'semenit',
26
- "mm" => '%d menit',
27
- "h" => 'satu jam',
28
- "hh" => '%d jam',
29
- "d" => 'satu hari',
30
- "dd" => '%d hari',
31
- "M" => 'satu bulan',
32
- "MM" => '%d bulan',
33
- "y" => 'satu tahun',
34
- "yy" => '%d tahun',
35
- ),
36
- "ordinal" => function ($number)
37
- {
38
-
39
- return $number;
40
- },
41
- "week" => array(
42
- "dow" => 1, // Monday is the first day of the week.
43
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
44
- ),
45
  );
1
+ <?php
2
+
3
+ // locale: Indonesian (Indonesia) (id-id)
4
+ // author: Yuda Sukmana https://github.com/ydatech
5
+
6
+ return array(
7
+ "months" => explode('_', 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'),
8
+ "monthsShort" => explode('_', 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agu_Sep_Okt_Nov_Des'),
9
+ "weekdays" => explode('_', 'Senin_Selasa_Rabu_Kamis_Jum\'at_Sabtu_Minggu'),
10
+ "weekdaysShort" => explode('_', 'Sen_Sel_Rab_Kam_Jum_Sab_Ming'),
11
+ "calendar" => array(
12
+ "sameDay" => '[Hari ini]',
13
+ "nextDay" => '[Besok]',
14
+ "lastDay" => '[Kemarin]',
15
+ "lastWeek" => 'l [Kemarin]',
16
+ "sameElse" => 'l',
17
+ "withTime" => '[pukul] H:i',
18
+ "default" => 'd/m/Y',
19
+ ),
20
+ "relativeTime" => array(
21
+ "future" => 'dalam %s',
22
+ "past" => '%s yang lalu',
23
+ "s" => 'beberapa detik',
24
+ "ss" => '%d detik',
25
+ "m" => 'semenit',
26
+ "mm" => '%d menit',
27
+ "h" => 'satu jam',
28
+ "hh" => '%d jam',
29
+ "d" => 'satu hari',
30
+ "dd" => '%d hari',
31
+ "M" => 'satu bulan',
32
+ "MM" => '%d bulan',
33
+ "y" => 'satu tahun',
34
+ "yy" => '%d tahun',
35
+ ),
36
+ "ordinal" => function ($number)
37
+ {
38
+
39
+ return $number;
40
+ },
41
+ "week" => array(
42
+ "dow" => 1, // Monday is the first day of the week.
43
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
44
+ ),
45
  );
src/Moment/Locales/it_IT.php CHANGED
@@ -1,74 +1,74 @@
1
- <?php
2
-
3
- // locale: italia italiano (it_IT)
4
- // author: Marco Manfredini https://github.com/Manfre98
5
-
6
- use Moment\Moment;
7
-
8
- return array(
9
- "months" => explode('_', 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'),
10
- "monthsShort" => explode('_', 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'),
11
- "weekdays" => explode('_', 'lunedì_martedì_mercoledì_giovedì_venerdì_sabato_domenica'),
12
- "weekdaysShort" => explode('_', 'lun_mar_mer_gio_ven_sab_dom'),
13
- "calendar" => array(
14
- "sameDay" => '[Oggi]',
15
- "nextDay" => '[Domani]',
16
- "lastDay" => '[Ieri]',
17
- "lastWeek" => function (Moment $moment) {
18
- switch ($moment->getWeekday()) {
19
- case 7:
20
- return 'l [scorsa]';
21
- default:
22
- return 'l [scorso]';
23
- }
24
- },
25
- "sameElse" => 'l',
26
- "withTime" => function (Moment $moment) {
27
- switch ($moment->getHour()) {
28
- case 0:
29
- return '[a] G:i';
30
- case 1:
31
- return '[all\']G:i';
32
- default:
33
- return '[alle] G:i';
34
- }
35
- },
36
- "default" => 'd/m/Y',
37
- ),
38
- "relativeTime" => array(
39
- "future" => 'tra %s',
40
- "past" => '%s fa',
41
- "s" => 'alcuni secondi',
42
- "ss" => '%d secondi',
43
- "m" => 'un minuto',
44
- "mm" => '%d minuti',
45
- "h" => 'un\'ora',
46
- "hh" => '%d ore',
47
- "d" => 'un giorno',
48
- "dd" => '%d giorni',
49
- "M" => 'un mese',
50
- "MM" => '%d mesi',
51
- "y" => 'un anno',
52
- "yy" => '%d anni',
53
- ),
54
- "ordinal" => function ($number)
55
- {
56
- return $number . 'º';
57
- },
58
- "week" => array(
59
- "dow" => 1, // Monday is the first day of the week.
60
- "doy" => 4 // The week that contains Jan 4th is the first week of the year.
61
- ),
62
- "customFormats" => array(
63
- "LT" => "G:i", // 22:00
64
- "LTS" => "G:i:s", // 22:00:00
65
- "L" => "d/m/Y", // 12/06/2010
66
- "l" => "j/n/Y", // 12/6/2010
67
- "LL" => "j F Y", // 12 giugno 2010
68
- "ll" => "j M Y", // 12 giu 2010
69
- "LLL" => "j F Y, G:i", // 12 giugno 2010, 22:00
70
- "lll" => "j M Y, G:i", // 12 giu 2010, 22:00
71
- "LLLL" => "l j F Y, G:i", // sabato 12 giugno 2010, 22:00
72
- "llll" => "D j M Y, G:i", // sab 12 giu 2010, 22:00
73
- ),
74
- );
1
+ <?php
2
+
3
+ // locale: italia italiano (it_IT)
4
+ // author: Marco Manfredini https://github.com/Manfre98
5
+
6
+ use Moment\Moment;
7
+
8
+ return array(
9
+ "months" => explode('_', 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'),
10
+ "monthsShort" => explode('_', 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'),
11
+ "weekdays" => explode('_', 'lunedì_martedì_mercoledì_giovedì_venerdì_sabato_domenica'),
12
+ "weekdaysShort" => explode('_', 'lun_mar_mer_gio_ven_sab_dom'),
13
+ "calendar" => array(
14
+ "sameDay" => '[Oggi]',
15
+ "nextDay" => '[Domani]',
16
+ "lastDay" => '[Ieri]',
17
+ "lastWeek" => function (Moment $moment) {
18
+ switch ($moment->getWeekday()) {
19
+ case 7:
20
+ return 'l [scorsa]';
21
+ default:
22
+ return 'l [scorso]';
23
+ }
24
+ },
25
+ "sameElse" => 'l',
26
+ "withTime" => function (Moment $moment) {
27
+ switch ($moment->getHour()) {
28
+ case 0:
29
+ return '[a] G:i';
30
+ case 1:
31
+ return '[all\']G:i';
32
+ default:
33
+ return '[alle] G:i';
34
+ }
35
+ },
36
+ "default" => 'd/m/Y',
37
+ ),
38
+ "relativeTime" => array(
39
+ "future" => 'tra %s',
40
+ "past" => '%s fa',
41
+ "s" => 'alcuni secondi',
42
+ "ss" => '%d secondi',
43
+ "m" => 'un minuto',
44
+ "mm" => '%d minuti',
45
+ "h" => 'un\'ora',
46
+ "hh" => '%d ore',
47
+ "d" => 'un giorno',
48
+ "dd" => '%d giorni',
49
+ "M" => 'un mese',
50
+ "MM" => '%d mesi',
51
+ "y" => 'un anno',
52
+ "yy" => '%d anni',
53
+ ),
54
+ "ordinal" => function ($number)
55
+ {
56
+ return $number . 'º';
57
+ },
58
+ "week" => array(
59
+ "dow" => 1, // Monday is the first day of the week.
60
+ "doy" => 4 // The week that contains Jan 4th is the first week of the year.
61
+ ),
62
+ "customFormats" => array(
63
+ "LT" => "G:i", // 22:00
64
+ "LTS" => "G:i:s", // 22:00:00
65
+ "L" => "d/m/Y", // 12/06/2010
66
+ "l" => "j/n/Y", // 12/6/2010
67
+ "LL" => "j F Y", // 12 giugno 2010
68
+ "ll" => "j M Y", // 12 giu 2010
69
+ "LLL" => "j F Y, G:i", // 12 giugno 2010, 22:00
70
+ "lll" => "j M Y, G:i", // 12 giu 2010, 22:00
71
+ "LLLL" => "l j F Y, G:i", //