Bug #23677 » svg_ts.diff
t3lib/class.t3lib_pagerenderer.php (working copy) | ||
---|---|---|
protected $scriptaculousPath = 'contrib/scriptaculous/';
|
||
protected $extCorePath = 'contrib/extjs/';
|
||
protected $extJsPath = 'contrib/extjs/';
|
||
protected $SVGPath = 'contrib/websvg/';
|
||
// internal flags for JS-libraries
|
||
... | ... | |
protected $addExtCore = FALSE;
|
||
protected $extJSadapter = 'ext/ext-base.js';
|
||
protected $enableExtJsDebug = FALSE;
|
||
protected $enableExtCoreDebug = FALSE;
|
||
... | ... | |
protected $inlineJavascriptWrap = array ();
|
||
protected $addSVG = FALSE;
|
||
protected $enableSVGDebug = FALSE;
|
||
// used by BE modules
|
||
public $backPath;
|
||
... | ... | |
$this->extJsPath = $path;
|
||
}
|
||
/**
|
||
* Sets Path for SVG library (websvg)
|
||
*
|
||
* @param string $path
|
||
* @return void
|
||
*/
|
||
public function setSVGPath($path) {
|
||
$this->SVGPath = $path;
|
||
}
|
||
/*****************************************************/
|
||
/* */
|
||
/* Public Enablers / Disablers */
|
||
... | ... | |
}
|
||
/**
|
||
* Gets Path for SVG library (relative to typo3 directory)
|
||
*
|
||
* @return string
|
||
*/
|
||
public function getSVGPath() {
|
||
return $this->SVGPath;
|
||
}
|
||
/**
|
||
* Gets the inline language labels.
|
||
*
|
||
* @return array The inline language labels
|
||
... | ... | |
}
|
||
/**
|
||
* call function if you need the SVG library
|
||
*
|
||
* @return void
|
||
*/
|
||
public function loadSVG() {
|
||
$this->addSVG = TRUE;
|
||
}
|
||
/**
|
||
* call this function to load debug version of ExtJS. Use this for development only
|
||
*
|
||
*/
|
||
public function enableSVGDebug() {
|
||
$this->enableSVGDebug = TRUE;
|
||
}
|
||
/**
|
||
* call this function to force flash usage with SVG library
|
||
*
|
||
*/
|
||
public function SVGForceFlash() {
|
||
$this->addMetaTag('<meta name="svg.render.forceflash" content="true" />');
|
||
}
|
||
/**
|
||
* call this function to load debug version of ExtJS. Use this for development only
|
||
*
|
||
*/
|
||
public function enableExtJsDebug() {
|
||
$this->enableExtJsDebug = TRUE;
|
||
}
|
||
... | ... | |
protected function renderJsLibraries() {
|
||
$out = '';
|
||
if ($this->addSVG) {
|
||
$out .= '<script src="' . $this->processJsFile($this->backPath . $this->SVGPath . 'svg.js') .
|
||
'" data-path="' . $this->backPath . $this->SVGPath .
|
||
'"' . ($this->enableSVGDebug ? ' data-debug="true"' : '') . '></script>';
|
||
}
|
||
if ($this->addPrototype) {
|
||
$out .= '<script src="' . $this->processJsFile($this->backPath . $this->prototypePath . 'prototype.js') .
|
||
'" type="text/javascript"></script>' . LF;
|
typo3/sysext/cms/tslib/class.tslib_content.php (working copy) | ||
---|---|---|
case 'QTOBJECT' :
|
||
$content .= $this->QTOBJECT($conf);
|
||
break;
|
||
case 'SVG' :
|
||
$content .= $this->SVG($conf);
|
||
break;
|
||
default :
|
||
// call hook functions for extra processing
|
||
if ($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
|
||
... | ... | |
return $content;
|
||
}
|
||
/**
|
||
* Rendering the cObject, SVG
|
||
*
|
||
* @param array array of TypoScript properties
|
||
* @return string Output
|
||
*/
|
||
public function SVG($conf) {
|
||
$width = $conf['width'] ? $conf['width'] : 600;
|
||
$height = $conf['height'] ? $conf['height'] : 400;
|
||
$src = $conf['src'] ? $this->stdWrap($conf['src'], $conf['src.']) : NULL;
|
||
$value = $this->stdWrap($conf['value'], $conf['value.']);
|
||
if ($src) {
|
||
$content = '
|
||
<!--[if IE]>
|
||
<object src="' . $src . '" classid="image/svg+xml" width="' . $width . '" height="' . $height . '">
|
||
<![endif]-->
|
||
<!--[if !IE]>-->
|
||
<object data="' . $src . '" type="image/svg+xml" width="' . $width . '" height="' . $height . '">
|
||
<!--<![endif]-->
|
||
' . $this->stdWrap($conf['noscript'], $conf['noscript.']) . '
|
||
</object>
|
||
';
|
||
} else {
|
||
$content = '
|
||
<script type="image/svg+xml">
|
||
<svg xmlns="http://www.w3.org/2000/svg"
|
||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||
width="' . $width . '"
|
||
height="' . $height . '">
|
||
' . $value . '
|
||
</svg>
|
||
</script>
|
||
<noscript>
|
||
' . $this->stdWrap($conf['noscript'], $conf['noscript.']) . '
|
||
</noscript>
|
||
';
|
||
}
|
||
return $content;
|
||
}
|
||
/************************************
|
||
*
|
||
* Various helper functions for content objects:
|
typo3/sysext/cms/tslib/class.tslib_pagegen.php (working copy) | ||
---|---|---|
// Javascript Libraries
|
||
if (is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.'])) {
|
||
if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG']) {
|
||
$pageRenderer->loadSVG();
|
||
if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['debug']) {
|
||
$pageRenderer->enableSVGDebug();
|
||
}
|
||
if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['forceFlash']) {
|
||
$pageRenderer->SVGForceFlash();
|
||
}
|
||
}
|
||
if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Prototype']) {
|
||
$pageRenderer->loadPrototype();
|
||
}
|