WordPress Popular Posts - Version 5.4.0

Version Description

If you're using a caching plugin flushing its cache after upgrading to this version is highly recommended.

  • The widget block is no longer an experimental feature and is now available to everyone (but it's still a WIP).
  • Widget block: adds AJAX support to prevent caching plugins from caching your popular posts block.
  • Widget block: adds WPML/Polylang support.
  • Widget block: fixes widget heading not displaying.
  • Widget themes: allow themes to detect the current post so it can be styled differently.
  • Fixes wpp_excerpt_more filter hook not working (props to SchweizerSchoggi!)
  • Adds filter hook wpp_title_more to allow customization of the prefix added to shortened post titles.
  • Removes inline JavaScript code from WPP's dashboard in preparation for WordPress' CSP adoption.

Release notes

Full Changelog

=

Download this release

Release Info

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

Code changes from version 5.3.6 to 5.4.0

assets/js/admin-notices.js ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function(){
2
+ // Performance Nag event handlers
3
+ let btn_nag_dismiss = document.querySelector('.wpp-dismiss-performance-notice'),
4
+ btn_nag_remind = document.querySelector('.wpp-remind-performance-notice');
5
+
6
+ btn_nag_dismiss.addEventListener('click', function(e){
7
+ e.preventDefault();
8
+
9
+ let me = e.target;
10
+
11
+ me.classList.add('disabled');
12
+ btn_nag_remind.classList.add('disabled');
13
+
14
+ me.parentNode.querySelector('.spinner').classList.add('is-active');
15
+
16
+ ajax(
17
+ 'POST',
18
+ ajaxurl,
19
+ 'action=wpp_handle_performance_notice&dismiss=1&token=' + wpp_admin_notices_params.nonce_performance_nag,
20
+ function(response) {
21
+ let json = JSON.parse(response);
22
+
23
+ if ( 'success' == json.status ) {
24
+ let notice = me.parentNode.parentNode;
25
+ notice.parentNode.removeChild(notice);
26
+ } else {
27
+ alert('Something went wrong, please try again later');
28
+ }
29
+
30
+ me.classList.remove('disabled');
31
+ btn_nag_remind.classList.remove('disabled');
32
+ me.parentNode.querySelector('.spinner').classList.remove('is-active');
33
+ }
34
+ );
35
+ });
36
+
37
+ btn_nag_remind.addEventListener('click', function(e){
38
+ e.preventDefault();
39
+
40
+ let me = e.target;
41
+
42
+ me.classList.add('disabled');
43
+ btn_nag_dismiss.classList.add('disabled');
44
+
45
+ me.parentNode.querySelector('.spinner').classList.add('is-active');
46
+
47
+ ajax(
48
+ 'POST',
49
+ ajaxurl,
50
+ 'action=wpp_handle_performance_notice&dismiss=-1&token=' + wpp_admin_notices_params.nonce_performance_nag,
51
+ function(response) {
52
+ let json = JSON.parse(response);
53
+
54
+ if ( 'success' == json.status ) {
55
+ let notice = me.parentNode.parentNode;
56
+ notice.parentNode.removeChild(notice);
57
+ } else {
58
+ alert('Something went wrong, please try again later');
59
+ }
60
+
61
+ me.classList.remove('disabled');
62
+ btn_nag_remind.classList.remove('disabled');
63
+ me.parentNode.querySelector('.spinner').classList.remove('is-active');
64
+ }
65
+ );
66
+ });
67
+
68
+ /** Helper functions */
69
+
70
+ function ajax(method, url, params, callback) {
71
+ let xhr = new XMLHttpRequest(),
72
+ target = url,
73
+ args = params,
74
+ valid_methods = ["GET", "POST"];
75
+ method = -1 != valid_methods.indexOf( method ) ? method : "GET";
76
+ /* Set request method and target URL */
77
+ xhr.open( method, target + ( "GET" == method ? '?' + args : '' ), true );
78
+ /* Set request headers */
79
+ if ( "POST" == method ) {
80
+ xhr.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
81
+ }
82
+ xhr.setRequestHeader( "X-Requested-With","XMLHttpRequest" );
83
+ /* Hook into onreadystatechange */
84
+ xhr.onreadystatechange = function() {
85
+ if ( 4 === xhr.readyState && 200 <= xhr.status && 300 > xhr.status ) {
86
+ if ( 'function' === typeof callback ) {
87
+ callback.call( undefined, xhr.response );
88
+ }
89
+ }
90
+ };
91
+ /* Send request */
92
+ xhr.send( ( "POST" == method ? args : null ) );
93
+ }
94
+ });
assets/js/admin.js CHANGED
@@ -2,6 +2,11 @@
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();
@@ -295,6 +300,10 @@
295
  .open();
296
 
297
  });
 
 
 
 
298
  // log limit
299
  $("#log_limit").change(function(){
300
  var me = $(this);
@@ -353,5 +362,132 @@
353
  $("#cache_too_long").hide();
354
  }
355
  });
 
 
 
 
 
 
 
 
 
 
356
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  }(jQuery));
2
  "use strict";
3
  $(function () {
4
 
5
+ if ( $('#wpp-chart').length && WPPChart.canRender() ) {
6
+ $("#wpp-chart p").remove();
7
+ WPPChart.init('wpp-chart');
8
+ }
9
+
10
  // Stats config
11
  $("#wpp-stats-config-btn, #wpp_stats_options .button-secondary").on("click", function(e){
12
  e.preventDefault();
300
  .open();
301
 
302
  });
303
+ $('#wpp-reset-image-cache').on('click', function(e){
304
+ e.preventDefault();
305
+ confirm_clear_image_cache();
306
+ });
307
  // log limit
308
  $("#log_limit").change(function(){
309
  var me = $(this);
362
  $("#cache_too_long").hide();
363
  }
364
  });
365
+
366
+ $("#wpp-reset-cache").on("click", function(e){
367
+ e.preventDefault();
368
+ confirm_reset_cache();
369
+ });
370
+
371
+ $("#wpp-reset-all").on("click", function(e){
372
+ e.preventDefault();
373
+ confirm_reset_all();
374
+ });
375
  });
376
+
377
+ // TOOLS
378
+ function confirm_reset_cache() {
379
+ if ( confirm(wpp_admin_params.text_confirm_reset_cache_table + " \n\n" + wpp_admin_params.text_continue) ) {
380
+ jQuery.post(
381
+ ajaxurl,
382
+ {
383
+ action: 'wpp_clear_data',
384
+ token: wpp_admin_params.nonce_reset_data,
385
+ clear: 'cache'
386
+ }, function(data){
387
+ var response = "";
388
+
389
+ switch( data ) {
390
+ case "1":
391
+ response = wpp_admin_params.text_cache_table_cleared;
392
+ break;
393
+
394
+ case "2":
395
+ response = wpp_admin_params.text_cache_table_missing;
396
+ break;
397
+
398
+ case "3":
399
+ response = wpp_admin_params.text_invalid_action;
400
+ break;
401
+
402
+ case "4":
403
+ response = wpp_admin_params.text_insufficient_permissions;
404
+ break;
405
+
406
+ default:
407
+ response = wpp_admin_params.text_invalid_action;
408
+ break;
409
+ }
410
+
411
+ alert(response);
412
+ }
413
+ );
414
+ }
415
+ }
416
+
417
+ function confirm_reset_all() {
418
+ if ( confirm(wpp_admin_params.text_confirm_reset_all_tables + " \n\n" + wpp_admin_params.text_continue) ) {
419
+ jQuery.post(
420
+ ajaxurl,
421
+ {
422
+ action: 'wpp_clear_data',
423
+ token: wpp_admin_params.nonce_reset_data,
424
+ clear: 'all'
425
+ }, function(data){
426
+ var response = "";
427
+
428
+ switch( data ) {
429
+ case "1":
430
+ response = wpp_admin_params.text_all_table_cleared;
431
+ break;
432
+
433
+ case "2":
434
+ response = wpp_admin_params.text_tables_missing;
435
+ break;
436
+
437
+ case "3":
438
+ response = wpp_admin_params.text_invalid_action;
439
+ break;
440
+
441
+ case "4":
442
+ response = wpp_admin_params.text_insufficient_permissions;
443
+ break;
444
+
445
+ default:
446
+ response = wpp_admin_params.text_invalid_action;
447
+ break;
448
+ }
449
+
450
+ alert(response);
451
+ }
452
+ );
453
+ }
454
+ }
455
+
456
+ function confirm_clear_image_cache() {
457
+ if ( confirm(wpp_admin_params.text_confirm_image_cache_reset + " \n\n" + wpp_admin_params.text_continue) ) {
458
+ jQuery.post(
459
+ ajaxurl,
460
+ {
461
+ action: 'wpp_clear_thumbnail',
462
+ token: wpp_admin_params.nonce_reset_thumbnails
463
+ }, function(data){
464
+ var response = "";
465
+
466
+ switch( data ) {
467
+ case "1":
468
+ response = wpp_admin_params.text_image_cache_cleared;
469
+ break;
470
+
471
+ case "2":
472
+ response = wpp_admin_params.text_image_cache_already_empty;
473
+ break;
474
+
475
+ case "3":
476
+ response = wpp_admin_params.text_invalid_action;
477
+ break;
478
+
479
+ case "4":
480
+ response = wpp_admin_params.text_insufficient_permissions;
481
+ break;
482
+
483
+ default:
484
+ response = wpp_admin_params.text_invalid_action;
485
+ break;
486
+ }
487
+
488
+ alert(response);
489
+ }
490
+ );
491
+ }
492
+ }
493
  }(jQuery));
assets/js/blocks/block-wpp-widget.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-polyfill'), 'version' => '2bd5c79f0c5cb18c1e9dfad0c639fcb0');
1
+ <?php return array('dependencies' => array('wp-polyfill'), 'version' => '2951ca110f8bc048797ca7e3ec49e87b');
assets/js/blocks/block-wpp-widget.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function a(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=t,a.d=function(e,t,s){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(s,r,function(t){return e[t]}.bind(null,r));return s},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){"use strict";a.r(t);var s={};s.flame=React.createElement("svg",{viewBox:"0 0 248 379"},React.createElement("path",{fill:"#fff",d:"M-83,96q0-122.5,0-245H165q0,131,0,262a31.87,31.87,0,0,1-.95-4.33A123.87,123.87,0,0,0,153.47,68.3c-12.28-27.74-31.1-50.64-53-71.21C75.67-26.13,55.85-52,54.32-87.87c-.79-18.47.81-36.24,11.59-52.15,1.08-1.59.38-4.4.5-6.64-2.43.1-5.5-.7-7.18.47a140.91,140.91,0,0,0-17.12,13.72C19.49-110.67,3-84.6-9.51-56A149,149,0,0,0-21.86-3.77c-2,39.4,11.38,73.46,36.17,103.51,1.74,2.11,3.51,4.2,5.27,6.3l-.67,1.07c-3.94-1.07-8-1.83-11.82-3.24C-25.17,91.94-52.36,58.57-51.12,21c.1-2.91.21-6.45-3.51-6.49-2,0-4.76,2.16-5.79,4.09-9.4,17.55-16.35,36-19.73,55.73C-81.38,81.49-82.07,88.76-83,96Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#ba2f2f",d:"M-83,96c.93-7.24,1.62-14.51,2.85-21.7,3.38-19.69,10.33-38.18,19.73-55.73,1-1.93,3.83-4.11,5.79-4.09,3.72,0,3.61,3.58,3.51,6.49-1.25,37.59,25.94,71,58.2,82.89,3.82,1.41,7.87,2.18,11.82,3.24l.67-1.07c-1.76-2.1-3.52-4.19-5.27-6.3C-10.49,69.68-23.88,35.63-21.86-3.77A149,149,0,0,1-9.51-56c12.48-28.62,29-54.69,51.62-76.5a140.91,140.91,0,0,1,17.12-13.72c1.68-1.18,4.75-.37,7.18-.47-.13,2.24.58,5-.5,6.64-10.78,15.9-12.37,33.68-11.59,52.15,1.53,35.89,21.35,61.74,46.11,85,21.94,20.57,40.76,43.47,53,71.21a123.87,123.87,0,0,1,10.59,40.36A31.87,31.87,0,0,0,165,113v9c-.7,4.24-1.17,8.54-2.13,12.73-10.74,46.51-37.08,78.75-84.34,91.58C72.16,228,65.52,228.79,59,230H43a25.19,25.19,0,0,0-3.12-1.18c-10-2.37-20.21-4.12-30-7.12-45.83-14-75.19-44.64-89-90.24-2.28-7.52-2.64-15.63-3.88-23.46Q-83,102-83,96ZM61.63-143.61c-6.24,5.39-12.87,10.38-18.64,16.22A229,229,0,0,0-8.77-46.26,138.37,138.37,0,0,0-16.63,23c4.69,32.54,20.21,59.59,42.4,83.23,1.34,1.43,2.7,2.83,4.8,5-15.23,1-28-3.3-39.74-10.64-29.74-18.62-46-45.23-46.8-81a138.75,138.75,0,0,0-7.46,14.67A178.29,178.29,0,0,0-78.24,93.09C-80.9,129.7-68,160.25-42.78,185.71c28.91,29.16,65.19,41.42,105.43,38.91,43.82-2.73,80.34-35.08,93.53-79.39,8.68-29.18,3.11-56.71-10.29-83.15C134.15,38.92,117.71,19.34,99,1.57,85-11.65,71.34-25.28,62.72-42.69,46.33-75.79,44.36-109.22,61.63-143.61Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#fff",d:"M-83,108c1.25,7.84,1.61,15.94,3.88,23.46,13.79,45.6,43.15,76.21,89,90.24,9.82,3,20,4.76,30,7.12A25.19,25.19,0,0,1,43,230H-83Q-83,169-83,108Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#fff",d:"M59,230c6.52-1.21,13.16-2,19.53-3.69,47.26-12.83,73.6-45.07,84.34-91.58,1-4.18,1.43-8.48,2.13-12.73V230Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#ba2f2f",d:"M61.63-143.61c-17.28,34.39-15.3,67.82,1.09,100.92C71.34-25.28,85-11.65,99,1.57c18.75,17.77,35.2,37.35,46.94,60.51,13.4,26.44,19,54,10.29,83.15-13.18,44.31-49.71,76.66-93.53,79.39-40.25,2.51-76.52-9.75-105.43-38.91C-68,160.25-80.9,129.7-78.24,93.09A178.29,178.29,0,0,1-63.45,34.31,138.75,138.75,0,0,1-56,19.64c.77,35.79,17.06,62.4,46.8,81C2.54,108,15.33,112.3,30.56,111.3c-2.1-2.21-3.46-3.62-4.8-5C3.57,82.62-11.94,55.57-16.63,23A138.37,138.37,0,0,1-8.77-46.26,229,229,0,0,1,43-127.38C48.76-133.23,55.39-138.22,61.63-143.61Z",transform:"translate(83 149)"}));var r=s;function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){for(var a=0;a<t.length;a++){var s=t[a];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=wp.serverSideRender,c=wp.element,m=c.Component,d=c.Fragment,h=wp.blockEditor.BlockControls,f=wp.components,b=f.Button,_=f.CheckboxControl,g=f.Disabled,y=f.SelectControl,v=f.Spinner,w=f.TextareaControl,x=f.TextControl,R=f.Toolbar,__=wp.i18n.__,E="wordpress-popular-posts/v1",C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(c,e);var t,a,s,r,o=(s=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=p(s);if(r){var a=p(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return i(this,e)});function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=o.call(this,e)).state={error:null,editMode:!0,themes:null,imgSizes:null,taxonomies:null},t}return t=c,(a=[{key:"componentDidMount",value:function(){var e=this.props.attributes;this.getThemes(),this.getImageSizes(),this.getTaxonomies(),this.setState({editMode:e._editMode})}},{key:"getThemes",value:function(){var e=this;wp.apiFetch({path:E+"/themes"}).then((function(t){e.setState({themes:t})}),(function(t){e.setState({error:t,themes:null})}))}},{key:"getImageSizes",value:function(){var e=this;wp.apiFetch({path:E+"/thumbnails"}).then((function(t){e.setState({imgSizes:t})}),(function(t){e.setState({error:t,imgSizes:null})}))}},{key:"getTaxonomies",value:function(){var e=this,t=this.props.attributes;wp.apiFetch({path:E+"/taxonomies"}).then((function(a){if(a){var s=t.tax.split(";"),r=t.term_id.split(";");if(s.length&&s.length==r.length){for(var o={},n=0;n<s.length;n++)o[s[n]]=r[n];for(var l in a)a[l]._terms=void 0!==o[l]?o[l]:""}}e.setState({taxonomies:a})}),(function(t){e.setState({error:t,taxonomies:null})}))}},{key:"getBlockControls",value:function(){var e=this.props.setAttributes,t=this;return React.createElement(h,null,React.createElement(R,null,React.createElement(b,{label:this.state.editMode?__("Preview","wordpress-popular-posts"):__("Edit","wordpress-popular-posts"),icon:this.state.editMode?"format-image":"edit",onClick:function(){var a=!t.state.editMode;t.setState({editMode:a}),e({_editMode:a})}})))}},{key:"getMainFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes;return React.createElement(d,null,React.createElement(x,{label:__("Title","wordpress-popular-posts"),value:t.title,onChange:function(e){e=function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&grave;"};return e.replace(/[&<>"'/]/gi,(function(e){return t[e]}))}(function(e){var t=document.createElement("div");t.innerHTML=e;var a=t.childNodes[0];return a?a.nodeValue:""}(e)),a({title:e})}}),React.createElement(x,{label:__("Limit","wordpress-popular-posts"),value:t.limit,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>0?e:10;a({limit:Number(t)})}}),React.createElement(y,{label:__("Sort posts by","wordpress-popular-posts"),value:t.order_by,options:[{label:__("Total views","wordpress-popular-posts"),value:"views"},{label:__("Comments","wordpress-popular-posts"),value:"comments"}],onChange:function(e){a({order_by:e})}}),React.createElement(y,{label:__("Time Range","wordpress-popular-posts"),value:t.range,options:[{label:__("Last 24 Hours","wordpress-popular-posts"),value:"last24hours"},{label:__("Last 7 days","wordpress-popular-posts"),value:"last7days"},{label:__("Last 30 days","wordpress-popular-posts"),value:"last30days"},{label:__("All-time","wordpress-popular-posts"),value:"all"},{label:__("Custom","wordpress-popular-posts"),value:"custom"}],onChange:function(e){a({range:e})}}),"custom"==t.range&&React.createElement("div",{className:"option-subset"},React.createElement(x,{label:__("Time Quantity","wordpress-popular-posts"),value:t.time_quantity,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>0?e:24;a({time_quantity:Number(t)})}}),React.createElement(y,{label:__("Time Unit","wordpress-popular-posts"),value:t.time_unit,options:[{label:__("Minute(s)","wordpress-popular-posts"),value:"minute"},{label:__("Hour(s)","wordpress-popular-posts"),value:"hour"},{label:__("Day(s)","wordpress-popular-posts"),value:"day"}],onChange:function(e){a({time_unit:e})}})),React.createElement(_,{label:__("Display only posts published within the selected Time Range","wordpress-popular-posts"),checked:t.freshness,onChange:function(e){a({freshness:e})}}))}},{key:"getFiltersFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=this,r=[];if(this.state.taxonomies)for(var o in this.state.taxonomies)r.push({name:this.state.taxonomies[o].name,label:this.state.taxonomies[o].labels.singular_name+" ("+this.state.taxonomies[o].name+")",terms:this.state.taxonomies[o]._terms});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Filters","wordpress-popular-posts"))),React.createElement(x,{label:__("Post type(s)","wordpress-popular-posts"),help:__("Post types must be comma separated.","wordpress-popular-posts"),value:t.post_type,onChange:function(e){var t=e.replace(/[^a-z0-9-_\,]+/gi,"");a({post_type:t})}}),React.createElement(x,{label:__("Post ID(s) to exclude","wordpress-popular-posts"),help:__("IDs must be comma separated.","wordpress-popular-posts"),value:t.pid,onChange:function(e){var t=e.replace(/[^0-9\,]/g,"");a({pid:t})}}),React.createElement(x,{label:__("Author ID(s)","wordpress-popular-posts"),help:__("IDs must be comma separated.","wordpress-popular-posts"),value:t.author,onChange:function(e){var t=e.replace(/[^0-9\,]/g,"");a({author:t})}}),r&&r.filter((function(e){return"post_format"!=e.name})).map((function(e){return React.createElement(x,{label:e.label,help:__("Term IDs must be comma separated, prefix a minus sign to exclude.","wordpress-popular-posts"),value:e.terms,onChange:function(t){return function(e,t){var a=s.state.taxonomies;t=t.replace(/[^0-9-\,]/g,""),a&&void 0!==a[e]&&(a[e]._terms=t,s.setState({taxonomies:a}))}(e.name,t)},onBlur:function(){return function(e){var t=s.state.taxonomies;if(t&&void 0!==t[e]){var r=t[e]._terms.split(",");r.length&&(r=r.map((function(e){return e.trim()})).filter((function(e){return""!=e&&"-"!=e}))),r.length&&(r=Array.from(new Set(r))),t[e]._terms=r.join(","),s.setState({taxonomies:t});var o="",n="";for(var l in s.state.taxonomies)if(s.state.taxonomies.hasOwnProperty(l)){if(!s.state.taxonomies[l]._terms.length)continue;o+=l+";",n+=s.state.taxonomies[l]._terms+";"}o&&n&&(o=o.replace(new RegExp(";$"),""),n=n.replace(new RegExp(";$"),"")),a({tax:o,term_id:n})}}(e.name)}})})))}},{key:"getPostSettingsFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=this;function r(e,t){var s=Number.isInteger(Number(t))&&Number(t)>=0?t:0;a("width"==e?{thumbnail_width:Number(s)}:{thumbnail_height:Number(s)})}var o=[];if(this.state.imgSizes)for(var n in this.state.imgSizes)o.push({label:n,value:n});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Posts settings","wordpress-popular-posts"))),React.createElement(_,{label:__("Shorten title","wordpress-popular-posts"),checked:t.shorten_title,onChange:function(e){a(0==e?{title_length:0,title_by_words:0,shorten_title:e}:{shorten_title:e,title_length:25})}}),t.shorten_title&&React.createElement("div",{className:"option-subset"},React.createElement(x,{label:__("Shorten title to","wordpress-popular-posts"),value:t.title_length,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>=0?e:0;a({title_length:Number(t)})}}),React.createElement(y,{value:t.title_by_words,options:[{label:__("characters","wordpress-popular-posts"),value:0},{label:__("words","wordpress-popular-posts"),value:1}],onChange:function(e){return a({title_by_words:Number(e)})}})),React.createElement(_,{label:__("Display post excerpt","wordpress-popular-posts"),checked:t.display_post_excerpt,onChange:function(e){a(0==e?{excerpt_length:0,excerpt_by_words:0,display_post_excerpt:e}:{display_post_excerpt:e,excerpt_length:55})}}),t.display_post_excerpt&&React.createElement("div",{className:"option-subset"},React.createElement(_,{label:__("Keep text format and links","wordpress-popular-posts"),checked:t.excerpt_format,onChange:function(e){return a({excerpt_format:e})}}),React.createElement(x,{label:__("Excerpt length","wordpress-popular-posts"),value:t.excerpt_length,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>=0?e:0;a({excerpt_length:Number(t)})}}),React.createElement(y,{value:t.excerpt_by_words,options:[{label:__("characters","wordpress-popular-posts"),value:0},{label:__("words","wordpress-popular-posts"),value:1}],onChange:function(e){return a({excerpt_by_words:Number(e)})}})),React.createElement(_,{label:__("Display post thumbnail","wordpress-popular-posts"),checked:t.display_post_thumbnail,onChange:function(e){a(0==e?{thumbnail_width:0,thumbnail_height:0,display_post_thumbnail:e}:{thumbnail_width:75,thumbnail_height:75,display_post_thumbnail:e})}}),t.display_post_thumbnail&&React.createElement("div",{className:"option-subset"},React.createElement(y,{value:t.thumbnail_build,options:[{label:__("Set size manually","wordpress-popular-posts"),value:"manual"},{label:__("Use predefined size","wordpress-popular-posts"),value:"predefined"}],onChange:function(e){"predefined"==e&&a({thumbnail_width:s.state.imgSizes[o[0].value].width,thumbnail_height:s.state.imgSizes[o[0].value].height,thumbnail_size:o[0].value}),a({thumbnail_build:e})}}),"manual"==t.thumbnail_build&&React.createElement(d,null,React.createElement(x,{label:__("Thumbnail width","wordpress-popular-posts"),help:__("Size in px units (pixels)","wordpress-popular-posts"),value:t.thumbnail_width,onChange:function(e){return r("width",e)}}),React.createElement(x,{label:__("Thumbnail height","wordpress-popular-posts"),help:__("Size in px units (pixels)","wordpress-popular-posts"),value:t.thumbnail_height,onChange:function(e){return r("height",e)}})),"predefined"==t.thumbnail_build&&React.createElement(d,null,React.createElement(y,{value:t.thumbnail_size,options:o,onChange:function(e){a({thumbnail_width:s.state.imgSizes[e].width,thumbnail_height:s.state.imgSizes[e].height,thumbnail_size:e})}}))))}},{key:"getStatsTagFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=[];if(this.state.taxonomies)for(var r in this.state.taxonomies)s.push({label:this.state.taxonomies[r].labels.singular_name+" ("+this.state.taxonomies[r].name+")",value:this.state.taxonomies[r].name});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Stats Tag settings","wordpress-popular-posts"))),React.createElement(_,{label:__("Display comments count","wordpress-popular-posts"),checked:t.stats_comments,onChange:function(e){return a({stats_comments:e})}}),React.createElement(_,{label:__("Display views","wordpress-popular-posts"),checked:t.stats_views,onChange:function(e){return a({stats_views:e})}}),React.createElement(_,{label:__("Display author","wordpress-popular-posts"),checked:t.stats_author,onChange:function(e){return a({stats_author:e})}}),React.createElement(_,{label:__("Display date","wordpress-popular-posts"),checked:t.stats_date,onChange:function(e){return a({stats_date:e})}}),t.stats_date&&React.createElement("div",{className:"option-subset"},React.createElement(y,{label:__("Date Format","wordpress-popular-posts"),value:t.stats_date_format,options:[{label:__("Relative","wordpress-popular-posts"),value:"relative"},{label:__("Month Day, Year","wordpress-popular-posts"),value:"F j, Y"},{label:__("yyyy/mm/dd","wordpress-popular-posts"),value:"Y/m/d"},{label:__("mm/dd/yyyy","wordpress-popular-posts"),value:"m/d/Y"},{label:__("dd/mm/yyyy","wordpress-popular-posts"),value:"d/m/Y"}],onChange:function(e){return a({stats_date_format:e})}})),React.createElement(_,{label:__("Display taxonomy","wordpress-popular-posts"),checked:t.stats_taxonomy,onChange:function(e){return a({stats_taxonomy:e})}}),t.stats_taxonomy&&React.createElement("div",{className:"option-subset"},React.createElement(y,{label:__("Taxonomy","wordpress-popular-posts"),value:t.taxonomy,options:s,onChange:function(e){return a({taxonomy:e})}})))}},{key:"getHTMLMarkupFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=this,r=[{label:__("None","wordpress-popular-posts"),value:""}];if(this.state.themes)for(var o in this.state.themes)r.push({label:this.state.themes[o].json.name,value:o});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("HTML Markup settings","wordpress-popular-posts"))),React.createElement(_,{label:__("Use custom HTML Markup","wordpress-popular-posts"),checked:t.custom_html,onChange:function(e){return a({custom_html:e})}}),t.custom_html&&React.createElement("div",{className:"option-subset"},React.createElement(w,{rows:"1",label:__("Before title","wordpress-popular-posts"),value:t.header_start,onChange:function(e){return a({header_start:e})}}),React.createElement(w,{rows:"1",label:__("After title","wordpress-popular-posts"),value:t.header_end,onChange:function(e){return a({header_end:e})}}),React.createElement(w,{rows:"1",label:__("Before popular posts","wordpress-popular-posts"),value:t.wpp_start,onChange:function(e){return a({wpp_start:e})}}),React.createElement(w,{rows:"1",label:__("After popular posts","wordpress-popular-posts"),value:t.wpp_end,onChange:function(e){return a({wpp_end:e})}}),React.createElement(w,{label:__("Post HTML markup","wordpress-popular-posts"),value:t.post_html,onChange:function(e){return a({post_html:e})}})),React.createElement(y,{label:__("Theme","wordpress-popular-posts"),value:t.theme,options:r,onChange:function(e){if(void 0!==s.state.themes[e]){var t=s.state.themes[e].json.config;a({shorten_title:t.shorten_title.active,title_length:t.shorten_title.title_length,title_by_words:t.shorten_title.words?1:0,display_post_excerpt:t["post-excerpt"].active,excerpt_format:t["post-excerpt"].format,excerpt_length:t["post-excerpt"].length,excerpt_by_words:t["post-excerpt"].words?1:0,display_post_thumbnail:t.thumbnail.active,thumbnail_build:t.thumbnail.build,thumbnail_width:t.thumbnail.width,thumbnail_height:t.thumbnail.height,stats_comments:t.stats_tag.comment_count,stats_views:t.stats_tag.views,stats_author:t.stats_tag.author,stats_date:t.stats_tag.date.active,stats_date_format:t.stats_tag.date.format,stats_taxonomy:t.stats_tag.taxonomy.active,taxonomy:t.stats_tag.taxonomy.name,custom_html:!0,wpp_start:t.markup["wpp-start"],wpp_end:t.markup["wpp-end"],post_html:t.markup["post-html"],theme:e})}else a({theme:e})}}))}},{key:"render",value:function(){if(!this.state.taxonomies||!this.state.themes||!this.state.imgSizes)return React.createElement(v,null);var e=this.props,t=e.isSelected,a=e.className,s=e.attributes,r=a;return r+=this.state.editMode?" in-edit-mode":" in-preview-mode",r+=t?" is-selected":"",[this.getBlockControls(),React.createElement("div",{className:r},this.state.editMode&&React.createElement(d,null,this.getMainFields(),this.getFiltersFields(),this.getPostSettingsFields(),this.getStatsTagFields(),this.getHTMLMarkupFields()),!this.state.editMode&&React.createElement(g,null,React.createElement(u,{block:this.props.name,className:a,attributes:s})))]}}])&&n(t.prototype,a),c}(m),S=wp.blocks.registerBlockType,k=wp.i18n.__;S("wordpress-popular-posts/widget",{title:"WordPress Popular Posts",category:"widgets",icon:r.flame,description:k("A highly customizable block that displays your most popular posts.","wordpress-popular-posts"),keywords:["popular","posts","trending","popularity"],attributes:{_editMode:{type:"boolean",default:!0},title:{type:"string"},limit:{type:"number",default:10},offset:{type:"number",default:0},order_by:{type:"string",default:"views"},range:{type:"string",default:"last24hours"},time_quantity:{type:"number",default:24},time_unit:{type:"string",default:"hour"},freshness:{type:"boolean",default:!1},post_type:{type:"string",default:"post"},pid:{type:"string",default:""},author:{type:"string",default:""},tax:{type:"string",default:""},term_id:{type:"string",default:""},shorten_title:{type:"boolean",default:!1},title_length:{type:"number",default:0},title_by_words:{type:"number",default:0},display_post_excerpt:{type:"boolean",default:!1},excerpt_format:{type:"boolean",default:!1},excerpt_length:{type:"number",default:0},excerpt_by_words:{type:"number",default:0},display_post_thumbnail:{type:"boolean",default:!1},thumbnail_width:{type:"number",default:0},thumbnail_height:{type:"number",default:0},thumbnail_build:{type:"string",default:"manual"},thumbnail_size:{type:"string",default:""},stats_comments:{type:"boolean",default:!1},stats_views:{type:"boolean",default:!0},stats_author:{type:"boolean",default:!1},stats_date:{type:"boolean",default:!1},stats_date_format:{type:"string",default:"F j, Y"},stats_taxonomy:{type:"boolean",default:!1},taxonomy:{type:"string",default:""},custom_html:{type:"boolean",default:!1},header_start:{type:"string",default:"<h2>"},header_end:{type:"string",default:"</h2>"},wpp_start:{type:"string",default:'<ul class="wpp-list">'},wpp_end:{type:"string",default:"</ul>"},post_html:{type:"string",default:'<li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li>'},theme:{type:"string",default:""}},supports:{anchor:!0,align:!0,html:!1},example:{attributes:{_editMode:!1,title:"Popular Posts",limit:3,range:"last7days",display_post_excerpt:!0,excerpt_length:75,display_post_thumbnail:!0,thumbnail_width:75,thumbnail_height:75,stats_views:!1,stats_taxonomy:!0,custom_html:!0,wpp_start:'<ul class="wpp-list wpp-cards">',post_html:'<li>{thumb_img} <div class="wpp-item-data"><div class="taxonomies">{taxonomy}</div>{title} <p class="wpp-excerpt">{excerpt}</p></div></li>',theme:"cards"}},edit:C,save:function(){return null}})}]);
1
+ !function(e){var t={};function a(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=t,a.d=function(e,t,s){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(s,r,function(t){return e[t]}.bind(null,r));return s},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){"use strict";a.r(t);var s={};s.flame=React.createElement("svg",{viewBox:"0 0 248 379"},React.createElement("path",{fill:"#fff",d:"M-83,96q0-122.5,0-245H165q0,131,0,262a31.87,31.87,0,0,1-.95-4.33A123.87,123.87,0,0,0,153.47,68.3c-12.28-27.74-31.1-50.64-53-71.21C75.67-26.13,55.85-52,54.32-87.87c-.79-18.47.81-36.24,11.59-52.15,1.08-1.59.38-4.4.5-6.64-2.43.1-5.5-.7-7.18.47a140.91,140.91,0,0,0-17.12,13.72C19.49-110.67,3-84.6-9.51-56A149,149,0,0,0-21.86-3.77c-2,39.4,11.38,73.46,36.17,103.51,1.74,2.11,3.51,4.2,5.27,6.3l-.67,1.07c-3.94-1.07-8-1.83-11.82-3.24C-25.17,91.94-52.36,58.57-51.12,21c.1-2.91.21-6.45-3.51-6.49-2,0-4.76,2.16-5.79,4.09-9.4,17.55-16.35,36-19.73,55.73C-81.38,81.49-82.07,88.76-83,96Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#ba2f2f",d:"M-83,96c.93-7.24,1.62-14.51,2.85-21.7,3.38-19.69,10.33-38.18,19.73-55.73,1-1.93,3.83-4.11,5.79-4.09,3.72,0,3.61,3.58,3.51,6.49-1.25,37.59,25.94,71,58.2,82.89,3.82,1.41,7.87,2.18,11.82,3.24l.67-1.07c-1.76-2.1-3.52-4.19-5.27-6.3C-10.49,69.68-23.88,35.63-21.86-3.77A149,149,0,0,1-9.51-56c12.48-28.62,29-54.69,51.62-76.5a140.91,140.91,0,0,1,17.12-13.72c1.68-1.18,4.75-.37,7.18-.47-.13,2.24.58,5-.5,6.64-10.78,15.9-12.37,33.68-11.59,52.15,1.53,35.89,21.35,61.74,46.11,85,21.94,20.57,40.76,43.47,53,71.21a123.87,123.87,0,0,1,10.59,40.36A31.87,31.87,0,0,0,165,113v9c-.7,4.24-1.17,8.54-2.13,12.73-10.74,46.51-37.08,78.75-84.34,91.58C72.16,228,65.52,228.79,59,230H43a25.19,25.19,0,0,0-3.12-1.18c-10-2.37-20.21-4.12-30-7.12-45.83-14-75.19-44.64-89-90.24-2.28-7.52-2.64-15.63-3.88-23.46Q-83,102-83,96ZM61.63-143.61c-6.24,5.39-12.87,10.38-18.64,16.22A229,229,0,0,0-8.77-46.26,138.37,138.37,0,0,0-16.63,23c4.69,32.54,20.21,59.59,42.4,83.23,1.34,1.43,2.7,2.83,4.8,5-15.23,1-28-3.3-39.74-10.64-29.74-18.62-46-45.23-46.8-81a138.75,138.75,0,0,0-7.46,14.67A178.29,178.29,0,0,0-78.24,93.09C-80.9,129.7-68,160.25-42.78,185.71c28.91,29.16,65.19,41.42,105.43,38.91,43.82-2.73,80.34-35.08,93.53-79.39,8.68-29.18,3.11-56.71-10.29-83.15C134.15,38.92,117.71,19.34,99,1.57,85-11.65,71.34-25.28,62.72-42.69,46.33-75.79,44.36-109.22,61.63-143.61Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#fff",d:"M-83,108c1.25,7.84,1.61,15.94,3.88,23.46,13.79,45.6,43.15,76.21,89,90.24,9.82,3,20,4.76,30,7.12A25.19,25.19,0,0,1,43,230H-83Q-83,169-83,108Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#fff",d:"M59,230c6.52-1.21,13.16-2,19.53-3.69,47.26-12.83,73.6-45.07,84.34-91.58,1-4.18,1.43-8.48,2.13-12.73V230Z",transform:"translate(83 149)"}),React.createElement("path",{fill:"#ba2f2f",d:"M61.63-143.61c-17.28,34.39-15.3,67.82,1.09,100.92C71.34-25.28,85-11.65,99,1.57c18.75,17.77,35.2,37.35,46.94,60.51,13.4,26.44,19,54,10.29,83.15-13.18,44.31-49.71,76.66-93.53,79.39-40.25,2.51-76.52-9.75-105.43-38.91C-68,160.25-80.9,129.7-78.24,93.09A178.29,178.29,0,0,1-63.45,34.31,138.75,138.75,0,0,1-56,19.64c.77,35.79,17.06,62.4,46.8,81C2.54,108,15.33,112.3,30.56,111.3c-2.1-2.21-3.46-3.62-4.8-5C3.57,82.62-11.94,55.57-16.63,23A138.37,138.37,0,0,1-8.77-46.26,229,229,0,0,1,43-127.38C48.76-133.23,55.39-138.22,61.63-143.61Z",transform:"translate(83 149)"}));var r=s;function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){for(var a=0;a<t.length;a++){var s=t[a];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=wp.serverSideRender,c=wp.element,m=c.Component,d=c.Fragment,h=wp.blockEditor.BlockControls,f=wp.components,b=f.Button,_=f.CheckboxControl,g=f.Disabled,y=f.SelectControl,v=f.Spinner,w=f.TextareaControl,x=f.TextControl,R=f.Toolbar,__=wp.i18n.__,E="wordpress-popular-posts/v1",C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(c,e);var t,a,s,r,o=(s=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=p(s);if(r){var a=p(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return i(this,e)});function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=o.call(this,e)).state={error:null,editMode:!0,themes:null,imgSizes:null,taxonomies:null},t}return t=c,(a=[{key:"componentDidMount",value:function(){var e=this.props.attributes;this.getThemes(),this.getImageSizes(),this.getTaxonomies(),this.setState({editMode:e._editMode})}},{key:"getThemes",value:function(){var e=this;wp.apiFetch({path:E+"/themes"}).then((function(t){e.setState({themes:t})}),(function(t){e.setState({error:t,themes:null})}))}},{key:"getImageSizes",value:function(){var e=this;wp.apiFetch({path:E+"/thumbnails"}).then((function(t){e.setState({imgSizes:t})}),(function(t){e.setState({error:t,imgSizes:null})}))}},{key:"getTaxonomies",value:function(){var e=this,t=this.props.attributes;wp.apiFetch({path:E+"/taxonomies"}).then((function(a){if(a){var s=t.tax.split(";"),r=t.term_id.split(";");if(s.length&&s.length==r.length){for(var o={},n=0;n<s.length;n++)o[s[n]]=r[n];for(var l in a)a[l]._terms=void 0!==o[l]?o[l]:""}}e.setState({taxonomies:a})}),(function(t){e.setState({error:t,taxonomies:null})}))}},{key:"getBlockControls",value:function(){var e=this.props.setAttributes,t=this;return React.createElement(h,null,React.createElement(R,null,React.createElement(b,{label:this.state.editMode?__("Preview","wordpress-popular-posts"):__("Edit","wordpress-popular-posts"),icon:this.state.editMode?"format-image":"edit",onClick:function(){var a=!t.state.editMode;t.setState({editMode:a}),e({_editMode:a})}})))}},{key:"getMainFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes;return React.createElement(d,null,React.createElement(x,{label:__("Title","wordpress-popular-posts"),value:t.title,onChange:function(e){e=function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&grave;"};return e.replace(/[&<>"'/]/gi,(function(e){return t[e]}))}(function(e){var t=document.createElement("div");t.innerHTML=e;var a=t.childNodes[0];return a?a.nodeValue:""}(e)),a({title:e})}}),React.createElement(x,{label:__("Limit","wordpress-popular-posts"),value:t.limit,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>0?e:10;a({limit:Number(t)})}}),React.createElement(y,{label:__("Sort posts by","wordpress-popular-posts"),value:t.order_by,options:[{label:__("Total views","wordpress-popular-posts"),value:"views"},{label:__("Comments","wordpress-popular-posts"),value:"comments"}],onChange:function(e){a({order_by:e})}}),React.createElement(y,{label:__("Time Range","wordpress-popular-posts"),value:t.range,options:[{label:__("Last 24 Hours","wordpress-popular-posts"),value:"last24hours"},{label:__("Last 7 days","wordpress-popular-posts"),value:"last7days"},{label:__("Last 30 days","wordpress-popular-posts"),value:"last30days"},{label:__("All-time","wordpress-popular-posts"),value:"all"},{label:__("Custom","wordpress-popular-posts"),value:"custom"}],onChange:function(e){a({range:e})}}),"custom"==t.range&&React.createElement("div",{className:"option-subset"},React.createElement(x,{label:__("Time Quantity","wordpress-popular-posts"),value:t.time_quantity,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>0?e:24;a({time_quantity:Number(t)})}}),React.createElement(y,{label:__("Time Unit","wordpress-popular-posts"),value:t.time_unit,options:[{label:__("Minute(s)","wordpress-popular-posts"),value:"minute"},{label:__("Hour(s)","wordpress-popular-posts"),value:"hour"},{label:__("Day(s)","wordpress-popular-posts"),value:"day"}],onChange:function(e){a({time_unit:e})}})),React.createElement(_,{label:__("Display only posts published within the selected Time Range","wordpress-popular-posts"),checked:t.freshness,onChange:function(e){a({freshness:e})}}))}},{key:"getFiltersFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=this,r=[];if(this.state.taxonomies)for(var o in this.state.taxonomies)r.push({name:this.state.taxonomies[o].name,label:this.state.taxonomies[o].labels.singular_name+" ("+this.state.taxonomies[o].name+")",terms:this.state.taxonomies[o]._terms});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Filters","wordpress-popular-posts"))),React.createElement(x,{label:__("Post type(s)","wordpress-popular-posts"),help:__("Post types must be comma separated.","wordpress-popular-posts"),value:t.post_type,onChange:function(e){var t=e.replace(/[^a-z0-9-_\,]+/gi,"");a({post_type:t})}}),React.createElement(x,{label:__("Post ID(s) to exclude","wordpress-popular-posts"),help:__("IDs must be comma separated.","wordpress-popular-posts"),value:t.pid,onChange:function(e){var t=e.replace(/[^0-9\,]/g,"");a({pid:t})}}),React.createElement(x,{label:__("Author ID(s)","wordpress-popular-posts"),help:__("IDs must be comma separated.","wordpress-popular-posts"),value:t.author,onChange:function(e){var t=e.replace(/[^0-9\,]/g,"");a({author:t})}}),r&&r.filter((function(e){return"post_format"!=e.name})).map((function(e){return React.createElement(x,{label:e.label,help:__("Term IDs must be comma separated, prefix a minus sign to exclude.","wordpress-popular-posts"),value:e.terms,onChange:function(t){return function(e,t){var a=s.state.taxonomies;t=t.replace(/[^0-9-\,]/g,""),a&&void 0!==a[e]&&(a[e]._terms=t,s.setState({taxonomies:a}))}(e.name,t)},onBlur:function(){return function(e){var t=s.state.taxonomies;if(t&&void 0!==t[e]){var r=t[e]._terms.split(",");r.length&&(r=r.map((function(e){return e.trim()})).filter((function(e){return""!=e&&"-"!=e}))),r.length&&(r=Array.from(new Set(r))),t[e]._terms=r.join(","),s.setState({taxonomies:t});var o="",n="";for(var l in s.state.taxonomies)if(s.state.taxonomies.hasOwnProperty(l)){if(!s.state.taxonomies[l]._terms.length)continue;o+=l+";",n+=s.state.taxonomies[l]._terms+";"}o&&n&&(o=o.replace(new RegExp(";$"),""),n=n.replace(new RegExp(";$"),"")),a({tax:o,term_id:n})}}(e.name)}})})))}},{key:"getPostSettingsFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=this;function r(e,t){var s=Number.isInteger(Number(t))&&Number(t)>=0?t:0;a("width"==e?{thumbnail_width:Number(s)}:{thumbnail_height:Number(s)})}var o=[];if(this.state.imgSizes)for(var n in this.state.imgSizes)o.push({label:n,value:n});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Posts settings","wordpress-popular-posts"))),React.createElement(_,{label:__("Shorten title","wordpress-popular-posts"),checked:t.shorten_title,onChange:function(e){a(0==e?{title_length:0,title_by_words:0,shorten_title:e}:{shorten_title:e,title_length:25})}}),t.shorten_title&&React.createElement("div",{className:"option-subset"},React.createElement(x,{label:__("Shorten title to","wordpress-popular-posts"),value:t.title_length,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>=0?e:0;a({title_length:Number(t)})}}),React.createElement(y,{value:t.title_by_words,options:[{label:__("characters","wordpress-popular-posts"),value:0},{label:__("words","wordpress-popular-posts"),value:1}],onChange:function(e){return a({title_by_words:Number(e)})}})),React.createElement(_,{label:__("Display post excerpt","wordpress-popular-posts"),checked:t.display_post_excerpt,onChange:function(e){a(0==e?{excerpt_length:0,excerpt_by_words:0,display_post_excerpt:e}:{display_post_excerpt:e,excerpt_length:55})}}),t.display_post_excerpt&&React.createElement("div",{className:"option-subset"},React.createElement(_,{label:__("Keep text format and links","wordpress-popular-posts"),checked:t.excerpt_format,onChange:function(e){return a({excerpt_format:e})}}),React.createElement(x,{label:__("Excerpt length","wordpress-popular-posts"),value:t.excerpt_length,onChange:function(e){var t=Number.isInteger(Number(e))&&Number(e)>=0?e:0;a({excerpt_length:Number(t)})}}),React.createElement(y,{value:t.excerpt_by_words,options:[{label:__("characters","wordpress-popular-posts"),value:0},{label:__("words","wordpress-popular-posts"),value:1}],onChange:function(e){return a({excerpt_by_words:Number(e)})}})),React.createElement(_,{label:__("Display post thumbnail","wordpress-popular-posts"),checked:t.display_post_thumbnail,onChange:function(e){a(0==e?{thumbnail_width:0,thumbnail_height:0,display_post_thumbnail:e}:{thumbnail_width:75,thumbnail_height:75,display_post_thumbnail:e})}}),t.display_post_thumbnail&&React.createElement("div",{className:"option-subset"},React.createElement(y,{value:t.thumbnail_build,options:[{label:__("Set size manually","wordpress-popular-posts"),value:"manual"},{label:__("Use predefined size","wordpress-popular-posts"),value:"predefined"}],onChange:function(e){"predefined"==e&&a({thumbnail_width:s.state.imgSizes[o[0].value].width,thumbnail_height:s.state.imgSizes[o[0].value].height,thumbnail_size:o[0].value}),a({thumbnail_build:e})}}),"manual"==t.thumbnail_build&&React.createElement(d,null,React.createElement(x,{label:__("Thumbnail width","wordpress-popular-posts"),help:__("Size in px units (pixels)","wordpress-popular-posts"),value:t.thumbnail_width,onChange:function(e){return r("width",e)}}),React.createElement(x,{label:__("Thumbnail height","wordpress-popular-posts"),help:__("Size in px units (pixels)","wordpress-popular-posts"),value:t.thumbnail_height,onChange:function(e){return r("height",e)}})),"predefined"==t.thumbnail_build&&React.createElement(d,null,React.createElement(y,{value:t.thumbnail_size,options:o,onChange:function(e){a({thumbnail_width:s.state.imgSizes[e].width,thumbnail_height:s.state.imgSizes[e].height,thumbnail_size:e})}}))))}},{key:"getStatsTagFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=[];if(this.state.taxonomies)for(var r in this.state.taxonomies)s.push({label:this.state.taxonomies[r].labels.singular_name+" ("+this.state.taxonomies[r].name+")",value:this.state.taxonomies[r].name});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Stats Tag settings","wordpress-popular-posts"))),React.createElement(_,{label:__("Display comments count","wordpress-popular-posts"),checked:t.stats_comments,onChange:function(e){return a({stats_comments:e})}}),React.createElement(_,{label:__("Display views","wordpress-popular-posts"),checked:t.stats_views,onChange:function(e){return a({stats_views:e})}}),React.createElement(_,{label:__("Display author","wordpress-popular-posts"),checked:t.stats_author,onChange:function(e){return a({stats_author:e})}}),React.createElement(_,{label:__("Display date","wordpress-popular-posts"),checked:t.stats_date,onChange:function(e){return a({stats_date:e})}}),t.stats_date&&React.createElement("div",{className:"option-subset"},React.createElement(y,{label:__("Date Format","wordpress-popular-posts"),value:t.stats_date_format,options:[{label:__("Relative","wordpress-popular-posts"),value:"relative"},{label:__("Month Day, Year","wordpress-popular-posts"),value:"F j, Y"},{label:__("yyyy/mm/dd","wordpress-popular-posts"),value:"Y/m/d"},{label:__("mm/dd/yyyy","wordpress-popular-posts"),value:"m/d/Y"},{label:__("dd/mm/yyyy","wordpress-popular-posts"),value:"d/m/Y"}],onChange:function(e){return a({stats_date_format:e})}})),React.createElement(_,{label:__("Display taxonomy","wordpress-popular-posts"),checked:t.stats_taxonomy,onChange:function(e){return a({stats_taxonomy:e})}}),t.stats_taxonomy&&React.createElement("div",{className:"option-subset"},React.createElement(y,{label:__("Taxonomy","wordpress-popular-posts"),value:t.taxonomy,options:s,onChange:function(e){return a({taxonomy:e})}})))}},{key:"getHTMLMarkupFields",value:function(){var e=this.props,t=e.attributes,a=e.setAttributes,s=this,r=[{label:__("None","wordpress-popular-posts"),value:""}];if(this.state.themes)for(var o in this.state.themes)r.push({label:this.state.themes[o].json.name,value:o});return React.createElement(d,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("HTML Markup settings","wordpress-popular-posts"))),React.createElement(_,{label:__("Use custom HTML Markup","wordpress-popular-posts"),checked:t.custom_html,onChange:function(e){return a({custom_html:e})}}),t.custom_html&&React.createElement("div",{className:"option-subset"},React.createElement(w,{rows:"1",label:__("Before title","wordpress-popular-posts"),value:t.header_start,onChange:function(e){return a({header_start:e})}}),React.createElement(w,{rows:"1",label:__("After title","wordpress-popular-posts"),value:t.header_end,onChange:function(e){return a({header_end:e})}}),React.createElement(w,{rows:"1",label:__("Before popular posts","wordpress-popular-posts"),value:t.wpp_start,onChange:function(e){return a({wpp_start:e})}}),React.createElement(w,{rows:"1",label:__("After popular posts","wordpress-popular-posts"),value:t.wpp_end,onChange:function(e){return a({wpp_end:e})}}),React.createElement(w,{label:__("Post HTML markup","wordpress-popular-posts"),value:t.post_html,onChange:function(e){return a({post_html:e})}})),React.createElement(y,{label:__("Theme","wordpress-popular-posts"),value:t.theme,options:r,onChange:function(e){if(void 0!==s.state.themes[e]){var t=s.state.themes[e].json.config;a({shorten_title:t.shorten_title.active,title_length:t.shorten_title.title_length,title_by_words:t.shorten_title.words?1:0,display_post_excerpt:t["post-excerpt"].active,excerpt_format:t["post-excerpt"].format,excerpt_length:t["post-excerpt"].length,excerpt_by_words:t["post-excerpt"].words?1:0,display_post_thumbnail:t.thumbnail.active,thumbnail_build:t.thumbnail.build,thumbnail_width:t.thumbnail.width,thumbnail_height:t.thumbnail.height,stats_comments:t.stats_tag.comment_count,stats_views:t.stats_tag.views,stats_author:t.stats_tag.author,stats_date:t.stats_tag.date.active,stats_date_format:t.stats_tag.date.format,stats_taxonomy:t.stats_tag.taxonomy.active,taxonomy:t.stats_tag.taxonomy.name,custom_html:!0,wpp_start:t.markup["wpp-start"],wpp_end:t.markup["wpp-end"],post_html:t.markup["post-html"],theme:e})}else a({theme:e})}}))}},{key:"render",value:function(){if(!this.state.taxonomies||!this.state.themes||!this.state.imgSizes)return React.createElement(v,null);var e=this.props,t=e.isSelected,a=e.className,s=e.attributes,r=a;return r+=this.state.editMode?" in-edit-mode":" in-preview-mode",r+=t?" is-selected":"",[this.getBlockControls(),React.createElement("div",{className:r},this.state.editMode&&React.createElement(d,null,this.getMainFields(),this.getFiltersFields(),this.getPostSettingsFields(),this.getStatsTagFields(),this.getHTMLMarkupFields()),!this.state.editMode&&React.createElement(g,null,React.createElement(u,{block:this.props.name,className:a,attributes:s,urlQueryArgs:{isSelected:t}})))]}}])&&n(t.prototype,a),c}(m),S=wp.blocks.registerBlockType,k=wp.i18n.__;S("wordpress-popular-posts/widget",{title:"WordPress Popular Posts",category:"widgets",icon:r.flame,description:k("A highly customizable block that displays your most popular posts.","wordpress-popular-posts"),keywords:["popular","posts","trending","popularity"],attributes:{_editMode:{type:"boolean",default:!0},_isSelected:{type:"boolean",default:!1},title:{type:"string"},limit:{type:"number",default:10},offset:{type:"number",default:0},order_by:{type:"string",default:"views"},range:{type:"string",default:"last24hours"},time_quantity:{type:"number",default:24},time_unit:{type:"string",default:"hour"},freshness:{type:"boolean",default:!1},post_type:{type:"string",default:"post"},pid:{type:"string",default:""},author:{type:"string",default:""},tax:{type:"string",default:""},term_id:{type:"string",default:""},shorten_title:{type:"boolean",default:!1},title_length:{type:"number",default:0},title_by_words:{type:"number",default:0},display_post_excerpt:{type:"boolean",default:!1},excerpt_format:{type:"boolean",default:!1},excerpt_length:{type:"number",default:0},excerpt_by_words:{type:"number",default:0},display_post_thumbnail:{type:"boolean",default:!1},thumbnail_width:{type:"number",default:0},thumbnail_height:{type:"number",default:0},thumbnail_build:{type:"string",default:"manual"},thumbnail_size:{type:"string",default:""},stats_comments:{type:"boolean",default:!1},stats_views:{type:"boolean",default:!0},stats_author:{type:"boolean",default:!1},stats_date:{type:"boolean",default:!1},stats_date_format:{type:"string",default:"F j, Y"},stats_taxonomy:{type:"boolean",default:!1},taxonomy:{type:"string",default:""},custom_html:{type:"boolean",default:!1},header_start:{type:"string",default:"<h2>"},header_end:{type:"string",default:"</h2>"},wpp_start:{type:"string",default:'<ul class="wpp-list">'},wpp_end:{type:"string",default:"</ul>"},post_html:{type:"string",default:'<li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li>'},theme:{type:"string",default:""}},supports:{anchor:!0,align:!0,html:!1},example:{attributes:{_editMode:!1,title:"Popular Posts",limit:3,range:"last7days",display_post_excerpt:!0,excerpt_length:75,display_post_thumbnail:!0,thumbnail_width:75,thumbnail_height:75,stats_views:!1,stats_taxonomy:!0,custom_html:!0,wpp_start:'<ul class="wpp-list wpp-cards">',post_html:'<li>{thumb_img} <div class="wpp-item-data"><div class="taxonomies">{taxonomy}</div>{title} <p class="wpp-excerpt">{excerpt}</p></div></li>',theme:"cards"}},edit:C,save:function(){return null}})}]);
assets/js/wpp.js CHANGED
@@ -6,30 +6,45 @@ var WordPressPopularPosts = (function(){
6
  var noop = function(){};
7
  var supportsShadowDOMV1 = !! HTMLElement.prototype.attachShadow;
8
 
9
- var get = function( url, params, callback ){
10
  callback = ( 'function' === typeof callback ) ? callback : noop;
11
- ajax( "GET", url, params, callback );
12
  };
13
 
14
- var post = function( url, params, callback ){
15
  callback = ( 'function' === typeof callback ) ? callback : noop;
16
- ajax( "POST", url, params, callback );
17
  };
18
 
19
- var ajax = function( method, url, params, callback ){
20
  /* Create XMLHttpRequest object and set variables */
21
  var xhr = new XMLHttpRequest(),
22
  target = url,
23
  args = params,
24
- valid_methods = ["GET", "POST"];
25
- method = -1 != valid_methods.indexOf( method ) ? method : "GET";
26
- /* Set request method and target URL */
27
- xhr.open( method, target + ( "GET" == method ? '?' + args : '' ), true );
 
 
28
  /* Set request headers */
29
- if ( "POST" == method ) {
30
- xhr.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
31
  }
32
- xhr.setRequestHeader( "X-Requested-With","XMLHttpRequest" );
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  /* Hook into onreadystatechange */
34
  xhr.onreadystatechange = function() {
35
  if ( 4 === xhr.readyState && 200 <= xhr.status && 300 > xhr.status ) {
@@ -38,8 +53,9 @@ var WordPressPopularPosts = (function(){
38
  }
39
  }
40
  };
 
41
  /* Send request */
42
- xhr.send( ( "POST" == method ? args : null ) );
43
  };
44
 
45
  var theme = function(wpp_list) {
@@ -106,9 +122,8 @@ var WordPressPopularPosts = (function(){
106
  })();
107
 
108
  document.addEventListener('DOMContentLoaded', function() {
109
- var widget_placeholders = document.querySelectorAll('.wpp-widget-placeholder');
110
-
111
- var w = 0;
112
 
113
  while ( w < widget_placeholders.length ) {
114
  fetchWidget(widget_placeholders[w]);
@@ -124,37 +139,59 @@ document.addEventListener('DOMContentLoaded', function() {
124
  }
125
 
126
  function fetchWidget(widget_placeholder) {
127
- WordPressPopularPosts.get(
128
- wpp_params.ajax_url + '/widget/' + widget_placeholder.getAttribute('data-widget-id').split('-')[1],
129
- 'is_single=' + wpp_params.ID + ( wpp_params.lang ? '&lang=' + wpp_params.lang : '' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  function(response) {
131
- widget_placeholder.insertAdjacentHTML('afterend', JSON.parse(response).widget);
 
 
 
 
132
 
133
- let parent = widget_placeholder.parentNode,
134
- sr = parent.querySelector('.popular-posts-sr');
135
 
136
- parent.removeChild(widget_placeholder);
 
 
137
 
138
- if ( sr ) {
139
- WordPressPopularPosts.theme(sr);
140
- }
141
 
142
- let event = null;
 
143
 
144
- if ( 'function' === typeof(Event) ) {
145
- event = new Event("wpp-onload", {"bubbles": true, "cancelable": false});
146
- } /* Fallback for older browsers */
147
- else {
148
- if ( document.createEvent ) {
149
- event = document.createEvent('Event');
150
- event.initEvent("wpp-onload", true, false);
151
- }
152
- }
153
 
154
- if ( event ) {
155
- parent.dispatchEvent(event);
156
- }
157
- }
158
- );
159
  }
160
  });
6
  var noop = function(){};
7
  var supportsShadowDOMV1 = !! HTMLElement.prototype.attachShadow;
8
 
9
+ var get = function( url, params, callback, additional_headers ){
10
  callback = ( 'function' === typeof callback ) ? callback : noop;
11
+ ajax( "GET", url, params, callback, additional_headers );
12
  };
13
 
14
+ var post = function( url, params, callback, additional_headers ){
15
  callback = ( 'function' === typeof callback ) ? callback : noop;
16
+ ajax( "POST", url, params, callback, additional_headers );
17
  };
18
 
19
+ var ajax = function( method, url, params, callback, additional_headers ){
20
  /* Create XMLHttpRequest object and set variables */
21
  var xhr = new XMLHttpRequest(),
22
  target = url,
23
  args = params,
24
+ valid_methods = ["GET", "POST"],
25
+ method = -1 != valid_methods.indexOf( method ) ? method : "GET",
26
+ headers = {
27
+ 'X-Requested-With': 'XMLHttpRequest'
28
+ };
29
+
30
  /* Set request headers */
31
+ if ( 'POST' == method ) {
32
+ headers['Content-Type'] = 'application/x-www-form-urlencoded';
33
  }
34
+
35
+ if ( 'object' == typeof additional_headers && Object.keys(additional_headers).length ) {
36
+ headers = Object.assign({}, headers, additional_headers);
37
+ }
38
+
39
+ /* Set request method and target URL */
40
+ xhr.open( method, target + ( 'GET' == method ? '?' + args : '' ), true );
41
+
42
+ for (const key in headers) {
43
+ if ( headers.hasOwnProperty(key) ) {
44
+ xhr.setRequestHeader( key, headers[key] );
45
+ }
46
+ }
47
+
48
  /* Hook into onreadystatechange */
49
  xhr.onreadystatechange = function() {
50
  if ( 4 === xhr.readyState && 200 <= xhr.status && 300 > xhr.status ) {
53
  }
54
  }
55
  };
56
+
57
  /* Send request */
58
+ xhr.send( ( 'POST' == method ? args : null ) );
59
  };
60
 
61
  var theme = function(wpp_list) {
122
  })();
123
 
124
  document.addEventListener('DOMContentLoaded', function() {
125
+ var widget_placeholders = document.querySelectorAll('.wpp-widget-placeholder, .wpp-widget-block-placeholder'),
126
+ w = 0;
 
127
 
128
  while ( w < widget_placeholders.length ) {
129
  fetchWidget(widget_placeholders[w]);
139
  }
140
 
141
  function fetchWidget(widget_placeholder) {
142
+ let widget_id_attr = widget_placeholder.getAttribute('data-widget-id'),
143
+ method = 'GET',
144
+ url = '',
145
+ headers = {},
146
+ params = '';
147
+
148
+ if ( widget_id_attr ) {
149
+ url = wpp_params.ajax_url + '/widget/' + widget_id_attr.split('-')[1];
150
+ params = 'is_single=' + wpp_params.ID + ( wpp_params.lang ? '&lang=' + wpp_params.lang : '' );
151
+ } else {
152
+ method = 'POST';
153
+ url = wpp_params.api_url + '/v2/widget?is_single=' + wpp_params.ID + ( wpp_params.lang ? '&lang=' + wpp_params.lang : '' );
154
+ headers = {
155
+ 'Content-Type': 'application/json'
156
+ };
157
+
158
+ let json_tag = widget_placeholder.parentNode.querySelector('script[type="application/json"]');
159
+
160
+ if ( json_tag ) {
161
+ let args = JSON.parse(json_tag.textContent);
162
+ params = JSON.stringify(args);
163
+ }
164
+ }
165
+
166
+ WordPressPopularPosts.ajax(
167
+ method,
168
+ url,
169
+ params,
170
  function(response) {
171
+ renderWidget(response, widget_placeholder);
172
+ },
173
+ headers
174
+ );
175
+ }
176
 
177
+ function renderWidget(response, widget_placeholder) {
178
+ widget_placeholder.insertAdjacentHTML('afterend', JSON.parse(response).widget);
179
 
180
+ let parent = widget_placeholder.parentNode,
181
+ sr = parent.querySelector('.popular-posts-sr'),
182
+ json_tag = parent.querySelector('script[type="application/json"]');
183
 
184
+ if ( json_tag )
185
+ parent.removeChild(json_tag);
 
186
 
187
+ parent.removeChild(widget_placeholder);
188
+ parent.classList.add('wpp-ajax');
189
 
190
+ if ( sr ) {
191
+ WordPressPopularPosts.theme(sr);
192
+ }
 
 
 
 
 
 
193
 
194
+ let event = new Event("wpp-onload", {"bubbles": true, "cancelable": false});
195
+ parent.dispatchEvent(event);
 
 
 
196
  }
197
  });
assets/js/wpp.min.js CHANGED
@@ -1,6 +1,7 @@
1
- var wpp_params=null,WordPressPopularPosts=function(){var g=function(){},e=!!HTMLElement.prototype.attachShadow,d=function(b,c,a,h){var f=new XMLHttpRequest;b=-1!=["GET","POST"].indexOf(b)?b:"GET";f.open(b,c+("GET"==b?"?"+a:""),!0);"POST"==b&&f.setRequestHeader("Content-type","application/x-www-form-urlencoded");f.setRequestHeader("X-Requested-With","XMLHttpRequest");f.onreadystatechange=function(){4===f.readyState&&200<=f.status&&300>f.status&&"function"===typeof h&&h.call(void 0,f.response)};f.send("POST"==
2
- b?a: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(e){var c=document.createElement("style"),a=document.createElement("ul");a.innerHTML='<li><a href="#"></a></li>';b.parentNode.appendChild(a);var h=getComputedStyle(a.querySelector("li")),f=getComputedStyle(a.querySelector("li a"));c.innerHTML=".wpp-list li {font-size: "+h.fontSize+"}";c.innerHTML+=".wpp-list li a {color: "+f.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"),e=!0;wpp_params=JSON.parse(g.textContent);wpp_params.ID&&("1"==wpp_params.sampling_active&&(e=1===Math.floor(Math.random()*wpp_params.sampling_rate)+1),e&&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)})}for(var e=document.querySelectorAll(".wpp-widget-placeholder"),d=0;d<e.length;)g(e[d]),d++;e=document.querySelectorAll(".popular-posts-sr");if(e.length)for(d=0;d<e.length;d++)WordPressPopularPosts.theme(e[d])});
 
1
+ var wpp_params=null,WordPressPopularPosts=function(){var m=function(){},h=!!HTMLElement.prototype.attachShadow,f=function(b,c,a,g,k){var e=new XMLHttpRequest;b=-1!=["GET","POST"].indexOf(b)?b:"GET";var d={"X-Requested-With":"XMLHttpRequest"};"POST"==b&&(d["Content-Type"]="application/x-www-form-urlencoded");"object"==typeof k&&Object.keys(k).length&&(d=Object.assign({},d,k));e.open(b,c+("GET"==b?"?"+a:""),!0);for(var l in d)d.hasOwnProperty(l)&&e.setRequestHeader(l,d[l]);e.onreadystatechange=function(){4===
2
+ e.readyState&&200<=e.status&&300>e.status&&"function"===typeof g&&g.call(void 0,e.response)};e.send("POST"==b?a:null)};return{get:function(b,c,a,g){a="function"===typeof a?a:m;f("GET",b,c,a,g)},post:function(b,c,a,g){a="function"===typeof a?a:m;f("POST",b,c,a,g)},ajax:f,theme:function(b){if(h){var c=document.createElement("style"),a=document.createElement("ul");a.innerHTML='<li><a href="#"></a></li>';b.parentNode.appendChild(a);var g=getComputedStyle(a.querySelector("li")),k=getComputedStyle(a.querySelector("li a"));
3
+ c.innerHTML=".wpp-list li {font-size: "+g.fontSize+"}";c.innerHTML+=".wpp-list li a {color: "+k.color+"}";b.parentNode.removeChild(a);a=b.attachShadow({mode:"open"});for(a.append(c);b.firstElementChild;)a.append(b.firstElementChild)}}}}();
4
+ (function(){try{var m=document.querySelector("script#wpp-json"),h=!0;wpp_params=JSON.parse(m.textContent);wpp_params.ID&&("1"==wpp_params.sampling_active&&(h=1===Math.floor(Math.random()*wpp_params.sampling_rate)+1),h&&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(f){wpp_params.debug&&window.console&&window.console.log&&window.console.log(JSON.parse(f))}))}catch(f){console.error("WPP: Couldn't read JSON data")}})();
5
+ document.addEventListener("DOMContentLoaded",function(){function m(b){var c=b.getAttribute("data-widget-id"),a="GET",g="",k={},e="";if(c)g=wpp_params.ajax_url+"/widget/"+c.split("-")[1],e="is_single="+wpp_params.ID+(wpp_params.lang?"&lang="+wpp_params.lang:"");else if(a="POST",g=wpp_params.api_url+"/v2/widget?is_single="+wpp_params.ID+(wpp_params.lang?"&lang="+wpp_params.lang:""),k={"Content-Type":"application/json"},c=b.parentNode.querySelector('script[type="application/json"]'))e=JSON.parse(c.textContent),
6
+ e=JSON.stringify(e);WordPressPopularPosts.ajax(a,g,e,function(d){b.insertAdjacentHTML("afterend",JSON.parse(d).widget);d=b.parentNode;var l=d.querySelector(".popular-posts-sr"),n=d.querySelector('script[type="application/json"]');n&&d.removeChild(n);d.removeChild(b);d.classList.add("wpp-ajax");l&&WordPressPopularPosts.theme(l);l=new Event("wpp-onload",{bubbles:!0,cancelable:!1});d.dispatchEvent(l)},k)}for(var h=document.querySelectorAll(".wpp-widget-placeholder, .wpp-widget-block-placeholder"),f=
7
+ 0;f<h.length;)m(h[f]),f++;h=document.querySelectorAll(".popular-posts-sr");if(h.length)for(f=0;f<h.length;f++)WordPressPopularPosts.theme(h[f])});
assets/themes/cards-compact/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-cards-compact\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\">{thumb_img}<div class=\"wpp-item-data\"><div class=\"taxonomies\">{taxonomy}</div>{title}</div></li>"
48
  }
49
  }
50
  }
assets/themes/cards/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-cards\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\">{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/cardview-compact/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-cardview-compact\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\"><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/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-cardview\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\"><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/evergreen/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-evergreen\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\" 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/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-midnight\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\" 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/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-sunrise\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\" 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/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-sunset\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\" 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/tiles/config.json CHANGED
@@ -44,7 +44,7 @@
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
  }
44
  "markup": {
45
  "wpp-start": "<ul class=\"wpp-list wpp-tiles\">",
46
  "wpp-end": "</ul>",
47
+ "post-html": "<li class=\"{current_class}\">{thumb}<div class=\"wpp-post-data\">{taxonomy} {title}</div></li>"
48
  }
49
  }
50
  }
assets/themes/tiny/config.json CHANGED
@@ -35,7 +35,7 @@
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
  }
35
  "markup": {
36
  "wpp-start": "<ul class=\"wpp-list wpp-tiny\">",
37
  "wpp-end": "</ul>",
38
+ "post-html": "<li class=\"{current_class}\"><div class=\"wpp-item-data\">{category}</div> {title}</li>"
39
  }
40
  }
41
  }
i18n/wordpress-popular-posts.pot CHANGED
@@ -5,7 +5,7 @@ msgid ""
5
  msgstr ""
6
  "Project-Id-Version: WordPress Popular Posts\n"
7
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-popular-posts\n"
8
- "POT-Creation-Date: 2021-07-03 13:54-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"
@@ -26,7 +26,7 @@ msgstr ""
26
  msgid "Preview"
27
  msgstr ""
28
 
29
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/Admin.php:1098
30
  #: ../src/Block/Widget/edit.js:125
31
  msgid "Edit"
32
  msgstr ""
@@ -36,7 +36,7 @@ msgstr ""
36
  msgid "Title"
37
  msgstr ""
38
 
39
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:270
40
  #: ../src/Block/Widget/edit.js:181
41
  msgid "Limit"
42
  msgstr ""
@@ -51,7 +51,7 @@ msgstr ""
51
  msgid "Total views"
52
  msgstr ""
53
 
54
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/Admin.php:724
55
  #: ../src/Block/Widget/edit.js:190 ../src/Widget/form.php:21
56
  msgid "Comments"
57
  msgstr ""
@@ -65,12 +65,12 @@ msgstr ""
65
  msgid "Last 24 Hours"
66
  msgstr ""
67
 
68
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:326
69
  #: ../src/Block/Widget/edit.js:199 ../src/Widget/form.php:35
70
  msgid "Last 7 days"
71
  msgstr ""
72
 
73
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:327
74
  #: ../src/Block/Widget/edit.js:200 ../src/Widget/form.php:36
75
  msgid "Last 30 days"
76
  msgstr ""
@@ -80,7 +80,7 @@ msgstr ""
80
  msgid "All-time"
81
  msgstr ""
82
 
83
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:328
84
  #: ../src/Block/Widget/edit.js:202 ../src/Widget/form.php:38
85
  msgid "Custom"
86
  msgstr ""
@@ -93,25 +93,25 @@ msgstr ""
93
  msgid "Time Unit"
94
  msgstr ""
95
 
96
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:297
97
- #: ../src/Admin/admin-page.php:551 ../src/Block/Widget/edit.js:217
98
  #: ../src/Widget/form.php:45
99
  msgid "Minute(s)"
100
  msgstr ""
101
 
102
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:298
103
- #: ../src/Admin/admin-page.php:552 ../src/Block/Widget/edit.js:218
104
  #: ../src/Widget/form.php:46
105
  msgid "Hour(s)"
106
  msgstr ""
107
 
108
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:299
109
- #: ../src/Admin/admin-page.php:553 ../src/Block/Widget/edit.js:219
110
  #: ../src/Widget/form.php:47
111
  msgid "Day(s)"
112
  msgstr ""
113
 
114
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:273
115
  #: ../src/Block/Widget/edit.js:226 ../src/Widget/form.php:52
116
  msgid "Display only posts published within the selected Time Range"
117
  msgstr ""
@@ -277,10 +277,10 @@ msgstr ""
277
  msgid "Taxonomy"
278
  msgstr ""
279
 
280
- #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:677
281
- #: ../src/Admin/admin-page.php:747 ../src/Admin/admin-page.php:754
282
- #: ../src/Admin/admin-page.php:761 ../src/Admin/admin-page.php:768
283
- #: ../src/Admin/admin-page.php:775 ../src/Block/Widget/edit.js:652
284
  #: ../src/Widget/form.php:226
285
  msgid "None"
286
  msgstr ""
@@ -327,7 +327,7 @@ msgid_plural "%s views in the last hour"
327
  msgstr[0] ""
328
  msgstr[1] ""
329
 
330
- #: ../src/Admin/Admin.php:405 ../src/Admin/admin-page.php:350
331
  msgid "Trending now"
332
  msgstr ""
333
 
@@ -339,76 +339,130 @@ msgstr ""
339
  msgid "Use this image"
340
  msgstr ""
341
 
342
- #: ../src/Admin/Admin.php:575
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  msgid "Overview"
344
  msgstr ""
345
 
346
- #: ../src/Admin/Admin.php:576
347
  msgid ""
348
  "Welcome to WordPress Popular Posts' Dashboard! In this screen you will find statistics "
349
  "on what's popular on your site, tools to further tweak WPP to your needs, and more!"
350
  msgstr ""
351
 
352
- #: ../src/Admin/Admin.php:582
353
  msgid "Like this plugin?"
354
  msgstr ""
355
 
356
- #: ../src/Admin/Admin.php:584
357
  msgid ""
358
  "Each donation motivates me to keep releasing free stuff for the WordPress community!"
359
  msgstr ""
360
 
361
- #: ../src/Admin/Admin.php:591
362
  #, php-format
363
  msgid "You can <a href=\"%s\" target=\"_blank\">leave a review</a>, too!"
364
  msgstr ""
365
 
366
- #: ../src/Admin/Admin.php:598
367
  #, php-format
368
  msgid ""
369
  "<p><strong>For more information:</strong></p><ul><li><a href=\"%1$s\">Documentation</"
370
  "a></li><li><a href=\"%2$s\">Support</a></li></ul>"
371
  msgstr ""
372
 
373
- #: ../src/Admin/Admin.php:624
374
  msgid "Settings"
375
  msgstr ""
376
 
377
- #: ../src/Admin/Admin.php:625
378
  msgid "Support"
379
  msgstr ""
380
 
381
- #: ../src/Admin/Admin.php:703 ../src/Admin/Admin.php:1092 ../src/Admin/Admin.php:1096
382
- #: ../src/Output.php:781
383
  #, php-format
384
  msgid "%s view"
385
  msgid_plural "%s views"
386
  msgstr[0] ""
387
  msgstr[1] ""
388
 
389
- #: ../src/Admin/Admin.php:703 ../src/Admin/Admin.php:1094 ../src/Admin/Admin.php:1096
390
- #: ../src/Output.php:764
391
  #, php-format
392
  msgid "%s comment"
393
  msgid_plural "%s comments"
394
  msgstr[0] ""
395
  msgstr[1] ""
396
 
397
- #: ../src/Admin/Admin.php:728
398
  msgid "Views"
399
  msgstr ""
400
 
401
- #: ../src/Admin/Admin.php:1098
402
  msgid "View"
403
  msgstr ""
404
 
405
- #: ../src/Admin/Admin.php:1109
406
  msgid ""
407
  "Looks like your site's activity is a little low right now. <br />Spread the word and "
408
  "come back later!"
409
  msgstr ""
410
 
411
- #: ../src/Admin/Admin.php:1371
412
  #, php-format
413
  msgid ""
414
  "<strong>WordPress Popular Posts:</strong> It seems your site is popular (great!) You "
@@ -416,15 +470,23 @@ msgid ""
416
  "performance stays up to par."
417
  msgstr ""
418
 
419
- #: ../src/Admin/admin-page.php:6 ../src/Admin/admin-page.php:241
 
 
 
 
 
 
 
 
420
  msgid "Stats"
421
  msgstr ""
422
 
423
- #: ../src/Admin/admin-page.php:7 ../src/Admin/admin-page.php:242
424
  msgid "Tools"
425
  msgstr ""
426
 
427
- #: ../src/Admin/admin-page.php:8 ../src/Admin/admin-page.php:243
428
  msgid "Parameters"
429
  msgstr ""
430
 
@@ -437,103 +499,45 @@ msgstr ""
437
  msgid "Please provide the name of your custom field."
438
  msgstr ""
439
 
440
- #: ../src/Admin/admin-page.php:122
441
- msgid ""
442
- "This operation will delete all entries from WordPress Popular Posts' cache table and "
443
- "cannot be undone."
444
- msgstr ""
445
-
446
- #: ../src/Admin/admin-page.php:122 ../src/Admin/admin-page.php:161
447
- #: ../src/Admin/admin-page.php:200
448
- msgid "Do you want to continue?"
449
- msgstr ""
450
-
451
- #: ../src/Admin/admin-page.php:134
452
- msgid "Success! The cache table has been cleared!"
453
- msgstr ""
454
-
455
- #: ../src/Admin/admin-page.php:138
456
- msgid "Error: cache table does not exist."
457
- msgstr ""
458
-
459
- #: ../src/Admin/admin-page.php:142 ../src/Admin/admin-page.php:150
460
- #: ../src/Admin/admin-page.php:181 ../src/Admin/admin-page.php:189
461
- #: ../src/Admin/admin-page.php:219 ../src/Admin/admin-page.php:227
462
- msgid "Invalid action."
463
- msgstr ""
464
-
465
- #: ../src/Admin/admin-page.php:146 ../src/Admin/admin-page.php:185
466
- #: ../src/Admin/admin-page.php:223
467
- msgid ""
468
- "Sorry, you do not have enough permissions to do this. Please contact the site "
469
- "administrator for support."
470
- msgstr ""
471
-
472
- #: ../src/Admin/admin-page.php:161
473
- msgid ""
474
- "This operation will delete all stored info from WordPress Popular Posts' data tables "
475
- "and cannot be undone."
476
- msgstr ""
477
-
478
- #: ../src/Admin/admin-page.php:173
479
- msgid "Success! All data have been cleared!"
480
- msgstr ""
481
-
482
- #: ../src/Admin/admin-page.php:177
483
- msgid "Error: one or both data tables are missing."
484
- msgstr ""
485
-
486
- #: ../src/Admin/admin-page.php:200
487
- msgid "This operation will delete all cached thumbnails and cannot be undone."
488
- msgstr ""
489
-
490
- #: ../src/Admin/admin-page.php:211
491
- msgid "Success! All files have been deleted!"
492
- msgstr ""
493
-
494
- #: ../src/Admin/admin-page.php:215
495
- msgid "The thumbnail cache is already empty!"
496
- msgstr ""
497
-
498
- #: ../src/Admin/admin-page.php:240
499
  msgid "Menu"
500
  msgstr ""
501
 
502
- #: ../src/Admin/admin-page.php:267
503
  msgid "Post type"
504
  msgstr ""
505
 
506
- #: ../src/Admin/admin-page.php:279 ../src/Admin/admin-page.php:311
507
- #: ../src/Admin/admin-page.php:478 ../src/Admin/admin-page.php:585
508
- #: ../src/Admin/admin-page.php:631
509
  msgid "Apply"
510
  msgstr ""
511
 
512
- #: ../src/Admin/admin-page.php:280 ../src/Admin/admin-page.php:314
513
  msgid "Cancel"
514
  msgstr ""
515
 
516
- #: ../src/Admin/admin-page.php:289
517
  msgid "Custom Time Range"
518
  msgstr ""
519
 
520
- #: ../src/Admin/admin-page.php:290
521
  msgid "Date Range"
522
  msgstr ""
523
 
524
- #: ../src/Admin/admin-page.php:304
525
  msgid "Select a date..."
526
  msgstr ""
527
 
528
- #: ../src/Admin/admin-page.php:324
529
  msgid "Today"
530
  msgstr ""
531
 
532
- #: ../src/Admin/admin-page.php:325 ../src/Widget/form.php:34
533
  msgid "Last 24 hours"
534
  msgstr ""
535
 
536
- #: ../src/Admin/admin-page.php:332
537
  #, php-format
538
  msgid ""
539
  "Err... A nice little chart is supposed to be here, instead you are seeing this because "
@@ -541,196 +545,196 @@ msgid ""
541
  "browser</a>."
542
  msgstr ""
543
 
544
- #: ../src/Admin/admin-page.php:348
545
  msgid "Most viewed"
546
  msgstr ""
547
 
548
- #: ../src/Admin/admin-page.php:349
549
  msgid "Most commented"
550
  msgstr ""
551
 
552
- #: ../src/Admin/admin-page.php:351
553
  msgid "Hall of Fame"
554
  msgstr ""
555
 
556
- #: ../src/Admin/admin-page.php:391
557
  msgid "Thumbnails"
558
  msgstr ""
559
 
560
- #: ../src/Admin/admin-page.php:397
561
  msgid "Default thumbnail"
562
  msgstr ""
563
 
564
- #: ../src/Admin/admin-page.php:418
565
  msgid "Change thumbnail"
566
  msgstr ""
567
 
568
- #: ../src/Admin/admin-page.php:421
569
  msgid "This image will be displayed when no thumbnail is available"
570
  msgstr ""
571
 
572
- #: ../src/Admin/admin-page.php:425
573
  msgid "Pick image from"
574
  msgstr ""
575
 
576
- #: ../src/Admin/admin-page.php:428
577
  msgid "Featured image"
578
  msgstr ""
579
 
580
- #: ../src/Admin/admin-page.php:429
581
  msgid "First image on post"
582
  msgstr ""
583
 
584
- #: ../src/Admin/admin-page.php:430
585
  msgid "First attachment"
586
  msgstr ""
587
 
588
- #: ../src/Admin/admin-page.php:431
589
  msgid "Custom field"
590
  msgstr ""
591
 
592
- #: ../src/Admin/admin-page.php:434
593
  msgid "Tell WordPress Popular Posts where it should get thumbnails from"
594
  msgstr ""
595
 
596
- #: ../src/Admin/admin-page.php:438
597
  msgid "Lazy load"
598
  msgstr ""
599
 
600
- #: ../src/Admin/admin-page.php:438 ../src/Admin/admin-page.php:535
601
- #: ../src/Admin/admin-page.php:563 ../src/Widget/form.php:7 ../src/Widget/form.php:54
602
  #: ../src/Widget/form.php:60 ../src/Widget/form.php:88 ../src/Widget/form.php:98
603
  #: ../src/Widget/form.php:190
604
  msgid "What is this?"
605
  msgstr ""
606
 
607
- #: ../src/Admin/admin-page.php:441
608
  msgid "No"
609
  msgstr ""
610
 
611
- #: ../src/Admin/admin-page.php:442 ../src/Admin/admin-page.php:457
612
  msgid "Yes"
613
  msgstr ""
614
 
615
- #: ../src/Admin/admin-page.php:447
616
  msgid "Custom field name"
617
  msgstr ""
618
 
619
- #: ../src/Admin/admin-page.php:453
620
  msgid "Resize image from Custom field?"
621
  msgstr ""
622
 
623
- #: ../src/Admin/admin-page.php:456
624
  msgid "No, use image as is"
625
  msgstr ""
626
 
627
- #: ../src/Admin/admin-page.php:468
628
  msgid "Empty image cache"
629
  msgstr ""
630
 
631
- #: ../src/Admin/admin-page.php:469
632
  msgid "Use this button to clear WPP's thumbnails cache"
633
  msgstr ""
634
 
635
- #: ../src/Admin/admin-page.php:489
636
  msgid "Data"
637
  msgstr ""
638
 
639
- #: ../src/Admin/admin-page.php:495
640
  msgid "Log views from"
641
  msgstr ""
642
 
643
- #: ../src/Admin/admin-page.php:498
644
  msgid "Visitors only"
645
  msgstr ""
646
 
647
- #: ../src/Admin/admin-page.php:499
648
  msgid "Logged-in users only"
649
  msgstr ""
650
 
651
- #: ../src/Admin/admin-page.php:500
652
  msgid "Everyone"
653
  msgstr ""
654
 
655
- #: ../src/Admin/admin-page.php:506
656
  msgid "Log limit"
657
  msgstr ""
658
 
659
- #: ../src/Admin/admin-page.php:509 ../src/Admin/admin-page.php:526
660
- #: ../src/Admin/admin-page.php:566 ../src/Admin/admin-page.php:616
661
  msgid "Disabled"
662
  msgstr ""
663
 
664
- #: ../src/Admin/admin-page.php:510
665
  msgid "Keep data for"
666
  msgstr ""
667
 
668
- #: ../src/Admin/admin-page.php:514
669
  msgid "day(s)"
670
  msgstr ""
671
 
672
- #: ../src/Admin/admin-page.php:517
673
  msgid "Data older than the specified time frame will be automatically discarded"
674
  msgstr ""
675
 
676
- #: ../src/Admin/admin-page.php:523
677
  msgid "Ajaxify widget"
678
  msgstr ""
679
 
680
- #: ../src/Admin/admin-page.php:527 ../src/Admin/admin-page.php:567
681
- #: ../src/Admin/admin-page.php:615
682
  msgid "Enabled"
683
  msgstr ""
684
 
685
- #: ../src/Admin/admin-page.php:531
686
  msgid ""
687
  "If you are using a caching plugin such as WP Super Cache, enabling this feature will "
688
  "keep the popular list from being cached by it"
689
  msgstr ""
690
 
691
- #: ../src/Admin/admin-page.php:535
692
  msgid "Data Caching"
693
  msgstr ""
694
 
695
- #: ../src/Admin/admin-page.php:538
696
  msgid "Never cache"
697
  msgstr ""
698
 
699
- #: ../src/Admin/admin-page.php:539
700
  msgid "Enable caching"
701
  msgstr ""
702
 
703
- #: ../src/Admin/admin-page.php:543
704
  msgid ""
705
  "WPP can cache the popular list for a specified amount of time. Recommended for large / "
706
  "high traffic sites"
707
  msgstr ""
708
 
709
- #: ../src/Admin/admin-page.php:547
710
  msgid "Refresh cache every"
711
  msgstr ""
712
 
713
- #: ../src/Admin/admin-page.php:554
714
  msgid "Week(s)"
715
  msgstr ""
716
 
717
- #: ../src/Admin/admin-page.php:555
718
  msgid "Month(s)"
719
  msgstr ""
720
 
721
- #: ../src/Admin/admin-page.php:556
722
  msgid "Year(s)"
723
  msgstr ""
724
 
725
- #: ../src/Admin/admin-page.php:559
726
  msgid "Really? That long?"
727
  msgstr ""
728
 
729
- #: ../src/Admin/admin-page.php:563
730
  msgid "Data Sampling"
731
  msgstr ""
732
 
733
- #: ../src/Admin/admin-page.php:571
734
  #, php-format
735
  msgid ""
736
  "By default, WordPress Popular Posts stores in database every single visit your site "
@@ -741,49 +745,49 @@ msgid ""
741
  "(for more, <a href=\"%2$s\" target=\"_blank\">please read here</a>)"
742
  msgstr ""
743
 
744
- #: ../src/Admin/admin-page.php:575
745
  msgid "Sample Rate"
746
  msgstr ""
747
 
748
- #: ../src/Admin/admin-page.php:579
749
  #, php-format
750
  msgid ""
751
  "A sampling rate of %d is recommended for large / high traffic sites. For lower traffic "
752
  "sites, you should lower the value"
753
  msgstr ""
754
 
755
- #: ../src/Admin/admin-page.php:596
756
  msgid "Miscellaneous"
757
  msgstr ""
758
 
759
- #: ../src/Admin/admin-page.php:602
760
  msgid "Open links in"
761
  msgstr ""
762
 
763
- #: ../src/Admin/admin-page.php:605
764
  msgid "Current window"
765
  msgstr ""
766
 
767
- #: ../src/Admin/admin-page.php:606
768
  msgid "New tab/window"
769
  msgstr ""
770
 
771
- #: ../src/Admin/admin-page.php:612
772
  msgid "Use plugin's stylesheet"
773
  msgstr ""
774
 
775
- #: ../src/Admin/admin-page.php:619
776
  msgid ""
777
  "By default, the plugin includes a stylesheet called wpp.css which you can use to style "
778
  "your popular posts listing. If you wish to use your own stylesheet or do not want it "
779
  "to have it included in the header section of your site, use this."
780
  msgstr ""
781
 
782
- #: ../src/Admin/admin-page.php:623
783
  msgid "Enable experimental features"
784
  msgstr ""
785
 
786
- #: ../src/Admin/admin-page.php:645
787
  msgid ""
788
  "WordPress Popular Posts maintains data in two separate tables: one for storing the "
789
  "most popular entries on a daily basis (from now on, \"cache\"), and another one to "
@@ -792,23 +796,23 @@ msgid ""
792
  "tables, please use the buttons below to do so."
793
  msgstr ""
794
 
795
- #: ../src/Admin/admin-page.php:646
796
  msgid "Empty cache"
797
  msgstr ""
798
 
799
- #: ../src/Admin/admin-page.php:646
800
  msgid "Use this button to manually clear entries from WPP cache only"
801
  msgstr ""
802
 
803
- #: ../src/Admin/admin-page.php:647
804
  msgid "Clear all data"
805
  msgstr ""
806
 
807
- #: ../src/Admin/admin-page.php:647
808
  msgid "Use this button to manually clear entries from all WPP data tables"
809
  msgstr ""
810
 
811
- #: ../src/Admin/admin-page.php:655
812
  #, php-format
813
  msgid ""
814
  "With the following parameters you can customize the popular posts list when using "
@@ -816,370 +820,370 @@ msgid ""
816
  "\"%2$s\">[wpp] shortcode</a>."
817
  msgstr ""
818
 
819
- #: ../src/Admin/admin-page.php:665
820
  msgid "Parameter"
821
  msgstr ""
822
 
823
- #: ../src/Admin/admin-page.php:666
824
  msgid "What it does "
825
  msgstr ""
826
 
827
- #: ../src/Admin/admin-page.php:667
828
  msgid "Possible values"
829
  msgstr ""
830
 
831
- #: ../src/Admin/admin-page.php:668
832
  msgid "Defaults to"
833
  msgstr ""
834
 
835
- #: ../src/Admin/admin-page.php:669
836
  msgid "Example"
837
  msgstr ""
838
 
839
- #: ../src/Admin/admin-page.php:675
840
  msgid "Sets a heading for the list"
841
  msgstr ""
842
 
843
- #: ../src/Admin/admin-page.php:676 ../src/Admin/admin-page.php:683
844
- #: ../src/Admin/admin-page.php:690 ../src/Admin/admin-page.php:739
845
- #: ../src/Admin/admin-page.php:746 ../src/Admin/admin-page.php:753
846
- #: ../src/Admin/admin-page.php:760 ../src/Admin/admin-page.php:767
847
- #: ../src/Admin/admin-page.php:774 ../src/Admin/admin-page.php:865
848
- #: ../src/Admin/admin-page.php:886 ../src/Admin/admin-page.php:893
849
  msgid "Text string"
850
  msgstr ""
851
 
852
- #: ../src/Admin/admin-page.php:678 ../src/Admin/admin-page.php:685
853
- #: ../src/Admin/admin-page.php:692 ../src/Admin/admin-page.php:699
854
- #: ../src/Admin/admin-page.php:706 ../src/Admin/admin-page.php:713
855
- #: ../src/Admin/admin-page.php:720 ../src/Admin/admin-page.php:727
856
- #: ../src/Admin/admin-page.php:734 ../src/Admin/admin-page.php:741
857
- #: ../src/Admin/admin-page.php:748 ../src/Admin/admin-page.php:755
858
- #: ../src/Admin/admin-page.php:762 ../src/Admin/admin-page.php:769
859
- #: ../src/Admin/admin-page.php:776 ../src/Admin/admin-page.php:783
860
- #: ../src/Admin/admin-page.php:790 ../src/Admin/admin-page.php:797
861
- #: ../src/Admin/admin-page.php:804 ../src/Admin/admin-page.php:811
862
- #: ../src/Admin/admin-page.php:818 ../src/Admin/admin-page.php:825
863
- #: ../src/Admin/admin-page.php:832 ../src/Admin/admin-page.php:839
864
- #: ../src/Admin/admin-page.php:846 ../src/Admin/admin-page.php:853
865
- #: ../src/Admin/admin-page.php:860 ../src/Admin/admin-page.php:867
866
- #: ../src/Admin/admin-page.php:874 ../src/Admin/admin-page.php:881
867
- #: ../src/Admin/admin-page.php:888 ../src/Admin/admin-page.php:895
868
- #: ../src/Admin/admin-page.php:902
869
  msgid "With wpp_get_mostpopular():"
870
  msgstr ""
871
 
872
- #: ../src/Admin/admin-page.php:678 ../src/Admin/admin-page.php:685
873
- #: ../src/Admin/admin-page.php:692 ../src/Admin/admin-page.php:699
874
- #: ../src/Admin/admin-page.php:706 ../src/Admin/admin-page.php:713
875
- #: ../src/Admin/admin-page.php:720 ../src/Admin/admin-page.php:727
876
- #: ../src/Admin/admin-page.php:734 ../src/Admin/admin-page.php:741
877
- #: ../src/Admin/admin-page.php:748 ../src/Admin/admin-page.php:755
878
- #: ../src/Admin/admin-page.php:762 ../src/Admin/admin-page.php:769
879
- #: ../src/Admin/admin-page.php:776 ../src/Admin/admin-page.php:783
880
- #: ../src/Admin/admin-page.php:790 ../src/Admin/admin-page.php:797
881
- #: ../src/Admin/admin-page.php:804 ../src/Admin/admin-page.php:811
882
- #: ../src/Admin/admin-page.php:818 ../src/Admin/admin-page.php:825
883
- #: ../src/Admin/admin-page.php:832 ../src/Admin/admin-page.php:839
884
- #: ../src/Admin/admin-page.php:846 ../src/Admin/admin-page.php:853
885
- #: ../src/Admin/admin-page.php:860 ../src/Admin/admin-page.php:867
886
- #: ../src/Admin/admin-page.php:874 ../src/Admin/admin-page.php:881
887
- #: ../src/Admin/admin-page.php:888 ../src/Admin/admin-page.php:895
888
- #: ../src/Admin/admin-page.php:902
889
  msgid "With the [wpp] shortcode:"
890
  msgstr ""
891
 
892
- #: ../src/Admin/admin-page.php:682
893
  msgid "Set the opening tag for the heading of the list"
894
  msgstr ""
895
 
896
- #: ../src/Admin/admin-page.php:689
897
  msgid "Set the closing tag for the heading of the list"
898
  msgstr ""
899
 
900
- #: ../src/Admin/admin-page.php:696
901
  msgid "Sets the maximum number of popular posts to be shown on the listing"
902
  msgstr ""
903
 
904
- #: ../src/Admin/admin-page.php:697 ../src/Admin/admin-page.php:711
905
- #: ../src/Admin/admin-page.php:781 ../src/Admin/admin-page.php:795
906
- #: ../src/Admin/admin-page.php:816 ../src/Admin/admin-page.php:823
907
  msgid "Positive integer"
908
  msgstr ""
909
 
910
- #: ../src/Admin/admin-page.php:703
911
  msgid ""
912
  "Tells WordPress Popular Posts to retrieve the most popular entries within the time "
913
  "range specified by you"
914
  msgstr ""
915
 
916
- #: ../src/Admin/admin-page.php:710
917
  msgid "Especifies the number of time units of the custom time range"
918
  msgstr ""
919
 
920
- #: ../src/Admin/admin-page.php:717
921
  msgid "Especifies the time unit of the custom time range"
922
  msgstr ""
923
 
924
- #: ../src/Admin/admin-page.php:724
925
  msgid ""
926
  "Tells WordPress Popular Posts to retrieve the most popular entries published within "
927
  "the time range specified by you"
928
  msgstr ""
929
 
930
- #: ../src/Admin/admin-page.php:731
931
  msgid "Sets the sorting option of the popular posts"
932
  msgstr ""
933
 
934
- #: ../src/Admin/admin-page.php:732
935
  msgid "(for average views per day)"
936
  msgstr ""
937
 
938
- #: ../src/Admin/admin-page.php:738
939
  msgid "Defines the type of posts to show on the listing"
940
  msgstr ""
941
 
942
- #: ../src/Admin/admin-page.php:745
943
  msgid ""
944
  "If set, WordPress Popular Posts will exclude the specified post(s) ID(s) form the "
945
  "listing."
946
  msgstr ""
947
 
948
- #: ../src/Admin/admin-page.php:752
949
  msgid ""
950
  "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
951
  "category ID(s). If a minus sign is used, entries associated to the category will be "
952
  "excluded instead."
953
  msgstr ""
954
 
955
- #: ../src/Admin/admin-page.php:759
956
  msgid "If set, WordPress Popular Posts will filter posts by a given taxonomy."
957
  msgstr ""
958
 
959
- #: ../src/Admin/admin-page.php:766
960
  msgid ""
961
  "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
962
  "term ID(s). If a minus sign is used, entries associated to the term(s) will be "
963
  "excluded instead."
964
  msgstr ""
965
 
966
- #: ../src/Admin/admin-page.php:773
967
  msgid ""
968
  "If set, WordPress Popular Posts will retrieve all entries created by specified "
969
  "author(s) ID(s)."
970
  msgstr ""
971
 
972
- #: ../src/Admin/admin-page.php:780
973
  msgid ""
974
  "If set, WordPress Popular Posts will shorten each post title to \"n\" characters "
975
  "whenever possible"
976
  msgstr ""
977
 
978
- #: ../src/Admin/admin-page.php:787
979
  msgid ""
980
  "If set to 1, WordPress Popular Posts will shorten each post title to \"n\" words "
981
  "instead of characters"
982
  msgstr ""
983
 
984
- #: ../src/Admin/admin-page.php:794
985
  msgid ""
986
  "If set, WordPress Popular Posts will build and include an excerpt of \"n\" characters "
987
  "long from the content of each post listed as popular"
988
  msgstr ""
989
 
990
- #: ../src/Admin/admin-page.php:801
991
  msgid ""
992
  "If set, WordPress Popular Posts will maintaing all styling tags (strong, italic, etc) "
993
  "and hyperlinks found in the excerpt"
994
  msgstr ""
995
 
996
- #: ../src/Admin/admin-page.php:808
997
  msgid ""
998
  "If set to 1, WordPress Popular Posts will shorten the excerpt to \"n\" words instead "
999
  "of characters"
1000
  msgstr ""
1001
 
1002
- #: ../src/Admin/admin-page.php:815
1003
  msgid ""
1004
  "If set, and if your current server configuration allows it, you will be able to "
1005
  "display thumbnails of your posts. This attribute sets the width for thumbnails"
1006
  msgstr ""
1007
 
1008
- #: ../src/Admin/admin-page.php:822
1009
  msgid ""
1010
  "If set, and if your current server configuration allows it, you will be able to "
1011
  "display thumbnails of your posts. This attribute sets the height for thumbnails"
1012
  msgstr ""
1013
 
1014
- #: ../src/Admin/admin-page.php:829
1015
  msgid ""
1016
  "If set, and if the WP-PostRatings plugin is installed and enabled on your blog, "
1017
  "WordPress Popular Posts will show how your visitors are rating your entries"
1018
  msgstr ""
1019
 
1020
- #: ../src/Admin/admin-page.php:836
1021
  msgid ""
1022
  "If set, WordPress Popular Posts will show how many comments each popular post has got "
1023
  "during the specified time range"
1024
  msgstr ""
1025
 
1026
- #: ../src/Admin/admin-page.php:843
1027
  msgid ""
1028
  "If set, WordPress Popular Posts will show how many views each popular post has got "
1029
  "during the specified time range"
1030
  msgstr ""
1031
 
1032
- #: ../src/Admin/admin-page.php:850
1033
  msgid ""
1034
  "If set, WordPress Popular Posts will show who published each popular post on the list"
1035
  msgstr ""
1036
 
1037
- #: ../src/Admin/admin-page.php:857
1038
  msgid ""
1039
  "If set, WordPress Popular Posts will display the date when each popular post on the "
1040
  "list was published"
1041
  msgstr ""
1042
 
1043
- #: ../src/Admin/admin-page.php:864
1044
  msgid "Sets the date format"
1045
  msgstr ""
1046
 
1047
- #: ../src/Admin/admin-page.php:871
1048
  msgid ""
1049
  "If set, WordPress Popular Posts will display the categories associated to each entry"
1050
  msgstr ""
1051
 
1052
- #: ../src/Admin/admin-page.php:878
1053
  msgid ""
1054
  "If set, WordPress Popular Posts will display the taxonomies associated to each entry"
1055
  msgstr ""
1056
 
1057
- #: ../src/Admin/admin-page.php:885
1058
  msgid "Sets the opening tag for the listing"
1059
  msgstr ""
1060
 
1061
- #: ../src/Admin/admin-page.php:892
1062
  msgid "Sets the closing tag for the listing"
1063
  msgstr ""
1064
 
1065
- #: ../src/Admin/admin-page.php:899
1066
  msgid "Sets the HTML structure of each post"
1067
  msgstr ""
1068
 
1069
- #: ../src/Admin/admin-page.php:900
1070
  msgid "Text string, custom HTML"
1071
  msgstr ""
1072
 
1073
- #: ../src/Admin/admin-page.php:900
1074
  msgid "Available Content Tags"
1075
  msgstr ""
1076
 
1077
- #: ../src/Admin/admin-page.php:900
1078
  msgid ""
1079
  "returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height"
1080
  msgstr ""
1081
 
1082
- #: ../src/Admin/admin-page.php:900
1083
  msgid ""
1084
  "returns thumbnail image without linking to post/page, requires thumbnail_width & "
1085
  "thumbnail_height"
1086
  msgstr ""
1087
 
1088
- #: ../src/Admin/admin-page.php:900
1089
  msgid "returns thumbnail url, requires thumbnail_width & thumbnail_height"
1090
  msgstr ""
1091
 
1092
- #: ../src/Admin/admin-page.php:900
1093
  msgid "returns linked post/page title"
1094
  msgstr ""
1095
 
1096
- #: ../src/Admin/admin-page.php:900
1097
  msgid "returns the post/page ID"
1098
  msgstr ""
1099
 
1100
- #: ../src/Admin/admin-page.php:900
1101
  msgid "returns post/page excerpt, and requires excerpt_length to be greater than 0"
1102
  msgstr ""
1103
 
1104
- #: ../src/Admin/admin-page.php:900
1105
  msgid "returns the default stats tags"
1106
  msgstr ""
1107
 
1108
- #: ../src/Admin/admin-page.php:900
1109
  msgid "returns post/page current rating, requires WP-PostRatings installed and enabled"
1110
  msgstr ""
1111
 
1112
- #: ../src/Admin/admin-page.php:900
1113
  msgid ""
1114
  "returns post/page current rating as an integer, requires WP-PostRatings installed and "
1115
  "enabled"
1116
  msgstr ""
1117
 
1118
- #: ../src/Admin/admin-page.php:900
1119
  msgid "returns the URL of the post/page"
1120
  msgstr ""
1121
 
1122
- #: ../src/Admin/admin-page.php:900
1123
  msgid "returns post/page title, no link"
1124
  msgstr ""
1125
 
1126
- #: ../src/Admin/admin-page.php:900
1127
  msgid "similar to text_title, sanitized for use in title/alt attributes"
1128
  msgstr ""
1129
 
1130
- #: ../src/Admin/admin-page.php:900
1131
  msgid "returns linked author name, requires stats_author=1"
1132
  msgstr ""
1133
 
1134
- #: ../src/Admin/admin-page.php:900
1135
  msgid "returns linked author name with copy, requires stats_author=1"
1136
  msgstr ""
1137
 
1138
- #: ../src/Admin/admin-page.php:900
1139
  msgid "returns linked category name, requires stats_category=1"
1140
  msgstr ""
1141
 
1142
- #: ../src/Admin/admin-page.php:900
1143
  msgid "returns linked category name with copy, requires stats_category=1"
1144
  msgstr ""
1145
 
1146
- #: ../src/Admin/admin-page.php:900
1147
  msgid "returns linked taxonomy names, requires stats_taxonomy=1"
1148
  msgstr ""
1149
 
1150
- #: ../src/Admin/admin-page.php:900
1151
  msgid "returns linked taxonomy names with copy, requires stats_taxonomy=1"
1152
  msgstr ""
1153
 
1154
- #: ../src/Admin/admin-page.php:900
1155
  msgid "returns views count only, no text, requires stats_views=1"
1156
  msgstr ""
1157
 
1158
- #: ../src/Admin/admin-page.php:900
1159
  msgid "returns views count with copy, requires stats_views=1"
1160
  msgstr ""
1161
 
1162
- #: ../src/Admin/admin-page.php:900
1163
  msgid "returns comments count only, no text, requires stats_comments=1"
1164
  msgstr ""
1165
 
1166
- #: ../src/Admin/admin-page.php:900
1167
  msgid "returns comments count with copy, requires stats_comments=1"
1168
  msgstr ""
1169
 
1170
- #: ../src/Admin/admin-page.php:900
1171
  msgid "returns post/page date, requires stats_date=1"
1172
  msgstr ""
1173
 
1174
- #: ../src/Admin/admin-page.php:900
1175
  msgid "returns post/page date with copy, requires stats_date=1"
1176
  msgstr ""
1177
 
1178
- #: ../src/Admin/admin-page.php:900
1179
  msgid "outputs number of popular posts found"
1180
  msgstr ""
1181
 
1182
- #: ../src/Admin/admin-page.php:900
1183
  msgid "outputs the position of the post in the listing"
1184
  msgstr ""
1185
 
@@ -1187,38 +1191,38 @@ msgstr ""
1187
  msgid "A highly customizable block that displays your most popular posts."
1188
  msgstr ""
1189
 
1190
- #: ../src/Output.php:271
1191
  msgid "Sorry. No data so far."
1192
  msgstr ""
1193
 
1194
- #: ../src/Output.php:612
1195
  #, php-format
1196
  msgid "%s ago"
1197
  msgstr ""
1198
 
1199
- #: ../src/Output.php:775
1200
  #, php-format
1201
  msgid "%s view per day"
1202
  msgid_plural "%s views per day"
1203
  msgstr[0] ""
1204
  msgstr[1] ""
1205
 
1206
- #: ../src/Output.php:793
1207
  #, php-format
1208
  msgid "by %s"
1209
  msgstr ""
1210
 
1211
- #: ../src/Output.php:798
1212
  #, php-format
1213
  msgid "posted %s"
1214
  msgstr ""
1215
 
1216
- #: ../src/Output.php:798
1217
  #, php-format
1218
  msgid "posted on %s"
1219
  msgstr ""
1220
 
1221
- #: ../src/Output.php:803
1222
  #, php-format
1223
  msgid "under %s"
1224
  msgstr ""
@@ -1287,7 +1291,7 @@ msgstr ""
1287
  msgid "Sets the Sampling Rate."
1288
  msgstr ""
1289
 
1290
- #: ../src/Rest/WidgetEndpoint.php:66
1291
  msgid "Invalid Widget Instance ID"
1292
  msgstr ""
1293
 
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: 2021-08-19 11:59-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"
26
  msgid "Preview"
27
  msgstr ""
28
 
29
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/Admin.php:1139
30
  #: ../src/Block/Widget/edit.js:125
31
  msgid "Edit"
32
  msgstr ""
36
  msgid "Title"
37
  msgstr ""
38
 
39
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:143
40
  #: ../src/Block/Widget/edit.js:181
41
  msgid "Limit"
42
  msgstr ""
51
  msgid "Total views"
52
  msgstr ""
53
 
54
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/Admin.php:765
55
  #: ../src/Block/Widget/edit.js:190 ../src/Widget/form.php:21
56
  msgid "Comments"
57
  msgstr ""
65
  msgid "Last 24 Hours"
66
  msgstr ""
67
 
68
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:199
69
  #: ../src/Block/Widget/edit.js:199 ../src/Widget/form.php:35
70
  msgid "Last 7 days"
71
  msgstr ""
72
 
73
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:200
74
  #: ../src/Block/Widget/edit.js:200 ../src/Widget/form.php:36
75
  msgid "Last 30 days"
76
  msgstr ""
80
  msgid "All-time"
81
  msgstr ""
82
 
83
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:201
84
  #: ../src/Block/Widget/edit.js:202 ../src/Widget/form.php:38
85
  msgid "Custom"
86
  msgstr ""
93
  msgid "Time Unit"
94
  msgstr ""
95
 
96
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:170
97
+ #: ../src/Admin/admin-page.php:417 ../src/Block/Widget/edit.js:217
98
  #: ../src/Widget/form.php:45
99
  msgid "Minute(s)"
100
  msgstr ""
101
 
102
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:171
103
+ #: ../src/Admin/admin-page.php:418 ../src/Block/Widget/edit.js:218
104
  #: ../src/Widget/form.php:46
105
  msgid "Hour(s)"
106
  msgstr ""
107
 
108
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:172
109
+ #: ../src/Admin/admin-page.php:419 ../src/Block/Widget/edit.js:219
110
  #: ../src/Widget/form.php:47
111
  msgid "Day(s)"
112
  msgstr ""
113
 
114
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:146
115
  #: ../src/Block/Widget/edit.js:226 ../src/Widget/form.php:52
116
  msgid "Display only posts published within the selected Time Range"
117
  msgstr ""
277
  msgid "Taxonomy"
278
  msgstr ""
279
 
280
+ #: ../assets/js/blocks/block-wpp-widget.js:1 ../src/Admin/admin-page.php:543
281
+ #: ../src/Admin/admin-page.php:613 ../src/Admin/admin-page.php:620
282
+ #: ../src/Admin/admin-page.php:627 ../src/Admin/admin-page.php:634
283
+ #: ../src/Admin/admin-page.php:641 ../src/Block/Widget/edit.js:652
284
  #: ../src/Widget/form.php:226
285
  msgid "None"
286
  msgstr ""
327
  msgstr[0] ""
328
  msgstr[1] ""
329
 
330
+ #: ../src/Admin/Admin.php:405 ../src/Admin/admin-page.php:216
331
  msgid "Trending now"
332
  msgstr ""
333
 
339
  msgid "Use this image"
340
  msgstr ""
341
 
342
+ #: ../src/Admin/Admin.php:526
343
+ msgid ""
344
+ "This operation will delete all entries from WordPress Popular Posts' cache table and "
345
+ "cannot be undone."
346
+ msgstr ""
347
+
348
+ #: ../src/Admin/Admin.php:527
349
+ msgid "Success! The cache table has been cleared!"
350
+ msgstr ""
351
+
352
+ #: ../src/Admin/Admin.php:528
353
+ msgid "Error: cache table does not exist."
354
+ msgstr ""
355
+
356
+ #: ../src/Admin/Admin.php:529
357
+ msgid ""
358
+ "This operation will delete all stored info from WordPress Popular Posts' data tables "
359
+ "and cannot be undone."
360
+ msgstr ""
361
+
362
+ #: ../src/Admin/Admin.php:530
363
+ msgid "Success! All data have been cleared!"
364
+ msgstr ""
365
+
366
+ #: ../src/Admin/Admin.php:531
367
+ msgid "Error: one or both data tables are missing."
368
+ msgstr ""
369
+
370
+ #: ../src/Admin/Admin.php:532
371
+ msgid "This operation will delete all cached thumbnails and cannot be undone."
372
+ msgstr ""
373
+
374
+ #: ../src/Admin/Admin.php:533
375
+ msgid "Success! All files have been deleted!"
376
+ msgstr ""
377
+
378
+ #: ../src/Admin/Admin.php:534
379
+ msgid "The thumbnail cache is already empty!"
380
+ msgstr ""
381
+
382
+ #: ../src/Admin/Admin.php:535
383
+ msgid "Do you want to continue?"
384
+ msgstr ""
385
+
386
+ #: ../src/Admin/Admin.php:536
387
+ msgid ""
388
+ "Sorry, you do not have enough permissions to do this. Please contact the site "
389
+ "administrator for support."
390
+ msgstr ""
391
+
392
+ #: ../src/Admin/Admin.php:537
393
+ msgid "Invalid action."
394
+ msgstr ""
395
+
396
+ #: ../src/Admin/Admin.php:616
397
  msgid "Overview"
398
  msgstr ""
399
 
400
+ #: ../src/Admin/Admin.php:617
401
  msgid ""
402
  "Welcome to WordPress Popular Posts' Dashboard! In this screen you will find statistics "
403
  "on what's popular on your site, tools to further tweak WPP to your needs, and more!"
404
  msgstr ""
405
 
406
+ #: ../src/Admin/Admin.php:623
407
  msgid "Like this plugin?"
408
  msgstr ""
409
 
410
+ #: ../src/Admin/Admin.php:625
411
  msgid ""
412
  "Each donation motivates me to keep releasing free stuff for the WordPress community!"
413
  msgstr ""
414
 
415
+ #: ../src/Admin/Admin.php:632
416
  #, php-format
417
  msgid "You can <a href=\"%s\" target=\"_blank\">leave a review</a>, too!"
418
  msgstr ""
419
 
420
+ #: ../src/Admin/Admin.php:639
421
  #, php-format
422
  msgid ""
423
  "<p><strong>For more information:</strong></p><ul><li><a href=\"%1$s\">Documentation</"
424
  "a></li><li><a href=\"%2$s\">Support</a></li></ul>"
425
  msgstr ""
426
 
427
+ #: ../src/Admin/Admin.php:665
428
  msgid "Settings"
429
  msgstr ""
430
 
431
+ #: ../src/Admin/Admin.php:666
432
  msgid "Support"
433
  msgstr ""
434
 
435
+ #: ../src/Admin/Admin.php:744 ../src/Admin/Admin.php:1133 ../src/Admin/Admin.php:1137
436
+ #: ../src/Output.php:760
437
  #, php-format
438
  msgid "%s view"
439
  msgid_plural "%s views"
440
  msgstr[0] ""
441
  msgstr[1] ""
442
 
443
+ #: ../src/Admin/Admin.php:744 ../src/Admin/Admin.php:1135 ../src/Admin/Admin.php:1137
444
+ #: ../src/Output.php:743
445
  #, php-format
446
  msgid "%s comment"
447
  msgid_plural "%s comments"
448
  msgstr[0] ""
449
  msgstr[1] ""
450
 
451
+ #: ../src/Admin/Admin.php:769
452
  msgid "Views"
453
  msgstr ""
454
 
455
+ #: ../src/Admin/Admin.php:1139
456
  msgid "View"
457
  msgstr ""
458
 
459
+ #: ../src/Admin/Admin.php:1150
460
  msgid ""
461
  "Looks like your site's activity is a little low right now. <br />Spread the word and "
462
  "come back later!"
463
  msgstr ""
464
 
465
+ #: ../src/Admin/Admin.php:1396
466
  #, php-format
467
  msgid ""
468
  "<strong>WordPress Popular Posts:</strong> It seems your site is popular (great!) You "
470
  "performance stays up to par."
471
  msgstr ""
472
 
473
+ #: ../src/Admin/Admin.php:1400
474
+ msgid "Dismiss"
475
+ msgstr ""
476
+
477
+ #: ../src/Admin/Admin.php:1400
478
+ msgid "Remind me later"
479
+ msgstr ""
480
+
481
+ #: ../src/Admin/admin-page.php:6 ../src/Admin/admin-page.php:114
482
  msgid "Stats"
483
  msgstr ""
484
 
485
+ #: ../src/Admin/admin-page.php:7 ../src/Admin/admin-page.php:115
486
  msgid "Tools"
487
  msgstr ""
488
 
489
+ #: ../src/Admin/admin-page.php:8 ../src/Admin/admin-page.php:116
490
  msgid "Parameters"
491
  msgstr ""
492
 
499
  msgid "Please provide the name of your custom field."
500
  msgstr ""
501
 
502
+ #: ../src/Admin/admin-page.php:113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  msgid "Menu"
504
  msgstr ""
505
 
506
+ #: ../src/Admin/admin-page.php:140
507
  msgid "Post type"
508
  msgstr ""
509
 
510
+ #: ../src/Admin/admin-page.php:152 ../src/Admin/admin-page.php:184
511
+ #: ../src/Admin/admin-page.php:344 ../src/Admin/admin-page.php:451
512
+ #: ../src/Admin/admin-page.php:497
513
  msgid "Apply"
514
  msgstr ""
515
 
516
+ #: ../src/Admin/admin-page.php:153 ../src/Admin/admin-page.php:187
517
  msgid "Cancel"
518
  msgstr ""
519
 
520
+ #: ../src/Admin/admin-page.php:162
521
  msgid "Custom Time Range"
522
  msgstr ""
523
 
524
+ #: ../src/Admin/admin-page.php:163
525
  msgid "Date Range"
526
  msgstr ""
527
 
528
+ #: ../src/Admin/admin-page.php:177
529
  msgid "Select a date..."
530
  msgstr ""
531
 
532
+ #: ../src/Admin/admin-page.php:197
533
  msgid "Today"
534
  msgstr ""
535
 
536
+ #: ../src/Admin/admin-page.php:198 ../src/Widget/form.php:34
537
  msgid "Last 24 hours"
538
  msgstr ""
539
 
540
+ #: ../src/Admin/admin-page.php:205
541
  #, php-format
542
  msgid ""
543
  "Err... A nice little chart is supposed to be here, instead you are seeing this because "
545
  "browser</a>."
546
  msgstr ""
547
 
548
+ #: ../src/Admin/admin-page.php:214
549
  msgid "Most viewed"
550
  msgstr ""
551
 
552
+ #: ../src/Admin/admin-page.php:215
553
  msgid "Most commented"
554
  msgstr ""
555
 
556
+ #: ../src/Admin/admin-page.php:217
557
  msgid "Hall of Fame"
558
  msgstr ""
559
 
560
+ #: ../src/Admin/admin-page.php:257
561
  msgid "Thumbnails"
562
  msgstr ""
563
 
564
+ #: ../src/Admin/admin-page.php:263
565
  msgid "Default thumbnail"
566
  msgstr ""
567
 
568
+ #: ../src/Admin/admin-page.php:284
569
  msgid "Change thumbnail"
570
  msgstr ""
571
 
572
+ #: ../src/Admin/admin-page.php:287
573
  msgid "This image will be displayed when no thumbnail is available"
574
  msgstr ""
575
 
576
+ #: ../src/Admin/admin-page.php:291
577
  msgid "Pick image from"
578
  msgstr ""
579
 
580
+ #: ../src/Admin/admin-page.php:294
581
  msgid "Featured image"
582
  msgstr ""
583
 
584
+ #: ../src/Admin/admin-page.php:295
585
  msgid "First image on post"
586
  msgstr ""
587
 
588
+ #: ../src/Admin/admin-page.php:296
589
  msgid "First attachment"
590
  msgstr ""
591
 
592
+ #: ../src/Admin/admin-page.php:297
593
  msgid "Custom field"
594
  msgstr ""
595
 
596
+ #: ../src/Admin/admin-page.php:300
597
  msgid "Tell WordPress Popular Posts where it should get thumbnails from"
598
  msgstr ""
599
 
600
+ #: ../src/Admin/admin-page.php:304
601
  msgid "Lazy load"
602
  msgstr ""
603
 
604
+ #: ../src/Admin/admin-page.php:304 ../src/Admin/admin-page.php:401
605
+ #: ../src/Admin/admin-page.php:429 ../src/Widget/form.php:7 ../src/Widget/form.php:54
606
  #: ../src/Widget/form.php:60 ../src/Widget/form.php:88 ../src/Widget/form.php:98
607
  #: ../src/Widget/form.php:190
608
  msgid "What is this?"
609
  msgstr ""
610
 
611
+ #: ../src/Admin/admin-page.php:307
612
  msgid "No"
613
  msgstr ""
614
 
615
+ #: ../src/Admin/admin-page.php:308 ../src/Admin/admin-page.php:323
616
  msgid "Yes"
617
  msgstr ""
618
 
619
+ #: ../src/Admin/admin-page.php:313
620
  msgid "Custom field name"
621
  msgstr ""
622
 
623
+ #: ../src/Admin/admin-page.php:319
624
  msgid "Resize image from Custom field?"
625
  msgstr ""
626
 
627
+ #: ../src/Admin/admin-page.php:322
628
  msgid "No, use image as is"
629
  msgstr ""
630
 
631
+ #: ../src/Admin/admin-page.php:334
632
  msgid "Empty image cache"
633
  msgstr ""
634
 
635
+ #: ../src/Admin/admin-page.php:335
636
  msgid "Use this button to clear WPP's thumbnails cache"
637
  msgstr ""
638
 
639
+ #: ../src/Admin/admin-page.php:355
640
  msgid "Data"
641
  msgstr ""
642
 
643
+ #: ../src/Admin/admin-page.php:361
644
  msgid "Log views from"
645
  msgstr ""
646
 
647
+ #: ../src/Admin/admin-page.php:364
648
  msgid "Visitors only"
649
  msgstr ""
650
 
651
+ #: ../src/Admin/admin-page.php:365
652
  msgid "Logged-in users only"
653
  msgstr ""
654
 
655
+ #: ../src/Admin/admin-page.php:366
656
  msgid "Everyone"
657
  msgstr ""
658
 
659
+ #: ../src/Admin/admin-page.php:372
660
  msgid "Log limit"
661
  msgstr ""
662
 
663
+ #: ../src/Admin/admin-page.php:375 ../src/Admin/admin-page.php:392
664
+ #: ../src/Admin/admin-page.php:432 ../src/Admin/admin-page.php:482
665
  msgid "Disabled"
666
  msgstr ""
667
 
668
+ #: ../src/Admin/admin-page.php:376
669
  msgid "Keep data for"
670
  msgstr ""
671
 
672
+ #: ../src/Admin/admin-page.php:380
673
  msgid "day(s)"
674
  msgstr ""
675
 
676
+ #: ../src/Admin/admin-page.php:383
677
  msgid "Data older than the specified time frame will be automatically discarded"
678
  msgstr ""
679
 
680
+ #: ../src/Admin/admin-page.php:389
681
  msgid "Ajaxify widget"
682
  msgstr ""
683
 
684
+ #: ../src/Admin/admin-page.php:393 ../src/Admin/admin-page.php:433
685
+ #: ../src/Admin/admin-page.php:481
686
  msgid "Enabled"
687
  msgstr ""
688
 
689
+ #: ../src/Admin/admin-page.php:397
690
  msgid ""
691
  "If you are using a caching plugin such as WP Super Cache, enabling this feature will "
692
  "keep the popular list from being cached by it"
693
  msgstr ""
694
 
695
+ #: ../src/Admin/admin-page.php:401
696
  msgid "Data Caching"
697
  msgstr ""
698
 
699
+ #: ../src/Admin/admin-page.php:404
700
  msgid "Never cache"
701
  msgstr ""
702
 
703
+ #: ../src/Admin/admin-page.php:405
704
  msgid "Enable caching"
705
  msgstr ""
706
 
707
+ #: ../src/Admin/admin-page.php:409
708
  msgid ""
709
  "WPP can cache the popular list for a specified amount of time. Recommended for large / "
710
  "high traffic sites"
711
  msgstr ""
712
 
713
+ #: ../src/Admin/admin-page.php:413
714
  msgid "Refresh cache every"
715
  msgstr ""
716
 
717
+ #: ../src/Admin/admin-page.php:420
718
  msgid "Week(s)"
719
  msgstr ""
720
 
721
+ #: ../src/Admin/admin-page.php:421
722
  msgid "Month(s)"
723
  msgstr ""
724
 
725
+ #: ../src/Admin/admin-page.php:422
726
  msgid "Year(s)"
727
  msgstr ""
728
 
729
+ #: ../src/Admin/admin-page.php:425
730
  msgid "Really? That long?"
731
  msgstr ""
732
 
733
+ #: ../src/Admin/admin-page.php:429
734
  msgid "Data Sampling"
735
  msgstr ""
736
 
737
+ #: ../src/Admin/admin-page.php:437
738
  #, php-format
739
  msgid ""
740
  "By default, WordPress Popular Posts stores in database every single visit your site "
745
  "(for more, <a href=\"%2$s\" target=\"_blank\">please read here</a>)"
746
  msgstr ""
747
 
748
+ #: ../src/Admin/admin-page.php:441
749
  msgid "Sample Rate"
750
  msgstr ""
751
 
752
+ #: ../src/Admin/admin-page.php:445
753
  #, php-format
754
  msgid ""
755
  "A sampling rate of %d is recommended for large / high traffic sites. For lower traffic "
756
  "sites, you should lower the value"
757
  msgstr ""
758
 
759
+ #: ../src/Admin/admin-page.php:462
760
  msgid "Miscellaneous"
761
  msgstr ""
762
 
763
+ #: ../src/Admin/admin-page.php:468
764
  msgid "Open links in"
765
  msgstr ""
766
 
767
+ #: ../src/Admin/admin-page.php:471
768
  msgid "Current window"
769
  msgstr ""
770
 
771
+ #: ../src/Admin/admin-page.php:472
772
  msgid "New tab/window"
773
  msgstr ""
774
 
775
+ #: ../src/Admin/admin-page.php:478
776
  msgid "Use plugin's stylesheet"
777
  msgstr ""
778
 
779
+ #: ../src/Admin/admin-page.php:485
780
  msgid ""
781
  "By default, the plugin includes a stylesheet called wpp.css which you can use to style "
782
  "your popular posts listing. If you wish to use your own stylesheet or do not want it "
783
  "to have it included in the header section of your site, use this."
784
  msgstr ""
785
 
786
+ #: ../src/Admin/admin-page.php:489
787
  msgid "Enable experimental features"
788
  msgstr ""
789
 
790
+ #: ../src/Admin/admin-page.php:511
791
  msgid ""
792
  "WordPress Popular Posts maintains data in two separate tables: one for storing the "
793
  "most popular entries on a daily basis (from now on, \"cache\"), and another one to "
796
  "tables, please use the buttons below to do so."
797
  msgstr ""
798
 
799
+ #: ../src/Admin/admin-page.php:512
800
  msgid "Empty cache"
801
  msgstr ""
802
 
803
+ #: ../src/Admin/admin-page.php:512
804
  msgid "Use this button to manually clear entries from WPP cache only"
805
  msgstr ""
806
 
807
+ #: ../src/Admin/admin-page.php:513
808
  msgid "Clear all data"
809
  msgstr ""
810
 
811
+ #: ../src/Admin/admin-page.php:513
812
  msgid "Use this button to manually clear entries from all WPP data tables"
813
  msgstr ""
814
 
815
+ #: ../src/Admin/admin-page.php:521
816
  #, php-format
817
  msgid ""
818
  "With the following parameters you can customize the popular posts list when using "
820
  "\"%2$s\">[wpp] shortcode</a>."
821
  msgstr ""
822
 
823
+ #: ../src/Admin/admin-page.php:531
824
  msgid "Parameter"
825
  msgstr ""
826
 
827
+ #: ../src/Admin/admin-page.php:532
828
  msgid "What it does "
829
  msgstr ""
830
 
831
+ #: ../src/Admin/admin-page.php:533
832
  msgid "Possible values"
833
  msgstr ""
834
 
835
+ #: ../src/Admin/admin-page.php:534
836
  msgid "Defaults to"
837
  msgstr ""
838
 
839
+ #: ../src/Admin/admin-page.php:535
840
  msgid "Example"
841
  msgstr ""
842
 
843
+ #: ../src/Admin/admin-page.php:541
844
  msgid "Sets a heading for the list"
845
  msgstr ""
846
 
847
+ #: ../src/Admin/admin-page.php:542 ../src/Admin/admin-page.php:549
848
+ #: ../src/Admin/admin-page.php:556 ../src/Admin/admin-page.php:605
849
+ #: ../src/Admin/admin-page.php:612 ../src/Admin/admin-page.php:619
850
+ #: ../src/Admin/admin-page.php:626 ../src/Admin/admin-page.php:633
851
+ #: ../src/Admin/admin-page.php:640 ../src/Admin/admin-page.php:731
852
+ #: ../src/Admin/admin-page.php:752 ../src/Admin/admin-page.php:759
853
  msgid "Text string"
854
  msgstr ""
855
 
856
+ #: ../src/Admin/admin-page.php:544 ../src/Admin/admin-page.php:551
857
+ #: ../src/Admin/admin-page.php:558 ../src/Admin/admin-page.php:565
858
+ #: ../src/Admin/admin-page.php:572 ../src/Admin/admin-page.php:579
859
+ #: ../src/Admin/admin-page.php:586 ../src/Admin/admin-page.php:593
860
+ #: ../src/Admin/admin-page.php:600 ../src/Admin/admin-page.php:607
861
+ #: ../src/Admin/admin-page.php:614 ../src/Admin/admin-page.php:621
862
+ #: ../src/Admin/admin-page.php:628 ../src/Admin/admin-page.php:635
863
+ #: ../src/Admin/admin-page.php:642 ../src/Admin/admin-page.php:649
864
+ #: ../src/Admin/admin-page.php:656 ../src/Admin/admin-page.php:663
865
+ #: ../src/Admin/admin-page.php:670 ../src/Admin/admin-page.php:677
866
+ #: ../src/Admin/admin-page.php:684 ../src/Admin/admin-page.php:691
867
+ #: ../src/Admin/admin-page.php:698 ../src/Admin/admin-page.php:705
868
+ #: ../src/Admin/admin-page.php:712 ../src/Admin/admin-page.php:719
869
+ #: ../src/Admin/admin-page.php:726 ../src/Admin/admin-page.php:733
870
+ #: ../src/Admin/admin-page.php:740 ../src/Admin/admin-page.php:747
871
+ #: ../src/Admin/admin-page.php:754 ../src/Admin/admin-page.php:761
872
+ #: ../src/Admin/admin-page.php:768
873
  msgid "With wpp_get_mostpopular():"
874
  msgstr ""
875
 
876
+ #: ../src/Admin/admin-page.php:544 ../src/Admin/admin-page.php:551
877
+ #: ../src/Admin/admin-page.php:558 ../src/Admin/admin-page.php:565
878
+ #: ../src/Admin/admin-page.php:572 ../src/Admin/admin-page.php:579
879
+ #: ../src/Admin/admin-page.php:586 ../src/Admin/admin-page.php:593
880
+ #: ../src/Admin/admin-page.php:600 ../src/Admin/admin-page.php:607
881
+ #: ../src/Admin/admin-page.php:614 ../src/Admin/admin-page.php:621
882
+ #: ../src/Admin/admin-page.php:628 ../src/Admin/admin-page.php:635
883
+ #: ../src/Admin/admin-page.php:642 ../src/Admin/admin-page.php:649
884
+ #: ../src/Admin/admin-page.php:656 ../src/Admin/admin-page.php:663
885
+ #: ../src/Admin/admin-page.php:670 ../src/Admin/admin-page.php:677
886
+ #: ../src/Admin/admin-page.php:684 ../src/Admin/admin-page.php:691
887
+ #: ../src/Admin/admin-page.php:698 ../src/Admin/admin-page.php:705
888
+ #: ../src/Admin/admin-page.php:712 ../src/Admin/admin-page.php:719
889
+ #: ../src/Admin/admin-page.php:726 ../src/Admin/admin-page.php:733
890
+ #: ../src/Admin/admin-page.php:740 ../src/Admin/admin-page.php:747
891
+ #: ../src/Admin/admin-page.php:754 ../src/Admin/admin-page.php:761
892
+ #: ../src/Admin/admin-page.php:768
893
  msgid "With the [wpp] shortcode:"
894
  msgstr ""
895
 
896
+ #: ../src/Admin/admin-page.php:548
897
  msgid "Set the opening tag for the heading of the list"
898
  msgstr ""
899
 
900
+ #: ../src/Admin/admin-page.php:555
901
  msgid "Set the closing tag for the heading of the list"
902
  msgstr ""
903
 
904
+ #: ../src/Admin/admin-page.php:562
905
  msgid "Sets the maximum number of popular posts to be shown on the listing"
906
  msgstr ""
907
 
908
+ #: ../src/Admin/admin-page.php:563 ../src/Admin/admin-page.php:577
909
+ #: ../src/Admin/admin-page.php:647 ../src/Admin/admin-page.php:661
910
+ #: ../src/Admin/admin-page.php:682 ../src/Admin/admin-page.php:689
911
  msgid "Positive integer"
912
  msgstr ""
913
 
914
+ #: ../src/Admin/admin-page.php:569
915
  msgid ""
916
  "Tells WordPress Popular Posts to retrieve the most popular entries within the time "
917
  "range specified by you"
918
  msgstr ""
919
 
920
+ #: ../src/Admin/admin-page.php:576
921
  msgid "Especifies the number of time units of the custom time range"
922
  msgstr ""
923
 
924
+ #: ../src/Admin/admin-page.php:583
925
  msgid "Especifies the time unit of the custom time range"
926
  msgstr ""
927
 
928
+ #: ../src/Admin/admin-page.php:590
929
  msgid ""
930
  "Tells WordPress Popular Posts to retrieve the most popular entries published within "
931
  "the time range specified by you"
932
  msgstr ""
933
 
934
+ #: ../src/Admin/admin-page.php:597
935
  msgid "Sets the sorting option of the popular posts"
936
  msgstr ""
937
 
938
+ #: ../src/Admin/admin-page.php:598
939
  msgid "(for average views per day)"
940
  msgstr ""
941
 
942
+ #: ../src/Admin/admin-page.php:604
943
  msgid "Defines the type of posts to show on the listing"
944
  msgstr ""
945
 
946
+ #: ../src/Admin/admin-page.php:611
947
  msgid ""
948
  "If set, WordPress Popular Posts will exclude the specified post(s) ID(s) form the "
949
  "listing."
950
  msgstr ""
951
 
952
+ #: ../src/Admin/admin-page.php:618
953
  msgid ""
954
  "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
955
  "category ID(s). If a minus sign is used, entries associated to the category will be "
956
  "excluded instead."
957
  msgstr ""
958
 
959
+ #: ../src/Admin/admin-page.php:625
960
  msgid "If set, WordPress Popular Posts will filter posts by a given taxonomy."
961
  msgstr ""
962
 
963
+ #: ../src/Admin/admin-page.php:632
964
  msgid ""
965
  "If set, WordPress Popular Posts will retrieve all entries that belong to the specified "
966
  "term ID(s). If a minus sign is used, entries associated to the term(s) will be "
967
  "excluded instead."
968
  msgstr ""
969
 
970
+ #: ../src/Admin/admin-page.php:639
971
  msgid ""
972
  "If set, WordPress Popular Posts will retrieve all entries created by specified "
973
  "author(s) ID(s)."
974
  msgstr ""
975
 
976
+ #: ../src/Admin/admin-page.php:646
977
  msgid ""
978
  "If set, WordPress Popular Posts will shorten each post title to \"n\" characters "
979
  "whenever possible"
980
  msgstr ""
981
 
982
+ #: ../src/Admin/admin-page.php:653
983
  msgid ""
984
  "If set to 1, WordPress Popular Posts will shorten each post title to \"n\" words "
985
  "instead of characters"
986
  msgstr ""
987
 
988
+ #: ../src/Admin/admin-page.php:660
989
  msgid ""
990
  "If set, WordPress Popular Posts will build and include an excerpt of \"n\" characters "
991
  "long from the content of each post listed as popular"
992
  msgstr ""
993
 
994
+ #: ../src/Admin/admin-page.php:667
995
  msgid ""
996
  "If set, WordPress Popular Posts will maintaing all styling tags (strong, italic, etc) "
997
  "and hyperlinks found in the excerpt"
998
  msgstr ""
999
 
1000
+ #: ../src/Admin/admin-page.php:674
1001
  msgid ""
1002
  "If set to 1, WordPress Popular Posts will shorten the excerpt to \"n\" words instead "
1003
  "of characters"
1004
  msgstr ""
1005
 
1006
+ #: ../src/Admin/admin-page.php:681
1007
  msgid ""
1008
  "If set, and if your current server configuration allows it, you will be able to "
1009
  "display thumbnails of your posts. This attribute sets the width for thumbnails"
1010
  msgstr ""
1011
 
1012
+ #: ../src/Admin/admin-page.php:688
1013
  msgid ""
1014
  "If set, and if your current server configuration allows it, you will be able to "
1015
  "display thumbnails of your posts. This attribute sets the height for thumbnails"
1016
  msgstr ""
1017
 
1018
+ #: ../src/Admin/admin-page.php:695
1019
  msgid ""
1020
  "If set, and if the WP-PostRatings plugin is installed and enabled on your blog, "
1021
  "WordPress Popular Posts will show how your visitors are rating your entries"
1022
  msgstr ""
1023
 
1024
+ #: ../src/Admin/admin-page.php:702
1025
  msgid ""
1026
  "If set, WordPress Popular Posts will show how many comments each popular post has got "
1027
  "during the specified time range"
1028
  msgstr ""
1029
 
1030
+ #: ../src/Admin/admin-page.php:709
1031
  msgid ""
1032
  "If set, WordPress Popular Posts will show how many views each popular post has got "
1033
  "during the specified time range"
1034
  msgstr ""
1035
 
1036
+ #: ../src/Admin/admin-page.php:716
1037
  msgid ""
1038
  "If set, WordPress Popular Posts will show who published each popular post on the list"
1039
  msgstr ""
1040
 
1041
+ #: ../src/Admin/admin-page.php:723
1042
  msgid ""
1043
  "If set, WordPress Popular Posts will display the date when each popular post on the "
1044
  "list was published"
1045
  msgstr ""
1046
 
1047
+ #: ../src/Admin/admin-page.php:730
1048
  msgid "Sets the date format"
1049
  msgstr ""
1050
 
1051
+ #: ../src/Admin/admin-page.php:737
1052
  msgid ""
1053
  "If set, WordPress Popular Posts will display the categories associated to each entry"
1054
  msgstr ""
1055
 
1056
+ #: ../src/Admin/admin-page.php:744
1057
  msgid ""
1058
  "If set, WordPress Popular Posts will display the taxonomies associated to each entry"
1059
  msgstr ""
1060
 
1061
+ #: ../src/Admin/admin-page.php:751
1062
  msgid "Sets the opening tag for the listing"
1063
  msgstr ""
1064
 
1065
+ #: ../src/Admin/admin-page.php:758
1066
  msgid "Sets the closing tag for the listing"
1067
  msgstr ""
1068
 
1069
+ #: ../src/Admin/admin-page.php:765
1070
  msgid "Sets the HTML structure of each post"
1071
  msgstr ""
1072
 
1073
+ #: ../src/Admin/admin-page.php:766
1074
  msgid "Text string, custom HTML"
1075
  msgstr ""
1076
 
1077
+ #: ../src/Admin/admin-page.php:766
1078
  msgid "Available Content Tags"
1079
  msgstr ""
1080
 
1081
+ #: ../src/Admin/admin-page.php:766
1082
  msgid ""
1083
  "returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height"
1084
  msgstr ""
1085
 
1086
+ #: ../src/Admin/admin-page.php:766
1087
  msgid ""
1088
  "returns thumbnail image without linking to post/page, requires thumbnail_width & "
1089
  "thumbnail_height"
1090
  msgstr ""
1091
 
1092
+ #: ../src/Admin/admin-page.php:766
1093
  msgid "returns thumbnail url, requires thumbnail_width & thumbnail_height"
1094
  msgstr ""
1095
 
1096
+ #: ../src/Admin/admin-page.php:766
1097
  msgid "returns linked post/page title"
1098
  msgstr ""
1099
 
1100
+ #: ../src/Admin/admin-page.php:766
1101
  msgid "returns the post/page ID"
1102
  msgstr ""
1103
 
1104
+ #: ../src/Admin/admin-page.php:766
1105
  msgid "returns post/page excerpt, and requires excerpt_length to be greater than 0"
1106
  msgstr ""
1107
 
1108
+ #: ../src/Admin/admin-page.php:766
1109
  msgid "returns the default stats tags"
1110
  msgstr ""
1111
 
1112
+ #: ../src/Admin/admin-page.php:766
1113
  msgid "returns post/page current rating, requires WP-PostRatings installed and enabled"
1114
  msgstr ""
1115
 
1116
+ #: ../src/Admin/admin-page.php:766
1117
  msgid ""
1118
  "returns post/page current rating as an integer, requires WP-PostRatings installed and "
1119
  "enabled"
1120
  msgstr ""
1121
 
1122
+ #: ../src/Admin/admin-page.php:766
1123
  msgid "returns the URL of the post/page"
1124
  msgstr ""
1125
 
1126
+ #: ../src/Admin/admin-page.php:766
1127
  msgid "returns post/page title, no link"
1128
  msgstr ""
1129
 
1130
+ #: ../src/Admin/admin-page.php:766
1131
  msgid "similar to text_title, sanitized for use in title/alt attributes"
1132
  msgstr ""
1133
 
1134
+ #: ../src/Admin/admin-page.php:766
1135
  msgid "returns linked author name, requires stats_author=1"
1136
  msgstr ""
1137
 
1138
+ #: ../src/Admin/admin-page.php:766
1139
  msgid "returns linked author name with copy, requires stats_author=1"
1140
  msgstr ""
1141
 
1142
+ #: ../src/Admin/admin-page.php:766
1143
  msgid "returns linked category name, requires stats_category=1"
1144
  msgstr ""
1145
 
1146
+ #: ../src/Admin/admin-page.php:766
1147
  msgid "returns linked category name with copy, requires stats_category=1"
1148
  msgstr ""
1149
 
1150
+ #: ../src/Admin/admin-page.php:766
1151
  msgid "returns linked taxonomy names, requires stats_taxonomy=1"
1152
  msgstr ""
1153
 
1154
+ #: ../src/Admin/admin-page.php:766
1155
  msgid "returns linked taxonomy names with copy, requires stats_taxonomy=1"
1156
  msgstr ""
1157
 
1158
+ #: ../src/Admin/admin-page.php:766
1159
  msgid "returns views count only, no text, requires stats_views=1"
1160
  msgstr ""
1161
 
1162
+ #: ../src/Admin/admin-page.php:766
1163
  msgid "returns views count with copy, requires stats_views=1"
1164
  msgstr ""
1165
 
1166
+ #: ../src/Admin/admin-page.php:766
1167
  msgid "returns comments count only, no text, requires stats_comments=1"
1168
  msgstr ""
1169
 
1170
+ #: ../src/Admin/admin-page.php:766
1171
  msgid "returns comments count with copy, requires stats_comments=1"
1172
  msgstr ""
1173
 
1174
+ #: ../src/Admin/admin-page.php:766
1175
  msgid "returns post/page date, requires stats_date=1"
1176
  msgstr ""
1177
 
1178
+ #: ../src/Admin/admin-page.php:766
1179
  msgid "returns post/page date with copy, requires stats_date=1"
1180
  msgstr ""
1181
 
1182
+ #: ../src/Admin/admin-page.php:766
1183
  msgid "outputs number of popular posts found"
1184
  msgstr ""
1185
 
1186
+ #: ../src/Admin/admin-page.php:766
1187
  msgid "outputs the position of the post in the listing"
1188
  msgstr ""
1189
 
1191
  msgid "A highly customizable block that displays your most popular posts."
1192
  msgstr ""
1193
 
1194
+ #: ../src/Output.php:245
1195
  msgid "Sorry. No data so far."
1196
  msgstr ""
1197
 
1198
+ #: ../src/Output.php:591
1199
  #, php-format
1200
  msgid "%s ago"
1201
  msgstr ""
1202
 
1203
+ #: ../src/Output.php:754
1204
  #, php-format
1205
  msgid "%s view per day"
1206
  msgid_plural "%s views per day"
1207
  msgstr[0] ""
1208
  msgstr[1] ""
1209
 
1210
+ #: ../src/Output.php:772
1211
  #, php-format
1212
  msgid "by %s"
1213
  msgstr ""
1214
 
1215
+ #: ../src/Output.php:777
1216
  #, php-format
1217
  msgid "posted %s"
1218
  msgstr ""
1219
 
1220
+ #: ../src/Output.php:777
1221
  #, php-format
1222
  msgid "posted on %s"
1223
  msgstr ""
1224
 
1225
+ #: ../src/Output.php:782
1226
  #, php-format
1227
  msgid "under %s"
1228
  msgstr ""
1291
  msgid "Sets the Sampling Rate."
1292
  msgstr ""
1293
 
1294
+ #: ../src/Rest/WidgetEndpoint.php:78
1295
  msgid "Invalid Widget Instance ID"
1296
  msgstr ""
1297
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: popular, posts, widget, popularity, top
5
  Requires at least: 4.9
6
  Tested up to: 5.8
7
  Requires PHP: 5.4
8
- Stable tag: 5.3.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -97,69 +97,20 @@ The FAQ section has been moved [here](https://github.com/cabrerahector/wordpress
97
 
98
  == Changelog ==
99
 
100
- = 5.3.6 =
101
 
102
- - Fixes a potential authenticated stored XSS vulnerability (props to pluginvulnerabilities.com).
103
- - Fixes widget title not being displayed under certain conditions (thanks @Okoth1 and others for reporting this issue!)
104
- - Fixes a PHP notice generated by the widget block on WordPress 5.8.
105
 
106
- [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-3-improved-php-8-support-retina-display-support-and-more/#5.3.6)
 
 
 
 
 
 
 
107
 
108
- = 5.3.5 =
109
-
110
- - Reverts security enhancements (not the XSS one though) which caused garbled output for some websites.
111
- - Fixes a PHP Fatal Error affecting some setups.
112
-
113
- [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-3-improved-php-8-support-retina-display-support-and-more/#5.3.5)
114
-
115
- = 5.3.4 =
116
-
117
- - Experimental Gutenberg support! This version introduces the first WPP block. It's not enabled by default though, see the Release Notes for more.
118
- - Fixes a potential authenticated stored XSS vulnerability (props to Visse for reporting it!)
119
- - Overall security enhancements (props to Visse for assisting with this!)
120
- - Other minor improvements / fixes.
121
-
122
- [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-3-improved-php-8-support-retina-display-support-and-more/#5.3.4)
123
-
124
- = 5.3.3 =
125
-
126
- - Fixes a potential XSS vulnerability (props to Yu Iwama of Secure Sky Technology Inc. and the JPCERT/CC Vulnerability Coordination Group).
127
- - Fixes a potential code injection vulnerability (props to Jerome & NinTechNet).
128
- - Fixes a srcset bug that affects specific PHP locales (props to @fredel).
129
- - Fixes a srcset not loading images due to improper SSL/HTTPS configuration (props to @aj4h).
130
- - Updates ChartJS to version 2.9.4.
131
-
132
- If you're using a caching plugin flushing its cache after upgrading to this version is highly recommended.
133
-
134
- [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-3-improved-php-8-support-retina-display-support-and-more/#minor-updates-and-hotfixes)
135
-
136
- = 5.3.2 =
137
-
138
- - `wpp_get_views()`: fixed an issue where the function would return 0 views under certain conditions (thanks to everyone who helped with this!)
139
-
140
- [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-3-improved-php-8-support-retina-display-support-and-more/#minor-updates-and-hotfixes)
141
-
142
- = 5.3.1 =
143
-
144
- - `wpp_get_views()`: restores previous behavior where when no time range was set the function would return total views count (thanks @narolles!)
145
- - The WPP widget will now be loaded via AJAX by default (this affects new installs only.)
146
-
147
- [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-3-improved-php-8-support-retina-display-support-and-more/#minor-updates-and-hotfixes)
148
-
149
- = 5.3.0 =
150
-
151
- - Improves compatibility with PHP 8.
152
- - Allows to override widget theme stylesheets.
153
- - Each post can have its own thumbnail now when using WPP with WPML/Polylang.
154
- - Improved Polylang support.
155
- - Adds a loading animation when using the widget with the Ajaxify widget option enabled.
156
- - Fixes an issue where the plugin wouldn't generate thumbnails when filenames contains Unicode characters.
157
- - The /popular-posts REST API endpoint now correctly translate posts when using WPML/Polylang.
158
- - `wpp_get_views()` can now return views count from custom time ranges.
159
- - Post thumbnails will now look sharper on retina displays!
160
- - Other minor improvements / fixes.
161
-
162
- [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-3-improved-php-8-support-retina-display-support-and-more/)
163
 
164
  [Full Changelog](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/changelog.md)
165
 
@@ -168,5 +119,5 @@ If you're using a caching plugin flushing its cache after upgrading to this vers
168
  * Flame graphic by freevector/Vecteezy.com.
169
 
170
  == Upgrade Notice ==
171
- = 5.3.3 =
172
  If you're using a caching plugin flushing its cache after upgrading to this version is highly recommended.
5
  Requires at least: 4.9
6
  Tested up to: 5.8
7
  Requires PHP: 5.4
8
+ Stable tag: 5.4.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
97
 
98
  == Changelog ==
99
 
100
+ = 5.4.0 =
101
 
102
+ **If you're using a caching plugin flushing its cache after upgrading to this version is highly recommended.**
 
 
103
 
104
+ - The widget block is no longer an experimental feature and is now available to everyone (but it's still a WIP).
105
+ - Widget block: adds AJAX support to prevent caching plugins from caching your popular posts block.
106
+ - Widget block: adds WPML/Polylang support.
107
+ - Widget block: fixes widget heading not displaying.
108
+ - Widget themes: allow themes to detect the current post so it can be styled differently.
109
+ - Fixes `wpp_excerpt_more` filter hook not working (props to SchweizerSchoggi!)
110
+ - Adds filter hook `wpp_title_more` to allow customization of the prefix added to shortened post titles.
111
+ - Removes inline JavaScript code from WPP's dashboard in preparation for [WordPress' CSP adoption](https://core.trac.wordpress.org/ticket/51407).
112
 
113
+ [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-5-4-widget-block-improvements-plus-prep-work-for-csp-support/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
  [Full Changelog](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/changelog.md)
116
 
119
  * Flame graphic by freevector/Vecteezy.com.
120
 
121
  == Upgrade Notice ==
122
+ = 5.4.0 =
123
  If you're using a caching plugin flushing its cache after upgrading to this version is highly recommended.
src/Admin/Admin.php CHANGED
@@ -103,8 +103,7 @@ class Admin {
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
@@ -132,6 +131,7 @@ class Admin {
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
  }
@@ -520,7 +520,21 @@ class Admin {
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
  }
@@ -531,6 +545,33 @@ class Admin {
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
  /**
@@ -1119,13 +1160,12 @@ class Admin {
1119
  */
1120
  public function clear_data()
1121
  {
1122
- $token = $_POST['token'];
1123
  $clear = isset($_POST['clear']) ? $_POST['clear'] : null;
1124
- $key = get_option("wpp_rand");
1125
 
1126
  if (
1127
  current_user_can('manage_options')
1128
- && ( $token === $key )
1129
  && $clear
1130
  ) {
1131
  global $wpdb;
@@ -1192,11 +1232,10 @@ class Admin {
1192
 
1193
  if ( is_array($wpp_uploads_dir) && ! empty($wpp_uploads_dir) ) {
1194
  $token = isset($_POST['token']) ? $_POST['token'] : null;
1195
- $key = get_option("wpp_rand");
1196
 
1197
  if (
1198
  current_user_can('edit_published_posts')
1199
- && ( $token === $key )
1200
  ) {
1201
  if ( is_dir($wpp_uploads_dir['basedir']) ) {
1202
  $files = glob("{$wpp_uploads_dir['basedir']}/*"); // get all related images
@@ -1340,44 +1379,68 @@ class Admin {
1340
  ) {
1341
  $now = Helper::timestamp();
1342
 
1343
- if ( isset($_GET['wpp_dismiss_performance_notice']) || isset($_GET['wpp_remind_performance_notice']) ) {
1344
- // User dismissed the notice
1345
- if ( isset($_GET['wpp_dismiss_performance_notice']) ) {
1346
- $performance_nag['status'] = 3;
1347
- } // User asked us to remind them later
1348
- else {
1349
- $performance_nag['status'] = 2;
1350
- $performance_nag['last_checked'] = $now;
1351
- }
1352
 
1353
- update_option('wpp_performance_nag', $performance_nag);
1354
- echo '<script>window.location.replace("'. esc_url(remove_query_arg(['wpp_dismiss_performance_notice', 'wpp_remind_performance_notice'])) .'");</script>';
1355
- } // Maybe display the notice
1356
- else {
1357
- // How much time has passed since the notice was last displayed?
1358
- $last_checked = $performance_nag['last_checked'];
1359
 
1360
- if ( $last_checked ) {
1361
- $last_checked = ($now - $last_checked) / (60 * 60);
1362
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1363
 
1364
- if (
1365
- 1 == $performance_nag['status']
1366
- || ( 2 == $performance_nag['status'] && $last_checked && $last_checked >= 24 )
1367
- ) {
1368
- ?>
1369
- <div class="notice notice-warning">
1370
- <p><?php printf(
1371
- __("<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'),
1372
- 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance'
1373
- ) ?></p>
1374
- <?php if ( current_user_can('manage_options') ) : ?>
1375
- <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>
1376
- <?php endif; ?>
1377
- </div>
1378
- <?php
1379
- }
 
 
 
 
 
 
 
 
 
1380
  }
 
 
 
 
 
 
 
 
1381
  }
 
 
1382
  }
1383
  }
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
+ add_action('wp_dashboard_setup', [$this, 'add_dashboard_widgets']);
 
107
  // Load WPP's admin styles and scripts
108
  add_action('admin_enqueue_scripts', [$this, 'enqueue_assets']);
109
  // Add admin screen
131
  add_action('wpp_cache_event', [$this, 'purge_data']);
132
  // Maybe performance nag
133
  add_action('wpp_maybe_performance_nag', [$this, 'performance_check']);
134
+ add_action('wp_ajax_wpp_handle_performance_notice', [$this, 'handle_performance_notice']);
135
  // Show notices
136
  add_action('admin_notices', [$this, 'notices']);
137
  }
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
+ 'nonce_reset_data' => wp_create_nonce("wpp_nonce_reset_data"),
525
+ 'nonce_reset_thumbnails' => wp_create_nonce("wpp_nonce_reset_thumbnails"),
526
+ 'text_confirm_reset_cache_table' => __("This operation will delete all entries from WordPress Popular Posts' cache table and cannot be undone.", 'wordpress-popular-posts'),
527
+ 'text_cache_table_cleared' => __('Success! The cache table has been cleared!', 'wordpress-popular-posts'),
528
+ 'text_cache_table_missing' => __('Error: cache table does not exist.', 'wordpress-popular-posts'),
529
+ 'text_confirm_reset_all_tables' => __("This operation will delete all stored info from WordPress Popular Posts' data tables and cannot be undone.", 'wordpress-popular-posts'),
530
+ 'text_all_table_cleared' => __('Success! All data have been cleared!', 'wordpress-popular-posts'),
531
+ 'text_tables_missing' => __('Error: one or both data tables are missing.', 'wordpress-popular-posts'),
532
+ 'text_confirm_image_cache_reset' => __('This operation will delete all cached thumbnails and cannot be undone.', 'wordpress-popular-posts'),
533
+ 'text_image_cache_cleared' => __('Success! All files have been deleted!', 'wordpress-popular-posts'),
534
+ 'text_image_cache_already_empty' => __('The thumbnail cache is already empty!', 'wordpress-popular-posts'),
535
+ 'text_continue' => __('Do you want to continue?', 'wordpress-popular-posts'),
536
+ 'text_insufficient_permissions' => __('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts'),
537
+ 'text_invalid_action' => __('Invalid action.', 'wordpress-popular-posts')
538
  ]);
539
  wp_enqueue_script('wordpress-popular-posts-admin-script');
540
  }
545
  wp_enqueue_style('wordpress-popular-posts-admin-styles', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/css/admin.css', [], WPP_VERSION, 'all');
546
  }
547
  }
548
+
549
+ $performance_nag = get_option('wpp_performance_nag');
550
+
551
+ if (
552
+ isset($performance_nag['status'])
553
+ && 3 != $performance_nag['status'] // 0 = inactive, 1 = active, 2 = remind me later, 3 = dismissed
554
+ ) {
555
+ $now = Helper::timestamp();
556
+
557
+ // How much time has passed since the notice was last displayed?
558
+ $last_checked = isset($performance_nag['last_checked']) ? $performance_nag['last_checked'] : 0;
559
+
560
+ if ( $last_checked ) {
561
+ $last_checked = ($now - $last_checked) / (60 * 60);
562
+ }
563
+
564
+ if (
565
+ 1 == $performance_nag['status']
566
+ || ( 2 == $performance_nag['status'] && $last_checked && $last_checked >= 24 )
567
+ ) {
568
+ wp_register_script('wpp-admin-notices', plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/admin-notices.js', [], WPP_VERSION);
569
+ wp_localize_script('wpp-admin-notices', 'wpp_admin_notices_params', [
570
+ 'nonce_performance_nag' => wp_create_nonce("wpp_nonce_performance_nag")
571
+ ]);
572
+ wp_enqueue_script('wpp-admin-notices');
573
+ }
574
+ }
575
  }
576
 
577
  /**
1160
  */
1161
  public function clear_data()
1162
  {
1163
+ $token = isset($_POST['token']) ? $_POST['token'] : null;
1164
  $clear = isset($_POST['clear']) ? $_POST['clear'] : null;
 
1165
 
1166
  if (
1167
  current_user_can('manage_options')
1168
+ && wp_verify_nonce($token, 'wpp_nonce_reset_data')
1169
  && $clear
1170
  ) {
1171
  global $wpdb;
1232
 
1233
  if ( is_array($wpp_uploads_dir) && ! empty($wpp_uploads_dir) ) {
1234
  $token = isset($_POST['token']) ? $_POST['token'] : null;
 
1235
 
1236
  if (
1237
  current_user_can('edit_published_posts')
1238
+ && wp_verify_nonce($token, 'wpp_nonce_reset_thumbnails')
1239
  ) {
1240
  if ( is_dir($wpp_uploads_dir['basedir']) ) {
1241
  $files = glob("{$wpp_uploads_dir['basedir']}/*"); // get all related images
1379
  ) {
1380
  $now = Helper::timestamp();
1381
 
1382
+ // How much time has passed since the notice was last displayed?
1383
+ $last_checked = isset($performance_nag['last_checked']) ? $performance_nag['last_checked'] : 0;
 
 
 
 
 
 
 
1384
 
1385
+ if ( $last_checked ) {
1386
+ $last_checked = ($now - $last_checked) / (60 * 60);
1387
+ }
 
 
 
1388
 
1389
+ if (
1390
+ 1 == $performance_nag['status']
1391
+ || ( 2 == $performance_nag['status'] && $last_checked && $last_checked >= 24 )
1392
+ ) {
1393
+ ?>
1394
+ <div class="notice notice-warning">
1395
+ <p><?php printf(
1396
+ __("<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'),
1397
+ 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance'
1398
+ ) ?></p>
1399
+ <?php if ( current_user_can('manage_options') ) : ?>
1400
+ <p><a class="button button-primary wpp-dismiss-performance-notice" href="<?php echo add_query_arg('wpp_dismiss_performance_notice', '1'); ?>"><?php _e("Dismiss", "wordpress-popular-posts"); ?></a> <a class="button wpp-remind-performance-notice" href="<?php echo add_query_arg('wpp_remind_performance_notice', '1'); ?>"><?php _e("Remind me later", "wordpress-popular-posts"); ?></a> <span class="spinner" style="float: none;"></span></p>
1401
+ <?php endif; ?>
1402
+ </div>
1403
+ <?php
1404
+ }
1405
+ }
1406
+ }
1407
 
1408
+ /**
1409
+ * Handles performance notice click event.
1410
+ *
1411
+ * @since
1412
+ */
1413
+ public function handle_performance_notice()
1414
+ {
1415
+ $response = [
1416
+ 'status' => 'error'
1417
+ ];
1418
+ $token = isset($_POST['token']) ? $_POST['token'] : null;
1419
+ $dismiss = isset($_POST['dismiss']) ? $_POST['dismiss'] : 0;
1420
+
1421
+ if (
1422
+ current_user_can('manage_options')
1423
+ && wp_verify_nonce($token, 'wpp_nonce_performance_nag')
1424
+ ) {
1425
+ $now = Helper::timestamp();
1426
+
1427
+ // User dismissed the notice
1428
+ if ( 1 == $dismiss ) {
1429
+ $performance_nag['status'] = 3;
1430
+ } // User asked us to remind them later
1431
+ else {
1432
+ $performance_nag['status'] = 2;
1433
  }
1434
+
1435
+ $performance_nag['last_checked'] = $now;
1436
+
1437
+ update_option('wpp_performance_nag', $performance_nag);
1438
+
1439
+ $response = [
1440
+ 'status' => 'success'
1441
+ ];
1442
  }
1443
+
1444
+ wp_send_json($response);
1445
  }
1446
  }
src/Admin/admin-page.php CHANGED
@@ -106,134 +106,7 @@ if ( isset($_POST['section']) ) {
106
  }
107
 
108
  }
109
-
110
- $rand = md5(uniqid(rand(), true));
111
-
112
- if ( ! $wpp_rand = get_option("wpp_rand") ) {
113
- add_option("wpp_rand", $rand);
114
- } else {
115
- update_option("wpp_rand", $rand);
116
- }
117
-
118
  ?>
119
- <script type="text/javascript">
120
- // TOOLS
121
- function confirm_reset_cache() {
122
- 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'); ?>") ) {
123
- jQuery.post(
124
- ajaxurl,
125
- {
126
- action: 'wpp_clear_data',
127
- token: '<?php echo get_option("wpp_rand"); ?>',
128
- clear: 'cache'
129
- }, function(data){
130
- var response = "";
131
-
132
- switch( data ) {
133
- case "1":
134
- 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'); ?>";
135
- break;
136
-
137
- case "2":
138
- 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'); ?>";
139
- break;
140
-
141
- case "3":
142
- 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'); ?>";
143
- break;
144
-
145
- case "4":
146
- 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'); ?>";
147
- break;
148
-
149
- default:
150
- 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'); ?>";
151
- break;
152
- }
153
-
154
- alert(response);
155
- }
156
- );
157
- }
158
- }
159
-
160
- function confirm_reset_all() {
161
- 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'); ?>")) {
162
- jQuery.post(
163
- ajaxurl,
164
- {
165
- action: 'wpp_clear_data',
166
- token: '<?php echo get_option("wpp_rand"); ?>',
167
- clear: 'all'
168
- }, function(data){
169
- var response = "";
170
-
171
- switch( data ) {
172
- case "1":
173
- 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'); ?>";
174
- break;
175
-
176
- case "2":
177
- 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'); ?>";
178
- break;
179
-
180
- case "3":
181
- 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'); ?>";
182
- break;
183
-
184
- case "4":
185
- 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'); ?>";
186
- break;
187
-
188
- default:
189
- 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'); ?>";
190
- break;
191
- }
192
-
193
- alert(response);
194
- }
195
- );
196
- }
197
- }
198
-
199
- function confirm_clear_image_cache() {
200
- 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'); ?>") ) {
201
- jQuery.post(
202
- ajaxurl,
203
- {
204
- action: 'wpp_clear_thumbnail',
205
- token: '<?php echo get_option("wpp_rand"); ?>'
206
- }, function(data){
207
- var response = "";
208
-
209
- switch( data ) {
210
- case "1":
211
- 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'); ?>";
212
- break;
213
-
214
- case "2":
215
- 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'); ?>";
216
- break;
217
-
218
- case "3":
219
- 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'); ?>";
220
- break;
221
-
222
- case "4":
223
- 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'); ?>";
224
- break;
225
-
226
- default:
227
- 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'); ?>";
228
- break;
229
- }
230
-
231
- alert(response);
232
- }
233
- );
234
- }
235
- }
236
- </script>
237
 
238
  <nav id="wpp-menu">
239
  <ul>
@@ -330,13 +203,6 @@ if ( ! $wpp_rand = get_option("wpp_rand") ) {
330
 
331
  <div id="wpp-chart">
332
  <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>
333
-
334
- <script>
335
- if ( WPPChart.canRender() ) {
336
- jQuery("#wpp-chart p").remove();
337
- WPPChart.init('wpp-chart');
338
- }
339
- </script>
340
  </div>
341
  </div>
342
  <?php
@@ -465,7 +331,7 @@ if ( ! $wpp_rand = get_option("wpp_rand") ) {
465
  <tr valign="top">
466
  <th scope="row"></th>
467
  <td>
468
- <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()">
469
  <p class="description"><?php _e("Use this button to clear WPP's thumbnails cache", 'wordpress-popular-posts'); ?>.</p>
470
  </td>
471
  </tr>
@@ -643,8 +509,8 @@ if ( ! $wpp_rand = get_option("wpp_rand") ) {
643
  <br /><br />
644
 
645
  <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>
646
- <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>
647
- <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>
648
  </div>
649
  </div>
650
  <!-- End tools -->
106
  }
107
 
108
  }
 
 
 
 
 
 
 
 
 
109
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  <nav id="wpp-menu">
112
  <ul>
203
 
204
  <div id="wpp-chart">
205
  <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>
 
 
 
 
 
 
 
206
  </div>
207
  </div>
208
  <?php
331
  <tr valign="top">
332
  <th scope="row"></th>
333
  <td>
334
+ <input type="button" name="wpp-reset-image-cache" id="wpp-reset-image-cache" class="button-secondary" value="<?php _e("Empty image cache", 'wordpress-popular-posts'); ?>">
335
  <p class="description"><?php _e("Use this button to clear WPP's thumbnails cache", 'wordpress-popular-posts'); ?>.</p>
336
  </td>
337
  </tr>
509
  <br /><br />
510
 
511
  <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>
512
+ <p><input type="button" name="wpp-reset-cache" id="wpp-reset-cache" class="button-secondary" value="<?php _e("Empty cache", 'wordpress-popular-posts'); ?>"> <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>
513
+ <p><input type="button" name="wpp-reset-all" id="wpp-reset-all" class="button-secondary" value="<?php _e("Clear all data", 'wordpress-popular-posts'); ?>"> <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>
514
  </div>
515
  </div>
516
  <!-- End tools -->
src/Block/Widget/Widget.php CHANGED
@@ -125,7 +125,7 @@ class Widget extends Block
125
  }
126
 
127
  /**
128
- *
129
  *
130
  * @since 5.4.0
131
  */
@@ -136,15 +136,11 @@ class Widget extends Block
136
  return;
137
  }
138
 
139
- // Experimental feature, bail if disabled.
140
- if ( ! $this->admin_options['tools']['experimental'] )
141
- return;
142
-
143
  wp_enqueue_script(
144
  'block-wpp-widget-js',
145
  plugin_dir_url(dirname(dirname(dirname(__FILE__)))) . 'assets/js/blocks/block-wpp-widget.js',
146
  ['wp-blocks', 'wp-i18n', 'wp-element', 'wp-block-editor', 'wp-server-side-render'],
147
- WPP_VERSION
148
  );
149
 
150
  wp_register_style(
@@ -165,6 +161,10 @@ class Widget extends Block
165
  'type' => 'boolean',
166
  'default' => true
167
  ],
 
 
 
 
168
  'title' => [
169
  'type' => 'string',
170
  'default' => ''
@@ -437,11 +437,21 @@ class Widget extends Block
437
  }
438
 
439
  // Has user set a title?
440
- if ( '' != $query_args['title'] ) {
441
- if ( ! $query_args['markup']['custom_html'] ) {
442
- $query_args['markup']['title-start'] = apply_filters('wpp_block_before_title', '<h2>');
443
- $query_args['markup']['title-end'] = apply_filters('wpp_block_after_title', '</h2>');
444
- }
 
 
 
 
 
 
 
 
 
 
445
  }
446
 
447
  // Return cached results
125
  }
126
 
127
  /**
128
+ * Registers the block.
129
  *
130
  * @since 5.4.0
131
  */
136
  return;
137
  }
138
 
 
 
 
 
139
  wp_enqueue_script(
140
  'block-wpp-widget-js',
141
  plugin_dir_url(dirname(dirname(dirname(__FILE__)))) . 'assets/js/blocks/block-wpp-widget.js',
142
  ['wp-blocks', 'wp-i18n', 'wp-element', 'wp-block-editor', 'wp-server-side-render'],
143
+ filemtime(plugin_dir_path(dirname(dirname(dirname(__FILE__)))) . 'assets/js/blocks/block-wpp-widget.js')
144
  );
145
 
146
  wp_register_style(
161
  'type' => 'boolean',
162
  'default' => true
163
  ],
164
+ '_isSelected' => [
165
+ 'type' => 'boolean',
166
+ 'default' => false
167
+ ],
168
  'title' => [
169
  'type' => 'string',
170
  'default' => ''
437
  }
438
 
439
  // Has user set a title?
440
+ if (
441
+ ! empty($query_args['title'])
442
+ && ! empty($query_args['markup']['title-start'])
443
+ && ! empty($query_args['markup']['title-end'])
444
+ ) {
445
+ $html .= htmlspecialchars_decode($query_args['markup']['title-start'], ENT_QUOTES) . $query_args['title'] . htmlspecialchars_decode($query_args['markup']['title-end'], ENT_QUOTES);
446
+ }
447
+
448
+ $isAdmin = isset($_GET['isSelected']) ? $_GET['isSelected'] : false;
449
+
450
+ if ( $this->admin_options['tools']['ajax'] && ! is_customize_preview() && ! $isAdmin ) {
451
+ $html .= '<script type="application/json">' . json_encode($query_args) . '</script>';
452
+ $html .= '<div class="wpp-widget-block-placeholder"></div>';
453
+
454
+ return $html;
455
  }
456
 
457
  // Return cached results
src/Block/Widget/edit.js CHANGED
@@ -743,6 +743,7 @@ export class WPPWidgetBlockEdit extends Component
743
  block={this.props.name}
744
  className={className}
745
  attributes={attributes}
 
746
  />
747
  </Disabled>
748
  }
743
  block={this.props.name}
744
  className={className}
745
  attributes={attributes}
746
+ urlQueryArgs={{isSelected: isSelected}}
747
  />
748
  </Disabled>
749
  }
src/Block/Widget/widget.js CHANGED
@@ -16,6 +16,10 @@ registerBlockType('wordpress-popular-posts/widget', {
16
  type: 'boolean',
17
  default: true
18
  },
 
 
 
 
19
  title: {
20
  type: 'string',
21
  },
16
  type: 'boolean',
17
  default: true
18
  },
19
+ _isSelected: {
20
+ type: 'boolean',
21
+ default: false
22
+ },
23
  title: {
24
  type: 'string',
25
  },
src/Front/Front.php CHANGED
@@ -146,6 +146,7 @@ class Front {
146
  'sampling_active' => (int) $this->config['tools']['sampling']['active'],
147
  'sampling_rate' => (int) $this->config['tools']['sampling']['rate'],
148
  'ajax_url' => esc_url_raw(rest_url('wordpress-popular-posts/v1/popular-posts')),
 
149
  'ID' => (int) $is_single,
150
  'token' => wp_create_nonce('wp_rest'),
151
  'lang' => function_exists('PLL') ? $this->translate->get_current_language() : 0,
146
  'sampling_active' => (int) $this->config['tools']['sampling']['active'],
147
  'sampling_rate' => (int) $this->config['tools']['sampling']['rate'],
148
  'ajax_url' => esc_url_raw(rest_url('wordpress-popular-posts/v1/popular-posts')),
149
+ 'api_url' => esc_url_raw(rest_url('wordpress-popular-posts')),
150
  'ID' => (int) $is_single,
151
  'token' => wp_create_nonce('wp_rest'),
152
  'lang' => function_exists('PLL') ? $this->translate->get_current_language() : 0,
src/Output.php CHANGED
@@ -94,10 +94,6 @@ class Output {
94
  $this->themer = $themer;
95
 
96
  $this->more = '...';
97
-
98
- // Allow customization of the more (...) string
99
- if ( has_filter('wpp_excerpt_more') )
100
- $this->more = apply_filters('wpp_excerpt_more', $this->more);
101
  }
102
 
103
  /**
@@ -287,7 +283,8 @@ class Output {
287
  ? $this->public_options['shorten_title']['length']
288
  : 25;
289
 
290
- $post_title = Helper::truncate($post_title, $length, $this->public_options['shorten_title']['words'], $this->more);
 
291
  }
292
 
293
  // Thumbnail
@@ -355,6 +352,7 @@ class Output {
355
  if ( $this->public_options['markup']['custom_html'] ) {
356
  $data = [
357
  'id' => $post_id,
 
358
  'title' => '<a href="' . $permalink . '" ' . ($post_title_attr !== $post_title ? 'title="' . $post_title_attr . '" ' : '' ) . 'class="wpp-post-title" target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_title . '</a>',
359
  'title_attr' => $post_title_attr,
360
  'summary' => $post_excerpt,
@@ -540,12 +538,15 @@ class Output {
540
  $excerpt = preg_replace('_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:/[^\s]*)?$_iuS', '', $excerpt);
541
  }
542
 
 
 
543
  }
544
 
545
  // Balance tags, if needed
546
  if ( '' !== $excerpt ) {
547
 
548
- $excerpt = Helper::truncate($excerpt, $this->public_options['post-excerpt']['length'], $this->public_options['post-excerpt']['words'], $this->more);
 
549
 
550
  if ( $this->public_options['post-excerpt']['keep_format'] )
551
  $excerpt = force_balance_tags($excerpt);
@@ -800,7 +801,7 @@ class Output {
800
  return false;
801
 
802
  $params = [];
803
- $pattern = '/\{(pid|excerpt|summary|meta|stats|title|title_attr|image|thumb|thumb_img|thumb_url|rating|score|url|text_title|author|author_copy|taxonomy|taxonomy_copy|category|category_copy|views|views_copy|comments|comments_copy|date|date_copy|total_items|item_position)\}/i';
804
  preg_match_all($pattern, $string, $matches);
805
 
806
  array_map('strtolower', $matches[0]);
@@ -809,6 +810,10 @@ class Output {
809
  $string = str_replace("{pid}", $data['id'], $string);
810
  }
811
 
 
 
 
 
812
  if ( in_array("{title}", $matches[0]) ) {
813
  $string = str_replace("{title}", $data['title'], $string);
814
  }
94
  $this->themer = $themer;
95
 
96
  $this->more = '...';
 
 
 
 
97
  }
98
 
99
  /**
283
  ? $this->public_options['shorten_title']['length']
284
  : 25;
285
 
286
+ $more = apply_filters('wpp_title_more', $this->more);
287
+ $post_title = Helper::truncate($post_title, $length, $this->public_options['shorten_title']['words'], $more);
288
  }
289
 
290
  // Thumbnail
352
  if ( $this->public_options['markup']['custom_html'] ) {
353
  $data = [
354
  'id' => $post_id,
355
+ 'is_current_post' => $is_current_post,
356
  'title' => '<a href="' . $permalink . '" ' . ($post_title_attr !== $post_title ? 'title="' . $post_title_attr . '" ' : '' ) . 'class="wpp-post-title" target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_title . '</a>',
357
  'title_attr' => $post_title_attr,
358
  'summary' => $post_excerpt,
538
  $excerpt = preg_replace('_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:/[^\s]*)?$_iuS', '', $excerpt);
539
  }
540
 
541
+ $excerpt = trim($excerpt);
542
+
543
  }
544
 
545
  // Balance tags, if needed
546
  if ( '' !== $excerpt ) {
547
 
548
+ $more = apply_filters('wpp_excerpt_more', $this->more);
549
+ $excerpt = Helper::truncate($excerpt, $this->public_options['post-excerpt']['length'], $this->public_options['post-excerpt']['words'], $more);
550
 
551
  if ( $this->public_options['post-excerpt']['keep_format'] )
552
  $excerpt = force_balance_tags($excerpt);
801
  return false;
802
 
803
  $params = [];
804
+ $pattern = '/\{(pid|current_class|excerpt|summary|meta|stats|title|title_attr|image|thumb|thumb_img|thumb_url|rating|score|url|text_title|author|author_copy|taxonomy|taxonomy_copy|category|category_copy|views|views_copy|comments|comments_copy|date|date_copy|total_items|item_position)\}/i';
805
  preg_match_all($pattern, $string, $matches);
806
 
807
  array_map('strtolower', $matches[0]);
810
  $string = str_replace("{pid}", $data['id'], $string);
811
  }
812
 
813
+ if ( in_array("{current_class}", $matches[0]) ) {
814
+ $string = str_replace("{current_class}", ( $data['is_current_post'] ? 'current' : '' ), $string);
815
+ }
816
+
817
  if ( in_array("{title}", $matches[0]) ) {
818
  $string = str_replace("{title}", $data['title'], $string);
819
  }
src/Rest/WidgetEndpoint.php CHANGED
@@ -43,6 +43,18 @@ class WidgetEndpoint extends Endpoint {
43
  'args' => $this->get_widget_params(),
44
  ]
45
  ]);
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
  /**
@@ -111,6 +123,41 @@ class WidgetEndpoint extends Endpoint {
111
  return false;
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * Retrieves the query params for getting a widget instance.
116
  *
43
  'args' => $this->get_widget_params(),
44
  ]
45
  ]);
46
+
47
+ $version = '2';
48
+ $namespace = 'wordpress-popular-posts/v' . $version;
49
+
50
+ register_rest_route($namespace, '/widget/', [
51
+ [
52
+ 'methods' => 'POST',
53
+ 'callback' => [$this, 'get_widget_block'],
54
+ 'permission_callback' => '__return_true',
55
+ 'args' => $this->get_widget_params(),
56
+ ]
57
+ ]);
58
  }
59
 
60
  /**
123
  return false;
124
  }
125
 
126
+ /**
127
+ * Retrieves a popular posts widget for display.
128
+ *
129
+ * @since 5.4.0
130
+ *
131
+ * @param \WP_REST_Request $request Full details about the request.
132
+ * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure.
133
+ */
134
+ public function get_widget_block($request)
135
+ {
136
+ $instance = $request->get_params();
137
+
138
+ $is_single = $request->get_param('is_single');
139
+ $lang = $request->get_param('lang');
140
+
141
+ // Multilang support
142
+ $this->set_lang($lang);
143
+
144
+ $popular_posts = $this->maybe_query($instance);
145
+
146
+ if ( is_numeric($is_single) && $is_single > 0 ) {
147
+ add_filter('wpp_is_single', function($id) use ($is_single) {
148
+ return $is_single;
149
+ });
150
+ }
151
+
152
+ $this->output->set_data($popular_posts->get_posts());
153
+ $this->output->set_public_options($instance);
154
+ $this->output->build_output();
155
+
156
+ return [
157
+ 'widget' => ( $this->config['tools']['cache']['active'] ? '<!-- cached -->' : '' ) . $this->output->get_output()
158
+ ];
159
+ }
160
+
161
  /**
162
  * Retrieves the query params for getting a widget instance.
163
  *
wordpress-popular-posts.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: WordPress Popular Posts
17
  * Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
18
  * Description: A highly customizable widget that displays the most popular posts on your blog.
19
- * Version: 5.3.6
20
  * Author: Hector Cabrera
21
  * Author URI: https://cabrerahector.com/
22
  * License: GPL-2.0+
@@ -29,7 +29,7 @@ if ( ! defined( 'WPINC' ) ) {
29
  die();
30
  }
31
 
32
- define('WPP_VERSION', '5.3.6');
33
  define('WPP_MIN_PHP_VERSION', '5.4');
34
  define('WPP_MIN_WP_VERSION', '4.9');
35
 
16
  * Plugin Name: WordPress Popular Posts
17
  * Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
18
  * Description: A highly customizable widget that displays the most popular posts on your blog.
19
+ * Version: 5.4.0
20
  * Author: Hector Cabrera
21
  * Author URI: https://cabrerahector.com/
22
  * License: GPL-2.0+
29
  die();
30
  }
31
 
32
+ define('WPP_VERSION', '5.0.0');
33
  define('WPP_MIN_PHP_VERSION', '5.4');
34
  define('WPP_MIN_WP_VERSION', '4.9');
35