| @@ -35,50 +35,29 @@ | ||
| 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 | -/******/ const 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/value functions for harmony exports | |
| 53 | -/******/ __webpack_require__.d = (exports, definition) => { | |
| 54 | -/******/ if(Array.isArray(definition)) { | |
| 55 | -/******/ var i = 0; | |
| 56 | -/******/ while(i < definition.length) { | |
| 57 | -/******/ var key = definition[i++]; | |
| 58 | -/******/ var binding = definition[i++]; | |
| 59 | -/******/ if(!__webpack_require__.o(exports, key)) { | |
| 60 | -/******/ if(binding === 0) { | |
| 61 | -/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 62 | -/******/ } else { | |
| 63 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 64 | -/******/ } | |
| 65 | -/******/ } else if(binding === 0) { i++; } | |
| 66 | -/******/ } | |
| 67 | -/******/ } else { | |
| 68 | -/******/ for(var key in definition) { | |
| 69 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 70 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 71 | -/******/ } | |
| 72 | -/******/ } | |
| 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] }); | |
| 73 | 54 | /******/ } |
| 74 | -/******/ }; | |
| 75 | -/******/ })(); | |
| 55 | +/******/ } | |
| 56 | +/******/ }; | |
| 76 | 57 | /******/ |
| 77 | 58 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 78 | -/******/ (() => { | |
| 79 | -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 80 | -/******/ })(); | |
| 59 | +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)); | |
| 81 | 60 | /******/ |
| 82 | 61 | /************************************************************************/ |
| 83 | 62 | let __webpack_exports__ = {}; |
| 84 | 63 | // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| @@ -93,10 +72,8 @@ | ||
| 93 | 72 | const languagesList = jQuery('.post_lang_choice'); |
| 94 | 73 | |
| 95 | 74 | // Dialog box for alerting the user about a risky changing. |
| 96 | 75 | const initializeConfirmationModal = () => { |
| 97 | - // We can't use underscore or lodash in this common code because it depends of the context classic or block editor. | |
| 98 | - // Classic editor underscore is loaded, Block editor lodash is loaded. | |
| 99 | 76 | const { |
| 100 | 77 | __ |
| 101 | 78 | } = wp.i18n; |
| 102 | 79 | |
| @@ -107,15 +84,12 @@ | ||
| 107 | 84 | }).text(__('Are you sure you want to change the language of the current content?', 'polylang')); |
| 108 | 85 | |
| 109 | 86 | // Put it after languages list dropdown. |
| 110 | 87 | // PHPCS ignore dialogContainer is a new safe HTML code generated above. |
| 111 | - languagesList.after(dialogContainer); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.after | |
| 112 | - | |
| 88 | + languagesList.after(dialogContainer); | |
| 113 | 89 | const dialogResult = new Promise((confirm, cancel) => { |
| 114 | 90 | const confirmDialog = what => { |
| 115 | - // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 116 | 91 | switch (what) { |
| 117 | - // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 118 | 92 | case 'yes': |
| 119 | 93 | // Confirm the new language. |
| 120 | 94 | languagesList.data('old-value', languagesList.children(':selected').first().val()); |
| 121 | 95 | confirm(); |
| @@ -125,10 +99,10 @@ | ||
| 125 | 99 | languagesList.val(languagesList.data('old-value')); |
| 126 | 100 | cancel('Cancel'); |
| 127 | 101 | break; |
| 128 | 102 | } |
| 129 | - dialogContainer.dialog('close'); // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 130 | - }; // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 103 | + dialogContainer.dialog('close'); | |
| 104 | + }; | |
| 131 | 105 | |
| 132 | 106 | // Initialize dialog box in the case a language is selected but not added in the list. |
| 133 | 107 | const dialogOptions = { |
| 134 | 108 | autoOpen: false, |
| @@ -200,9 +174,9 @@ | ||
| 200 | 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(), |
| 201 | 175 | select: function (event, ui) { |
| 202 | 176 | jQuery('#htr_lang_' + tr_lang).val(ui.item.id); |
| 203 | 177 | // ui.item.link is built and come from server side and is well escaped when necessary |
| 204 | - td.html(ui.item.link); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html | |
| 178 | + td.html(ui.item.link); | |
| 205 | 179 | } |
| 206 | 180 | }); |
| 207 | 181 | |
| 208 | 182 | // when the input box is emptied |
| @@ -209,9 +183,9 @@ | ||
| 209 | 183 | jQuery(this).on('blur', function () { |
| 210 | 184 | if (!jQuery(this).val()) { |
| 211 | 185 | jQuery('#htr_lang_' + tr_lang).val(0); |
| 212 | 186 | // Value is retrieved from HTML already generated server side |
| 213 | - td.html(td.siblings('.hidden').children().clone()); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html | |
| 187 | + td.html(td.siblings('.hidden').children().clone()); | |
| 214 | 188 | } |
| 215 | 189 | }); |
| 216 | 190 | }); |
| 217 | 191 | } |
| @@ -375,9 +349,8 @@ | ||
| 375 | 349 | dialogResult = Promise.resolve(); |
| 376 | 350 | } |
| 377 | 351 | dialogResult.then(() => { |
| 378 | 352 | let data = { |
| 379 | - // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent | |
| 380 | 353 | action: 'post_lang_choice', |
| 381 | 354 | lang: selectedOption.value, |
| 382 | 355 | post_type: $('#post_type').val(), |
| 383 | 356 | post_id: $('#post_ID').val(), |
| @@ -407,11 +380,11 @@ | ||
| 407 | 380 | // new_lang input is controlled server side in PHP. The value come from the dropdown list of language returned and escaped server side. |
| 408 | 381 | // Notice that window.location changing triggers automatically page reloading. |
| 409 | 382 | if (-1 != location.search.indexOf('new_lang')) { |
| 410 | 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 |
| 411 | - 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'); | |
| 412 | 385 | } else { |
| 413 | - 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; | |
| 414 | 387 | } |
| 415 | 388 | } |
| 416 | 389 | ; |
| 417 | 390 | |