Platinum SEO Pack - Version 2.1.2

Version Description

  • 2020-06-01 - Sitemap has been further enhanced with the latest WordPress sitemap files. Also a few styling changes have been implemented to the sitemap rendered by the plugin. A few other cosmetic changes have been done to Help text wordings in a few files.
Download this release

Release Info

Developer Rajesh Babu
Plugin Icon 128x128 Platinum SEO Pack
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

Files changed (25) hide show
  1. Changelog.txt +3 -0
  2. platinum-seo-pack.php +1 -1
  3. psp-include/settings/js/snippetpreview.js +1 -1
  4. psp-include/settings/psp_analysis_metabox_renderer.php +1 -1
  5. psp-include/settings/psp_basic_metabox_renderer.php +4 -0
  6. psp-include/settings/psp_settings.php +8 -5
  7. psp-include/sitemap/inc/{class-core-sitemaps-index.php → class-wp-sitemaps-index.php} +16 -12
  8. psp-include/sitemap/inc/{class-core-sitemaps-provider.php → class-wp-sitemaps-provider.php} +33 -65
  9. psp-include/sitemap/inc/{class-core-sitemaps-registry.php → class-wp-sitemaps-registry.php} +9 -9
  10. psp-include/sitemap/inc/{class-core-sitemaps-renderer.php → class-wp-sitemaps-renderer.php} +14 -24
  11. psp-include/sitemap/inc/{class-core-sitemaps-stylesheet.php → class-wp-sitemaps-stylesheet.php} +5 -5
  12. psp-include/sitemap/inc/{class-core-sitemaps.php → class-wp-sitemaps.php} +30 -31
  13. psp-include/sitemap/inc/functions.php +24 -24
  14. psp-include/sitemap/inc/providers/class-core-sitemaps-posts.php +0 -160
  15. psp-include/sitemap/inc/providers/class-core-sitemaps-taxonomies.php +0 -143
  16. psp-include/sitemap/inc/providers/class-core-sitemaps-users.php +0 -111
  17. psp-include/sitemap/inc/providers/class-wp-sitemaps-posts.php +211 -0
  18. psp-include/sitemap/inc/providers/class-wp-sitemaps-taxonomies.php +193 -0
  19. psp-include/sitemap/inc/providers/class-wp-sitemaps-users.php +163 -0
  20. psp-include/sitemap/psp_sitemap.php +161 -71
  21. psp-include/sitemap/psp_sitemap_settings.php +28 -5
  22. psp-include/sitemap/sitemap-image.xsl +12 -4
  23. psp-include/utilities/psp_helper.php +1 -1
  24. psp_main.php +4 -4
  25. readme.txt +4 -1
Changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 2.1.1 =
2
  * 2020-05-22 - Platinum SEO Plugin becomes the first SEO plugin to integrate with the upcoming SiteMap functionality in WordPress Core. The Core siteMap is still in development and Platinum SEO has integrated with the currently available version of the Core Module. If you do like to generate a sitemap with Platinum SEO, do enable it and enable the Object Types for which you want to generate a sitemap in SiteMap settings in Platinum SEO.
3
 
1
+ = 2.1.2 =
2
+ * 2020-06-01 - Sitemap has been further enhanced with the latest WordPress sitemap files. Also a few styling changes have been implemented to the sitemap rendered by the plugin. A few other cosmetic changes have been done to Help text wordings in a few files.
3
+
4
  = 2.1.1 =
5
  * 2020-05-22 - Platinum SEO Plugin becomes the first SEO plugin to integrate with the upcoming SiteMap functionality in WordPress Core. The Core siteMap is still in development and Platinum SEO has integrated with the currently available version of the Core Module. If you do like to generate a sitemap with Platinum SEO, do enable it and enable the Object Types for which you want to generate a sitemap in SiteMap settings in Platinum SEO.
6
 
platinum-seo-pack.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Platinum SEO Pack
5
  Plugin URI: https://techblissonline.com/platinum-wordpress-seo-plugin/
6
  Description: Complete SEO and Social optimization solution for your Wordpress blog/site. It is Simple, Uncomplicated and User friendly with several useful features.
7
- Version: 2.1.1
8
  Author: Techblissonline.com (Rajesh)
9
  Author URI: https://techblissonline.com/
10
  Text Domain: platinum-seo-pack
4
  Plugin Name: Platinum SEO Pack
5
  Plugin URI: https://techblissonline.com/platinum-wordpress-seo-plugin/
6
  Description: Complete SEO and Social optimization solution for your Wordpress blog/site. It is Simple, Uncomplicated and User friendly with several useful features.
7
+ Version: 2.1.2
8
  Author: Techblissonline.com (Rajesh)
9
  Author URI: https://techblissonline.com/
10
  Text Domain: platinum-seo-pack
psp-include/settings/js/snippetpreview.js CHANGED
@@ -1 +1 @@
1
- function escapeRegExp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function wordCount(e){var t=e.match(/\S+/g);return t?t.length:0}function pspSortArray(e,t){var s=[],i=[];for(let r=0;r<e.length;r++)i=[],void 0!==(i=wp.data.select("core").getEntityRecord("taxonomy",t,e[r]))&&(s[r]=i.name);return s?(s.sort(),s[0]):"%"+t+"%"}function pspSortClassicArray(e,t){var s=[];return jQuery('input[name="'+e+'"]:checked').each(function(){s.push(jQuery(this).parent("label").text())}),s&&s.length?(s.sort(),s[0]):"%"+t+"%"}function boldWords(e){var t=e,s=jQuery("#psp_seo_meta\\[keywords\\]").val().match(/\S+/g);if(s)for(i=0;i<s.length;i++)t=(t=t.replace(new RegExp("(^|[\\W])("+escapeRegExp(s[i])+")([\\W]|$)","gi"),"$1<b>$2</b>$3")).replace(new RegExp("(^|[\\W])("+escapeRegExp(s[i])+")([\\W]|$)","gi"),"$1<b>$2</b>$3");return t}function boldText(e){var t=e,s=jQuery("#psp_seo_meta\\[keywords\\]").val().match(/\S+/g);if(s)for(i=0;i<s.length;i++)t=t.replace(new RegExp("("+escapeRegExp(s[i])+")","gi"),"<b>$1</b>");return t}function htmlEncode(e){return jQuery("<div/>").text(e).html()}function setGtbUrlPreview(e){var t="";(t=e)&&(t=t.replace(/^https?\:\/\//i,""));var s=htmlEncode(t),i=(s=s.replace(/\/$/,"")).length;jQuery("#permalinkSizer").html(s);var r=s=s.replace(/([^https?:\/\/])(\/)/g,"$1 > ");t=s,jQuery("#urlSizer").html(s),jQuery("#murlSizer").html(r);var n=new RegExp("W(.*)$");for(trimmed=!1;jQuery("#urlSizer").width()>566;){var a=s;a=(a=(a=(a=a.substring(0,a.length-1)).trim()).replace(/\>$/,"")).trim(),jQuery("#urlSizer").html(a),s=a,trimmed=!0}trimmed&&(s+=" ...",jQuery("#urlSizer").html(s)),info=i+" characters, ",jQuery("#urlInfo").html(s.length+" characters, "+jQuery("#urlSizer").width()+" pixels"),jQuery("#urlSizer").width()<=584?jQuery("#urlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"):jQuery("#urlInfo").html(info+'<span style="color:red;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"),jQuery("#techblissonlineSnippetUrl").html(s),mtrimmed=!1;for(var l=r;r.length>42;)r=jQuery.trim(r.replace(" ...","")),(l=(l=(l=jQuery.trim(l.replace(n,""))).trim()).replace(/\>$/,"")).length>=42&&(l=(l=jQuery.trim(r.replace(" ...",""))).substring(0,l.length-1)),l=l.trim(),r=l+=" ...",mtrimmed=!0;mtrimmed&&jQuery("#murlSizer").html(r),info=r.length+" characters, ",jQuery("#murlInfo").html(r.length+" characters, "+jQuery("#murlSizer").width()+" pixels"),jQuery("#murlSizer").width()<=282?jQuery("#murlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+" pixels</span>"):jQuery("#murlInfo").html(info+'<span style="color:red;">'+jQuery("#murlSizer").width()+" pixels</span>"),jQuery("#techblissonlineMSnippetUrl").html(r)}function setUrlPreview(){var e=jQuery.trim(jQuery("#pspHomePermalink").text())+"slug-name/",t=!1;if(window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(t=wpEditorL10n.tinymce.settings),jQuery("#editable-post-name").length){e=jQuery.trim(jQuery("#sample-permalink").text());var s=jQuery.trim(jQuery("#editable-post-name").text());e=(e=e.replace(s,"")).replace(/\/$/g,"")}else jQuery("#name").length?e=jQuery.trim(jQuery("#pspPostPermalink").text()):jQuery("#slug").length?e=jQuery.trim(jQuery("#pspPostPermalink").text()):t&&wp.data&&wp.data.select&&(e=wp.data.select("core/editor").getPermalink(),wp.data.subscribe(function(){setGtbUrlPreview(wp.data.select("core/editor").getPermalink())}));if(jQuery("#new-post-slug").length>0)e+=jQuery("#new-post-slug").val();else if(jQuery("#editable-post-name-full").length){e+=jQuery("#editable-post-name-full").text()}e&&(e=e.replace(/^https?\:\/\//i,""));var i=htmlEncode(e),r=i.length;r=(i=i.replace(/\/$/,"")).length;jQuery("#permalinkSizer").html(i);var n=i=i.replace(/([^https?:\/\/])(\/)/g,"$1 > ");e=i,jQuery("#urlSizer").html(i),jQuery("#murlSizer").html(n);var a=new RegExp("W(.*)$");for(trimmed=!1;jQuery("#urlSizer").width()>584;){var l=i;l=(l=(l=(l=l.substring(0,l.length-1)).trim()).replace(/\>$/,"")).trim(),jQuery("#urlSizer").html(l),i=l,trimmed=!0}trimmed&&(i+=" ..."),info=r+" characters, ",jQuery("#urlInfo").html(r+" characters, "+jQuery("#urlSizer").width()+" pixels"),jQuery("#urlSizer").width()<=584?jQuery("#urlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"):jQuery("#urlInfo").html(info+'<span style="color:red;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"),jQuery("#techblissonlineSnippetUrl").html(i),mtrimmed=!1;for(var o=n;o.length>42;)n=jQuery.trim(n.replace(" ...","")),(o=(o=(o=jQuery.trim(o.replace(a,""))).trim()).replace(/\>$/,"")).length>=42&&(o=(o=jQuery.trim(n.replace(" ...",""))).substring(0,o.length-1)),o=o.trim(),n=o+=" ...",mtrimmed=!0;mtrimmed&&jQuery("#murlSizer").html(n),info=n.length+" characters, ",jQuery("#murlInfo").html(n.length+" characters, "+jQuery("#murlSizer").width()+" pixels"),jQuery("#murlSizer").width()<=282?jQuery("#murlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+" pixels</span>"):jQuery("#murlInfo").html(info+'<span style="color:red;">'+jQuery("#murlSizer").width()+" pixels</span>"),jQuery("#techblissonlineMSnippetUrl").html(n)}function stripTrailingSlash(e){return"/"==e.substr(-1)?e.substr(0,e.length-1):e}function setGtbTitlePreview(e,t){var s=jQuery("#psp_seo_meta\\[titleformat\\]").val(),i=!1,r=!1;jQuery("#psp_seo_meta\\[disable_title_format\\]:checked").length>0&&(i=!0),jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(r=!0),i&&(s="%seo_title%"),r&&(s="%wp_title%");var n=jQuery("#pspPostTypeArrayFormat").text(),a=JSON.parse(n),l=jQuery("#psp_seo_meta\\[title\\]"),o=s.replace("%seo_title%",e);if(""===e&&(o=o.replace("%seo_title%",l.attr("placeholder"))),o=(o=(o=(o=(o=(o=o.replace("%wp_title%",a.wp_title)).replace("%site_name%",a.site_name)).replace("%site_description%",a.site_description)).replace("%category%",t)).replace("%taxonomy%",t)).replace(/%sep%/g,a.sep),""!==(o=(o=jQuery.trim(o)).trim(a.sep))){var p=htmlEncode(o),c=p;jQuery("#titleSizer").html(p),jQuery("#actualTitleSizer").html(p);var d=new RegExp("sw+(.*)$");trimmed=!1;for(var u=p;jQuery("#titleSizer").width()>584;)p=jQuery.trim(p.replace(" ...","")),(u=jQuery.trim(u.replace(d,""))).length>=p.length&&(u=u.substring(0,u.length-1)),p=u+" ...",jQuery("#titleSizer").html(p),trimmed=!0;trimmed,jQuery("#titleSizer").html(p),mtrimmed=!1;for(var h=c;h.length>78;)c=jQuery.trim(c.replace(" ...","")),(h=jQuery.trim(h.replace(d,""))).length>=78&&(h=(h=jQuery.trim(h.replace(" ...",""))).substring(0,h.length-1)),c=h+=" ...",mtrimmed=!0;mtrimmed,jQuery("#mtitleSizer").html(c),info=jQuery("<textarea />").html(p).text().length+" characters, "+wordCount(p)+" words ",jQuery("#titleInfo").html(p.length+" characters, "+jQuery("#titleSizer").width()+" pixels, "+wordCount(p)+" words"),jQuery("#titleSizer").width()<=584?jQuery("#titleInfo").html(info+'<span style="color:green;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"):jQuery("#titleInfo").html(info+'<span style="color:red;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"),minfo=jQuery("<textarea />").html(c).text().length+" characters/ 78 characters "+wordCount(c)+" words ",jQuery("#mtitleInfo").html(c.length+" characters, "+jQuery("#mtitleSizer").width()+" pixels, "+wordCount(c)+" words"),c.length<=78?jQuery("#mtitleInfo").html('<span style="color:green;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"):jQuery("#mtitleInfo").html('<span style="color:red;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"),jQuery("#techblissonlineSnippetTitle").html(p),jQuery("#techblissonlineMSnippetTitle").html(c),setPSPSeoAnalysis()}}function setTitlePreview(){var e,t,s="",i="",r="",n=!1,a="";window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(n=wpEditorL10n.tinymce.settings);var l=jQuery("#pspPostTypeArrayFormat").text(),o=JSON.parse(l),p=jQuery("#psp_seo_meta\\[titleformat\\]").val(),c=!1,d=!1,u=!1;jQuery("#psp_seo_meta\\[disable_title_format\\]:checked").length>0&&(c=!0),jQuery("#psp_seo_meta\\[disable_title\\]:checked").length>0&&(d=!0),jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(u=!0);a=o.category,p.toLowerCase().indexOf("%wp_title%");var h=jQuery("#title"),m=jQuery("#psp_seo_meta\\[title\\]");i=m.attr("placeholder");var y=jQuery("#psp_seo_meta\\[preferred_tax\\]"),g="categories",j="post_category[]",Q="category";if(y&&y.val()&&"category"!==(Q=jQuery("#psp_seo_meta\\[preferred_tax\\] option:selected").text())&&(g=Q,j="tax_input["+Q+"][]"),h&&(a=pspSortClassicArray(j,Q)),!m.val()||d||u?(jQuery("#title").val()?i=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?i=jQuery.trim(jQuery("#name").val()):n&&wp.data&&wp.data.select&&(i=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",void 0!==t&&t.length>0&&(a=pspSortArray(t,Q)),wp.data.subscribe(function(){i=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",void 0!==t&&t.length>0&&(a=pspSortArray(t,Q)),void 0===i&&(m=jQuery("#psp_seo_meta\\[title\\]")),""===i&&(m=jQuery("#psp_seo_meta\\[title\\]"),i=m.attr("placeholder")),a&&setGtbTitlePreview(i,a)})),s=i,(c||u)&&(p="%wp_title%"),s=(s=(s=(s=(s=(s=(s=p.replace("%seo_title%",i)).replace("%wp_title%",i)).replace("%site_name%",o.site_name)).replace("%site_description%",o.site_description)).replace("%taxonomy%",a)).replace("%category%",a)).replace(/%sep%/g,o.sep),s=(s=jQuery.trim(s)).trim(o.sep)):(s=m.val(),r=m.val(),jQuery("#title").val()?i=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?i=jQuery.trim(jQuery("#name").val()):n&&wp.data&&wp.data.select&&(i=wp.data.select("core/editor").getEditedPostAttribute("title"),e=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",void 0!==e&&e.length>0&&(a=pspSortArray(e,Q)),wp.data.subscribe(function(){i=wp.data.select("core/editor").getEditedPostAttribute("title"),e=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",r=m.val(),void 0!==e&&e.length>0&&(a=pspSortArray(e,Q)),r&&a&&setGtbTitlePreview(r,a)})),c&&(p="%seo_title%"),s=(s=(s=(s=(s=(s=(s=p.replace("%seo_title%",r)).replace("%wp_title%",i)).replace("%site_name%",o.site_name)).replace("%site_description%",o.site_description)).replace("%taxonomy%",a)).replace("%category%",a)).replace(/%sep%/g,o.sep),s=(s=jQuery.trim(s)).trim(o.sep)),""!==s){""===i||n||i;var f=htmlEncode(s),w=f;jQuery("#titleSizer").html(f),jQuery("#actualTitleSizer").html(f);var v=new RegExp("sw+(.*)$"),S=f;for(trimmed=!1;jQuery("#titleSizer").width()>584;)f=jQuery.trim(f.replace(" ...","")),(S=jQuery.trim(S.replace(v,""))).length>=f.length&&(S=S.substring(0,S.length-1)),f=S+" ...",jQuery("#titleSizer").text(f),trimmed=!0;trimmed,jQuery("#titleSizer").text(f),jQuery("body").append(jQuery("#titleSizer")).width(),jQuery("body#titleSizer").remove(),info=jQuery("<textarea />").html(f).text().length+" characters, "+wordCount(f)+" words ",jQuery("#titleInfo").html(f.length+" characters, "+jQuery("#titleSizer").width()+" pixels, "+wordCount(f)+" words"),jQuery("#titleSizer").width()<=584?jQuery("#titleInfo").html(info+'<span style="color:green;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"):jQuery("#titleInfo").html(info+'<span style="color:red;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"),jQuery("#techblissonlineSnippetTitle").html(f);var _=w;for(mtrimmed=!1;_.length>78;)w=jQuery.trim(w.replace(" ...","")),(_=jQuery.trim(_.replace(v,""))).length>=78&&(_=(_=jQuery.trim(_.replace(" ...",""))).substring(0,_.length-1)),w=_+=" ...",mtrimmed=!0;mtrimmed,jQuery("#mtitleSizer").text(w),jQuery("body").append(jQuery("#mtitleSizer")).width(),jQuery("body#mtitleSizer").remove(),minfo=jQuery("<textarea />").html(w).text().length+" characters/ 78 characters "+wordCount(w)+" words ",jQuery("#mtitleInfo").html(w.length+" characters, "+jQuery("#mtitleSizer").width()+" pixels, "+wordCount(w)+" words"),w.length<=78?jQuery("#mtitleInfo").html('<span style="color:green;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"):jQuery("#mtitleInfo").html('<span style="color:red;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"),jQuery("#techblissonlineMSnippetTitle").html(w),setPSPSeoAnalysis()}}function setDescriptionPreview(){var e,t=!1,s=jQuery("#psp_seo_meta\\[description\\]");window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(t=wpEditorL10n.tinymce.settings);var i=jQuery.trim(jQuery("#psp_seo_meta\\[maxsnippet\\]").val()),r=i;parseInt(i)<0&&(i=230,r=285),jQuery.inArray(parseInt(i),[-1,0,1,2,3,4])>-1&&(i=230,r=285),""===i&&(i=230,r=285),i=parseInt(i),r=parseInt(r);var n="",a=!1,l=!1,o=jQuery("#pspPostTypeArrayFormat").text();if(e=JSON.parse(o).autogendesc,jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(a=!0),jQuery("#psp_seo_meta\\[disable_description\\]:checked").length>0&&(l=!0),""!==n||a||l||(n=jQuery.trim(jQuery("#psp_seo_meta\\[description\\]").val())),""===n){if(""===n&&t&&wp.data&&wp.data.select){var p=wp.data.select("core/editor").getEditedPostContent();return""!==e&&(n=(n=p.replace(/(<([^>]+)>)/gi,"")).substring(0,r)),n||(n=s.attr("placeholder")),void setGTBDescPreview(n)}var c=jQuery.trim(jQuery("#content").val());if(!s.val()||a||l)return""!==e&&(n=(n=c.replace(/(<([^>]+)>)/gi,"")).substring(0,r)),n||(n=s.attr("placeholder")),void setGTBDescPreview(n)}return n?void setGTBDescPreview(n):void 0}function setGTBDescPreview(e){jQuery("#psp_seo_meta\\[description\\]");var t=e;placeholder_desc=e;var s=jQuery.trim(jQuery("#psp_seo_meta\\[maxsnippet\\]").val()),i=s;parseInt(s)<0&&(s=230,i=285),jQuery.inArray(parseInt(s),[-1,0,1,2,3,4])>-1&&(s=230,i=285),""===s&&(s=230,i=285),s=parseInt(s),i=parseInt(i);var r=htmlEncode(t),n=r+=" ...";jQuery("#descriptionSizer").html(r),jQuery("#mdescriptionSizer").html(n);for(var a=new RegExp("sw+(.*)$"),l=r;l.length>s;)r=jQuery.trim(r.replace(" ...","")),l=jQuery.trim(l.replace(a,"")),t=jQuery.trim(t.replace(a,"")),l.length>=s&&(l=(l=jQuery.trim(l.replace(" ...",""))).substring(0,l.length-1),t=t.substring(0,t.length-1)),l+=" ...";r=l,jQuery("#descriptionSizer").html(r);for(var o=n;o.length>i;)n=jQuery.trim(n.replace(" ...","")),(o=jQuery.trim(o.replace(a,""))).length>=i&&(o=(o=jQuery.trim(o.replace(" ...",""))).substring(0,o.length-1)),o+=" ...";n=o,jQuery("#descriptionSizer").html(n),jQuery("body").append(jQuery("#descriptionSizer")).width(),jQuery("body").append(jQuery("#mdescriptionSizer")).width(),jQuery("body").remove("#descriptionSizer"),jQuery("body").remove("#mdescriptionSizer"),jQuery("#descriptionInfo").html(r.length+" characters, "+jQuery("#descriptionSizer").width()+" pixels, "+wordCount(r)+" words"),info=jQuery("#descriptionSizer").width()+" pixels, "+wordCount(r)+" words ",jQuery("#mdescriptionInfo").html(n.length+" characters, "+jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(n)+" words"),minfo=jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(n)+" words ",r.length<=146?jQuery("#descriptionInfo").html(info+'<span style="color:green;">'+r.length+"/~170 characters"):r.length<=160?jQuery("#descriptionInfo").html(info+'<span style="color:orange;">'+r.length+"/~170 characters</span>"):r.length<=166?jQuery("#descriptionInfo").html(info+'<span style="color:purple;">'+r.length+"/~170 characters</span>"):jQuery("#descriptionInfo").html(info+'<span style="color:red;">'+r.length+"/~170 characters</span>"),n.length<=146?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:green;">'+n.length+"/~170 characters"):n.length<=160?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:orange;">'+n.length+"/~170 characters</span>"):n.length<=166?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:purple;">'+n.length+"/~170 characters</span>"):jQuery("#mdescriptionInfo").html(minfo+'<span style="color:red;">'+n.length+"/~170 characters</span>"),jQuery("#techblissonlineSnippetDescription").html(r),jQuery("#techblissonlineMSnippetDescription").html(n)}function updateDateText(){var e=htmlEncode(jQuery.trim(jQuery("#DateText").val()));e.length>0?jQuery("#resultDateText").html(e+" - "):jQuery("#resultDateText").html("")}function setPSPSeoAnalysis(){var e,t=!1,s="",i="";window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(t=wpEditorL10n.tinymce.settings),t&&wp.data&&wp.data.select?(""==(i=wp.data.select("core/editor").getEditedPostContent())&&(i=wp.data.select("core/editor").getEditedPostAttribute("content")),s=wp.data.select("core/editor").getEditedPostAttribute("title")):(i=jQuery.trim(jQuery("#content").val()),s=jQuery.trim(jQuery("#title").val()));var r=[],n=0;e=i,""!=i&&(i=(i=(i=(i=i.replace(/(<([^>]+)>)/gi,"")).replace(/['"]+/g,"")).replace(/[^a-zA-Z]+/g," ")).toLowerCase(),r=i.split(/[\/\s]+/),n=r.length);var a,l=window.location.hostname,o=!1,p=!1;a=jQuery("<div />",{html:e}).find("a").map(function(){if(jQuery(this).attr("href")&&(-1==jQuery(this).attr("href").indexOf(l)&&(o=!0),-1!==jQuery(this).attr("href").indexOf(l)&&(p=!0)),""!==jQuery(this).text())return jQuery(this).text()}).get();var c;c=jQuery(e).find("img").map(function(){if(jQuery(this).attr("alt")&&""!==jQuery(this).attr("alt"))return jQuery(this).attr("alt")}).get();var d=!1,u=jQuery(e).find("img");void 0!==u&&u.length>0&&(d=!0);var h=!1,m=jQuery("<div />",{html:e}).find("h2, h3, h4, h5, h6");void 0!==m&&m.length>0&&(h=!0);var y;y=jQuery("<div />",{html:e}).find("h1").map(function(){if(""!==jQuery(this).text())return jQuery(this).text()}).get();var g;g=jQuery("<div />",{html:e}).find("h2").map(function(){if(""!==jQuery(this).text())return jQuery(this).text()}).get();var j=jQuery("#urlSizer").html(),Q=jQuery("#techblissonlineSnippetTitle").html(),f=jQuery("#techblissonlineSnippetDescription").val(),w=jQuery("#psp_seo_meta\\[description\\]").val(),v=jQuery("#psp_seo_meta\\[schema_string\\]").val(),S=!1,_=!1;""!==w&&(_=!0),""!==v&&"Invalid JSON Schema"!==v&&(S=!0);var x=jQuery.trim(jQuery("#permalinkSizer").html()),b=jQuery.trim(jQuery("#actualTitleSizer").html());jQuery("#actualTitleSizers").html(b);var z=0,P=0,E=0;""!==x&&(z=x.length),""!==x&&jQuery("#permalinkSizer").width(),""!==b&&(P=jQuery("<textarea />").html(b).text().length),""!==b&&(E=jQuery("#actualTitleSizer").width()),0==E&&(E=jQuery("#actualTitleSizers").width()-1),""!==j&&(j=j.trim());var T=0,k=0,I=0,C=0,A="",L=[0,2,4],U=[1,3,4],D=[],$=jQuery("#psp_seo_meta\\[keywords\\]").val();if(void 0!==$&&(D=$.split(",")),A+='<div class="psp-bs">',A+='<div class="container-fluid">',A+="<h1>Platinum SEO Analysis</h1>",A+='<p>This is a basic content analysis of this page and your focus keywords. Assigning a score does not mean anything and so we do not do that. Rather, make sure that all these basic recommendations are adhered to. We also recommend you to try our <a href="https://techblissonline.com/tools/" target="_blank">Techblissonline SEO Tools</a> for a detailed analysis of your pages and your competitor pages for your focus keywords, co-occuring words (related entities) and improve your content accordingly. </p>',A+='<div class="panel-group">',A+='<div class="row"><div class="col-sm-12">',A+='<div class="panel panel-primary">',A+='<div class="panel-heading">General</div>',A+='<div class="panel-body">',A+="<ul>",z>0&&z<75?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> URL Length is '+z+" characters </li>":z>75&&(A=A+'<li><span class="dashicons dashicons-dismiss"></span> URL lLength is '+z+' characters <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="URL might get truncated in Google SERPS if it is more than 75 characters wide. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>'),P>0&&P<70?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> SEO Title lLength is '+P+" characters </li>":P>70&&(A=A+'<li><span class="dashicons dashicons-dismiss"></span> Actual SEO Title lLength is '+P+' characters. <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Title might get truncated in Google SERPS if it is more than 70 characters wide. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>'),E>0&&E<574?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> SEO Title pixel width is '+E+" pixels </li>":E>574&&(A=A+'<li><span class="dashicons dashicons-dismiss"></span> SEO Title pixel width is '+E+' pixels including Title format. <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Title might get truncated in Google SERPS if it is more than 574 pixels wide. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>'),A+=_?'<li><span class="dashicons dashicons-yes-alt"></span> Platinum SEO Description is used </li>':'<li><span class="dashicons dashicons-dismiss"></span> Platinum SEO Description field is not filled in. You may be using auto-generated description. <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Using optimized description improves CTR from search and social engines"><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=S?'<li><span class="dashicons dashicons-yes-alt"></span> Json Schema is used on this page using Platinum SEO </li>':'<li><span class="dashicons dashicons-dismiss"></span> Json Schema is not used on this page using Platinum SEO <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Using Json Schema has a positive impact on Google. Use our Schema generator tool to generate and add one in the Advanced SEO section."><sup><span class="dashicons dashicons-info"></span></sup></a></li>',""!=i&&(A=n>0&&n>500?A+'<li><span class="dashicons dashicons-yes-alt"></span> Total number of words in Content is '+n+' <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Content length does not matter as long as user intent is matched for the topic covered. Write related articles and link them internally "><sup><span class="dashicons dashicons-info"></span></sup></a></li>':A+'<li><span class="dashicons dashicons-dismiss"></span> Total number of words in Content is '+n+' <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Content length does not matter as long as user intent is matched for the topic covered. Write related articles and link them internally "><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=d?'<li><span class="dashicons dashicons-yes-alt"></span> Images used in Content </li>':'<li><span class="dashicons dashicons-dismiss"></span> Images not used in Content <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Using relevant high quality images can increase user engagement and bring in more traffic"><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=p?'<li><span class="dashicons dashicons-yes-alt"></span> Internal links used in content. </li>':'<li><span class="dashicons dashicons-dismiss"></span> Internal links not used in Content <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Linking to other relevant internal resources improves Time on site. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=o?'<li><span class="dashicons dashicons-yes-alt"></span> External links found in content. </li>':'<li><span class="dashicons dashicons-dismiss"></span> External links not found in Content <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Linking to other relevant external resources as references improves trust on content. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>',h&&(A+='<li><span class="dashicons dashicons-yes-alt"></span> Subheaders like h2 are used in Content </li>')),A+="</ul>",A+="</div>",A+="</div>",A+="</div></div>",(void 0!==D||D.length<1)&&""==$)return A+="</div>",A+="</div></div>",void jQuery("#techblissonlineseoanalysis").html(A);jQuery.each(D,function(e,t){if(T=0,k=0,I=0,C=0,searchlc=t.toLowerCase().trim(),!(""==searchlc||e>4)){if(jQuery.each([y,g,c,a],function(e,t){jQuery.each(t,function(t,s){-1!==s.toLowerCase().trim().indexOf(searchlc)&&(0==e&&(T+=1),1==e&&(k+=1),2==e&&(I+=1),3==e&&(C+=1))})}),jQuery.inArray(parseInt(e),L)>-1&&(A+='<div class="row">'),A+='<div class="col-sm-6">',A=(A+='<div class="panel panel-primary">')+'<div class="panel-heading">'+t+"</div>",A+='<div class="panel-body">',A+="<ul>",j&&(searchlcurl=searchlc.replace(/ /g,"-"),-1!==j.search(searchlcurl)?A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in URL </li>':A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in URL </li>'),Q&&(psplctitle=Q.toLowerCase().trim(),-1!==psplctitle.search(searchlc)?(A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in Title </li>',psplctitle.indexOf(searchlc)<20?A+='<li><span class="dashicons dashicons-yes-alt"></span> Found in the beginning of Title </li>':A+='<li><span class="dashicons dashicons-dismiss"></span> Not found in the beginning of Title </li>'):A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in Title </li>'),f&&(psplcdesc=f.toLowerCase().trim(),-1!==psplcdesc.search(searchlc)?(psplcdesc,A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in Meta Description </li>'):A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in Meta Description </li>'),s&&(psplcwptitle=s.toLowerCase().trim(),-1!==psplcwptitle.search(searchlc)?A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in h1 tag (Wordpress Title) </li>':A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in h1 tag (Wordpress Title) </li>'),A+="</ul>",""==i)return A+="</div>",A+="</div>",A+="</div>",void(jQuery.inArray(parseInt(e),U)>-1&&(A+="</div>"));var l,o=[];o=(l=pspGetCounOfIndices(searchlc,r,!1))[1],pspkd=0,pspkeycounter=0,n>0&&o&&(pspkd=o.length/n*100);var p=l[0];p&&(pspkeycounter=p.length),A+="<ul>",o.length>0?(A=pspkd.toFixed(2)<3?A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in content '+o.length+" time(s) </li>":A+'<li><span class="dashicons dashicons-dismiss"></span> Used in content '+o.length+" time(s) </li>",pspkeycounter>0&&pspkeycounter<6?A=A+'<li><li><span class="dashicons dashicons-yes-alt"></span> Found in first 100 words of content '+pspkeycounter+" time(s) </li>":0==pspkeycounter?A+='<li><span class="dashicons dashicons-dismiss"></span> Not found in first 100 words of content </li>':A=A+'<li><span class="dashicons dashicons-dismiss"></span> Found in first 100 words of content '+pspkeycounter+" time(s) </li>",A=pspkd.toFixed(2)<3?A+'<li><span class="dashicons dashicons-yes-alt"></span> Keyword Density of '+t+" is "+pspkd.toFixed(2):A+'<li><span class="dashicons dashicons-dismiss"></span> Keyword Density of '+t+" is "+pspkd.toFixed(2)):A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in Content </li>',T>0&&(A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in other h1 tags '+T+" time(s) </li>"),k>0?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in h2 tags '+k+" time(s) </li>":A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in h2 tags </li>',I>0?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in image alt attributes '+I+" time(s) </li>":A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in image alt attributes </li>',C>0?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in anchor texts '+C+" time(s) </li>":A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in anchor texts </li>',A+="</ul>",A+="</div>",A+="</div>",A+="</div>",jQuery.inArray(parseInt(e),U)>-1&&(A+="</div>")}}),A+="</div>",A+="</div></div>",jQuery("#techblissonlineseoanalysis").html(A)}function pspGetCounOfIndices(e,t,s){if(0==e.length)return[];var i,r=[],n=[],a=[];s||(e=e.toLowerCase()),i=t.length;for(let a=0;a<i;a++)str=t[a],str&&(s||(str=str.toLowerCase()),str.indexOf(e,0)>-1&&(n.push(str),a<100&&r.push(str)));return a.push(r),a.push(n),a}function updateAll(){setUrlPreview(),setTitlePreview(),setDescriptionPreview()}String.prototype.trimEnd=function(e){e=e||" ";for(var t=this.length-1;t>=0&&this.charAt(t)==e;t--);return this.substring(0,t+1)},jQuery(document).ready(function(){jQuery("#URL").keyup(function(){setUrlPreview()}),jQuery(document).on("keyup","#new-post-slug",function(){setUrlPreview()}),jQuery(document).on("click",".cancel, .save",function(){setUrlPreview()}),jQuery('input[name="post_category[]"]').click(function(){setTitlePreview()}),jQuery("input[name^='tax_input[']").click(function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[title\\]").keyup(function(){setTitlePreview()}),jQuery("#title").keyup(function(){setTitlePreview()}),jQuery("#name").keyup(function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[titleformat\\]").bind("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[titleformat\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[preferred_tax\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[disable_title_format\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[disable_title\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[disable_psp\\]").on("change",function(){setTitlePreview(),setDescriptionPreview()}),jQuery("#psp_seo_meta\\[disable_description\\]").on("change",function(){setDescriptionPreview()}),jQuery("#psp_seo_meta\\[description\\]").keyup(function(){setDescriptionPreview()}),jQuery("#content").keyup(function(){setDescriptionPreview()}),jQuery("#psp_seo_meta\\[maxsnippet\\]").on("change",function(){setDescriptionPreview()}),jQuery("#DateText").keyup(function(){updateDateText()}),jQuery("#psp_seo_meta\\[keywords\\]").keyup(function(){setPSPSeoAnalysis()}),jQuery("#psp_analyse_btn").on("click",function(){updateAll()}),updateAll()});
1
+ function escapeRegExp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function wordCount(e){var t=e.match(/\S+/g);return t?t.length:0}function pspSortArray(e,t){var s=[],i=[];for(let r=0;r<e.length;r++)i=[],void 0!==(i=wp.data.select("core").getEntityRecord("taxonomy",t,e[r]))&&(s[r]=i.name);return s?(s.sort(),s[0]):"%"+t+"%"}function pspSortClassicArray(e,t){var s=[];return jQuery('input[name="'+e+'"]:checked').each(function(){s.push(jQuery(this).parent("label").text())}),s&&s.length?(s.sort(),s[0]):"%"+t+"%"}function boldWords(e){var t=e,s=jQuery("#psp_seo_meta\\[keywords\\]").val().match(/\S+/g);if(s)for(i=0;i<s.length;i++)t=(t=t.replace(new RegExp("(^|[\\W])("+escapeRegExp(s[i])+")([\\W]|$)","gi"),"$1<b>$2</b>$3")).replace(new RegExp("(^|[\\W])("+escapeRegExp(s[i])+")([\\W]|$)","gi"),"$1<b>$2</b>$3");return t}function boldText(e){var t=e,s=jQuery("#psp_seo_meta\\[keywords\\]").val().match(/\S+/g);if(s)for(i=0;i<s.length;i++)t=t.replace(new RegExp("("+escapeRegExp(s[i])+")","gi"),"<b>$1</b>");return t}function htmlEncode(e){return jQuery("<div/>").text(e).html()}function setGtbUrlPreview(e){var t="";(t=e)&&(t=t.replace(/^https?\:\/\//i,""));var s=htmlEncode(t),i=(s=s.replace(/\/$/,"")).length;jQuery("#permalinkSizer").html(s);var r=s=s.replace(/([^https?:\/\/])(\/)/g,"$1 > ");t=s,jQuery("#urlSizer").html(s),jQuery("#murlSizer").html(r);var n=new RegExp("W(.*)$");for(trimmed=!1;jQuery("#urlSizer").width()>566;){var a=s;a=(a=(a=(a=a.substring(0,a.length-1)).trim()).replace(/\>$/,"")).trim(),jQuery("#urlSizer").html(a),s=a,trimmed=!0}trimmed&&(s+=" ...",jQuery("#urlSizer").html(s)),info=i+" characters, ",jQuery("#urlInfo").html(s.length+" characters, "+jQuery("#urlSizer").width()+" pixels"),jQuery("#urlSizer").width()<=584?jQuery("#urlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"):jQuery("#urlInfo").html(info+'<span style="color:red;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"),jQuery("#techblissonlineSnippetUrl").html(s),mtrimmed=!1;for(var l=r;r.length>42;)r=jQuery.trim(r.replace(" ...","")),(l=(l=(l=jQuery.trim(l.replace(n,""))).trim()).replace(/\>$/,"")).length>=42&&(l=(l=jQuery.trim(r.replace(" ...",""))).substring(0,l.length-1)),l=l.trim(),r=l+=" ...",mtrimmed=!0;mtrimmed&&jQuery("#murlSizer").html(r),info=r.length+" characters, ",jQuery("#murlInfo").html(r.length+" characters, "+jQuery("#murlSizer").width()+" pixels"),jQuery("#murlSizer").width()<=282?jQuery("#murlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+" pixels</span>"):jQuery("#murlInfo").html(info+'<span style="color:red;">'+jQuery("#murlSizer").width()+" pixels</span>"),jQuery("#techblissonlineMSnippetUrl").html(r)}function setUrlPreview(){var e=jQuery.trim(jQuery("#pspHomePermalink").text())+"slug-name/",t=!1;if(window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(t=wpEditorL10n.tinymce.settings),jQuery("#editable-post-name").length){e=jQuery.trim(jQuery("#sample-permalink").text());var s=jQuery.trim(jQuery("#editable-post-name").text());e=(e=e.replace(s,"")).replace(/\/$/g,"")}else jQuery("#name").length?e=jQuery.trim(jQuery("#pspPostPermalink").text()):jQuery("#slug").length?e=jQuery.trim(jQuery("#pspPostPermalink").text()):t&&wp.data&&wp.data.select&&(e=wp.data.select("core/editor").getPermalink(),wp.data.subscribe(function(){setGtbUrlPreview(wp.data.select("core/editor").getPermalink())}));if(jQuery("#new-post-slug").length>0)e+=jQuery("#new-post-slug").val();else if(jQuery("#editable-post-name-full").length){e+=jQuery("#editable-post-name-full").text()}e&&(e=e.replace(/^https?\:\/\//i,""));var i=htmlEncode(e),r=i.length;r=(i=i.replace(/\/$/,"")).length;jQuery("#permalinkSizer").html(i);var n=i=i.replace(/([^https?:\/\/])(\/)/g,"$1 > ");e=i,jQuery("#urlSizer").html(i),jQuery("#murlSizer").html(n);var a=new RegExp("W(.*)$");for(trimmed=!1;jQuery("#urlSizer").width()>584;){var l=i;l=(l=(l=(l=l.substring(0,l.length-1)).trim()).replace(/\>$/,"")).trim(),jQuery("#urlSizer").html(l),i=l,trimmed=!0}trimmed&&(i+=" ..."),info=r+" characters, ",jQuery("#urlInfo").html(r+" characters, "+jQuery("#urlSizer").width()+" pixels"),jQuery("#urlSizer").width()<=584?jQuery("#urlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"):jQuery("#urlInfo").html(info+'<span style="color:red;">'+jQuery("#urlSizer").width()+"/584 pixels</span>"),jQuery("#techblissonlineSnippetUrl").html(i),mtrimmed=!1;for(var o=n;o.length>42;)n=jQuery.trim(n.replace(" ...","")),(o=(o=(o=jQuery.trim(o.replace(a,""))).trim()).replace(/\>$/,"")).length>=42&&(o=(o=jQuery.trim(n.replace(" ...",""))).substring(0,o.length-1)),o=o.trim(),n=o+=" ...",mtrimmed=!0;mtrimmed&&jQuery("#murlSizer").html(n),info=n.length+" characters, ",jQuery("#murlInfo").html(n.length+" characters, "+jQuery("#murlSizer").width()+" pixels"),jQuery("#murlSizer").width()<=282?jQuery("#murlInfo").html(info+'<span style="color:green;">'+jQuery("#urlSizer").width()+" pixels</span>"):jQuery("#murlInfo").html(info+'<span style="color:red;">'+jQuery("#murlSizer").width()+" pixels</span>"),jQuery("#techblissonlineMSnippetUrl").html(n)}function stripTrailingSlash(e){return"/"==e.substr(-1)?e.substr(0,e.length-1):e}function setGtbTitlePreview(e,t){var s=jQuery("#psp_seo_meta\\[titleformat\\]").val(),i=!1,r=!1;jQuery("#psp_seo_meta\\[disable_title_format\\]:checked").length>0&&(i=!0),jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(r=!0),i&&(s="%seo_title%"),r&&(s="%wp_title%");var n=jQuery("#pspPostTypeArrayFormat").text(),a=JSON.parse(n),l=jQuery("#psp_seo_meta\\[title\\]"),o=s.replace("%seo_title%",e);if(""===e&&(o=o.replace("%seo_title%",l.attr("placeholder"))),o=(o=(o=(o=(o=(o=o.replace("%wp_title%",a.wp_title)).replace("%site_name%",a.site_name)).replace("%site_description%",a.site_description)).replace("%category%",t)).replace("%taxonomy%",t)).replace(/%sep%/g,a.sep),""!==(o=(o=jQuery.trim(o)).trim(a.sep))){var p=htmlEncode(o),c=p;jQuery("#titleSizer").html(p),jQuery("#actualTitleSizer").html(p);var d=new RegExp("sw+(.*)$");trimmed=!1;for(var u=p;jQuery("#titleSizer").width()>584;)p=jQuery.trim(p.replace(" ...","")),(u=jQuery.trim(u.replace(d,""))).length>=p.length&&(u=u.substring(0,u.length-1)),p=u+" ...",jQuery("#titleSizer").html(p),trimmed=!0;trimmed,jQuery("#titleSizer").html(p),mtrimmed=!1;for(var h=c;h.length>78;)c=jQuery.trim(c.replace(" ...","")),(h=jQuery.trim(h.replace(d,""))).length>=78&&(h=(h=jQuery.trim(h.replace(" ...",""))).substring(0,h.length-1)),c=h+=" ...",mtrimmed=!0;mtrimmed,jQuery("#mtitleSizer").html(c),info=jQuery("<textarea />").html(p).text().length+" characters, "+wordCount(p)+" words ",jQuery("#titleInfo").html(p.length+" characters, "+jQuery("#titleSizer").width()+" pixels, "+wordCount(p)+" words"),jQuery("#titleSizer").width()<=584?jQuery("#titleInfo").html(info+'<span style="color:green;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"):jQuery("#titleInfo").html(info+'<span style="color:red;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"),minfo=jQuery("<textarea />").html(c).text().length+" characters/ 78 characters "+wordCount(c)+" words ",jQuery("#mtitleInfo").html(c.length+" characters, "+jQuery("#mtitleSizer").width()+" pixels, "+wordCount(c)+" words"),c.length<=78?jQuery("#mtitleInfo").html('<span style="color:green;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"):jQuery("#mtitleInfo").html('<span style="color:red;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"),jQuery("#techblissonlineSnippetTitle").html(p),jQuery("#techblissonlineMSnippetTitle").html(c),setPSPSeoAnalysis()}}function setTitlePreview(){var e,t,s="",i="",r="",n=!1,a="";window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(n=wpEditorL10n.tinymce.settings);var l=jQuery("#pspPostTypeArrayFormat").text(),o=JSON.parse(l),p=jQuery("#psp_seo_meta\\[titleformat\\]").val(),c=!1,d=!1,u=!1;jQuery("#psp_seo_meta\\[disable_title_format\\]:checked").length>0&&(c=!0),jQuery("#psp_seo_meta\\[disable_title\\]:checked").length>0&&(d=!0),jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(u=!0);a=o.category,p.toLowerCase().indexOf("%wp_title%");var h=jQuery("#title"),m=jQuery("#psp_seo_meta\\[title\\]");i=m.attr("placeholder");var y=jQuery("#psp_seo_meta\\[preferred_tax\\]"),g="categories",j="post_category[]",Q="category";if(y&&y.val()&&"category"!==(Q=jQuery("#psp_seo_meta\\[preferred_tax\\] option:selected").text())&&(g=Q,j="tax_input["+Q+"][]"),h&&(a=pspSortClassicArray(j,Q)),!m.val()||d||u?(jQuery("#title").val()?i=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?i=jQuery.trim(jQuery("#name").val()):n&&wp.data&&wp.data.select&&(i=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",void 0!==t&&t.length>0&&(a=pspSortArray(t,Q)),wp.data.subscribe(function(){i=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",void 0!==t&&t.length>0&&(a=pspSortArray(t,Q)),void 0===i&&(m=jQuery("#psp_seo_meta\\[title\\]")),""===i&&(m=jQuery("#psp_seo_meta\\[title\\]"),i=m.attr("placeholder")),a&&setGtbTitlePreview(i,a)})),s=i,(c||u)&&(p="%wp_title%"),s=(s=(s=(s=(s=(s=(s=p.replace("%seo_title%",i)).replace("%wp_title%",i)).replace("%site_name%",o.site_name)).replace("%site_description%",o.site_description)).replace("%taxonomy%",a)).replace("%category%",a)).replace(/%sep%/g,o.sep),s=(s=jQuery.trim(s)).trim(o.sep)):(s=m.val(),r=m.val(),jQuery("#title").val()?i=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?i=jQuery.trim(jQuery("#name").val()):n&&wp.data&&wp.data.select&&(i=wp.data.select("core/editor").getEditedPostAttribute("title"),e=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",void 0!==e&&e.length>0&&(a=pspSortArray(e,Q)),wp.data.subscribe(function(){i=wp.data.select("core/editor").getEditedPostAttribute("title"),e=wp.data.select("core/editor").getEditedPostAttribute(g),a="%"+Q+"%",r=m.val(),void 0!==e&&e.length>0&&(a=pspSortArray(e,Q)),r&&a&&setGtbTitlePreview(r,a)})),c&&(p="%seo_title%"),s=(s=(s=(s=(s=(s=(s=p.replace("%seo_title%",r)).replace("%wp_title%",i)).replace("%site_name%",o.site_name)).replace("%site_description%",o.site_description)).replace("%taxonomy%",a)).replace("%category%",a)).replace(/%sep%/g,o.sep),s=(s=jQuery.trim(s)).trim(o.sep)),""!==s){""===i||n||i;var f=htmlEncode(s),w=f;jQuery("#titleSizer").html(f),jQuery("#actualTitleSizer").html(f);var v=new RegExp("sw+(.*)$"),S=f;for(trimmed=!1;jQuery("#titleSizer").width()>584;)f=jQuery.trim(f.replace(" ...","")),(S=jQuery.trim(S.replace(v,""))).length>=f.length&&(S=S.substring(0,S.length-1)),f=S+" ...",jQuery("#titleSizer").text(f),trimmed=!0;trimmed,jQuery("#titleSizer").text(f),jQuery("body").append(jQuery("#titleSizer")).width(),jQuery("body#titleSizer").remove(),info=jQuery("<textarea />").html(f).text().length+" characters, "+wordCount(f)+" words ",jQuery("#titleInfo").html(f.length+" characters, "+jQuery("#titleSizer").width()+" pixels, "+wordCount(f)+" words"),jQuery("#titleSizer").width()<=584?jQuery("#titleInfo").html(info+'<span style="color:green;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"):jQuery("#titleInfo").html(info+'<span style="color:red;">'+jQuery("#titleSizer").width()+"/584 pixels</span>"),jQuery("#techblissonlineSnippetTitle").html(f);var _=w;for(mtrimmed=!1;_.length>78;)w=jQuery.trim(w.replace(" ...","")),(_=jQuery.trim(_.replace(v,""))).length>=78&&(_=(_=jQuery.trim(_.replace(" ...",""))).substring(0,_.length-1)),w=_+=" ...",mtrimmed=!0;mtrimmed,jQuery("#mtitleSizer").text(w),jQuery("body").append(jQuery("#mtitleSizer")).width(),jQuery("body#mtitleSizer").remove(),minfo=jQuery("<textarea />").html(w).text().length+" characters/ 78 characters "+wordCount(w)+" words ",jQuery("#mtitleInfo").html(w.length+" characters, "+jQuery("#mtitleSizer").width()+" pixels, "+wordCount(w)+" words"),w.length<=78?jQuery("#mtitleInfo").html('<span style="color:green;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"):jQuery("#mtitleInfo").html('<span style="color:red;">'+minfo+"</span> "+jQuery("#mtitleSizer").width()+" pixels"),jQuery("#techblissonlineMSnippetTitle").html(w),setPSPSeoAnalysis()}}function setDescriptionPreview(){var e,t=!1,s=jQuery("#psp_seo_meta\\[description\\]");window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(t=wpEditorL10n.tinymce.settings);var i=jQuery.trim(jQuery("#psp_seo_meta\\[maxsnippet\\]").val()),r=i;parseInt(i)<0&&(i=230,r=285),jQuery.inArray(parseInt(i),[-1,0,1,2,3,4])>-1&&(i=230,r=285),""===i&&(i=230,r=285),i=parseInt(i),r=parseInt(r);var n="",a=!1,l=!1,o=jQuery("#pspPostTypeArrayFormat").text();if(e=JSON.parse(o).autogendesc,jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(a=!0),jQuery("#psp_seo_meta\\[disable_description\\]:checked").length>0&&(l=!0),""!==n||a||l||(n=jQuery.trim(jQuery("#psp_seo_meta\\[description\\]").val())),""===n){if(""===n&&t&&wp.data&&wp.data.select){var p=wp.data.select("core/editor").getEditedPostContent();return""!==e&&(n=(n=p.replace(/(<([^>]+)>)/gi,"")).substring(0,r)),n||(n=s.attr("placeholder")),void setGTBDescPreview(n)}var c=jQuery.trim(jQuery("#content").val());if(!s.val()||a||l)return""!==e&&(n=(n=c.replace(/(<([^>]+)>)/gi,"")).substring(0,r)),n||(n=s.attr("placeholder")),void setGTBDescPreview(n)}return n?void setGTBDescPreview(n):void 0}function setGTBDescPreview(e){jQuery("#psp_seo_meta\\[description\\]");var t=e;placeholder_desc=e;var s=jQuery.trim(jQuery("#psp_seo_meta\\[maxsnippet\\]").val()),i=s;parseInt(s)<0&&(s=230,i=285),jQuery.inArray(parseInt(s),[-1,0,1,2,3,4])>-1&&(s=230,i=285),""===s&&(s=230,i=285),s=parseInt(s),i=parseInt(i);var r=htmlEncode(t),n=r+=" ...";jQuery("#descriptionSizer").html(r),jQuery("#mdescriptionSizer").html(n);for(var a=new RegExp("sw+(.*)$"),l=r;l.length>s;)r=jQuery.trim(r.replace(" ...","")),l=jQuery.trim(l.replace(a,"")),t=jQuery.trim(t.replace(a,"")),l.length>=s&&(l=(l=jQuery.trim(l.replace(" ...",""))).substring(0,l.length-1),t=t.substring(0,t.length-1)),l+=" ...";r=l,jQuery("#descriptionSizer").html(r);for(var o=n;o.length>i;)n=jQuery.trim(n.replace(" ...","")),(o=jQuery.trim(o.replace(a,""))).length>=i&&(o=(o=jQuery.trim(o.replace(" ...",""))).substring(0,o.length-1)),o+=" ...";n=o,jQuery("#descriptionSizer").html(n),jQuery("body").append(jQuery("#descriptionSizer")).width(),jQuery("body").append(jQuery("#mdescriptionSizer")).width(),jQuery("body").remove("#descriptionSizer"),jQuery("body").remove("#mdescriptionSizer"),jQuery("#descriptionInfo").html(r.length+" characters, "+jQuery("#descriptionSizer").width()+" pixels, "+wordCount(r)+" words"),info=jQuery("#descriptionSizer").width()+" pixels, "+wordCount(r)+" words ",jQuery("#mdescriptionInfo").html(n.length+" characters, "+jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(n)+" words"),minfo=jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(n)+" words ",r.length<=146?jQuery("#descriptionInfo").html(info+'<span style="color:green;">'+r.length+"/~170 characters"):r.length<=160?jQuery("#descriptionInfo").html(info+'<span style="color:orange;">'+r.length+"/~170 characters</span>"):r.length<=166?jQuery("#descriptionInfo").html(info+'<span style="color:purple;">'+r.length+"/~170 characters</span>"):jQuery("#descriptionInfo").html(info+'<span style="color:red;">'+r.length+"/~170 characters</span>"),n.length<=146?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:green;">'+n.length+"/~170 characters"):n.length<=160?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:orange;">'+n.length+"/~170 characters</span>"):n.length<=166?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:purple;">'+n.length+"/~170 characters</span>"):jQuery("#mdescriptionInfo").html(minfo+'<span style="color:red;">'+n.length+"/~170 characters</span>"),jQuery("#techblissonlineSnippetDescription").html(r),jQuery("#techblissonlineMSnippetDescription").html(n)}function updateDateText(){var e=htmlEncode(jQuery.trim(jQuery("#DateText").val()));e.length>0?jQuery("#resultDateText").html(e+" - "):jQuery("#resultDateText").html("")}function setPSPSeoAnalysis(){var e,t=!1,s="",i="";window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(t=wpEditorL10n.tinymce.settings),t&&wp.data&&wp.data.select?(""==(i=wp.data.select("core/editor").getEditedPostContent())&&(i=wp.data.select("core/editor").getEditedPostAttribute("content")),s=wp.data.select("core/editor").getEditedPostAttribute("title")):(i=jQuery.trim(jQuery("#content").val()),s=jQuery.trim(jQuery("#title").val()));var r=[],n=0;e=i,""!=i&&(i=(i=(i=(i=i.replace(/(<([^>]+)>)/gi,"")).replace(/['"]+/g,"")).replace(/[^a-zA-Z]+/g," ")).toLowerCase(),r=i.split(/[\/\s]+/),n=r.length);var a,l=window.location.hostname,o=!1,p=!1;a=jQuery("<div />",{html:e}).find("a").map(function(){if(jQuery(this).attr("href")&&(-1==jQuery(this).attr("href").indexOf(l)&&(o=!0),-1!==jQuery(this).attr("href").indexOf(l)&&(p=!0)),""!==jQuery(this).text())return jQuery(this).text()}).get();var c;c=jQuery(e).find("img").map(function(){if(jQuery(this).attr("alt")&&""!==jQuery(this).attr("alt"))return jQuery(this).attr("alt")}).get();var d=!1,u=jQuery(e).find("img");void 0!==u&&u.length>0&&(d=!0);var h=!1,m=jQuery("<div />",{html:e}).find("h2, h3, h4, h5, h6");void 0!==m&&m.length>0&&(h=!0);var y;y=jQuery("<div />",{html:e}).find("h1").map(function(){if(""!==jQuery(this).text())return jQuery(this).text()}).get();var g;g=jQuery("<div />",{html:e}).find("h2").map(function(){if(""!==jQuery(this).text())return jQuery(this).text()}).get();var j=jQuery("#urlSizer").html(),Q=jQuery("#techblissonlineSnippetTitle").html(),f=jQuery("#techblissonlineSnippetDescription").val(),w=jQuery("#psp_seo_meta\\[description\\]").val(),v=jQuery("#psp_seo_meta\\[schema_string\\]").val(),S=!1,_=!1;""!==w&&(_=!0),""!==v&&"Invalid JSON Schema"!==v&&(S=!0);var x=jQuery.trim(jQuery("#permalinkSizer").html()),b=jQuery.trim(jQuery("#actualTitleSizer").html());jQuery("#actualTitleSizers").html(b);var z=0,P=0,E=0;""!==x&&(z=x.length),""!==x&&jQuery("#permalinkSizer").width(),""!==b&&(P=jQuery("<textarea />").html(b).text().length),""!==b&&(E=jQuery("#actualTitleSizer").width()),0==E&&(E=jQuery("#actualTitleSizers").width()-1),""!==j&&(j=j.trim());var k=0,T=0,I=0,C=0,A="",L=[0,2,4],U=[1,3,4],D=[],R=jQuery("#psp_seo_meta\\[keywords\\]").val();if(void 0!==R&&(D=R.split(",")),A+='<div class="psp-bs">',A+='<div class="container-fluid">',A+="<h1>Platinum SEO Analysis</h1>",A+='<p>This is a basic content analysis of this page and your focus keywords. Assigning a score does not mean anything and so we do not do that. Rather, make sure that all these basic recommendations are adhered to. We also recommend you to try our <a href="https://techblissonline.com/tools/" target="_blank">Techblissonline SEO Tools</a> for a detailed analysis of your pages and your competitor pages for your focus keywords, co-occuring words (related entities) and improve your content accordingly. </p>',A+='<div class="panel-group">',A+='<div class="row"><div class="col-sm-12">',A+='<div class="panel panel-primary">',A+='<div class="panel-heading">General</div>',A+='<div class="panel-body">',A+="<ul>",z>0&&z<75?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> URL Length is '+z+" characters </li>":z>75&&(A=A+'<li><span class="psp-info dashicons dashicons-info"></span> URL lLength is '+z+' characters <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="URL might get truncated in Google SERPS if it is more than 75 characters wide. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>'),P>0&&P<70?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> SEO Title lLength is '+P+" characters </li>":P>70&&(A=A+'<li><span class="dashicons dashicons-dismiss"></span> Actual SEO Title lLength is '+P+' characters. <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Title might get truncated in Google SERPS if it is more than 70 characters wide. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>'),E>0&&E<574?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> SEO Title pixel width is '+E+" pixels </li>":E>574&&(A=A+'<li><span class="dashicons dashicons-dismiss"></span> SEO Title pixel width is '+E+' pixels including Title format. <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Title might get truncated in Google SERPS if it is more than 574 pixels wide. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>'),A+=_?'<li><span class="dashicons dashicons-yes-alt"></span> Platinum SEO Description is used </li>':'<li><span class="dashicons dashicons-dismiss"></span> Platinum SEO Description field is not filled in. You may have an auto-generated description. <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Using optimized description improves CTR from search and social engines"><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=S?'<li><span class="dashicons dashicons-yes-alt"></span> Json Schema is used on this page using Platinum SEO </li>':'<li><span class="dashicons dashicons-dismiss"></span> Json Schema is not used on this page using Platinum SEO <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Using Json Schema has a positive impact on Google. Use our Schema generator tool to generate and add one in the Advanced SEO section."><sup><span class="dashicons dashicons-info"></span></sup></a></li>',""!=i&&(A=n>0&&n>500?A+'<li><span class="dashicons dashicons-yes-alt"></span> Total number of words in Content is '+n+' <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Content length does not matter as long as user intent is matched for the topic covered. Write related articles and link them internally "><sup><span class="dashicons dashicons-info"></span></sup></a></li>':A+'<li><span class="psp-info dashicons dashicons-info"></span> Total number of words in Content is '+n+' <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Content length does not matter as long as user intent is matched for the topic covered. Write related articles and link them internally "><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=d?'<li><span class="dashicons dashicons-yes-alt"></span> Images used in Content </li>':'<li><span class="dashicons dashicons-dismiss"></span> Images not used in Content <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Using relevant high quality images can increase user engagement and bring in more traffic"><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=p?'<li><span class="dashicons dashicons-yes-alt"></span> Internal links used in content. </li>':'<li><span class="dashicons dashicons-dismiss"></span> Internal links not used in Content <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Linking to other relevant internal resources improves Time on site. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>',A+=o?'<li><span class="dashicons dashicons-yes-alt"></span> External links found in content. Referring to an authoritative source on which the underlying research for the content was done or linking to the creator of the product the page is about, is always a good practice that improves trust. </li>':'<li><span class="psp-info dashicons dashicons-info"></span> External links not found in Content.Referring to an authoritative source on which the underlying research for the content was done or linking to the creator of the product this page is about, is always a good practice that improves trust. <a href="#" class="psptip" data-toggle="tooltip" data-placement="top" title="Linking to other relevant external resources as references improves trust on content. "><sup><span class="dashicons dashicons-info"></span></sup></a></li>',h&&(A+='<li><span class="dashicons dashicons-yes-alt"></span> Subheaders like h2 are used in Content </li>')),A+="</ul>",A+="</div>",A+="</div>",A+="</div></div>",(void 0!==D||D.length<1)&&""==R)return A+="</div>",A+="</div></div>",void jQuery("#techblissonlineseoanalysis").html(A);jQuery.each(D,function(e,t){if(k=0,T=0,I=0,C=0,searchlc=t.toLowerCase().trim(),!(""==searchlc||e>4)){if(jQuery.each([y,g,c,a],function(e,t){jQuery.each(t,function(t,s){-1!==s.toLowerCase().trim().indexOf(searchlc)&&(0==e&&(k+=1),1==e&&(T+=1),2==e&&(I+=1),3==e&&(C+=1))})}),jQuery.inArray(parseInt(e),L)>-1&&(A+='<div class="row">'),A+='<div class="col-sm-6">',A=(A+='<div class="panel panel-primary">')+'<div class="panel-heading">'+t+"</div>",A+='<div class="panel-body">',A+="<ul>",j&&(searchlcurl=searchlc.replace(/ /g,"-"),-1!==j.search(searchlcurl)?A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in URL </li>':A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in URL </li>'),Q&&(psplctitle=Q.toLowerCase().trim(),-1!==psplctitle.search(searchlc)?(A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in Title </li>',psplctitle.indexOf(searchlc)<20?A+='<li><span class="dashicons dashicons-yes-alt"></span> Found in the beginning of Title </li>':A+='<li><span class="dashicons dashicons-dismiss"></span> Not found in the beginning of Title </li>'):A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in Title </li>'),f&&(psplcdesc=f.toLowerCase().trim(),-1!==psplcdesc.search(searchlc)?(psplcdesc,A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in Meta Description </li>'):A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in Meta Description </li>'),s&&(psplcwptitle=s.toLowerCase().trim(),-1!==psplcwptitle.search(searchlc)?A+='<li><span class="dashicons dashicons-yes-alt"></span> Used in h1 tag (Wordpress Title) </li>':A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in h1 tag (Wordpress Title) </li>'),A+="</ul>",""==i)return A+="</div>",A+="</div>",A+="</div>",void(jQuery.inArray(parseInt(e),U)>-1&&(A+="</div>"));var l,o=[];o=(l=pspGetCounOfIndices(searchlc,r,!1))[1],pspkd=0,pspkeycounter=0,n>0&&o&&(pspkd=o.length/n*100);var p=l[0];p&&(pspkeycounter=p.length),A+="<ul>",o.length>0?(A=pspkd.toFixed(2)<3?A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in content '+o.length+" time(s) </li>":A+'<li><span class="dashicons dashicons-dismiss"></span> Used in content '+o.length+" time(s) </li>",pspkeycounter>0&&pspkeycounter<6?A=A+'<li><li><span class="dashicons dashicons-yes-alt"></span> Found in first 100 words of content '+pspkeycounter+" time(s) </li>":0==pspkeycounter?A+='<li><span class="dashicons dashicons-dismiss"></span> Not found in first 100 words of content </li>':A=A+'<li><span class="dashicons dashicons-dismiss"></span> Found in first 100 words of content '+pspkeycounter+" time(s) </li>",A=pspkd.toFixed(2)<3?A+'<li><span class="dashicons dashicons-yes-alt"></span> Keyword Density of '+t+" is "+pspkd.toFixed(2):A+'<li><span class="dashicons dashicons-dismiss"></span> Keyword Density of '+t+" is "+pspkd.toFixed(2)):A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in Content </li>',k>0&&(A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in other h1 tags '+k+" time(s) </li>"),T>0?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in h2 tags '+T+" time(s) </li>":A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in h2 tags </li>',I>0?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in image alt attributes '+I+" time(s) </li>":A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in image alt attributes </li>',C>0?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in anchor texts '+C+" time(s) </li>":A+='<li><span class="dashicons dashicons-dismiss"></span> Not used in anchor texts </li>',A+="</ul>",A+="</div>",A+="</div>",A+="</div>",jQuery.inArray(parseInt(e),U)>-1&&(A+="</div>")}}),A+="</div>",A+="</div></div>",jQuery("#techblissonlineseoanalysis").html(A)}function pspGetCounOfIndices(e,t,s){if(0==e.length)return[];var i,r=[],n=[],a=[];s||(e=e.toLowerCase()),i=t.length;for(let a=0;a<i;a++)str=t[a],str&&(s||(str=str.toLowerCase()),str.indexOf(e,0)>-1&&(n.push(str),a<100&&r.push(str)));return a.push(r),a.push(n),a}function updateAll(){setUrlPreview(),setTitlePreview(),setDescriptionPreview()}String.prototype.trimEnd=function(e){e=e||" ";for(var t=this.length-1;t>=0&&this.charAt(t)==e;t--);return this.substring(0,t+1)},jQuery(document).ready(function(){jQuery("#URL").keyup(function(){setUrlPreview()}),jQuery(document).on("keyup","#new-post-slug",function(){setUrlPreview()}),jQuery(document).on("click",".cancel, .save",function(){setUrlPreview()}),jQuery('input[name="post_category[]"]').click(function(){setTitlePreview()}),jQuery("input[name^='tax_input[']").click(function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[title\\]").keyup(function(){setTitlePreview()}),jQuery("#title").keyup(function(){setTitlePreview()}),jQuery("#name").keyup(function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[titleformat\\]").bind("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[titleformat\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[preferred_tax\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[disable_title_format\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[disable_title\\]").on("change",function(){setTitlePreview()}),jQuery("#psp_seo_meta\\[disable_psp\\]").on("change",function(){setTitlePreview(),setDescriptionPreview()}),jQuery("#psp_seo_meta\\[disable_description\\]").on("change",function(){setDescriptionPreview()}),jQuery("#psp_seo_meta\\[description\\]").keyup(function(){setDescriptionPreview()}),jQuery("#content").keyup(function(){setDescriptionPreview()}),jQuery("#psp_seo_meta\\[maxsnippet\\]").on("change",function(){setDescriptionPreview()}),jQuery("#DateText").keyup(function(){updateDateText()}),jQuery("#psp_seo_meta\\[keywords\\]").keyup(function(){setPSPSeoAnalysis()}),jQuery("#psp_analyse_btn").on("click",function(){updateAll()}),updateAll()});
psp-include/settings/psp_analysis_metabox_renderer.php CHANGED
@@ -14,7 +14,7 @@ Author URI: https://techblissonline.com/
14
  echo "<div class='psp-bs'><input ".esc_attr($diskey_checked)." id='psp_seo_meta[disable_keywords]' name='psp_seo_meta[disable_keywords]' type='checkbox' data-toggle='toggle' data-on='Off' data-onstyle='default' data-off='On' data-offstyle='success' data-style='ios' /></div><br />";
15
  ?><?php } ?></th>
16
  <td><input type="text" name="psp_seo_meta[keywords]" id="psp_seo_meta[keywords]" value="<?php echo ( isset($psp_seo_meta['keywords']) ? esc_attr($psp_seo_meta['keywords']) : ''); ?>"><br />
17
- <p class="description"><?php esc_html_e('Set comma separated meta keywords to be used for this post/page.Meta Keywords tag should also be switched on sitewide in Platinum SEO General setthings. These are also used as the Focus keywords for Platinum SEO Analysis of this page,', 'platinum-seo-pack'); ?></p>
18
  <p class="description"><strong><?php esc_html_e('Enter comma separated focus keywords in the input above and find the analysis below', 'platinum-seo-pack'); ?></strong></p>
19
  <div class="psp-bs"><input style="width:20%;display:block;margin:auto" id="psp_analyse_btn" class="psp_analyser btn btn-primary" type="hidden" value="Analyse" /></div>
20
  </td>
14
  echo "<div class='psp-bs'><input ".esc_attr($diskey_checked)." id='psp_seo_meta[disable_keywords]' name='psp_seo_meta[disable_keywords]' type='checkbox' data-toggle='toggle' data-on='Off' data-onstyle='default' data-off='On' data-offstyle='success' data-style='ios' /></div><br />";
15
  ?><?php } ?></th>
16
  <td><input type="text" name="psp_seo_meta[keywords]" id="psp_seo_meta[keywords]" value="<?php echo ( isset($psp_seo_meta['keywords']) ? esc_attr($psp_seo_meta['keywords']) : ''); ?>"><br />
17
+ <p class="description"><?php esc_html_e('Set comma separated keywords or entities for this post/page. These are used as the Focus or primary keywords for Platinum SEO Analysis of this page. If you intend using these in meta keywords tag, which is not supported by Google and many other Search Engines, you should turn it on sitewide in Platinum SEO General setthings. By default, these are used for your internal Post/Page analysis only.', 'platinum-seo-pack'); ?></p>
18
  <p class="description"><strong><?php esc_html_e('Enter comma separated focus keywords in the input above and find the analysis below', 'platinum-seo-pack'); ?></strong></p>
19
  <div class="psp-bs"><input style="width:20%;display:block;margin:auto" id="psp_analyse_btn" class="psp_analyser btn btn-primary" type="hidden" value="Analyse" /></div>
20
  </td>
psp-include/settings/psp_basic_metabox_renderer.php CHANGED
@@ -96,6 +96,10 @@ label {
96
  color: red !important;
97
  }
98
 
 
 
 
 
99
  #psp-meta-box .psp-metabox-tabs, #psp-preview-box .psp-preview-tabs {
100
  background: #fff;
101
  border-width: 0px 1px 1px 1px;
96
  color: red !important;
97
  }
98
 
99
+ .psp-info {
100
+ color: #3073AC !important;
101
+ }
102
+
103
  #psp-meta-box .psp-metabox-tabs, #psp-preview-box .psp-preview-tabs {
104
  background: #fff;
105
  border-width: 0px 1px 1px 1px;
psp-include/settings/psp_settings.php CHANGED
@@ -379,6 +379,7 @@ class PspSettings {
379
  'label_for' => 'psp_home_keywords',
380
  'option_name' => $psp_home_settings_name.'[keywords]',
381
  'option_value' => isset($psp_home_settings['keywords']) ? stripcslashes(esc_attr($psp_home_settings['keywords'])) : '',
 
382
  );
383
 
384
  $home_header_metas = isset($psp_home_settings['headers']) ? html_entity_decode(stripcslashes(esc_attr($psp_home_settings['headers']))) : '';
@@ -644,7 +645,8 @@ class PspSettings {
644
  'label_for' => 'psp_'.$setting_name.'_autogenerate_description',
645
  'option_name' => $psp_settings_name.'[autogenerate_description]',
646
  'option_value' => isset($psp_settings['autogenerate_description']) ? $psp_settings['autogenerate_description'] : '',
647
- 'checkbox_label' => esc_html__( 'Autogenerate description for all post types, if no SEO description is set for any post.', 'platinum-seo-pack' )
 
648
  );
649
 
650
  $autogenerate_desc_field_id = 'psp_'.$setting_name.'_autogenerate_description';
@@ -670,7 +672,8 @@ class PspSettings {
670
  'label_for' => 'psp_'.$setting_name.'_use_meta_keywords',
671
  'option_name' => $psp_settings_name.'[use_meta_keywords]',
672
  'option_value' => isset($psp_settings['use_meta_keywords']) ? $psp_settings['use_meta_keywords'] : '',
673
- 'checkbox_label' => esc_html__( 'Use meta keywords tag.', 'platinum-seo-pack' )
 
674
  );
675
 
676
  $use_meta_keywords_field_id = 'psp_'.$setting_name.'_use_meta_keywords';
@@ -2839,7 +2842,7 @@ class PspSettings {
2839
  wp_enqueue_media();
2840
  wp_enqueue_script( 'psp-meta-box', plugins_url( '/js/pspmetabox.js', __FILE__ ), array( 'jquery-ui-tabs') );
2841
  //wp_enqueue_script( 'psp-image-uploader', plugins_url( '/js/pspmediauploader.js', __FILE__ ), array( 'jquery' ) );
2842
- wp_enqueue_script( 'psp-meta-box-snippet', plugins_url( '/js/snippetpreview.js', __FILE__ ),'', '2.1');
2843
  //wp_enqueue_script( 'psp-social', plugins_url( '/js/pspsocialhandler.js', __FILE__ ), array( 'jquery' ) );
2844
  //wp_enqueue_script( 'psp-cm', plugins_url( '/js/cm.js', __FILE__ ), array(), false, true);
2845
 
@@ -3085,7 +3088,7 @@ class PspSettings {
3085
  //wp_enqueue_media();
3086
  wp_enqueue_script( 'psp-meta-box', plugins_url( '/js/pspmetabox.js', __FILE__ ), array( 'jquery-ui-tabs') );
3087
  //wp_enqueue_script( 'psp-image-uploader', plugins_url( '/js/pspmediauploader.js', __FILE__ ), array( 'jquery' ) );
3088
- wp_enqueue_script( 'psp-meta-box-snippet', plugins_url( '/js/snippetpreview.js', __FILE__ ), '', '2.1');
3089
  //wp_enqueue_script( 'psp-social', plugins_url( '/js/pspsocialhandler.js', __FILE__ ), array( 'jquery' ) );
3090
 
3091
  $psp_cm_json_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'json', 'codemirror'=> array('autoRefresh' => true)));
@@ -3327,7 +3330,7 @@ class PspSettings {
3327
  //wp_enqueue_media();
3328
  wp_enqueue_script( 'psp-meta-box', plugins_url( '/js/pspmetabox.js', __FILE__ ), array('jquery', 'jquery-ui-tabs' ) );
3329
  //wp_enqueue_script( 'psp-image-uploader', plugins_url( '/js/pspmediauploader.js', __FILE__ ), array( 'jquery' ) );
3330
- wp_enqueue_script( 'psp-meta-box-snippet', plugins_url( '/js/snippetpreview.js', __FILE__ ), '', '2.1');
3331
  //wp_enqueue_script( 'psp-social', plugins_url( '/js/pspsocialhandler.js', __FILE__ ), array( 'jquery' ) );
3332
 
3333
  $psp_cm_json_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'json', 'codemirror'=> array('autoRefresh' => true)));
379
  'label_for' => 'psp_home_keywords',
380
  'option_name' => $psp_home_settings_name.'[keywords]',
381
  'option_value' => isset($psp_home_settings['keywords']) ? stripcslashes(esc_attr($psp_home_settings['keywords'])) : '',
382
+ 'option_description' => esc_html__( 'Google and most other Search engines do not use or support the meta keywords tag. If you still find it necessary to use this tag for any specific reason of yours, you may add comma separated primary entities or keywords for the Home page here.These will be displayed as meta keywords tag. Leaving it empty will disable this tag for the Jome Page.', 'platinum-seo-pack' ),
383
  );
384
 
385
  $home_header_metas = isset($psp_home_settings['headers']) ? html_entity_decode(stripcslashes(esc_attr($psp_home_settings['headers']))) : '';
645
  'label_for' => 'psp_'.$setting_name.'_autogenerate_description',
646
  'option_name' => $psp_settings_name.'[autogenerate_description]',
647
  'option_value' => isset($psp_settings['autogenerate_description']) ? $psp_settings['autogenerate_description'] : '',
648
+ 'checkbox_label' => esc_html__( 'Autogenerate description for all post types', 'platinum-seo-pack' ),
649
+ 'option_description' => esc_html__( 'If no SEO description is set for any post, an auto-generated description will be set against the meta description tag for the Post or Page. Post Excerpt, if it exists, will be used. If not, the first few words from the Post or Page will be used.', 'platinum-seo-pack' )
650
  );
651
 
652
  $autogenerate_desc_field_id = 'psp_'.$setting_name.'_autogenerate_description';
672
  'label_for' => 'psp_'.$setting_name.'_use_meta_keywords',
673
  'option_name' => $psp_settings_name.'[use_meta_keywords]',
674
  'option_value' => isset($psp_settings['use_meta_keywords']) ? $psp_settings['use_meta_keywords'] : '',
675
+ 'checkbox_label' => esc_html__( 'Use meta keywords tag.', 'platinum-seo-pack' ),
676
+ 'option_description' => esc_html__( 'Note that Google and many other Search engines do not read/use this tag. If for any specific reason, you intend to display meta keywords tag on your site, you may enable this. Your focus or primary keywords will be shown against this tag on the respective Post or Page.', 'platinum-seo-pack' )
677
  );
678
 
679
  $use_meta_keywords_field_id = 'psp_'.$setting_name.'_use_meta_keywords';
2842
  wp_enqueue_media();
2843
  wp_enqueue_script( 'psp-meta-box', plugins_url( '/js/pspmetabox.js', __FILE__ ), array( 'jquery-ui-tabs') );
2844
  //wp_enqueue_script( 'psp-image-uploader', plugins_url( '/js/pspmediauploader.js', __FILE__ ), array( 'jquery' ) );
2845
+ wp_enqueue_script( 'psp-meta-box-snippet', plugins_url( '/js/snippetpreview.js', __FILE__ ),'', '2.1.2');
2846
  //wp_enqueue_script( 'psp-social', plugins_url( '/js/pspsocialhandler.js', __FILE__ ), array( 'jquery' ) );
2847
  //wp_enqueue_script( 'psp-cm', plugins_url( '/js/cm.js', __FILE__ ), array(), false, true);
2848
 
3088
  //wp_enqueue_media();
3089
  wp_enqueue_script( 'psp-meta-box', plugins_url( '/js/pspmetabox.js', __FILE__ ), array( 'jquery-ui-tabs') );
3090
  //wp_enqueue_script( 'psp-image-uploader', plugins_url( '/js/pspmediauploader.js', __FILE__ ), array( 'jquery' ) );
3091
+ wp_enqueue_script( 'psp-meta-box-snippet', plugins_url( '/js/snippetpreview.js', __FILE__ ), '', '2.1.2');
3092
  //wp_enqueue_script( 'psp-social', plugins_url( '/js/pspsocialhandler.js', __FILE__ ), array( 'jquery' ) );
3093
 
3094
  $psp_cm_json_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'json', 'codemirror'=> array('autoRefresh' => true)));
3330
  //wp_enqueue_media();
3331
  wp_enqueue_script( 'psp-meta-box', plugins_url( '/js/pspmetabox.js', __FILE__ ), array('jquery', 'jquery-ui-tabs' ) );
3332
  //wp_enqueue_script( 'psp-image-uploader', plugins_url( '/js/pspmediauploader.js', __FILE__ ), array( 'jquery' ) );
3333
+ wp_enqueue_script( 'psp-meta-box-snippet', plugins_url( '/js/snippetpreview.js', __FILE__ ), '', '2.1.2');
3334
  //wp_enqueue_script( 'psp-social', plugins_url( '/js/pspsocialhandler.js', __FILE__ ), array( 'jquery' ) );
3335
 
3336
  $psp_cm_json_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'json', 'codemirror'=> array('autoRefresh' => true)));
psp-include/sitemap/inc/{class-core-sitemaps-index.php → class-wp-sitemaps-index.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Sitemaps: Core_Sitemaps_Index class.
4
  *
5
  * Generates the sitemap index.
6
  *
@@ -10,27 +10,27 @@
10
  */
11
 
12
  /**
13
- * Class Core_Sitemaps_Index.
14
  * Builds the sitemap index page that lists the links to all of the sitemaps.
15
  *
16
  * @since 5.5.0
17
  */
18
- class Core_Sitemaps_Index {
19
 
20
  /**
21
  * The main registry of supported sitemaps.
22
  *
23
  * @since 5.5.0
24
- * @var Core_Sitemaps_Registry
25
  */
26
  protected $registry;
27
 
28
  /**
29
- * Core_Sitemaps_Index constructor.
30
  *
31
  * @since 5.5.0
32
  *
33
- * @param Core_Sitemaps_Registry $registry Sitemap provider registry.
34
  */
35
  public function __construct( $registry ) {
36
  $this->registry = $registry;
@@ -47,12 +47,17 @@ class Core_Sitemaps_Index {
47
  $sitemaps = array();
48
 
49
  $providers = $this->registry->get_sitemaps();
50
- /* @var Core_Sitemaps_Provider $provider */
51
  foreach ( $providers as $provider ) {
 
 
 
 
 
 
 
52
  // Using array_push is more efficient than array_merge in a loop.
53
- $sitemap = $provider->get_sitemap_entries();
54
- //array_push( $sitemaps, ...$provider->get_sitemap_entries() );
55
- if($sitemap) array_push( $sitemaps, ...$sitemap );
56
  }
57
 
58
  return $sitemaps;
@@ -63,14 +68,13 @@ class Core_Sitemaps_Index {
63
  *
64
  * @since 5.5.0
65
  *
66
- * @return string the sitemap index url.
67
  */
68
  public function get_index_url() {
69
  /* @var WP_Rewrite $wp_rewrite */
70
  global $wp_rewrite;
71
 
72
  $url = home_url( '/wp-sitemap.xml' );
73
- //$url = home_url( '/sitemap.xml' );
74
 
75
  if ( ! $wp_rewrite->using_permalinks() ) {
76
  $url = add_query_arg( 'sitemap', 'index', home_url( '/' ) );
1
  <?php
2
  /**
3
+ * Sitemaps: WP_Sitemaps_Index class.
4
  *
5
  * Generates the sitemap index.
6
  *
10
  */
11
 
12
  /**
13
+ * Class WP_Sitemaps_Index.
14
  * Builds the sitemap index page that lists the links to all of the sitemaps.
15
  *
16
  * @since 5.5.0
17
  */
18
+ class WP_Sitemaps_Index {
19
 
20
  /**
21
  * The main registry of supported sitemaps.
22
  *
23
  * @since 5.5.0
24
+ * @var WP_Sitemaps_Registry
25
  */
26
  protected $registry;
27
 
28
  /**
29
+ * WP_Sitemaps_Index constructor.
30
  *
31
  * @since 5.5.0
32
  *
33
+ * @param WP_Sitemaps_Registry $registry Sitemap provider registry.
34
  */
35
  public function __construct( $registry ) {
36
  $this->registry = $registry;
47
  $sitemaps = array();
48
 
49
  $providers = $this->registry->get_sitemaps();
50
+ /* @var WP_Sitemaps_Provider $provider */
51
  foreach ( $providers as $provider ) {
52
+ $sitemap_entries = $provider->get_sitemap_entries();
53
+
54
+ // Prevent issues with array_push and empty arrays on PHP < 7.3.
55
+ if ( ! $sitemap_entries ) {
56
+ continue;
57
+ }
58
+
59
  // Using array_push is more efficient than array_merge in a loop.
60
+ array_push( $sitemaps, ...$sitemap_entries );
 
 
61
  }
62
 
63
  return $sitemaps;
68
  *
69
  * @since 5.5.0
70
  *
71
+ * @return string The sitemap index url.
72
  */
73
  public function get_index_url() {
74
  /* @var WP_Rewrite $wp_rewrite */
75
  global $wp_rewrite;
76
 
77
  $url = home_url( '/wp-sitemap.xml' );
 
78
 
79
  if ( ! $wp_rewrite->using_permalinks() ) {
80
  $url = add_query_arg( 'sitemap', 'index', home_url( '/' ) );
psp-include/sitemap/inc/{class-core-sitemaps-provider.php → class-wp-sitemaps-provider.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Sitemaps: Core_Sitemaps_Provider class
4
  *
5
  * This class is a base class for other sitemap providers to extend and contains shared functionality.
6
  *
@@ -10,11 +10,11 @@
10
  */
11
 
12
  /**
13
- * Class Core_Sitemaps_Provider.
14
  *
15
  * @since 5.5.0
16
  */
17
- abstract class Core_Sitemaps_Provider {
18
 
19
  /**
20
  * Provider name.
@@ -36,18 +36,6 @@ abstract class Core_Sitemaps_Provider {
36
  */
37
  protected $object_type = '';
38
 
39
- /**
40
- * Object subtype name.
41
- *
42
- * For example, this should be a post type name for object type 'post' or
43
- * a taxonomy name for object type 'term').
44
- *
45
- * @since 5.5.0
46
- *
47
- * @var string
48
- */
49
- protected $object_subtype = '';
50
-
51
  /**
52
  * Gets a URL list for a sitemap.
53
  *
@@ -55,25 +43,10 @@ abstract class Core_Sitemaps_Provider {
55
  *
56
  * @param int $page_num Page of results.
57
  * @param string $object_subtype Optional. Object subtype name. Default empty.
58
- * @return array List of URLs for a sitemap.
59
  */
60
  abstract public function get_url_list( $page_num, $object_subtype = '' );
61
 
62
- /**
63
- * Returns the name of the object type or object subtype being queried.
64
- *
65
- * @since 5.5.0
66
- *
67
- * @return string Object subtype if set, otherwise object type.
68
- */
69
- public function get_queried_type() {
70
- if ( empty( $this->object_subtype ) ) {
71
- return $this->object_type;
72
- }
73
-
74
- return $this->object_subtype;
75
- }
76
-
77
  /**
78
  * Gets the max number of pages available for the object type.
79
  *
@@ -82,21 +55,7 @@ abstract class Core_Sitemaps_Provider {
82
  * @param string $object_subtype Optional. Object subtype. Default empty.
83
  * @return int Total number of pages.
84
  */
85
- abstract public function max_num_pages( $object_subtype = '' );
86
-
87
- /**
88
- * Sets the object subtype.
89
- *
90
- * @since 5.5.0
91
- *
92
- * @param string $object_subtype The name of the object subtype.
93
- * @return bool Returns true on success.
94
- */
95
- public function set_object_subtype( $object_subtype ) {
96
- $this->object_subtype = $object_subtype;
97
-
98
- return true;
99
- }
100
 
101
  /**
102
  * Gets data about each sitemap type.
@@ -110,10 +69,23 @@ abstract class Core_Sitemaps_Provider {
110
 
111
  $object_subtypes = $this->get_object_subtypes();
112
 
 
 
 
 
 
 
 
 
 
 
 
113
  foreach ( $object_subtypes as $object_subtype_name => $data ) {
 
 
114
  $sitemap_data[] = array(
115
- 'name' => $object_subtype_name,
116
- 'pages' => $this->max_num_pages( $object_subtype_name ),
117
  );
118
  }
119
 
@@ -190,30 +162,26 @@ abstract class Core_Sitemaps_Provider {
190
 
191
  return home_url( $basename );
192
  }
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  /**
195
- * Returns the list of supported object sub-types exposed by the provider.
196
  *
197
  * @since 5.5.0
198
  *
199
  * @return array List of object subtypes objects keyed by their name.
200
  */
201
  public function get_object_subtypes() {
202
- if ( ! empty( $this->object_subtype ) ) {
203
- return array(
204
- $this->object_subtype => (object) array( 'name' => $this->object_subtype ),
205
- );
206
- }
207
-
208
- /**
209
- * To prevent complexity in code calling this function, such as `get_sitemap_type_data()`
210
- * in this class, a non-empty array is returned, so that sitemaps for providers without
211
- * object subtypes are still registered correctly.
212
- *
213
- * @link https://github.com/GoogleChromeLabs/wp-sitemaps/pull/72#discussion_r347496750
214
- */
215
- return array(
216
- '' => (object) array( 'name' => '' ),
217
- );
218
  }
219
  }
1
  <?php
2
  /**
3
+ * Sitemaps: WP_Sitemaps_Provider class
4
  *
5
  * This class is a base class for other sitemap providers to extend and contains shared functionality.
6
  *
10
  */
11
 
12
  /**
13
+ * Class WP_Sitemaps_Provider.
14
  *
15
  * @since 5.5.0
16
  */
17
+ abstract class WP_Sitemaps_Provider {
18
 
19
  /**
20
  * Provider name.
36
  */
37
  protected $object_type = '';
38
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Gets a URL list for a sitemap.
41
  *
43
  *
44
  * @param int $page_num Page of results.
45
  * @param string $object_subtype Optional. Object subtype name. Default empty.
46
+ * @return array $url_list Array of URLs for a sitemap.
47
  */
48
  abstract public function get_url_list( $page_num, $object_subtype = '' );
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Gets the max number of pages available for the object type.
52
  *
55
  * @param string $object_subtype Optional. Object subtype. Default empty.
56
  * @return int Total number of pages.
57
  */
58
+ abstract public function get_max_num_pages( $object_subtype = '' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  /**
61
  * Gets data about each sitemap type.
69
 
70
  $object_subtypes = $this->get_object_subtypes();
71
 
72
+ // If there are no object subtypes, include a single sitemap for the
73
+ // entire object type.
74
+ if ( empty( $object_subtypes ) ) {
75
+ $sitemap_data[] = array(
76
+ 'name' => '',
77
+ 'pages' => $this->get_max_num_pages(),
78
+ );
79
+ return $sitemap_data;
80
+ }
81
+
82
+ // Otherwise, include individual sitemaps for every object subtype.
83
  foreach ( $object_subtypes as $object_subtype_name => $data ) {
84
+ $object_subtype_name = (string) $object_subtype_name;
85
+
86
  $sitemap_data[] = array(
87
+ 'name' => $object_subtype_name,
88
+ 'pages' => $this->get_max_num_pages( $object_subtype_name ),
89
  );
90
  }
91
 
162
 
163
  return home_url( $basename );
164
  }
165
+
166
+ /**
167
+ * Returns the object type of the provider.
168
+ *
169
+ * @since 5.5.0
170
+ *
171
+ * @return string The object type of the provider.
172
+ */
173
+ public function get_object_type() {
174
+ return $this->object_type;
175
+ }
176
 
177
  /**
178
+ * Returns the list of supported object subtypes exposed by the provider.
179
  *
180
  * @since 5.5.0
181
  *
182
  * @return array List of object subtypes objects keyed by their name.
183
  */
184
  public function get_object_subtypes() {
185
+ return array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
  }
psp-include/sitemap/inc/{class-core-sitemaps-registry.php → class-wp-sitemaps-registry.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Sitemaps: Core_Sitemaps_Registry class
4
  *
5
  * Handles registering sitemaps.
6
  *
@@ -10,11 +10,11 @@
10
  */
11
 
12
  /**
13
- * Class Core_Sitemaps_Registry.
14
  *
15
  * @since 5.5.0
16
  */
17
- class Core_Sitemaps_Registry {
18
  /**
19
  * Registered sitemaps.
20
  *
@@ -29,8 +29,8 @@ class Core_Sitemaps_Registry {
29
  *
30
  * @since 5.5.0
31
  *
32
- * @param string $name Name of the sitemap.
33
- * @param Core_Sitemaps_Provider $provider Instance of a Core_Sitemaps_Provider.
34
  * @return bool True if the sitemap was added, false if it is already registered.
35
  */
36
  public function add_sitemap( $name, $provider ) {
@@ -38,7 +38,7 @@ class Core_Sitemaps_Registry {
38
  return false;
39
  }
40
 
41
- if ( ! $provider instanceof Core_Sitemaps_Provider ) {
42
  return false;
43
  }
44
 
@@ -53,7 +53,7 @@ class Core_Sitemaps_Registry {
53
  * @since 5.5.0
54
  *
55
  * @param string $name Sitemap provider name.
56
- * @return Core_Sitemaps_Provider|null Sitemaps provider if it exists, null otherwise.
57
  */
58
  public function get_sitemap( $name ) {
59
  if ( ! isset( $this->sitemaps[ $name ] ) ) {
@@ -73,8 +73,8 @@ class Core_Sitemaps_Registry {
73
  public function get_sitemaps() {
74
  $total_sitemaps = count( $this->sitemaps );
75
 
76
- if ( $total_sitemaps > CORE_SITEMAPS_MAX_SITEMAPS ) {
77
- return array_slice( $this->sitemaps, 0, CORE_SITEMAPS_MAX_SITEMAPS, true );
78
  }
79
 
80
  return $this->sitemaps;
1
  <?php
2
  /**
3
+ * Sitemaps: WP_Sitemaps_Registry class
4
  *
5
  * Handles registering sitemaps.
6
  *
10
  */
11
 
12
  /**
13
+ * Class WP_Sitemaps_Registry.
14
  *
15
  * @since 5.5.0
16
  */
17
+ class WP_Sitemaps_Registry {
18
  /**
19
  * Registered sitemaps.
20
  *
29
  *
30
  * @since 5.5.0
31
  *
32
+ * @param string $name Name of the sitemap.
33
+ * @param WP_Sitemaps_Provider $provider Instance of a WP_Sitemaps_Provider.
34
  * @return bool True if the sitemap was added, false if it is already registered.
35
  */
36
  public function add_sitemap( $name, $provider ) {
38
  return false;
39
  }
40
 
41
+ if ( ! $provider instanceof WP_Sitemaps_Provider ) {
42
  return false;
43
  }
44
 
53
  * @since 5.5.0
54
  *
55
  * @param string $name Sitemap provider name.
56
+ * @return WP_Sitemaps_Provider|null Sitemaps provider if it exists, null otherwise.
57
  */
58
  public function get_sitemap( $name ) {
59
  if ( ! isset( $this->sitemaps[ $name ] ) ) {
73
  public function get_sitemaps() {
74
  $total_sitemaps = count( $this->sitemaps );
75
 
76
+ if ( $total_sitemaps > WP_SITEMAPS_MAX_SITEMAPS ) {
77
+ return array_slice( $this->sitemaps, 0, WP_SITEMAPS_MAX_SITEMAPS, true );
78
  }
79
 
80
  return $this->sitemaps;
psp-include/sitemap/inc/{class-core-sitemaps-renderer.php → class-wp-sitemaps-renderer.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Sitemaps: Core_Sitemaps_Renderer class
4
  *
5
  * Responsible for rendering Sitemaps data to XML in accordance with sitemap protocol.
6
  *
@@ -10,11 +10,11 @@
10
  */
11
 
12
  /**
13
- * Class Core_Sitemaps_Renderer
14
  *
15
  * @since 5.5.0
16
  */
17
- class Core_Sitemaps_Renderer {
18
  /**
19
  * XSL stylesheet for styling a sitemap for web browsers.
20
  *
@@ -34,7 +34,7 @@ class Core_Sitemaps_Renderer {
34
  protected $stylesheet_index = '';
35
 
36
  /**
37
- * Core_Sitemaps_Renderer constructor.
38
  *
39
  * @since 5.5.0
40
  */
@@ -54,7 +54,7 @@ class Core_Sitemaps_Renderer {
54
  *
55
  * @since 5.5.0
56
  *
57
- * @return string the sitemap stylesheet url.
58
  */
59
  public function get_sitemap_stylesheet_url() {
60
  /* @var WP_Rewrite $wp_rewrite */
@@ -76,7 +76,7 @@ class Core_Sitemaps_Renderer {
76
  *
77
  * @param string $sitemap_url Full URL for the sitemaps xsl file.
78
  */
79
- return apply_filters( 'core_sitemaps_stylesheet_url', $sitemap_url );
80
  }
81
 
82
  /**
@@ -84,7 +84,7 @@ class Core_Sitemaps_Renderer {
84
  *
85
  * @since 5.5.0
86
  *
87
- * @return string the sitemap index stylesheet url.
88
  */
89
  public function get_sitemap_index_stylesheet_url() {
90
  /* @var WP_Rewrite $wp_rewrite */
@@ -106,7 +106,7 @@ class Core_Sitemaps_Renderer {
106
  *
107
  * @param string $sitemap_url Full URL for the sitemaps index xsl file.
108
  */
109
- return apply_filters( 'core_sitemaps_stylesheet_index_url', $sitemap_url );
110
  }
111
 
112
  /**
@@ -114,7 +114,7 @@ class Core_Sitemaps_Renderer {
114
  *
115
  * @since 5.5.0
116
  *
117
- * @param array $sitemaps List of sitemap entries.
118
  */
119
  public function render_index( $sitemaps ) {
120
  header( 'Content-type: application/xml; charset=UTF-8' );
@@ -135,7 +135,7 @@ class Core_Sitemaps_Renderer {
135
  *
136
  * @since 5.5.0
137
  *
138
- * @param array $sitemaps List of sitemap entries.
139
  * @return string|false A well-formed XML string for a sitemap index. False on error.
140
  */
141
  public function get_sitemap_index_xml( $sitemaps ) {
@@ -163,12 +163,12 @@ class Core_Sitemaps_Renderer {
163
  *
164
  * @param array $url_list A list of URLs for a sitemap.
165
  */
166
- public function render_sitemap( $url_list, $object_subtype ) {
167
  header( 'Content-type: application/xml; charset=UTF-8' );
168
 
169
  $this->check_for_simple_xml_availability();
170
 
171
- $sitemap_xml = apply_filters( "core_sitemaps_get_sitemap_xml", $url_list, $object_subtype );
172
 
173
  if ( empty( $sitemap_xml ) ) {
174
 
@@ -193,7 +193,7 @@ class Core_Sitemaps_Renderer {
193
  *
194
  * @since 5.5.0
195
  *
196
- * @param array $url_list A list of URLs for a sitemap.
197
  * @return string|false A well-formed XML string for a sitemap index. False on error.
198
  */
199
  public function get_sitemap_xml( $url_list ) {
@@ -202,8 +202,7 @@ class Core_Sitemaps_Renderer {
202
  '%1$s%2$s%3$s',
203
  '<?xml version="1.0" encoding="UTF-8" ?>',
204
  $this->stylesheet,
205
- //'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'
206
- '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'
207
  )
208
  );
209
 
@@ -214,15 +213,6 @@ class Core_Sitemaps_Renderer {
214
  foreach ( $url_item as $attr => $value ) {
215
  if ( 'url' === $attr ) {
216
  $url->addChild( $attr, esc_url( $value ) );
217
- } else if ('image' === $attr) {
218
- //$image = $url->addChild('image:image');
219
- //$image = $url->addChild('image:image', null, 'http://www.google.com/schemas/sitemap-image/1.1');
220
- foreach ($value as $imageattr) {
221
- $image = $url->addChild('image:image', null, 'http://www.google.com/schemas/sitemap-image/1.1');
222
- if(array_key_exists("loc", $imageattr)) $image->addChild('image:loc',esc_url( $imageattr['loc'] ), 'http://www.google.com/schemas/sitemap-image/1.1');
223
- if(array_key_exists("title", $imageattr)) $image->addChild('image:title',esc_attr( $imageattr['title'] ), 'http://www.google.com/schemas/sitemap-image/1.1');
224
- if(array_key_exists("caption", $imageattr)) $image->addChild('image:caption',esc_attr( $imageattr['caption'] ), 'http://www.google.com/schemas/sitemap-image/1.1');
225
- }
226
  } else {
227
  $url->addChild( $attr, esc_attr( $value ) );
228
  }
1
  <?php
2
  /**
3
+ * Sitemaps: WP_Sitemaps_Renderer class
4
  *
5
  * Responsible for rendering Sitemaps data to XML in accordance with sitemap protocol.
6
  *
10
  */
11
 
12
  /**
13
+ * Class WP_Sitemaps_Renderer
14
  *
15
  * @since 5.5.0
16
  */
17
+ class WP_Sitemaps_Renderer {
18
  /**
19
  * XSL stylesheet for styling a sitemap for web browsers.
20
  *
34
  protected $stylesheet_index = '';
35
 
36
  /**
37
+ * WP_Sitemaps_Renderer constructor.
38
  *
39
  * @since 5.5.0
40
  */
54
  *
55
  * @since 5.5.0
56
  *
57
+ * @return string The sitemap stylesheet url.
58
  */
59
  public function get_sitemap_stylesheet_url() {
60
  /* @var WP_Rewrite $wp_rewrite */
76
  *
77
  * @param string $sitemap_url Full URL for the sitemaps xsl file.
78
  */
79
+ return apply_filters( 'wp_sitemaps_stylesheet_url', $sitemap_url );
80
  }
81
 
82
  /**
84
  *
85
  * @since 5.5.0
86
  *
87
+ * @return string The sitemap index stylesheet url.
88
  */
89
  public function get_sitemap_index_stylesheet_url() {
90
  /* @var WP_Rewrite $wp_rewrite */
106
  *
107
  * @param string $sitemap_url Full URL for the sitemaps index xsl file.
108
  */
109
+ return apply_filters( 'wp_sitemaps_stylesheet_index_url', $sitemap_url );
110
  }
111
 
112
  /**
114
  *
115
  * @since 5.5.0
116
  *
117
+ * @param array $sitemaps Array of sitemap URLs.
118
  */
119
  public function render_index( $sitemaps ) {
120
  header( 'Content-type: application/xml; charset=UTF-8' );
135
  *
136
  * @since 5.5.0
137
  *
138
+ * @param array $sitemaps Array of sitemap URLs.
139
  * @return string|false A well-formed XML string for a sitemap index. False on error.
140
  */
141
  public function get_sitemap_index_xml( $sitemaps ) {
163
  *
164
  * @param array $url_list A list of URLs for a sitemap.
165
  */
166
+ public function render_sitemap( $url_list, $object_type, $object_subtype ) {
167
  header( 'Content-type: application/xml; charset=UTF-8' );
168
 
169
  $this->check_for_simple_xml_availability();
170
 
171
+ $sitemap_xml = apply_filters( "wp_sitemaps_get_sitemap_xml", $url_list, $object_type, $object_subtype );
172
 
173
  if ( empty( $sitemap_xml ) ) {
174
 
193
  *
194
  * @since 5.5.0
195
  *
196
+ * @param array $url_list Array of URLs for a sitemap.
197
  * @return string|false A well-formed XML string for a sitemap index. False on error.
198
  */
199
  public function get_sitemap_xml( $url_list ) {
202
  '%1$s%2$s%3$s',
203
  '<?xml version="1.0" encoding="UTF-8" ?>',
204
  $this->stylesheet,
205
+ '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'
 
206
  )
207
  );
208
 
213
  foreach ( $url_item as $attr => $value ) {
214
  if ( 'url' === $attr ) {
215
  $url->addChild( $attr, esc_url( $value ) );
 
 
 
 
 
 
 
 
 
216
  } else {
217
  $url->addChild( $attr, esc_attr( $value ) );
218
  }
psp-include/sitemap/inc/{class-core-sitemaps-stylesheet.php → class-wp-sitemaps-stylesheet.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Sitemaps: Core_Sitemaps_Stylesheet class
4
  *
5
  * This class provides the XSL stylesheets to style all sitemaps.
6
  *
@@ -14,7 +14,7 @@
14
  *
15
  * @since 5.5.0
16
  */
17
- class Core_Sitemaps_Stylesheet {
18
  /**
19
  * Renders the xsl stylesheet depending on whether its the sitemap index or not.
20
  *
@@ -117,7 +117,7 @@ XSL;
117
  *
118
  * @param string $xsl Full content for the xml stylesheet.
119
  */
120
- return apply_filters( 'core_sitemaps_stylesheet_content', $xsl_content );
121
  }
122
 
123
  /**
@@ -201,7 +201,7 @@ XSL;
201
  *
202
  * @param string $xsl Full content for the xml stylesheet.
203
  */
204
- return apply_filters( 'core_sitemaps_index_stylesheet_content', $xsl_content );
205
  }
206
 
207
  /**
@@ -247,6 +247,6 @@ XSL;
247
  *
248
  * @param string $css CSS to be applied to default xsl file.
249
  */
250
- return apply_filters( 'core_sitemaps_stylesheet_css', $css );
251
  }
252
  }
1
  <?php
2
  /**
3
+ * Sitemaps: WP_Sitemaps_Stylesheet class
4
  *
5
  * This class provides the XSL stylesheets to style all sitemaps.
6
  *
14
  *
15
  * @since 5.5.0
16
  */
17
+ class WP_Sitemaps_Stylesheet {
18
  /**
19
  * Renders the xsl stylesheet depending on whether its the sitemap index or not.
20
  *
117
  *
118
  * @param string $xsl Full content for the xml stylesheet.
119
  */
120
+ return apply_filters( 'wp_sitemaps_stylesheet_content', $xsl_content );
121
  }
122
 
123
  /**
201
  *
202
  * @param string $xsl Full content for the xml stylesheet.
203
  */
204
+ return apply_filters( 'wp_sitemaps_index_stylesheet_content', $xsl_content );
205
  }
206
 
207
  /**
247
  *
248
  * @param string $css CSS to be applied to default xsl file.
249
  */
250
+ return apply_filters( 'wp_sitemaps_stylesheet_css', $css );
251
  }
252
  }
psp-include/sitemap/inc/{class-core-sitemaps.php → class-wp-sitemaps.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Sitemaps: Core_Sitemaps class
4
  *
5
  * This is the main class integrating all other classes.
6
  *
@@ -10,17 +10,17 @@
10
  */
11
 
12
  /**
13
- * Class Core_Sitemaps.
14
  *
15
  * @since 5.5.0
16
  */
17
- class Core_Sitemaps {
18
  /**
19
  * The main index of supported sitemaps.
20
  *
21
  * @since 5.5.0
22
  *
23
- * @var Core_Sitemaps_Index
24
  */
25
  public $index;
26
 
@@ -29,7 +29,7 @@ class Core_Sitemaps {
29
  *
30
  * @since 5.5.0
31
  *
32
- * @var Core_Sitemaps_Registry
33
  */
34
  public $registry;
35
 
@@ -38,19 +38,19 @@ class Core_Sitemaps {
38
  *
39
  * @since 5.5.0
40
  *
41
- * @var Core_Sitemaps_Renderer
42
  */
43
  public $renderer;
44
 
45
  /**
46
- * Core_Sitemaps constructor.
47
  *
48
  * @since 5.5.0
49
  */
50
  public function __construct() {
51
- $this->registry = new Core_Sitemaps_Registry();
52
- $this->renderer = new Core_Sitemaps_Renderer();
53
- $this->index = new Core_Sitemaps_Index( $this->registry );
54
  }
55
 
56
  /**
@@ -63,7 +63,7 @@ class Core_Sitemaps {
63
  $this->register_sitemaps();
64
 
65
  // Add additional action callbacks.
66
- add_action( 'core_sitemaps_init', array( $this, 'register_rewrites' ) );
67
  add_action( 'template_redirect', array( $this, 'render_sitemaps' ) );
68
  add_action( 'wp_loaded', array( $this, 'maybe_flush_rewrites' ) );
69
  add_filter( 'pre_handle_404', array( $this, 'redirect_sitemapxml' ), 10, 2 );
@@ -82,19 +82,25 @@ class Core_Sitemaps {
82
  *
83
  * @since 5.5.0
84
  *
85
- * @param array $providers Array of Core_Sitemap_Provider objects keyed by their name.
 
 
 
 
 
 
86
  */
87
  $providers = apply_filters(
88
- 'core_sitemaps_register_providers',
89
  array(
90
- 'posts' => new Core_Sitemaps_Posts(),
91
- 'taxonomies' => new Core_Sitemaps_Taxonomies(),
92
- 'users' => new Core_Sitemaps_Users(),
93
  )
94
  );
95
 
96
  // Register each supported provider.
97
- /* @var Core_Sitemaps_Provider $provider */
98
  foreach ( $providers as $name => $provider ) {
99
  $this->registry->add_sitemap( $name, $provider );
100
  }
@@ -158,7 +164,7 @@ class Core_Sitemaps {
158
  * @since 5.5.0
159
  */
160
  public function maybe_flush_rewrites() {
161
- if ( update_option( 'core_sitemaps_rewrite_version', CORE_SITEMAPS_REWRITE_VERSION ) ) {
162
  flush_rewrite_rules( false );
163
  }
164
  }
@@ -183,7 +189,7 @@ class Core_Sitemaps {
183
 
184
  // Render stylesheet if this is stylesheet route.
185
  if ( $stylesheet_type ) {
186
- $stylesheet = new Core_Sitemaps_Stylesheet();
187
 
188
  $stylesheet->render_stylesheet( $stylesheet_type );
189
  exit;
@@ -207,14 +213,8 @@ class Core_Sitemaps {
207
  $paged = 1;
208
  }
209
 
210
- $object_subtypes = $provider->get_object_subtypes();
211
-
212
- // Only set the current object sub-type if it's supported.
213
- if ( isset( $object_subtypes[ $object_subtype ] ) ) {
214
- $provider->set_object_subtype( $object_subtype );
215
- }
216
-
217
  $url_list = $provider->get_url_list( $paged, $object_subtype );
 
218
 
219
  // Force a 404 and bail early if no URLs are present.
220
  if ( empty( $url_list ) ) {
@@ -222,7 +222,7 @@ class Core_Sitemaps {
222
  return;
223
  }
224
 
225
- $this->renderer->render_sitemap( $url_list, $object_subtype );
226
  exit;
227
  }
228
 
@@ -233,8 +233,7 @@ class Core_Sitemaps {
233
  *
234
  * @param bool $bypass Pass-through of the pre_handle_404 filter value.
235
  * @param WP_Query $query The WP_Query object.
236
- *
237
- * @return bool bypass value.
238
  */
239
  public function redirect_sitemapxml( $bypass, $query ) {
240
  // If a plugin has already utilized the pre_handle_404 function, return without action to avoid conflicts.
@@ -259,7 +258,7 @@ class Core_Sitemaps {
259
  *
260
  * @param string $output robots.txt output.
261
  * @param bool $public Whether the site is public or not.
262
- * @return string robots.txt output.
263
  */
264
  public function add_robots( $output, $public ) {
265
  if ( $public ) {
@@ -275,7 +274,7 @@ class Core_Sitemaps {
275
  * @since 5.5.0
276
  *
277
  * @param string $redirect The redirect URL currently determined.
278
- * @return bool|string $redirect
279
  */
280
  public function redirect_canonical( $redirect ) {
281
  if ( get_query_var( 'sitemap' ) || get_query_var( 'sitemap-stylesheet' ) ) {
1
  <?php
2
  /**
3
+ * Sitemaps: WP_Sitemaps class
4
  *
5
  * This is the main class integrating all other classes.
6
  *
10
  */
11
 
12
  /**
13
+ * Class WP_Sitemaps.
14
  *
15
  * @since 5.5.0
16
  */
17
+ class WP_Sitemaps {
18
  /**
19
  * The main index of supported sitemaps.
20
  *
21
  * @since 5.5.0
22
  *
23
+ * @var WP_Sitemaps_Index
24
  */
25
  public $index;
26
 
29
  *
30
  * @since 5.5.0
31
  *
32
+ * @var WP_Sitemaps_Registry
33
  */
34
  public $registry;
35
 
38
  *
39
  * @since 5.5.0
40
  *
41
+ * @var WP_Sitemaps_Renderer
42
  */
43
  public $renderer;
44
 
45
  /**
46
+ * WP_Sitemaps constructor.
47
  *
48
  * @since 5.5.0
49
  */
50
  public function __construct() {
51
+ $this->registry = new WP_Sitemaps_Registry();
52
+ $this->renderer = new WP_Sitemaps_Renderer();
53
+ $this->index = new WP_Sitemaps_Index( $this->registry );
54
  }
55
 
56
  /**
63
  $this->register_sitemaps();
64
 
65
  // Add additional action callbacks.
66
+ add_action( 'wp_sitemaps_init', array( $this, 'register_rewrites' ) );
67
  add_action( 'template_redirect', array( $this, 'render_sitemaps' ) );
68
  add_action( 'wp_loaded', array( $this, 'maybe_flush_rewrites' ) );
69
  add_filter( 'pre_handle_404', array( $this, 'redirect_sitemapxml' ), 10, 2 );
82
  *
83
  * @since 5.5.0
84
  *
85
+ * @param array $providers {
86
+ * Array of WP_Sitemap_Provider objects keyed by their name.
87
+ *
88
+ * @type object $posts The WP_Sitemaps_Posts object.
89
+ * @type object $taxonomies The WP_Sitemaps_Taxonomies object.
90
+ * @type object $users The WP_Sitemaps_Users object.
91
+ * }
92
  */
93
  $providers = apply_filters(
94
+ 'wp_sitemaps_register_providers',
95
  array(
96
+ 'posts' => new WP_Sitemaps_Posts(),
97
+ 'taxonomies' => new WP_Sitemaps_Taxonomies(),
98
+ 'users' => new WP_Sitemaps_Users(),
99
  )
100
  );
101
 
102
  // Register each supported provider.
103
+ /* @var WP_Sitemaps_Provider $provider */
104
  foreach ( $providers as $name => $provider ) {
105
  $this->registry->add_sitemap( $name, $provider );
106
  }
164
  * @since 5.5.0
165
  */
166
  public function maybe_flush_rewrites() {
167
+ if ( update_option( 'wp_sitemaps_rewrite_version', WP_SITEMAPS_REWRITE_VERSION ) ) {
168
  flush_rewrite_rules( false );
169
  }
170
  }
189
 
190
  // Render stylesheet if this is stylesheet route.
191
  if ( $stylesheet_type ) {
192
+ $stylesheet = new WP_Sitemaps_Stylesheet();
193
 
194
  $stylesheet->render_stylesheet( $stylesheet_type );
195
  exit;
213
  $paged = 1;
214
  }
215
 
 
 
 
 
 
 
 
216
  $url_list = $provider->get_url_list( $paged, $object_subtype );
217
+ $object_type = $provider->get_object_type();
218
 
219
  // Force a 404 and bail early if no URLs are present.
220
  if ( empty( $url_list ) ) {
222
  return;
223
  }
224
 
225
+ $this->renderer->render_sitemap( $url_list, $object_type, $object_subtype );
226
  exit;
227
  }
228
 
233
  *
234
  * @param bool $bypass Pass-through of the pre_handle_404 filter value.
235
  * @param WP_Query $query The WP_Query object.
236
+ * @return bool Bypass value.
 
237
  */
238
  public function redirect_sitemapxml( $bypass, $query ) {
239
  // If a plugin has already utilized the pre_handle_404 function, return without action to avoid conflicts.
258
  *
259
  * @param string $output robots.txt output.
260
  * @param bool $public Whether the site is public or not.
261
+ * @return string The robots.txt output.
262
  */
263
  public function add_robots( $output, $public ) {
264
  if ( $public ) {
274
  * @since 5.5.0
275
  *
276
  * @param string $redirect The redirect URL currently determined.
277
+ * @return bool|string $redirect The canonical redirect URL.
278
  */
279
  public function redirect_canonical( $redirect ) {
280
  if ( get_query_var( 'sitemap' ) || get_query_var( 'sitemap-stylesheet' ) ) {
psp-include/sitemap/inc/functions.php CHANGED
@@ -15,17 +15,17 @@
15
  *
16
  * @since 5.5.0
17
  *
18
- * @return Core_Sitemaps|null Core_Sitemaps instance, or null of sitemaps are disabled.
19
  */
20
- function core_sitemaps_get_server() {
21
  /**
22
  * Global Core Sitemaps instance.
23
  *
24
  * @since 5.5.0
25
  *
26
- * @var Core_Sitemaps $core_sitemaps
27
  */
28
- global $core_sitemaps;
29
 
30
  $is_enabled = (bool) get_option( 'blog_public' );
31
 
@@ -36,30 +36,30 @@ function core_sitemaps_get_server() {
36
  *
37
  * @param bool $is_enabled Whether XML Sitemaps are enabled or not. Defaults to true for public sites.
38
  */
39
- $is_enabled = (bool) apply_filters( 'core_sitemaps_is_enabled', $is_enabled );
40
 
41
  if ( ! $is_enabled ) {
42
  return null;
43
  }
44
 
45
  // If there isn't a global instance, set and bootstrap the sitemaps system.
46
- if ( empty( $core_sitemaps ) ) {
47
- $core_sitemaps = new Core_Sitemaps();
48
- $core_sitemaps->init();
49
 
50
  /**
51
- * Fires when initializing the Core_Sitemaps object.
52
  *
53
  * Additional sitemaps should be registered on this hook.
54
  *
55
  * @since 5.5.0
56
  *
57
- * @param core_sitemaps $core_sitemaps Server object.
58
  */
59
- do_action( 'core_sitemaps_init', $core_sitemaps );
60
  }
61
 
62
- return $core_sitemaps;
63
  }
64
 
65
  /**
@@ -69,14 +69,14 @@ function core_sitemaps_get_server() {
69
  *
70
  * @return array $sitemaps A list of registered sitemap providers.
71
  */
72
- function core_sitemaps_get_sitemaps() {
73
- $core_sitemaps = core_sitemaps_get_server();
74
 
75
- if ( ! $core_sitemaps ) {
76
  return array();
77
  }
78
 
79
- return $core_sitemaps->registry->get_sitemaps();
80
  }
81
 
82
  /**
@@ -84,18 +84,18 @@ function core_sitemaps_get_sitemaps() {
84
  *
85
  * @since 5.5.0
86
  *
87
- * @param string $name Unique name for the sitemap provider.
88
- * @param Core_Sitemaps_Provider $provider The `Core_Sitemaps_Provider` instance implementing the sitemap.
89
  * @return bool Returns true if the sitemap was added. False on failure.
90
  */
91
- function core_sitemaps_register_sitemap( $name, $provider ) {
92
- $core_sitemaps = core_sitemaps_get_server();
93
 
94
- if ( ! $core_sitemaps ) {
95
  return false;
96
  }
97
 
98
- return $core_sitemaps->registry->add_sitemap( $name, $provider );
99
  }
100
 
101
  /**
@@ -106,7 +106,7 @@ function core_sitemaps_register_sitemap( $name, $provider ) {
106
  * @param string $object_type Object type for sitemap to be filtered (e.g. 'post', 'term', 'user').
107
  * @return int The maximum number of URLs.
108
  */
109
- function core_sitemaps_get_max_urls( $object_type ) {
110
  /**
111
  * Filters the maximum number of URLs displayed on a sitemap.
112
  *
@@ -115,5 +115,5 @@ function core_sitemaps_get_max_urls( $object_type ) {
115
  * @param int $max_urls The maximum number of URLs included in a sitemap. Default 2000.
116
  * @param string $object_type Object type for sitemap to be filtered (e.g. 'post', 'term', 'user').
117
  */
118
- return apply_filters( 'core_sitemaps_max_urls', CORE_SITEMAPS_MAX_URLS, $object_type );
119
  }
15
  *
16
  * @since 5.5.0
17
  *
18
+ * @return WP_Sitemaps|null Sitemaps instance, or null if sitemaps are disabled.
19
  */
20
+ function wp_sitemaps_get_server() {
21
  /**
22
  * Global Core Sitemaps instance.
23
  *
24
  * @since 5.5.0
25
  *
26
+ * @var WP_Sitemaps $wp_sitemaps
27
  */
28
+ global $wp_sitemaps;
29
 
30
  $is_enabled = (bool) get_option( 'blog_public' );
31
 
36
  *
37
  * @param bool $is_enabled Whether XML Sitemaps are enabled or not. Defaults to true for public sites.
38
  */
39
+ $is_enabled = (bool) apply_filters( 'wp_sitemaps_is_enabled', $is_enabled );
40
 
41
  if ( ! $is_enabled ) {
42
  return null;
43
  }
44
 
45
  // If there isn't a global instance, set and bootstrap the sitemaps system.
46
+ if ( empty( $wp_sitemaps ) ) {
47
+ $wp_sitemaps = new WP_Sitemaps();
48
+ $wp_sitemaps->init();
49
 
50
  /**
51
+ * Fires when initializing the Sitemaps object.
52
  *
53
  * Additional sitemaps should be registered on this hook.
54
  *
55
  * @since 5.5.0
56
  *
57
+ * @param WP_Sitemaps $sitemaps Server object.
58
  */
59
+ do_action( 'wp_sitemaps_init', $wp_sitemaps );
60
  }
61
 
62
+ return $wp_sitemaps;
63
  }
64
 
65
  /**
69
  *
70
  * @return array $sitemaps A list of registered sitemap providers.
71
  */
72
+ function wp_get_sitemaps() {
73
+ $sitemaps = wp_sitemaps_get_server();
74
 
75
+ if ( ! $sitemaps ) {
76
  return array();
77
  }
78
 
79
+ return $sitemaps->registry->get_sitemaps();
80
  }
81
 
82
  /**
84
  *
85
  * @since 5.5.0
86
  *
87
+ * @param string $name Unique name for the sitemap provider.
88
+ * @param WP_Sitemaps_Provider $provider The `Sitemaps_Provider` instance implementing the sitemap.
89
  * @return bool Returns true if the sitemap was added. False on failure.
90
  */
91
+ function wp_register_sitemap( $name, $provider ) {
92
+ $sitemaps = wp_sitemaps_get_server();
93
 
94
+ if ( ! $sitemaps ) {
95
  return false;
96
  }
97
 
98
+ return $sitemaps->registry->add_sitemap( $name, $provider );
99
  }
100
 
101
  /**
106
  * @param string $object_type Object type for sitemap to be filtered (e.g. 'post', 'term', 'user').
107
  * @return int The maximum number of URLs.
108
  */
109
+ function wp_sitemaps_get_max_urls( $object_type ) {
110
  /**
111
  * Filters the maximum number of URLs displayed on a sitemap.
112
  *
115
  * @param int $max_urls The maximum number of URLs included in a sitemap. Default 2000.
116
  * @param string $object_type Object type for sitemap to be filtered (e.g. 'post', 'term', 'user').
117
  */
118
+ return apply_filters( 'wp_sitemaps_max_urls', WP_SITEMAPS_MAX_URLS, $object_type );
119
  }
psp-include/sitemap/inc/providers/class-core-sitemaps-posts.php DELETED
@@ -1,160 +0,0 @@
1
- <?php
2
- /**
3
- * Sitemaps: Core_Sitemaps_Posts class
4
- *
5
- * Builds the sitemaps for the 'post' object type.
6
- *
7
- * @package WordPress
8
- * @subpackage Sitemaps
9
- * @since 5.5.0
10
- */
11
-
12
- /**
13
- * Posts XML sitemap provider.
14
- *
15
- * @since 5.5.0
16
- */
17
- class Core_Sitemaps_Posts extends Core_Sitemaps_Provider {
18
- /**
19
- * Core_Sitemaps_Posts constructor.
20
- *
21
- * @since 5.5.0
22
- */
23
- public function __construct() {
24
- $this->name = 'posts';
25
- $this->object_type = 'post';
26
- }
27
-
28
- /**
29
- * Returns the public post types, which excludes nav_items and similar types.
30
- * Attachments are also excluded. This includes custom post types with public = true.
31
- *
32
- * @since 5.5.0
33
- *
34
- * @return array Map of registered post type objects keyed by their name.
35
- */
36
- public function get_object_subtypes() {
37
- $post_types = get_post_types( array( 'public' => true ), 'objects' );
38
- unset( $post_types['attachment'] );
39
-
40
- /**
41
- * Filters the list of post object sub types available within the sitemap.
42
- *
43
- * @since 5.5.0
44
- *
45
- * @param array $post_types Map of registered post type objects keyed by their name.
46
- */
47
- return apply_filters( 'core_sitemaps_post_types', $post_types );
48
- }
49
-
50
- /**
51
- * Gets a URL list for a post type sitemap.
52
- *
53
- * @since 5.5.0
54
- *
55
- * @param int $page_num Page of results.
56
- * @param string $post_type Optional. Post type name. Default empty.
57
- * @return array List of URLs for a sitemap.
58
- */
59
- public function get_url_list( $page_num, $post_type = '' ) {
60
- if ( ! $post_type ) {
61
- $post_type = $this->get_queried_type();
62
- }
63
-
64
- // Return an empty array if the type is not supported.
65
- $supported_types = $this->get_object_subtypes();
66
-
67
- if ( ! isset( $supported_types[ $post_type ] ) ) {
68
- return array();
69
- }
70
-
71
- $query = new WP_Query(
72
- array(
73
- 'fields' => 'ids',
74
- 'orderby' => 'ID',
75
- 'order' => 'ASC',
76
- 'post_type' => $post_type,
77
- 'posts_per_page' => core_sitemaps_get_max_urls( $this->object_type ),
78
- 'post_status' => array( 'publish' ),
79
- 'paged' => $page_num,
80
- 'no_found_rows' => true,
81
- 'update_post_term_cache' => false,
82
- 'update_post_meta_cache' => false,
83
- )
84
- );
85
-
86
- /**
87
- * Returns an array of posts.
88
- *
89
- * @var array<int, \WP_Post> $posts
90
- */
91
- $posts = $query->get_posts();
92
-
93
- $posts = apply_filters( 'core_sitemaps_posts_list', $posts, $post_type, $page_num );
94
-
95
- $url_list = array();
96
-
97
- $post_sitemap_attributes = array();
98
-
99
- /*
100
- * Add a URL for the homepage in the pages sitemap.
101
- * Shows only on the first page if the reading settings are set to display latest posts.
102
- */
103
- if ( 'page' === $post_type && 1 === $page_num && 'posts' === get_option( 'show_on_front' ) ) {
104
- // Extract the data needed for home URL to add to the array.
105
- $url_list[] = array(
106
- 'loc' => home_url(),
107
- );
108
- }
109
-
110
- foreach ( $posts as $post ) {
111
- $post_sitemap_attributes = array( 'loc' => get_permalink( $post )) ;
112
- $url_list[] = apply_filters( 'core_sitemaps_post_attributes', $post_sitemap_attributes, $post );
113
- /***
114
- $url_list[] = array(
115
- 'loc' => get_permalink( $post ),
116
- );
117
- ***/
118
- }
119
-
120
- /**
121
- * Filters the list of URLs for a sitemap before rendering.
122
- *
123
- * @since 5.5.0
124
- *
125
- * @param array $url_list List of URLs for a sitemap.
126
- * @param string $post_type Name of the post_type.
127
- * @param int $page_num Page number of the results.
128
- */
129
- return apply_filters( 'core_sitemaps_posts_url_list', $url_list, $post_type, $page_num );
130
- }
131
-
132
- /**
133
- * Gets the max number of pages available for the object type.
134
- *
135
- * @since 5.5.0
136
- *
137
- * @param string $post_type Optional. Post type name. Default empty.
138
- * @return int Total number of pages.
139
- */
140
- public function max_num_pages( $post_type = '' ) {
141
- if ( empty( $post_type ) ) {
142
- $post_type = $this->get_queried_type();
143
- }
144
-
145
- $query = new WP_Query(
146
- array(
147
- 'fields' => 'ids',
148
- 'orderby' => 'ID',
149
- 'order' => 'ASC',
150
- 'post_type' => $post_type,
151
- 'posts_per_page' => core_sitemaps_get_max_urls( $this->object_type ),
152
- 'paged' => 1,
153
- 'update_post_term_cache' => false,
154
- 'update_post_meta_cache' => false,
155
- )
156
- );
157
-
158
- return isset( $query->max_num_pages ) ? $query->max_num_pages : 1;
159
- }
160
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
psp-include/sitemap/inc/providers/class-core-sitemaps-taxonomies.php DELETED
@@ -1,143 +0,0 @@
1
- <?php
2
- /**
3
- * Sitemaps: Core_Sitemaps_Taxonomies class
4
- *
5
- * Builds the sitemaps for the 'taxonomy' object type.
6
- *
7
- * @package WordPress
8
- * @subpackage Sitemaps
9
- * @since 5.5.0
10
- */
11
-
12
- /**
13
- * Taxonomies XML sitemap provider.
14
- *
15
- * @since 5.5.0
16
- */
17
- class Core_Sitemaps_Taxonomies extends Core_Sitemaps_Provider {
18
- /**
19
- * Core_Sitemaps_Taxonomies constructor.
20
- *
21
- * @since 5.5.0
22
- */
23
- public function __construct() {
24
- $this->name = 'taxonomies';
25
- $this->object_type = 'term';
26
- }
27
-
28
- /**
29
- * Returns all public, registered taxonomies.
30
- *
31
- * @since 5.5.0
32
- *
33
- * @return array Map of registered taxonomy objects keyed by their name.
34
- */
35
- public function get_object_subtypes() {
36
- $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
37
-
38
- /**
39
- * Filter the list of taxonomy object subtypes available within the sitemap.
40
- *
41
- * @since 5.5.0
42
- *
43
- * @param array $taxonomies Map of registered taxonomy objects keyed by their name.
44
- */
45
- return apply_filters( 'core_sitemaps_taxonomies', $taxonomies );
46
- }
47
-
48
- /**
49
- * Gets a URL list for a taxonomy sitemap.
50
- *
51
- * @since 5.5.0
52
- *
53
- * @param int $page_num Page of results.
54
- * @param string $taxonomy Optional. Taxonomy name. Default empty.
55
- * @return array List of URLs for a sitemap.
56
- */
57
- public function get_url_list( $page_num, $taxonomy = '' ) {
58
- // Find the query_var for subtype.
59
- if ( ! $taxonomy ) {
60
- $taxonomy = $this->get_queried_type();
61
- }
62
-
63
- // Bail early if we don't have a taxonomy.
64
- if ( empty( $taxonomy ) ) {
65
- return array();
66
- }
67
-
68
- $supported_types = $this->get_object_subtypes();
69
-
70
- // Bail early if the queried taxonomy is not a supported type.
71
- if ( ! isset( $supported_types[ $taxonomy ] ) ) {
72
- return array();
73
- }
74
-
75
- $url_list = array();
76
-
77
- // Offset by how many terms should be included in previous pages.
78
- $offset = ( $page_num - 1 ) * core_sitemaps_get_max_urls( $this->object_type );
79
-
80
- $args = array(
81
- 'fields' => 'ids',
82
- 'taxonomy' => $taxonomy,
83
- 'orderby' => 'term_order',
84
- 'number' => core_sitemaps_get_max_urls( $this->object_type ),
85
- 'offset' => $offset,
86
- 'hide_empty' => true,
87
-
88
- /*
89
- * Limits aren't included in queries when hierarchical is set to true (by default).
90
- *
91
- * @link: https://github.com/WordPress/WordPress/blob/5.3/wp-includes/class-wp-term-query.php#L558-L567
92
- */
93
- 'hierarchical' => false,
94
- 'update_term_meta_cache' => false,
95
- );
96
-
97
- $taxonomy_terms = new WP_Term_Query( $args );
98
-
99
- $taxonomy_terms = apply_filters( 'core_sitemaps_terms_list', $taxonomy_terms, $taxonomy, $page_num );
100
-
101
- if ( ! empty( $taxonomy_terms->terms ) ) {
102
- foreach ( $taxonomy_terms->terms as $term ) {
103
-
104
- $term_sitemap_attributes = array( 'loc' => get_term_link( $term )) ;
105
- $url_list[] = apply_filters( 'core_sitemaps_term_attributes', $term_sitemap_attributes, $term );
106
- /**
107
- $url_list[] = array(
108
- 'loc' => get_term_link( $term ),
109
- );
110
- **/
111
- }
112
- }
113
-
114
- /**
115
- * Filters the list of URLs for a sitemap before rendering.
116
- *
117
- * @since 5.5.0
118
- *
119
- * @param array $url_list List of URLs for a sitemap.
120
- * @param string $taxonomy Taxonomy name.
121
- * @param int $page_num Page of results.
122
- */
123
- return apply_filters( 'core_sitemaps_taxonomies_url_list', $url_list, $taxonomy, $page_num );
124
- }
125
-
126
- /**
127
- * Gets the max number of pages available for the object type.
128
- *
129
- * @since 5.5.0
130
- *
131
- * @param string $taxonomy Taxonomy name.
132
- * @return int Total number of pages.
133
- */
134
- public function max_num_pages( $taxonomy = '' ) {
135
- if ( empty( $taxonomy ) ) {
136
- $taxonomy = $this->get_queried_type();
137
- }
138
-
139
- $term_count = wp_count_terms( $taxonomy, array( 'hide_empty' => true ) );
140
-
141
- return (int) ceil( $term_count / core_sitemaps_get_max_urls( $this->object_type ) );
142
- }
143
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
psp-include/sitemap/inc/providers/class-core-sitemaps-users.php DELETED
@@ -1,111 +0,0 @@
1
- <?php
2
- /**
3
- * Sitemaps: Core_Sitemaps_Users class
4
- *
5
- * Builds the sitemaps for the 'user' object type.
6
- *
7
- * @package WordPress
8
- * @subpackage Sitemaps
9
- * @since 5.5.0
10
- */
11
-
12
- /**
13
- * Users XML sitemap provider.
14
- *
15
- * @since 5.5.0
16
- */
17
- class Core_Sitemaps_Users extends Core_Sitemaps_Provider {
18
- /**
19
- * Core_Sitemaps_Users constructor.
20
- *
21
- * @since 5.5.0
22
- */
23
- public function __construct() {
24
- $this->name = 'users';
25
- $this->object_type = 'user';
26
- }
27
-
28
- /**
29
- * Gets a URL list for a user sitemap.
30
- *
31
- * @since 5.5.0
32
- *
33
- * @param int $page_num Page of results.
34
- * @param string $object_subtype Optional. Not applicable for Users but
35
- * required for compatibility with the parent
36
- * provider class. Default empty.
37
- * @return array List of URLs for a sitemap.
38
- */
39
- public function get_url_list( $page_num, $object_subtype = '' ) {
40
- $query = $this->get_public_post_authors_query( $page_num );
41
- $users = $query->get_results();
42
- $url_list = array();
43
-
44
- foreach ( $users as $user ) {
45
- $url_list[] = array(
46
- 'loc' => get_author_posts_url( $user->ID ),
47
- );
48
- }
49
-
50
- /**
51
- * Filters the list of URLs for a sitemap before rendering.
52
- *
53
- * @since 5.5.0
54
- *
55
- * @param array $url_list List of URLs for a sitemap.
56
- * @param int $page_num Page of results.
57
- */
58
- return apply_filters( 'core_sitemaps_users_url_list', $url_list, $page_num );
59
- }
60
-
61
- /**
62
- * Gets the max number of pages available for the object type.
63
- *
64
- * @since 5.5.0
65
- *
66
- * @see Core_Sitemaps_Provider::max_num_pages
67
- *
68
- * @param string $object_subtype Optional. Not applicable for Users but
69
- * required for compatibility with the parent
70
- * provider class. Default empty.
71
- * @return int Total page count.
72
- */
73
- public function max_num_pages( $object_subtype = '' ) {
74
- $query = $this->get_public_post_authors_query();
75
-
76
- $total_users = $query->get_total();
77
-
78
- return (int) ceil( $total_users / core_sitemaps_get_max_urls( $this->object_type ) );
79
- }
80
-
81
- /**
82
- * Returns a query for authors with public posts.
83
- *
84
- * Implementation must support `$query->max_num_pages`.
85
- *
86
- * @since 5.5.0
87
- *
88
- * @param integer $page_num Optional. Default is 1. Page of query results to return.
89
- * @return WP_User_Query
90
- */
91
- public function get_public_post_authors_query( $page_num = 1 ) {
92
- $public_post_types = get_post_types(
93
- array(
94
- 'public' => true,
95
- )
96
- );
97
-
98
- // We're not supporting sitemaps for author pages for attachments.
99
- unset( $public_post_types['attachment'] );
100
-
101
- $query = new WP_User_Query(
102
- array(
103
- 'has_published_posts' => array_keys( $public_post_types ),
104
- 'number' => core_sitemaps_get_max_urls( $this->object_type ),
105
- 'paged' => absint( $page_num ),
106
- )
107
- );
108
-
109
- return $query;
110
- }
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
psp-include/sitemap/inc/providers/class-wp-sitemaps-posts.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitemaps: WP_Sitemaps_Posts class
4
+ *
5
+ * Builds the sitemaps for the 'post' object type.
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Sitemaps
9
+ * @since 5.5.0
10
+ */
11
+
12
+ /**
13
+ * Posts XML sitemap provider.
14
+ *
15
+ * @since 5.5.0
16
+ */
17
+ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
18
+ /**
19
+ * WP_Sitemaps_Posts constructor.
20
+ *
21
+ * @since 5.5.0
22
+ */
23
+ public function __construct() {
24
+ $this->name = 'posts';
25
+ $this->object_type = 'post';
26
+ }
27
+
28
+ /**
29
+ * Returns the public post types, which excludes nav_items and similar types.
30
+ * Attachments are also excluded. This includes custom post types with public = true.
31
+ *
32
+ * @since 5.5.0
33
+ *
34
+ * @return array Map of registered post type objects (WP_Post_Type) keyed by their name.
35
+ */
36
+ public function get_object_subtypes() {
37
+ $post_types = get_post_types( array( 'public' => true ), 'objects' );
38
+ unset( $post_types['attachment'] );
39
+
40
+ /**
41
+ * Filters the list of post object sub types available within the sitemap.
42
+ *
43
+ * @since 5.5.0
44
+ *
45
+ * @param array $post_types Map of registered post type objects (WP_Post_Type) keyed by their name.
46
+ */
47
+ return apply_filters( 'wp_sitemaps_post_types', $post_types );
48
+ }
49
+
50
+ /**
51
+ * Gets a URL list for a post type sitemap.
52
+ *
53
+ * @since 5.5.0
54
+ *
55
+ * @param int $page_num Page of results.
56
+ * @param string $post_type Optional. Post type name. Default empty.
57
+ * @return array $url_list Array of URLs for a sitemap.
58
+ */
59
+ public function get_url_list( $page_num, $post_type = '' ) {
60
+ // Bail early if the queried post type is not supported.
61
+ $supported_types = $this->get_object_subtypes();
62
+
63
+ if ( ! isset( $supported_types[ $post_type ] ) ) {
64
+ return array();
65
+ }
66
+
67
+ /**
68
+ * Filters the posts URL list before it is generated.
69
+ *
70
+ * Passing a non-null value will effectively short-circuit the generation,
71
+ * returning that value instead.
72
+ *
73
+ * @since 5.5.0
74
+ *
75
+ * @param array $url_list The URL list. Default null.
76
+ * @param string $post_type Post type name.
77
+ * @param int $page_num Page of results.
78
+ */
79
+ $url_list = apply_filters(
80
+ 'wp_sitemaps_posts_pre_url_list',
81
+ null,
82
+ $post_type,
83
+ $page_num
84
+ );
85
+
86
+ if ( null !== $url_list ) {
87
+ return $url_list;
88
+ }
89
+
90
+ $args = $this->get_posts_query_args( $post_type );
91
+ $args['paged'] = $page_num;
92
+
93
+ $query = new WP_Query( $args );
94
+
95
+ /**
96
+ * Returns an array of posts.
97
+ *
98
+ * @var array<int, \WP_Post> $posts
99
+ */
100
+ $posts = $query->get_posts();
101
+
102
+ $url_list = array();
103
+
104
+ /*
105
+ * Add a URL for the homepage in the pages sitemap.
106
+ * Shows only on the first page if the reading settings are set to display latest posts.
107
+ */
108
+ if ( 'page' === $post_type && 1 === $page_num && 'posts' === get_option( 'show_on_front' ) ) {
109
+ // Extract the data needed for home URL to add to the array.
110
+ $url_list[] = array(
111
+ 'loc' => home_url(),
112
+ );
113
+ }
114
+
115
+ foreach ( $posts as $post ) {
116
+ $sitemap_entry = array(
117
+ 'loc' => get_permalink( $post ),
118
+ );
119
+
120
+ /**
121
+ * Filters the sitemap entry for an individual post.
122
+ *
123
+ * @since 5.5.0
124
+ *
125
+ * @param array $sitemap_entry Sitemap entry for the post.
126
+ * @param WP_Post $post Post object.
127
+ * @param string $post_type Name of the post_type.
128
+ */
129
+ $sitemap_entry = apply_filters( 'wp_sitemaps_posts_entry', $sitemap_entry, $post, $post_type );
130
+ $url_list[] = $sitemap_entry;
131
+ }
132
+
133
+ return $url_list;
134
+ }
135
+
136
+ /**
137
+ * Gets the max number of pages available for the object type.
138
+ *
139
+ * @since 5.5.0
140
+ *
141
+ * @param string $post_type Optional. Post type name. Default empty.
142
+ * @return int Total number of pages.
143
+ */
144
+ public function get_max_num_pages( $post_type = '' ) {
145
+ if ( empty( $post_type ) ) {
146
+ return 0;
147
+ }
148
+
149
+ /**
150
+ * Filters the max number of pages before it is generated.
151
+ *
152
+ * Passing a non-null value will effectively short-circuit the generation,
153
+ * returning that value instead.
154
+ *
155
+ * @since 5.5.0
156
+ *
157
+ * @param int $max_num_pages The maximum number of pages. Default null.
158
+ * @param string $post_type Post type name.
159
+ */
160
+ $max_num_pages = apply_filters( 'wp_sitemaps_posts_pre_max_num_pages', null, $post_type );
161
+
162
+ if ( null !== $max_num_pages ) {
163
+ return $max_num_pages;
164
+ }
165
+
166
+ $args = $this->get_posts_query_args( $post_type );
167
+ $args['fields'] = 'ids';
168
+ $args['no_found_rows'] = false;
169
+
170
+ $query = new WP_Query( $args );
171
+
172
+ return isset( $query->max_num_pages ) ? $query->max_num_pages : 1;
173
+ }
174
+
175
+ /**
176
+ * Returns the query args for retrieving posts to list in the sitemap.
177
+ *
178
+ * @since 5.5.0
179
+ *
180
+ * @param string $post_type Post type name.
181
+ * @return array $args Array of WP_Query arguments.
182
+ */
183
+ protected function get_posts_query_args( $post_type ) {
184
+ /**
185
+ * Filters the query arguments for post type sitemap queries.
186
+ *
187
+ * @see WP_Query for a full list of arguments.
188
+ *
189
+ * @since 5.5.0
190
+ *
191
+ * @param array $args Array of WP_Query arguments.
192
+ * @param string $post_type Post type name.
193
+ */
194
+ $args = apply_filters(
195
+ 'wp_sitemaps_posts_query_args',
196
+ array(
197
+ 'orderby' => 'ID',
198
+ 'order' => 'ASC',
199
+ 'post_type' => $post_type,
200
+ 'posts_per_page' => wp_sitemaps_get_max_urls( $this->object_type ),
201
+ 'post_status' => array( 'publish' ),
202
+ 'no_found_rows' => true,
203
+ 'update_post_term_cache' => false,
204
+ 'update_post_meta_cache' => false,
205
+ ),
206
+ $post_type
207
+ );
208
+
209
+ return $args;
210
+ }
211
+ }
psp-include/sitemap/inc/providers/class-wp-sitemaps-taxonomies.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitemaps: WP_Sitemaps_Taxonomies class
4
+ *
5
+ * Builds the sitemaps for the 'taxonomy' object type.
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Sitemaps
9
+ * @since 5.5.0
10
+ */
11
+
12
+ /**
13
+ * Taxonomies XML sitemap provider.
14
+ *
15
+ * @since 5.5.0
16
+ */
17
+ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
18
+ /**
19
+ * WP_Sitemaps_Taxonomies constructor.
20
+ *
21
+ * @since 5.5.0
22
+ */
23
+ public function __construct() {
24
+ $this->name = 'taxonomies';
25
+ $this->object_type = 'term';
26
+ }
27
+
28
+ /**
29
+ * Returns all public, registered taxonomies.
30
+ *
31
+ * @since 5.5.0
32
+ *
33
+ * @return array Map of registered taxonomy objects keyed by their name.
34
+ */
35
+ public function get_object_subtypes() {
36
+ $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
37
+
38
+ /**
39
+ * Filter the list of taxonomy object subtypes available within the sitemap.
40
+ *
41
+ * @since 5.5.0
42
+ *
43
+ * @param array $taxonomies Map of registered taxonomy objects keyed by their name.
44
+ */
45
+ return apply_filters( 'wp_sitemaps_taxonomies', $taxonomies );
46
+ }
47
+
48
+ /**
49
+ * Gets a URL list for a taxonomy sitemap.
50
+ *
51
+ * @since 5.5.0
52
+ *
53
+ * @param int $page_num Page of results.
54
+ * @param string $taxonomy Optional. Taxonomy name. Default empty.
55
+ * @return array $url_list Array of URLs for a sitemap.
56
+ */
57
+ public function get_url_list( $page_num, $taxonomy = '' ) {
58
+ $supported_types = $this->get_object_subtypes();
59
+
60
+ // Bail early if the queried taxonomy is not supported.
61
+ if ( ! isset( $supported_types[ $taxonomy ] ) ) {
62
+ return array();
63
+ }
64
+
65
+ /**
66
+ * Filters the taxonomies URL list before it is generated.
67
+ *
68
+ * Passing a non-null value will effectively short-circuit the generation,
69
+ * returning that value instead.
70
+ *
71
+ * @since 5.5.0
72
+ *
73
+ * @param array $url_list The URL list. Default null.
74
+ * @param string $taxonomy Taxonomy name.
75
+ * @param int $page_num Page of results.
76
+ */
77
+ $url_list = apply_filters(
78
+ 'wp_sitemaps_taxonomies_pre_url_list',
79
+ null,
80
+ $taxonomy,
81
+ $page_num
82
+ );
83
+
84
+ if ( null !== $url_list ) {
85
+ return $url_list;
86
+ }
87
+
88
+ $url_list = array();
89
+
90
+ // Offset by how many terms should be included in previous pages.
91
+ $offset = ( $page_num - 1 ) * wp_sitemaps_get_max_urls( $this->object_type );
92
+
93
+ $args = $this->get_taxonomies_query_args( $taxonomy );
94
+ $args['offset'] = $offset;
95
+
96
+ $taxonomy_terms = new WP_Term_Query( $args );
97
+
98
+ if ( ! empty( $taxonomy_terms->terms ) ) {
99
+ foreach ( $taxonomy_terms->terms as $term ) {
100
+ $sitemap_entry = array(
101
+ 'loc' => get_term_link( $term ),
102
+ );
103
+
104
+ /**
105
+ * Filters the sitemap entry for an individual term.
106
+ *
107
+ * @since 5.5.0
108
+ *
109
+ * @param array $sitemap_entry Sitemap entry for the term.
110
+ * @param WP_Term $term Term object.
111
+ * @param string $taxonomy Taxonomy name.
112
+ */
113
+ $sitemap_entry = apply_filters( 'wp_sitemaps_taxonomies_entry', $sitemap_entry, $term, $taxonomy );
114
+ $url_list[] = $sitemap_entry;
115
+ }
116
+ }
117
+
118
+ return $url_list;
119
+ }
120
+
121
+ /**
122
+ * Gets the max number of pages available for the object type.
123
+ *
124
+ * @since 5.5.0
125
+ *
126
+ * @param string $taxonomy Taxonomy name.
127
+ * @return int Total number of pages.
128
+ */
129
+ public function get_max_num_pages( $taxonomy = '' ) {
130
+ if ( empty( $taxonomy ) ) {
131
+ return 0;
132
+ }
133
+
134
+ /**
135
+ * Filters the max number of pages before it is generated.
136
+ *
137
+ * Passing a non-null value will effectively short-circuit the generation,
138
+ * returning that value instead.
139
+ *
140
+ * @since 5.5.0
141
+ *
142
+ * @param int $max_num_pages The maximum number of pages. Default null.
143
+ * @param string $taxonomy Taxonomy name.
144
+ */
145
+ $max_num_pages = apply_filters( 'wp_sitemaps_taxonomies_pre_max_num_pages', null, $taxonomy );
146
+
147
+ if ( null !== $max_num_pages ) {
148
+ return $max_num_pages;
149
+ }
150
+
151
+ $term_count = wp_count_terms( $taxonomy, $this->get_taxonomies_query_args( $taxonomy ) );
152
+
153
+ return (int) ceil( $term_count / wp_sitemaps_get_max_urls( $this->object_type ) );
154
+ }
155
+
156
+ /**
157
+ * Returns the query args for retrieving taxonomy terms to list in the sitemap.
158
+ *
159
+ * @since 5.5.0
160
+ *
161
+ * @param string $taxonomy Taxonomy name.
162
+ * @return array $args Array of WP_Term_Query arguments.
163
+ */
164
+ protected function get_taxonomies_query_args( $taxonomy ) {
165
+ /**
166
+ * Filters the taxonomy terms query arguments.
167
+ *
168
+ * Allows modification of the taxonomy query arguments before querying.
169
+ *
170
+ * @see WP_Term_Query for a full list of arguments
171
+ *
172
+ * @since 5.5.0
173
+ *
174
+ * @param array $args Array of WP_Term_Query arguments.
175
+ * @param string $taxonomy Taxonomy name.
176
+ */
177
+ $args = apply_filters(
178
+ 'wp_sitemaps_taxonomies_query_args',
179
+ array(
180
+ 'fields' => 'ids',
181
+ 'taxonomy' => $taxonomy,
182
+ 'orderby' => 'term_order',
183
+ 'number' => wp_sitemaps_get_max_urls( $this->object_type ),
184
+ 'hide_empty' => true,
185
+ 'hierarchical' => false,
186
+ 'update_term_meta_cache' => false,
187
+ ),
188
+ $taxonomy
189
+ );
190
+
191
+ return $args;
192
+ }
193
+ }
psp-include/sitemap/inc/providers/class-wp-sitemaps-users.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitemaps: WP_Sitemaps_Users class
4
+ *
5
+ * Builds the sitemaps for the 'user' object type.
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Sitemaps
9
+ * @since 5.5.0
10
+ */
11
+
12
+ /**
13
+ * Users XML sitemap provider.
14
+ *
15
+ * @since 5.5.0
16
+ */
17
+ class WP_Sitemaps_Users extends WP_Sitemaps_Provider {
18
+ /**
19
+ * WP_Sitemaps_Users constructor.
20
+ *
21
+ * @since 5.5.0
22
+ */
23
+ public function __construct() {
24
+ $this->name = 'users';
25
+ $this->object_type = 'user';
26
+ }
27
+
28
+ /**
29
+ * Gets a URL list for a user sitemap.
30
+ *
31
+ * @since 5.5.0
32
+ *
33
+ * @param int $page_num Page of results.
34
+ * @param string $object_subtype Optional. Not applicable for Users but
35
+ * required for compatibility with the parent
36
+ * provider class. Default empty.
37
+ * @return array $url_list Array of URLs for a sitemap.
38
+ */
39
+ public function get_url_list( $page_num, $object_subtype = '' ) {
40
+ /**
41
+ * Filters the users URL list before it is generated.
42
+ *
43
+ * Passing a non-null value will effectively short-circuit the generation,
44
+ * returning that value instead.
45
+ *
46
+ * @since 5.5.0
47
+ *
48
+ * @param array $url_list The URL list. Default null.
49
+ * @param int $page_num Page of results.
50
+ */
51
+ $url_list = apply_filters(
52
+ 'wp_sitemaps_users_pre_url_list',
53
+ null,
54
+ $page_num
55
+ );
56
+
57
+ if ( null !== $url_list ) {
58
+ return $url_list;
59
+ }
60
+
61
+ $args = $this->get_users_query_args();
62
+ $args['paged'] = $page_num;
63
+
64
+ $query = new WP_User_Query( $args );
65
+ $users = $query->get_results();
66
+ $url_list = array();
67
+
68
+ foreach ( $users as $user ) {
69
+ $sitemap_entry = array(
70
+ 'loc' => get_author_posts_url( $user->ID ),
71
+ );
72
+
73
+ /**
74
+ * Filters the sitemap entry for an individual user.
75
+ *
76
+ * @since 5.5.0
77
+ *
78
+ * @param array $sitemap_entry Sitemap entry for the user.
79
+ * @param WP_User $user User object.
80
+ */
81
+ $sitemap_entry = apply_filters( 'wp_sitemaps_users_entry', $sitemap_entry, $user );
82
+ $url_list[] = $sitemap_entry;
83
+ }
84
+
85
+ return $url_list;
86
+ }
87
+
88
+ /**
89
+ * Gets the max number of pages available for the object type.
90
+ *
91
+ * @since 5.5.0
92
+ *
93
+ * @see WP_Sitemaps_Provider::max_num_pages
94
+ *
95
+ * @param string $object_subtype Optional. Not applicable for Users but
96
+ * required for compatibility with the parent
97
+ * provider class. Default empty.
98
+ * @return int Total page count.
99
+ */
100
+ public function get_max_num_pages( $object_subtype = '' ) {
101
+ /**
102
+ * Filters the max number of pages before it is generated.
103
+ *
104
+ * Passing a non-null value will effectively short-circuit the generation,
105
+ * returning that value instead.
106
+ *
107
+ * @since 5.5.0
108
+ *
109
+ * @param int $max_num_pages The maximum number of pages. Default null.
110
+ */
111
+ $max_num_pages = apply_filters( 'wp_sitemaps_users_pre_max_num_pages', null );
112
+
113
+ if ( null !== $max_num_pages ) {
114
+ return $max_num_pages;
115
+ }
116
+
117
+ $args = $this->get_users_query_args();
118
+ $query = new WP_User_Query( $args );
119
+
120
+ $total_users = $query->get_total();
121
+
122
+ return (int) ceil( $total_users / wp_sitemaps_get_max_urls( $this->object_type ) );
123
+ }
124
+
125
+ /**
126
+ * Returns the query args for retrieving users to list in the sitemap.
127
+ *
128
+ * @since 5.5.0
129
+ *
130
+ * @return array $args Array of WP_User_Query arguments.
131
+ */
132
+ protected function get_users_query_args() {
133
+ $public_post_types = get_post_types(
134
+ array(
135
+ 'public' => true,
136
+ )
137
+ );
138
+
139
+ // We're not supporting sitemaps for author pages for attachments.
140
+ unset( $public_post_types['attachment'] );
141
+
142
+ /**
143
+ * Filters the query arguments for authors with public posts.
144
+ *
145
+ * Allows modification of the authors query arguments before querying.
146
+ *
147
+ * @see WP_User_Query for a full list of arguments
148
+ *
149
+ * @since 5.5.0
150
+ *
151
+ * @param array $args Array of WP_User_Query arguments.
152
+ */
153
+ $args = apply_filters(
154
+ 'wp_sitemaps_users_query_args',
155
+ array(
156
+ 'has_published_posts' => array_keys( $public_post_types ),
157
+ 'number' => wp_sitemaps_get_max_urls( $this->object_type ),
158
+ )
159
+ );
160
+
161
+ return $args;
162
+ }
163
+ }
psp-include/sitemap/psp_sitemap.php CHANGED
@@ -33,42 +33,42 @@ class PspSitemap {
33
  $psp_helper_instance = PspHelper::get_instance();
34
  $this->psp_helper = $psp_helper_instance;
35
 
36
- // Limit the number of URLs included in a sitemap.
37
- if ( ! defined( 'CORE_SITEMAPS_MAX_SITEMAPS' ) ) {
38
- define( 'CORE_SITEMAPS_MAX_SITEMAPS', 50000 );
39
  }
40
 
41
- // Limit the number of URLs included in a sitemap.
42
- if ( ! defined( 'CORE_SITEMAPS_REWRITE_VERSION' ) ) {
43
- define( 'CORE_SITEMAPS_REWRITE_VERSION', '2020-04-29' );
44
  }
45
 
46
  // Limit the number of URLs included in a sitemap.
47
- if ( ! defined( 'CORE_SITEMAPS_MAX_URLS' ) ) {
48
- define( 'CORE_SITEMAPS_MAX_URLS', 2000 );
49
  }
50
 
51
  $psp_sm_settings = get_option('psp_sitemap');
52
  $this->psp_sitemap_settings = $psp_sm_settings;
53
 
54
- $psp_core_sitemaps_enabled = isset($psp_sm_settings['enable']) ? $psp_sm_settings['enable'] : '';
55
 
56
- require_once __DIR__ . '/inc/class-core-sitemaps.php';
57
- require_once __DIR__ . '/inc/class-core-sitemaps-provider.php';
58
- require_once __DIR__ . '/inc/class-core-sitemaps-index.php';
59
- require_once __DIR__ . '/inc/class-core-sitemaps-registry.php';
60
- require_once __DIR__ . '/inc/class-core-sitemaps-renderer.php';
61
- require_once __DIR__ . '/inc/class-core-sitemaps-stylesheet.php';
62
- require_once __DIR__ . '/inc/providers/class-core-sitemaps-posts.php';
63
- require_once __DIR__ . '/inc/providers/class-core-sitemaps-taxonomies.php';
64
- require_once __DIR__ . '/inc/providers/class-core-sitemaps-users.php';
65
  require_once __DIR__ . '/inc/functions.php';
66
 
67
- if (!$psp_core_sitemaps_enabled) return;
68
 
69
 
70
- add_filter('core_sitemaps_stylesheet_index_url', array($this, 'psp_get_sitemaps_stylesheet_index_url'), 10, 1);
71
- add_filter('core_sitemaps_stylesheet_url', array($this, 'psp_get_sitemaps_stylesheet_url'), 10, 1);
72
 
73
 
74
  $excluded_post_ids = array();
@@ -86,33 +86,36 @@ class PspSitemap {
86
 
87
  //psp sitemap disabled
88
  //add_filter( 'pre_handle_404', array( $this, 'psp_redirect_sitemapxml' ), 9, 2 );
89
- add_filter( 'core_sitemaps_register_providers', array( $this, 'psp_sitemap_providers' ), 10, 1 );
90
- add_filter( 'core_sitemaps_max_urls', array( $this, 'psp_sitemap_max_urls' ), 10, 2 );
 
 
 
 
91
 
92
- add_filter('core_sitemaps_is_enabled', array($this, 'psp_enable_core_sitemaps'), 10, 1);
93
- add_filter('core_sitemaps_taxonomies', array($this, 'psp_taxonomies_for_sitemap'), 10, 1);
94
- add_filter('core_sitemaps_post_types', array($this, 'psp_post_types_for_sitemap'), 10, 1);
95
 
96
- add_filter('core_sitemaps_posts_list', array($this, 'psp_posts_for_sitemap'), 10, 3);
97
- add_filter('core_sitemaps_terms_list', array($this, 'psp_terms_for_sitemap'), 10, 3);
98
 
99
- add_filter('core_sitemaps_post_attributes', array($this, 'psp_post_attr_for_sitemap'), 10, 2);
100
 
101
- add_filter('core_sitemaps_term_attributes', array($this, 'psp_term_attr_for_sitemap'), 10, 2);
102
 
103
- add_filter('core_sitemaps_get_sitemap_xml', array($this, 'psp_get_sitemap_xml'), 10, 2);
104
 
105
  // Boot the sitemaps system.
106
- add_action( 'init', 'core_sitemaps_get_server' );
107
 
108
  }
109
 
110
- public function psp_enable_core_sitemaps($enabled) {
111
 
112
  $psp_sm_settings = $this->psp_sitemap_settings;
113
- $psp_core_sitemaps_enabled = isset($psp_sm_settings['enable']) ? $psp_sm_settings['enable'] : '';
114
 
115
- if ( $psp_core_sitemaps_enabled ) {
116
  return 'enabled';
117
  } else {
118
  return false;
@@ -129,14 +132,14 @@ class PspSitemap {
129
  return $providers;
130
  } else {
131
  return array(
132
- 'posts' => new Core_Sitemaps_Posts(),
133
- 'taxonomies' => new Core_Sitemaps_Taxonomies(),
134
  );
135
  }
136
 
137
  }
138
 
139
- public function psp_sitemap_max_urls($core_sitemap_max_urls, $object_type) {
140
 
141
  $psp_sm_settings = $this->psp_sitemap_settings;
142
  $psp_sitemaps_max_urls = isset($psp_sm_settings['max_urls']) ? $psp_sm_settings['max_urls'] : '';
@@ -144,7 +147,7 @@ class PspSitemap {
144
  if ( $psp_sitemaps_max_urls ) {
145
  return (int) $psp_sitemaps_max_urls;
146
  } else {
147
- return (int) $core_sitemap_max_urls;
148
  }
149
 
150
  }
@@ -191,51 +194,125 @@ class PspSitemap {
191
 
192
  }
193
 
194
- public function psp_posts_for_sitemap($posts, $post_type, $page_num) {
195
-
196
- $psp_posts = array();
197
 
 
198
  $psp_excluded_post_ids = $this->psp_excluded_post_ids;
 
199
 
200
- if ($psp_excluded_post_ids) {
201
 
202
- foreach ( $posts as $post ) {
203
- if ( !in_array($post, $psp_excluded_post_ids) ) {
204
- $psp_posts[] = $post;
205
- }
206
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
- return $psp_posts;
 
 
 
 
 
 
209
 
210
  }
211
-
212
- return $posts;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
  }
215
 
216
- public function psp_terms_for_sitemap($terms, $taxonomy, $page_num) {
217
-
218
- $psp_terms = array();
219
 
220
  $psp_excluded_term_ids = $this->psp_excluded_term_ids;
221
 
222
- if ($psp_excluded_term_ids) {
223
-
224
- foreach ( $terms->terms as $term ) {
225
- if ( !in_array($term, $psp_excluded_term_ids) ) {
226
- $psp_terms[] = $term;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  }
228
  }
229
- $terms->terms = $psp_terms;
230
- return $terms;
 
 
 
 
231
 
232
  }
233
-
234
- return $terms;
235
 
236
  }
237
 
238
- public function psp_post_attr_for_sitemap($post_sm_attributes = array(), $post) {
239
 
240
  $psp_sm_settings = $this->psp_sitemap_settings;
241
 
@@ -260,12 +337,10 @@ class PspSitemap {
260
 
261
  }
262
 
263
- public function psp_term_attr_for_sitemap($term_sm_attributes = array(), $term) {
264
 
265
- //$post_sm_attributes['lastmod'] = $this->psp_get_last_modified_time( $post )->format('Y-m-d h:m:s');
266
-
267
- return $term_sm_attributes;
268
-
269
 
270
  }
271
 
@@ -328,6 +403,21 @@ class PspSitemap {
328
 
329
  }
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  public function psp_get_sitemaps_stylesheet_url( $sitemap_url = '' ) {
332
  //error_log (plugins_url( '/sitemap.xsl', __FILE__ ));
333
  //return $sitemaps_stylesheet_url;
@@ -362,7 +452,7 @@ class PspSitemap {
362
  * @param array $url_list A list of URLs for a sitemap.
363
  * @return string|false A well-formed XML string for a sitemap index. False on error.
364
  */
365
- public function psp_get_sitemap_xml( $url_list, $object_subtype ) {
366
 
367
  $psp_sm_settings = $this->psp_sitemap_settings;
368
 
@@ -370,7 +460,7 @@ class PspSitemap {
370
 
371
  $psp_image_sitemaps_enabled = isset($psp_sm_settings['include_images']) ? $psp_sm_settings['include_images'] : '';
372
 
373
- if ($object_subtype === 'post') {
374
 
375
  $psp_stylesheet_url = plugins_url( '/sitemap.xsl', __FILE__ );
376
  $this->stylesheet = '<?xml-stylesheet type="text/xsl" href="' . esc_url( $psp_stylesheet_url ) . '" ?>';
33
  $psp_helper_instance = PspHelper::get_instance();
34
  $this->psp_helper = $psp_helper_instance;
35
 
36
+ // The limit for how many sitemaps to include in an index.
37
+ if ( ! defined( 'WP_SITEMAPS_MAX_SITEMAPS' ) ) {
38
+ define( 'WP_SITEMAPS_MAX_SITEMAPS', 50000 );
39
  }
40
 
41
+ // WP Sitemaps rewrite version
42
+ if ( ! defined( 'WP_SITEMAPS_REWRITE_VERSION' ) ) {
43
+ define( 'WP_SITEMAPS_REWRITE_VERSION', '2020-04-29' );
44
  }
45
 
46
  // Limit the number of URLs included in a sitemap.
47
+ if ( ! defined( 'WP_SITEMAPS_MAX_URLS' ) ) {
48
+ define( 'WP_SITEMAPS_MAX_URLS', 2000 );
49
  }
50
 
51
  $psp_sm_settings = get_option('psp_sitemap');
52
  $this->psp_sitemap_settings = $psp_sm_settings;
53
 
54
+ $psp_wp_sitemaps_enabled = isset($psp_sm_settings['enable']) ? $psp_sm_settings['enable'] : '';
55
 
56
+ require_once __DIR__ . '/inc/class-wp-sitemaps.php';
57
+ require_once __DIR__ . '/inc/class-wp-sitemaps-provider.php';
58
+ require_once __DIR__ . '/inc/class-wp-sitemaps-index.php';
59
+ require_once __DIR__ . '/inc/class-wp-sitemaps-registry.php';
60
+ require_once __DIR__ . '/inc/class-wp-sitemaps-renderer.php';
61
+ require_once __DIR__ . '/inc/class-wp-sitemaps-stylesheet.php';
62
+ require_once __DIR__ . '/inc/providers/class-wp-sitemaps-posts.php';
63
+ require_once __DIR__ . '/inc/providers/class-wp-sitemaps-taxonomies.php';
64
+ require_once __DIR__ . '/inc/providers/class-wp-sitemaps-users.php';
65
  require_once __DIR__ . '/inc/functions.php';
66
 
67
+ if (!$psp_wp_sitemaps_enabled) return;
68
 
69
 
70
+ add_filter('wp_sitemaps_stylesheet_index_url', array($this, 'psp_get_sitemaps_stylesheet_index_url'), 10, 1);
71
+ add_filter('wp_sitemaps_stylesheet_url', array($this, 'psp_get_sitemaps_stylesheet_url'), 10, 1);
72
 
73
 
74
  $excluded_post_ids = array();
86
 
87
  //psp sitemap disabled
88
  //add_filter( 'pre_handle_404', array( $this, 'psp_redirect_sitemapxml' ), 9, 2 );
89
+ add_filter( 'wp_sitemaps_register_providers', array( $this, 'psp_sitemap_providers' ), 10, 1 );
90
+ add_filter( 'wp_sitemaps_max_urls', array( $this, 'psp_sitemap_max_urls' ), 10, 2 );
91
+
92
+ add_filter('wp_sitemaps_is_enabled', array($this, 'psp_enable_wp_sitemaps'), 10, 1);
93
+ add_filter('wp_sitemaps_taxonomies', array($this, 'psp_taxonomies_for_sitemap'), 10, 1);
94
+ add_filter('wp_sitemaps_post_types', array($this, 'psp_post_types_for_sitemap'), 10, 1);
95
 
96
+ //add_filter('core_sitemaps_posts_list', array($this, 'psp_posts_for_sitemap'), 10, 3);
97
+ //add_filter('core_sitemaps_terms_list', array($this, 'psp_terms_for_sitemap'), 10, 3);
 
98
 
99
+ add_filter('wp_sitemaps_posts_query_args', array($this, 'psp_posts_args_for_sitemap'), 10, 2);
100
+ add_filter('wp_sitemaps_taxonomies_query_args', array($this, 'psp_terms_args_for_sitemap'), 10, 2);
101
 
102
+ add_filter('wp_sitemaps_posts_entry', array($this, 'psp_post_entry_for_sitemap'), 10, 3);
103
 
104
+ add_filter('wp_sitemaps_taxonomies_entry', array($this, 'psp_term_entry_for_sitemap'), 10, 3);
105
 
106
+ add_filter('wp_sitemaps_get_sitemap_xml', array($this, 'psp_get_sitemap_xml'), 10, 3);
107
 
108
  // Boot the sitemaps system.
109
+ add_action( 'init', 'wp_sitemaps_get_server' );
110
 
111
  }
112
 
113
+ public function psp_enable_wp_sitemaps($enabled) {
114
 
115
  $psp_sm_settings = $this->psp_sitemap_settings;
116
+ $psp_wp_sitemaps_enabled = isset($psp_sm_settings['enable']) ? $psp_sm_settings['enable'] : '';
117
 
118
+ if ( $psp_wp_sitemaps_enabled ) {
119
  return 'enabled';
120
  } else {
121
  return false;
132
  return $providers;
133
  } else {
134
  return array(
135
+ 'posts' => new WP_Sitemaps_Posts(),
136
+ 'taxonomies' => new WP_Sitemaps_Taxonomies(),
137
  );
138
  }
139
 
140
  }
141
 
142
+ public function psp_sitemap_max_urls($wp_sitemap_max_urls, $object_type) {
143
 
144
  $psp_sm_settings = $this->psp_sitemap_settings;
145
  $psp_sitemaps_max_urls = isset($psp_sm_settings['max_urls']) ? $psp_sm_settings['max_urls'] : '';
147
  if ( $psp_sitemaps_max_urls ) {
148
  return (int) $psp_sitemaps_max_urls;
149
  } else {
150
+ return (int) $wp_sitemap_max_urls;
151
  }
152
 
153
  }
194
 
195
  }
196
 
197
+ public function psp_posts_args_for_sitemap($posts_args, $post_type) {
 
 
198
 
199
+ $psp_excluded_post_ids = array();
200
  $psp_excluded_post_ids = $this->psp_excluded_post_ids;
201
+ $psp_noindex_post_ids = array();
202
 
203
+ $psp_sm_settings = $this->psp_sitemap_settings;
204
 
205
+ $psp_posts_args = array(
206
+ 'fields' => 'ids',
207
+ 'orderby' => 'ID',
208
+ //'order' => 'DESC',
209
+ 'order' => empty($psp_sm_settings['sort_order']) ? 'DESC' : 'ASC' ,
210
+ 'post_type' => $post_type,
211
+ 'post_status' => array( 'publish' ),
212
+ 'no_found_rows' => true,
213
+ 'update_post_term_cache' => false,
214
+ 'update_post_meta_cache' => false,
215
+ );
216
+
217
+ $psp_posts_args['posts_per_page'] = !empty($posts_args['posts_per_page']) ? $posts_args['posts_per_page'] : wp_sitemaps_get_max_urls( 'post' );
218
+
219
+
220
+ //Exclude NoIndex Posts
221
+ $psp_noindex_post_ids = $this->psp_get_noindex_posts();
222
+ if ( !empty($psp_excluded_post_ids) ) {
223
 
224
+ $psp_excluded_post_ids = array_unique (array_merge ($psp_excluded_post_ids, $psp_noindex_post_ids));
225
+
226
+ }
227
+
228
+ if ($psp_excluded_post_ids) {
229
+
230
+ $psp_posts_args['post__not_in'] = $psp_excluded_post_ids;
231
 
232
  }
233
+
234
+ /***
235
+ $psp_posts_args['meta_query'] => array(
236
+ 'relation' => 'OR',
237
+ array(
238
+ 'key' => '_techblissonline_psp_noindex',
239
+ 'compare' => 'NOT EXISTS'
240
+ ),
241
+ array(
242
+ 'key' => '_techblissonline_psp_noindex',
243
+ 'compare' => '!=',
244
+ 'value' => 'on'
245
+ ),
246
+ ),
247
+ ***/
248
+ return $psp_posts_args;
249
 
250
  }
251
 
252
+ public function psp_terms_args_for_sitemap($terms_args, $taxonomy) {
 
 
253
 
254
  $psp_excluded_term_ids = $this->psp_excluded_term_ids;
255
 
256
+ $psp_terms_args = array(
257
+ 'fields' => 'ids',
258
+ 'taxonomy' => $taxonomy,
259
+ 'orderby' => 'term_order',
260
+ //'number' => wp_sitemaps_get_max_urls( $this->object_type ),
261
+ 'hide_empty' => true,
262
+ 'hierarchical' => false,
263
+ 'update_term_meta_cache' => false,
264
+ );
265
+
266
+ $psp_terms_args['number'] = !empty($terms_args['number']) ? $terms_args['number'] : wp_sitemaps_get_max_urls( 'taxonomy' );
267
+
268
+ //Exclude noindex terms
269
+
270
+ $terms = get_terms( array(
271
+ 'taxonomy' => $taxonomy,
272
+ 'hide_empty' => false,
273
+ ) );
274
+
275
+ //$noindex_term_ids = array();
276
+
277
+ foreach ( $terms as $term ) {
278
+
279
+ $term_id = $term->term_id;
280
+
281
+ if ( "category" === $term->taxonomy ) {
282
+
283
+ $taxname = "category";
284
+
285
+ } else {
286
+
287
+ $taxname = "taxonomy";
288
+
289
+ }
290
+
291
+ $psp_tax_seo_metas = "psp_".$taxname."_seo_metas_".$term_id;
292
+ $term_meta = get_term_meta($term_id, $psp_tax_seo_metas);
293
+
294
+ if ($term_meta) $term_meta = $term_meta[0];
295
+ if (!$term_meta) $term_meta = get_option( $psp_tax_seo_metas );
296
+ if ( !empty($term_meta['noindex']) ) {
297
+ if ( empty($psp_excluded_term_ids) || !in_array( $term_id, $psp_excluded_term_ids ) ) {
298
+ //$noindex_term_ids[] = $term_id;
299
+ $psp_excluded_term_ids[] = $term_id;
300
  }
301
  }
302
+
303
+ }
304
+
305
+ if ($psp_excluded_term_ids) {
306
+
307
+ $psp_terms_args['exclude'] = $psp_excluded_term_ids;
308
 
309
  }
310
+
311
+ return $psp_terms_args;
312
 
313
  }
314
 
315
+ public function psp_post_entry_for_sitemap($post_sm_attributes = array(), $post, $post_type) {
316
 
317
  $psp_sm_settings = $this->psp_sitemap_settings;
318
 
337
 
338
  }
339
 
340
+ public function psp_term_entry_for_sitemap($term_sm_attributes = array(), $term, $taxonomy) {
341
 
342
+ //$post_sm_attributes['lastmod'] = $this->psp_get_last_modified_time( $post )->format('Y-m-d h:m:s');
343
+ return $term_sm_attributes;
 
 
344
 
345
  }
346
 
403
 
404
  }
405
 
406
+ private function psp_get_noindex_posts () {
407
+
408
+ global $wpdb;
409
+
410
+ $psp_meta_tbl = $wpdb->prefix . "platinumseometa";
411
+ $psp_meta_key = "_techblissonline_psp_noindex";
412
+ $psp_meta_value = "on";
413
+ $posts_list = array();
414
+
415
+ $sql_posts_ids = $wpdb->prepare("SELECT platinumseo_id FROM $psp_meta_tbl WHERE meta_key = %s and meta_value = %s", $psp_meta_key, $psp_meta_value );
416
+ $posts_list = $wpdb->get_col($sql_posts_ids);
417
+
418
+ return $posts_list;
419
+ }
420
+
421
  public function psp_get_sitemaps_stylesheet_url( $sitemap_url = '' ) {
422
  //error_log (plugins_url( '/sitemap.xsl', __FILE__ ));
423
  //return $sitemaps_stylesheet_url;
452
  * @param array $url_list A list of URLs for a sitemap.
453
  * @return string|false A well-formed XML string for a sitemap index. False on error.
454
  */
455
+ public function psp_get_sitemap_xml( $url_list, $object_type, $object_subtype ) {
456
 
457
  $psp_sm_settings = $this->psp_sitemap_settings;
458
 
460
 
461
  $psp_image_sitemaps_enabled = isset($psp_sm_settings['include_images']) ? $psp_sm_settings['include_images'] : '';
462
 
463
+ if ( 'post' === $object_type ) {
464
 
465
  $psp_stylesheet_url = plugins_url( '/sitemap.xsl', __FILE__ );
466
  $this->stylesheet = '<?xml-stylesheet type="text/xsl" href="' . esc_url( $psp_stylesheet_url ) . '" ?>';
psp-include/sitemap/psp_sitemap_settings.php CHANGED
@@ -178,6 +178,22 @@ class PspSmSettings extends PspSettings {
178
  $sitemap_image_field_title = esc_html__( 'Include Images: ', 'platinum-seo-pack' );
179
 
180
  add_settings_field( $sitemap_image_field_id, $sitemap_image_field_title, array( &$this, 'psp_add_field_checkbox' ), $this->psp_sm_settings_group, 'psp_sitemap_section', $sitemap_image_field );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
  //Enable siteMap for Authors
183
  $sitemap_author_field = array (
@@ -242,18 +258,23 @@ class PspSmSettings extends PspSettings {
242
  }
243
 
244
  //global $wp_rewrite;
245
- $core_sitemaps = new Core_Sitemaps();
246
 
247
  if( isset( $settings['enable']) && $settings['enable'] ) {
248
- $core_sitemaps->register_rewrites();
249
  //$wp_rewrite -> flush_rules();
250
  flush_rewrite_rules( false );
251
  } else {
252
- $core_sitemaps->unregister_rewrites();
253
  //$wp_rewrite -> flush_rules();
254
  flush_rewrite_rules( false );
255
  }
256
 
 
 
 
 
 
257
  if ( isset( $settings['include_images'] ) ) {
258
  $settings['include_images'] = !is_null(filter_var($settings['include_images'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['include_images'] : '';
259
 
@@ -346,12 +367,14 @@ class PspSmSettings extends PspSettings {
346
  $id = isset($args['label_for']) ? esc_attr($args['label_for']) : '';
347
  $option_value = isset($args['option_value']) ? esc_attr( $args['option_value'] ) : '';
348
  //$option_value = esc_attr( $args['option_value'] );
 
 
349
  $checkbox_label = isset($args['checkbox_label']) ? esc_html($args['checkbox_label']) : '';
350
- $option_description = isset($args['option_description']) ? esc_html($args['option_description']) : '';
351
  $checked = '';
352
  $desc_allowed_html = array('br' => array(), 'code' => array(), 'strong' => array(), 'em' => array(), 'i' => array(), 'bold' => array(), 'a' => array('href' => array(), 'target' => array()));
353
  if($option_value) { $checked = ' checked="checked" '; }
354
- echo "<input ".esc_attr($checked)." id='".esc_attr($id)."' name='".esc_attr($option_name)."' type='checkbox' data-toggle='toggle'/><span>&nbsp;</span><span for='".esc_attr($id)."'>".wp_kses(html_entity_decode($checkbox_label), $desc_allowed_html)."</span><br /><p class='description'>".wp_kses(html_entity_decode($option_description), $desc_allowed_html)."</p>";
355
 
356
  }
357
 
178
  $sitemap_image_field_title = esc_html__( 'Include Images: ', 'platinum-seo-pack' );
179
 
180
  add_settings_field( $sitemap_image_field_id, $sitemap_image_field_title, array( &$this, 'psp_add_field_checkbox' ), $this->psp_sm_settings_group, 'psp_sitemap_section', $sitemap_image_field );
181
+
182
+ //Asc or Desc in Post type SiteMaps
183
+ $sitemap_sort_field = array (
184
+ 'label_for' => 'psp_'.$psp_sm_settings_name.'_sort_order',
185
+ 'option_name' => $psp_sm_settings_name.'[sort_order]',
186
+ 'option_value' => isset($psp_sm_settings['sort_order']) ? $psp_sm_settings['sort_order'] : '',
187
+ 'checkbox_on_value' => esc_html__( 'Ascending ', 'platinum-seo-pack' ),
188
+ 'checkbox_off_value' => esc_html__( 'Descending ', 'platinum-seo-pack' ),
189
+ 'checkbox_label' => esc_html__( 'Order of POST IDs', 'platinum-seo-pack' ),
190
+ 'option_description' => esc_html__( 'Sort order of Post Entries included in Post Type SiteMaps created using Platinum SEO. The POST entries are always sorted by Ppost ID.', 'platinum-seo-pack' ),
191
+ );
192
+
193
+ $sitemap_sort_field_id = 'psp_'.$psp_sm_settings_name.'_sort_order';
194
+ $sitemap_sort_field_title = esc_html__( 'Posts Sort Order: ', 'platinum-seo-pack' );
195
+
196
+ add_settings_field( $sitemap_sort_field_id, $sitemap_sort_field_title, array( &$this, 'psp_add_field_checkbox' ), $this->psp_sm_settings_group, 'psp_sitemap_section', $sitemap_sort_field );
197
 
198
  //Enable siteMap for Authors
199
  $sitemap_author_field = array (
258
  }
259
 
260
  //global $wp_rewrite;
261
+ $wp_sitemaps = new WP_Sitemaps();
262
 
263
  if( isset( $settings['enable']) && $settings['enable'] ) {
264
+ $wp_sitemaps->register_rewrites();
265
  //$wp_rewrite -> flush_rules();
266
  flush_rewrite_rules( false );
267
  } else {
268
+ $wp_sitemaps->unregister_rewrites();
269
  //$wp_rewrite -> flush_rules();
270
  flush_rewrite_rules( false );
271
  }
272
 
273
+ if ( isset( $settings['sort_order'] ) ) {
274
+ $settings['sort_order'] = !is_null(filter_var($settings['sort_order'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['sort_order'] : '';
275
+
276
+ }
277
+
278
  if ( isset( $settings['include_images'] ) ) {
279
  $settings['include_images'] = !is_null(filter_var($settings['include_images'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['include_images'] : '';
280
 
367
  $id = isset($args['label_for']) ? esc_attr($args['label_for']) : '';
368
  $option_value = isset($args['option_value']) ? esc_attr( $args['option_value'] ) : '';
369
  //$option_value = esc_attr( $args['option_value'] );
370
+ $checkbox_on_value = isset($args['checkbox_on_value']) ? esc_html($args['checkbox_on_value']) : '';
371
+ $checkbox_off_value = isset($args['checkbox_off_value']) ? esc_html($args['checkbox_off_value']) : '';
372
  $checkbox_label = isset($args['checkbox_label']) ? esc_html($args['checkbox_label']) : '';
373
+ $option_description = isset($args['option_description']) ? esc_html($args['option_description']) : '';
374
  $checked = '';
375
  $desc_allowed_html = array('br' => array(), 'code' => array(), 'strong' => array(), 'em' => array(), 'i' => array(), 'bold' => array(), 'a' => array('href' => array(), 'target' => array()));
376
  if($option_value) { $checked = ' checked="checked" '; }
377
+ echo "<input ".esc_attr($checked)." id='".esc_attr($id)."' name='".esc_attr($option_name)."' type='checkbox' data-toggle='toggle' data-on='".$checkbox_on_value."' data-off='".$checkbox_off_value."'/><span>&nbsp;</span><span for='".esc_attr($id)."'>".wp_kses(html_entity_decode($checkbox_label), $desc_allowed_html)."</span><br /><p class='description'>".wp_kses(html_entity_decode($option_description), $desc_allowed_html)."</p>";
378
 
379
  }
380
 
psp-include/sitemap/sitemap-image.xsl CHANGED
@@ -47,6 +47,14 @@
47
  #sitemap__table tr:nth-child(odd) td {
48
  background-color: #eee;
49
  }
 
 
 
 
 
 
 
 
50
 
51
  a:hover {
52
  text-decoration: none;
@@ -70,14 +78,14 @@
70
  <table id="sitemap__table">
71
  <thead>
72
  <tr>
73
- <th>URL</th>
74
  <th>Last modified (GMT)</th>
75
  </tr>
76
  </thead>
77
  <tbody>
78
  <xsl:for-each select="sitemap:urlset/sitemap:url">
79
  <tr>
80
- <td>
81
  <xsl:variable name="itemURL">
82
  <xsl:value-of select="sitemap:loc"/>
83
  </xsl:variable>
@@ -89,8 +97,8 @@
89
  <xsl:value-of select="concat(substring(sitemap:lastmod,0,10),concat(' ', substring(sitemap:lastmod,12,8)))"/>
90
  </td>
91
  <xsl:for-each select="image:image">
92
- <tr>
93
- <td>
94
  <xsl:variable name="imageURL">
95
  <xsl:value-of select="image:loc"/>
96
  </xsl:variable>
47
  #sitemap__table tr:nth-child(odd) td {
48
  background-color: #eee;
49
  }
50
+
51
+ #sitemap__table tr.image td {
52
+ background-color: #F6F8FA;
53
+ position: relative;
54
+ left: 3%;
55
+ z-index: 1;
56
+ }
57
+
58
 
59
  a:hover {
60
  text-decoration: none;
78
  <table id="sitemap__table">
79
  <thead>
80
  <tr>
81
+ <th style="width:75%">URL</th>
82
  <th>Last modified (GMT)</th>
83
  </tr>
84
  </thead>
85
  <tbody>
86
  <xsl:for-each select="sitemap:urlset/sitemap:url">
87
  <tr>
88
+ <td style="width:75%">
89
  <xsl:variable name="itemURL">
90
  <xsl:value-of select="sitemap:loc"/>
91
  </xsl:variable>
97
  <xsl:value-of select="concat(substring(sitemap:lastmod,0,10),concat(' ', substring(sitemap:lastmod,12,8)))"/>
98
  </td>
99
  <xsl:for-each select="image:image">
100
+ <tr class="image">
101
+ <td style="width:75%">
102
  <xsl:variable name="imageURL">
103
  <xsl:value-of select="image:loc"/>
104
  </xsl:variable>
psp-include/utilities/psp_helper.php CHANGED
@@ -19,7 +19,7 @@ class PspHelper {
19
  * as description. Touch only if you know what you're doing
20
  */
21
  private $min_description_length = 1;
22
- private $version = "2.1.1";
23
 
24
  public $sitename = "";
25
  public $sitedescription = "";
19
  * as description. Touch only if you know what you're doing
20
  */
21
  private $min_description_length = 1;
22
+ private $version = "2.1.2";
23
 
24
  public $sitename = "";
25
  public $sitedescription = "";
psp_main.php CHANGED
@@ -259,24 +259,24 @@ class PspMain {
259
  $user_id = get_current_user_id();
260
  // Add the meta so that the notice is permanently dismissed.
261
  delete_user_meta( $user_id, 'psp_ignore_notice_v_209' );
262
- update_user_meta( $user_id, 'psp_ignore_notice', "v_211" );
263
  };
264
  };
265
  }
266
 
267
  public function platinum_seo_admin_notice__success() {
268
  $user_id = get_current_user_id();
269
- if ( "v_211" === trim(get_user_meta( $user_id, 'psp_ignore_notice', true ) )) return;
270
  global $pagenow;
271
  $psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
272
  if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
273
  ?>
274
  <div class="notice notice-success is-dismissible">
275
- <strong><p><?php echo esc_html__( 'Platinum SEO Plugin has now integrated WordPress SiteMap! ', 'platinum-seo-pack' ). esc_html__( 'See What has Changed in this', 'platinum-seo-pack' ).'<a href="https://techblissonline.com/platinum-wordpress-seo-plugin/#what-is-new" target="_blank"> '.esc_html__( ' Version ', 'platinum-seo-pack' ).'2.1.1 and V2.1.0!</a>'.'<a href="'. esc_url( add_query_arg( [
276
  'psp_ignore_notice' => '1',
277
  'action' => 'psp_delete_adminnotice',
278
  'nonce' => wp_create_nonce('psp_delete_adminnotice'),
279
- ] ) ) .'" style="float:right; display:block; border:none;">'.esc_html__( 'Dismiss permanently', 'platinum-seo-pack' ) .'</a>'; ?><br><?php echo esc_html__( "We are moving to a separate table. If you are an existing Platinum SEO Plugin User, import your existing Platinum SEO Data into the new table choosing Platinum SEO in the", "platinum-seo-pack" ).'<a href="'. get_admin_url(get_current_blog_id()).'admin.php?page=importer"> '.esc_html__( " Importer!", "platinum-seo-pack" ).'</a>'.esc_html__( ' If you like this plugin ', 'platinum-seo-pack' ).'<a href="https://wordpress.org/support/plugin/platinum-seo-pack/reviews/" target="_blank"> '.esc_html__( " give us a rating!", "platinum-seo-pack" ).'</a>'; ?></p></strong>
280
  </div>
281
  <?php
282
  }
259
  $user_id = get_current_user_id();
260
  // Add the meta so that the notice is permanently dismissed.
261
  delete_user_meta( $user_id, 'psp_ignore_notice_v_209' );
262
+ update_user_meta( $user_id, 'psp_ignore_notice', "v_212" );
263
  };
264
  };
265
  }
266
 
267
  public function platinum_seo_admin_notice__success() {
268
  $user_id = get_current_user_id();
269
+ if ( "v_212" === trim(get_user_meta( $user_id, 'psp_ignore_notice', true ) )) return;
270
  global $pagenow;
271
  $psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
272
  if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
273
  ?>
274
  <div class="notice notice-success is-dismissible">
275
+ <strong><p><?php echo esc_html__( 'Platinum SEO Plugin has integrated the latest WordPress SiteMap files! ', 'platinum-seo-pack' ).'<a href="'. esc_url( add_query_arg( [
276
  'psp_ignore_notice' => '1',
277
  'action' => 'psp_delete_adminnotice',
278
  'nonce' => wp_create_nonce('psp_delete_adminnotice'),
279
+ ] ) ) .'" style="float:right; display:block; border:none;">'.esc_html__( 'Dismiss permanently', 'platinum-seo-pack' ) .'</a>'.'<br>'. esc_html__( 'See What has Changed in this', 'platinum-seo-pack' ).'<a href="https://techblissonline.com/platinum-wordpress-seo-plugin/#what-is-new" target="_blank"> '.esc_html__( ' Version ', 'platinum-seo-pack' ).'2.1.2'.esc_html__( ' and earlier Versions!', 'platinum-seo-pack' ) .'</a>'; ?></p></strong>
280
  </div>
281
  <?php
282
  }
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: seo, wordpress seo, plugin, google seo, platinum seo, schema, schema marku
6
  Requires at least: 4.0
7
  Tested up to: 5.4.1
8
  Requires PHP: 5.6
9
- Stable tag: 2.1.1
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -69,6 +69,9 @@ Please read these **[FAQs](https://techblissonline.com/platinum-seo-pack-faq/)**
69
  4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
70
 
71
  == Changelog ==
 
 
 
72
  = 2.1.1 =
73
  * 2020-05-22 - Platinum SEO Plugin becomes the first SEO plugin to integrate with the upcoming SiteMap functionality in WordPress Core. The Core siteMap is still in development and Platinum SEO has integrated with the currently available version of the Core Module. If you do like to generate a sitemap with Platinum SEO, do enable it and enable the Object Types for which you want to generate a sitemap in SiteMap settings in Platinum SEO.
74
 
6
  Requires at least: 4.0
7
  Tested up to: 5.4.1
8
  Requires PHP: 5.6
9
+ Stable tag: 2.1.2
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
69
  4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
70
 
71
  == Changelog ==
72
+ = 2.1.2 =
73
+ * 2020-06-01 - Sitemap has been further enhanced with the latest WordPress sitemap files. Also a few styling changes have been implemented to the sitemap rendered by the plugin. A few other cosmetic changes have been done to Help text wordings in a few files.
74
+
75
  = 2.1.1 =
76
  * 2020-05-22 - Platinum SEO Plugin becomes the first SEO plugin to integrate with the upcoming SiteMap functionality in WordPress Core. The Core siteMap is still in development and Platinum SEO has integrated with the currently available version of the Core Module. If you do like to generate a sitemap with Platinum SEO, do enable it and enable the Object Types for which you want to generate a sitemap in SiteMap settings in Platinum SEO.
77