Index: class.tx_rtehtmlarea_base.php
===================================================================
--- class.tx_rtehtmlarea_base.php (révision 7836)
+++ class.tx_rtehtmlarea_base.php (copie de travail)
@@ -41,7 +41,15 @@
'msie' => array (
1 => array (
'version' => 6.0,
- 'system' => 'win'
+ 'system' => 'winNT'
+ ),
+ 2 => array (
+ 'version' => 6.0,
+ 'system' => 'win98'
+ ),
+ 3 => array (
+ 'version' => 6.0,
+ 'system' => 'win95'
)
),
'gecko' => array (
@@ -49,7 +57,7 @@
'version' => 1.8
)
),
- 'safari' => array (
+ 'webkit' => array (
1 => array (
'version' => 523
)
@@ -143,13 +151,13 @@
$rteConfBrowser = $this->conf_supported_browser;
if (is_array($rteConfBrowser)) {
foreach ($rteConfBrowser as $browser => $browserConf) {
- if ($browser == $this->client['BROWSER']) {
+ if ($browser == $this->client['browser']) {
// Config for Browser found, check it:
if (is_array($browserConf)) {
foreach ($browserConf as $browserConfNr => $browserConfSub) {
- if ($browserConfSub['version'] <= $this->client['VERSION'] || empty($browserConfSub['version'])) {
+ if ($browserConfSub['version'] <= $this->client['version'] || empty($browserConfSub['version'])) {
// Version is correct
- if ($browserConfSub['system'] == $this->client['SYSTEM'] || empty($browserConfSub['system'])) {
+ if ($browserConfSub['system'] == $this->client['system'] || empty($browserConfSub['system'])) {
// System is correctly
$rteIsAvailable = 1;
}// End of System
@@ -307,7 +315,7 @@
$RTEWidth -= ($inline->getStructureDepth() > 0 ? ($inline->getStructureDepth()+1)*$inline->getLevelMargin() : 0);
if (isset($this->thisConfig['RTEWidthOverride'])) {
if (strstr($this->thisConfig['RTEWidthOverride'], '%')) {
- if ($this->client['BROWSER'] != 'msie') {
+ if ($this->client['browser'] != 'msie') {
$RTEWidth = (intval($this->thisConfig['RTEWidthOverride']) > 0) ? $this->thisConfig['RTEWidthOverride'] : '100%';
}
} else {
@@ -543,7 +551,7 @@
function setToolbar() {
global $BE_USER;
- if ($this->client['BROWSER'] == 'msie' || $this->client['BROWSER'] == 'opera') {
+ if ($this->client['browser'] == 'msie' || $this->client['browser'] == 'opera') {
$this->thisConfig['keepButtonGroupTogether'] = 0;
}
@@ -709,7 +717,7 @@
// Re-initialize the scripts array so that only the cumulative set of plugins of the last RTE on the page is used
$this->cumulativeScripts[$RTEcounter] = array();
$this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea.js', 'htmlarea', 'js', '', TRUE);
- if ($this->client['BROWSER'] == 'msie') {
+ if ($this->client['browser'] == 'msie') {
$this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea-ie.js', 'htmlarea-ie', 'js', '', TRUE);
} else {
$this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea-gecko.js', 'htmlarea-gecko', 'js', '', TRUE);
@@ -1371,82 +1379,41 @@
public function isFrontendEditActive() {
return is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->beUserLogin && ($GLOBALS['BE_USER']->frontendEdit instanceof t3lib_frontendedit);
}
-
/**
* Client Browser Information
*
- * Usage: 4
- *
- * @param string Alternative User Agent string (if empty, t3lib_div::getIndpEnv('HTTP_USER_AGENT') is used)
- * @return array Parsed information about the HTTP_USER_AGENT in categories BROWSER, VERSION, SYSTEM and FORMSTYLE
+ * @param string $userAgent: The useragent string, t3lib_div::getIndpEnv('HTTP_USER_AGENT')
+ * @return array Contains keys "useragent", "browser", "version", "system"
+ * where "browser" is limited to the engines
+ * and where "version" is a floating number
*/
-
- function clientInfo($useragent='') {
- global $TYPO3_CONF_VARS;
-
- if (!$useragent) $useragent=t3lib_div::getIndpEnv('HTTP_USER_AGENT');
-
- $bInfo=array();
- // Which browser?
- if (strstr($useragent,'Konqueror')) {
- $bInfo['BROWSER']= 'konqu';
- } elseif (strstr($useragent,'Opera')) {
- $bInfo['BROWSER']= 'opera';
- } elseif (strstr($useragent,'MSIE')) {
- $bInfo['BROWSER']= 'msie';
- } elseif (strstr($useragent,'Gecko/')) {
- $bInfo['BROWSER']='gecko';
- } elseif (strstr($useragent,'WebKit/')) {
- $bInfo['BROWSER']='safari';
- } elseif (strstr($useragent,'Mozilla/4')) {
- $bInfo['BROWSER']='net';
+ function clientInfo ($userAgent='') {
+ if (!$userAgent) {
+ $userAgent = t3lib_div::getIndpEnv('HTTP_USER_AGENT');
}
-
- if ($bInfo['BROWSER']) {
- // Browser version
- switch($bInfo['BROWSER']) {
- case 'net':
- $bInfo['VERSION']= doubleval(substr($useragent,8));
- if (strstr($useragent,'Netscape6/')) {$bInfo['VERSION']=doubleval(substr(strstr($useragent,'Netscape6/'),10));}
- if (strstr($useragent,'Netscape/7')) {$bInfo['VERSION']=doubleval(substr(strstr($useragent,'Netscape/7'),9));}
- break;
- case 'gecko':
- $tmp = strstr($useragent,'rv:');
- $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,3)));
- break;
- case 'msie':
- $tmp = strstr($useragent,'MSIE');
- $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,4)));
- break;
- case 'safari':
- $tmp = strstr($useragent,'WebKit/');
- $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,3)));
- break;
- case 'opera':
- $tmp = strstr($useragent,'Opera');
- $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,5)));
- break;
- case 'konqu':
- $tmp = strstr($useragent,'Konqueror/');
- $bInfo['VERSION'] = doubleval(substr($tmp,10));
- break;
+ $browserInfo = t3lib_utility_Client::getBrowserInfo($userAgent);
+ // Known engines: order is not irrelevant.
+ $knownEngines = array('opera', 'msie', 'gecko', 'webkit');
+ if (is_array($browserInfo['all'])) {
+ foreach ($knownEngines as $engine) {
+ if ($browserInfo['all'][$engine]) {
+ $browserInfo['browser'] = $engine;
+ switch ($engine) {
+ case 'gecko':
+ // We need the Gecko revision number as version of the Gecko engine, not the build date
+ $tmp = strstr($browserInfo['useragent'], 'rv:');
+ $browserInfo['version'] = t3lib_utility_Client::getVersion(substr($tmp, 3));
+ break;
+ default:
+ $browserInfo['version'] = t3lib_utility_Client::getVersion($browserInfo['all'][$engine]);
+ break;
+ }
+ break;
+ }
}
-
- // Client system
- if (strstr($useragent,'Win')) {
- $bInfo['SYSTEM'] = 'win';
- } elseif (strstr($useragent,'Mac')) {
- $bInfo['SYSTEM'] = 'mac';
- } elseif (strstr($useragent,'Linux') || strstr($useragent,'X11') || strstr($useragent,'SGI') || strstr($useragent,' SunOS ') || strstr($useragent,' HP-UX ')) {
- $bInfo['SYSTEM'] = 'unix';
- }
}
-
- // Is true if the browser supports css to format forms, especially the width
- $bInfo['FORMSTYLE']=($bInfo['BROWSER']=='msie' || ($bInfo['BROWSER']=='net'&&$bInfo['VERSION']>=5) || $bInfo['BROWSER']=='opera' || $bInfo['BROWSER']=='konqu');
- return $bInfo;
+ return $browserInfo;
}
-
/***************************
*
* OTHER FUNCTIONS: (from Classic RTE)
Index: extensions/Acronym/class.tx_rtehtmlarea_acronym.php
===================================================================
--- extensions/Acronym/class.tx_rtehtmlarea_acronym.php (révision 7836)
+++ extensions/Acronym/class.tx_rtehtmlarea_acronym.php (copie de travail)
@@ -65,7 +65,7 @@
public function transformContent($content) {
// was not supported by IE before verison 7
- if ($this->htmlAreaRTE->client['BROWSER'] == 'msie' && $this->htmlAreaRTE->client['VERSION'] < 7) {
+ if ($this->htmlAreaRTE->client['browser'] == 'msie' && $this->htmlAreaRTE->client['version'] < 7) {
// change to
$content = preg_replace('/<(\/?)abbr/i', "<$1acronym", $content);
}
@@ -97,7 +97,7 @@
RTEarea['.$RTEcounter.'].buttons.'. $button .'.acronymUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('', 'acronym_'.$this->htmlAreaRTE->contentLanguageUid, 'js', $this->buildJSAcronymArray($this->htmlAreaRTE->contentLanguageUid)) . '";';
// was not supported by IE before version 7
- if ($this->htmlAreaRTE->client['BROWSER'] == 'msie' && $this->htmlAreaRTE->client['VERSION'] < 7) {
+ if ($this->htmlAreaRTE->client['browser'] == 'msie' && $this->htmlAreaRTE->client['version'] < 7) {
$this->abbreviationIndex = 0;
}
$registerRTEinJavascriptString .= '
Index: extensions/ContextMenu/class.tx_rtehtmlarea_contextmenu.php
===================================================================
--- extensions/ContextMenu/class.tx_rtehtmlarea_contextmenu.php (révision 7836)
+++ extensions/ContextMenu/class.tx_rtehtmlarea_contextmenu.php (copie de travail)
@@ -47,7 +47,7 @@
protected $convertToolbarForHtmlAreaArray = array ();
public function main($parentObject) {
- return parent::main($parentObject) && !($this->htmlAreaRTE->client['BROWSER'] == 'opera' || $this->thisConfig['disableContextMenu'] || $this->thisConfig['disableRightClick']);
+ return parent::main($parentObject) && !($this->htmlAreaRTE->client['browser'] == 'opera' || $this->thisConfig['disableContextMenu'] || $this->thisConfig['disableRightClick']);
}
/**
* Return JS configuration of the htmlArea plugins registered by the extension
Index: extensions/CopyPaste/class.tx_rtehtmlarea_copypaste.php
===================================================================
--- extensions/CopyPaste/class.tx_rtehtmlarea_copypaste.php (révision 7836)
+++ extensions/CopyPaste/class.tx_rtehtmlarea_copypaste.php (copie de travail)
@@ -50,15 +50,15 @@
);
// Hide buttons not implemented in client browsers
protected $hideButtonsFromClient = array (
- 'safari' => array('paste'),
+ 'webkit' => array('paste'),
'opera' => array('copy', 'cut', 'paste'),
);
public function main($parentObject) {
$enabled = parent::main($parentObject);
// Hiding some buttons
- if ($enabled && is_array($this->hideButtonsFromClient[$this->htmlAreaRTE->client['BROWSER']])) {
- $this->pluginButtons = implode(',', array_diff(t3lib_div::trimExplode(',', $this->pluginButtons, 1), $this->hideButtonsFromClient[$this->htmlAreaRTE->client['BROWSER']]));
+ if ($enabled && is_array($this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']])) {
+ $this->pluginButtons = implode(',', array_diff(t3lib_div::trimExplode(',', $this->pluginButtons, 1), $this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']]));
}
// Force enabling the plugin even if no button remains in the tool bar, so that hot keys still are enabled
$this->pluginAddsButtons = false;
@@ -79,7 +79,7 @@
public function buildJavascriptConfiguration($RTEcounter) {
$registerRTEinJavascriptString = '';
$button = 'paste';
- if ($this->htmlAreaRTE->client['BROWSER'] == 'gecko') {
+ if ($this->htmlAreaRTE->client['browser'] == 'gecko') {
$mozillaAllowClipboardURL = $this->thisConfig['buttons.'][$button.'.']['mozillaAllowClipboardURL'] ? $this->thisConfig['buttons.'][$button.'.']['mozillaAllowClipboardURL'] : $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins']['CopyPaste']['mozillaAllowClipboardURL'];
if ($mozillaAllowClipboardURL) {
if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button.'.'])) {
@@ -102,8 +102,8 @@
*/
public function applyToolbarConstraints($show) {
// Remove some buttons
- if (is_array($this->hideButtonsFromClient[$this->htmlAreaRTE->client['BROWSER']])) {
- return array_diff($show, $this->hideButtonsFromClient[$this->htmlAreaRTE->client['BROWSER']]);
+ if (is_array($this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']])) {
+ return array_diff($show, $this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']]);
} else {
return $show;
}
Index: extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php
===================================================================
--- extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php (révision 7836)
+++ extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php (copie de travail)
@@ -81,7 +81,7 @@
public function transformContent($content) {
// Change the strong and em tags for gecko browsers
- if ($this->htmlAreaRTE->client['BROWSER'] == 'gecko') {
+ if ($this->htmlAreaRTE->client['browser'] == 'gecko') {
// change to
$content = preg_replace('/<(\/?)strong/i', "<$1b", $content);
// change to
Index: extensions/QuickTag/class.tx_rtehtmlarea_quicktag.php
===================================================================
--- extensions/QuickTag/class.tx_rtehtmlarea_quicktag.php (révision 7836)
+++ extensions/QuickTag/class.tx_rtehtmlarea_quicktag.php (copie de travail)
@@ -51,7 +51,7 @@
public function main($parentObject) {
$available = parent::main($parentObject);
- if ($this->thisConfig['disableSelectColor'] && $this->htmlAreaRTE->client['BROWSER'] != 'gecko') {
+ if ($this->thisConfig['disableSelectColor'] && $this->htmlAreaRTE->client['browser'] != 'gecko') {
$this->requiredPlugins = 'DefaultColor';
}
return $available;
Index: extensions/TableOperations/class.tx_rtehtmlarea_tableoperations.php
===================================================================
--- extensions/TableOperations/class.tx_rtehtmlarea_tableoperations.php (révision 7836)
+++ extensions/TableOperations/class.tx_rtehtmlarea_tableoperations.php (copie de travail)
@@ -75,10 +75,10 @@
$available = parent::main($parentObject);
- if ($this->htmlAreaRTE->client['BROWSER'] == 'opera') {
+ if ($this->htmlAreaRTE->client['browser'] == 'opera') {
$this->thisConfig['hideTableOperationsInToolbar'] = 0;
}
- if ($this->thisConfig['disableSelectColor'] && $this->htmlAreaRTE->client['BROWSER'] != 'gecko') {
+ if ($this->thisConfig['disableSelectColor'] && $this->htmlAreaRTE->client['browser'] != 'gecko') {
$this->requiredPlugins = 'DefaultColor';
}
return $available;
Index: pi2/class.tx_rtehtmlarea_pi2.php
===================================================================
--- pi2/class.tx_rtehtmlarea_pi2.php (révision 7836)
+++ pi2/class.tx_rtehtmlarea_pi2.php (copie de travail)
@@ -181,7 +181,7 @@
$width = 460+($this->TCEform->docLarge ? 150 : 0);
if (isset($this->thisConfig['RTEWidthOverride'])) {
if (strstr($this->thisConfig['RTEWidthOverride'], '%')) {
- if ($this->client['BROWSER'] != 'msie') {
+ if ($this->client['browser'] != 'msie') {
$width = (intval($this->thisConfig['RTEWidthOverride']) > 0) ? $this->thisConfig['RTEWidthOverride'] : '100%';
}
} else {