From 70d25484e4ca9c76d886bf676608449ca88de939 Mon Sep 17 00:00:00 2001 From: Cliff Date: Sun, 18 Oct 2020 10:37:20 +0100 Subject: [PATCH 01/26] Added height control and v-scroll to com_admin sidebars (#31092) * Added height control and v-scroll to com_admin sidebars * Changed order of css statements * White space * Added close help index feature for small screens * Put css in same order as remote * Amended css order for failing tests * change order of css statements * Removed aria-label from button in com_admin and com_config * Changed css 100vh to 75vh --- administrator/components/com_admin/tmpl/help/default.php | 8 ++++++-- .../components/com_config/tmpl/component/default.php | 2 +- .../templates/atum/scss/blocks/_sidebar-nav.scss | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_admin/tmpl/help/default.php b/administrator/components/com_admin/tmpl/help/default.php index f225efa64eb86..6e5c112abaf9d 100644 --- a/administrator/components/com_admin/tmpl/help/default.php +++ b/administrator/components/com_admin/tmpl/help/default.php @@ -20,7 +20,11 @@
diff --git a/administrator/components/com_config/tmpl/component/default.php b/administrator/components/com_config/tmpl/component/default.php index 970b1ebb543f6..3e9ba9b2e926d 100644 --- a/administrator/components/com_config/tmpl/component/default.php +++ b/administrator/components/com_config/tmpl/component/default.php @@ -43,7 +43,7 @@
- +
From 7b6e69a970d9520ee290a4d58ab89943a873f205 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Wed, 21 Oct 2020 09:48:42 +0200 Subject: [PATCH 14/26] Fix MySQL error 1093 from PR #30945 (#31171) --- .../com_admin/sql/updates/mysql/4.0.0-2020-09-27.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-09-27.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-09-27.sql index 5f8791398a118..a6495e0ec6547 100644 --- a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-09-27.sql +++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-09-27.sql @@ -4,9 +4,11 @@ DELETE FROM `#__extensions` WHERE `name` = 'plg_authentication_gmail' AND `type` -- -- Delete possibly duplicate record for plg_sampledata_multilang -- -DELETE FROM `#__extensions` - WHERE `name` = 'plg_sampledata_multilang' AND `type` = 'plugin' AND `element` = 'multilang' AND `folder` = 'sampledata' AND `client_id` = 0 - AND `extension_id` < (SELECT MAX(`extension_id`) FROM `#__extensions` WHERE `name` = 'plg_sampledata_multilang' AND `type` = 'plugin' AND `element` = 'multilang' AND `folder` = 'sampledata' AND `client_id` = 0); +DELETE `e1`.* + FROM `#__extensions` AS `e1` + LEFT JOIN (SELECT MAX(extension_id) AS last_id FROM `#__extensions` GROUP BY `name`,`type`,`element`,`folder`,`client_id`) AS `e2` + ON `e2`.`last_id` = `e1`.`extension_id` + WHERE `last_id` IS NULL; -- -- Enable the remaining plg_sampledata_multilang record in case it has been disabled before From 4208b6c0799de8d147d6f16c8a8ba7f2413947a5 Mon Sep 17 00:00:00 2001 From: Dimitris Grammatikogiannis Date: Wed, 21 Oct 2020 18:22:56 +0200 Subject: [PATCH 15/26] [4.0] More cleanup on the jstools (#31158) --- .eslintignore | 15 ---- .../joomla-field-fancy-select.w-c.es6.js | 11 ++- .../joomla-field-module-order.w-c.es6.js | 28 +++++--- .../joomla-field-permissions.w-c.es6.js | 3 +- .../joomla-field-send-test-mail.w-c.es6.js | 15 ++-- .../joomla-field-simple-color.w-c.es6.js | 22 +++--- .../js/fields/joomla-field-subform.w-c.es6.js | 72 +++++++++---------- package.json | 2 +- 8 files changed, 85 insertions(+), 83 deletions(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 0521bd9bdc407..0000000000000 --- a/.eslintignore +++ /dev/null @@ -1,15 +0,0 @@ -# A list of files to ignore from linting -*.js -!*.es6.js -administrator/components/com_media/node_modules/uri-js/node_modules/punycode/punycode.es6.js -media -# Don't validate temporary build files -build/tmp -# TODO: Fix the webcomponents codestyle then also allow linting on them -joomla-field-fancy-select.w-c.es6.js -joomla-field-module-order.w-c.es6.js -joomla-field-permissions.w-c.es6.js -joomla-field-send-test-mail.w-c.es6.js -joomla-field-simple-color.w-c.es6.js -joomla-field-subform.w-c.es6.js -# End of TODO diff --git a/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js index 11b2979b72281..e9d0d00876886 100644 --- a/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js @@ -34,7 +34,7 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem get termKey() { return this.getAttribute('term-key') || 'term'; } - get minTermLength() { return parseInt(this.getAttribute('min-term-length')) || 1; } + get minTermLength() { return parseInt(this.getAttribute('min-term-length'), 10) || 1; } get newItemPrefix() { return this.getAttribute('new-item-prefix') || ''; } @@ -117,6 +117,7 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem } // Init Choices + // eslint-disable-next-line no-undef this.choicesInstance = new Choices(this.select, { placeholderValue: this.placeholder, searchPlaceholderValue: this.searchPlaceholder, @@ -245,8 +246,6 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem event.target.value = null; this.choicesInstance.hideDropdown(); - - return false; }); } @@ -283,7 +282,7 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem } requestLookup() { - let url = this.url; + let { url } = this; url += (url.indexOf('?') === -1 ? '?' : '&'); url += `${encodeURIComponent(this.termKey)}=${encodeURIComponent(this.choicesInstance.input.value)}`; @@ -293,7 +292,7 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem } this.activeXHR = Joomla.request({ - url: url, + url, onSuccess: (response) => { this.activeXHR = null; const items = response ? JSON.parse(response) : []; @@ -323,7 +322,7 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem }, onError: () => { this.activeXHR = null; - } + }, }); } diff --git a/build/media_source/system/js/fields/joomla-field-module-order.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-module-order.w-c.es6.js index 659d9863c2055..d62f8d9251737 100644 --- a/build/media_source/system/js/fields/joomla-field-module-order.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-module-order.w-c.es6.js @@ -44,7 +44,7 @@ customElements.define('joomla-field-module-order', class extends HTMLElement { writeDynaList(selectProperties, source, originalPositionName, originalPositionValue) { let i = 0; const selectNode = document.createElement('select'); - if (this.hasOwnProperty('disabled')) { + if (this.hasAttribute('disabled')) { selectNode.setAttribute('disabled', ''); } @@ -60,18 +60,24 @@ customElements.define('joomla-field-module-order', class extends HTMLElement { selectNode.setAttribute('name', selectProperties.name); selectNode.id = selectProperties.id; + // eslint-disable-next-line no-restricted-syntax for (const x in source) { + // eslint-disable-next-line no-prototype-builtins if (!source.hasOwnProperty(x)) { + // eslint-disable-next-line no-continue continue; } const node = document.createElement('option'); const item = source[x]; + // eslint-disable-next-line prefer-destructuring node.value = item[1]; + // eslint-disable-next-line prefer-destructuring node.innerHTML = item[2]; - if ((originalPositionName && originalPositionValue === item[1]) || (!originalPositionName && i === 0)) { + if ((originalPositionName && originalPositionValue === item[1]) + || (!originalPositionName && i === 0)) { node.setAttribute('selected', 'selected'); } @@ -98,13 +104,19 @@ customElements.define('joomla-field-module-order', class extends HTMLElement { method: 'GET', perform: true, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - onSuccess(response) { - if (response) { - response = JSON.parse(response); + onSuccess(resp) { + if (resp) { + let response; + try { + response = JSON.parse(resp); + } catch (e) { + // eslint-disable-next-line no-console + console.error(e); + } /** Check if everything is OK * */ if (response.data.length > 0) { - for (let i = 0; i < response.data.length; ++i) { + for (let i = 0; i < response.data.length; i += 1) { orders[i] = response.data[i].split(','); } @@ -120,8 +132,8 @@ customElements.define('joomla-field-module-order', class extends HTMLElement { } /** Render messages, if any. There are only message in case of errors. * */ - if (typeof response.messages === 'object' && response.messages !== null) { - Joomla.renderMessages(response.messages); + if (typeof resp.messages === 'object' && resp.messages !== null) { + Joomla.renderMessages(resp.messages); } }, }); diff --git a/build/media_source/system/js/fields/joomla-field-permissions.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-permissions.w-c.es6.js index 37011aa6deabe..39b840bbba7f3 100644 --- a/build/media_source/system/js/fields/joomla-field-permissions.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-permissions.w-c.es6.js @@ -124,7 +124,8 @@ window.customElements.define('joomla-field-permissions', class extends HTMLEleme try { response = JSON.parse(data); } catch (e) { - console.log(e); + // eslint-disable-next-line no-console + console.error(e); } icon.removeAttribute('class'); diff --git a/build/media_source/system/js/fields/joomla-field-send-test-mail.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-send-test-mail.w-c.es6.js index d4407e5752764..9b26af503909e 100644 --- a/build/media_source/system/js/fields/joomla-field-send-test-mail.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-send-test-mail.w-c.es6.js @@ -23,7 +23,7 @@ } sendTestMail() { - const email_data = { + const emailData = { smtpauth: document.getElementById('jform_smtpauth1').checked ? 1 : 0, smtpuser: this.querySelector('[name="jform[smtpuser]"]').value, smtppass: this.querySelector('[name="jform[smtppass]"]').value, @@ -42,11 +42,18 @@ Joomla.request({ url: this.getAttribute('uri'), method: 'POST', - data: JSON.stringify(email_data), + data: JSON.stringify(emailData), perform: true, headers: { 'Content-Type': 'application/json' }, - onSuccess: (response) => { - response = JSON.parse(response); + onSuccess: (resp) => { + let response; + try { + response = JSON.parse(resp); + } catch (e) { + // eslint-disable-next-line no-console + console.error(e); + } + if (typeof response.messages === 'object' && response.messages !== null) { Joomla.renderMessages(response.messages); } diff --git a/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js index a5ec99c9f2e4d..4e3dd5cf30d23 100644 --- a/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js @@ -291,17 +291,14 @@ this.appendChild(this.panel); - this.focusableElements = [].slice.call(this.panel.querySelectorAll(this.focusableSelectors.join())); + this.focusableElements = [].slice + .call(this.panel.querySelectorAll(this.focusableSelectors.join())); this.keys = this.keys.bind(this); this.hide = this.hide.bind(this); this.mousedown = this.mousedown.bind(this); } - disconnectedCallback() { - - } - static get observedAttributes() { return ['text-select', 'text-color', 'text-close', 'text-transparent']; } @@ -406,6 +403,7 @@ } // Prevents the mousedown event from "eating" the click event. + // eslint-disable-next-line class-methods-use-this mousedown(e) { e.stopPropagation(); e.preventDefault(); @@ -416,10 +414,13 @@ let newValue = value; if (value.length === 4) { const tmpValue = value.split(''); - newValue = tmpValue[0] + tmpValue[1] + tmpValue[1] + tmpValue[2] + tmpValue[2] + tmpValue[3] + tmpValue[3]; + newValue = tmpValue[0] + tmpValue[1] + tmpValue[1] + tmpValue[2] + + tmpValue[2] + tmpValue[3] + tmpValue[3]; } + // eslint-disable-next-line no-restricted-syntax for (const color in colorNames) { + // eslint-disable-next-line no-prototype-builtins if (colorNames.hasOwnProperty(color) && newValue.toLowerCase() === colorNames[color]) { return color; } @@ -429,11 +430,12 @@ } /** - * Converts a RGB color to its hexadecimal value. - * See http://stackoverflow.com/questions/1740700/get-hex-value-rather-than-rgb-value-using-$ - */ + * Converts a RGB color to its hexadecimal value. + * See http://stackoverflow.com/questions/1740700/get-hex-value-rather-than-rgb-value-using-$ + */ + // eslint-disable-next-line class-methods-use-this rgb2hex(rgb) { - const hex = x => (`0${parseInt(x, 10).toString(16)}`).slice(-2); + const hex = (x) => (`0${parseInt(x, 10).toString(16)}`).slice(-2); const matches = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); return `#${hex(matches[1])}${hex(matches[2])}${hex(matches[3])}`; diff --git a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js index 46b55ea517cd5..a7911f3897ac7 100644 --- a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js @@ -42,7 +42,7 @@ set name(value) { // Update the template - this.template = this.template.replace(new RegExp(` name="${this.name.replace(/[\[\]]/g, '\\$&')}`, 'g'), ` name="${value}`); + this.template = this.template.replace(new RegExp(` name="${this.name.replace(/[[\]]/g, '\\$&')}`, 'g'), ` name="${value}`); return this.setAttribute('name', value); } @@ -59,12 +59,11 @@ const allContainers = this.querySelectorAll(this.rowsContainer); // Find closest, and exclude nested - for (let i = 0, l = allContainers.length; i < l; i++) { - if (allContainers[i].closest('joomla-field-subform') === this) { - this.containerWithRows = allContainers[i]; - break; + Array.from(allContainers).forEach((container) => { + if (container.closest('joomla-field-subform') === this) { + this.containerWithRows = container; } - } + }); } // Keep track of row index, this is important to avoid a name duplication @@ -141,11 +140,11 @@ const result = []; // Filter out the rows - for (let i = 0, l = rows.length; i < l; i++) { - if (rows[i].matches(this.repeatableElement)) { - result.push(rows[i]); + rows.forEach((row) => { + if (row.matches(this.repeatableElement)) { + result.push(row); } - } + }); return result; } @@ -249,11 +248,10 @@ * @param {Number} count */ fixUniqueAttributes(row, count) { - count = count || 0; - + const countTmp = count || 0; const group = row.getAttribute('data-group'); // current group name const basename = row.getAttribute('data-base-name'); - const countnew = Math.max(this.lastRowIndex, count); + const countnew = Math.max(this.lastRowIndex, countTmp); const groupnew = basename + countnew; // new group name this.lastRowIndex = countnew + 1; @@ -266,8 +264,8 @@ // Filter out nested haveName = [].slice.call(haveName).filter((el) => el.closest('joomla-field-subform') === this); - for (let i = 0, l = haveName.length; i < l; i++) { - const $el = haveName[i]; + haveName.forEach((elem) => { + const $el = elem; const name = $el.getAttribute('name'); const id = name .replace(/(\[\]$)/g, '') @@ -286,7 +284,6 @@ // Set the id for fieldset and group label const fieldset = $el.closest('fieldset.checkboxes'); - const elLbl = row.querySelector(`label[for="${id}"]`); if (fieldset) { @@ -307,7 +304,6 @@ // Set the id for fieldset and group label const fieldset = $el.closest('fieldset.radio'); - const elLbl = row.querySelector(`label[for="${id}"]`); if (fieldset) { @@ -342,7 +338,7 @@ lbl.setAttribute('for', idNew); lbl.setAttribute('id', `${idNew}-lbl`); } - } + }); } /** @@ -357,13 +353,12 @@ // Find all existing rows and add draggable attributes const rows = this.getRows(); - for (let ir = 0, lr = rows.length; ir < lr; ir++) { - const childRow = rows[ir]; - childRow.setAttribute('draggable', 'false'); - childRow.setAttribute('aria-grabbed', 'false'); - childRow.setAttribute('tabindex', '0'); - } + rows.forEach((row) => { + row.setAttribute('draggable', 'false'); + row.setAttribute('aria-grabbed', 'false'); + row.setAttribute('tabindex', '0'); + }); // Helper method to test whether Handler was clicked function getMoveHandler(element) { @@ -390,16 +385,21 @@ } } - // Touch interaction: - // - a touch of "move button" mark a row draggable / "selected", or deselect previous selected - // - a touch of "move button" in the destination row will move a selected row to a new position + /** + * Touch interaction: + * + * - a touch of "move button" mark a row draggable / "selected", + * or deselect previous selected + * + * - a touch of "move button" in the destination row will move + * a selected row to a new position + */ this.addEventListener('touchstart', (event) => { touched = true; // Check for .move button const handler = getMoveHandler(event.target); - const row = handler ? handler.closest(that.repeatableElement) : null; if (!row || row.closest('joomla-field-subform') !== that) { @@ -411,9 +411,7 @@ row.setAttribute('draggable', 'true'); row.setAttribute('aria-grabbed', 'true'); item = row; - } - // Second selection - else { + } else { // Second selection // Move to selected position if (row !== item) { switchRowPositions(item, row); @@ -436,7 +434,6 @@ // Check for .move button const handler = getMoveHandler(target); - const row = handler ? handler.closest(that.repeatableElement) : null; if (!row || row.closest('joomla-field-subform') !== that) { @@ -463,8 +460,10 @@ // - "enter" to place selected row in to destination // - "esc" to cancel selection this.addEventListener('keydown', (event) => { - if ((event.keyCode !== KEYCODE.ESC && event.keyCode !== KEYCODE.SPACE && event.keyCode !== KEYCODE.ENTER) - || event.target.form || !event.target.matches(that.repeatableElement)) { + if ((event.keyCode !== KEYCODE.ESC + && event.keyCode !== KEYCODE.SPACE + && event.keyCode !== KEYCODE.ENTER) || event.target.form + || !event.target.matches(that.repeatableElement)) { return; } @@ -482,9 +481,7 @@ row.setAttribute('draggable', 'false'); row.setAttribute('aria-grabbed', 'false'); item = null; - } - // Select new - else { + } else { // Select new // If there was previously selected if (item) { item.setAttribute('draggable', 'false'); @@ -502,7 +499,6 @@ event.preventDefault(); } - // Escape is the abort keystroke (for any target element) if (event.keyCode === KEYCODE.ESC && item) { item.setAttribute('draggable', 'false'); diff --git a/package.json b/package.json index fa7b90aad9d10..8f2284f4ddc90 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "build:js": "node build/build.js --compile-js", "build:css": "node build/build.js --compile-css", "watch": "node build/build.js --watch", - "lint:js": "node ./node_modules/eslint/bin/eslint.js --config build/.eslintrc --ext .js,.vue .", + "lint:js": "node ./node_modules/eslint/bin/eslint.js --config build/.eslintrc --ignore-pattern '/media/' --ext .es6.js,.vue .", "lint:css": "node ./node_modules/stylelint/bin/stylelint.js --config build/.stylelintrc.json -s scss \"administrator/components/com_media/resources/**/*.scss\" \"administrator/templates/**/*.scss\" \"build/media_source/**/*.scss\" \"templates/**/*.scss\" \"installation/template/**/*.scss\"", "test": "npx karma start tests/javascript/karma.conf.js --single-run", "install": "node build/build.js --copy-assets && node build/build.js --build-pages", From b1777b88c596197126ad2495fbaa7fe9705358f7 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Wed, 21 Oct 2020 19:47:13 +0100 Subject: [PATCH 16/26] Fix undefined error when invalid redis cache host (#31121) --- libraries/src/Cache/Storage/RedisStorage.php | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/src/Cache/Storage/RedisStorage.php b/libraries/src/Cache/Storage/RedisStorage.php index 3f343cd51f599..44a3e8406cf05 100644 --- a/libraries/src/Cache/Storage/RedisStorage.php +++ b/libraries/src/Cache/Storage/RedisStorage.php @@ -102,6 +102,7 @@ protected function getConnection() } catch (\RedisException $e) { + $connection = false; Log::add($e->getMessage(), Log::DEBUG); } From a4de85ad58023848cc9e4dcd5d071660695d3e49 Mon Sep 17 00:00:00 2001 From: Hans Kuijpers Date: Wed, 21 Oct 2020 21:17:06 +0200 Subject: [PATCH 17/26] [4.0] wrap message container output in an array and implode it so it prevents obsolete spaces (#30760) * move joomla-alert from message to it's own JLayout * Update message.php * remove extra jlayout file * add the else statement when msgList is empty. that's easy * rewrite current PHP code so all html will be put directly after each other * Update layouts/joomla/system/message.php Co-authored-by: Richard Fath * Update layouts/joomla/system/message.php Co-authored-by: Richard Fath * move wrapper * put if-else in a wrapper * changed array into string to prevent implode * :recycle: clean code Co-authored-by: Richard Fath --- layouts/joomla/system/message.php | 42 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/layouts/joomla/system/message.php b/layouts/joomla/system/message.php index 460a215a80055..cca4581cc4924 100644 --- a/layouts/joomla/system/message.php +++ b/layouts/joomla/system/message.php @@ -13,7 +13,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; -$msgList = $displayData['msgList']; +$msgList = $displayData['msgList']; +$msgOutput = ''; $alert = [ CMSApplication::MSG_EMERGENCY => 'danger', @@ -43,25 +44,22 @@ ->useStyle('webcomponent.joomla-alert') ->useScript('webcomponent.joomla-alert'); +if (is_array($msgList) && !empty($msgList)) : + foreach ($msgList as $type => $msgs) : + $msgOutput .= ''; + if (!empty($msgs)) : + $msgOutput .= '
'; + $msgOutput .= ''; + $msgOutput .= '' . Text::_($type) . ''; + $msgOutput .= '
'; + $msgOutput .= '
'; + foreach ($msgs as $msg) : + $msgOutput .= '
' . $msg . '
'; + endforeach; + $msgOutput .= '
'; + endif; + $msgOutput .= '
'; + endforeach; +endif; ?> -
-
- - $msgs) : ?> - - -
- - -
-
- -
- -
- -
- - -
-
+
From e9863f317114cf12e391bd287f836cbde3d2bc0b Mon Sep 17 00:00:00 2001 From: Christiane Maier-Stadtherr Date: Thu, 22 Oct 2020 09:43:25 +0200 Subject: [PATCH 18/26] Set alt="" for random images (#31175) --- modules/mod_random_image/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mod_random_image/tmpl/default.php b/modules/mod_random_image/tmpl/default.php index 156b394bb8ff4..a939c2bc33dc9 100644 --- a/modules/mod_random_image/tmpl/default.php +++ b/modules/mod_random_image/tmpl/default.php @@ -24,7 +24,7 @@ - folder . '/' . htmlspecialchars($image->name, ENT_COMPAT, 'UTF-8'), htmlspecialchars($image->name, ENT_COMPAT, 'UTF-8'), array('width' => $image->width, 'height' => $image->height)); ?> + folder . '/' . htmlspecialchars($image->name, ENT_COMPAT, 'UTF-8'), '', array('width' => $image->width, 'height' => $image->height)); ?> From ed0b30bd1a75d2122f9c168761d89d96dcbcc5a3 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Thu, 22 Oct 2020 11:40:11 +0300 Subject: [PATCH 19/26] [4.0] Lint .es6 files (#31197) * Remove empty lines --- build/media_source/system/js/core.es6/form.es6 | 2 -- build/media_source/system/js/core.es6/message.es6 | 2 -- package.json | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/build/media_source/system/js/core.es6/form.es6 b/build/media_source/system/js/core.es6/form.es6 index 17ddbbb58bbc5..e3df01a33320b 100644 --- a/build/media_source/system/js/core.es6/form.es6 +++ b/build/media_source/system/js/core.es6/form.es6 @@ -91,7 +91,6 @@ } }; - /** * USED IN: all list forms. * @@ -223,7 +222,6 @@ let i = 0; let cbx; - if (!cb) { return false; } diff --git a/build/media_source/system/js/core.es6/message.es6 b/build/media_source/system/js/core.es6/message.es6 index b1cd7854d3cd7..309ec31d238c3 100644 --- a/build/media_source/system/js/core.es6/message.es6 +++ b/build/media_source/system/js/core.es6/message.es6 @@ -133,7 +133,6 @@ Joomla.ajaxErrorsMessages = (xhr, textStatus) => { const msg = {}; - if (textStatus === 'parsererror') { // For jQuery jqXHR const buf = []; @@ -141,7 +140,6 @@ // Html entity encode. let encodedJson = xhr.responseText.trim(); - // eslint-disable-next-line no-plusplus for (let i = encodedJson.length - 1; i >= 0; i--) { buf.unshift(['&#', encodedJson[i].charCodeAt(), ';'].join('')); diff --git a/package.json b/package.json index 8f2284f4ddc90..798c507cca93e 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "build:js": "node build/build.js --compile-js", "build:css": "node build/build.js --compile-css", "watch": "node build/build.js --watch", - "lint:js": "node ./node_modules/eslint/bin/eslint.js --config build/.eslintrc --ignore-pattern '/media/' --ext .es6.js,.vue .", + "lint:js": "node ./node_modules/eslint/bin/eslint.js --config build/.eslintrc --ignore-pattern '/media/' --ext .es6.js,.es6,.vue .", "lint:css": "node ./node_modules/stylelint/bin/stylelint.js --config build/.stylelintrc.json -s scss \"administrator/components/com_media/resources/**/*.scss\" \"administrator/templates/**/*.scss\" \"build/media_source/**/*.scss\" \"templates/**/*.scss\" \"installation/template/**/*.scss\"", "test": "npx karma start tests/javascript/karma.conf.js --single-run", "install": "node build/build.js --copy-assets && node build/build.js --build-pages", From 04e74c86a8b32511126249f75baa3659ef9457d6 Mon Sep 17 00:00:00 2001 From: Hans Kuijpers Date: Thu, 22 Oct 2020 16:02:51 +0200 Subject: [PATCH 20/26] [4.0] House cleaning => remove obsolete div element in system message container (#31195) * remove obsolete wrapping div element with id = system-message * remove obsolete styling --- build/media_source/system/css/system.css | 69 ------------------ .../system/images/notice-alert.png | Bin 862 -> 0 bytes .../system/images/notice-download.png | Bin 966 -> 0 bytes .../system/images/notice-info.png | Bin 1106 -> 0 bytes .../system/images/notice-note.png | Bin 771 -> 0 bytes layouts/joomla/system/message.php | 2 +- templates/system/css/offline.css | 6 -- 7 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 build/media_source/system/css/system.css delete mode 100644 build/media_source/system/images/notice-alert.png delete mode 100644 build/media_source/system/images/notice-download.png delete mode 100644 build/media_source/system/images/notice-info.png delete mode 100644 build/media_source/system/images/notice-note.png diff --git a/build/media_source/system/css/system.css b/build/media_source/system/css/system.css deleted file mode 100644 index b710f52be106e..0000000000000 --- a/build/media_source/system/css/system.css +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -/* System Messages */ -#system-message { - margin-bottom: 10px; - padding: 0; -} - -#system-message > dt { - font-weight: bold; - display: none; -} - -#system-message > dd { - margin: 0; - font-weight: bold; - text-indent: 30px; -} - -#system-message > dd > ul { - color: #0055BB; - background-position: 4px top; - background-repeat: no-repeat; - margin-bottom: 10px; - list-style: none; - padding: 10px; - border-top: 3px solid #84A7DB; - border-bottom: 3px solid #84A7DB; -} - -#system-message > dd > ul > li { - line-height: 1.5em; -} - -/* System Standard Messages */ -#system-message > .message > ul { - background-color: #C3D2E5; - background-image: url(../images/notice-info.png); -} - -/* System Error Messages */ -#system-message > .error > ul, -#system-message > .warning > ul, -#system-message > .notice > ul { - color: #c00; -} - -#system-message > .error > ul { - background-color: #E6C0C0; - background-image: url(../images/notice-alert.png); - border-color: #DE7A7B; -} - -/* System Warning Messages */ -#system-message > .warning > ul { - background-color: #E6C8A6; - background-image: url(../images/notice-note.png); - border-color: #FFBB00; -} - -/* System Notice Messages */ -#system-message > .notice > ul { - background-color: #EFE7B8; - background-image: url(../images/notice-note.png); - border-color: #F0DC7E; -} diff --git a/build/media_source/system/images/notice-alert.png b/build/media_source/system/images/notice-alert.png deleted file mode 100644 index d21ae83486103cb372bdd994682dbe3da605614c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 862 zcmV-k1EKthP)afwx`;UUMDAfFn=m zneL?%O$;X6rpbZtdVn`yqTuI%0cQpDfPlAODV=%aMPQOeq}puf(s2eivd&{9Dg{q4 z1LIB2nP@3JD5++m6_inETY7(t&ir7KReU(bg@@yfcsN$y8T0@jlKde(5XvgFCA~Y| zyzO4rfqP?g-9z$w15UZWGfJCnD!nyEpT9NPj$5O&JwsWzHA&7AZ;TX}y3%VS1m^k# zOY!<>9j=cQ`olOAu8%QD<9uCdaX9~RajY5C%UmAD<6MTr=`@E^ZE~78Pc>Jlb|_~s z^Jrb^r3^du(r^LP%bZSWaQnbcblQruf5sWArHm4z^re0n=dO{SPqX5MG>ajQCN$`_ zNwtr&h6w}@%FoqE&m`3-=Ri!=wN$FD$jk6jpRbXgOsG-L-e~tyskS07%~M}TdNig) zIlIG(uBBA_BrC4M(IhL4Yo&+jKso!ON}T@uQxrF?gxDrU;_xT$V}G5%^{_GbDYEGD2q)YWnb8m5U?qtmc~;X{`Rg7sg|xw8L%dz!J3e&C)UO|tV?L+ z@w$*I-B7wbsB$k0vsjrjLF$(U)m^bX!b=&0bJf(Ae{Bncn%u%Lk0lu^7Dfdu2x>ZF zQCyG3X$uyFSWwo{ML{*w*3Ds7K=bwNuz-1KE9Rywm>tz(R*-E>h{K$i4)Zc}K53Tc zv@XsLXxts$k){UN+|&Sv=`kZ_rfry&v14Y^D$O4=BW{w`XwQL}DI2Cobf6lEt@3Fc|O;rE}v0XsaRa7gl4k^lez07*qoM6N<$g1R`U8~^|S diff --git a/build/media_source/system/images/notice-download.png b/build/media_source/system/images/notice-download.png deleted file mode 100644 index ca095d5e4964073e750e03872c9d75d796b2defd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 966 zcmV;%13CPOP)XT3Ai-NQv}+etB2DJ;e1*f`rZo^9VdJ|AM+F5^q@`EF)eDZj7kx9so# z8)qHP!rXc&!p|8sA3uH6D7$FHs)-T%92(Q#u*UQ&|5w?02d#U~K4k7ZW7I$*P8%_P z;3Ikg8KJI>WtZ-cNN4OfcAS2|Kss3a^}mA$vKv&)94HaN1rSnGg}2vX_;o zEDQ~WqS0aFpXjiTX(GEdSZg`-ZVJ6!nWa;Kxr`yaO+|EYX8iVI$b~76gi|-r ztNlfGNiIhr*(SNHo#x-6ojMl68tM%=5ES`+QSjAFKsqJHU-bKpU(}}-}-tDPAC;} zV(G>l@J@z!eYRdm*9V`o@97#7+8S*Fb%hGn&Y)B&kV|FwU+^cCX0OVIR3L%YQLq*U zb(uOdD~7cu1hP8tx=l(~now726Yw4tuWWq6%TSc@Yijl8IkWT*m_fI^t{28&gd}dY*zAOZ?#6cQZYJe|MCt0k5 zwJ}7BBUrO3D zY4V*XwOX1mBg=(c6K!8Tn!ap|`?NDk)eqckZ@@AZ9PmikGA7r5#$c3D(4H z#BK-aJqbChb0&pfjv)L_7_>?V8<}HAYc_CfgACH>yDqMjRC~`mwN3@E*TCxdLWF=p z&Q~D4B|*xTLCeMPTHCrAy!9qXjeRfe;tKC`t{Ne(5#kz_F>9w6pXK|^g z$yF)DRR&lkOAAeOd;(JH{ezTw&dW+Cq{#E!am5mNg$2D_2P>rsQOnecwI`IwAcdX- zq}ZcpWfD^0K9A(Pw;xw1&S9wmUS=Uw9-fPkSrh-AR7@e({z3BGwueAw@*K~3B->LY oI3U0R{tzq|YaSNNJAa4sAF7d=IuZV-4gdfE07*qoM6N<$g4bEdoB#j- diff --git a/build/media_source/system/images/notice-info.png b/build/media_source/system/images/notice-info.png deleted file mode 100644 index eb93e9ea5bb73356f6ce5fd1f858eb239c4ebb48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1106 zcmV-Y1g-mtP)rzu^6oyw$Bs2%N|N4_l$R%(I%yJDX5NUT89wxz zePVeOCeHfNBWQ=h(DrZR$}eGD`FS7Tj_krRb|7nvtWgae#&|a8(+xdgt9~f5cWLwx znZpsN1`j}jfiUR)CW60zz-h>5X`qjnRi{xSl1U?GJ5tvJ)vao@4z~|nPkc}(TnR;jCo*R zWUlX~f7R;lZHK9M7v$bnrfUn-z7FT&QQXkI{#MjPFG0(@VC>xy=NR`SWyg-!QfBwo zd$ns5)Ts<>K&@=h90WDagPImVEvsCArKrzvZ$aC&CC(0I)3#T+nVqk}S(%n~HVPv5 z$89)f_L(qp9`M4uY}&e!a_)3zNZIt>OP{9YB{(N@cMVyt6$Fp}O#YrdY}(AQPKk`R zjnnhG!VjcrHAYQqP~^@sKUoBUy>|#k|41;kP4CG4RI{4qHK-ZhZ%a14y@HfDmq51` zKy|ao8C*(yQr9Br`z55C*EX(-tngiL1@Tep=HOn8#0^95K7eXxKn;s&=d{ixkrhnq z7m${^7oh5=i2e0X+|)S}V$<2Qb1FvLuqe(7rZ?x2mfGjY@tk|L_vX0Hq?yy!zkurG ztYCWmc~Ey_4xE*#d;<4;IBpm`d=IJ!fNEw%KPCE`@tq2Prs`jvh8s`8Ihm>eq?##y zwSUJ=Z4)aX$F%6DM8)W9|J(UY;jiSFvSw6ILt8b)%YI6v{1I}!^Eew>*C#=x6LOC# z9t&L(hMH-pE9J9~Qbze?z*zkQ)D@GwY~p`PeQ-QpPB3)_R^fcIf!yKWK=$!OJ)?6> z!cg__yyNsf>Z6ZF ziN~fX^T1L$1f6|=4f~lsP@x-+NAn15M&MiCfo<#=BzrHYs7LgLPR39^2y>+uD*5gS zQOTf07m6acTT|?Yxx5!9dk=Ia-E8UtU2O;Dw=!*@f{v5gwJxZb4Axj!Z)82+MLkAE z-B$XfC~UJ)K`RW!9k7(SaLL{UQ>jbb<7Ad}$~B35X4dG6+QBn|AQiS}(PzcgMl0pt z2{6zVHoeS?QT&Jt@jyzlu zXW`MCTzpG>0MT-h_ zo+>}jp?pffP}_MrE9>VTy&@?J^yJFLmi#e6+$lVwB6Oz1X)~N0y(srcPpq9~^l(D- zkN~F=oRIX)(X-;w^hw)JF?zs`mcO4vQQdz$Q9w?7^prRhMAJo##R#YDX!vYBDk^$3 z!7)+1_~>!T@Ige(g@;=T6N2jRdqy;WD~p;hz@Zq2wRiE+!{U><=%A@IPVapqnmg5n ze=2$)axlRmaqZ{<3G_lg#uRrsCdl9Q%;=bd=48T}1I92}JIaNI30r+skUO2$!A2!O zIM8~`SUWY1uX%QKj2ELbYm6|u-__CbXTEd$1sK!xfc5}!(P6=CnnQy8KGD&_1HN-r zbi^3Wh!f*UQ68pQ4GJnfg7WijRMajnW>6o9h8meAJ{cG7lY4|2aaVOl!`*@$mALCh zGz>A`Ie>B4({{95))TZITfLjXp%e-?JcP>G49dK(*`E+LckI~Fz2XwIeI2^Fvz-j* z-kIM>m$Rt#7%u@?VL$o1cek7)XdOd@+hcy(KAl6EkD=cT8;5yJx{{+i#U)^uW(*K+ zv!kWgKFWLyeTiXz_Mf&Ll2ze|5ic`Z<<5-5do+!DJ4#0M9ivWi)C_lnhmw~R#i>Cm z9BvWhw+ae;PHm5%sSaDkiwFP!002ovPDHLkV1kn@ BZ^r-t diff --git a/layouts/joomla/system/message.php b/layouts/joomla/system/message.php index cca4581cc4924..900a38efd3251 100644 --- a/layouts/joomla/system/message.php +++ b/layouts/joomla/system/message.php @@ -62,4 +62,4 @@ endforeach; endif; ?> -
+
diff --git a/templates/system/css/offline.css b/templates/system/css/offline.css index 0ebf54c455816..3ccd91c07ca4f 100644 --- a/templates/system/css/offline.css +++ b/templates/system/css/offline.css @@ -105,12 +105,6 @@ fieldset.input p { /* -- message styles ----------------------------------- */ -#system-message { - margin: 0 auto; - padding: 20px 0 0; - max-width: 445px; -} - .alert { background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #CCCCCC; From f020116a6aed678bbcd3070a8160ada03324b6b3 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Thu, 22 Oct 2020 18:28:35 +0300 Subject: [PATCH 21/26] Fix error on System Information page (#31189) --- .../src/Extension/AdminComponent.php | 2 + .../src/Service/HTML/Configuration.php | 44 +++++++++++++++++++ .../com_admin/tmpl/sysinfo/default_config.php | 6 +-- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 administrator/components/com_admin/src/Service/HTML/Configuration.php diff --git a/administrator/components/com_admin/src/Extension/AdminComponent.php b/administrator/components/com_admin/src/Extension/AdminComponent.php index e76ffbfde45f2..d7a3f16be1554 100644 --- a/administrator/components/com_admin/src/Extension/AdminComponent.php +++ b/administrator/components/com_admin/src/Extension/AdminComponent.php @@ -14,6 +14,7 @@ use Joomla\CMS\Extension\BootableExtensionInterface; use Joomla\CMS\Extension\MVCComponent; use Joomla\CMS\HTML\HTMLRegistryAwareTrait; +use Joomla\Component\Admin\Administrator\Service\HTML\Configuration; use Joomla\Component\Admin\Administrator\Service\HTML\Directory; use Joomla\Component\Admin\Administrator\Service\HTML\PhpSetting; use Joomla\Component\Admin\Administrator\Service\HTML\System; @@ -46,5 +47,6 @@ public function boot(ContainerInterface $container) $this->getRegistry()->register('system', new System); $this->getRegistry()->register('phpsetting', new PhpSetting); $this->getRegistry()->register('directory', new Directory); + $this->getRegistry()->register('configuration', new Configuration); } } diff --git a/administrator/components/com_admin/src/Service/HTML/Configuration.php b/administrator/components/com_admin/src/Service/HTML/Configuration.php new file mode 100644 index 0000000000000..013d241c9989e --- /dev/null +++ b/administrator/components/com_admin/src/Service/HTML/Configuration.php @@ -0,0 +1,44 @@ + - - - - + From 425de684cdaaa8e5f51d66579ce3f1121018f501 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Thu, 22 Oct 2020 22:40:01 +0300 Subject: [PATCH 22/26] Remove unused file (#31198) --- build/media_source/system/scss/_jalert.scss | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 build/media_source/system/scss/_jalert.scss diff --git a/build/media_source/system/scss/_jalert.scss b/build/media_source/system/scss/_jalert.scss deleted file mode 100644 index 3e3cba269a2ce..0000000000000 --- a/build/media_source/system/scss/_jalert.scss +++ /dev/null @@ -1,19 +0,0 @@ -// Bootstrap alert mapping - -@mixin alert-variant($background, $border, $body-color) { - color: $body-color; - background-color: $background; - border-color: $border; - border-left: 10px solid $background; - - hr { - border-top-color: darken($background, 5%); - } - .alert-link { - color: darken($background, 10%); - } -} - -.alert-message { - @include alert-variant(theme-color("success"), theme-color("success"), $gray-200); -} From 793b62de5c9f04ce4c5ed9f0b4083c7579b28109 Mon Sep 17 00:00:00 2001 From: Dimitris Grammatikogiannis Date: Fri, 23 Oct 2020 21:44:49 +0200 Subject: [PATCH 23/26] nodelist !== array (#31213) --- .../system/js/fields/joomla-field-subform.w-c.es6.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js index a7911f3897ac7..1be710f15c8b3 100644 --- a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js @@ -136,7 +136,7 @@ * @returns {HTMLElement[]} */ getRows() { - const rows = this.containerWithRows.children; + const rows = Array.from(this.containerWithRows.children); const result = []; // Filter out the rows @@ -352,7 +352,7 @@ let touched = false; // We have a touch events // Find all existing rows and add draggable attributes - const rows = this.getRows(); + const rows = Array.from(this.getRows()); rows.forEach((row) => { row.setAttribute('draggable', 'false'); From 3c97ab58f563fb0f0e738d6b420ade23456e491b Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Fri, 23 Oct 2020 22:04:25 +0200 Subject: [PATCH 24/26] [4.0] Cleaning up Drone configuration (#31116) * Cleaning up Drone configuration * Fix step dependency * Switching npm image to 14-alpine --- .drone.yml | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/.drone.yml b/.drone.yml index 250329cffe3e2..c5bcb35de8874 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,7 +24,7 @@ steps: - echo $(date) - name: npm - image: node:current-alpine + image: node:14-alpine depends_on: [ phpcs ] commands: - npm ci --unsafe-perm @@ -128,20 +128,8 @@ steps: commands: - npm run lint:js - - name: javascript-tests - depends_on: [ npm ] - image: joomlaprojects/docker-images:systemtests - environment: - JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1 - commands: - - export DISPLAY=:0 - - Xvfb -screen 0 1024x768x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 & - - sleep 3 - - fluxbox > /dev/null 2>&1 & - - npm run test - - name: system-tests-mysql - depends_on: [ javascript-tests ] + depends_on: [ javascript-cs ] image: joomlaprojects/docker-images:systemtests environment: JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1 @@ -215,15 +203,9 @@ branches: exclude: [ l10n_* ] volumes: -- name: cache - host: - path: /tmp/cache - name: composer-cache host: path: /tmp/composer-cache -- name: reference - host: - path: /tmp/reference services: - name: mysql @@ -243,12 +225,6 @@ services: MYSQL_ROOT_PASSWORD: joomla_ut MYSQL_DATABASE: test_joomla - - name: memcached - image: memcached:alpine - - - name: redis - image: redis:alpine - - name: postgres image: postgres:11-alpine ports: @@ -293,6 +269,6 @@ steps: --- kind: signature -hmac: 4f58d8f61573498094e990f8f9ca8dec5324e727cfaa277c8fcb2392c17e33fe +hmac: f99784b6fd6bf3707a600f262bb9e59aa7b5f97e54df8976e459096de4344ef3 ... From c9e7c855443e8a3eef91719965f1c67bc6268793 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Sat, 24 Oct 2020 01:17:10 +0100 Subject: [PATCH 25/26] [4.0] Reset, Remind, Register (#31215) Changes the order of the links in the login module to match the order of the links in the login component. It is a fairly arbitrary order but they should be the same. Partial PR for #31212 --- modules/mod_login/tmpl/default.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/mod_login/tmpl/default.php b/modules/mod_login/tmpl/default.php index c73ec1dc5152a..eb27497fc3fc6 100644 --- a/modules/mod_login/tmpl/default.php +++ b/modules/mod_login/tmpl/default.php @@ -141,20 +141,20 @@ class="btn btn-secondary " From 29b2267a3237151c00268b786e80118c08e537e0 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Sat, 24 Oct 2020 03:18:01 +0300 Subject: [PATCH 26/26] [4.0] WebAsset exceptions (#31214) --- libraries/src/WebAsset/WebAssetManager.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/libraries/src/WebAsset/WebAssetManager.php b/libraries/src/WebAsset/WebAssetManager.php index 64dd8bdd7bf86..70af5f44b6c82 100644 --- a/libraries/src/WebAsset/WebAssetManager.php +++ b/libraries/src/WebAsset/WebAssetManager.php @@ -503,6 +503,8 @@ public function assetExists(string $type, string $name): bool * @return self * * @since 4.0.0 + * + * @throws \InvalidArgumentException */ public function registerAsset(string $type, $asset, string $uri = '', array $options = [], array $attributes = [], array $dependencies = []) { @@ -518,7 +520,14 @@ public function registerAsset(string $type, $asset, string $uri = '', array $opt } else { - throw new \BadMethodCallException('The $asset variable should be either WebAssetItemInterface or a string of the asset name'); + throw new \InvalidArgumentException( + sprintf( + '%s(): Argument #2 ($asset) must be a string or an instance of %s, %s given.', + __METHOD__, + WebAssetItemInterface::class, + \is_object($asset) ? \get_class($asset) : \gettype($asset) + ) + ); } return $this; @@ -672,6 +681,8 @@ public function filterOutInlineAssets(array &$assets): array * @return self * * @since 4.0.0 + * + * @throws \InvalidArgumentException */ public function addInline(string $type, $content, array $options = [], array $attributes = [], array $dependencies = []): self { @@ -687,7 +698,14 @@ public function addInline(string $type, $content, array $options = [], array $at } else { - throw new \BadMethodCallException('The $content variable should be either WebAssetItemInterface or a string'); + throw new \InvalidArgumentException( + sprintf( + '%s(): Argument #2 ($content) must be a string or an instance of %s, %s given.', + __METHOD__, + WebAssetItemInterface::class, + \is_object($content) ? \get_class($content) : \gettype($content) + ) + ); } // Get the name