}
- if ((int)$this->theme->parametres->iconSet < 15) {
- $this->theme->parametres->iconSet = 15;
+ $this->svgfiles = array_unique([$this->assets . '/images/symbols/interface.svg',
+ WS_ICONS . '/15/interface.svg']);
+ if ($this->theme->parametres->iconSet > 15) {
+ $this->svgfiles[] = WS_ICONS . '/' . $this->theme->parametres->iconSet . '/interface.svg';
}
- $this->svgfiles = array($this->assets . '/images/symbols/interface.svg',
- WS_ICONS . '/' . $this->theme->parametres->iconSet . '/interface.svg');
if ($this->book->parametres->zoomMode == 1 || $this->isMobileFirst()) {
$this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssOneScale;
}
$print = $this->writePrint();
- $message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), '<br /><a href="http://www.whatbrowser.org/intl/' . $this->config->defaultLang . '/" target="_blank">', '</a>');
+ $message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), '<!--', '-->');
$splash = '';
$splashstyles = '';
$splash .= '<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
}
}
-
-
- $svg = '';
- foreach ($this->svgfiles as $svgfile) {
- if (file_exists($svgfile)) {
- $svg .= str_replace('$bookmark-color', wsHTML5::colorToCSS($this->theme->parametres->bookmarkBackgroundColor), file_get_contents($svgfile));
- } else {
- die($svgfile . ' does not exist');
- }
- }
- if (count($this->_svgSymbols)) {
- $svg .= '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">' . implode('', $this->_svgSymbols) . '</svg>' . "\n";
- }
+ $svg = $this->_mergeSVG();
if ($this->phonegap) {
$csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
return $this->_indexVars;
}
+ protected function _mergeSVG()
+ {
+ $symbols = [];
+ foreach ($this->svgfiles as $svgfile) {
+ $symbols = array_merge($symbols, $this->_getSVGSymbols($svgfile));
+ }
+ $symbols = array_merge($symbols, $this->_svgSymbols);
+ return '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">' . str_replace('> <', '><', CubeIT_Util_Text::removeNewLines(implode('', $symbols))) . '</svg>';
+ }
+
+ protected function _getSVGSymbols($svg)
+ {
+ if (file_exists($svg)) {
+ $svg = file_get_contents($svg);
+ }
+ $svg = str_replace('$bookmark-color', wsHTML5::colorToCSS($this->theme->parametres->bookmarkBackgroundColor), $svg);
+ $res = [];
+ $xml = simplexml_load_string($svg);
+ $xml->registerXPathNamespace('svg', 'http://www.w3.org/2000/svg');
+ foreach ($xml->xpath('//svg:symbol') as $item) {
+ $res[(string)$item['id']] = $item->asXML();
+ }
+
+ return $res;
+ }
+
protected function writeIndex()
{
$xml = simplexml_load_string(file_get_contents($svg));
$viewBox = (string)$xml['viewBox'];
- $this->_svgSymbols[] = '<symbol id="' . $symbolName . '" viewBox="' . $viewBox . '">' . $this->SimpleXMLElement_innerXML($xml) . '</symbol>';
+ $this->_svgSymbols[$symbolName] = '<symbol id="' . $symbolName . '" viewBox="' . $viewBox . '">' . $this->SimpleXMLElement_innerXML($xml) . '</symbol>';
}
protected function writeLinks()