Platinum SEO Pack - Version 2.0.9

Version Description

  • 2020-04-16 - Redirection can now be created using Request URI, Request Path or Request URL as the source URL.
Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.9

Changelog.txt CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
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.9 =
2
+ * 2020-04-16 - Redirection can now be created using Request URI, Request Path or Request URL as the source URL.
3
+
4
+ = 2.0.8 =
5
+ * 2020-04-12 - 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.
6
+ 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
7
+ Platinum SEO Plugin now enables its users to disable 404 Permalink guessing that WordPress does as part of its canonical redirect function. Though this function does several useful SEO related functionalities, 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.
8
+
9
+ = 2.0.7 =
10
+ * 2020-04-05 - Updation to help file links in Redirections Settings.
11
+
12
  = 2.0.6 =
13
  * 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.
14
 
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
@@ -65,7 +65,7 @@ global $psp;
65
  $psp = PspMain::get_instance();
66
 
67
  global $psp_db_version;
68
- $psp_db_version = '2.0.6';
69
 
70
  register_activation_hook ( __FILE__, array ($psp, 'psp_activate' ) );
71
  register_deactivation_hook ( __FILE__, array ($psp, 'psp_deactivate' ) );
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.9
8
  Author: Techblissonline.com (Rajesh)
9
  Author URI: https://techblissonline.com/
10
  Text Domain: platinum-seo-pack
65
  $psp = PspMain::get_instance();
66
 
67
  global $psp_db_version;
68
+ $psp_db_version = '2.0.9';
69
 
70
  register_activation_hook ( __FILE__, array ($psp, 'psp_activate' ) );
71
  register_deactivation_hook ( __FILE__, array ($psp, 'psp_deactivate' ) );
psp-include/generators/psp_home_others_seo_metas.php CHANGED
@@ -680,11 +680,14 @@ class PspHomeOthersSeoMetas {
680
  if (empty($this->psp_search_result_settings)) $this->psp_search_result_settings = get_option("psp_search_result_settings");
681
 
682
  if (is_search() && isset($s) && !empty($s)) {
 
683
  if (function_exists('attribute_escape')) {
684
  $search = attribute_escape($s);
685
  } else {
686
  $search = esc_attr($s);
687
  }
 
 
688
  $search = str_replace('+', ' ', $search);
689
  //$search = $this->capitalize($search);
690
  $search = ucwords($this->psp_helper->internationalize($search));
680
  if (empty($this->psp_search_result_settings)) $this->psp_search_result_settings = get_option("psp_search_result_settings");
681
 
682
  if (is_search() && isset($s) && !empty($s)) {
683
+ /***
684
  if (function_exists('attribute_escape')) {
685
  $search = attribute_escape($s);
686
  } else {
687
  $search = esc_attr($s);
688
  }
689
+ ***/
690
+ $search = esc_attr($s);
691
  $search = str_replace('+', ' ', $search);
692
  //$search = $this->capitalize($search);
693
  $search = ucwords($this->psp_helper->internationalize($search));
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_advanced_metabox_renderer.php CHANGED
@@ -9,7 +9,7 @@ Author URI: https://techblissonline.com/
9
  <p class="description"><?php esc_html_e( 'These are some settings specific to this page (post). If these are not set, appropriate defaults will be used for meta tags.However, you need to manually set the combined Json Schema for this page in the below mentioned option for Json schema support. ' , 'platinum-seo-pack'); ?> </p>
10
  <table class="form-table">
11
  <tr class="form-field">
12
- <th scope="row" valign="top"><label for="psp_index"><?php esc_html_e('Add index/noindex:', 'platinum_seo_pack') ?> </label></th>
13
  <td><?php if ( !empty($psp_seo_meta['noindex'])) { $noindex_checked = ' checked="checked" '; } else { $noindex_checked =""; }
14
  echo "<div class='psp-bs'><input ".esc_attr($noindex_checked)." id='psp_seo_meta[noindex]' name='psp_seo_meta[noindex]' type='checkbox' data-toggle='toggle' data-on='NoIndex' data-off='Index' data-onstyle='danger' data-offstyle='primary' data-width='100' /></div>";
15
  ?>
@@ -18,7 +18,7 @@ Author URI: https://techblissonline.com/
18
  </tr>
19
 
20
  <tr class="form-field">
21
- <th scope="row" valign="top"><label for="psp_index"><?php esc_html_e('Add follow/nofollow:', 'platinum_seo_pack') ?> </label></th>
22
  <td><?php if ( !empty($psp_seo_meta['nofollow'])) { $nofollow_checked = ' checked="checked" '; } else { $nofollow_checked =""; }
23
  echo "<div class='psp-bs'><input ".esc_attr($nofollow_checked)." id='psp_seo_meta[nofollow]' name='psp_seo_meta[nofollow]' type='checkbox' data-toggle='toggle' data-on='NoFollow' data-off='Follow' data-onstyle='warning' data-offstyle='primary' data-width='100' /></div>";
24
  ?>
9
  <p class="description"><?php esc_html_e( 'These are some settings specific to this page (post). If these are not set, appropriate defaults will be used for meta tags.However, you need to manually set the combined Json Schema for this page in the below mentioned option for Json schema support. ' , 'platinum-seo-pack'); ?> </p>
10
  <table class="form-table">
11
  <tr class="form-field">
12
+ <th scope="row" valign="top"><label for="psp_index"><?php esc_html_e('Add index/noindex:', 'platinum-seo-pack') ?> </label></th>
13
  <td><?php if ( !empty($psp_seo_meta['noindex'])) { $noindex_checked = ' checked="checked" '; } else { $noindex_checked =""; }
14
  echo "<div class='psp-bs'><input ".esc_attr($noindex_checked)." id='psp_seo_meta[noindex]' name='psp_seo_meta[noindex]' type='checkbox' data-toggle='toggle' data-on='NoIndex' data-off='Index' data-onstyle='danger' data-offstyle='primary' data-width='100' /></div>";
15
  ?>
18
  </tr>
19
 
20
  <tr class="form-field">
21
+ <th scope="row" valign="top"><label for="psp_index"><?php esc_html_e('Add follow/nofollow:', 'platinum-seo-pack') ?> </label></th>
22
  <td><?php if ( !empty($psp_seo_meta['nofollow'])) { $nofollow_checked = ' checked="checked" '; } else { $nofollow_checked =""; }
23
  echo "<div class='psp-bs'><input ".esc_attr($nofollow_checked)." id='psp_seo_meta[nofollow]' name='psp_seo_meta[nofollow]' type='checkbox' data-toggle='toggle' data-on='NoFollow' data-off='Follow' data-onstyle='warning' data-offstyle='primary' data-width='100' /></div>";
24
  ?>
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;
@@ -177,9 +181,9 @@ class PspRedirections {
177
  $psp_id = sanitize_key($psp_id);
178
 
179
  //$psp_source_url = isset($_POST['source-url-input']) ? esc_url_raw(html_entity_decode($_POST['source-url-input'])) : '';
180
- $psp_source_url = isset($_POST["psp-".$psp_id]) ? sanitize_text_field(html_entity_decode($_POST["psp-".$psp_id])) : '';
181
- $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
182
- $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
183
 
184
  if ($psp_action == 'addredirect' && !empty($psp_source_url) && !empty($psp_redirect_to) && !empty($psp_redirect_code)) {
185
  //Add new redirect
@@ -409,9 +413,9 @@ class PspRedirections {
409
 
410
  $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
411
 
412
- $psp_source_url = isset($_POST['source-url-input']) ? sanitize_text_field(html_entity_decode($_POST['source-url-input'])) : '';
413
- $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
414
- $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
415
  $psp_log = isset($_POST['psplog']) ? sanitize_key($_POST['psplog']) : '';
416
 
417
  if (!empty($psp_redir_type) && isset( $_POST['psp_urls_redirect_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_urls_redirect_actions_nonce']), 'do_psp_urls_redirect_actions' )) {
@@ -506,9 +510,9 @@ class PspRedirections {
506
 
507
  $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
508
 
509
- $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
510
- $psp_source_url = isset($_POST['source-url-input']) ? sanitize_text_field(html_entity_decode($_POST['source-url-input'])) : '';
511
- $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
512
  $psp_log = isset($_POST['psplog']) ? sanitize_key($_POST['psplog']) : '';
513
 
514
  //Update or Delete SQL here
@@ -680,10 +684,12 @@ class PspRedirections {
680
  include_once( 'psp_redirect_list_renderer.php' );
681
  }
682
 
683
- public function psp_handle_404() {
684
 
685
  global $wp;
686
  global $wpdb;
 
 
687
 
688
  $req_uri = '';
689
  $req_url = '';
@@ -700,10 +706,19 @@ class PspRedirections {
700
  }
701
  ***/
702
  list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
 
703
  if($req_uri) $req_url = home_url($req_uri);
704
  $requested_url = filter_var( $req_url, FILTER_VALIDATE_URL, '' );
705
  //error_log("path to page ".$path_to_page);
706
  //error_log("requested url ".$requested_url);
 
 
 
 
 
 
 
 
707
 
708
  $redirections = array();
709
  $psp_redirections_tbl = $wpdb->prefix . "psp_redirections";
@@ -712,10 +727,16 @@ 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
 
718
- $sql_redirections_1 = $wpdb->prepare("SELECT a.id AS psp_id, a.source_url AS psp_post_name, a.dest_url AS psp_redirect, a.redir_code AS psp_redirect_code, a.log_redirect AS psp_log_redirect FROM $psp_redirections_tbl a WHERE a.source_url = %s", $path_to_page );
 
 
719
 
720
  $sql_redirections_2 = $wpdb->prepare("SELECT a.id AS psp_id, a.source_url AS psp_post_name, a.dest_url AS psp_redirect, a.redir_code AS psp_redirect_code, a.log_redirect AS psp_log_redirect FROM $psp_redirections_tbl a WHERE a.source_url = %s", $requested_url );
721
 
@@ -724,7 +745,7 @@ class PspRedirections {
724
  //error_log("nothings exists for path ".$path_to_page);
725
  $redirections = $wpdb->get_results($sql_redirections_2, OBJECT);
726
  //error_log(print_r($redirections, true));
727
- }
728
 
729
  if (!$redirections) {
730
  //error_log("nothings exists for requested url ".$requested_url);
@@ -762,13 +783,19 @@ class PspRedirections {
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;
@@ -794,6 +821,10 @@ class PspRedirections {
794
  if($req_uri) $req_url = home_url($req_uri);
795
  $requested_url = filter_var( $req_url, FILTER_VALIDATE_URL, '' );
796
 
 
 
 
 
797
  $pspinsert['source_uri'] = !empty($req_uri) ? $req_uri : '';
798
  $pspinsert['source_url'] = !empty($requested_url) ? esc_url_raw($requested_url) : '';
799
 
@@ -851,17 +882,17 @@ class PspRedirections {
851
  ***/
852
  //$requested_url = trim(add_query_arg( $wp->query_vars, home_url( $wp->request ) ));
853
 
854
- //list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
855
- //if($req_uri) $req_url = home_url($req_uri);
856
- $req_url = home_url($_SERVER['REQUEST_URI']);
857
  $requested_url = filter_var( $req_url, FILTER_VALIDATE_URL, '' );
858
 
859
  if ( $bots_only ) {
860
  //$requested_url = trim(home_url( $wp->request ));
861
  }
862
 
863
- $pspinsert['source_uri'] = !empty($path_to_page) ? $path_to_page : '';
864
- $pspinsert['source_url'] = !empty($requested_url) ? esc_url_raw($requested_url) : '';
865
 
866
  if (empty($path_to_page) || empty($requested_url)) {
867
 
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']) ? trim(sanitize_text_field(html_entity_decode($_POST['source-url-input']))) : '';
153
+ $psp_redirect_to = isset($_POST['redirect-url-input']) ? trim(esc_url_raw(html_entity_decode($_POST['redirect-url-input']))) : '';
154
+ $psp_redirect_code = isset($_POST['psp-redirect-code']) ? trim(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;
181
  $psp_id = sanitize_key($psp_id);
182
 
183
  //$psp_source_url = isset($_POST['source-url-input']) ? esc_url_raw(html_entity_decode($_POST['source-url-input'])) : '';
184
+ $psp_source_url = isset($_POST["psp-".$psp_id]) ? trim(sanitize_text_field(html_entity_decode($_POST["psp-".$psp_id]))) : '';
185
+ $psp_redirect_to = isset($_POST['redirect-url-input']) ? trim(esc_url_raw(html_entity_decode($_POST['redirect-url-input']))) : '';
186
+ $psp_redirect_code = isset($_POST['psp-redirect-code']) ? trim(sanitize_key($_POST['psp-redirect-code'])) : '';
187
 
188
  if ($psp_action == 'addredirect' && !empty($psp_source_url) && !empty($psp_redirect_to) && !empty($psp_redirect_code)) {
189
  //Add new redirect
413
 
414
  $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
415
 
416
+ $psp_source_url = isset($_POST['source-url-input']) ? trim(sanitize_text_field(html_entity_decode($_POST['source-url-input']))) : '';
417
+ $psp_redirect_to = isset($_POST['redirect-url-input']) ? trim(esc_url_raw(html_entity_decode($_POST['redirect-url-input']))) : '';
418
+ $psp_redirect_code = isset($_POST['psp-redirect-code']) ? trim(sanitize_key($_POST['psp-redirect-code'])) : '';
419
  $psp_log = isset($_POST['psplog']) ? sanitize_key($_POST['psplog']) : '';
420
 
421
  if (!empty($psp_redir_type) && isset( $_POST['psp_urls_redirect_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_urls_redirect_actions_nonce']), 'do_psp_urls_redirect_actions' )) {
510
 
511
  $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
512
 
513
+ $psp_redirect_to = isset($_POST['redirect-url-input']) ? trim(esc_url_raw(html_entity_decode($_POST['redirect-url-input']))) : '';
514
+ $psp_source_url = isset($_POST['source-url-input']) ? trim(sanitize_text_field(html_entity_decode($_POST['source-url-input']))) : '';
515
+ $psp_redirect_code = isset($_POST['psp-redirect-code']) ? trim(sanitize_key($_POST['psp-redirect-code'])) : '';
516
  $psp_log = isset($_POST['psplog']) ? sanitize_key($_POST['psplog']) : '';
517
 
518
  //Update or Delete SQL here
684
  include_once( 'psp_redirect_list_renderer.php' );
685
  }
686
 
687
+ public function psp_handle_404() {
688
 
689
  global $wp;
690
  global $wpdb;
691
+
692
+ $psp_allowed_protocols = array('http','https');
693
 
694
  $req_uri = '';
695
  $req_url = '';
706
  }
707
  ***/
708
  list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
709
+ $req_uri = trim($req_uri);
710
  if($req_uri) $req_url = home_url($req_uri);
711
  $requested_url = filter_var( $req_url, FILTER_VALIDATE_URL, '' );
712
  //error_log("path to page ".$path_to_page);
713
  //error_log("requested url ".$requested_url);
714
+
715
+ if ( $requested_url ) {
716
+ $requested_url = trim(esc_url_raw( $requested_url, $psp_allowed_protocols ));
717
+ }
718
+
719
+ if ( !$requested_url ) {
720
+ return;
721
+ }
722
 
723
  $redirections = array();
724
  $psp_redirections_tbl = $wpdb->prefix . "psp_redirections";
727
  $do_auto_redirect = isset($psp_redirection_settings['auto_redirection']) ? ($psp_redirection_settings['auto_redirection']) : '';
728
 
729
  if ( is_404() ) {
730
+ /***commented in V2.0.9
731
+ if ($do_auto_redirect) {
732
+ $this->psp_auto_redirect();
733
+ }
734
+ ***/
735
  if ( $do_redirect ) {
736
 
737
+ $sql_redirections_1 = $wpdb->prepare("SELECT a.id AS psp_id, a.source_url AS psp_post_name, a.dest_url AS psp_redirect, a.redir_code AS psp_redirect_code, a.log_redirect AS psp_log_redirect FROM $psp_redirections_tbl a WHERE a.source_url IN ( %s, %s)", $path_to_page, $req_uri );
738
+
739
+ //$sql_redirections_1 = $wpdb->prepare("SELECT a.id AS psp_id, a.source_url AS psp_post_name, a.dest_url AS psp_redirect, a.redir_code AS psp_redirect_code, a.log_redirect AS psp_log_redirect FROM $psp_redirections_tbl a WHERE a.source_url = %s", $path_to_page );
740
 
741
  $sql_redirections_2 = $wpdb->prepare("SELECT a.id AS psp_id, a.source_url AS psp_post_name, a.dest_url AS psp_redirect, a.redir_code AS psp_redirect_code, a.log_redirect AS psp_log_redirect FROM $psp_redirections_tbl a WHERE a.source_url = %s", $requested_url );
742
 
745
  //error_log("nothings exists for path ".$path_to_page);
746
  $redirections = $wpdb->get_results($sql_redirections_2, OBJECT);
747
  //error_log(print_r($redirections, true));
748
+ }
749
 
750
  if (!$redirections) {
751
  //error_log("nothings exists for requested url ".$requested_url);
783
  if ($do_auto_redirect) {
784
  $this->psp_auto_redirect();
785
  }
786
+ //$this->psp_log_404();
787
 
788
  }
789
 
790
  return;
791
  }
792
 
793
+ public function psp_do_log_404() {
794
+ if (is_404()) {
795
+ $this->psp_log_404();
796
+ }
797
+ }
798
+
799
  public function psp_log_redirect($redirections) {
800
 
801
  global $wp;
821
  if($req_uri) $req_url = home_url($req_uri);
822
  $requested_url = filter_var( $req_url, FILTER_VALIDATE_URL, '' );
823
 
824
+ if(!$requested_url) {
825
+ return;
826
+ }
827
+
828
  $pspinsert['source_uri'] = !empty($req_uri) ? $req_uri : '';
829
  $pspinsert['source_url'] = !empty($requested_url) ? esc_url_raw($requested_url) : '';
830
 
882
  ***/
883
  //$requested_url = trim(add_query_arg( $wp->query_vars, home_url( $wp->request ) ));
884
 
885
+ list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
886
+ if($req_uri) $req_url = home_url($req_uri);
887
+ //$req_url = home_url($_SERVER['REQUEST_URI']);
888
  $requested_url = filter_var( $req_url, FILTER_VALIDATE_URL, '' );
889
 
890
  if ( $bots_only ) {
891
  //$requested_url = trim(home_url( $wp->request ));
892
  }
893
 
894
+ $pspinsert['source_uri'] = !empty($path_to_page) ? trim($path_to_page) : '';
895
+ $pspinsert['source_url'] = !empty($requested_url) ? trim(esc_url_raw($requested_url)) : '';
896
 
897
  if (empty($path_to_page) || empty($requested_url)) {
898
 
psp-include/settings/psp_settings.php CHANGED
@@ -479,7 +479,7 @@ class PspSettings {
479
 
480
  //Section
481
  $section_id = 'psp_separator_section';
482
- $section_title = esc_html__( 'Sitewide Title Settings', 'platinum_seo_pack' );
483
  add_settings_section( $section_id, $section_title, array( &$this, 'section_separator_desc' ), $this->psp_general_settings_group );
484
 
485
  //field
@@ -545,7 +545,7 @@ class PspSettings {
545
  //Section
546
  $section_id = 'psp_'.$setting_name.'_section';
547
  //$section_title = $setting_name_text.' Settings';
548
- $section_title = sprintf( esc_html__( 'Other %s Settings', 'platinum_seo_pack' ), $setting_name_text );
549
  add_settings_section( $section_id, $section_title, array( &$this, 'section_sitewidemeta_desc' ), $this->psp_general_settings_group );
550
 
551
  //Fields
@@ -767,7 +767,7 @@ class PspSettings {
767
  /************
768
  //sitelinks searchbox Section
769
  $section_id = 'psp_sitelinks_search_section';
770
- $section_title = __( 'Sitelinks Search Box in Google:', 'platinum_seo_pack' );
771
  add_settings_section( $section_id, $section_title, array( &$this, 'section_sitelinks_searchbox_desc' ), $this->psp_general_settings_group );
772
 
773
  //Enable sitelinks searchbox
@@ -798,7 +798,7 @@ class PspSettings {
798
  *******************/
799
  //Credits Section
800
  $section_id = 'psp_credit_section';
801
- $section_title = esc_html__( 'Credits:', 'platinum_seo_pack' );
802
  add_settings_section( $section_id, $section_title, array( &$this, 'section_empty_desc' ), $this->psp_general_settings_group );
803
 
804
  //Enable credits
@@ -825,7 +825,7 @@ class PspSettings {
825
 
826
  //Section
827
  $section_id = 'psp_cleanup_head_section';
828
- $section_title = esc_html__( 'Clean Up HTML Head Section', 'platinum_seo_pack' );
829
  add_settings_section( $section_id, $section_title, array( &$this, 'section_cleanup_head_desc' ), $this->psp_general_settings_group );
830
 
831
  //field
@@ -956,7 +956,7 @@ class PspSettings {
956
  $psp_settings_name = "psp_".$setting_name."_settings";
957
  //Section
958
  $section_id = 'psp_cleanup_comment_section';
959
- $section_title = esc_html__( 'Clean Up Comments Section', 'platinum_seo_pack' );
960
  add_settings_section( $section_id, $section_title, array( &$this, 'section_cleanup_comment_desc' ), $this->psp_general_settings_group );
961
 
962
  //fields
@@ -1171,7 +1171,7 @@ class PspSettings {
1171
 
1172
  //Section
1173
  $section_id = 'psp_breadcrumb_section';
1174
- $section_title = esc_html__( 'Breadcrumb Settings', 'platinum_seo_pack' );
1175
  add_settings_section( $section_id, $section_title, array( &$this, 'section_breadcrumb_desc' ), $this->psp_breadcrumb_settings_group );
1176
 
1177
  //yse default settings
@@ -1409,7 +1409,7 @@ class PspSettings {
1409
  //Section
1410
  $section_id = 'psp_'.$others_name.'_section';
1411
  //$section_title = $arc_name_text.' Settings';
1412
- $section_title = sprintf( esc_html__( '%s Settings', 'platinum_seo_pack' ), $arc_name_text );
1413
 
1414
  if ($others_name == "search_result") {
1415
 
@@ -1510,7 +1510,7 @@ class PspSettings {
1510
  //Section
1511
  $section_id = 'psp_'.$archive_name.'section';
1512
  //$section_title = $arc_name_text.' Settings';
1513
- $section_title = sprintf( esc_html__( '%s Settings', 'platinum_seo_pack' ), $arc_name_text );
1514
 
1515
  add_settings_section( $section_id, $section_title, array( &$this, 'section_archives_desc' ), $this->psp_archives_settings_group );
1516
 
@@ -1599,7 +1599,7 @@ class PspSettings {
1599
  $noarchive_field_title = "";//esc_html__('Do not show cached link in SERPS: ', 'platinum-seo-pack');
1600
  $nosnippet_field_title = "";//esc_html__('Do not show snippet in SERPS: ', 'platinum-seo-pack');
1601
  //$disable_field_title = 'Disable '.$arc_name_text. ' : ';
1602
- //$disable_field_title = sprintf( esc_html__( 'Disable %s :', 'platinum_seo_pack' ), $arc_name_text );
1603
  $redirect_field_title = esc_html__('Redirect To: ', 'platinum-seo-pack');
1604
  $redirectcode_field_title ="";// esc_html__('Use: ', 'platinum-seo-pack');
1605
 
@@ -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
  }
@@ -1925,7 +1947,7 @@ class PspSettings {
1925
 
1926
  //sitelinks searchbox Section
1927
  $section_id = 'psp_sitelinks_search_section';
1928
- $section_title = esc_html__( 'Sitelinks Search Box in Google', 'platinum_seo_pack' );
1929
  add_settings_section( $section_id, $section_title, array( &$this, 'section_sitelinks_searchbox_desc' ), $this->psp_other_settings_group );
1930
 
1931
  //Enable sitelinks searchbox
@@ -2231,7 +2253,7 @@ class PspSettings {
2231
 
2232
  $section_id = 'psp_'.$tax_name.'_section';
2233
  //$section_title = $tax_name_text.' Settings';
2234
- $section_title = sprintf( esc_html__( '%s Settings', 'platinum_seo_pack' ), $tax_name_text );
2235
 
2236
  $title_field_id = 'psp_'.$tax_name.'_title';
2237
  $desc_field_id = 'psp_'.$tax_name.'_desc';
@@ -2246,7 +2268,7 @@ class PspSettings {
2246
  $title_field_title = esc_html__('Title Format: ', 'platinum-seo-pack');
2247
  $desc_field_title = esc_html__('Meta Description Format: ','platinum-seo-pack');
2248
  $robots_field_title = esc_html__('Meta Robots: ', 'platinum-seo-pack');
2249
- $metabox_field_title = sprintf( esc_html__( 'Hide %s Metabox:', 'platinum_seo_pack' ), $tax_name_text );
2250
 
2251
  //wp_register_script( 'psp-taxtags-js', plugins_url( '/js/psp_post_tags.js', __FILE__ ), array( 'jquery-ui-autocomplete', 'jquery' ) );
2252
  //wp_enqueue_script('psp-taxtags-js');
@@ -2413,8 +2435,8 @@ class PspSettings {
2413
 
2414
  $section_id = 'psp_'.$posttype_name.'_section';
2415
  //$section_title = $posttype_name_text.' Settings';
2416
- $section_title = sprintf( esc_html__( '%s Settings', 'platinum_seo_pack' ), $posttype_name_text );
2417
- if ($posttype_name == "attachment") $section_title = sprintf( esc_html__( '%s (Media) Settings', 'platinum_seo_pack' ), $posttype_name_text );
2418
 
2419
  $title_field_id = 'psp_'.$posttype_name.'_title';
2420
  $desc_field_id = 'psp_'.$posttype_name.'_desc';
@@ -2433,7 +2455,7 @@ class PspSettings {
2433
  $desc_field_title = esc_html__('Meta Description Format: ','platinum-seo-pack');
2434
  $header_field_title = 'Additional '.$posttype_name_text. ' Headers: ';
2435
  $robots_field_title = esc_html__('Meta Robots: ', 'platinum-seo-pack');
2436
- $metabox_field_title = sprintf( esc_html__( 'Hide %s Metabox:', 'platinum_seo_pack' ), $posttype_name_text );
2437
  $breadcrumb_tax_field_title = esc_html__('Taxonomy for breadcrumb trail: ', 'platinum-seo-pack');
2438
 
2439
  //wp_register_script( 'psp-posttags-js', plugins_url( '/js/psp_post_tags.js', __FILE__ ), array('psp-tagit-js') );
@@ -2767,7 +2789,7 @@ class PspSettings {
2767
  function add_admin_menus() {
2768
  //add_options_page( 'Platinum SEO New Settings', 'My Settings', 'manage_options', $this->psp_plugin_options_key, array( &$this, 'psp_options_page' ) );
2769
  add_menu_page(esc_html__('Techblissonline Platinum SEO and social Pack', 'platinum-seo-pack'), esc_html__('Platinum SEO and Social Pack', 'platinum-seo-pack'), 'manage_options', $this->psp_plugin_options_key, array($this, 'psp_options_page'), plugins_url( 'images/techblissonline-platinum-seo-pack.ico', dirname(dirname(__FILE__) )));
2770
- add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO and social Pack', 'platinum_seo_pack'), '<span class="dashicons dashicons-admin-settings"></span> '.esc_html__('SEO', 'platinum_seo_pack'), 'manage_options', $this->psp_plugin_options_key);
2771
  $psp_settings = get_option('psp_pre_setting');
2772
  $psp_premium_valid = isset($psp_settings['premium']) ? $psp_settings['premium'] : '';
2773
  $psp_premium_status = isset($psp_settings['psp_premium_license_key_status']) ? $psp_settings['psp_premium_license_key_status'] : '';
@@ -2776,15 +2798,15 @@ class PspSettings {
2776
  //$psp_premium_valid = 1;
2777
  //$psp_premium_status = 1;
2778
  //if ($psp_premium_valid && $psp_premium_status)
2779
- add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Social', 'platinum_seo_pack'), '<span class="dashicons dashicons-admin-settings"></span> '.esc_html__('Social', 'platinum_seo_pack'), 'manage_options', 'psp-social-by-techblissonline', array($this->psp_social_instance, 'psp_social_options_page'));
2780
- //add_submenu_page($this->psp_plugin_options_key, __('Techblissonline Platinum SEO Premium Pack', 'platinum_seo_pack'), __('SEO - Advanced', 'platinum_seo_pack'), 'manage_options', 'webmastertools', array($this->psp_wmt_instance, 'psp_wmt_options_page'));
2781
- //add_submenu_page($this->psp_plugin_options_key, __('Techblissonline Platinum SEO Analytics', 'platinum_seo_pack'), __('SEO - Analytics', 'platinum_seo_pack'), 'manage_options', 'psp-gatracking-by-techblissonline', array($this->psp_ga_instance, 'psp_ga_options_page'));
2782
- add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Tools', 'platinum_seo_pack'), '<span class="dashicons dashicons-edit"></span> '.esc_html__('SEO - Editors', 'platinum_seo_pack'), 'manage_options', 'psp-tools-by-techblissonline', array($this->psp_tools_instance, 'psp_tools_options_page'));
2783
- add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Premium Pack', 'platinum_seo_pack'), '<span class="dashicons dashicons-admin-tools"></span> '.esc_html__(' SEO Tools', 'platinum_seo_pack'), 'manage_options', 'psp-seo-tools-by-techblissonline', array( &$this, 'psp_pre_tools_display_page'));
2784
- $psp_redir_page = add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Redirections', 'platinum_seo_pack'), '<span class="dashicons dashicons-admin-tools"></span> '.esc_html__('Redirections', 'platinum_seo_pack'), 'manage_options', 'redirectionmanager', array($this->psp_redirect_instance, 'redir_mgmtpage'));
2785
- $psp_404_page = add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO 404 Manager', 'platinum_seo_pack'), '<span class="dashicons dashicons-admin-tools"></span> '.esc_html__('Manage 404 Errors', 'platinum_seo_pack'), 'manage_options', 'manager404', array($this->psp_redirect_instance, 'manage_404_page'));
2786
- //add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Premium Pack', 'platinum_seo_pack'), __('Techblissonline - SEO Tools', 'platinum_seo_pack'), 'manage_options', 'psp-seo-tools-by-techblissonline', array($this->psp_pre_instance, 'psp_pre_options_page'));
2787
- if ($psp_premium_valid) add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Premium Pack', 'platinum_seo_pack'), '<span class="dashicons dashicons-admin-network"></span> '.esc_html__('Premium - Licenses', 'platinum_seo_pack'), 'manage_options', 'pspp-licenses', array($this->psp_pre_instance, 'psp_premium_options_page'));
2788
  }
2789
 
2790
  function psp_pre_tools_display_page() {
479
 
480
  //Section
481
  $section_id = 'psp_separator_section';
482
+ $section_title = esc_html__( 'Sitewide Title Settings', 'platinum-seo-pack' );
483
  add_settings_section( $section_id, $section_title, array( &$this, 'section_separator_desc' ), $this->psp_general_settings_group );
484
 
485
  //field
545
  //Section
546
  $section_id = 'psp_'.$setting_name.'_section';
547
  //$section_title = $setting_name_text.' Settings';
548
+ $section_title = sprintf( esc_html__( 'Other %s Settings', 'platinum-seo-pack' ), $setting_name_text );
549
  add_settings_section( $section_id, $section_title, array( &$this, 'section_sitewidemeta_desc' ), $this->psp_general_settings_group );
550
 
551
  //Fields
767
  /************
768
  //sitelinks searchbox Section
769
  $section_id = 'psp_sitelinks_search_section';
770
+ $section_title = __( 'Sitelinks Search Box in Google:', 'platinum-seo-pack' );
771
  add_settings_section( $section_id, $section_title, array( &$this, 'section_sitelinks_searchbox_desc' ), $this->psp_general_settings_group );
772
 
773
  //Enable sitelinks searchbox
798
  *******************/
799
  //Credits Section
800
  $section_id = 'psp_credit_section';
801
+ $section_title = esc_html__( 'Credits:', 'platinum-seo-pack' );
802
  add_settings_section( $section_id, $section_title, array( &$this, 'section_empty_desc' ), $this->psp_general_settings_group );
803
 
804
  //Enable credits
825
 
826
  //Section
827
  $section_id = 'psp_cleanup_head_section';
828
+ $section_title = esc_html__( 'Clean Up HTML Head Section', 'platinum-seo-pack' );
829
  add_settings_section( $section_id, $section_title, array( &$this, 'section_cleanup_head_desc' ), $this->psp_general_settings_group );
830
 
831
  //field
956
  $psp_settings_name = "psp_".$setting_name."_settings";
957
  //Section
958
  $section_id = 'psp_cleanup_comment_section';
959
+ $section_title = esc_html__( 'Clean Up Comments Section', 'platinum-seo-pack' );
960
  add_settings_section( $section_id, $section_title, array( &$this, 'section_cleanup_comment_desc' ), $this->psp_general_settings_group );
961
 
962
  //fields
1171
 
1172
  //Section
1173
  $section_id = 'psp_breadcrumb_section';
1174
+ $section_title = esc_html__( 'Breadcrumb Settings', 'platinum-seo-pack' );
1175
  add_settings_section( $section_id, $section_title, array( &$this, 'section_breadcrumb_desc' ), $this->psp_breadcrumb_settings_group );
1176
 
1177
  //yse default settings
1409
  //Section
1410
  $section_id = 'psp_'.$others_name.'_section';
1411
  //$section_title = $arc_name_text.' Settings';
1412
+ $section_title = sprintf( esc_html__( '%s Settings', 'platinum-seo-pack' ), $arc_name_text );
1413
 
1414
  if ($others_name == "search_result") {
1415
 
1510
  //Section
1511
  $section_id = 'psp_'.$archive_name.'section';
1512
  //$section_title = $arc_name_text.' Settings';
1513
+ $section_title = sprintf( esc_html__( '%s Settings', 'platinum-seo-pack' ), $arc_name_text );
1514
 
1515
  add_settings_section( $section_id, $section_title, array( &$this, 'section_archives_desc' ), $this->psp_archives_settings_group );
1516
 
1599
  $noarchive_field_title = "";//esc_html__('Do not show cached link in SERPS: ', 'platinum-seo-pack');
1600
  $nosnippet_field_title = "";//esc_html__('Do not show snippet in SERPS: ', 'platinum-seo-pack');
1601
  //$disable_field_title = 'Disable '.$arc_name_text. ' : ';
1602
+ //$disable_field_title = sprintf( esc_html__( 'Disable %s :', 'platinum-seo-pack' ), $arc_name_text );
1603
  $redirect_field_title = esc_html__('Redirect To: ', 'platinum-seo-pack');
1604
  $redirectcode_field_title ="";// esc_html__('Use: ', 'platinum-seo-pack');
1605
 
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
  }
1947
 
1948
  //sitelinks searchbox Section
1949
  $section_id = 'psp_sitelinks_search_section';
1950
+ $section_title = esc_html__( 'Sitelinks Search Box in Google', 'platinum-seo-pack' );
1951
  add_settings_section( $section_id, $section_title, array( &$this, 'section_sitelinks_searchbox_desc' ), $this->psp_other_settings_group );
1952
 
1953
  //Enable sitelinks searchbox
2253
 
2254
  $section_id = 'psp_'.$tax_name.'_section';
2255
  //$section_title = $tax_name_text.' Settings';
2256
+ $section_title = sprintf( esc_html__( '%s Settings', 'platinum-seo-pack' ), $tax_name_text );
2257
 
2258
  $title_field_id = 'psp_'.$tax_name.'_title';
2259
  $desc_field_id = 'psp_'.$tax_name.'_desc';
2268
  $title_field_title = esc_html__('Title Format: ', 'platinum-seo-pack');
2269
  $desc_field_title = esc_html__('Meta Description Format: ','platinum-seo-pack');
2270
  $robots_field_title = esc_html__('Meta Robots: ', 'platinum-seo-pack');
2271
+ $metabox_field_title = sprintf( esc_html__( 'Hide %s Metabox:', 'platinum-seo-pack' ), $tax_name_text );
2272
 
2273
  //wp_register_script( 'psp-taxtags-js', plugins_url( '/js/psp_post_tags.js', __FILE__ ), array( 'jquery-ui-autocomplete', 'jquery' ) );
2274
  //wp_enqueue_script('psp-taxtags-js');
2435
 
2436
  $section_id = 'psp_'.$posttype_name.'_section';
2437
  //$section_title = $posttype_name_text.' Settings';
2438
+ $section_title = sprintf( esc_html__( '%s Settings', 'platinum-seo-pack' ), $posttype_name_text );
2439
+ if ($posttype_name == "attachment") $section_title = sprintf( esc_html__( '%s (Media) Settings', 'platinum-seo-pack' ), $posttype_name_text );
2440
 
2441
  $title_field_id = 'psp_'.$posttype_name.'_title';
2442
  $desc_field_id = 'psp_'.$posttype_name.'_desc';
2455
  $desc_field_title = esc_html__('Meta Description Format: ','platinum-seo-pack');
2456
  $header_field_title = 'Additional '.$posttype_name_text. ' Headers: ';
2457
  $robots_field_title = esc_html__('Meta Robots: ', 'platinum-seo-pack');
2458
+ $metabox_field_title = sprintf( esc_html__( 'Hide %s Metabox:', 'platinum-seo-pack' ), $posttype_name_text );
2459
  $breadcrumb_tax_field_title = esc_html__('Taxonomy for breadcrumb trail: ', 'platinum-seo-pack');
2460
 
2461
  //wp_register_script( 'psp-posttags-js', plugins_url( '/js/psp_post_tags.js', __FILE__ ), array('psp-tagit-js') );
2789
  function add_admin_menus() {
2790
  //add_options_page( 'Platinum SEO New Settings', 'My Settings', 'manage_options', $this->psp_plugin_options_key, array( &$this, 'psp_options_page' ) );
2791
  add_menu_page(esc_html__('Techblissonline Platinum SEO and social Pack', 'platinum-seo-pack'), esc_html__('Platinum SEO and Social Pack', 'platinum-seo-pack'), 'manage_options', $this->psp_plugin_options_key, array($this, 'psp_options_page'), plugins_url( 'images/techblissonline-platinum-seo-pack.ico', dirname(dirname(__FILE__) )));
2792
+ add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO and social Pack', 'platinum-seo-pack'), '<span class="dashicons dashicons-admin-settings"></span> '.esc_html__('SEO', 'platinum-seo-pack'), 'manage_options', $this->psp_plugin_options_key);
2793
  $psp_settings = get_option('psp_pre_setting');
2794
  $psp_premium_valid = isset($psp_settings['premium']) ? $psp_settings['premium'] : '';
2795
  $psp_premium_status = isset($psp_settings['psp_premium_license_key_status']) ? $psp_settings['psp_premium_license_key_status'] : '';
2798
  //$psp_premium_valid = 1;
2799
  //$psp_premium_status = 1;
2800
  //if ($psp_premium_valid && $psp_premium_status)
2801
+ add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Social', 'platinum-seo-pack'), '<span class="dashicons dashicons-admin-settings"></span> '.esc_html__('Social', 'platinum-seo-pack'), 'manage_options', 'psp-social-by-techblissonline', array($this->psp_social_instance, 'psp_social_options_page'));
2802
+ //add_submenu_page($this->psp_plugin_options_key, __('Techblissonline Platinum SEO Premium Pack', 'platinum-seo-pack'), __('SEO - Advanced', 'platinum-seo-pack'), 'manage_options', 'webmastertools', array($this->psp_wmt_instance, 'psp_wmt_options_page'));
2803
+ //add_submenu_page($this->psp_plugin_options_key, __('Techblissonline Platinum SEO Analytics', 'platinum-seo-pack'), __('SEO - Analytics', 'platinum-seo-pack'), 'manage_options', 'psp-gatracking-by-techblissonline', array($this->psp_ga_instance, 'psp_ga_options_page'));
2804
+ add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Tools', 'platinum-seo-pack'), '<span class="dashicons dashicons-edit"></span> '.esc_html__('SEO - Editors', 'platinum-seo-pack'), 'manage_options', 'psp-tools-by-techblissonline', array($this->psp_tools_instance, 'psp_tools_options_page'));
2805
+ add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Premium Pack', 'platinum-seo-pack'), '<span class="dashicons dashicons-admin-tools"></span> '.esc_html__(' SEO Tools', 'platinum-seo-pack'), 'manage_options', 'psp-seo-tools-by-techblissonline', array( &$this, 'psp_pre_tools_display_page'));
2806
+ $psp_redir_page = add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Redirections', 'platinum-seo-pack'), '<span class="dashicons dashicons-admin-tools"></span> '.esc_html__('Redirections', 'platinum-seo-pack'), 'manage_options', 'redirectionmanager', array($this->psp_redirect_instance, 'redir_mgmtpage'));
2807
+ $psp_404_page = add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO 404 Manager', 'platinum-seo-pack'), '<span class="dashicons dashicons-admin-tools"></span> '.esc_html__('Manage 404 Errors', 'platinum-seo-pack'), 'manage_options', 'manager404', array($this->psp_redirect_instance, 'manage_404_page'));
2808
+ //add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Premium Pack', 'platinum-seo-pack'), __('Techblissonline - SEO Tools', 'platinum-seo-pack'), 'manage_options', 'psp-seo-tools-by-techblissonline', array($this->psp_pre_instance, 'psp_pre_options_page'));
2809
+ if ($psp_premium_valid) add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Premium Pack', 'platinum-seo-pack'), '<span class="dashicons dashicons-admin-network"></span> '.esc_html__('Premium - Licenses', 'platinum-seo-pack'), 'manage_options', 'pspp-licenses', array($this->psp_pre_instance, 'psp_premium_options_page'));
2810
  }
2811
 
2812
  function psp_pre_tools_display_page() {
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,51 @@ 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 ) {
@@ -1287,25 +1348,27 @@ class PspMain {
1287
  return;
1288
  }
1289
 
1290
- if($wpdb->get_var("show tables like '$psp_redirections_tbl'") != $psp_redirections_tbl)
1291
- {
1292
- $psp_sql = "CREATE TABLE $psp_redirections_tbl (
 
1293
  id mediumint(9) NOT NULL AUTO_INCREMENT,
1294
  source_url varchar(255) DEFAULT '' NOT NULL,
1295
  dest_url varchar(255) DEFAULT '' NOT NULL,
1296
  redir_code varchar(55) DEFAULT '' NOT NULL,
1297
  log_redirect varchar(10) DEFAULT '' NOT NULL,
1298
  created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
1299
- PRIMARY KEY (id)
 
1300
  ) $charset_collate;";
1301
 
1302
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1303
- dbDelta( $psp_sql );
1304
- }
1305
 
1306
- if($wpdb->get_var("show tables like '$psp_redirections_log'") != $psp_redirections_log)
1307
- {
1308
- $psp_sql = "CREATE TABLE $psp_redirections_log (
1309
  id mediumint(9) NOT NULL AUTO_INCREMENT,
1310
  source_uri varchar(255) DEFAULT '' NOT NULL,
1311
  source_url varchar(255) DEFAULT '' NOT NULL,
@@ -1318,13 +1381,13 @@ class PspMain {
1318
  PRIMARY KEY (id)
1319
  ) $charset_collate;";
1320
 
1321
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1322
- dbDelta( $psp_sql );
1323
- }
1324
 
1325
- if($wpdb->get_var("show tables like '$psp_404_log'") != $psp_404_log)
1326
- {
1327
- $psp_sql = "CREATE TABLE $psp_404_log (
1328
  id mediumint(9) NOT NULL AUTO_INCREMENT,
1329
  source_uri varchar(255) DEFAULT '' NOT NULL,
1330
  source_url varchar(255) DEFAULT '' NOT NULL,
@@ -1338,12 +1401,599 @@ class PspMain {
1338
  PRIMARY KEY (id)
1339
  ) $charset_collate;";
1340
 
1341
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1342
- dbDelta( $psp_sql );
1343
- }
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
+ delete_user_meta( $user_id, 'psp_ignore_notice_v_208' );
253
+ add_user_meta( $user_id, 'psp_ignore_notice_v_209', true, true );
254
+ };
255
+ }
256
+
257
+ public function platinum_seo_admin_notice__success() {
258
+ $user_id = get_current_user_id();
259
+ if ( get_user_meta( $user_id, 'psp_ignore_notice_v_209', true ) ) return;
260
+ global $pagenow;
261
+ $psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
262
+ if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
263
+ ?>
264
+ <div class="notice notice-success is-dismissible">
265
+ <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.9 and V2.0.8!', 'platinum-seo-pack' ).'</a>'.'<a href="'. esc_url( add_query_arg( [
266
+ 'psp_ignore_notice' => '1',
267
+ ] ) ) .'" 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>
268
+ </div>
269
+ <?php
270
+ }
271
+ }
272
 
273
+ public function psp_disable_404_redirect_guessing( $url ) {
274
+ return ( is_404() ) ? false : $url;
275
+ }
276
+ //v2.0.8
277
  public static function get_instance() {
278
 
279
  if ( null == self::$obj_handle ) {
1348
  return;
1349
  }
1350
 
1351
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1352
+ //if($wpdb->get_var("show tables like '$psp_redirections_tbl'") != $psp_redirections_tbl)
1353
+ //{
1354
+ $psp_sql_1 = "CREATE TABLE $psp_redirections_tbl (
1355
  id mediumint(9) NOT NULL AUTO_INCREMENT,
1356
  source_url varchar(255) DEFAULT '' NOT NULL,
1357
  dest_url varchar(255) DEFAULT '' NOT NULL,
1358
  redir_code varchar(55) DEFAULT '' NOT NULL,
1359
  log_redirect varchar(10) DEFAULT '' NOT NULL,
1360
  created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
1361
+ PRIMARY KEY (id),
1362
+ KEY source_url (source_url)
1363
  ) $charset_collate;";
1364
 
1365
+ //require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1366
+ dbDelta( $psp_sql_1 );
1367
+ //}
1368
 
1369
+ //if($wpdb->get_var("show tables like '$psp_redirections_log'") != $psp_redirections_log)
1370
+ //{
1371
+ $psp_sql_2 = "CREATE TABLE $psp_redirections_log (
1372
  id mediumint(9) NOT NULL AUTO_INCREMENT,
1373
  source_uri varchar(255) DEFAULT '' NOT NULL,
1374
  source_url varchar(255) DEFAULT '' NOT NULL,
1381
  PRIMARY KEY (id)
1382
  ) $charset_collate;";
1383
 
1384
+ //require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1385
+ dbDelta( $psp_sql_2 );
1386
+ //}
1387
 
1388
+ //if($wpdb->get_var("show tables like '$psp_404_log'") != $psp_404_log)
1389
+ //{
1390
+ $psp_sql_3 = "CREATE TABLE $psp_404_log (
1391
  id mediumint(9) NOT NULL AUTO_INCREMENT,
1392
  source_uri varchar(255) DEFAULT '' NOT NULL,
1393
  source_url varchar(255) DEFAULT '' NOT NULL,
1401
  PRIMARY KEY (id)
1402
  ) $charset_collate;";
1403
 
1404
+ //require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1405
+ dbDelta( $psp_sql_3 );
1406
+ //}
1407
 
1408
+ update_option( 'psp_db_version', $psp_db_version );
1409
 
1410
+ }
1411
+ //same as redirect_canonical in WordPress Core but redirect_guess_404_permalink() has been disabled
1412
+ //this function replaces redirect_canonical function in WordPress template_redirect hooks
1413
+ //this is done because redirect_guess_404_permalink() does not have any filters (as of WordPress 5.4) for plugin to hook into
1414
+ public function psp_redirect_canonical( $requested_url = null, $do_redirect = true ) {
1415
+ global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
1416
+
1417
+ if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ) ) ) {
1418
+ return;
1419
+ }
1420
+
1421
+ // If we're not in wp-admin and the post has been published and preview nonce
1422
+ // is non-existent or invalid then no need for preview in query.
1423
+ if ( is_preview() && get_query_var( 'p' ) && 'publish' == get_post_status( get_query_var( 'p' ) ) ) {
1424
+ if ( ! isset( $_GET['preview_id'] )
1425
+ || ! isset( $_GET['preview_nonce'] )
1426
+ || ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ) ) {
1427
+ $wp_query->is_preview = false;
1428
+ }
1429
+ }
1430
+
1431
+ if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() ) ) {
1432
+ return;
1433
+ }
1434
+
1435
+ if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
1436
+ // Build the URL in the address bar.
1437
+ $requested_url = is_ssl() ? 'https://' : 'http://';
1438
+ $requested_url .= $_SERVER['HTTP_HOST'];
1439
+ $requested_url .= $_SERVER['REQUEST_URI'];
1440
+ }
1441
+
1442
+ $original = @parse_url( $requested_url );
1443
+ if ( false === $original ) {
1444
+ return;
1445
+ }
1446
+
1447
+ $redirect = $original;
1448
+ $redirect_url = false;
1449
+
1450
+ // Notice fixing.
1451
+ if ( ! isset( $redirect['path'] ) ) {
1452
+ $redirect['path'] = '';
1453
+ }
1454
+ if ( ! isset( $redirect['query'] ) ) {
1455
+ $redirect['query'] = '';
1456
+ }
1457
+
1458
+ /*
1459
+ * If the original URL ended with non-breaking spaces, they were almost
1460
+ * certainly inserted by accident. Let's remove them, so the reader doesn't
1461
+ * see a 404 error with no obvious cause.
1462
+ */
1463
+ $redirect['path'] = preg_replace( '|(%C2%A0)+$|i', '', $redirect['path'] );
1464
+
1465
+ // It's not a preview, so remove it from URL.
1466
+ if ( get_query_var( 'preview' ) ) {
1467
+ $redirect['query'] = remove_query_arg( 'preview', $redirect['query'] );
1468
+ }
1469
+
1470
+ $id = get_query_var( 'p' );
1471
+
1472
+ if ( is_feed() && $id ) {
1473
+ $redirect_url = get_post_comments_feed_link( $id, get_query_var( 'feed' ) );
1474
+ if ( $redirect_url ) {
1475
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed' ), $redirect_url );
1476
+ $redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH );
1477
+ }
1478
+ }
1479
+
1480
+ if ( is_singular() && 1 > $wp_query->post_count && $id ) {
1481
+
1482
+ $vars = $wpdb->get_results( $wpdb->prepare( "SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $id ) );
1483
+
1484
+ if ( ! empty( $vars[0] ) ) {
1485
+ $vars = $vars[0];
1486
+ if ( 'revision' == $vars->post_type && $vars->post_parent > 0 ) {
1487
+ $id = $vars->post_parent;
1488
+ }
1489
+
1490
+ $redirect_url = get_permalink( $id );
1491
+ if ( $redirect_url ) {
1492
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
1493
+ }
1494
+ }
1495
+ }
1496
+
1497
+ // These tests give us a WP-generated permalink.
1498
+ if ( is_404() ) {
1499
+
1500
+ // Redirect ?page_id, ?p=, ?attachment_id= to their respective URLs.
1501
+ $id = max( get_query_var( 'p' ), get_query_var( 'page_id' ), get_query_var( 'attachment_id' ) );
1502
+ $redirect_post = $id ? get_post( $id ) : false;
1503
+ if ( $redirect_post ) {
1504
+ $post_type_obj = get_post_type_object( $redirect_post->post_type );
1505
+ if ( $post_type_obj->public && 'auto-draft' != $redirect_post->post_status ) {
1506
+ $redirect_url = get_permalink( $redirect_post );
1507
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
1508
+ }
1509
+ }
1510
+
1511
+ if ( get_query_var( 'day' ) && get_query_var( 'monthnum' ) && get_query_var( 'year' ) ) {
1512
+ $year = get_query_var( 'year' );
1513
+ $month = get_query_var( 'monthnum' );
1514
+ $day = get_query_var( 'day' );
1515
+ $date = sprintf( '%04d-%02d-%02d', $year, $month, $day );
1516
+ if ( ! wp_checkdate( $month, $day, $year, $date ) ) {
1517
+ $redirect_url = get_month_link( $year, $month );
1518
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url );
1519
+ }
1520
+ } elseif ( get_query_var( 'monthnum' ) && get_query_var( 'year' ) && 12 < get_query_var( 'monthnum' ) ) {
1521
+ $redirect_url = get_year_link( get_query_var( 'year' ) );
1522
+ $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url );
1523
+ }
1524
+ /***commenting guessing***
1525
+ if ( ! $redirect_url ) {
1526
+ $redirect_url = redirect_guess_404_permalink();
1527
+ if ( $redirect_url ) {
1528
+ $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 );
1529
+ }
1530
+ }
1531
+ ****/
1532
+ if ( get_query_var( 'page' ) && $wp_query->post &&
1533
+ false !== strpos( $wp_query->post->post_content, '<!--nextpage-->' ) ) {
1534
+ $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' );
1535
+ $redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
1536
+ $redirect_url = get_permalink( $wp_query->post->ID );
1537
+ }
1538
+ } elseif ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) {
1539
+ // Rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101.
1540
+ if ( is_attachment() &&
1541
+ ! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) ) &&
1542
+ ! $redirect_url ) {
1543
+ if ( ! empty( $_GET['attachment_id'] ) ) {
1544
+ $redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) );
1545
+ if ( $redirect_url ) {
1546
+ $redirect['query'] = remove_query_arg( 'attachment_id', $redirect['query'] );
1547
+ }
1548
+ } else {
1549
+ $redirect_url = get_attachment_link();
1550
+ }
1551
+ } elseif ( is_single() && ! empty( $_GET['p'] ) && ! $redirect_url ) {
1552
+ $redirect_url = get_permalink( get_query_var( 'p' ) );
1553
+ if ( $redirect_url ) {
1554
+ $redirect['query'] = remove_query_arg( array( 'p', 'post_type' ), $redirect['query'] );
1555
+ }
1556
+ } elseif ( is_single() && ! empty( $_GET['name'] ) && ! $redirect_url ) {
1557
+ $redirect_url = get_permalink( $wp_query->get_queried_object_id() );
1558
+ if ( $redirect_url ) {
1559
+ $redirect['query'] = remove_query_arg( 'name', $redirect['query'] );
1560
+ }
1561
+ } elseif ( is_page() && ! empty( $_GET['page_id'] ) && ! $redirect_url ) {
1562
+ $redirect_url = get_permalink( get_query_var( 'page_id' ) );
1563
+ if ( $redirect_url ) {
1564
+ $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
1565
+ }
1566
+ } elseif ( is_page() && ! is_feed() && 'page' == get_option( 'show_on_front' ) && get_queried_object_id() == get_option( 'page_on_front' ) && ! $redirect_url ) {
1567
+ $redirect_url = home_url( '/' );
1568
+ } 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 ) {
1569
+ $redirect_url = get_permalink( get_option( 'page_for_posts' ) );
1570
+ if ( $redirect_url ) {
1571
+ $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
1572
+ }
1573
+ } elseif ( ! empty( $_GET['m'] ) && ( is_year() || is_month() || is_day() ) ) {
1574
+ $m = get_query_var( 'm' );
1575
+ switch ( strlen( $m ) ) {
1576
+ case 4: // Yearly.
1577
+ $redirect_url = get_year_link( $m );
1578
+ break;
1579
+ case 6: // Monthly.
1580
+ $redirect_url = get_month_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ) );
1581
+ break;
1582
+ case 8: // Daily.
1583
+ $redirect_url = get_day_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ), substr( $m, 6, 2 ) );
1584
+ break;
1585
+ }
1586
+ if ( $redirect_url ) {
1587
+ $redirect['query'] = remove_query_arg( 'm', $redirect['query'] );
1588
+ }
1589
+ // Now moving on to non ?m=X year/month/day links.
1590
+ } elseif ( is_day() && get_query_var( 'year' ) && get_query_var( 'monthnum' ) && ! empty( $_GET['day'] ) ) {
1591
+ $redirect_url = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
1592
+ if ( $redirect_url ) {
1593
+ $redirect['query'] = remove_query_arg( array( 'year', 'monthnum', 'day' ), $redirect['query'] );
1594
+ }
1595
+ } elseif ( is_month() && get_query_var( 'year' ) && ! empty( $_GET['monthnum'] ) ) {
1596
+ $redirect_url = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
1597
+ if ( $redirect_url ) {
1598
+ $redirect['query'] = remove_query_arg( array( 'year', 'monthnum' ), $redirect['query'] );
1599
+ }
1600
+ } elseif ( is_year() && ! empty( $_GET['year'] ) ) {
1601
+ $redirect_url = get_year_link( get_query_var( 'year' ) );
1602
+ if ( $redirect_url ) {
1603
+ $redirect['query'] = remove_query_arg( 'year', $redirect['query'] );
1604
+ }
1605
+ } elseif ( is_author() && ! empty( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
1606
+ $author = get_userdata( get_query_var( 'author' ) );
1607
+ 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 ) ) ) {
1608
+ $redirect_url = get_author_posts_url( $author->ID, $author->user_nicename );
1609
+ if ( $redirect_url ) {
1610
+ $redirect['query'] = remove_query_arg( 'author', $redirect['query'] );
1611
+ }
1612
+ }
1613
+ } elseif ( is_category() || is_tag() || is_tax() ) { // Terms (tags/categories).
1614
+
1615
+ $term_count = 0;
1616
+ foreach ( $wp_query->tax_query->queried_terms as $tax_query ) {
1617
+ $term_count += count( $tax_query['terms'] );
1618
+ }
1619
+
1620
+ $obj = $wp_query->get_queried_object();
1621
+ if ( $term_count <= 1 && ! empty( $obj->term_id ) ) {
1622
+ $tax_url = get_term_link( (int) $obj->term_id, $obj->taxonomy );
1623
+ if ( $tax_url && ! is_wp_error( $tax_url ) ) {
1624
+ if ( ! empty( $redirect['query'] ) ) {
1625
+ // Strip taxonomy query vars off the URL.
1626
+ $qv_remove = array( 'term', 'taxonomy' );
1627
+ if ( is_category() ) {
1628
+ $qv_remove[] = 'category_name';
1629
+ $qv_remove[] = 'cat';
1630
+ } elseif ( is_tag() ) {
1631
+ $qv_remove[] = 'tag';
1632
+ $qv_remove[] = 'tag_id';
1633
+ } else {
1634
+ // Custom taxonomies will have a custom query var, remove those too.
1635
+ $tax_obj = get_taxonomy( $obj->taxonomy );
1636
+ if ( false !== $tax_obj->query_var ) {
1637
+ $qv_remove[] = $tax_obj->query_var;
1638
+ }
1639
+ }
1640
+
1641
+ $rewrite_vars = array_diff( array_keys( $wp_query->query ), array_keys( $_GET ) );
1642
+
1643
+ // Check to see if all the query vars are coming from the rewrite, none are set via $_GET.
1644
+ if ( ! array_diff( $rewrite_vars, array_keys( $_GET ) ) ) {
1645
+ // Remove all of the per-tax query vars.
1646
+ $redirect['query'] = remove_query_arg( $qv_remove, $redirect['query'] );
1647
+
1648
+ // Create the destination URL for this taxonomy.
1649
+ $tax_url = parse_url( $tax_url );
1650
+ if ( ! empty( $tax_url['query'] ) ) {
1651
+ // Taxonomy accessible via ?taxonomy=...&term=... or any custom query var.
1652
+ parse_str( $tax_url['query'], $query_vars );
1653
+ $redirect['query'] = add_query_arg( $query_vars, $redirect['query'] );
1654
+ } else {
1655
+ // Taxonomy is accessible via a "pretty URL".
1656
+ $redirect['path'] = $tax_url['path'];
1657
+ }
1658
+ } else {
1659
+ // Some query vars are set via $_GET. Unset those from $_GET that exist via the rewrite.
1660
+ foreach ( $qv_remove as $_qv ) {
1661
+ if ( isset( $rewrite_vars[ $_qv ] ) ) {
1662
+ $redirect['query'] = remove_query_arg( $_qv, $redirect['query'] );
1663
+ }
1664
+ }
1665
+ }
1666
+ }
1667
+ }
1668
+ }
1669
+ } elseif ( is_single() && strpos( $wp_rewrite->permalink_structure, '%category%' ) !== false ) {
1670
+ $cat = get_query_var( 'category_name' );
1671
+ if ( $cat ) {
1672
+ $category = get_category_by_path( $cat );
1673
+ if ( ( ! $category || is_wp_error( $category ) ) || ! has_term( $category->term_id, 'category', $wp_query->get_queried_object_id() ) ) {
1674
+ $redirect_url = get_permalink( $wp_query->get_queried_object_id() );
1675
+ }
1676
+ }
1677
+ }
1678
+
1679
+ // Post paging.
1680
+ if ( is_singular() && get_query_var( 'page' ) ) {
1681
+ if ( ! $redirect_url ) {
1682
+ $redirect_url = get_permalink( get_queried_object_id() );
1683
+ }
1684
+
1685
+ $page = get_query_var( 'page' );
1686
+ if ( $page > 1 ) {
1687
+ if ( is_front_page() ) {
1688
+ $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' );
1689
+ } else {
1690
+ $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( $page, 'single_paged' );
1691
+ }
1692
+ }
1693
+ $redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
1694
+ }
1695
+
1696
+ // Paging and feeds.
1697
+ if ( get_query_var( 'paged' ) || is_feed() || get_query_var( 'cpage' ) ) {
1698
+ 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'] ) ) {
1699
+ // Strip off paging and feed.
1700
+ $redirect['path'] = preg_replace( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path'] ); // Strip off any existing paging.
1701
+ $redirect['path'] = preg_replace( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path'] ); // Strip off feed endings.
1702
+ $redirect['path'] = preg_replace( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path'] ); // Strip off any existing comment paging.
1703
+ }
1704
+
1705
+ $addl_path = '';
1706
+ if ( is_feed() && in_array( get_query_var( 'feed' ), $wp_rewrite->feeds ) ) {
1707
+ $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
1708
+ if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
1709
+ $addl_path .= 'comments/';
1710
+ }
1711
+ if ( ( 'rss' == get_default_feed() && 'feed' == get_query_var( 'feed' ) ) || 'rss' == get_query_var( 'feed' ) ) {
1712
+ $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
1713
+ } else {
1714
+ $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == get_query_var( 'feed' ) || 'feed' == get_query_var( 'feed' ) ) ? '' : get_query_var( 'feed' ) ), 'feed' );
1715
+ }
1716
+ $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
1717
+ } elseif ( is_feed() && 'old' == get_query_var( 'feed' ) ) {
1718
+ $old_feed_files = array(
1719
+ 'wp-atom.php' => 'atom',
1720
+ 'wp-commentsrss2.php' => 'comments_rss2',
1721
+ 'wp-feed.php' => get_default_feed(),
1722
+ 'wp-rdf.php' => 'rdf',
1723
+ 'wp-rss.php' => 'rss2',
1724
+ 'wp-rss2.php' => 'rss2',
1725
+ );
1726
+ if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
1727
+ $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
1728
+ wp_redirect( $redirect_url, 301 );
1729
+ die();
1730
+ }
1731
+ }
1732
+
1733
+ if ( get_query_var( 'paged' ) > 0 ) {
1734
+ $paged = get_query_var( 'paged' );
1735
+ $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
1736
+ if ( ! is_feed() ) {
1737
+ if ( $paged > 1 && ! is_single() ) {
1738
+ $addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ) . user_trailingslashit( "$wp_rewrite->pagination_base/$paged", 'paged' );
1739
+ } elseif ( ! is_single() ) {
1740
+ $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
1741
+ }
1742
+ } elseif ( $paged > 1 ) {
1743
+ $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] );
1744
+ }
1745
+ }
1746
+
1747
+ if ( get_option( 'page_comments' ) && (
1748
+ ( 'newest' == get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 0 ) ||
1749
+ ( 'newest' != get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 1 )
1750
+ ) ) {
1751
+ $addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . get_query_var( 'cpage' ), 'commentpaged' );
1752
+ $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
1753
+ }
1754
+
1755
+ $redirect['path'] = user_trailingslashit( preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path'] ) ); // Strip off trailing /index.php/.
1756
+ if ( ! empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos( $redirect['path'], '/' . $wp_rewrite->index . '/' ) === false ) {
1757
+ $redirect['path'] = trailingslashit( $redirect['path'] ) . $wp_rewrite->index . '/';
1758
+ }
1759
+ if ( ! empty( $addl_path ) ) {
1760
+ $redirect['path'] = trailingslashit( $redirect['path'] ) . $addl_path;
1761
+ }
1762
+ $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
1763
+ }
1764
+
1765
+ if ( 'wp-register.php' == basename( $redirect['path'] ) ) {
1766
+ if ( is_multisite() ) {
1767
+ /** This filter is documented in wp-login.php */
1768
+ $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
1769
+ } else {
1770
+ $redirect_url = wp_registration_url();
1771
+ }
1772
+
1773
+ wp_redirect( $redirect_url, 301 );
1774
+ die();
1775
+ }
1776
+ }
1777
+
1778
+ // Tack on any additional query vars.
1779
+ $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
1780
+ if ( $redirect_url && ! empty( $redirect['query'] ) ) {
1781
+ parse_str( $redirect['query'], $_parsed_query );
1782
+ $redirect = @parse_url( $redirect_url );
1783
+
1784
+ if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
1785
+ parse_str( $redirect['query'], $_parsed_redirect_query );
1786
+
1787
+ if ( empty( $_parsed_redirect_query['name'] ) ) {
1788
+ unset( $_parsed_query['name'] );
1789
+ }
1790
+ }
1791
+
1792
+ $_parsed_query = array_combine(
1793
+ rawurlencode_deep( array_keys( $_parsed_query ) ),
1794
+ rawurlencode_deep( array_values( $_parsed_query ) )
1795
+ );
1796
+ $redirect_url = add_query_arg( $_parsed_query, $redirect_url );
1797
+ }
1798
+
1799
+ if ( $redirect_url ) {
1800
+ $redirect = @parse_url( $redirect_url );
1801
+ }
1802
+
1803
+ // www.example.com vs. example.com
1804
+ $user_home = @parse_url( home_url() );
1805
+ if ( ! empty( $user_home['host'] ) ) {
1806
+ $redirect['host'] = $user_home['host'];
1807
+ }
1808
+ if ( empty( $user_home['path'] ) ) {
1809
+ $user_home['path'] = '/';
1810
+ }
1811
+
1812
+ // Handle ports.
1813
+ if ( ! empty( $user_home['port'] ) ) {
1814
+ $redirect['port'] = $user_home['port'];
1815
+ } else {
1816
+ unset( $redirect['port'] );
1817
+ }
1818
+
1819
+ // Trailing /index.php.
1820
+ $redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path'] );
1821
+
1822
+ $punctuation_pattern = implode(
1823
+ '|',
1824
+ array_map(
1825
+ 'preg_quote',
1826
+ array(
1827
+ ' ',
1828
+ '%20', // Space.
1829
+ '!',
1830
+ '%21', // Exclamation mark.
1831
+ '"',
1832
+ '%22', // Double quote.
1833
+ "'",
1834
+ '%27', // Single quote.
1835
+ '(',
1836
+ '%28', // Opening bracket.
1837
+ ')',
1838
+ '%29', // Closing bracket.
1839
+ ',',
1840
+ '%2C', // Comma.
1841
+ '.',
1842
+ '%2E', // Period.
1843
+ ';',
1844
+ '%3B', // Semicolon.
1845
+ '{',
1846
+ '%7B', // Opening curly bracket.
1847
+ '}',
1848
+ '%7D', // Closing curly bracket.
1849
+ '%E2%80%9C', // Opening curly quote.
1850
+ '%E2%80%9D', // Closing curly quote.
1851
+ )
1852
+ )
1853
+ );
1854
+
1855
+ // Remove trailing spaces and end punctuation from the path.
1856
+ $redirect['path'] = preg_replace( "#($punctuation_pattern)+$#", '', $redirect['path'] );
1857
+
1858
+ if ( ! empty( $redirect['query'] ) ) {
1859
+ // Remove trailing spaces and end punctuation from certain terminating query string args.
1860
+ $redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
1861
+
1862
+ // Clean up empty query strings.
1863
+ $redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' );
1864
+
1865
+ // Redirect obsolete feeds.
1866
+ $redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $redirect['query'] );
1867
+
1868
+ // Remove redundant leading ampersands.
1869
+ $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
1870
+ }
1871
+
1872
+ // Strip /index.php/ when we're not using PATHINFO permalinks.
1873
+ if ( ! $wp_rewrite->using_index_permalinks() ) {
1874
+ $redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] );
1875
+ }
1876
+
1877
+ // Trailing slashes.
1878
+ if ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() && ! is_404() && ( ! is_front_page() || ( is_front_page() && ( get_query_var( 'paged' ) > 1 ) ) ) ) {
1879
+ $user_ts_type = '';
1880
+ if ( get_query_var( 'paged' ) > 0 ) {
1881
+ $user_ts_type = 'paged';
1882
+ } else {
1883
+ foreach ( array( 'single', 'category', 'page', 'day', 'month', 'year', 'home' ) as $type ) {
1884
+ $func = 'is_' . $type;
1885
+ if ( call_user_func( $func ) ) {
1886
+ $user_ts_type = $type;
1887
+ break;
1888
+ }
1889
+ }
1890
+ }
1891
+ $redirect['path'] = user_trailingslashit( $redirect['path'], $user_ts_type );
1892
+ } elseif ( is_front_page() ) {
1893
+ $redirect['path'] = trailingslashit( $redirect['path'] );
1894
+ }
1895
+
1896
+ // Strip multiple slashes out of the URL.
1897
+ if ( strpos( $redirect['path'], '//' ) > -1 ) {
1898
+ $redirect['path'] = preg_replace( '|/+|', '/', $redirect['path'] );
1899
+ }
1900
+
1901
+ // Always trailing slash the Front Page URL.
1902
+ if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) ) {
1903
+ $redirect['path'] = trailingslashit( $redirect['path'] );
1904
+ }
1905
+
1906
+ // Ignore differences in host capitalization, as this can lead to infinite redirects.
1907
+ // Only redirect no-www <=> yes-www.
1908
+ if ( strtolower( $original['host'] ) == strtolower( $redirect['host'] ) ||
1909
+ ( strtolower( $original['host'] ) != 'www.' . strtolower( $redirect['host'] ) && 'www.' . strtolower( $original['host'] ) != strtolower( $redirect['host'] ) ) ) {
1910
+ $redirect['host'] = $original['host'];
1911
+ }
1912
+
1913
+ $compare_original = array( $original['host'], $original['path'] );
1914
+
1915
+ if ( ! empty( $original['port'] ) ) {
1916
+ $compare_original[] = $original['port'];
1917
+ }
1918
+
1919
+ if ( ! empty( $original['query'] ) ) {
1920
+ $compare_original[] = $original['query'];
1921
+ }
1922
+
1923
+ $compare_redirect = array( $redirect['host'], $redirect['path'] );
1924
+
1925
+ if ( ! empty( $redirect['port'] ) ) {
1926
+ $compare_redirect[] = $redirect['port'];
1927
+ }
1928
+
1929
+ if ( ! empty( $redirect['query'] ) ) {
1930
+ $compare_redirect[] = $redirect['query'];
1931
+ }
1932
+
1933
+ if ( $compare_original !== $compare_redirect ) {
1934
+ $redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
1935
+ if ( ! empty( $redirect['port'] ) ) {
1936
+ $redirect_url .= ':' . $redirect['port'];
1937
+ }
1938
+ $redirect_url .= $redirect['path'];
1939
+ if ( ! empty( $redirect['query'] ) ) {
1940
+ $redirect_url .= '?' . $redirect['query'];
1941
+ }
1942
+ }
1943
+
1944
+ if ( ! $redirect_url || $redirect_url == $requested_url ) {
1945
+ return;
1946
+ }
1947
+
1948
+ // Hex encoded octets are case-insensitive.
1949
+ if ( false !== strpos( $requested_url, '%' ) ) {
1950
+ if ( ! function_exists( 'lowercase_octets' ) ) {
1951
+ /**
1952
+ * Converts the first hex-encoded octet match to lowercase.
1953
+ *
1954
+ * @since 3.1.0
1955
+ * @ignore
1956
+ *
1957
+ * @param array $matches Hex-encoded octet matches for the requested URL.
1958
+ * @return string Lowercased version of the first match.
1959
+ */
1960
+ function lowercase_octets( $matches ) {
1961
+ return strtolower( $matches[0] );
1962
+ }
1963
+ }
1964
+ $requested_url = preg_replace_callback( '|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url );
1965
+ }
1966
+
1967
+ /**
1968
+ * Filters the canonical redirect URL.
1969
+ *
1970
+ * Returning false to this filter will cancel the redirect.
1971
+ *
1972
+ * @since 2.3.0
1973
+ *
1974
+ * @param string $redirect_url The redirect URL.
1975
+ * @param string $requested_url The requested URL.
1976
+ */
1977
+ $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
1978
+
1979
+ // Yes, again -- in case the filter aborted the request.
1980
+ if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) == strip_fragment_from_url( $requested_url ) ) {
1981
+ return;
1982
+ }
1983
+
1984
+ if ( $do_redirect ) {
1985
+ // Protect against chained redirects.
1986
+ if ( ! redirect_canonical( $redirect_url, false ) ) {
1987
+ wp_redirect( $redirect_url, 301 );
1988
+ exit();
1989
+ } else {
1990
+ // Debug.
1991
+ // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
1992
+ return;
1993
+ }
1994
+ } else {
1995
+ return $redirect_url;
1996
+ }
1997
  }
1998
 
1999
  public function psp_loaded_filter() {
readme.txt CHANGED
@@ -1,11 +1,12 @@
1
  === Platinum SEO ===
2
- Contributors: Techblissonline (Rajesh)
 
3
  Plugin link: https://techblissonline.com/platinum-wordpress-seo-plugin/
4
  Tags: seo, wordpress seo, plugin, google seo, platinum seo, schema, schema markup, Json schema
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,23 +23,28 @@ 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
30
- * Option to specify meta description and meta keywords tag for categories and tag pages.
31
- * Option to turn off Page title or Post title rewrites for any particular post or page
32
- * Option to turn off Page title or Post title format for any particular post or page
33
- * Helps you avoid duplicate content
34
- * Lets you override any title and set any META description and META keywords, for any post or page
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
 
43
 
44
 
@@ -47,7 +53,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 +66,21 @@ 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
 
1
  === Platinum SEO ===
2
+ Contributors: Rajesh Babu, Techblissonline (Rajesh)
3
+ Donate link: https://www.patreon.com/join/techblissonline
4
  Plugin link: https://techblissonline.com/platinum-wordpress-seo-plugin/
5
  Tags: seo, wordpress seo, plugin, google seo, platinum seo, schema, schema markup, Json schema
6
  Requires at least: 4.0
7
  Tested up to: 5.4
8
  Requires PHP: 5.6
9
+ Stable tag: 2.0.9
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
23
 
24
  Some features:
25
 
26
+ 1) 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.
27
+ 2) 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.
28
+ 3) Create social meta tags for facebook, twitter, pinterest and linkedin.
29
+ 4) Optimized Post and Page Titles for search engines
30
+ 5) Generates all SEO relevant META tags automatically
31
+ 6) Option to specify meta description and meta keywords tag for categories and tag pages.
32
+ 7) Option to turn off Page title or Post title rewrites for any particular post or page
33
+ 8) Option to turn off Page title or Post title format for any particular post or page
34
+ 9) Helps you avoid duplicate content
35
+ 10) Lets you override any title and set any META description and META keywords, for any post or page
36
+ 11) Support for custom post types
37
+ 12) Support for custom taxonomies
38
+ 13) 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.
39
+ 14) 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/)
40
+ 15) WordPress Plugin to change HTTP status code from 404 to 410.
41
+ 16) You now have a complete Redirection Manager.You can redirect any post or page to the desired location.
42
+ 17) WordPress 301 Redirect Plugin using HTTP 301 Status Code
43
+ 18) WordPress 302 Redirect Plugin using HTTP 302 Status Code
44
+ 19) WordPress 307 Redirect Plugin using HTTP 307 Status Code
45
+ 20) WordPress 303 Redirect Plugin using HTTP 303 Status Code
46
+ 21) Add index, noindex, follow or nofollow, noodp, noydir, noarchive, nosnippet meta tags to any post/page.
47
+ 22) Plenty of other features.
48
 
49
 
50
 
53
  1. Unzip into your `/wp-content/plugins/` directory. If you're uploading it make sure to upload
54
  the top-level folder. Don't just upload all the php files and put them in `/wp-content/plugins/`.
55
  2. Activate the plugin through the 'Plugins' menu in WordPress
56
+ 3. Visit your SEO options (*Platinum SEO and Social Pack -> SEO*)
57
  That's all folks!
58
 
59
  If you have to upgrade manually simply repeat the installation steps.
66
 
67
  1. Sitewide SEO and Social Settings
68
  2. Techblissonline Platinum SEO and Social Settings Meta Box for Posts, Pages and Taxonomies
69
+ 3. Adding **[combined Json Schemas](https://techblissonline.com/combine-json-schema/)** for each Post, Page and taxonomy.
70
  4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
71
 
72
  == Changelog ==
73
+ = 2.0.9 =
74
+ * 2020-04-16 - Redirection can now be created using Request URI, Request Path or Request URL as the source URL.
75
+
76
+ = 2.0.8 =
77
+ * 2020-04-12 - 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.
78
+ 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
79
+ Platinum SEO Plugin now enables its users to disable 404 Permalink guessing that WordPress does as part of its canonical redirect function. Though this function does several useful SEO related functionalities, 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.
80
+
81
+ = 2.0.7 =
82
+ * 2020-04-05 - Updation to help file links in Redirections Settings.
83
+
84
  = 2.0.6 =
85
  * 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.
86