Cyr-To-Lat - Version 4.0

Version Description

(24.04.2019) = * Added button to convert existing slugs, instead of checkbox * Added admin notices during conversion of existing slugs * Added post_type and post_status parameters to wp-cli command * Fixed text domain * Simplified package.json to make final js even smaller * Added phpunit tests to the plugin main class * Added travis.yml for continuous integration on GitHub, and improvement of code reliability

Download this release

Release Info

Developer mihdan
Plugin Icon 128x128 Cyr-To-Lat
Version 4.0
Comparing to
See all releases

Code changes from version 3.7 to 4.0

css/cyr-to-lat-admin.css CHANGED
@@ -10,8 +10,8 @@
10
  width: 30%;
11
  }
12
 
13
- #ctl-options .form-table:not(:nth-child(2)) th {
14
- display: none;
15
  }
16
 
17
  .ctl-table {
10
  width: 30%;
11
  }
12
 
13
+ #ctl-options .form-table th {
14
+ display: none;
15
  }
16
 
17
  .ctl-table {
cyr-to-lat.php CHANGED
@@ -8,9 +8,9 @@
8
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
  * Requires at least: 2.3
11
- * Tested up to: 5.1
12
- * Version: 3.7
13
- * Stable tag: 3.7
14
  *
15
  * Text Domain: cyr2lat
16
  * Domain Path: /languages/
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
26
  /**
27
  * Plugin version.
28
  */
29
- define( 'CYR_TO_LAT_VERSION', '3.7' );
30
 
31
  /**
32
  * Path to the plugin dir.
8
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
  * Requires at least: 2.3
11
+ * Tested up to: 5.2
12
+ * Version: 4.0
13
+ * Stable tag: 4.0
14
  *
15
  * Text Domain: cyr2lat
16
  * Domain Path: /languages/
26
  /**
27
  * Plugin version.
28
  */
29
+ define( 'CYR_TO_LAT_VERSION', '4.0' );
30
 
31
  /**
32
  * Path to the plugin dir.
dist/js/settings/app.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.hideTables(),this.bindEvents()}return n(t,[{key:"hideTables",value:function(){var t=[].concat(o(document.querySelectorAll("#ctl-options table")));t.shift(),t.map(function(t,e){if(t.classList.add("ctl-table"),0===e){t.classList.add("active");var r=document.createElement("ul");r.classList.add("nav-tab-wrapper"),t.parentNode.insertBefore(r,t)}});var e=[].concat(o(document.querySelectorAll("#ctl-options h2")));e.shift(),e.map(function(t,e){t.classList.add("nav-tab"),t.dataset.index=e,document.querySelector("#ctl-options ul").appendChild(t),0===e&&t.classList.add("nav-tab-active")})}},{key:"bindEvents",value:function(){[].concat(o(document.querySelectorAll("#ctl-options ul h2"))).map(function(t){t.onclick=function(t){t.preventDefault();var e=t.target.dataset.index;[].concat(o(document.querySelectorAll("#ctl-options ul h2"))).map(function(t){t.classList.remove("nav-tab-active")}),t.target.classList.add("nav-tab-active");var r=[].concat(o(document.querySelectorAll(".ctl-table")));return r.map(function(t){t.classList.remove("active")}),r[e].classList.add("active"),!1}})}}]),t}();e.default=i},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}}(r(0));document.addEventListener("DOMContentLoaded",function(){new n.default})},function(t,e){!function(t){"use strict";if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};c.prototype.append=function(t,e){t=a(t),e=u(e);var r=this.map[t];this.map[t]=r?r+","+e:e},c.prototype.delete=function(t){delete this.map[a(t)]},c.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},c.prototype.set=function(t,e){this.map[a(t)]=u(e)},c.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},c.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),f(t)},c.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),f(t)},c.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),f(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},p.call(b.prototype),p.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var s=[301,302,303,307,308];v.redirect=function(t,e){if(-1===s.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.Headers=c,t.Request=b,t.Response=v,t.fetch=function(t,r){return new Promise(function(n,o){var i=new b(t,r),s=new XMLHttpRequest;s.onload=function(){var t={status:s.status,statusText:s.statusText,headers:function(t){var e=new c;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}(s.getAllResponseHeaders()||"")};t.url="responseURL"in s?s.responseURL:t.headers.get("X-Request-URL");var e="response"in s?s.response:s.responseText;n(new v(e,t))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials&&(s.withCredentials=!0),"responseType"in s&&e.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function c(t){this.map={},t instanceof c?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function h(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=y(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=d(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(t,e){var r=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=function(t){var e=t.toUpperCase();return i.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function m(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function v(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:this)},function(t,e,r){r(2),t.exports=r(1)}]);
1
+ !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.hideTables(),this.bindEvents()}return n(t,[{key:"hideTables",value:function(){[].concat(o(document.querySelectorAll("#ctl-options table"))).map(function(t,e){if(t.classList.add("ctl-table"),0===e){t.classList.add("active");var r=document.createElement("ul");r.classList.add("nav-tab-wrapper"),t.parentNode.insertBefore(r,t)}}),[].concat(o(document.querySelectorAll("#ctl-options h2"))).map(function(t,e){t.classList.add("nav-tab"),t.dataset.index=e,document.querySelector("#ctl-options ul").appendChild(t),0===e&&t.classList.add("nav-tab-active")})}},{key:"bindEvents",value:function(){[].concat(o(document.querySelectorAll("#ctl-options ul h2"))).map(function(t){t.onclick=function(t){t.preventDefault();var e=t.target.dataset.index;[].concat(o(document.querySelectorAll("#ctl-options ul h2"))).map(function(t){t.classList.remove("nav-tab-active")}),t.target.classList.add("nav-tab-active");var r=[].concat(o(document.querySelectorAll(".ctl-table")));return r.map(function(t){t.classList.remove("active")}),r[e].classList.add("active"),!1}})}}]),t}();e.default=i},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}}(r(0));document.addEventListener("DOMContentLoaded",function(){new n.default})},function(t,e){!function(t){"use strict";if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};c.prototype.append=function(t,e){t=a(t),e=u(e);var r=this.map[t];this.map[t]=r?r+","+e:e},c.prototype.delete=function(t){delete this.map[a(t)]},c.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},c.prototype.set=function(t,e){this.map[a(t)]=u(e)},c.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},c.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),f(t)},c.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),f(t)},c.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),f(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},p.call(b.prototype),p.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var s=[301,302,303,307,308];v.redirect=function(t,e){if(-1===s.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.Headers=c,t.Request=b,t.Response=v,t.fetch=function(t,r){return new Promise(function(n,o){var i=new b(t,r),s=new XMLHttpRequest;s.onload=function(){var t={status:s.status,statusText:s.statusText,headers:function(t){var e=new c;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}(s.getAllResponseHeaders()||"")};t.url="responseURL"in s?s.responseURL:t.headers.get("X-Request-URL");var e="response"in s?s.response:s.responseText;n(new v(e,t))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials&&(s.withCredentials=!0),"responseType"in s&&e.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function c(t){this.map={},t instanceof c?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function h(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=y(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=d(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(t,e){var r=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=function(t){var e=t.toUpperCase();return i.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function m(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function v(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:this)},function(t,e,r){r(2),t.exports=r(1)}]);
includes/background-processes/class-cyr-to-lat-conversion-process.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Background old slugs converting process
4
+ *
5
+ * @package cyr-to-lat
6
+ */
7
+
8
+ /**
9
+ * Class Cyr_To_Lat_Conversion_Process
10
+ */
11
+ class Cyr_To_Lat_Conversion_Process extends WP_Background_Process {
12
+
13
+ /**
14
+ * Prefix
15
+ *
16
+ * @var string
17
+ */
18
+ protected $prefix = CYR_TO_LAT_PREFIX;
19
+
20
+ /**
21
+ * Plugin main class
22
+ *
23
+ * @var Cyr_To_Lat_Main
24
+ */
25
+ protected $main;
26
+
27
+ /**
28
+ * Cyr_To_Lat_Conversion_Process constructor
29
+ *
30
+ * @param Cyr_To_Lat_Main $main Plugin main class.
31
+ */
32
+ public function __construct( $main ) {
33
+ $this->main = $main;
34
+
35
+ parent::__construct();
36
+ }
37
+
38
+ /**
39
+ * Task. Updates single post or term.
40
+ *
41
+ * @param mixed $item Queue item to iterate over.
42
+ *
43
+ * @return mixed
44
+ */
45
+ protected function task( $item ) {
46
+ return false;
47
+ }
48
+
49
+ /**
50
+ * Complete
51
+ */
52
+ protected function complete() {
53
+ parent::complete();
54
+
55
+ set_site_transient( $this->identifier . '_process_completed', microtime() );
56
+ }
57
+
58
+ /**
59
+ * Check if process is completed.
60
+ * Delete relevant transient.
61
+ */
62
+ public function is_process_completed() {
63
+ if ( get_site_transient( $this->identifier . '_process_completed' ) ) {
64
+ // Process is marked as completed.
65
+ // Delete relevant site transient.
66
+ delete_site_transient( $this->identifier . '_process_completed' );
67
+
68
+ return true;
69
+ }
70
+
71
+ return false;
72
+ }
73
+
74
+ /**
75
+ * Is process running
76
+ *
77
+ * Check whether the current process is already running
78
+ * in a background process.
79
+ */
80
+ public function is_process_running() {
81
+ $is_process_running = parent::is_process_running();
82
+
83
+ return $is_process_running;
84
+ }
85
+
86
+ /**
87
+ * Log
88
+ *
89
+ * @param string $message Message to log.
90
+ */
91
+ protected function log( $message ) {
92
+ if ( WP_DEBUG_LOG ) {
93
+ // @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
94
+ error_log( 'Cyr-To-Lat: ' . $message );
95
+ // @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
96
+ }
97
+ }
98
+ }
includes/background-processes/class-cyr-to-lat-post-conversion-process.php CHANGED
@@ -8,14 +8,7 @@
8
  /**
9
  * Class Cyr_To_Lat_Post_Conversion_Process
10
  */
11
- class Cyr_To_Lat_Post_Conversion_Process extends WP_Background_Process {
12
-
13
- /**
14
- * Prefix
15
- *
16
- * @var string
17
- */
18
- protected $prefix = CYR_TO_LAT_PREFIX;
19
 
20
  /**
21
  * Process action name
@@ -24,24 +17,6 @@ class Cyr_To_Lat_Post_Conversion_Process extends WP_Background_Process {
24
  */
25
  protected $action = CYR_TO_LAT_POST_CONVERSION_ACTION;
26
 
27
- /**
28
- * Plugin main class
29
- *
30
- * @var Cyr_To_Lat_Main
31
- */
32
- private $main;
33
-
34
- /**
35
- * Cyr_To_Lat_Post_Conversion_Process constructor
36
- *
37
- * @param Cyr_To_Lat_Main $main Plugin main class.
38
- */
39
- public function __construct( $main ) {
40
- $this->main = $main;
41
-
42
- parent::__construct();
43
- }
44
-
45
  /**
46
  * Task. Updates single post
47
  *
@@ -61,7 +36,7 @@ class Cyr_To_Lat_Post_Conversion_Process extends WP_Background_Process {
61
  // phpcs:enable
62
  }
63
 
64
- $this->log( $post->post_name . ' => ' . $sanitized_name );
65
 
66
  return false;
67
  }
@@ -72,19 +47,6 @@ class Cyr_To_Lat_Post_Conversion_Process extends WP_Background_Process {
72
  protected function complete() {
73
  parent::complete();
74
 
75
- $this->log( 'Post slugs conversion completed.' );
76
- }
77
-
78
- /**
79
- * Log
80
- *
81
- * @param string $message Message to log.
82
- */
83
- public function log( $message ) {
84
- if ( WP_DEBUG_LOG ) {
85
- // @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
86
- error_log( $message );
87
- // @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
88
- }
89
  }
90
  }
8
  /**
9
  * Class Cyr_To_Lat_Post_Conversion_Process
10
  */
11
+ class Cyr_To_Lat_Post_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
 
 
 
 
 
 
 
12
 
13
  /**
14
  * Process action name
17
  */
18
  protected $action = CYR_TO_LAT_POST_CONVERSION_ACTION;
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Task. Updates single post
22
  *
36
  // phpcs:enable
37
  }
38
 
39
+ $this->log( __( 'Post slug converted:', 'cyr2lat' ) . ' ' . urldecode( $post->post_name ) . ' => ' . $sanitized_name );
40
 
41
  return false;
42
  }
47
  protected function complete() {
48
  parent::complete();
49
 
50
+ $this->log( __( 'Post slugs conversion completed.', 'cyr2lat' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
  }
includes/background-processes/class-cyr-to-lat-term-conversion-process.php CHANGED
@@ -8,14 +8,7 @@
8
  /**
9
  * Class Cyr_To_Lat_Term_Conversion_Process
10
  */
11
- class Cyr_To_Lat_Term_Conversion_Process extends WP_Background_Process {
12
-
13
- /**
14
- * Prefix.
15
- *
16
- * @var string
17
- */
18
- protected $prefix = CYR_TO_LAT_PREFIX;
19
 
20
  /**
21
  * Process action name
@@ -24,24 +17,6 @@ class Cyr_To_Lat_Term_Conversion_Process extends WP_Background_Process {
24
  */
25
  protected $action = CYR_TO_LAT_TERM_CONVERSION_ACTION;
26
 
27
- /**
28
- * Plugin main class.
29
- *
30
- * @var Cyr_To_Lat_Main
31
- */
32
- private $main;
33
-
34
- /**
35
- * Cyr_To_Lat_Post_Conversion_Process constructor
36
- *
37
- * @param Cyr_To_Lat_Main $main Plugin main class.
38
- */
39
- public function __construct( $main ) {
40
- $this->main = $main;
41
-
42
- parent::__construct();
43
- }
44
-
45
  /**
46
  * Task. Updates single term
47
  *
@@ -60,7 +35,7 @@ class Cyr_To_Lat_Term_Conversion_Process extends WP_Background_Process {
60
  // phpcs:enable
61
  }
62
 
63
- $this->log( $term->slug . ' => ' . $sanitized_slug );
64
 
65
  return false;
66
  }
@@ -71,19 +46,6 @@ class Cyr_To_Lat_Term_Conversion_Process extends WP_Background_Process {
71
  protected function complete() {
72
  parent::complete();
73
 
74
- $this->log( 'Term slugs conversion completed.' );
75
- }
76
-
77
- /**
78
- * Log
79
- *
80
- * @param string $message Message to log.
81
- */
82
- public function log( $message ) {
83
- if ( WP_DEBUG_LOG ) {
84
- // @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
85
- error_log( $message );
86
- // @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
87
- }
88
  }
89
  }
8
  /**
9
  * Class Cyr_To_Lat_Term_Conversion_Process
10
  */
11
+ class Cyr_To_Lat_Term_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
 
 
 
 
 
 
 
12
 
13
  /**
14
  * Process action name
17
  */
18
  protected $action = CYR_TO_LAT_TERM_CONVERSION_ACTION;
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Task. Updates single term
22
  *
35
  // phpcs:enable
36
  }
37
 
38
+ $this->log( __( 'Term slug converted:', 'cyr2lat' ) . ' ' . urldecode( $term->slug ) . ' => ' . $sanitized_slug );
39
 
40
  return false;
41
  }
46
  protected function complete() {
47
  parent::complete();
48
 
49
+ $this->log( __( 'Term slugs conversion completed.', 'cyr2lat' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
  }
includes/class-cyr-to-lat-admin-notices.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Notices.
4
+ *
5
+ * @package cyr-to-lat
6
+ */
7
+
8
+ /**
9
+ * Class Cyr_To_Lat_Admin_Notices
10
+ *
11
+ * @class Cyr_To_Lat_Admin_Notices
12
+ */
13
+ class Cyr_To_Lat_Admin_Notices {
14
+
15
+ /**
16
+ * Admin notices array.
17
+ *
18
+ * @var array
19
+ */
20
+ private $notices = array();
21
+
22
+ /**
23
+ * Cyr_To_Lat_Admin_Notices constructor.
24
+ */
25
+ public function __construct() {
26
+ add_action( 'admin_notices', array( $this, 'show_notices' ) );
27
+ }
28
+
29
+ /**
30
+ * Add admin notice.
31
+ *
32
+ * @param string $message Message to show.
33
+ * @param string $class Message class: notice notice-success notice-error notice-warning notice-info
34
+ * is-dismissible.
35
+ */
36
+ public function add_notice( $message, $class = 'notice' ) {
37
+ $this->notices[] = array(
38
+ 'message' => $message,
39
+ 'class' => $class,
40
+ );
41
+ }
42
+
43
+ /**
44
+ * Show all notices.
45
+ */
46
+ public function show_notices() {
47
+ foreach ( $this->notices as $notice ) {
48
+ ?>
49
+ <div class="<?php echo esc_attr( $notice['class'] ); ?>">
50
+ <p>
51
+ <strong>
52
+ <?php echo wp_kses( $notice['message'], wp_kses_allowed_html( 'post' ) ); ?>
53
+ </strong>
54
+ </p>
55
+ </div>
56
+ <?php
57
+ }
58
+ }
59
+ }
includes/class-cyr-to-lat-converter.php CHANGED
@@ -45,6 +45,13 @@ class Cyr_To_Lat_Converter {
45
  */
46
  private $process_all_terms;
47
 
 
 
 
 
 
 
 
48
  /**
49
  * Cyr_To_Lat_Converter constructor.
50
  *
@@ -56,6 +63,7 @@ class Cyr_To_Lat_Converter {
56
  $this->settings = $settings;
57
  $this->process_all_posts = new Cyr_To_Lat_Post_Conversion_Process( $main );
58
  $this->process_all_terms = new Cyr_To_Lat_Term_Conversion_Process( $main );
 
59
  $this->init_hooks();
60
  }
61
 
@@ -63,7 +71,8 @@ class Cyr_To_Lat_Converter {
63
  * Init class hooks.
64
  */
65
  public function init_hooks() {
66
- add_action( 'init', array( $this, 'process_handler' ) );
 
67
 
68
  /**
69
  * Fix bug in WP_Background_Process::memory_exceeded() function.
@@ -88,11 +97,60 @@ class Cyr_To_Lat_Converter {
88
  array( $this, 'time_exceeded_filter' )
89
  );
90
 
91
- if ( 'yes' === $this->settings->get_option( 'convert_existing_slugs' ) ) {
92
- $this->settings->set_option( 'convert_existing_slugs', 'no' );
93
- add_action( 'init', array( $this, 'convert_existing_slugs' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
95
 
 
 
 
 
96
  }
97
 
98
  /**
@@ -112,41 +170,79 @@ class Cyr_To_Lat_Converter {
112
 
113
  /**
114
  * Convert Existing Slugs.
 
 
115
  */
116
- public function convert_existing_slugs() {
117
  global $wpdb;
118
 
119
  $regexp = Cyr_To_Lat_Main::PROHIBITED_CHARS_REGEX . '+';
120
 
121
- // phpcs:disable WordPress.DB.DirectDatabaseQuery
 
 
 
 
 
 
 
 
122
  $posts = $wpdb->get_results(
123
  $wpdb->prepare(
124
- "SELECT ID, post_name FROM $wpdb->posts WHERE post_name REGEXP(%s) AND post_status IN ('publish', 'future', 'private')",
 
 
 
125
  $regexp
126
  )
127
  );
128
- // phpcs:enable
129
 
130
- foreach ( (array) $posts as $post ) {
131
- $this->process_all_posts->push_to_queue( $post );
132
- }
 
 
 
133
 
134
- $this->process_all_posts->save()->dispatch();
 
 
 
 
 
 
 
 
 
 
135
 
136
- // phpcs:disable WordPress.DB.DirectDatabaseQuery
137
  $terms = $wpdb->get_results(
138
  $wpdb->prepare(
139
  "SELECT term_id, slug FROM $wpdb->terms WHERE slug REGEXP(%s)",
140
  $regexp
141
  )
142
  );
143
- // phpcs:enable
144
 
145
- foreach ( (array) $terms as $term ) {
146
- $this->process_all_terms->push_to_queue( $term );
147
- }
 
 
 
148
 
149
- $this->process_all_terms->save()->dispatch();
 
 
 
 
 
 
 
 
 
 
150
  }
151
 
152
  /**
@@ -192,6 +288,7 @@ class Cyr_To_Lat_Converter {
192
  * Converts a shorthand byte value to an integer byte value.
193
  *
194
  * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
 
195
  * @return int An integer byte value.
196
  */
197
  protected function convert_shorthand_to_bytes( $value ) {
@@ -218,11 +315,24 @@ class Cyr_To_Lat_Converter {
218
  *
219
  * @return mixed
220
  */
221
- protected function time_exceeded_filter( $return ) {
222
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
223
  return false;
224
  }
225
 
226
  return $return;
227
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  }
45
  */
46
  private $process_all_terms;
47
 
48
+ /**
49
+ * Admin notices.
50
+ *
51
+ * @var Cyr_To_Lat_Admin_Notices
52
+ */
53
+ private $admin_notices;
54
+
55
  /**
56
  * Cyr_To_Lat_Converter constructor.
57
  *
63
  $this->settings = $settings;
64
  $this->process_all_posts = new Cyr_To_Lat_Post_Conversion_Process( $main );
65
  $this->process_all_terms = new Cyr_To_Lat_Term_Conversion_Process( $main );
66
+ $this->admin_notices = new Cyr_To_Lat_Admin_Notices();
67
  $this->init_hooks();
68
  }
69
 
71
  * Init class hooks.
72
  */
73
  public function init_hooks() {
74
+ add_action( 'admin_init', array( $this, 'process_handler' ) );
75
+ add_action( 'admin_init', array( $this, 'conversion_notices' ) );
76
 
77
  /**
78
  * Fix bug in WP_Background_Process::memory_exceeded() function.
97
  array( $this, 'time_exceeded_filter' )
98
  );
99
 
100
+ }
101
+
102
+ /**
103
+ * Show conversion notices.
104
+ */
105
+ public function conversion_notices() {
106
+ $posts_process_running = $this->process_all_posts->is_process_running();
107
+ $terms_process_running = $this->process_all_terms->is_process_running();
108
+
109
+ if ( ! $posts_process_running && ! $terms_process_running ) {
110
+ add_action( 'admin_init', array( $this, 'start_conversion' ), 20 );
111
+ }
112
+
113
+ if ( $posts_process_running ) {
114
+ $this->admin_notices->add_notice(
115
+ __( 'Cyr To Lat converts existing post slugs in the background process.', 'cyr2lat' ),
116
+ 'notice notice-info is-dismissible'
117
+ );
118
+ }
119
+
120
+ if ( $terms_process_running ) {
121
+ $this->admin_notices->add_notice(
122
+ __( 'Cyr To Lat converts existing term slugs in the background process.', 'cyr2lat' ),
123
+ 'notice notice-info is-dismissible'
124
+ );
125
+ }
126
+
127
+ if ( $this->process_all_posts->is_process_completed() ) {
128
+ $this->admin_notices->add_notice(
129
+ __( 'Cyr To Lat completed conversion of existing post slugs.', 'cyr2lat' ),
130
+ 'notice notice-success is-dismissible'
131
+ );
132
+ }
133
+
134
+ if ( $this->process_all_terms->is_process_completed() ) {
135
+ $this->admin_notices->add_notice(
136
+ __( 'Cyr To Lat completed conversion of existing term slugs.', 'cyr2lat' ),
137
+ 'notice notice-success is-dismissible'
138
+ );
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Check if we have to start conversion and start it.
144
+ */
145
+ public function start_conversion() {
146
+ if ( ! isset( $_POST['cyr2lat-convert'] ) ) {
147
+ return;
148
  }
149
 
150
+ $settings = $this->settings;
151
+ check_admin_referer( $settings::OPTION_GROUP . '-options' );
152
+
153
+ $this->convert_existing_slugs();
154
  }
155
 
156
  /**
170
 
171
  /**
172
  * Convert Existing Slugs.
173
+ *
174
+ * @param array $args Arguments for query.
175
  */
176
+ public function convert_existing_slugs( $args = array() ) {
177
  global $wpdb;
178
 
179
  $regexp = Cyr_To_Lat_Main::PROHIBITED_CHARS_REGEX . '+';
180
 
181
+ $defaults = array(
182
+ 'post_type' => get_post_types(),
183
+ 'post_status' => array( 'publish', 'future', 'private' ),
184
+ );
185
+
186
+ $args = wp_parse_args( $args, $defaults );
187
+
188
+ // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
189
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery
190
  $posts = $wpdb->get_results(
191
  $wpdb->prepare(
192
+ "SELECT ID, post_name FROM $wpdb->posts WHERE post_name REGEXP(%s) AND post_status IN (" .
193
+ $this->main->ctl_prepare_in( $args['post_status'] ) .
194
+ ') AND post_type IN (' .
195
+ $this->main->ctl_prepare_in( $args['post_type'] ) . ')',
196
  $regexp
197
  )
198
  );
199
+ // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
200
 
201
+ if ( $posts ) {
202
+ foreach ( (array) $posts as $post ) {
203
+ $this->process_all_posts->push_to_queue( $post );
204
+ }
205
+
206
+ $this->process_all_posts->save()->dispatch();
207
 
208
+ $this->log( __( 'Post slugs conversion started.', 'cyr2lat' ) );
209
+ $this->admin_notices->add_notice(
210
+ __( 'Cyr To Lat started conversion of existing post slugs.', 'cyr2lat' ),
211
+ 'notice notice-info is-dismissible'
212
+ );
213
+ } else {
214
+ $this->admin_notices->add_notice(
215
+ __( 'Cyr To Lat has not found existing post slugs for conversion.', 'cyr2lat' ),
216
+ 'notice notice-info is-dismissible'
217
+ );
218
+ }
219
 
220
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery
221
  $terms = $wpdb->get_results(
222
  $wpdb->prepare(
223
  "SELECT term_id, slug FROM $wpdb->terms WHERE slug REGEXP(%s)",
224
  $regexp
225
  )
226
  );
 
227
 
228
+ if ( $terms ) {
229
+ foreach ( (array) $terms as $term ) {
230
+ $this->process_all_terms->push_to_queue( $term );
231
+ }
232
+
233
+ $this->process_all_terms->save()->dispatch();
234
 
235
+ $this->log( __( 'Term slugs conversion started.', 'cyr2lat' ) );
236
+ $this->admin_notices->add_notice(
237
+ __( 'Cyr To Lat started conversion of existing term slugs.', 'cyr2lat' ),
238
+ 'notice notice-info is-dismissible'
239
+ );
240
+ } else {
241
+ $this->admin_notices->add_notice(
242
+ __( 'Cyr To Lat has not found existing term slugs for conversion.', 'cyr2lat' ),
243
+ 'notice notice-info is-dismissible'
244
+ );
245
+ }
246
  }
247
 
248
  /**
288
  * Converts a shorthand byte value to an integer byte value.
289
  *
290
  * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
291
+ *
292
  * @return int An integer byte value.
293
  */
294
  protected function convert_shorthand_to_bytes( $value ) {
315
  *
316
  * @return mixed
317
  */
318
+ public function time_exceeded_filter( $return ) {
319
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
320
  return false;
321
  }
322
 
323
  return $return;
324
  }
325
+
326
+ /**
327
+ * Log
328
+ *
329
+ * @param string $message Message to log.
330
+ */
331
+ protected function log( $message ) {
332
+ if ( WP_DEBUG_LOG ) {
333
+ // @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
334
+ error_log( 'Cyr-To-Lat: ' . $message );
335
+ // @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
336
+ }
337
+ }
338
  }
includes/class-cyr-to-lat-main.php CHANGED
@@ -25,6 +25,13 @@ class Cyr_To_Lat_Main {
25
  */
26
  private $settings;
27
 
 
 
 
 
 
 
 
28
  /**
29
  * WP-CLI
30
  *
@@ -33,22 +40,38 @@ class Cyr_To_Lat_Main {
33
  private $cli;
34
 
35
  /**
36
- * Cyr_To_Lat constructor.
 
 
 
 
37
  */
38
- public function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  $this->init();
40
- $this->init_hooks();
41
  }
42
 
43
  /**
44
  * Init class.
45
  */
46
  public function init() {
47
- $this->settings = new Cyr_To_Lat_Settings();
48
- $converter = new Cyr_To_Lat_Converter( $this, $this->settings );
49
-
50
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
51
- $this->cli = new Cyr_To_Lat_WP_CLI( $converter );
52
  try {
53
  /**
54
  * Method WP_CLI::add_command() accepts class as callable.
@@ -60,6 +83,8 @@ class Cyr_To_Lat_Main {
60
  return;
61
  }
62
  }
 
 
63
  }
64
 
65
  /**
@@ -132,6 +157,17 @@ class Cyr_To_Lat_Main {
132
  return $title;
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
135
  /**
136
  * Check if Classic Editor plugin is active.
137
  *
@@ -140,15 +176,11 @@ class Cyr_To_Lat_Main {
140
  * @return bool
141
  */
142
  private function ctl_is_classic_editor_plugin_active() {
143
- if ( ! function_exists( 'is_plugin_active' ) ) {
144
  include_once ABSPATH . 'wp-admin/includes/plugin.php';
145
  }
146
 
147
- if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
148
- return true;
149
- }
150
-
151
- return false;
152
  }
153
 
154
  /**
@@ -190,11 +222,17 @@ class Cyr_To_Lat_Main {
190
  * @return mixed
191
  */
192
  public function ctl_sanitize_post_name( $data, $postarr = array() ) {
 
193
 
194
  if ( ! $this->ctl_is_gutenberg_editor_active() ) {
195
  return $data;
196
  }
197
 
 
 
 
 
 
198
  if (
199
  ! $data['post_name'] && $data['post_title'] &&
200
  ! in_array( $data['post_status'], array( 'auto-draft', 'revision' ), true )
@@ -204,6 +242,33 @@ class Cyr_To_Lat_Main {
204
 
205
  return $data;
206
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  }
208
 
209
  // eof.
25
  */
26
  private $settings;
27
 
28
+ /**
29
+ * Converter instance.
30
+ *
31
+ * @var Cyr_To_Lat_Converter
32
+ */
33
+ private $converter;
34
+
35
  /**
36
  * WP-CLI
37
  *
40
  private $cli;
41
 
42
  /**
43
+ * Cyr_To_Lat_Main constructor.
44
+ *
45
+ * @param Cyr_To_Lat_Settings $settings Plugin settings.
46
+ * @param Cyr_To_Lat_Converter $converter Converter instance.
47
+ * @param Cyr_To_Lat_WP_CLI $cli CLI instance.
48
  */
49
+ public function __construct( $settings = null, $converter = null, $cli = null ) {
50
+ $this->settings = $settings;
51
+ if ( ! $this->settings ) {
52
+ $this->settings = new Cyr_To_Lat_Settings();
53
+ }
54
+
55
+ $this->converter = $converter;
56
+ if ( ! $this->converter ) {
57
+ $this->converter = new Cyr_To_Lat_Converter( $this, $this->settings );
58
+ }
59
+
60
+ $this->cli = $cli;
61
+ if ( defined( 'WP_CLI' ) && WP_CLI ) {
62
+ if ( ! $this->cli ) {
63
+ $this->cli = new Cyr_To_Lat_WP_CLI( $this->converter );
64
+ }
65
+ }
66
+
67
  $this->init();
 
68
  }
69
 
70
  /**
71
  * Init class.
72
  */
73
  public function init() {
 
 
 
74
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
 
75
  try {
76
  /**
77
  * Method WP_CLI::add_command() accepts class as callable.
83
  return;
84
  }
85
  }
86
+
87
+ $this->init_hooks();
88
  }
89
 
90
  /**
157
  return $title;
158
  }
159
 
160
+ /**
161
+ * Helper function to make class unit-testable
162
+ *
163
+ * @param string $function Function name.
164
+ *
165
+ * @return bool
166
+ */
167
+ protected function ctl_function_exists( $function ) {
168
+ return function_exists( $function );
169
+ }
170
+
171
  /**
172
  * Check if Classic Editor plugin is active.
173
  *
176
  * @return bool
177
  */
178
  private function ctl_is_classic_editor_plugin_active() {
179
+ if ( ! $this->ctl_function_exists( 'is_plugin_active' ) ) {
180
  include_once ABSPATH . 'wp-admin/includes/plugin.php';
181
  }
182
 
183
+ return is_plugin_active( 'classic-editor/classic-editor.php' );
 
 
 
 
184
  }
185
 
186
  /**
222
  * @return mixed
223
  */
224
  public function ctl_sanitize_post_name( $data, $postarr = array() ) {
225
+ global $current_screen;
226
 
227
  if ( ! $this->ctl_is_gutenberg_editor_active() ) {
228
  return $data;
229
  }
230
 
231
+ // Run code only on post edit screen.
232
+ if ( ! ( $current_screen && 'post' === $current_screen->base ) ) {
233
+ return $data;
234
+ }
235
+
236
  if (
237
  ! $data['post_name'] && $data['post_title'] &&
238
  ! in_array( $data['post_status'], array( 'auto-draft', 'revision' ), true )
242
 
243
  return $data;
244
  }
245
+
246
+ /**
247
+ * Changes array of items into string of items, separated by comma and sql-escaped
248
+ *
249
+ * @see https://coderwall.com/p/zepnaw
250
+ * @global wpdb $wpdb
251
+ *
252
+ * @param mixed|array $items item(s) to be joined into string.
253
+ * @param string $format %s or %d.
254
+ *
255
+ * @return string Items separated by comma and sql-escaped
256
+ */
257
+ public function ctl_prepare_in( $items, $format = '%s' ) {
258
+ global $wpdb;
259
+
260
+ $items = (array) $items;
261
+ $how_many = count( $items );
262
+ if ( $how_many > 0 ) {
263
+ $placeholders = array_fill( 0, $how_many, $format );
264
+ $prepared_format = implode( ',', $placeholders );
265
+ $prepared_in = $wpdb->prepare( $prepared_format, $items ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
266
+ } else {
267
+ $prepared_in = '';
268
+ }
269
+
270
+ return $prepared_in;
271
+ }
272
  }
273
 
274
  // eof.
includes/class-cyr-to-lat-settings.php CHANGED
@@ -130,16 +130,7 @@ class Cyr_To_Lat_Settings {
130
  */
131
  public function init_form_fields() {
132
  $this->form_fields = array(
133
- 'convert_existing_slugs' => array(
134
- 'label' => __( 'Convert Existing Slugs', 'cyr2lat' ),
135
- 'section' => 'general_section',
136
- 'type' => 'checkbox',
137
- 'placeholder' => '',
138
- 'helper' => '',
139
- 'supplemental' => '',
140
- 'default' => 'no',
141
- ),
142
- 'iso9' => array(
143
  'label' => __( 'ISO9 Table', 'cyr2lat' ),
144
  'section' => 'iso9_section',
145
  'type' => 'table',
@@ -148,7 +139,7 @@ class Cyr_To_Lat_Settings {
148
  'supplemental' => '',
149
  'default' => Cyr_To_Lat_Conversion_Tables::get(),
150
  ),
151
- 'bel' => array(
152
  'label' => __( 'bel Table', 'cyr2lat' ),
153
  'section' => 'bel_section',
154
  'type' => 'table',
@@ -157,7 +148,7 @@ class Cyr_To_Lat_Settings {
157
  'supplemental' => '',
158
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'bel' ),
159
  ),
160
- 'uk' => array(
161
  'label' => __( 'uk Table', 'cyr2lat' ),
162
  'section' => 'uk_section',
163
  'type' => 'table',
@@ -166,7 +157,7 @@ class Cyr_To_Lat_Settings {
166
  'supplemental' => '',
167
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'uk' ),
168
  ),
169
- 'bg_BG' => array(
170
  'label' => __( 'bg_BG Table', 'cyr2lat' ),
171
  'section' => 'bg_BG_section',
172
  'type' => 'table',
@@ -175,7 +166,7 @@ class Cyr_To_Lat_Settings {
175
  'supplemental' => '',
176
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'bg_BG' ),
177
  ),
178
- 'mk_MK' => array(
179
  'label' => __( 'mk_MK Table', 'cyr2lat' ),
180
  'section' => 'mk_MK_section',
181
  'type' => 'table',
@@ -184,7 +175,7 @@ class Cyr_To_Lat_Settings {
184
  'supplemental' => '',
185
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'mk_MK' ),
186
  ),
187
- 'ka_GE' => array(
188
  'label' => __( 'ka_GE Table', 'cyr2lat' ),
189
  'section' => 'ka_GE_section',
190
  'type' => 'table',
@@ -193,7 +184,7 @@ class Cyr_To_Lat_Settings {
193
  'supplemental' => '',
194
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'ka_GE' ),
195
  ),
196
- 'kk' => array(
197
  'label' => __( 'kk Table', 'cyr2lat' ),
198
  'section' => 'kk_section',
199
  'type' => 'table',
@@ -283,7 +274,7 @@ class Cyr_To_Lat_Settings {
283
  ?>
284
  </h2>
285
 
286
- <form id="ctl-options" action="<?php echo esc_url( admin_url( 'options.php' ) ); ?>" method="POST">
287
  <?php
288
  do_settings_sections( self::PAGE ); // Sections with options.
289
  settings_fields( self::OPTION_GROUP ); // Hidden protection fields.
@@ -291,6 +282,13 @@ class Cyr_To_Lat_Settings {
291
  ?>
292
  </form>
293
 
 
 
 
 
 
 
 
294
  <div>
295
  <h2 id="donate">
296
  <?php echo esc_html( __( 'Donate', 'cyr2lat' ) ); ?>
@@ -326,12 +324,6 @@ class Cyr_To_Lat_Settings {
326
  * Setup settings sections.
327
  */
328
  public function setup_sections() {
329
- add_settings_section(
330
- 'general_section',
331
- __( 'General Options', 'cyr2lat' ),
332
- array( $this, 'cyr_to_lat_section' ),
333
- self::PAGE
334
- );
335
  add_settings_section(
336
  'iso9_section',
337
  __( 'ISO9 Table', 'cyr2lat' ),
@@ -384,7 +376,6 @@ class Cyr_To_Lat_Settings {
384
  public function cyr_to_lat_section( $arguments ) {
385
  }
386
 
387
-
388
  /**
389
  * Setup settings fields.
390
  */
130
  */
131
  public function init_form_fields() {
132
  $this->form_fields = array(
133
+ 'iso9' => array(
 
 
 
 
 
 
 
 
 
134
  'label' => __( 'ISO9 Table', 'cyr2lat' ),
135
  'section' => 'iso9_section',
136
  'type' => 'table',
139
  'supplemental' => '',
140
  'default' => Cyr_To_Lat_Conversion_Tables::get(),
141
  ),
142
+ 'bel' => array(
143
  'label' => __( 'bel Table', 'cyr2lat' ),
144
  'section' => 'bel_section',
145
  'type' => 'table',
148
  'supplemental' => '',
149
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'bel' ),
150
  ),
151
+ 'uk' => array(
152
  'label' => __( 'uk Table', 'cyr2lat' ),
153
  'section' => 'uk_section',
154
  'type' => 'table',
157
  'supplemental' => '',
158
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'uk' ),
159
  ),
160
+ 'bg_BG' => array(
161
  'label' => __( 'bg_BG Table', 'cyr2lat' ),
162
  'section' => 'bg_BG_section',
163
  'type' => 'table',
166
  'supplemental' => '',
167
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'bg_BG' ),
168
  ),
169
+ 'mk_MK' => array(
170
  'label' => __( 'mk_MK Table', 'cyr2lat' ),
171
  'section' => 'mk_MK_section',
172
  'type' => 'table',
175
  'supplemental' => '',
176
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'mk_MK' ),
177
  ),
178
+ 'ka_GE' => array(
179
  'label' => __( 'ka_GE Table', 'cyr2lat' ),
180
  'section' => 'ka_GE_section',
181
  'type' => 'table',
184
  'supplemental' => '',
185
  'default' => Cyr_To_Lat_Conversion_Tables::get( 'ka_GE' ),
186
  ),
187
+ 'kk' => array(
188
  'label' => __( 'kk Table', 'cyr2lat' ),
189
  'section' => 'kk_section',
190
  'type' => 'table',
274
  ?>
275
  </h2>
276
 
277
+ <form id="ctl-options" action="<?php echo esc_url( admin_url( 'options.php' ) ); ?>" method="post">
278
  <?php
279
  do_settings_sections( self::PAGE ); // Sections with options.
280
  settings_fields( self::OPTION_GROUP ); // Hidden protection fields.
282
  ?>
283
  </form>
284
 
285
+ <form id="ctl-convert-existing-slugs" action="" method="post">
286
+ <?php
287
+ wp_nonce_field( self::OPTION_GROUP . '-options' );
288
+ submit_button( __( 'Convert Existing Slugs', 'cyr2lat' ), 'secondary', 'cyr2lat-convert' );
289
+ ?>
290
+ </form>
291
+
292
  <div>
293
  <h2 id="donate">
294
  <?php echo esc_html( __( 'Donate', 'cyr2lat' ) ); ?>
324
  * Setup settings sections.
325
  */
326
  public function setup_sections() {
 
 
 
 
 
 
327
  add_settings_section(
328
  'iso9_section',
329
  __( 'ISO9 Table', 'cyr2lat' ),
376
  public function cyr_to_lat_section( $arguments ) {
377
  }
378
 
 
379
  /**
380
  * Setup settings fields.
381
  */
includes/class-cyr-to-lat-wp-cli.php CHANGED
@@ -52,7 +52,17 @@ class Cyr_To_Lat_WP_CLI extends WP_CLI_Command {
52
  */
53
  $notify = \WP_CLI\Utils\make_progress_bar( 'Regenerate old slugs', 1 );
54
 
55
- $this->converter->convert_existing_slugs();
 
 
 
 
 
 
 
 
 
 
56
  $notify->tick();
57
  $notify->finish();
58
 
52
  */
53
  $notify = \WP_CLI\Utils\make_progress_bar( 'Regenerate old slugs', 1 );
54
 
55
+ $result = array();
56
+
57
+ if ( ! empty( $assoc_args['post_status'] ) ) {
58
+ $result['post_status'] = explode( ',', $assoc_args['post_status'] );
59
+ }
60
+
61
+ if ( ! empty( $assoc_args['post_type'] ) ) {
62
+ $result['post_type'] = explode( ',', $assoc_args['post_type'] );
63
+ }
64
+
65
+ $this->converter->convert_existing_slugs( $result );
66
  $notify->tick();
67
  $notify->finish();
68
 
languages/cyr-to-lat-ru_RU.mo DELETED
Binary file
languages/cyr-to-lat-ru_RU.po DELETED
@@ -1,85 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Cyr To Lat\n"
4
- "POT-Creation-Date: 2019-01-28 17:51+0200\n"
5
- "PO-Revision-Date: 2019-01-28 17:51+0200\n"
6
- "Last-Translator: KAGG Design <info@kagg.eu>\n"
7
- "Language-Team: KAGG Design\n"
8
- "Language: ru_RU\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.2.1\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
15
- "%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
16
- "X-Poedit-KeywordsList: __;esc_html__;esc_attr__\n"
17
- "X-Poedit-Flags-xgettext: --add-comments\n"
18
- "X-Poedit-SearchPath-0: .\n"
19
- "X-Poedit-SearchPath-1: src\n"
20
- "X-Poedit-SearchPathExcluded-0: vendor\n"
21
- "X-Poedit-SearchPathExcluded-1: dist\n"
22
- "X-Poedit-SearchPathExcluded-2: src\n"
23
-
24
- #: includes/class-cyr-to-lat-settings.php:113
25
- msgid "View Cyr To Lat settings"
26
- msgstr "Посмотреть настройки Cyr To Lat"
27
-
28
- #: includes/class-cyr-to-lat-settings.php:114
29
- msgid "Settings"
30
- msgstr "Настройки"
31
-
32
- #: includes/class-cyr-to-lat-settings.php:126
33
- msgid "Convert Existing Slugs"
34
- msgstr "Конвертировать существующие слаги"
35
-
36
- #: includes/class-cyr-to-lat-settings.php:134
37
- #: includes/class-cyr-to-lat-settings.php:300
38
- msgid "ISO9 Table"
39
- msgstr "Таблица ISO9"
40
-
41
- #: includes/class-cyr-to-lat-settings.php:143
42
- #: includes/class-cyr-to-lat-settings.php:306
43
- msgid "bg_BG Table"
44
- msgstr "Таблица bg_BG"
45
-
46
- #: includes/class-cyr-to-lat-settings.php:152
47
- #: includes/class-cyr-to-lat-settings.php:312
48
- msgid "uk Table"
49
- msgstr "Таблица uk"
50
-
51
- #: includes/class-cyr-to-lat-settings.php:161
52
- #: includes/class-cyr-to-lat-settings.php:318
53
- msgid "ka_GE Table"
54
- msgstr "Таблица ka_GE"
55
-
56
- #: includes/class-cyr-to-lat-settings.php:221
57
- #: includes/class-cyr-to-lat-settings.php:222
58
- msgid "Cyr To Lat"
59
- msgstr "Cyr To Lat"
60
-
61
- #. Admin panel title.
62
- #: includes/class-cyr-to-lat-settings.php:244
63
- msgid "Cyr To Lat Plugin Options"
64
- msgstr "Опции плагина Cyr To Lat"
65
-
66
- #: includes/class-cyr-to-lat-settings.php:258
67
- msgid "Donate"
68
- msgstr "Пожертвовать"
69
-
70
- #: includes/class-cyr-to-lat-settings.php:261
71
- msgid "Would you like to support the advancement of this plugin?"
72
- msgstr "Хотите поддержать развитие этого плагина?"
73
-
74
- #. @todo Change to Sergey's account
75
- #: includes/class-cyr-to-lat-settings.php:276
76
- msgid "Your appreciation"
77
- msgstr "Ваша оценка"
78
-
79
- #: includes/class-cyr-to-lat-settings.php:281
80
- msgid "Leave a ★★★★★ plugin review on WordPress.org"
81
- msgstr "Оставьте ★★★★★ обзор плагина на WordPress.org"
82
-
83
- #: includes/class-cyr-to-lat-settings.php:294
84
- msgid "General Options"
85
- msgstr "Общие настройки"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/cyr2lat-ru_RU.mo CHANGED
Binary file
languages/cyr2lat-ru_RU.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Cyr To Lat\n"
4
- "POT-Creation-Date: 2019-04-12 15:35+0300\n"
5
- "PO-Revision-Date: 2019-04-12 15:37+0300\n"
6
  "Last-Translator: KAGG Design <info@kagg.eu>\n"
7
  "Language-Team: KAGG Design\n"
8
  "Language: ru_RU\n"
@@ -21,6 +21,59 @@ msgstr ""
21
  "X-Poedit-SearchPathExcluded-1: dist\n"
22
  "X-Poedit-SearchPathExcluded-2: src\n"
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  #: includes/class-cyr-to-lat-settings.php:121
25
  msgid "View Cyr To Lat settings"
26
  msgstr "Посмотреть настройки Cyr To Lat"
@@ -30,70 +83,72 @@ msgid "Settings"
30
  msgstr "Настройки"
31
 
32
  #: includes/class-cyr-to-lat-settings.php:134
33
- msgid "Convert Existing Slugs"
34
- msgstr "Конвертировать существующие слаги"
35
-
36
- #: includes/class-cyr-to-lat-settings.php:143
37
- #: includes/class-cyr-to-lat-settings.php:337
38
  msgid "ISO9 Table"
39
  msgstr "Таблица ISO9"
40
 
41
- #: includes/class-cyr-to-lat-settings.php:152
42
- #: includes/class-cyr-to-lat-settings.php:343
43
  msgid "bel Table"
44
  msgstr "Таблица bel"
45
 
46
- #: includes/class-cyr-to-lat-settings.php:161
47
- #: includes/class-cyr-to-lat-settings.php:349
48
  msgid "uk Table"
49
  msgstr "Таблица uk"
50
 
51
- #: includes/class-cyr-to-lat-settings.php:170
52
- #: includes/class-cyr-to-lat-settings.php:355
53
  msgid "bg_BG Table"
54
  msgstr "Таблица bg_BG"
55
 
56
- #: includes/class-cyr-to-lat-settings.php:179
57
- #: includes/class-cyr-to-lat-settings.php:361
58
  msgid "mk_MK Table"
59
  msgstr "Таблица mk_MK"
60
 
61
- #: includes/class-cyr-to-lat-settings.php:188
62
- #: includes/class-cyr-to-lat-settings.php:367
63
  msgid "ka_GE Table"
64
  msgstr "Таблица ka_GE"
65
 
66
- #: includes/class-cyr-to-lat-settings.php:197
67
- #: includes/class-cyr-to-lat-settings.php:373
68
  msgid "kk Table"
69
  msgstr "Таблица kk"
70
 
71
- #: includes/class-cyr-to-lat-settings.php:261
72
- #: includes/class-cyr-to-lat-settings.php:262
73
  msgid "Cyr To Lat"
74
  msgstr "Cyr To Lat"
75
 
76
  #. Admin panel title.
77
- #: includes/class-cyr-to-lat-settings.php:282
78
  msgid "Cyr To Lat Plugin Options"
79
  msgstr "Опции плагина Cyr To Lat"
80
 
81
- #: includes/class-cyr-to-lat-settings.php:296
 
 
 
 
82
  msgid "Donate"
83
  msgstr "Пожертвовать"
84
 
85
- #: includes/class-cyr-to-lat-settings.php:299
86
  msgid "Would you like to support the advancement of this plugin?"
87
  msgstr "Хотите поддержать развитие этого плагина?"
88
 
89
- #: includes/class-cyr-to-lat-settings.php:313
90
  msgid "Your appreciation"
91
  msgstr "Ваша оценка"
92
 
93
- #: includes/class-cyr-to-lat-settings.php:318
94
  msgid "Leave a ★★★★★ plugin review on WordPress.org"
95
  msgstr "Оставьте ★★★★★ обзор плагина на WordPress.org"
96
 
97
- #: includes/class-cyr-to-lat-settings.php:331
98
- msgid "General Options"
99
- msgstr "Общие настройки"
 
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Cyr To Lat\n"
4
+ "POT-Creation-Date: 2019-04-21 15:42+0300\n"
5
+ "PO-Revision-Date: 2019-04-21 15:43+0300\n"
6
  "Last-Translator: KAGG Design <info@kagg.eu>\n"
7
  "Language-Team: KAGG Design\n"
8
  "Language: ru_RU\n"
21
  "X-Poedit-SearchPathExcluded-1: dist\n"
22
  "X-Poedit-SearchPathExcluded-2: src\n"
23
 
24
+ #: includes/background-processes/class-cyr-to-lat-post-conversion-process.php:52
25
+ msgid "Post slugs conversion completed."
26
+ msgstr "Конвертация ярлыков постов завершена."
27
+
28
+ #: includes/background-processes/class-cyr-to-lat-term-conversion-process.php:38
29
+ msgid "Term slug converted:"
30
+ msgstr "Ярлык термина сконвертирован:"
31
+
32
+ #: includes/background-processes/class-cyr-to-lat-term-conversion-process.php:49
33
+ msgid "Term slugs conversion completed."
34
+ msgstr "Конвертация ярлыков терминов завершена."
35
+
36
+ #: includes/class-cyr-to-lat-converter.php:108
37
+ msgid "Cyr To Lat converts existing post slugs in the background process."
38
+ msgstr "Cyr To Lat конвертирует существующие ярлыки постов в фоновом процессе."
39
+
40
+ #: includes/class-cyr-to-lat-converter.php:115
41
+ msgid "Cyr To Lat converts existing term slugs in the background process."
42
+ msgstr ""
43
+ "Cyr To Lat конвертирует существующие ярлыки терминов в фоновом процессе."
44
+
45
+ #: includes/class-cyr-to-lat-converter.php:122
46
+ msgid "Cyr To Lat completed conversion of existing post slugs."
47
+ msgstr "Cyr To Lat завершил конвертацию существующих ярлыков постов."
48
+
49
+ #: includes/class-cyr-to-lat-converter.php:129
50
+ msgid "Cyr To Lat completed conversion of existing term slugs."
51
+ msgstr "Cyr To Lat завершил конвертацию существующих ярлыков терминов."
52
+
53
+ #: includes/class-cyr-to-lat-converter.php:194
54
+ msgid "Post slugs conversion started."
55
+ msgstr "Начата конвертация ярлыков постов."
56
+
57
+ #: includes/class-cyr-to-lat-converter.php:196
58
+ msgid "Cyr To Lat started conversion of existing post slugs."
59
+ msgstr "Cyr To Lat начал конвертацию существующих ярлыков постов."
60
+
61
+ #: includes/class-cyr-to-lat-converter.php:201
62
+ msgid "Cyr To Lat has not found existing post slugs for conversion."
63
+ msgstr "Cyr To Lat не нашёл существующих ярлыков постов для конвертации."
64
+
65
+ #: includes/class-cyr-to-lat-converter.php:221
66
+ msgid "Term slugs conversion started."
67
+ msgstr "Начата конвертация ярлыков терминов."
68
+
69
+ #: includes/class-cyr-to-lat-converter.php:223
70
+ msgid "Cyr To Lat started conversion of existing term slugs."
71
+ msgstr "Cyr To Lat начал конвертацию существующих ярлыков терминов."
72
+
73
+ #: includes/class-cyr-to-lat-converter.php:228
74
+ msgid "Cyr To Lat has not found existing term slugs for conversion."
75
+ msgstr "Cyr To Lat не нашёл существующих ярлыков терминов для конвертации."
76
+
77
  #: includes/class-cyr-to-lat-settings.php:121
78
  msgid "View Cyr To Lat settings"
79
  msgstr "Посмотреть настройки Cyr To Lat"
83
  msgstr "Настройки"
84
 
85
  #: includes/class-cyr-to-lat-settings.php:134
86
+ #: includes/class-cyr-to-lat-settings.php:329
 
 
 
 
87
  msgid "ISO9 Table"
88
  msgstr "Таблица ISO9"
89
 
90
+ #: includes/class-cyr-to-lat-settings.php:143
91
+ #: includes/class-cyr-to-lat-settings.php:335
92
  msgid "bel Table"
93
  msgstr "Таблица bel"
94
 
95
+ #: includes/class-cyr-to-lat-settings.php:152
96
+ #: includes/class-cyr-to-lat-settings.php:341
97
  msgid "uk Table"
98
  msgstr "Таблица uk"
99
 
100
+ #: includes/class-cyr-to-lat-settings.php:161
101
+ #: includes/class-cyr-to-lat-settings.php:347
102
  msgid "bg_BG Table"
103
  msgstr "Таблица bg_BG"
104
 
105
+ #: includes/class-cyr-to-lat-settings.php:170
106
+ #: includes/class-cyr-to-lat-settings.php:353
107
  msgid "mk_MK Table"
108
  msgstr "Таблица mk_MK"
109
 
110
+ #: includes/class-cyr-to-lat-settings.php:179
111
+ #: includes/class-cyr-to-lat-settings.php:359
112
  msgid "ka_GE Table"
113
  msgstr "Таблица ka_GE"
114
 
115
+ #: includes/class-cyr-to-lat-settings.php:188
116
+ #: includes/class-cyr-to-lat-settings.php:365
117
  msgid "kk Table"
118
  msgstr "Таблица kk"
119
 
120
+ #: includes/class-cyr-to-lat-settings.php:252
121
+ #: includes/class-cyr-to-lat-settings.php:253
122
  msgid "Cyr To Lat"
123
  msgstr "Cyr To Lat"
124
 
125
  #. Admin panel title.
126
+ #: includes/class-cyr-to-lat-settings.php:273
127
  msgid "Cyr To Lat Plugin Options"
128
  msgstr "Опции плагина Cyr To Lat"
129
 
130
+ #: includes/class-cyr-to-lat-settings.php:288
131
+ msgid "Convert Existing Slugs"
132
+ msgstr "Конвертировать существующие ярлыки"
133
+
134
+ #: includes/class-cyr-to-lat-settings.php:294
135
  msgid "Donate"
136
  msgstr "Пожертвовать"
137
 
138
+ #: includes/class-cyr-to-lat-settings.php:297
139
  msgid "Would you like to support the advancement of this plugin?"
140
  msgstr "Хотите поддержать развитие этого плагина?"
141
 
142
+ #: includes/class-cyr-to-lat-settings.php:311
143
  msgid "Your appreciation"
144
  msgstr "Ваша оценка"
145
 
146
+ #: includes/class-cyr-to-lat-settings.php:316
147
  msgid "Leave a ★★★★★ plugin review on WordPress.org"
148
  msgstr "Оставьте ★★★★★ обзор плагина на WordPress.org"
149
 
150
+ #~ msgid "Post slug converted:"
151
+ #~ msgstr "Ярлык поста сконвертирован:"
152
+
153
+ #~ msgid "General Options"
154
+ #~ msgstr "Общие настройки"
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kaggdesign
3
  Tags: cyrillic, belorussian, ukrainian, bulgarian, macedonian, georgian, kazakh, latin, l10n, russian, cyr-to-lat, cyr2lat, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
- Tested up to: 5.1
6
- Stable tag: 3.7
7
  Requires PHP: 5.2
8
 
9
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
@@ -13,7 +13,7 @@ Converts Cyrillic characters in post, page and term slugs to Latin characters.
13
  Converts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs.
14
 
15
  = Features =
16
- * Automatically converts existing post, page and term slugs on activation
17
  * Saves existing post and page permalinks integrity
18
  * Performs transliteration of attachment file names
19
  * Includes Russian, Belorussian, Ukrainian, Bulgarian, Macedonian, Georgian, and Kazakh characters
@@ -42,6 +42,18 @@ function my_cyr_to_lat_table($ctl_table) {
42
  add_filter('ctl_table', 'my_cyr_to_lat_table');
43
  `
44
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  = Can I contribute? =
46
 
47
  Yes you can!
@@ -51,6 +63,15 @@ Yes you can!
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
 
 
 
 
54
  = 3.7 (12.04.2019) =
55
  * Added Belorussian, Macedonian, Kazakh tables
56
  * Fixed bug with MariaDB during old slug conversion
2
  Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kaggdesign
3
  Tags: cyrillic, belorussian, ukrainian, bulgarian, macedonian, georgian, kazakh, latin, l10n, russian, cyr-to-lat, cyr2lat, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
+ Tested up to: 5.2
6
+ Stable tag: 4.0
7
  Requires PHP: 5.2
8
 
9
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
13
  Converts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs.
14
 
15
  = Features =
16
+ * Converts any number of existing post, page and term slugs in background processes
17
  * Saves existing post and page permalinks integrity
18
  * Performs transliteration of attachment file names
19
  * Includes Russian, Belorussian, Ukrainian, Bulgarian, Macedonian, Georgian, and Kazakh characters
42
  add_filter('ctl_table', 'my_cyr_to_lat_table');
43
  `
44
 
45
+ == How can I convert a large number of posts/terms using wp-cli? ==
46
+
47
+ Use the following command in console:
48
+
49
+ `
50
+ wp cyr2lat regenerate [--post_type=<post_type>] [--post_status=<post_status>]
51
+ `
52
+
53
+ Where
54
+ `-post_type` is list of post types,
55
+ `-post_status` is list of post statuses.
56
+
57
  = Can I contribute? =
58
 
59
  Yes you can!
63
 
64
  == Changelog ==
65
 
66
+ = 4.0 (24.04.2019) =
67
+ * Added button to convert existing slugs, instead of checkbox
68
+ * Added admin notices during conversion of existing slugs
69
+ * Added post_type and post_status parameters to wp-cli command
70
+ * Fixed text domain
71
+ * Simplified package.json to make final js even smaller
72
+ * Added phpunit tests to the plugin main class
73
+ * Added travis.yml for continuous integration on GitHub, and improvement of code reliability
74
+
75
  = 3.7 (12.04.2019) =
76
  * Added Belorussian, Macedonian, Kazakh tables
77
  * Fixed bug with MariaDB during old slug conversion
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit45d109b755504f763d934370e259f554::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit5dcf7a98b032f1c0e3482e43ab2c5865::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -6,6 +6,8 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
9
  'Cyr_To_Lat_Conversion_Tables' => $baseDir . '/includes/class-cyr-to-lat-conversion-tables.php',
10
  'Cyr_To_Lat_Converter' => $baseDir . '/includes/class-cyr-to-lat-converter.php',
11
  'Cyr_To_Lat_Main' => $baseDir . '/includes/class-cyr-to-lat-main.php',
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Cyr_To_Lat_Admin_Notices' => $baseDir . '/includes/class-cyr-to-lat-admin-notices.php',
10
+ 'Cyr_To_Lat_Conversion_Process' => $baseDir . '/includes/background-processes/class-cyr-to-lat-conversion-process.php',
11
  'Cyr_To_Lat_Conversion_Tables' => $baseDir . '/includes/class-cyr-to-lat-conversion-tables.php',
12
  'Cyr_To_Lat_Converter' => $baseDir . '/includes/class-cyr-to-lat-converter.php',
13
  'Cyr_To_Lat_Main' => $baseDir . '/includes/class-cyr-to-lat-main.php',
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit45d109b755504f763d934370e259f554 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit45d109b755504f763d934370e259f554 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit45d109b755504f763d934370e259f554', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit45d109b755504f763d934370e259f554', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit5dcf7a98b032f1c0e3482e43ab2c5865 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit5dcf7a98b032f1c0e3482e43ab2c5865', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit5dcf7a98b032f1c0e3482e43ab2c5865', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/autoload_static.php CHANGED
@@ -31,6 +31,8 @@ class ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8
31
  );
32
 
33
  public static $classMap = array (
 
 
34
  'Cyr_To_Lat_Conversion_Tables' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-conversion-tables.php',
35
  'Cyr_To_Lat_Converter' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-converter.php',
36
  'Cyr_To_Lat_Main' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-main.php',
31
  );
32
 
33
  public static $classMap = array (
34
+ 'Cyr_To_Lat_Admin_Notices' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-admin-notices.php',
35
+ 'Cyr_To_Lat_Conversion_Process' => __DIR__ . '/../..' . '/includes/background-processes/class-cyr-to-lat-conversion-process.php',
36
  'Cyr_To_Lat_Conversion_Tables' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-conversion-tables.php',
37
  'Cyr_To_Lat_Converter' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-converter.php',
38
  'Cyr_To_Lat_Main' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-main.php',