| @@ -10,19 +10,19 @@ | ||
| 10 | 10 | |
| 11 | 11 | /******/ }); |
| 12 | 12 | /************************************************************************/ |
| 13 | 13 | /******/ // The module cache |
| 14 | -/******/ var __webpack_module_cache__ = {}; | |
| 14 | +/******/ const __webpack_module_cache__ = {}; | |
| 15 | 15 | /******/ |
| 16 | 16 | /******/ // The require function |
| 17 | 17 | /******/ function __webpack_require__(moduleId) { |
| 18 | 18 | /******/ // Check if module is in cache |
| 19 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 19 | +/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 20 | 20 | /******/ if (cachedModule !== undefined) { |
| 21 | 21 | /******/ return cachedModule.exports; |
| 22 | 22 | /******/ } |
| 23 | 23 | /******/ // Create a new module (and put it into the cache) |
| 24 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 24 | +/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 25 | 25 | /******/ // no module.id needed |
| 26 | 26 | /******/ // no module.loaded needed |
| 27 | 27 | /******/ exports: {} |
| 28 | 28 | /******/ }; |
| @@ -35,38 +35,32 @@ | ||
| 35 | 35 | /******/ } |
| 36 | 36 | /******/ |
| 37 | 37 | /************************************************************************/ |
| 38 | 38 | /******/ /* webpack/runtime/compat get default export */ |
| 39 | -/******/ (() => { | |
| 40 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 41 | -/******/ __webpack_require__.n = (module) => { | |
| 42 | -/******/ var getter = module && module.__esModule ? | |
| 43 | -/******/ () => (module['default']) : | |
| 44 | -/******/ () => (module); | |
| 45 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 46 | -/******/ return getter; | |
| 47 | -/******/ }; | |
| 48 | -/******/ })(); | |
| 39 | +/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 40 | +/******/ __webpack_require__.n = (module) => { | |
| 41 | +/******/ const getter = module && module.__esModule ? | |
| 42 | +/******/ () => (module['default']) : | |
| 43 | +/******/ () => (module); | |
| 44 | +/******/ __webpack_require__.d(getter, { a: getter }); | |
| 45 | +/******/ return getter; | |
| 46 | +/******/ }; | |
| 49 | 47 | /******/ |
| 50 | 48 | /******/ /* webpack/runtime/define property getters */ |
| 51 | -/******/ (() => { | |
| 52 | -/******/ // define getter functions for harmony exports | |
| 53 | -/******/ __webpack_require__.d = (exports, definition) => { | |
| 54 | -/******/ for(var key in definition) { | |
| 55 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 56 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 57 | -/******/ } | |
| 49 | +/******/ // define getter/value functions for harmony exports | |
| 50 | +/******/ __webpack_require__.d = (exports, definition) => { | |
| 51 | +/******/ for(var key in definition) { | |
| 52 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 53 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 58 | 54 | /******/ } |
| 59 | -/******/ }; | |
| 60 | -/******/ })(); | |
| 55 | +/******/ } | |
| 56 | +/******/ }; | |
| 61 | 57 | /******/ |
| 62 | 58 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 63 | -/******/ (() => { | |
| 64 | -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 65 | -/******/ })(); | |
| 59 | +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)); | |
| 66 | 60 | /******/ |
| 67 | 61 | /************************************************************************/ |
| 68 | -var __webpack_exports__ = {}; | |
| 62 | +let __webpack_exports__ = {}; | |
| 69 | 63 | // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 70 | 64 | (() => { |
| 71 | 65 | "use strict"; |
| 72 | 66 | |
| @@ -78,10 +72,8 @@ | ||
| 78 | 72 | const languagesList = jQuery('.post_lang_choice'); |
| 79 | 73 | |
| 80 | 74 | // Dialog box for alerting the user about a risky changing. |
| 81 | 75 | const initializeConfirmationModal = () => { |
| 82 | - // We can't use underscore or lodash in this common code because it depends of the context classic or block editor. | |
| 83 | - // Classic editor underscore is loaded, Block editor lodash is loaded. | |
| 84 | 76 | const { |
| 85 | 77 | __ |
| 86 | 78 | } = wp.i18n; |
| 87 | 79 | |
| @@ -92,15 +84,12 @@ | ||
| 92 | 84 | }).text(__('Are you sure you want to change the language of the current content?', 'polylang')); |
| 93 | 85 | |
| 94 | 86 | // Put it after languages list dropdown. |
| 95 | 87 | // PHPCS ignore dialogContainer is a new safe HTML code generated above. |
| 96 | - languagesList.after(dialogContainer); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.after | |
| 97 | - | |
| 88 | + languagesList.after(dialogContainer); | |
| 98 | 89 | const dialogResult = new Promise((confirm, cancel) => { |
| 99 | 90 | const confirmDialog = what => { |
| 100 | - // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 101 | 91 | switch (what) { |
| 102 | - // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 103 | 92 | case 'yes': |
| 104 | 93 | // Confirm the new language. |
| 105 | 94 | languagesList.data('old-value', languagesList.children(':selected').first().val()); |
| 106 | 95 | confirm(); |
| @@ -110,10 +99,10 @@ | ||
| 110 | 99 | languagesList.val(languagesList.data('old-value')); |
| 111 | 100 | cancel('Cancel'); |
| 112 | 101 | break; |
| 113 | 102 | } |
| 114 | - dialogContainer.dialog('close'); // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 115 | - }; // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 103 | + dialogContainer.dialog('close'); | |
| 104 | + }; | |
| 116 | 105 | |
| 117 | 106 | // Initialize dialog box in the case a language is selected but not added in the list. |
| 118 | 107 | const dialogOptions = { |
| 119 | 108 | autoOpen: false, |
| @@ -185,9 +174,9 @@ | ||
| 185 | 174 | source: ajaxurl + '?action=pll_posts_not_translated' + '&post_language=' + jQuery('.post_lang_choice').val() + '&translation_language=' + tr_lang + '&post_type=' + jQuery('#post_type').val() + '&_pll_nonce=' + jQuery('#_pll_nonce').val(), |
| 186 | 175 | select: function (event, ui) { |
| 187 | 176 | jQuery('#htr_lang_' + tr_lang).val(ui.item.id); |
| 188 | 177 | // ui.item.link is built and come from server side and is well escaped when necessary |
| 189 | - td.html(ui.item.link); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html | |
| 178 | + td.html(ui.item.link); | |
| 190 | 179 | } |
| 191 | 180 | }); |
| 192 | 181 | |
| 193 | 182 | // when the input box is emptied |
| @@ -194,9 +183,9 @@ | ||
| 194 | 183 | jQuery(this).on('blur', function () { |
| 195 | 184 | if (!jQuery(this).val()) { |
| 196 | 185 | jQuery('#htr_lang_' + tr_lang).val(0); |
| 197 | 186 | // Value is retrieved from HTML already generated server side |
| 198 | - td.html(td.siblings('.hidden').children().clone()); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html | |
| 187 | + td.html(td.siblings('.hidden').children().clone()); | |
| 199 | 188 | } |
| 200 | 189 | }); |
| 201 | 190 | }); |
| 202 | 191 | } |
| @@ -360,9 +349,8 @@ | ||
| 360 | 349 | dialogResult = Promise.resolve(); |
| 361 | 350 | } |
| 362 | 351 | dialogResult.then(() => { |
| 363 | 352 | let data = { |
| 364 | - // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 365 | 353 | action: 'post_lang_choice', |
| 366 | 354 | lang: selectedOption.value, |
| 367 | 355 | post_type: $('#post_type').val(), |
| 368 | 356 | post_id: $('#post_ID').val(), |
| @@ -392,11 +380,11 @@ | ||
| 392 | 380 | // new_lang input is controlled server side in PHP. The value come from the dropdown list of language returned and escaped server side. |
| 393 | 381 | // Notice that window.location changing triggers automatically page reloading. |
| 394 | 382 | if (-1 != location.search.indexOf('new_lang')) { |
| 395 | 383 | // use regexp non capturing group to replace new_lang parameter no matter where it is and capture other parameters which can be behind it |
| 396 | - window.location.search = window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/, 'new_lang=' + lang + '$1$2'); // phpcs:ignore WordPressVIPMinimum.JS.Window.location, WordPressVIPMinimum.JS.Window.VarAssignment | |
| 384 | + window.location.search = window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/, 'new_lang=' + lang + '$1$2'); | |
| 397 | 385 | } else { |
| 398 | - window.location.search = window.location.search + (-1 != window.location.search.indexOf('?') ? '&' : '?') + 'new_lang=' + lang; // phpcs:ignore WordPressVIPMinimum.JS.Window.location, WordPressVIPMinimum.JS.Window.VarAssignment | |
| 386 | + window.location.search = window.location.search + (-1 != window.location.search.indexOf('?') ? '&' : '?') + 'new_lang=' + lang; | |
| 399 | 387 | } |
| 400 | 388 | } |
| 401 | 389 | ; |
| 402 | 390 | |