-
+
escapeHtml($job->getDataSize()); ?>
diff --git a/view/frontend/templates/internals/configuration.phtml b/view/frontend/templates/internals/configuration.phtml
index 7986b6711..47621ce1c 100755
--- a/view/frontend/templates/internals/configuration.phtml
+++ b/view/frontend/templates/internals/configuration.phtml
@@ -1,20 +1,18 @@
getConfiguration();
?>
-
+renderTag('style', [], $configuration['instant']['selector'] . ' {display:none}', false);
+ /* @noEscape */ echo $secureRenderer->renderTag('script', [], 'document.write(\'' . $css . '\');' , false);
+}
+?>
+
+= /* @noEscape */ $secureRenderer->renderTag('script', [], "window.algoliaConfig = " . json_encode($configuration) . ';' , false); ?>
+
diff --git a/view/frontend/templates/layer/view.phtml b/view/frontend/templates/layer/view.phtml
index 0649850d0..f444d6318 100644
--- a/view/frontend/templates/layer/view.phtml
+++ b/view/frontend/templates/layer/view.phtml
@@ -1,3 +1,7 @@
+
+
canShowBlock()) : ?>
getLayer()->getState()->getFilters()) ?>
@@ -30,14 +34,16 @@
-
+
+ = /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false); ?>
-
\ No newline at end of file
+
diff --git a/view/frontend/web/instantsearch.js b/view/frontend/web/instantsearch.js
index e8430286d..5d357bc52 100644
--- a/view/frontend/web/instantsearch.js
+++ b/view/frontend/web/instantsearch.js
@@ -352,11 +352,14 @@ define(
container: instant_selector,
placeholder: algoliaConfig.translations.searchFor,
showSubmit: false,
- queryHook: function (inputValue, search) {
- if (algoliaConfig.isSearchPage && algoliaConfig.request.categoryId.length <= 0 && algoliaConfig.request.landingPageId.length <= 0) {
- $(".page-title-wrapper span.base").html(algoliaConfig.translations.searchTitle + ": '" + algolia.htmlspecialcharsDecode(inputValue) + "'");
+ queryHook: (inputValue, search) => {
+ const encodedHtml = algolia.htmlspecialcharsEncode(inputValue);
+ if (algoliaConfig.isSearchPage
+ && !algoliaConfig.request.categoryId
+ && !algoliaConfig.request.landingPageId.length) {
+ $(".page-title-wrapper span.base").html(algoliaConfig.translations.searchTitle + ": '" + encodedHtml + "'");
}
- return search(inputValue);
+ return search(inputValue);
}
}
}
diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js
index da5138844..2e130bc8b 100755
--- a/view/frontend/web/internals/common.js
+++ b/view/frontend/web/internals/common.js
@@ -1,6 +1,20 @@
define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) {
+ // Character maps supplied for more performant Regex ops
+ const SPECIAL_CHAR_ENCODE_MAP = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ };
+
+ /// Reverse key / value pair
+ const SPECIAL_CHAR_DECODE_MAP = Object.entries(SPECIAL_CHAR_ENCODE_MAP).reduce((acc, [key, value]) => {
+ acc[value] = key;
+ return acc;
+ }, {});
- window.algolia = {
+ window.algolia = {
deprecatedHooks: [
'beforeAutocompleteProductSourceOptions',
'beforeAutocompleteSources'
@@ -64,23 +78,14 @@ define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) {
return data;
},
- htmlspecialcharsDecode: function(string) {
- var unescapedString = string,
- specialchars = [
- [ '"', '"' ],
- [ '>', '>' ],
- [ '<', '<' ],
- [ '&', '&' ],
- [ "'", ''' ]
- ];
-
- var len = specialchars.length;
- for (var i=0; i
{
+ const regex = new RegExp(Object.keys(SPECIAL_CHAR_DECODE_MAP).join('|'), 'g');
+ return string.replace(regex, m => SPECIAL_CHAR_DECODE_MAP[m]);
+ },
+ htmlspecialcharsEncode: string => {
+ const regex = new RegExp(`[${Object.keys(SPECIAL_CHAR_ENCODE_MAP).join('')}]`, 'g');
+ return string.replace(regex, (m) => SPECIAL_CHAR_ENCODE_MAP[m]);
+ }
};
window.isMobile = function () {