From 71410515447506f44357a6dadf3b5bddf029f07c Mon Sep 17 00:00:00 2001 From: Franz Holzinger Date: Mon, 10 Feb 2020 14:10:52 +0100 Subject: [PATCH] * fix bug #3: replace GeneralUtility::slashJS by static::slashJS which is a copy of the other slashJS method. --- ChangeLog | 2 ++ ext_emconf.php | 8 +------- pi1/class.tx_jfmulticontent_pi1.php | 31 +++++++++++++++++++---------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf73ff6..bba1a6b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +2020-02-10 Franz Holzinger + * fix bug #3: replace GeneralUtility::slashJS by static::slashJS which is a copy of the other slashJS method. 2020-01-08 Franz Holzinger * new feature: add support for extension lib_jquery to include the jquery-1.10.0.min.js library in many versions. diff --git a/ext_emconf.php b/ext_emconf.php index b233f36..5f2b689 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -2,12 +2,6 @@ ######################################################################## # Extension Manager/Repository config file for ext "jfmulticontent". -# -# Auto generated 10-08-2015 09:40 -# -# Manual updates: -# Only the data in the array - everything else is removed by next -# writing. "version" and "dependencies" must not be touched! ######################################################################## $EM_CONF[$_EXTKEY] = array( @@ -15,7 +9,7 @@ 'description' => 'Arranges multiple contents into one content element with multiple columns, accordions, tabs, slider, slidedeck, easyAccordion or Booklet (Sponsored by http://www.made-in-nature.de/typo3-agentur.html). This extension will also extend tt_news with two new lists.', 'category' => 'plugin', 'shy' => 0, - 'version' => '2.11.1', + 'version' => '2.11.2', 'dependencies' => '', 'conflicts' => '', 'priority' => '', diff --git a/pi1/class.tx_jfmulticontent_pi1.php b/pi1/class.tx_jfmulticontent_pi1.php index dfeea87..e216e2c 100755 --- a/pi1/class.tx_jfmulticontent_pi1.php +++ b/pi1/class.tx_jfmulticontent_pi1.php @@ -1086,7 +1086,7 @@ public function main ($content, $conf) $this->pagerenderer->addCssFileInc($this->conf['sliderCSSie7'], 'lte IE 7'); if ($this->conf['config.']['sliderTheme']) { - $options[] = "theme: '" . GeneralUtility::slashJS($this->conf['config.']['sliderTheme']) . "'"; + $options[] = 'theme: \'' . static::slashJS($this->conf['config.']['sliderTheme']) . '\''; if (substr($this->confArr['anythingSliderThemeFolder'], 0, 4) === 'EXT:') { list($extKey, $local) = explode('/', substr($this->confArr['anythingSliderThemeFolder'], 4), 2); $anythingSliderThemeFolder = @@ -1094,7 +1094,7 @@ public function main ($content, $conf) } else { $anythingSliderThemeFolder = $this->confArr['anythingSliderThemeFolder']; } - $this->pagerenderer->addCssFile(GeneralUtility::slashJS($anythingSliderThemeFolder) . $this->conf['config.']['sliderTheme'] . '/style.css'); + $this->pagerenderer->addCssFile(static::slashJS($anythingSliderThemeFolder) . $this->conf['config.']['sliderTheme'] . '/style.css'); } if ($this->conf['config.']['sliderMode']) { $options[] = "mode: '" . $this->conf['config.']['sliderMode'] . "'"; @@ -1108,24 +1108,24 @@ public function main ($content, $conf) $options[] = 'buildNavigation: ' . ($this->conf['config.']['sliderNavigation'] ? 'true' : 'false'); $options[] = 'buildStartStop: ' . ($this->conf['config.']['sliderStartStop'] ? 'true' : 'false'); - $options[] = "startText: '" . GeneralUtility::slashJS($this->pi_getLL('slider_start')) . "'"; - $options[] = "stopText: '" . GeneralUtility::slashJS($this->pi_getLL('slider_stop')) . "'"; + $options[] = 'startText: \'' . static::slashJS($this->pi_getLL('slider_start')) . '\''; + $options[] = 'stopText: \'' . static::slashJS($this->pi_getLL('slider_stop')) . '\''; if ($this->pi_getLL('slider_forward')) { - $options[] = "forwardText: '".GeneralUtility::slashJS($this->pi_getLL('slider_forward')) . "'"; + $options[] = 'forwardText: \'' . static::slashJS($this->pi_getLL('slider_forward')) . '\''; } if ($this->pi_getLL('slider_back')) { - $options[] = "backText: '" . GeneralUtility::slashJS($this->pi_getLL('slider_back')) . "'"; + $options[] = 'backText: \'' . static::slashJS($this->pi_getLL('slider_back')) . '\''; } // define the paneltext if ($this->conf['config.']['sliderPanelFromHeader']) { $tab = array(); - for ($a=0; $a < $this->contentCount; $a++) { + for ($a = 0; $a < $this->contentCount; $a++) { $tab[] = 'if(i==' . ($a + 1) . ') return ' . GeneralUtility::quoteJSvalue($this->titles[$a]) . ';'; } - $options[] = "navigationFormatter: function(i,p){\n " . implode("\n ", $tab) . "\n }"; + $options[] = 'navigationFormatter: function(i,p){' . PHP_EOL . implode(PHP_EOL . ' ', $tab) . PHP_EOL . ' }'; } elseif (trim($this->pi_getLL('slider_panel'))) { - $options[] = "navigationFormatter: function(i,p){ var str = '" . (GeneralUtility::slashJS($this->pi_getLL('slider_panel'))) . "'; return str.replace('%i%',i); }"; + $options[] = 'navigationFormatter: function(i,p){ var str = \'' . (static::slashJS($this->pi_getLL('slider_panel'))) . '\'; return str.replace(\'%i%\',i); }'; } if ($this->conf['config.']['sliderRandomContent']) { $options[] = "startPanel: Math.floor(Math.random()*" . ($this->contentCount + 1) . ")"; @@ -1704,7 +1704,18 @@ protected function getFlexformData ($sheet = '', $name = '', $devlog = true) } return $result; } - + + /** + * This function is used to escape any ' -characters when transferring text to JavaScript! + * + * @param string $string String to escape + * @return string Processed input string + */ + public static function slashJS($string) + { + return str_replace($char, '\\' . $char, $string); + } + /** * @return PageRepository */