Custom Permalinks - Version 2.2.0

Version Description

  • Aug 13, 2021 =

  • Bugs

    • Show decoded permalink in meta box
  • Enhancements

    • Update script to fix linting issues and use updated permalink to view the post/page.
Download this release

Release Info

Developer sasiddiqui
Plugin Icon Custom Permalinks
Version 2.2.0
Comparing to
See all releases

Code changes from version 2.1.0 to 2.2.0

assets/css/{about-plugins-2.1.0.min.css → about-plugins-2.2.0.min.css} RENAMED
File without changes
assets/js/script-form-2.1.0.min.js DELETED
@@ -1 +0,0 @@
1
- !function(){"use strict";var l="",a="",s=!1;function r(e){e.target&&(e.target.style.color="#000")}function i(e){var t=document.getElementById("original-permalink");e.target&&(document.getElementById("custom_permalink").value=e.target.value,""!==e.target.value&&e.target.value!==t.value||(e.target.value=t.value,e.target.style.color="#ddd"))}function d(){var e,t=document.getElementsByClassName("edit-post-post-link__preview-label"),n=document.getElementById("custom_permalinks_home_url"),o="";l&&wpApiSettings&&wpApiSettings.nonce&&(t&&t[0]&&t[0].parentNode.classList.add("cp-permalink-hidden"),(a=l.isSavingMetaBoxes())===s||a||(e=wp.data.select("core/editor").getEditedPostAttribute("id"),o=new XMLHttpRequest,s=a,o.onreadystatechange=function(){var e,t,n,a;4===o.readyState&&200===o.status&&(e=JSON.parse(o.responseText),t=document.getElementById("custom_permalinks_home_url"),n=document.getElementById("custom-permalinks-add"),a="",document.getElementById("custom_permalink").value=e.custom_permalink,""===e.custom_permalink&&(e.custom_permalink=e.original_permalink),a=e.preview_permalink?t.value+e.preview_permalink:t.value+e.custom_permalink,document.getElementById("custom-permalinks-post-slug").value=e.custom_permalink,document.getElementById("original-permalink").value=e.original_permalink,document.querySelector("#view-post-btn a")&&(document.querySelector("#view-post-btn a").href=a),document.querySelector("a.editor-post-preview")&&(document.querySelector("a.editor-post-preview").href=a),n&&"add"===n.value&&(document.getElementById("custom-permalinks-edit-box").style.display=""),document.querySelector(".components-notice__content a")&&(document.querySelector(".components-notice__content a").href="/"+e.custom_permalink))},o.open("GET",n.value+"wp-json/custom-permalinks/v1/get-permalink/"+e,!0),o.setRequestHeader("Cache-Control","private, max-age=0, no-cache"),o.setRequestHeader("X-WP-NONCE",wpApiSettings.nonce),o.send()),s=a)}function m(){var e=document.getElementsByClassName("edit-post-post-link__preview-label");e&&e[0]&&e[0].parentNode.classList.add("cp-permalink-hidden")}document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByClassName("edit-post-post-link__preview-label"),t=0,n=document.getElementById("custom-permalinks-edit-box"),a=document.getElementById("custom-permalinks-post-slug"),o="",s=0;if(a&&(a.addEventListener("focus",r),a.addEventListener("blur",i)),n&&""===document.querySelector("#custom-permalinks-edit-box .inside").innerHTML.trim()&&(n.style.display="none"),wp.data)for(a=document.getElementById("custom-permalinks-add"),(o=document.querySelectorAll(".edit-post-sidebar .components-panel__header"))&&o.length&&(s=o.length),a&&"add"===a.value&&(n.style.display="none"),l=wp.data.select("core/edit-post"),wp.data.subscribe(d),e&&e[0]&&e[0].parentNode.classList.add("cp-permalink-hidden"),n.classList.contains("closed")&&n.classList.remove("closed");t<s;)o[t].addEventListener("click",m),t+=1})}();
 
assets/js/script-form-2.2.0.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";let r="",a="",l=!1;function i(e){e.target&&(e.target.style.color="#000")}function d(e){var t;e.target&&(t=document.getElementById("original-permalink"),document.getElementById("custom_permalink").value=e.target.value,""!==e.target.value&&e.target.value!==t.value||(e.target.value=t.value,e.target.style.color="#ddd"))}function c(){if(r&&wpApiSettings&&wpApiSettings.nonce){const o=document.getElementsByClassName("edit-post-post-link__preview-label");var t,n=document.getElementById("custom_permalinks_home_url");let e="";o&&o[0]&&o[0].parentNode.classList.add("cp-permalink-hidden"),a=r.isSavingMetaBoxes(),a===l||a||(t=wp.data.select("core/editor").getEditedPostAttribute("id"),e=new XMLHttpRequest,l=a,e.onreadystatechange=function(){4===e.readyState&&200===e.status&&function(e){var t=document.getElementById("custom_permalinks_home_url"),n=document.getElementById("custom-permalinks-add");let o="",a="";if(document.getElementById("custom_permalink").value=e.custom_permalink,""===e.custom_permalink&&(e.custom_permalink=e.original_permalink),o=e.preview_permalink?t.value+e.preview_permalink:t.value+e.custom_permalink,document.getElementById("custom-permalinks-post-slug").value=e.custom_permalink,document.getElementById("original-permalink").value=e.original_permalink,document.querySelector("#view-post-btn a")&&(a=document.querySelector("#view-post-btn a").href,document.querySelector("#view-post-btn a").href=o),document.querySelector("a.editor-post-preview")&&(document.querySelector("a.editor-post-preview").href=o),""!==a){a=a.replace(/\//g,"/");let e=0;const r=document.querySelectorAll("body a");for(var l=new RegExp(a,"g"),s=r.length;e<s;)r[e]&&r[e].href&&(r[e].href=r[e].href.replace(l,o)),e+=1}n&&"add"===n.value&&(document.getElementById("custom-permalinks-edit-box").style.display=""),document.querySelector(".components-notice__content a")&&(document.querySelector(".components-notice__content a").href="/"+e.custom_permalink)}(JSON.parse(e.responseText))},e.open("GET",n.value+"wp-json/custom-permalinks/v1/get-permalink/"+t,!0),e.setRequestHeader("Cache-Control","private, max-age=0, no-cache"),e.setRequestHeader("X-WP-NONCE",wpApiSettings.nonce),e.send()),l=a}}function m(){const e=document.getElementsByClassName("edit-post-post-link__preview-label");e&&e[0]&&e[0].parentNode.classList.add("cp-permalink-hidden")}document.addEventListener("DOMContentLoaded",function(){const e=document.getElementsByClassName("edit-post-post-link__preview-label");let t=0;var n;const o=document.getElementById("custom-permalinks-edit-box"),a=document.getElementById("custom-permalinks-post-slug");let l="",s=0;if(a&&(a.addEventListener("focus",i),a.addEventListener("blur",d)),o&&""===document.querySelector("#custom-permalinks-edit-box .inside").innerHTML.trim()&&(o.style.display="none"),wp.data)for(n=document.getElementById("custom-permalinks-add"),l=document.querySelectorAll(".edit-post-sidebar .components-panel__header"),l&&l.length&&(s=l.length),n&&"add"===n.value&&(o.style.display="none"),r=wp.data.select("core/edit-post"),wp.data.subscribe(c),e&&e[0]&&e[0].parentNode.classList.add("cp-permalink-hidden"),o.classList.contains("closed")&&o.classList.remove("closed");t<s;)l[t].addEventListener("click",m),t+=1})}();
custom-permalinks.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Custom Permalinks
4
  * Plugin URI: https://www.custompermalinks.com/
5
  * Description: Set custom permalinks on a per-post basis.
6
- * Version: 2.1.0
7
  * Requires at least: 2.6
8
  * Requires PHP: 5.4
9
  * Author: Sami Ahmed Siddiqui
3
  * Plugin Name: Custom Permalinks
4
  * Plugin URI: https://www.custompermalinks.com/
5
  * Description: Set custom permalinks on a per-post basis.
6
+ * Version: 2.2.0
7
  * Requires at least: 2.6
8
  * Requires PHP: 5.4
9
  * Author: Sami Ahmed Siddiqui
includes/class-custom-permalinks-form.php CHANGED
@@ -904,6 +904,12 @@ class Custom_Permalinks_Form {
904
 
905
  $all_permalinks['preview_permalink'] = $view_post_link;
906
  }
 
 
 
 
 
 
907
  }
908
 
909
  $cp_frontend = new Custom_Permalinks_Frontend();
904
 
905
  $all_permalinks['preview_permalink'] = $view_post_link;
906
  }
907
+ } else {
908
+ $all_permalinks['custom_permalink'] = htmlspecialchars(
909
+ urldecode(
910
+ $all_permalinks['custom_permalink']
911
+ )
912
+ );
913
  }
914
 
915
  $cp_frontend = new Custom_Permalinks_Frontend();
includes/class-custom-permalinks.php CHANGED
@@ -18,7 +18,7 @@ class Custom_Permalinks {
18
  *
19
  * @var string
20
  */
21
- public $version = '2.1.0';
22
 
23
  /**
24
  * Class constructor.
18
  *
19
  * @var string
20
  */
21
+ public $version = '2.2.0';
22
 
23
  /**
24
  * Class constructor.
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: sasiddiqui
3
  Tags: permalink, url, link, address, custom, redirect, custom post type, GDPR, GDPR Compliant
4
  Tested up to: 5.8
5
- Stable tag: 2.1.0
6
  License: GPLv3
7
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
8
 
@@ -188,6 +188,13 @@ This process defines you the steps to follow either you are installing through W
188
 
189
  == Changelog ==
190
 
 
 
 
 
 
 
 
191
  = 2.1.0 - Aug 09, 2021 =
192
 
193
  * Bugs
2
  Contributors: sasiddiqui
3
  Tags: permalink, url, link, address, custom, redirect, custom post type, GDPR, GDPR Compliant
4
  Tested up to: 5.8
5
+ Stable tag: 2.2.0
6
  License: GPLv3
7
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
8
 
188
 
189
  == Changelog ==
190
 
191
+ = 2.2.0 - Aug 13, 2021 =
192
+
193
+ * Bugs
194
+ * Show decoded permalink in meta box
195
+ * Enhancements
196
+ * Update script to fix linting issues and use updated permalink to view the post/page.
197
+
198
  = 2.1.0 - Aug 09, 2021 =
199
 
200
  * Bugs