WordPress Popular Posts - Version 6.1.1

Version Description

  • Fixes a rare PHP fatal error that can occur during plugin activation.
  • Block: adds links to documentation within the block form for ease of access.
  • Updates dependencies.

Release notes

Download this release

Release Info

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

Code changes from version 6.1.0 to 6.1.1

assets/js/blocks/block-wpp-widget.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array(), 'version' => '8343ded4659627c46d09');
1
+ <?php return array('dependencies' => array(), 'version' => '1fee0e8d43b6337ca2ff');
assets/js/blocks/block-wpp-widget.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={};e.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)"}));const t=e;function a(e){return a="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},a(e)}function s(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 r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}function o(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}var l=wp.serverSideRender,i=wp.element,p=i.Component,u=i.Fragment,c=wp.blockEditor.BlockControls,m=wp.components,d=m.CheckboxControl,h=m.Disabled,b=m.SelectControl,f=m.Spinner,_=m.TextareaControl,g=m.TextControl,y=m.Toolbar,w=m.ToolbarButton,__=wp.i18n.__,v="wordpress-popular-posts/v1",x=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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(x,e);var t,a,i,p,m=(i=x,p=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=n(i);if(p){var a=n(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return o(this,e)});function x(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,x),(t=m.call(this,e)).state={error:null,editMode:!0,themes:null,imgSizes:null,taxonomies:null},t}return t=x,(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:v+"/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:v+"/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:v+"/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(c,null,React.createElement(y,{label:"{ __('Settings') }"},React.createElement(w,{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(u,null,React.createElement(g,{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(g,{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(b,{label:__("Sort posts by","wordpress-popular-posts"),value:t.order_by,options:[{label:__("Total views","wordpress-popular-posts"),value:"views"},{label:__("Avg. daily views","wordpress-popular-posts"),value:"avg"},{label:__("Comments","wordpress-popular-posts"),value:"comments"}],onChange:function(e){a({order_by:e})}}),React.createElement(b,{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(g,{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(b,{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(d,{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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Filters","wordpress-popular-posts"))),React.createElement(g,{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(g,{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(g,{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(g,{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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Posts settings","wordpress-popular-posts"))),React.createElement(d,{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(g,{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(b,{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(d,{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,excerpt_format:!1}:{display_post_excerpt:e,excerpt_length:55})}}),t.display_post_excerpt&&React.createElement("div",{className:"option-subset"},React.createElement(d,{label:__("Keep text format and links","wordpress-popular-posts"),checked:t.excerpt_format,onChange:function(e){return a({excerpt_format:e})}}),React.createElement(g,{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(b,{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(d,{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_build:"manual"}:{thumbnail_width:75,thumbnail_height:75,display_post_thumbnail:e})}}),t.display_post_thumbnail&&React.createElement("div",{className:"option-subset"},React.createElement(b,{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){a("predefined"==e?{thumbnail_width:s.state.imgSizes[o[0].value].width,thumbnail_height:s.state.imgSizes[o[0].value].height,thumbnail_size:o[0].value}:{thumbnail_width:75,thumbnail_height:75,thumbnail_size:""}),a({thumbnail_build:e})}}),"manual"==t.thumbnail_build&&React.createElement(u,null,React.createElement(g,{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(g,{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(u,null,React.createElement(b,{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})}}))),_wordpress_popular_posts.can_show_rating&&React.createElement(d,{label:__("Display post rating","wordpress-popular-posts"),checked:t.rating,onChange:function(e){return a({rating: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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Stats Tag settings","wordpress-popular-posts"))),React.createElement(d,{label:__("Display comments count","wordpress-popular-posts"),checked:t.stats_comments,onChange:function(e){return a({stats_comments:e})}}),React.createElement(d,{label:__("Display views","wordpress-popular-posts"),checked:t.stats_views,onChange:function(e){return a({stats_views:e})}}),React.createElement(d,{label:__("Display author","wordpress-popular-posts"),checked:t.stats_author,onChange:function(e){return a({stats_author:e})}}),React.createElement(d,{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(b,{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"},{label:__("WordPress Date Format","wordpress-popular-posts"),value:"wp_date_format"}],onChange:function(e){return a({stats_date_format:e})}})),React.createElement(d,{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(b,{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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("HTML Markup settings","wordpress-popular-posts"))),React.createElement(d,{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(_,{rows:"1",label:__("Before title","wordpress-popular-posts"),value:t.header_start,onChange:function(e){return a({header_start:e})}}),React.createElement(_,{rows:"1",label:__("After title","wordpress-popular-posts"),value:t.header_end,onChange:function(e){return a({header_end:e})}}),React.createElement(_,{rows:"1",label:__("Before popular posts","wordpress-popular-posts"),value:t.wpp_start,onChange:function(e){return a({wpp_start:e})}}),React.createElement(_,{rows:"1",label:__("After popular posts","wordpress-popular-posts"),value:t.wpp_end,onChange:function(e){return a({wpp_end:e})}}),React.createElement(_,{label:__("Post HTML markup","wordpress-popular-posts"),value:t.post_html,onChange:function(e){return a({post_html:e})}})),React.createElement(b,{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.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(f,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(u,null,this.getMainFields(),this.getFiltersFields(),this.getPostSettingsFields(),this.getStatsTagFields(),this.getHTMLMarkupFields()),!this.state.editMode&&React.createElement(h,null,React.createElement(l,{block:this.props.name,className:a,attributes:s,urlQueryArgs:{isSelected:t}})))]}}])&&s(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),x}(p),R=wp.blocks.registerBlockType,E=wp.i18n.__;R("wordpress-popular-posts/widget",{title:"WordPress Popular Posts",category:"widgets",icon:t.flame,description:E("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:""},rating:{type:"boolean",default:!1},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:x,save:function(){return null}})})();
1
+ !function(){"use strict";var e={};e.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 t=e;function a(e){return a="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},a(e)}function s(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 r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function o(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}var l=wp.serverSideRender,p=wp.element,i=p.Component,u=p.Fragment,c=wp.blockEditor.BlockControls,m=wp.components,d=m.CheckboxControl,h=m.Disabled,b=m.SelectControl,f=m.Spinner,_=m.TextareaControl,g=m.TextControl,y=m.Toolbar,w=m.ToolbarButton,__=wp.i18n.__,v="wordpress-popular-posts/v1",x=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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(x,e);var t,a,p,i,m=(p=x,i=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=n(p);if(i){var a=n(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return o(this,e)});function x(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,x),(t=m.call(this,e)).state={error:null,editMode:!0,themes:null,imgSizes:null,taxonomies:null},t}return t=x,(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:v+"/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:v+"/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:v+"/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(c,null,React.createElement(y,{label:"{ __('Settings') }"},React.createElement(w,{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(u,null,React.createElement(g,{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(g,{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(b,{label:__("Sort posts by","wordpress-popular-posts"),value:t.order_by,options:[{label:__("Total views","wordpress-popular-posts"),value:"views"},{label:__("Avg. daily views","wordpress-popular-posts"),value:"avg"},{label:__("Comments","wordpress-popular-posts"),value:"comments"}],onChange:function(e){a({order_by:e})}}),React.createElement(b,{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(g,{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(b,{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(d,{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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Filters","wordpress-popular-posts"))),React.createElement(g,{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(g,{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(g,{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(g,{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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Posts settings","wordpress-popular-posts"))),React.createElement(d,{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(g,{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(b,{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(d,{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,excerpt_format:!1}:{display_post_excerpt:e,excerpt_length:55})}}),t.display_post_excerpt&&React.createElement("div",{className:"option-subset"},React.createElement(d,{label:__("Keep text format and links","wordpress-popular-posts"),checked:t.excerpt_format,onChange:function(e){return a({excerpt_format:e})}}),React.createElement(g,{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(b,{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(d,{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_build:"manual"}:{thumbnail_width:75,thumbnail_height:75,display_post_thumbnail:e})}}),t.display_post_thumbnail&&React.createElement("div",{className:"option-subset"},React.createElement(b,{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){a("predefined"==e?{thumbnail_width:s.state.imgSizes[o[0].value].width,thumbnail_height:s.state.imgSizes[o[0].value].height,thumbnail_size:o[0].value}:{thumbnail_width:75,thumbnail_height:75,thumbnail_size:""}),a({thumbnail_build:e})}}),"manual"==t.thumbnail_build&&React.createElement(u,null,React.createElement(g,{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(g,{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(u,null,React.createElement(b,{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})}}))),_wordpress_popular_posts.can_show_rating&&React.createElement(d,{label:__("Display post rating","wordpress-popular-posts"),checked:t.rating,onChange:function(e){return a({rating: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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("Stats Tag settings","wordpress-popular-posts"))),React.createElement(d,{label:__("Display comments count","wordpress-popular-posts"),checked:t.stats_comments,onChange:function(e){return a({stats_comments:e})}}),React.createElement(d,{label:__("Display views","wordpress-popular-posts"),checked:t.stats_views,onChange:function(e){return a({stats_views:e})}}),React.createElement(d,{label:__("Display author","wordpress-popular-posts"),checked:t.stats_author,onChange:function(e){return a({stats_author:e})}}),React.createElement(d,{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(b,{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"},{label:__("WordPress Date Format","wordpress-popular-posts"),value:"wp_date_format"}],onChange:function(e){return a({stats_date_format:e})}})),React.createElement(d,{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(b,{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(u,null,React.createElement("p",{className:"not-a-legend"},React.createElement("strong",null,__("HTML Markup settings","wordpress-popular-posts"))," ",React.createElement("small",null,"(",React.createElement("a",{href:"https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#how-can-i-use-my-own-html-markup-with-your-plugin",target:"_blank"},__("What is this?","wordpress-popular-posts")),")")),React.createElement(d,{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(_,{rows:"1",label:__("Before title","wordpress-popular-posts"),value:t.header_start,onChange:function(e){return a({header_start:e})}}),React.createElement(_,{rows:"1",label:__("After title","wordpress-popular-posts"),value:t.header_end,onChange:function(e){return a({header_end:e})}}),React.createElement(_,{rows:"1",label:__("Before popular posts","wordpress-popular-posts"),value:t.wpp_start,onChange:function(e){return a({wpp_start:e})}}),React.createElement(_,{rows:"1",label:__("After popular posts","wordpress-popular-posts"),value:t.wpp_end,onChange:function(e){return a({wpp_end:e})}}),React.createElement(_,{label:__("Post HTML markup","wordpress-popular-posts"),value:t.post_html,onChange:function(e){return a({post_html:e})}}),React.createElement("small",null,React.createElement("a",{href:"https://github.com/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags#content-tags",target:"_blank"},__("Content Tags List","wordpress-popular-posts")))),React.createElement(b,{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.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(f,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(u,null,this.getMainFields(),this.getFiltersFields(),this.getPostSettingsFields(),this.getStatsTagFields(),this.getHTMLMarkupFields()),!this.state.editMode&&React.createElement(h,null,React.createElement(l,{block:this.props.name,className:a,attributes:s,urlQueryArgs:{isSelected:t}})))]}}])&&s(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),x}(i),R=wp.blocks.registerBlockType,E=wp.i18n.__;R("wordpress-popular-posts/widget",{title:"WordPress Popular Posts",category:"widgets",icon:t.flame,description:E("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:""},rating:{type:"boolean",default:!1},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:x,save:function(){return null}})}();
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: 2022-11-12 15:20-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"
@@ -302,6 +302,14 @@ msgstr ""
302
  msgid "HTML Markup settings"
303
  msgstr ""
304
 
 
 
 
 
 
 
 
 
305
  #: assets/js/blocks/block-wpp-widget.js:1 src/Block/Widget/edit.js:686
306
  #: src/Widget/form.php:191
307
  msgid "Use custom HTML Markup"
@@ -327,7 +335,11 @@ msgstr ""
327
  msgid "Post HTML markup"
328
  msgstr ""
329
 
330
- #: assets/js/blocks/block-wpp-widget.js:1 src/Block/Widget/edit.js:724
 
 
 
 
331
  #: src/Widget/form.php:219
332
  msgid "Theme"
333
  msgstr ""
@@ -625,13 +637,6 @@ msgstr ""
625
  msgid "Lazy load"
626
  msgstr ""
627
 
628
- #: src/Admin/screen-tools.php:57 src/Admin/screen-tools.php:155
629
- #: src/Admin/screen-tools.php:183 src/Widget/form.php:7 src/Widget/form.php:54
630
- #: src/Widget/form.php:60 src/Widget/form.php:88 src/Widget/form.php:98
631
- #: src/Widget/form.php:191
632
- msgid "What is this?"
633
- msgstr ""
634
-
635
  #: src/Admin/screen-tools.php:60
636
  msgid "No"
637
  msgstr ""
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: 2022-11-24 12:14-0400\n"
9
  "PO-Revision-Date: 2015-04-24 13:30-0430\n"
10
  "Last-Translator: Héctor Cabrera <hcabrerab@gmail.com>\n"
11
  "Language-Team: Héctor Cabrera <me@cabrerahector.com>\n"
302
  msgid "HTML Markup settings"
303
  msgstr ""
304
 
305
+ #: assets/js/blocks/block-wpp-widget.js:1 src/Admin/screen-tools.php:57
306
+ #: src/Admin/screen-tools.php:155 src/Admin/screen-tools.php:183
307
+ #: src/Block/Widget/edit.js:684 src/Widget/form.php:7 src/Widget/form.php:54
308
+ #: src/Widget/form.php:60 src/Widget/form.php:88 src/Widget/form.php:98
309
+ #: src/Widget/form.php:191
310
+ msgid "What is this?"
311
+ msgstr ""
312
+
313
  #: assets/js/blocks/block-wpp-widget.js:1 src/Block/Widget/edit.js:686
314
  #: src/Widget/form.php:191
315
  msgid "Use custom HTML Markup"
335
  msgid "Post HTML markup"
336
  msgstr ""
337
 
338
+ #: assets/js/blocks/block-wpp-widget.js:1 src/Block/Widget/edit.js:721
339
+ msgid "Content Tags List"
340
+ msgstr ""
341
+
342
+ #: assets/js/blocks/block-wpp-widget.js:1 src/Block/Widget/edit.js:725
343
  #: src/Widget/form.php:219
344
  msgid "Theme"
345
  msgstr ""
637
  msgid "Lazy load"
638
  msgstr ""
639
 
 
 
 
 
 
 
 
640
  #: src/Admin/screen-tools.php:60
641
  msgid "No"
642
  msgstr ""
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: hcabrera
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
4
  Tags: popular, posts, widget, popularity, top
5
  Requires at least: 5.3
6
- Tested up to: 6.1.0
7
  Requires PHP: 7.2
8
- Stable tag: 6.1.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -109,6 +109,14 @@ The FAQ section has been moved [here](https://github.com/cabrerahector/wordpress
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
 
112
  = 6.1.0 =
113
 
114
  - Improves PHP 8.1 support.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
4
  Tags: popular, posts, widget, popularity, top
5
  Requires at least: 5.3
6
+ Tested up to: 6.1.1
7
  Requires PHP: 7.2
8
+ Stable tag: 6.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
109
 
110
  == Changelog ==
111
 
112
+ = 6.1.1 =
113
+
114
+ - Fixes a rare PHP fatal error that can occur during plugin activation.
115
+ - Block: adds links to documentation within the block form for ease of access.
116
+ - Updates dependencies.
117
+
118
+ [Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-6-1-0-improved-php-8-1-support-plus-minor-enhancements/#minor-updates-and-hotfixes)
119
+
120
  = 6.1.0 =
121
 
122
  - Improves PHP 8.1 support.
src/Activation/Activator.php CHANGED
@@ -24,10 +24,10 @@ class Activator {
24
  * Fired when the plugin is activated.
25
  *
26
  * @since 1.0.0
27
- * @param bool $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
28
  * @global object $wpdb
29
  */
30
- public static function activate(bool $network_wide)
31
  {
32
  global $wpdb;
33
 
24
  * Fired when the plugin is activated.
25
  *
26
  * @since 1.0.0
27
+ * @param mixed $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog. Sometimes it's NULL though.
28
  * @global object $wpdb
29
  */
30
+ public static function activate($network_wide) /** @TODO: starting PHP 8.0 $network_wide can be declared as mixed $network_wide */
31
  {
32
  global $wpdb;
33
 
src/Activation/Deactivator.php CHANGED
@@ -25,9 +25,9 @@ class Deactivator {
25
  *
26
  * @since 1.0.0
27
  * @global object wpbd
28
- * @param bool network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
29
  */
30
- public static function deactivate(bool $network_wide)
31
  {
32
  global $wpdb;
33
 
25
  *
26
  * @since 1.0.0
27
  * @global object wpbd
28
+ * @param mixed network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog. Sometimes is NULL though.
29
  */
30
+ public static function deactivate($network_wide) /** @TODO: starting PHP 8.0 $network_wide can be declared as mixed $network_wide */
31
  {
32
  global $wpdb;
33
 
src/Block/Widget/edit.js CHANGED
@@ -681,7 +681,7 @@ export class WPPWidgetBlockEdit extends Component
681
  }
682
 
683
  return <Fragment>
684
- <p className='not-a-legend'><strong>{__('HTML Markup settings', 'wordpress-popular-posts')}</strong></p>
685
  <CheckboxControl
686
  label={__('Use custom HTML Markup', 'wordpress-popular-posts')}
687
  checked={attributes.custom_html}
@@ -718,6 +718,7 @@ export class WPPWidgetBlockEdit extends Component
718
  value={attributes.post_html}
719
  onChange={(value) => setAttributes({ post_html: value })}
720
  />
 
721
  </div>
722
  }
723
  <SelectControl
681
  }
682
 
683
  return <Fragment>
684
+ <p className='not-a-legend'><strong>{__('HTML Markup settings', 'wordpress-popular-posts')}</strong> <small>(<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#how-can-i-use-my-own-html-markup-with-your-plugin" target="_blank">{__('What is this?', 'wordpress-popular-posts')}</a>)</small></p>
685
  <CheckboxControl
686
  label={__('Use custom HTML Markup', 'wordpress-popular-posts')}
687
  checked={attributes.custom_html}
718
  value={attributes.post_html}
719
  onChange={(value) => setAttributes({ post_html: value })}
720
  />
721
+ <small><a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags#content-tags" target="_blank">{__('Content Tags List', 'wordpress-popular-posts')}</a></small>
722
  </div>
723
  }
724
  <SelectControl
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: 6.1.0
20
  * Requires at least: 5.3
21
  * Requires PHP: 7.2
22
  * Author: Hector Cabrera
@@ -31,7 +31,7 @@ if ( ! defined( 'WPINC' ) ) {
31
  die();
32
  }
33
 
34
- define('WPP_VERSION', '6.1.0');
35
 
36
  $wpp_main_plugin_file = __FILE__;
37
  // Load plugin bootstrap
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: 6.1.1
20
  * Requires at least: 5.3
21
  * Requires PHP: 7.2
22
  * Author: Hector Cabrera
31
  die();
32
  }
33
 
34
+ define('WPP_VERSION', '6.1.1');
35
 
36
  $wpp_main_plugin_file = __FILE__;
37
  // Load plugin bootstrap