Skip to content

Commit

Permalink
* fix bug #3: replace GeneralUtility::slashJS by static::slashJS whic…
Browse files Browse the repository at this point in the history
…h is a copy of the other slashJS method.
  • Loading branch information
franzholz committed Feb 10, 2020
1 parent 304cb06 commit 7141051
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2020-02-10 Franz Holzinger <franz@ttproducts.de>
* fix bug #3: replace GeneralUtility::slashJS by static::slashJS which is a copy of the other slashJS method.

2020-01-08 Franz Holzinger <franz@ttproducts.de>
* new feature: add support for extension lib_jquery to include the jquery-1.10.0.min.js library in many versions.
Expand Down
8 changes: 1 addition & 7 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

########################################################################
# 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(
'title' => 'Multiple Content',
'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' => '',
Expand Down
31 changes: 21 additions & 10 deletions pi1/class.tx_jfmulticontent_pi1.php
Original file line number Diff line number Diff line change
Expand Up @@ -1086,15 +1086,15 @@ 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 =
\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey)) . $local;
} 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'] . "'";
Expand All @@ -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) . ")";
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 7141051

Please sign in to comment.