Platinum SEO Pack - Version 2.0.8

Version Description

  • 2020-04-11 - Fixed a bug that prevented Redirection from getting created when "Create Redirection" was clicked in Platinum SEO 404 Manager. However, the ability to create Redirection through "Bulk Updates" dropdown was working as expected. Modified a Javascript related to snippet preview. Hence it is essential for users to clear browser cache after updating the plugin to V2.0.8. Otherwise, browsers will continue to use the old Javascript file stored in its cache. causing issues Platinum SEO Plugin now enables its users to disable 404 Permalink guessing that WordPress does as part of its canonical redirec function. Though this function does several useful SEO related functionlaities, this guessing may prove to be harmful in certain cases and it is always better to let the WordPress user determine the URL to redirect to by monitoring the 404 Error Log.This can be done easily using Platinum SEO WordPress Plugin. For more details, read Techblissonline.
Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.8

Changelog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  = 2.0.6 =
2
  * 2020-04-05 - Introduces a complete HTTP Redirections Manager. It also now has a 404 Manager that lets you track and fix any 404 Error. This 404 Manager is integrated with Redirections to resolve the 404 Error by Creating appropriate HTTP Redirection. Make sure to clear browser cache after updating the plugin.
3
 
1
+ = 2.0.8 =
2
+ * 2020-04-11 - Fixed a bug that prevented Redirectinon from getting created when "Create Redirection" was clicked in Platinum SEO 404 Manager. However, the ability to create Redirection through "Bulk Updates" dropdown was working as expected.
3
+ Modified a Javascript related to snippet preview. Hence it is essential for users to clear browser cache after updating the plugin to V2.0.8. Otherwise, browsers will continue to use the old Javascript file stored in its cache. causing issues
4
+ Platinum SEO Plugin now enables its users to disable 404 Permalink guessing that WordPress does as part of its canonical redirec function. Though this function does several useful SEO related functionlaities, this guessing may prove to be harmful in certain cases and it is always better to let the WordPress user determine the URL to redirect to by monitoring the 404 Error Log.This can be done easily using Platinum SEO WordPress Plugin. For more details, read Techblissonline.
5
+
6
+ = 2.0.7 =
7
+ * 2020-04-05 - Updation to help file links in Redirections Settings.
8
+
9
  = 2.0.6 =
10
  * 2020-04-05 - Introduces a complete HTTP Redirections Manager. It also now has a 404 Manager that lets you track and fix any 404 Error. This 404 Manager is integrated with Redirections to resolve the 404 Error by Creating appropriate HTTP Redirection. Make sure to clear browser cache after updating the plugin.
11
 
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.0.6
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.0.8
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=htmlEncode(e),s=(t=t.replace(/\/$/,"")).length;jQuery("#permalinkSizer").html(t);var i=t=t.replace(/([^https?:\/\/])(\/)/g,"$1 > ");jQuery("#urlSizer").html(t),jQuery("#murlSizer").html(i);var r=new RegExp("W(.*)$");for(trimmed=!1;jQuery("#urlSizer").width()>566;){var n=t;n=(n=(n=(n=n.substring(0,n.length-1)).trim()).replace(/\>$/,"")).trim(),jQuery("#urlSizer").html(n),t=n,trimmed=!0}trimmed&&(t+=" ...",jQuery("#urlSizer").html(t)),info=s+" characters, ",jQuery("#urlInfo").html(t.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(t),mtrimmed=!1;for(var a=i;i.length>42;)i=jQuery.trim(i.replace(" ...","")),(a=(a=(a=jQuery.trim(a.replace(r,""))).trim()).replace(/\>$/,"")).length>=42&&(a=(a=jQuery.trim(i.replace(" ...",""))).substring(0,a.length-1)),a=a.trim(),i=a+=" ...",mtrimmed=!0;mtrimmed&&jQuery("#murlSizer").html(i),info=i.length+" characters, ",jQuery("#murlInfo").html(i.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(i)}function setUrlPreview(){var e="",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())}));jQuery("#new-post-slug").length>0&&(e+=jQuery("#new-post-slug").val());jQuery("#editable-post-name-full").length&&(e+=jQuery("#editable-post-name-full").text());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(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))){placeholder_title=e,l.attr("placeholder",placeholder_title);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="",a=!1,l="";window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(a=wpEditorL10n.tinymce.settings);var o=jQuery("#pspPostTypeArrayFormat").text(),p=JSON.parse(o),c=jQuery("#psp_seo_meta\\[titleformat\\]").val(),d=!1,u=!1,h=!1;jQuery("#psp_seo_meta\\[disable_title_format\\]:checked").length>0&&(d=!0),jQuery("#psp_seo_meta\\[disable_title\\]:checked").length>0&&(u=!0),jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(h=!0);l=p.category,c.toLowerCase().indexOf("%wp_title%");var m=jQuery("#title"),y=jQuery("#psp_seo_meta\\[title\\]"),g=jQuery("#psp_seo_meta\\[preferred_tax\\]"),j="categories",Q="post_category[]",f="category";if(g&&g.val()&&"category"!==(f=jQuery("#psp_seo_meta\\[preferred_tax\\] option:selected").text())&&(j=f,Q="tax_input["+f+"][]"),m&&(l=pspSortClassicArray(Q,f)),!y.val()||u||h?(jQuery("#title").val()?r=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?r=jQuery.trim(jQuery("#name").val()):a&&wp.data&&wp.data.select&&(r=wp.data.select("core/editor").getEditedPostAttribute("title"),s=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==s&&s.length>0&&(l=pspSortArray(s,f)),wp.data.subscribe(function(){r=wp.data.select("core/editor").getEditedPostAttribute("title"),s=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==s&&s.length>0&&(l=pspSortArray(s,f)),r&&l&&setGtbTitlePreview(r,l)})),i=r,(d||h)&&(c="%wp_title%"),i=(i=(i=(i=(i=(i=(i=c.replace("%seo_title%",r)).replace("%wp_title%",r)).replace("%site_name%",p.site_name)).replace("%site_description%",p.site_description)).replace("%taxonomy%",l)).replace("%category%",l)).replace(/%sep%/g,p.sep),i=(i=jQuery.trim(i)).trim(p.sep)):(i=y.val(),n=y.val(),jQuery("#title").val()?r=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?r=jQuery.trim(jQuery("#name").val()):a&&wp.data&&wp.data.select&&(r=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==t&&t.length>0&&(l=pspSortArray(t,f)),wp.data.subscribe(function(){r=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==t&&t.length>0&&(l=pspSortArray(t,f)),n&&l&&setGtbTitlePreview(n,l)})),d&&(c="%seo_title%"),i=(i=(i=(i=(i=(i=(i=c.replace("%seo_title%",n)).replace("%wp_title%",r)).replace("%site_name%",p.site_name)).replace("%site_description%",p.site_description)).replace("%taxonomy%",l)).replace("%category%",l)).replace(/%sep%/g,p.sep),i=(i=jQuery.trim(i)).trim(p.sep)),""!==i){e=r,y.attr("placeholder",e);var w=htmlEncode(i),v=w;jQuery("#titleSizer").html(w),jQuery("#actualTitleSizer").html(w);var S=new RegExp("sw+(.*)$"),_=w;for(trimmed=!1;jQuery("#titleSizer").width()>584;)w=jQuery.trim(w.replace(" ...","")),(_=jQuery.trim(_.replace(S,""))).length>=w.length&&(_=_.substring(0,_.length-1)),w=_+" ...",jQuery("#titleSizer").text(w),trimmed=!0;trimmed,jQuery("#titleSizer").text(w),jQuery("body").append(jQuery("#titleSizer")).width(),jQuery("body#titleSizer").remove(),info=jQuery("<textarea />").html(w).text().length+" characters, "+wordCount(w)+" words ",jQuery("#titleInfo").html(w.length+" characters, "+jQuery("#titleSizer").width()+" pixels, "+wordCount(w)+" 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(w);var x=v;for(mtrimmed=!1;x.length>78;)v=jQuery.trim(v.replace(" ...","")),(x=jQuery.trim(x.replace(S,""))).length>=78&&(x=(x=jQuery.trim(x.replace(" ...",""))).substring(0,x.length-1)),v=x+=" ...",mtrimmed=!0;mtrimmed,jQuery("#mtitleSizer").text(v),jQuery("body").append(jQuery("#mtitleSizer")).width(),jQuery("body#mtitleSizer").remove(),minfo=jQuery("<textarea />").html(v).text().length+" characters/ 78 characters "+wordCount(v)+" words ",jQuery("#mtitleInfo").html(v.length+" characters, "+jQuery("#mtitleSizer").width()+" pixels, "+wordCount(v)+" words"),v.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(v),setPSPSeoAnalysis()}}function setDescriptionPreview(){var e=!1,t=jQuery("#psp_seo_meta\\[description\\]");window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(e=wpEditorL10n.tinymce.settings);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="",n=!1,a=!1;if(jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(n=!0),jQuery("#psp_seo_meta\\[disable_description\\]:checked").length>0&&(a=!0),""!==r||n||a||(r=jQuery.trim(jQuery("#psp_seo_meta\\[description\\]").val())),""===r)if(""===r&&e&&wp.data&&wp.data.select){var l=wp.data.select("core/editor").getEditedPostContent();r=(r=l.replace(/(<([^>]+)>)/gi,"")).substring(0,i),t.attr("placeholder",r),wp.data.subscribe(function(){var e=wp.data.select("core/editor").getEditedPostContent();t.val()||(r=(r=e.replace(/(<([^>]+)>)/gi,"")).substring(0,i),t.attr("placeholder",r),setGTBDescPreview(r))})}else{var o=jQuery.trim(jQuery("#content").val());if(!t.val()||n||a)return r=(r=o.replace(/(<([^>]+)>)/gi,"")).substring(0,i),t.attr("placeholder",r),void setGTBDescPreview(r)}var p=htmlEncode(r),c=p+=" ...";jQuery("#descriptionSizer").html(p),jQuery("#mdescriptionSizer").html(c);for(var d=new RegExp("sw+(.*)$"),u=p;u.length>s;)p=jQuery.trim(p.replace(" ...","")),u=jQuery.trim(u.replace(d,"")),r=jQuery.trim(r.replace(d,"")),u.length>=s&&(u=(u=jQuery.trim(u.replace(" ...",""))).substring(0,u.length-1),r=r.substring(0,r.length-1)),u+=" ...";p=u,jQuery("#descriptionSizer").html(p);for(var h=c;h.length>i;)c=jQuery.trim(c.replace(" ...","")),(h=jQuery.trim(h.replace(d,""))).length>=i&&(h=(h=jQuery.trim(h.replace(" ...",""))).substring(0,h.length-1)),h+=" ...";c=h,jQuery("#mdescriptionSizer").html(c),jQuery("#descriptionInfo").html(p.length+" characters, "+jQuery("#descriptionSizer").width()+" pixels, "+wordCount(p)+" words"),info=jQuery("#descriptionSizer").width()+" pixels, "+wordCount(p)+" words ",jQuery("#mdescriptionInfo").html(c.length+" characters, "+jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(c)+" words"),minfo=jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(c)+" words ",p.length<=146?jQuery("#descriptionInfo").html(info+'<span style="color:green;">'+p.length+"/~170 characters"):p.length<=160?jQuery("#descriptionInfo").html(info+'<span style="color:orange;">'+p.length+"/~170 characters</span>"):p.length<=166?jQuery("#descriptionInfo").html(info+'<span style="color:purple;">'+p.length+"/~170 characters</span>"):jQuery("#descriptionInfo").html(info+'<span style="color:red;">'+p.length+"/~170 characters</span>"),c.length<=146?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:green;">'+c.length+"/~170 characters"):c.length<=160?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:orange;">'+c.length+"/~170 characters</span>"):c.length<=166?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:purple;">'+c.length+"/~170 characters</span>"):jQuery("#mdescriptionInfo").html(minfo+'<span style="color:red;">'+c.length+"/~170 characters</span>"),jQuery("#techblissonlineSnippetDescription").html(p),jQuery("#techblissonlineMSnippetDescription").html(c),setPSPSeoAnalysis()}function setGTBDescPreview(e){var t=jQuery("#psp_seo_meta\\[description\\]"),s=e;placeholder_desc=e,t.attr("placeholder",placeholder_desc);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=htmlEncode(s),a=n+=" ...";jQuery("#descriptionSizer").html(n),jQuery("#mdescriptionSizer").html(a);for(var l=new RegExp("sw+(.*)$"),o=n;o.length>i;)n=jQuery.trim(n.replace(" ...","")),o=jQuery.trim(o.replace(l,"")),s=jQuery.trim(s.replace(l,"")),o.length>=i&&(o=(o=jQuery.trim(o.replace(" ...",""))).substring(0,o.length-1),s=s.substring(0,s.length-1)),o+=" ...";n=o,jQuery("#descriptionSizer").html(n);for(var p=a;p.length>r;)a=jQuery.trim(a.replace(" ...","")),(p=jQuery.trim(p.replace(l,""))).length>=r&&(p=(p=jQuery.trim(p.replace(" ...",""))).substring(0,p.length-1)),p+=" ...";a=p,jQuery("#descriptionSizer").html(a),jQuery("body").append(jQuery("#descriptionSizer")).width(),jQuery("body").append(jQuery("#mdescriptionSizer")).width(),jQuery("body").remove("#descriptionSizer"),jQuery("body").remove("#mdescriptionSizer"),jQuery("#descriptionInfo").html(n.length+" characters, "+jQuery("#descriptionSizer").width()+" pixels, "+wordCount(n)+" words"),info=jQuery("#descriptionSizer").width()+" pixels, "+wordCount(n)+" words ",jQuery("#mdescriptionInfo").html(a.length+" characters, "+jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(a)+" words"),minfo=jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(a)+" words ",n.length<=146?jQuery("#descriptionInfo").html(info+'<span style="color:green;">'+n.length+"/~170 characters"):n.length<=160?jQuery("#descriptionInfo").html(info+'<span style="color:orange;">'+n.length+"/~170 characters</span>"):n.length<=166?jQuery("#descriptionInfo").html(info+'<span style="color:purple;">'+n.length+"/~170 characters</span>"):jQuery("#descriptionInfo").html(info+'<span style="color:red;">'+n.length+"/~170 characters</span>"),a.length<=146?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:green;">'+a.length+"/~170 characters"):a.length<=160?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:orange;">'+a.length+"/~170 characters</span>"):a.length<=166?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:purple;">'+a.length+"/~170 characters</span>"):jQuery("#mdescriptionInfo").html(minfo+'<span style="color:red;">'+a.length+"/~170 characters</span>"),jQuery("#techblissonlineSnippetDescription").html(n),jQuery("#techblissonlineMSnippetDescription").html(a),setPSPSeoAnalysis()}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&&(r=(i=(i=(i=(i=i.replace(/(<([^>]+)>)/gi,"")).replace(/['"]+/g,"")).replace(/[^a-zA-Z]+/g," ")).toLowerCase()).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(-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"))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.trim();var I=0,T=0,k=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(I=0,T=0,k=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&&(I+=1),1==e&&(T+=1),2==e&&(k+=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 r=[];r=pspGetOccurences(searchlc,i,!1),pspkd=0,n>0&&r&&(pspkd=r.length/n*100);var l=pspGetCounOfIndices(r);A+="<ul>",r.length>0?(A=pspkd.toFixed(2)<3?A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in content '+r.length+" time(s) </li>":A+'<li><span class="dashicons dashicons-dismiss"></span> Used in content '+r.length+" time(s) </li>",l>0&&l<6?A=A+'<li><li><span class="dashicons dashicons-yes-alt"></span> Found in first 100 words of content '+l+" time(s) </li>":0==l?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 '+l+" 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>',I>0&&(A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in other h1 tags '+I+" 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>',k>0?A=A+'<li><span class="dashicons dashicons-yes-alt"></span> Used in image alt attributes '+k+" 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 pspGetOccurences(e,t,s){var i=e.length;if(0==i)return[];var r,n=0,a=[];for(s||(t=t.toLowerCase(),e=e.toLowerCase());(r=t.indexOf(e,n))>-1;)a.push(r),n=r+i;return a}function pspGetCounOfIndices(e){for(var t=0,s=0;s<e.length;++s)e[s]<100&&t++;return t}function updateAll(){setUrlPreview(),setTitlePreview(),setDescriptionPreview(),updateDateText()}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=htmlEncode(e),s=(t=t.replace(/\/$/,"")).length;jQuery("#permalinkSizer").html(t);var i=t=t.replace(/([^https?:\/\/])(\/)/g,"$1 > ");jQuery("#urlSizer").html(t),jQuery("#murlSizer").html(i);var r=new RegExp("W(.*)$");for(trimmed=!1;jQuery("#urlSizer").width()>566;){var n=t;n=(n=(n=(n=n.substring(0,n.length-1)).trim()).replace(/\>$/,"")).trim(),jQuery("#urlSizer").html(n),t=n,trimmed=!0}trimmed&&(t+=" ...",jQuery("#urlSizer").html(t)),info=s+" characters, ",jQuery("#urlInfo").html(t.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(t),mtrimmed=!1;for(var a=i;i.length>42;)i=jQuery.trim(i.replace(" ...","")),(a=(a=(a=jQuery.trim(a.replace(r,""))).trim()).replace(/\>$/,"")).length>=42&&(a=(a=jQuery.trim(i.replace(" ...",""))).substring(0,a.length-1)),a=a.trim(),i=a+=" ...",mtrimmed=!0;mtrimmed&&jQuery("#murlSizer").html(i),info=i.length+" characters, ",jQuery("#murlInfo").html(i.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(i)}function setUrlPreview(){var e="",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())}));jQuery("#new-post-slug").length>0&&(e+=jQuery("#new-post-slug").val());jQuery("#editable-post-name-full").length&&(e+=jQuery("#editable-post-name-full").text());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(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))){placeholder_title=e,l.attr("placeholder",placeholder_title);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="",a=!1,l="";window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(a=wpEditorL10n.tinymce.settings);var o=jQuery("#pspPostTypeArrayFormat").text(),p=JSON.parse(o),c=jQuery("#psp_seo_meta\\[titleformat\\]").val(),d=!1,u=!1,h=!1;jQuery("#psp_seo_meta\\[disable_title_format\\]:checked").length>0&&(d=!0),jQuery("#psp_seo_meta\\[disable_title\\]:checked").length>0&&(u=!0),jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(h=!0);l=p.category,c.toLowerCase().indexOf("%wp_title%");var m=jQuery("#title"),y=jQuery("#psp_seo_meta\\[title\\]"),g=jQuery("#psp_seo_meta\\[preferred_tax\\]"),j="categories",Q="post_category[]",f="category";if(g&&g.val()&&"category"!==(f=jQuery("#psp_seo_meta\\[preferred_tax\\] option:selected").text())&&(j=f,Q="tax_input["+f+"][]"),m&&(l=pspSortClassicArray(Q,f)),!y.val()||u||h?(jQuery("#title").val()?r=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?r=jQuery.trim(jQuery("#name").val()):a&&wp.data&&wp.data.select&&(r=wp.data.select("core/editor").getEditedPostAttribute("title"),s=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==s&&s.length>0&&(l=pspSortArray(s,f)),wp.data.subscribe(function(){r=wp.data.select("core/editor").getEditedPostAttribute("title"),s=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==s&&s.length>0&&(l=pspSortArray(s,f)),r&&l&&setGtbTitlePreview(r,l)})),i=r,(d||h)&&(c="%wp_title%"),i=(i=(i=(i=(i=(i=(i=c.replace("%seo_title%",r)).replace("%wp_title%",r)).replace("%site_name%",p.site_name)).replace("%site_description%",p.site_description)).replace("%taxonomy%",l)).replace("%category%",l)).replace(/%sep%/g,p.sep),i=(i=jQuery.trim(i)).trim(p.sep)):(i=y.val(),n=y.val(),jQuery("#title").val()?r=jQuery.trim(jQuery("#title").val()):jQuery("#name").val()?r=jQuery.trim(jQuery("#name").val()):a&&wp.data&&wp.data.select&&(r=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==t&&t.length>0&&(l=pspSortArray(t,f)),wp.data.subscribe(function(){r=wp.data.select("core/editor").getEditedPostAttribute("title"),t=wp.data.select("core/editor").getEditedPostAttribute(j),l="%"+f+"%",void 0!==t&&t.length>0&&(l=pspSortArray(t,f)),n&&l&&setGtbTitlePreview(n,l)})),d&&(c="%seo_title%"),i=(i=(i=(i=(i=(i=(i=c.replace("%seo_title%",n)).replace("%wp_title%",r)).replace("%site_name%",p.site_name)).replace("%site_description%",p.site_description)).replace("%taxonomy%",l)).replace("%category%",l)).replace(/%sep%/g,p.sep),i=(i=jQuery.trim(i)).trim(p.sep)),""!==i){e=r,y.attr("placeholder",e);var w=htmlEncode(i),v=w;jQuery("#titleSizer").html(w),jQuery("#actualTitleSizer").html(w);var S=new RegExp("sw+(.*)$"),_=w;for(trimmed=!1;jQuery("#titleSizer").width()>584;)w=jQuery.trim(w.replace(" ...","")),(_=jQuery.trim(_.replace(S,""))).length>=w.length&&(_=_.substring(0,_.length-1)),w=_+" ...",jQuery("#titleSizer").text(w),trimmed=!0;trimmed,jQuery("#titleSizer").text(w),jQuery("body").append(jQuery("#titleSizer")).width(),jQuery("body#titleSizer").remove(),info=jQuery("<textarea />").html(w).text().length+" characters, "+wordCount(w)+" words ",jQuery("#titleInfo").html(w.length+" characters, "+jQuery("#titleSizer").width()+" pixels, "+wordCount(w)+" 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(w);var x=v;for(mtrimmed=!1;x.length>78;)v=jQuery.trim(v.replace(" ...","")),(x=jQuery.trim(x.replace(S,""))).length>=78&&(x=(x=jQuery.trim(x.replace(" ...",""))).substring(0,x.length-1)),v=x+=" ...",mtrimmed=!0;mtrimmed,jQuery("#mtitleSizer").text(v),jQuery("body").append(jQuery("#mtitleSizer")).width(),jQuery("body#mtitleSizer").remove(),minfo=jQuery("<textarea />").html(v).text().length+" characters/ 78 characters "+wordCount(v)+" words ",jQuery("#mtitleInfo").html(v.length+" characters, "+jQuery("#mtitleSizer").width()+" pixels, "+wordCount(v)+" words"),v.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(v),setPSPSeoAnalysis()}}function setDescriptionPreview(){var e=!1,t=jQuery("#psp_seo_meta\\[description\\]");window.wpEditorL10n&&wpEditorL10n.tinymce&&wpEditorL10n.tinymce.settings&&(e=wpEditorL10n.tinymce.settings);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="",n=!1,a=!1;if(jQuery("#psp_seo_meta\\[disable_psp\\]:checked").length>0&&(n=!0),jQuery("#psp_seo_meta\\[disable_description\\]:checked").length>0&&(a=!0),""!==r||n||a||(r=jQuery.trim(jQuery("#psp_seo_meta\\[description\\]").val())),""===r){if(""===r&&e&&wp.data&&wp.data.select)return(r=(r=wp.data.select("core/editor").getEditedPostContent().replace(/(<([^>]+)>)/gi,"")).substring(0,i))&&t.attr("placeholder",r),r||(r=t.attr("placeholder")),void setGTBDescPreview(r);var l=jQuery.trim(jQuery("#content").val());if(!t.val()||n||a)return r=(r=l.replace(/(<([^>]+)>)/gi,"")).substring(0,i),t.attr("placeholder",r),void setGTBDescPreview(r)}return r?void setGTBDescPreview(r):void 0}function setGTBDescPreview(e){var t=jQuery("#psp_seo_meta\\[description\\]"),s=e;placeholder_desc=e,t.attr("placeholder",placeholder_desc);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=htmlEncode(s),a=n+=" ...";jQuery("#descriptionSizer").html(n),jQuery("#mdescriptionSizer").html(a);for(var l=new RegExp("sw+(.*)$"),o=n;o.length>i;)n=jQuery.trim(n.replace(" ...","")),o=jQuery.trim(o.replace(l,"")),s=jQuery.trim(s.replace(l,"")),o.length>=i&&(o=(o=jQuery.trim(o.replace(" ...",""))).substring(0,o.length-1),s=s.substring(0,s.length-1)),o+=" ...";n=o,jQuery("#descriptionSizer").html(n);for(var p=a;p.length>r;)a=jQuery.trim(a.replace(" ...","")),(p=jQuery.trim(p.replace(l,""))).length>=r&&(p=(p=jQuery.trim(p.replace(" ...",""))).substring(0,p.length-1)),p+=" ...";a=p,jQuery("#descriptionSizer").html(a),jQuery("body").append(jQuery("#descriptionSizer")).width(),jQuery("body").append(jQuery("#mdescriptionSizer")).width(),jQuery("body").remove("#descriptionSizer"),jQuery("body").remove("#mdescriptionSizer"),jQuery("#descriptionInfo").html(n.length+" characters, "+jQuery("#descriptionSizer").width()+" pixels, "+wordCount(n)+" words"),info=jQuery("#descriptionSizer").width()+" pixels, "+wordCount(n)+" words ",jQuery("#mdescriptionInfo").html(a.length+" characters, "+jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(a)+" words"),minfo=jQuery("#mdescriptionSizer").width()+" pixels, "+wordCount(a)+" words ",n.length<=146?jQuery("#descriptionInfo").html(info+'<span style="color:green;">'+n.length+"/~170 characters"):n.length<=160?jQuery("#descriptionInfo").html(info+'<span style="color:orange;">'+n.length+"/~170 characters</span>"):n.length<=166?jQuery("#descriptionInfo").html(info+'<span style="color:purple;">'+n.length+"/~170 characters</span>"):jQuery("#descriptionInfo").html(info+'<span style="color:red;">'+n.length+"/~170 characters</span>"),a.length<=146?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:green;">'+a.length+"/~170 characters"):a.length<=160?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:orange;">'+a.length+"/~170 characters</span>"):a.length<=166?jQuery("#mdescriptionInfo").html(minfo+'<span style="color:purple;">'+a.length+"/~170 characters</span>"):jQuery("#mdescriptionInfo").html(minfo+'<span style="color:red;">'+a.length+"/~170 characters</span>"),jQuery("#techblissonlineSnippetDescription").html(n),jQuery("#techblissonlineMSnippetDescription").html(a)}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()});
psp-include/settings/psp_basic_metabox_renderer.php CHANGED
@@ -153,7 +153,7 @@ label {
153
  <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[description]"><?php esc_html_e('Description: ', 'platinum-seo-pack'); ?></label><br /><?php if ($psp_type == "posttype" && (!$psp_posttype_metabox_advanced_hidden || is_super_admin())) { ?><?php if( isset($psp_seo_meta['disable_description']) && $psp_seo_meta['disable_description']) { $disdes_checked = ' checked="checked" '; } else { $disdes_checked = ""; }
154
  echo "<div class='psp-bs'><input ".esc_attr($disdes_checked)." id='psp_seo_meta[disable_description]' name='psp_seo_meta[disable_description]' type='checkbox' data-toggle='toggle' data-on='Off' data-onstyle='default' data-off='On' data-offstyle='success' data-style='ios' /></div><br />";
155
  ?><?php } ?></th>
156
- <td><textarea name="psp_seo_meta[description]" rows="5" id="psp_seo_meta[description]"><?php echo ( isset($psp_seo_meta['description']) ? html_entity_decode(stripcslashes(esc_textarea($psp_seo_meta['description']))) : ''); ?></textarea><br />
157
  <p class="description"><?php esc_html_e('Set meta desciption to be used for this post/page.Switching this Off will mean this description will not be used and an auto-generated description will be used, if that had been turned on sitewide in Platinum SEO General Settings.', 'platinum-seo-pack'); ?></p>
158
  </td>
159
  </tr>
153
  <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[description]"><?php esc_html_e('Description: ', 'platinum-seo-pack'); ?></label><br /><?php if ($psp_type == "posttype" && (!$psp_posttype_metabox_advanced_hidden || is_super_admin())) { ?><?php if( isset($psp_seo_meta['disable_description']) && $psp_seo_meta['disable_description']) { $disdes_checked = ' checked="checked" '; } else { $disdes_checked = ""; }
154
  echo "<div class='psp-bs'><input ".esc_attr($disdes_checked)." id='psp_seo_meta[disable_description]' name='psp_seo_meta[disable_description]' type='checkbox' data-toggle='toggle' data-on='Off' data-onstyle='default' data-off='On' data-offstyle='success' data-style='ios' /></div><br />";
155
  ?><?php } ?></th>
156
+ <td><textarea name="psp_seo_meta[description]" placeholder="<?php esc_html_e("Write a unique description that is short enough to fit search results snippet for this page. An ideal meta description is one that has a brief content matching what the user is searching for and inducing him to click through.", 'platinum-seo-pack');?>" rows="5" id="psp_seo_meta[description]"><?php echo ( isset($psp_seo_meta['description']) ? html_entity_decode(stripcslashes(esc_textarea($psp_seo_meta['description']))) : ''); ?></textarea><br />
157
  <p class="description"><?php esc_html_e('Set meta desciption to be used for this post/page.Switching this Off will mean this description will not be used and an auto-generated description will be used, if that had been turned on sitewide in Platinum SEO General Settings.', 'platinum-seo-pack'); ?></p>
158
  </td>
159
  </tr>
psp-include/settings/psp_redirect_404.php CHANGED
@@ -144,13 +144,17 @@ class PspRedirections {
144
  if ( isset($_POST['insertit']) && !empty($_POST['source-url-input']) && !empty($_POST['id-input']) )
145
  {
146
  if (isset( $_POST['psp_404_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_404_actions_nonce']), 'do_psp_404_actions' )) {
 
 
 
147
 
148
  $psp_id = isset($_POST['id-input']) ? sanitize_key($_POST['id-input']) : '';
149
  $psp_source_url = isset($_POST['source-url-input']) ? sanitize_text_field(html_entity_decode($_POST['source-url-input'])) : '';
150
  $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
151
  $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
152
 
153
- if ($psp_action == 'addredirect' && !empty($psp_source_url) && !empty($psp_redirect_to) && !empty($psp_redirect_code)) {
 
154
  //Add new redirect
155
  if (!empty($psp_source_url)) $pspinsert['source_url'] = $psp_source_url;
156
  if (!empty($psp_redirect_to)) $pspinsert['dest_url'] = $psp_redirect_to;
@@ -712,6 +716,10 @@ class PspRedirections {
712
  $do_auto_redirect = isset($psp_redirection_settings['auto_redirection']) ? ($psp_redirection_settings['auto_redirection']) : '';
713
 
714
  if ( is_404() ) {
 
 
 
 
715
 
716
  if ( $do_redirect ) {
717
 
@@ -759,16 +767,22 @@ class PspRedirections {
759
  }
760
 
761
 
762
- if ($do_auto_redirect) {
763
- $this->psp_auto_redirect();
764
- }
765
- $this->psp_log_404();
766
 
767
  }
768
 
769
  return;
770
  }
771
 
 
 
 
 
 
 
772
  public function psp_log_redirect($redirections) {
773
 
774
  global $wp;
144
  if ( isset($_POST['insertit']) && !empty($_POST['source-url-input']) && !empty($_POST['id-input']) )
145
  {
146
  if (isset( $_POST['psp_404_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_404_actions_nonce']), 'do_psp_404_actions' )) {
147
+
148
+ //$psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : 'addredirect';
149
+ $psp_action = 'addredirect';
150
 
151
  $psp_id = isset($_POST['id-input']) ? sanitize_key($_POST['id-input']) : '';
152
  $psp_source_url = isset($_POST['source-url-input']) ? sanitize_text_field(html_entity_decode($_POST['source-url-input'])) : '';
153
  $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
154
  $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
155
 
156
+ if ($psp_action == 'addredirect' && !empty($psp_source_url) && !empty($psp_redirect_to) && !empty($psp_redirect_code)) {
157
+
158
  //Add new redirect
159
  if (!empty($psp_source_url)) $pspinsert['source_url'] = $psp_source_url;
160
  if (!empty($psp_redirect_to)) $pspinsert['dest_url'] = $psp_redirect_to;
716
  $do_auto_redirect = isset($psp_redirection_settings['auto_redirection']) ? ($psp_redirection_settings['auto_redirection']) : '';
717
 
718
  if ( is_404() ) {
719
+
720
+ if ($do_auto_redirect) {
721
+ $this->psp_auto_redirect();
722
+ }
723
 
724
  if ( $do_redirect ) {
725
 
767
  }
768
 
769
 
770
+ //if ($do_auto_redirect) {
771
+ // $this->psp_auto_redirect();
772
+ //}
773
+ //$this->psp_log_404();
774
 
775
  }
776
 
777
  return;
778
  }
779
 
780
+ public function psp_do_log_404() {
781
+ if (is_404()) {
782
+ $this->psp_log_404();
783
+ }
784
+ }
785
+
786
  public function psp_log_redirect($redirections) {
787
 
788
  global $wp;
psp-include/settings/psp_settings.php CHANGED
@@ -1719,6 +1719,22 @@ class PspSettings {
1719
 
1720
  add_settings_field( $psp_301_limit_field_id, $psp_301_limit_field_title, array( &$this, 'psp_add_field_text_number' ), $this->psp_permalink_settings_group, $section_id, $psp_301_limit_field);
1721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1722
  //404 Section
1723
  $section_id = 'psp_404_section';
1724
  $section_title = esc_html__('404 Errors', 'platinum-seo-pack');
@@ -1838,6 +1854,12 @@ class PspSettings {
1838
  }
1839
  }
1840
 
 
 
 
 
 
 
1841
  if( isset( $settings['enable_404'] ) ) {
1842
  $settings['enable_404'] = !is_null(filter_var($settings['enable_404'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['enable_404'] : '';
1843
  }
1719
 
1720
  add_settings_field( $psp_301_limit_field_id, $psp_301_limit_field_title, array( &$this, 'psp_add_field_text_number' ), $this->psp_permalink_settings_group, $section_id, $psp_301_limit_field);
1721
 
1722
+ //V2.0.8
1723
+ $psp_disable_wp_404_guess_field = array (
1724
+ 'label_for' => 'psp_disable_wp_404_guess',
1725
+ 'option_name' => $psp_settings_name.'[disable_wp_404_guess]',
1726
+ 'option_value' => isset($psp_settings['disable_wp_404_guess']) ? $psp_settings['disable_wp_404_guess'] : '',
1727
+ 'checkbox_label' => esc_html__('', 'platinum-seo-pack'),
1728
+ 'option_description' => esc_html__( 'Turn ON to disable WordPress 404 Canonical Redirect Guessing (Recommended).', 'platinum-seo-pack' ),
1729
+ );
1730
+
1731
+ $psp_disable_wp_404_guess_id = 'psp_disable_wp_404_guess';
1732
+ $psp_disable_wp_404_guess_title = esc_html__('Disable WP 404 Redirect Guessing: ', 'platinum-seo-pack').'<a href="https://techblissonline.com/wordpress-canonical-redirect-for-404-errors/" target="_blank" rel="noopener">'.'<br>'.esc_html__('How does this work?', 'platinum-seo-pack').'</a>';
1733
+
1734
+ add_settings_field( $psp_disable_wp_404_guess_id, $psp_disable_wp_404_guess_title, array( &$this, 'psp_add_field_checkbox' ), $this->psp_permalink_settings_group, $section_id, $psp_disable_wp_404_guess_field );
1735
+
1736
+ //V2.0.8
1737
+
1738
  //404 Section
1739
  $section_id = 'psp_404_section';
1740
  $section_title = esc_html__('404 Errors', 'platinum-seo-pack');
1854
  }
1855
  }
1856
 
1857
+ //V2.0.8
1858
+ if( isset( $settings['disable_wp_404_guess'] ) ) {
1859
+ $settings['disable_wp_404_guess'] = !is_null(filter_var($settings['disable_wp_404_guess'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['disable_wp_404_guess'] : '';
1860
+ }
1861
+ //V2.0.8
1862
+
1863
  if( isset( $settings['enable_404'] ) ) {
1864
  $settings['enable_404'] = !is_null(filter_var($settings['enable_404'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['enable_404'] : '';
1865
  }
psp_main.php CHANGED
@@ -19,7 +19,9 @@ class PspMain {
19
  public $psp_ga_settings = array();
20
 
21
  public function __construct() {
22
-
 
 
23
  //create settings instance
24
  $psp_settings_instance = PspSettings::get_instance();
25
  $this->psp_settings_handle = $psp_settings_instance;
@@ -189,7 +191,23 @@ class PspMain {
189
  }
190
 
191
  //add the redirect action
192
- add_action( 'template_redirect', array( $this, 'psp_redirect' ), 1, 2); // do the redirects
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  //add breadcrumbs filter
195
  add_filter('psp_breadcrumb_trail_args', array(&$this,'psp_breadcrumb_trail_args'));
@@ -211,8 +229,50 @@ class PspMain {
211
  add_action( 'wp_head', array($this, 'add_tracking_code' ), 99 );
212
  }
213
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
 
 
 
 
 
216
  public static function get_instance() {
217
 
218
  if ( null == self::$obj_handle ) {
@@ -1344,6 +1404,593 @@ class PspMain {
1344
 
1345
  add_option( 'psp_db_version', $psp_db_version );
1346
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1347
  }
1348
 
1349
  public function psp_loaded_filter() {
19
  public $psp_ga_settings = array();
20
 
21
  public function __construct() {
22
+
23
+ global $wp_filter;
24
+
25
  //create settings instance
26
  $psp_settings_instance = PspSettings::get_instance();
27
  $this->psp_settings_handle = $psp_settings_instance;
191
  }
192
 
193
  //add the redirect action
194
+ //add_action( 'template_redirect', array( $this, 'psp_redirect' ), 1, 2); // do the redirects
195
+ //V2.0.8
196
+ $callbacksforthetdaction = array();
197
+ if ( has_action( 'template_redirect' ) ) {
198
+ $callbacksforthetdaction = $wp_filter['template_redirect']->callbacks;
199
+ }
200
+
201
+ $template_redirect_priority = 999;
202
+ if (!empty($callbacksforthetdaction)) {
203
+ $template_redirect_priority = max(array_keys($callbacksforthetdaction)) + 10;
204
+ }
205
+
206
+ add_action( 'template_redirect', array( $this, 'psp_redirect' ), 1, 2); // do the redirects
207
+ //if($this->psp_redirect_instance) {
208
+ add_action( 'template_redirect', array($this->psp_redirect_instance, 'psp_do_log_404'), $template_redirect_priority, 2); // do the 404 logging
209
+ //}
210
+ //V2.0.8
211
 
212
  //add breadcrumbs filter
213
  add_filter('psp_breadcrumb_trail_args', array(&$this,'psp_breadcrumb_trail_args'));
229
  add_action( 'wp_head', array($this, 'add_tracking_code' ), 99 );
230
  }
231
 
232
+ //disable 404 redirect guessing v2.0.8
233
+ $psp_permalink_settings = get_option("psp_permalink_settings");
234
+ $psp_disable_wp_404_redirect_guessing = isset($psp_permalink_settings['disable_wp_404_guess']) ? $psp_permalink_settings['disable_wp_404_guess'] : '';
235
+ if($psp_disable_wp_404_redirect_guessing) {
236
+ //add_filter( 'redirect_canonical', array($this, 'psp_disable_404_redirect_guessing' ) );
237
+ remove_action( 'template_redirect', 'redirect_canonical' );
238
+ add_action( 'template_redirect', array( $this, 'psp_redirect_canonical' ), 10, 2);
239
+ }
240
+
241
+ add_action('admin_notices', array($this, 'platinum_seo_admin_notice__success'));
242
+ add_action('admin_init', array($this, 'platinum_seo_notice_dismissed'));
243
+ //v2.0.8
244
  }
245
+ //v2.0.8
246
+ public function platinum_seo_notice_dismissed() {
247
+ $user_id = get_current_user_id();
248
+ if ( isset( $_GET['psp_ignore_notice'] ) &&
249
+ '1' === $_GET['psp_ignore_notice'] ) {
250
+ $user_id = get_current_user_id();
251
+ // Add the meta so that the notice is permanently dismissed.
252
+ add_user_meta( $user_id, 'psp_ignore_notice_v_208', true, true );
253
+ };
254
+ }
255
+
256
+ public function platinum_seo_admin_notice__success() {
257
+ $user_id = get_current_user_id();
258
+ if ( get_user_meta( $user_id, 'psp_ignore_notice_v_208', true ) ) return;
259
+ global $pagenow;
260
+ $psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
261
+ if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
262
+ ?>
263
+ <div class="notice notice-success is-dismissible">
264
+ <strong><p><?php echo esc_html__( 'Thank you for using Platinum SEO Plugin!', 'platinum-seo-pack' ).'<a href="https://techblissonline.com/platinum-wordpress-seo-plugin/#what-is-new" target="_blank"> '.esc_html__( 'See What has Changed in this Version 2.0.8!', 'platinum-seo-pack' ).'</a>'.'<a href="'. esc_url( add_query_arg( [
265
+ 'psp_ignore_notice' => '1',
266
+ ] ) ) .'" style="float:right; display:block; border:none;">'.esc_html__( 'Dismiss permanently', 'platinum-seo-pack' ) .'</a>'; ?><br><?php echo esc_html__( 'Make sure to clear browser cache after you update to this version!', 'platinum-seo-pack' ) ?></p></strong>
267
+ </div>
268
+ <?php
269
+ }
270
+ }
271
 
272
+ public function psp_disable_404_redirect_guessing( $url ) {
273
+ return ( is_404() ) ? false : $url;
274
+ }
275
+ //v2.0.8
276
  public static function get_instance() {
277
 
278
  if ( null == self::$obj_handle ) {
1404
 
1405
  add_option( 'psp_db_version', $psp_db_version );
1406
 
1407
+ }
1408
+ //same as redirect_canonical in WordPress Core but redirect_guess_404_permalink() has been disabled
1409
+ //this function replaces redirect_canonical function in WordPress template_redirect hooks
1410
+ //this is done because redirect_guess_404_permalink() does not have any filters (as of WordPress 5.4) for plugin to hook into
1411
+ public function psp_redirect_canonical( $requested_url = null, $do_redirect = true ) {
1412
+ global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
1413
+
1414
+ if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ) ) ) {
1415
+ return;
1416
+ }
1417
+
1418
+ // If we're not in wp-admin and the post has been published and preview nonce
1419
+ // is non-existent or invalid then no need for preview in query.
1420
+ if ( is_preview() && get_query_var( 'p' ) && 'publish' == get_post_status( get_query_var( 'p' ) ) ) {
1421
+ if ( ! isset( $_GET['preview_id'] )
1422
+ || ! isset( $_GET['preview_nonce'] )
1423
+ || ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ) ) {
1424
+ $wp_query->is_preview = false;
1425
+ }
1426
+ }
1427
+
1428
+ if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() ) ) {
1429
+ return;
1430
+ }
1431
+
1432
+ if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
1433
+ // Build the URL in the address bar.
1434
+ $requested_url = is_ssl() ? 'https://' : 'http://';
1435
+ $requested_url .= $_SERVER['HTTP_HOST'];
1436
+ $requested_url .= $_SERVER['REQUEST_URI'];
1437
+ }
1438
+
1439
+ $original = @parse_url( $requested_url );
1440
+ if ( false === $original ) {
1441
+ return;
1442
+ }
1443
+
1444
+ $redirect = $original;
1445
+ $redirect_url = false;
1446
+
1447
+ // Notice fixing.
1448
+ if ( ! isset( $redirect['path'] ) ) {
1449
+ $redirect['path'] = '';
1450
+ }
1451
+ if ( ! isset( $redirect['query'] ) ) {
1452
+ $redirect['query'] = '';
1453
+ }
1454
+
1455
+ /*
1456
+ * If the original URL ended with non-breaking spaces, they were almost
1457
+ * certainly inserted by accident. Let's remove them, so the reader doesn't
1458
+ * see a 404 error with no obvious cause.
1459
+ */
1460
+ $redirect['path'] = preg_replace( '|(%C2%A0)+$|i', '', $redirect['path'] );
1461
+
1462
+ // It's not a preview, so remove it from URL.
1463
+ if ( get_query_var( 'preview' ) ) {
1464
+ $redirect['query'] = remove_query_arg( 'preview', $redirect['query'] );
1465
+ }
1466
+
1467
+ $id = get_query_var( 'p' );
1468
+
1469
+ if ( is_feed() && $id ) {
1470
+ $redirect_url = get_post_comments_feed_link( $id, get_query_var( 'feed' ) );
1471
+ if ( $redirect_url ) {
1472
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed' ), $redirect_url );
1473
+ $redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH );
1474
+ }
1475
+ }
1476
+
1477
+ if ( is_singular() && 1 > $wp_query->post_count && $id ) {
1478
+
1479
+ $vars = $wpdb->get_results( $wpdb->prepare( "SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $id ) );
1480
+
1481
+ if ( ! empty( $vars[0] ) ) {
1482
+ $vars = $vars[0];
1483
+ if ( 'revision' == $vars->post_type && $vars->post_parent > 0 ) {
1484
+ $id = $vars->post_parent;
1485
+ }
1486
+
1487
+ $redirect_url = get_permalink( $id );
1488
+ if ( $redirect_url ) {
1489
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
1490
+ }
1491
+ }
1492
+ }
1493
+
1494
+ // These tests give us a WP-generated permalink.
1495
+ if ( is_404() ) {
1496
+
1497
+ // Redirect ?page_id, ?p=, ?attachment_id= to their respective URLs.
1498
+ $id = max( get_query_var( 'p' ), get_query_var( 'page_id' ), get_query_var( 'attachment_id' ) );
1499
+ $redirect_post = $id ? get_post( $id ) : false;
1500
+ if ( $redirect_post ) {
1501
+ $post_type_obj = get_post_type_object( $redirect_post->post_type );
1502
+ if ( $post_type_obj->public && 'auto-draft' != $redirect_post->post_status ) {
1503
+ $redirect_url = get_permalink( $redirect_post );
1504
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
1505
+ }
1506
+ }
1507
+
1508
+ if ( get_query_var( 'day' ) && get_query_var( 'monthnum' ) && get_query_var( 'year' ) ) {
1509
+ $year = get_query_var( 'year' );
1510
+ $month = get_query_var( 'monthnum' );
1511
+ $day = get_query_var( 'day' );
1512
+ $date = sprintf( '%04d-%02d-%02d', $year, $month, $day );
1513
+ if ( ! wp_checkdate( $month, $day, $year, $date ) ) {
1514
+ $redirect_url = get_month_link( $year, $month );
1515
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url );
1516
+ }
1517
+ } elseif ( get_query_var( 'monthnum' ) && get_query_var( 'year' ) && 12 < get_query_var( 'monthnum' ) ) {
1518
+ $redirect_url = get_year_link( get_query_var( 'year' ) );
1519
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url );
1520
+ }
1521
+ /***commenting guessing***
1522
+ if ( ! $redirect_url ) {
1523
+ $redirect_url = redirect_guess_404_permalink();
1524
+ if ( $redirect_url ) {
1525
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
1526
+ }
1527
+ }
1528
+ ****/
1529
+ if ( get_query_var( 'page' ) && $wp_query->post &&
1530
+ false !== strpos( $wp_query->post->post_content, '<!--nextpage-->' ) ) {
1531
+ $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' );
1532
+ $redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
1533
+ $redirect_url = get_permalink( $wp_query->post->ID );
1534
+ }
1535
+ } elseif ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) {
1536
+ // Rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101.
1537
+ if ( is_attachment() &&
1538
+ ! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) ) &&
1539
+ ! $redirect_url ) {
1540
+ if ( ! empty( $_GET['attachment_id'] ) ) {
1541
+ $redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) );
1542
+ if ( $redirect_url ) {
1543
+ $redirect['query'] = remove_query_arg( 'attachment_id', $redirect['query'] );
1544
+ }
1545
+ } else {
1546
+ $redirect_url = get_attachment_link();
1547
+ }
1548
+ } elseif ( is_single() && ! empty( $_GET['p'] ) && ! $redirect_url ) {
1549
+ $redirect_url = get_permalink( get_query_var( 'p' ) );
1550
+ if ( $redirect_url ) {
1551
+ $redirect['query'] = remove_query_arg( array( 'p', 'post_type' ), $redirect['query'] );
1552
+ }
1553
+ } elseif ( is_single() && ! empty( $_GET['name'] ) && ! $redirect_url ) {
1554
+ $redirect_url = get_permalink( $wp_query->get_queried_object_id() );
1555
+ if ( $redirect_url ) {
1556
+ $redirect['query'] = remove_query_arg( 'name', $redirect['query'] );
1557
+ }
1558
+ } elseif ( is_page() && ! empty( $_GET['page_id'] ) && ! $redirect_url ) {
1559
+ $redirect_url = get_permalink( get_query_var( 'page_id' ) );
1560
+ if ( $redirect_url ) {
1561
+ $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
1562
+ }
1563
+ } elseif ( is_page() && ! is_feed() && 'page' == get_option( 'show_on_front' ) && get_queried_object_id() == get_option( 'page_on_front' ) && ! $redirect_url ) {
1564
+ $redirect_url = home_url( '/' );
1565
+ } elseif ( is_home() && ! empty( $_GET['page_id'] ) && 'page' == get_option( 'show_on_front' ) && get_query_var( 'page_id' ) == get_option( 'page_for_posts' ) && ! $redirect_url ) {
1566
+ $redirect_url = get_permalink( get_option( 'page_for_posts' ) );
1567
+ if ( $redirect_url ) {
1568
+ $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
1569
+ }
1570
+ } elseif ( ! empty( $_GET['m'] ) && ( is_year() || is_month() || is_day() ) ) {
1571
+ $m = get_query_var( 'm' );
1572
+ switch ( strlen( $m ) ) {
1573
+ case 4: // Yearly.
1574
+ $redirect_url = get_year_link( $m );
1575
+ break;
1576
+ case 6: // Monthly.
1577
+ $redirect_url = get_month_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ) );
1578
+ break;
1579
+ case 8: // Daily.
1580
+ $redirect_url = get_day_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ), substr( $m, 6, 2 ) );
1581
+ break;
1582
+ }
1583
+ if ( $redirect_url ) {
1584
+ $redirect['query'] = remove_query_arg( 'm', $redirect['query'] );
1585
+ }
1586
+ // Now moving on to non ?m=X year/month/day links.
1587
+ } elseif ( is_day() && get_query_var( 'year' ) && get_query_var( 'monthnum' ) && ! empty( $_GET['day'] ) ) {
1588
+ $redirect_url = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
1589
+ if ( $redirect_url ) {
1590
+ $redirect['query'] = remove_query_arg( array( 'year', 'monthnum', 'day' ), $redirect['query'] );
1591
+ }
1592
+ } elseif ( is_month() && get_query_var( 'year' ) && ! empty( $_GET['monthnum'] ) ) {
1593
+ $redirect_url = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
1594
+ if ( $redirect_url ) {
1595
+ $redirect['query'] = remove_query_arg( array( 'year', 'monthnum' ), $redirect['query'] );
1596
+ }
1597
+ } elseif ( is_year() && ! empty( $_GET['year'] ) ) {
1598
+ $redirect_url = get_year_link( get_query_var( 'year' ) );
1599
+ if ( $redirect_url ) {
1600
+ $redirect['query'] = remove_query_arg( 'year', $redirect['query'] );
1601
+ }
1602
+ } elseif ( is_author() && ! empty( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
1603
+ $author = get_userdata( get_query_var( 'author' ) );
1604
+ if ( ( false !== $author ) && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) ) ) {
1605
+ $redirect_url = get_author_posts_url( $author->ID, $author->user_nicename );
1606
+ if ( $redirect_url ) {
1607
+ $redirect['query'] = remove_query_arg( 'author', $redirect['query'] );
1608
+ }
1609
+ }
1610
+ } elseif ( is_category() || is_tag() || is_tax() ) { // Terms (tags/categories).
1611
+
1612
+ $term_count = 0;
1613
+ foreach ( $wp_query->tax_query->queried_terms as $tax_query ) {
1614
+ $term_count += count( $tax_query['terms'] );
1615
+ }
1616
+
1617
+ $obj = $wp_query->get_queried_object();
1618
+ if ( $term_count <= 1 && ! empty( $obj->term_id ) ) {
1619
+ $tax_url = get_term_link( (int) $obj->term_id, $obj->taxonomy );
1620
+ if ( $tax_url && ! is_wp_error( $tax_url ) ) {
1621
+ if ( ! empty( $redirect['query'] ) ) {
1622
+ // Strip taxonomy query vars off the URL.
1623
+ $qv_remove = array( 'term', 'taxonomy' );
1624
+ if ( is_category() ) {
1625
+ $qv_remove[] = 'category_name';
1626
+ $qv_remove[] = 'cat';
1627
+ } elseif ( is_tag() ) {
1628
+ $qv_remove[] = 'tag';
1629
+ $qv_remove[] = 'tag_id';
1630
+ } else {
1631
+ // Custom taxonomies will have a custom query var, remove those too.
1632
+ $tax_obj = get_taxonomy( $obj->taxonomy );
1633
+ if ( false !== $tax_obj->query_var ) {
1634
+ $qv_remove[] = $tax_obj->query_var;
1635
+ }
1636
+ }
1637
+
1638
+ $rewrite_vars = array_diff( array_keys( $wp_query->query ), array_keys( $_GET ) );
1639
+
1640
+ // Check to see if all the query vars are coming from the rewrite, none are set via $_GET.
1641
+ if ( ! array_diff( $rewrite_vars, array_keys( $_GET ) ) ) {
1642
+ // Remove all of the per-tax query vars.
1643
+ $redirect['query'] = remove_query_arg( $qv_remove, $redirect['query'] );
1644
+
1645
+ // Create the destination URL for this taxonomy.
1646
+ $tax_url = parse_url( $tax_url );
1647
+ if ( ! empty( $tax_url['query'] ) ) {
1648
+ // Taxonomy accessible via ?taxonomy=...&term=... or any custom query var.
1649
+ parse_str( $tax_url['query'], $query_vars );
1650
+ $redirect['query'] = add_query_arg( $query_vars, $redirect['query'] );
1651
+ } else {
1652
+ // Taxonomy is accessible via a "pretty URL".
1653
+ $redirect['path'] = $tax_url['path'];
1654
+ }
1655
+ } else {
1656
+ // Some query vars are set via $_GET. Unset those from $_GET that exist via the rewrite.
1657
+ foreach ( $qv_remove as $_qv ) {
1658
+ if ( isset( $rewrite_vars[ $_qv ] ) ) {
1659
+ $redirect['query'] = remove_query_arg( $_qv, $redirect['query'] );
1660
+ }
1661
+ }
1662
+ }
1663
+ }
1664
+ }
1665
+ }
1666
+ } elseif ( is_single() && strpos( $wp_rewrite->permalink_structure, '%category%' ) !== false ) {
1667
+ $cat = get_query_var( 'category_name' );
1668
+ if ( $cat ) {
1669
+ $category = get_category_by_path( $cat );
1670
+ if ( ( ! $category || is_wp_error( $category ) ) || ! has_term( $category->term_id, 'category', $wp_query->get_queried_object_id() ) ) {
1671
+ $redirect_url = get_permalink( $wp_query->get_queried_object_id() );
1672
+ }
1673
+ }
1674
+ }
1675
+
1676
+ // Post paging.
1677
+ if ( is_singular() && get_query_var( 'page' ) ) {
1678
+ if ( ! $redirect_url ) {
1679
+ $redirect_url = get_permalink( get_queried_object_id() );
1680
+ }
1681
+
1682
+ $page = get_query_var( 'page' );
1683
+ if ( $page > 1 ) {
1684
+ if ( is_front_page() ) {
1685
+ $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' );
1686
+ } else {
1687
+ $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( $page, 'single_paged' );
1688
+ }
1689
+ }
1690
+ $redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
1691
+ }
1692
+
1693
+ // Paging and feeds.
1694
+ if ( get_query_var( 'paged' ) || is_feed() || get_query_var( 'cpage' ) ) {
1695
+ while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) {
1696
+ // Strip off paging and feed.
1697
+ $redirect['path'] = preg_replace( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path'] ); // Strip off any existing paging.
1698
+ $redirect['path'] = preg_replace( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path'] ); // Strip off feed endings.
1699
+ $redirect['path'] = preg_replace( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path'] ); // Strip off any existing comment paging.
1700
+ }
1701
+
1702
+ $addl_path = '';
1703
+ if ( is_feed() && in_array( get_query_var( 'feed' ), $wp_rewrite->feeds ) ) {
1704
+ $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
1705
+ if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
1706
+ $addl_path .= 'comments/';
1707
+ }
1708
+ if ( ( 'rss' == get_default_feed() && 'feed' == get_query_var( 'feed' ) ) || 'rss' == get_query_var( 'feed' ) ) {
1709
+ $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
1710
+ } else {
1711
+ $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == get_query_var( 'feed' ) || 'feed' == get_query_var( 'feed' ) ) ? '' : get_query_var( 'feed' ) ), 'feed' );
1712
+ }
1713
+ $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
1714
+ } elseif ( is_feed() && 'old' == get_query_var( 'feed' ) ) {
1715
+ $old_feed_files = array(
1716
+ 'wp-atom.php' => 'atom',
1717
+ 'wp-commentsrss2.php' => 'comments_rss2',
1718
+ 'wp-feed.php' => get_default_feed(),
1719
+ 'wp-rdf.php' => 'rdf',
1720
+ 'wp-rss.php' => 'rss2',
1721
+ 'wp-rss2.php' => 'rss2',
1722
+ );
1723
+ if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
1724
+ $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
1725
+ wp_redirect( $redirect_url, 301 );
1726
+ die();
1727
+ }
1728
+ }
1729
+
1730
+ if ( get_query_var( 'paged' ) > 0 ) {
1731
+ $paged = get_query_var( 'paged' );
1732
+ $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
1733
+ if ( ! is_feed() ) {
1734
+ if ( $paged > 1 && ! is_single() ) {
1735
+ $addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ) . user_trailingslashit( "$wp_rewrite->pagination_base/$paged", 'paged' );
1736
+ } elseif ( ! is_single() ) {
1737
+ $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
1738
+ }
1739
+ } elseif ( $paged > 1 ) {
1740
+ $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] );
1741
+ }
1742
+ }
1743
+
1744
+ if ( get_option( 'page_comments' ) && (
1745
+ ( 'newest' == get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 0 ) ||
1746
+ ( 'newest' != get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 1 )
1747
+ ) ) {
1748
+ $addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . get_query_var( 'cpage' ), 'commentpaged' );
1749
+ $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
1750
+ }
1751
+
1752
+ $redirect['path'] = user_trailingslashit( preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path'] ) ); // Strip off trailing /index.php/.
1753
+ if ( ! empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos( $redirect['path'], '/' . $wp_rewrite->index . '/' ) === false ) {
1754
+ $redirect['path'] = trailingslashit( $redirect['path'] ) . $wp_rewrite->index . '/';
1755
+ }
1756
+ if ( ! empty( $addl_path ) ) {
1757
+ $redirect['path'] = trailingslashit( $redirect['path'] ) . $addl_path;
1758
+ }
1759
+ $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
1760
+ }
1761
+
1762
+ if ( 'wp-register.php' == basename( $redirect['path'] ) ) {
1763
+ if ( is_multisite() ) {
1764
+ /** This filter is documented in wp-login.php */
1765
+ $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
1766
+ } else {
1767
+ $redirect_url = wp_registration_url();
1768
+ }
1769
+
1770
+ wp_redirect( $redirect_url, 301 );
1771
+ die();
1772
+ }
1773
+ }
1774
+
1775
+ // Tack on any additional query vars.
1776
+ $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
1777
+ if ( $redirect_url && ! empty( $redirect['query'] ) ) {
1778
+ parse_str( $redirect['query'], $_parsed_query );
1779
+ $redirect = @parse_url( $redirect_url );
1780
+
1781
+ if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
1782
+ parse_str( $redirect['query'], $_parsed_redirect_query );
1783
+
1784
+ if ( empty( $_parsed_redirect_query['name'] ) ) {
1785
+ unset( $_parsed_query['name'] );
1786
+ }
1787
+ }
1788
+
1789
+ $_parsed_query = array_combine(
1790
+ rawurlencode_deep( array_keys( $_parsed_query ) ),
1791
+ rawurlencode_deep( array_values( $_parsed_query ) )
1792
+ );
1793
+ $redirect_url = add_query_arg( $_parsed_query, $redirect_url );
1794
+ }
1795
+
1796
+ if ( $redirect_url ) {
1797
+ $redirect = @parse_url( $redirect_url );
1798
+ }
1799
+
1800
+ // www.example.com vs. example.com
1801
+ $user_home = @parse_url( home_url() );
1802
+ if ( ! empty( $user_home['host'] ) ) {
1803
+ $redirect['host'] = $user_home['host'];
1804
+ }
1805
+ if ( empty( $user_home['path'] ) ) {
1806
+ $user_home['path'] = '/';
1807
+ }
1808
+
1809
+ // Handle ports.
1810
+ if ( ! empty( $user_home['port'] ) ) {
1811
+ $redirect['port'] = $user_home['port'];
1812
+ } else {
1813
+ unset( $redirect['port'] );
1814
+ }
1815
+
1816
+ // Trailing /index.php.
1817
+ $redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path'] );
1818
+
1819
+ $punctuation_pattern = implode(
1820
+ '|',
1821
+ array_map(
1822
+ 'preg_quote',
1823
+ array(
1824
+ ' ',
1825
+ '%20', // Space.
1826
+ '!',
1827
+ '%21', // Exclamation mark.
1828
+ '"',
1829
+ '%22', // Double quote.
1830
+ "'",
1831
+ '%27', // Single quote.
1832
+ '(',
1833
+ '%28', // Opening bracket.
1834
+ ')',
1835
+ '%29', // Closing bracket.
1836
+ ',',
1837
+ '%2C', // Comma.
1838
+ '.',
1839
+ '%2E', // Period.
1840
+ ';',
1841
+ '%3B', // Semicolon.
1842
+ '{',
1843
+ '%7B', // Opening curly bracket.
1844
+ '}',
1845
+ '%7D', // Closing curly bracket.
1846
+ '%E2%80%9C', // Opening curly quote.
1847
+ '%E2%80%9D', // Closing curly quote.
1848
+ )
1849
+ )
1850
+ );
1851
+
1852
+ // Remove trailing spaces and end punctuation from the path.
1853
+ $redirect['path'] = preg_replace( "#($punctuation_pattern)+$#", '', $redirect['path'] );
1854
+
1855
+ if ( ! empty( $redirect['query'] ) ) {
1856
+ // Remove trailing spaces and end punctuation from certain terminating query string args.
1857
+ $redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
1858
+
1859
+ // Clean up empty query strings.
1860
+ $redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' );
1861
+
1862
+ // Redirect obsolete feeds.
1863
+ $redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $redirect['query'] );
1864
+
1865
+ // Remove redundant leading ampersands.
1866
+ $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
1867
+ }
1868
+
1869
+ // Strip /index.php/ when we're not using PATHINFO permalinks.
1870
+ if ( ! $wp_rewrite->using_index_permalinks() ) {
1871
+ $redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] );
1872
+ }
1873
+
1874
+ // Trailing slashes.
1875
+ if ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() && ! is_404() && ( ! is_front_page() || ( is_front_page() && ( get_query_var( 'paged' ) > 1 ) ) ) ) {
1876
+ $user_ts_type = '';
1877
+ if ( get_query_var( 'paged' ) > 0 ) {
1878
+ $user_ts_type = 'paged';
1879
+ } else {
1880
+ foreach ( array( 'single', 'category', 'page', 'day', 'month', 'year', 'home' ) as $type ) {
1881
+ $func = 'is_' . $type;
1882
+ if ( call_user_func( $func ) ) {
1883
+ $user_ts_type = $type;
1884
+ break;
1885
+ }
1886
+ }
1887
+ }
1888
+ $redirect['path'] = user_trailingslashit( $redirect['path'], $user_ts_type );
1889
+ } elseif ( is_front_page() ) {
1890
+ $redirect['path'] = trailingslashit( $redirect['path'] );
1891
+ }
1892
+
1893
+ // Strip multiple slashes out of the URL.
1894
+ if ( strpos( $redirect['path'], '//' ) > -1 ) {
1895
+ $redirect['path'] = preg_replace( '|/+|', '/', $redirect['path'] );
1896
+ }
1897
+
1898
+ // Always trailing slash the Front Page URL.
1899
+ if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) ) {
1900
+ $redirect['path'] = trailingslashit( $redirect['path'] );
1901
+ }
1902
+
1903
+ // Ignore differences in host capitalization, as this can lead to infinite redirects.
1904
+ // Only redirect no-www <=> yes-www.
1905
+ if ( strtolower( $original['host'] ) == strtolower( $redirect['host'] ) ||
1906
+ ( strtolower( $original['host'] ) != 'www.' . strtolower( $redirect['host'] ) && 'www.' . strtolower( $original['host'] ) != strtolower( $redirect['host'] ) ) ) {
1907
+ $redirect['host'] = $original['host'];
1908
+ }
1909
+
1910
+ $compare_original = array( $original['host'], $original['path'] );
1911
+
1912
+ if ( ! empty( $original['port'] ) ) {
1913
+ $compare_original[] = $original['port'];
1914
+ }
1915
+
1916
+ if ( ! empty( $original['query'] ) ) {
1917
+ $compare_original[] = $original['query'];
1918
+ }
1919
+
1920
+ $compare_redirect = array( $redirect['host'], $redirect['path'] );
1921
+
1922
+ if ( ! empty( $redirect['port'] ) ) {
1923
+ $compare_redirect[] = $redirect['port'];
1924
+ }
1925
+
1926
+ if ( ! empty( $redirect['query'] ) ) {
1927
+ $compare_redirect[] = $redirect['query'];
1928
+ }
1929
+
1930
+ if ( $compare_original !== $compare_redirect ) {
1931
+ $redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
1932
+ if ( ! empty( $redirect['port'] ) ) {
1933
+ $redirect_url .= ':' . $redirect['port'];
1934
+ }
1935
+ $redirect_url .= $redirect['path'];
1936
+ if ( ! empty( $redirect['query'] ) ) {
1937
+ $redirect_url .= '?' . $redirect['query'];
1938
+ }
1939
+ }
1940
+
1941
+ if ( ! $redirect_url || $redirect_url == $requested_url ) {
1942
+ return;
1943
+ }
1944
+
1945
+ // Hex encoded octets are case-insensitive.
1946
+ if ( false !== strpos( $requested_url, '%' ) ) {
1947
+ if ( ! function_exists( 'lowercase_octets' ) ) {
1948
+ /**
1949
+ * Converts the first hex-encoded octet match to lowercase.
1950
+ *
1951
+ * @since 3.1.0
1952
+ * @ignore
1953
+ *
1954
+ * @param array $matches Hex-encoded octet matches for the requested URL.
1955
+ * @return string Lowercased version of the first match.
1956
+ */
1957
+ function lowercase_octets( $matches ) {
1958
+ return strtolower( $matches[0] );
1959
+ }
1960
+ }
1961
+ $requested_url = preg_replace_callback( '|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url );
1962
+ }
1963
+
1964
+ /**
1965
+ * Filters the canonical redirect URL.
1966
+ *
1967
+ * Returning false to this filter will cancel the redirect.
1968
+ *
1969
+ * @since 2.3.0
1970
+ *
1971
+ * @param string $redirect_url The redirect URL.
1972
+ * @param string $requested_url The requested URL.
1973
+ */
1974
+ $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
1975
+
1976
+ // Yes, again -- in case the filter aborted the request.
1977
+ if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) == strip_fragment_from_url( $requested_url ) ) {
1978
+ return;
1979
+ }
1980
+
1981
+ if ( $do_redirect ) {
1982
+ // Protect against chained redirects.
1983
+ if ( ! redirect_canonical( $redirect_url, false ) ) {
1984
+ wp_redirect( $redirect_url, 301 );
1985
+ exit();
1986
+ } else {
1987
+ // Debug.
1988
+ // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
1989
+ return;
1990
+ }
1991
+ } else {
1992
+ return $redirect_url;
1993
+ }
1994
  }
1995
 
1996
  public function psp_loaded_filter() {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: seo, wordpress seo, plugin, google seo, platinum seo, schema, schema marku
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -22,8 +22,8 @@ Techblissonline's **[ WordPress SEO Plugin](https://techblissonline.com/platinum
22
 
23
  Some features:
24
 
25
- * Create and set any kind of Json-ld schema markup tag for any post, page or taxonomy.
26
- * Canonical URLs
27
  * Create social meta tags for facebook, twitter, pinterest and linkedin.
28
  * Optimized Post and Page Titles for search engines
29
  * Generates all SEO relevant META tags automatically
@@ -35,8 +35,13 @@ Some features:
35
  * Support for custom post types
36
  * Support for custom taxonomies
37
  * Compatible with most other plugins. You can use Google XML Sitemap Generator to generate your sitemap. You can exclude any particular post/page/taxonomy from the sitemap through settings in the Techblissonline Platinum Wordpress SEO Plugin.
38
- * You have a 404 Manager.You can HTTP Redirect any Post or URL that returns a 404 Error. You can also set status to 410, if needed.
39
- * You now have a complete Redirection Manager.You can redirect any post or page to the desired location using 301, 302, 303 and 307.
 
 
 
 
 
40
  * Add index, noindex, follow or nofollow, noodp, noydir, noarchive, nosnippet meta tags to any post/page.
41
  * Plenty of other features.
42
 
@@ -47,7 +52,7 @@ Some features:
47
  1. Unzip into your `/wp-content/plugins/` directory. If you're uploading it make sure to upload
48
  the top-level folder. Don't just upload all the php files and put them in `/wp-content/plugins/`.
49
  2. Activate the plugin through the 'Plugins' menu in WordPress
50
- 3. Visit your SEO options (*Platinum SEO -> Platinum SEO*)
51
  That's all folks!
52
 
53
  If you have to upgrade manually simply repeat the installation steps.
@@ -60,10 +65,18 @@ Please read these **[FAQs](https://techblissonline.com/platinum-seo-pack-faq/)**
60
 
61
  1. Sitewide SEO and Social Settings
62
  2. Techblissonline Platinum SEO and Social Settings Meta Box for Posts, Pages and Taxonomies
63
- 3. Adding **[combined Json Schemas] (https://techblissonline.com/combine-json-schema/)** for each Post, Page and taxonomy.
64
  4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
65
 
66
  == Changelog ==
 
 
 
 
 
 
 
 
67
  = 2.0.6 =
68
  * 2020-04-05 - Introduces a complete HTTP Redirections Manager. It also now has a 404 Manager that lets you track and fix any 404 Error. This 404 Manager is integrated with Redirections to resolve the 404 Error by Creating appropriate HTTP Redirection. Make sure to clear browser cache after updating the plugin.
69
 
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.8
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
22
 
23
  Some features:
24
 
25
+ * Create and set any kind of Json-ld schema markup tag for any post, page or taxonomy. Thus Platinum SEO is now the easiest Plugin to add JSON Schema Markup. This can be generated using the free JSON Schema Markup Generator on Techblissonline.com.
26
+ * Canonical URLs are set automatically. Users can also override default canonical URLs for any POST or Page by explicitly setting the Canonical URL in the Techblissonline Platinum SEO MetaBox. You may even set Cross site Canonical URLs.
27
  * Create social meta tags for facebook, twitter, pinterest and linkedin.
28
  * Optimized Post and Page Titles for search engines
29
  * Generates all SEO relevant META tags automatically
35
  * Support for custom post types
36
  * Support for custom taxonomies
37
  * Compatible with most other plugins. You can use Google XML Sitemap Generator to generate your sitemap. You can exclude any particular post/page/taxonomy from the sitemap through settings in the Techblissonline Platinum Wordpress SEO Plugin.
38
+ * You have a 404 Manager.You can HTTP Redirect any Post or URL that returns a 404 Error. You can also set status to 410, if needed. [Fix 404 Errors](https://techblissonline.com/http-404-error/) using its 404 Monitor and doing [HTTP Redirect in WordPress](https://techblissonline.com/redirection-in-wordpress/)
39
+ * WordPress Plugin to change HTTP status code from 404 to 410.
40
+ * You now have a complete Redirection Manager.You can redirect any post or page to the desired location.
41
+ * WordPress 301 Redirect Plugin using HTTP 301 Status Code
42
+ * WordPress 302 Redirect Plugin using HTTP 302 Status Code
43
+ * WordPress 307 Redirect Plugin using HTTP 307 Status Code
44
+ * WordPress 303 Redirect Plugin using HTTP 303 Status Code
45
  * Add index, noindex, follow or nofollow, noodp, noydir, noarchive, nosnippet meta tags to any post/page.
46
  * Plenty of other features.
47
 
52
  1. Unzip into your `/wp-content/plugins/` directory. If you're uploading it make sure to upload
53
  the top-level folder. Don't just upload all the php files and put them in `/wp-content/plugins/`.
54
  2. Activate the plugin through the 'Plugins' menu in WordPress
55
+ 3. Visit your SEO options (*Platinum SEO and Social Pack -> SEO*)
56
  That's all folks!
57
 
58
  If you have to upgrade manually simply repeat the installation steps.
65
 
66
  1. Sitewide SEO and Social Settings
67
  2. Techblissonline Platinum SEO and Social Settings Meta Box for Posts, Pages and Taxonomies
68
+ 3. Adding **[combined Json Schemas](https://techblissonline.com/combine-json-schema/)** for each Post, Page and taxonomy.
69
  4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
70
 
71
  == Changelog ==
72
+ = 2.0.8 =
73
+ * 2020-04-11 - Fixed a bug that prevented Redirection from getting created when "Create Redirection" was clicked in Platinum SEO 404 Manager. However, the ability to create Redirection through "Bulk Updates" dropdown was working as expected.
74
+ Modified a Javascript related to snippet preview. Hence it is essential for users to clear browser cache after updating the plugin to V2.0.8. Otherwise, browsers will continue to use the old Javascript file stored in its cache. causing issues
75
+ Platinum SEO Plugin now enables its users to disable 404 Permalink guessing that WordPress does as part of its canonical redirec function. Though this function does several useful SEO related functionlaities, this guessing may prove to be harmful in certain cases and it is always better to let the WordPress user determine the URL to redirect to by monitoring the 404 Error Log.This can be done easily using Platinum SEO WordPress Plugin. For more details, read Techblissonline.
76
+
77
+ = 2.0.7 =
78
+ * 2020-04-05 - Updation to help file links in Redirections Settings.
79
+
80
  = 2.0.6 =
81
  * 2020-04-05 - Introduces a complete HTTP Redirections Manager. It also now has a 404 Manager that lets you track and fix any 404 Error. This 404 Manager is integrated with Redirections to resolve the 404 Error by Creating appropriate HTTP Redirection. Make sure to clear browser cache after updating the plugin.
82