Commit b0dbe1d2 authored by sgalinsk's avatar sgalinsk
Browse files

[TASK] Update tinymce sources and related stuff, initial cleanup


git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/tinymce/trunk@63461 735d13b6-9817-0410-8766-e36946ffe9aa
parent 732efdd0
For Mozilla and Firefox the functionality of
"copy and Paste" are disabled by default. If you
wish your Typo3-User are able to use this, the User
must have the "user.js" with it contents in his
Mozilla Userdir. On Windows XP is this the following:
C:\Documents and Settings\[User Name]\Application Data\Mozilla\Firefox\Profiles\
See also here:
http://www.mozilla.org/editor/midasdemo/securityprefs.html
Regards
Thomas
user_pref("capability.policy.policynames", "allowclipboard");
user_pref("capability.policy.allowclipboard.sites", "http://localhost");
user_pref("capability.policy.allowclipboard.Clipboard.cutcopy", "allAccess");
user_pref("capability.policy.allowclipboard.Clipboard.paste", "allAccess");
\ No newline at end of file
--- Used Versions ---
* tinyMCE - 2.1.1.1
* PHP compressor - 1.1.0
* PHP spellchecker - 1.0.5
* Languages - 08.07.2007 (dd.mm.yyyy)
--- TODO ---
* FileBrowser enhancements like in tinyRTE (?)
--- Used Versions ---
* TinyMCE - 3.5.2
* PHP compressor - 2.0.4
* PHP spellchecker - 2.0.6
* Languages - 14.06.2012
<?php
/***************************************************************
* Copyright notice
*
* (c) 2005-2007 Stefan Galinski (stefan.galinski@gmail.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* tinyMCE initialisation class
* Copyright notice
*
* $Id$
* (c) 2005-2012 Stefan Galinski (stefan.galinski@gmail.com)
* All rights reserved
*
* @author Stefan Galinski <stefan.galinski@gmail.com>
*/
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
* Initialisation flag
*
* @var boolean
*/
/** @var boolean initialisation flag to prevent multiple init code */
$tinyMCEInitFlag = false;
$tinyMCEInitFlag = FALSE;
/**
* tinyMCE initialisation class
*
* @author Stefan Galinski <stefan.galinski@gmail.com>
* @package Typo3
* @package TYPO3
* @subpackage tx_tinymce
*/
class tinyMCE
{
class tinyMCE {
/**
* @var array configuration
* @see prepareConfig()
*/
var $extConfig = array();
protected $extConfig = array();
/**@+
/** @var array configuration */
var $config = array();
var $GZconfig = array();
/**#@-*/
/**
* @var array
*/
protected $config = array();
/**
* @var array
*/
protected $GZconfig = array();
/**
* Constructor
* loads the tinyMCE configuration
*
* @param string configuration file or string (optional ... default is basic configuration)
* @param string gzip configuration file or string (optional ... default is basic configuration)
* @param boolean set to false if you dont want the automatic language replacement (default true)
* @return void
* @param string $config configuration file or string (optional ... default is basic configuration)
* @param string $GZconfig gzip configuration file or string (optional ... default is basic configuration)
* @param boolean $autoLang set to false if you dont want the automatic language replacement (default true)
*/
function tinyMCE($config='', $GZconfig='', $autoLang=true)
{
public function __construct($config = '', $GZconfig = '', $autoLang = TRUE) {
// prepare extension and given tinyMCE configurations
$this->prepareConfig();
$this->prepareTinyMCEConfig($config, false);
$this->prepareTinyMCEConfig($GZconfig, true);
$this->prepareTinyMCEConfig($config, FALSE);
$this->prepareTinyMCEConfig($GZconfig, TRUE);
// language replacement
if($autoLang)
{
if ($autoLang) {
// get main object
if(TYPO3_MODE == 'FE')
if (TYPO3_MODE == 'FE') {
$lang =& $GLOBALS['TSFE'];
else
} else {
$lang =& $GLOBALS['LANG'];
}
// language conversion from TLD to iso631
if(array_key_exists($this->extConfig['lang'], $lang->csConvObj->isoArray))
if (array_key_exists($this->extConfig['lang'], $lang->csConvObj->isoArray)) {
$this->extConfig['lang'] = $lang->csConvObj->isoArray[$this->extConfig['lang']];
if(!is_file(PATH_site . t3lib_extMgm::siteRelPath('tinymce') .
'tinyMCE/langs/' . $this->extConfig['lang'] . '.js'))
$this->extConfig['lang'] = 'en';
}
if (!is_file(PATH_site . t3lib_extMgm::siteRelPath('tinymce') .
'tinyMCE/langs/' . $this->extConfig['lang'] . '.js')
) {
$this->extConfig['lang'] = 'en';
}
// language replacement
$this->replaceInConfig(array('language' => $this->extConfig['lang']));
if($this->extConfig['compressed'])
$this->replaceInConfig(array('languages' => $this->extConfig['lang']), true);
if ($this->extConfig['compressed']) {
$this->replaceInConfig(array('languages' => $this->extConfig['lang']), TRUE);
}
}
// activate disk cache
if($this->extConfig['compressed'] && $this->extConfig['diskCache'])
$this->replaceInConfig(array('disk_cache' => 'true'), true);
elseif($this->extConfig['compressed'] && !$this->extConfig['diskCache'])
$this->replaceInConfig(array('disk_cache', 'false'), true);
if ($this->extConfig['compressed'] && $this->extConfig['diskCache']) {
$this->replaceInConfig(array('disk_cache' => 'true'), TRUE);
} elseif ($this->extConfig['compressed'] && !$this->extConfig['diskCache']) {
$this->replaceInConfig(array('disk_cache', 'false'), TRUE);
}
}
/**
* Generates a configuration string from the array informations
* Generates a configuration string from the array information
*
* @param boolean set to true if the options should be set into the gzip config
* @param boolean $gzip set to true if the options should be set into the gzip config
* @return string generated configuration
*/
function buildConfigString($gzip)
{
$curConfig = ($gzip) ? $this->GZconfig : $this->config;
protected function buildConfigString($gzip) {
$curConfig = ($gzip ? $this->GZconfig : $this->config);
// generate configuration strings from array
$config = $curConfig['preJS'];
$config .= (($gzip) ? 'tinyMCE_GZ' : 'tinyMCE') . '.init({' . "\n";
$configOptions = array();
if (count($curConfig)) {
foreach($curConfig as $option => $value) {
if ($option == 'preJS' || $option == 'postJS')
foreach ($curConfig as $option => $value) {
if ($option == 'preJS' || $option == 'postJS') {
continue;
if ($value != 'false' && $value != 'true')
}
if ($value != 'false' && $value != 'true') {
$value = '\'' . $value . '\'';
}
$configOptions[] = "\t" . $option . ' : ' . $value;
}
}
......@@ -141,18 +140,17 @@ class tinyMCE
*
* @return string generated javascript inclusion code
*/
function getJS()
{
public function getJS() {
// check init flag
if($GLOBALS['tinyMCEInitFlag'])
if ($GLOBALS['tinyMCEInitFlag']) {
return '';
$GLOBALS['tinyMCEInitFlag'] = true;
}
$GLOBALS['tinyMCEInitFlag'] = TRUE;
// build configuration strings
$config = $this->buildConfigString(false);
$GZconfig = $this->buildConfigString(true);
$config = $this->buildConfigString(FALSE);
$GZconfig = $this->buildConfigString(TRUE);
// return javascript
return '<script type="text/javascript" src="' . $GLOBALS['BACK_PATH'] .
t3lib_extMgm::extRelPath('tinymce') . 'tinyMCE/' .
($this->extConfig['compressed'] ? 'tiny_mce_gzip.js' : 'tiny_mce.js') . '"></script>
......@@ -164,27 +162,28 @@ class tinyMCE
* Prepares a tinyMCE configuration
* All options, post and pre javascript is saved into the config or GZconfig array
*
* @param string file reference or configuration string
* @param boolean set to true if the options should be set into the gzip config
* @param string $config file reference or configuration string
* @param boolean $gzip set to true if the options should be set into the gzip config
* @return void
*/
function prepareTinyMCEConfig($config, $gzip)
{
protected function prepareTinyMCEConfig($config, $gzip) {
// get file contents if necessary
if(is_file($config))
if (is_file($config)) {
$config = t3lib_div::getURL($config);
}
// get config variable
if ($gzip)
if ($gzip) {
$curConfig =& $this->GZconfig;
else
} else {
$curConfig =& $this->config;
}
// split config into first and last javascript parts (applied later again into the config variables)
// additionaly the config part is matched to get the options
$start = '(.*)((tinyMCE|tinyMCE_GZ)\.init.*?\(.*?\{.*?';
$end = '.*?\}.*?\).*?;)(.*)';
$pattern = '/' . $start . $end . '/is';
$end = '.*?\}.*?\).*?;)(.*)';
$pattern = '/' . $start . $end . '/is';
preg_match($pattern, $config, $matches);
// add preJS and postJS
......@@ -194,37 +193,41 @@ class tinyMCE
// split options into an array (first time strings and the second call splits bool values)
$pattern = '([[:print:]]+?)[\s]*?:[\s]*["|\']{1}(.*?)["|\']{1}[,|\n|}]{1}.*?';
preg_match_all('/' . $pattern . '/i', $matches[2], $options);
for ($i = 0; $i < count($options[1]); ++$i)
$configOptions = NULL;
for ($i = 0; $i < count($options[1]); ++$i) {
$configOptions[$options[1][$i]] = $options[2][$i];
}
$options = array();
$boolPattern = '([[:print:]]+?)[\s]*?:[\s]*(false|true)[,|\n|}]{1}.*?';
preg_match_all('/' . $boolPattern . '/i', $matches[2], $options);
for ($i = 0; $i < count($options[1]); ++$i)
for ($i = 0; $i < count($options[1]); ++$i) {
$configOptions[$options[1][$i]] = $options[2][$i];
}
// add config options
if (is_array($configOptions))
if (is_array($configOptions)) {
$curConfig = array_merge($curConfig, $configOptions);
}
}
/**
* replaces/adds an option in the configuration
*
* @param array option => value
* @param boolean set to true if the options should be set into the gzip config
* @param array $options option => value
* @param boolean $gzip set to true if the options should be set into the gzip config
* @return void
*/
function replaceInConfig($options, $gzip=false)
{
function replaceInConfig($options, $gzip = FALSE) {
foreach ($options as $option => $value) {
if($gzip)
if ($gzip) {
$this->GZconfig[$option] = $value;
else
} else {
$this->config[$option] = $value;
}
}
}
/**
* return false if the browser isnt supported
*
......@@ -236,14 +239,8 @@ class tinyMCE
*
* @return boolean return true if the browser is supported
*/
function checkBrowser()
{
$browser = t3lib_div::getIndpEnv('HTTP_USER_AGENT');
if(preg_match('/Opera\\/[0-8]./', $browser) ||
preg_match('/Mozilla.+Konqueror./', $browser))
return false;
return true;
public function checkBrowser() {
return TRUE;
}
/**
......@@ -253,22 +250,17 @@ class tinyMCE
*
* @return void
*/
function prepareConfig()
{
protected function prepareConfig() {
$this->extConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['tinymce']);
// get current/forced language
$groupOrUserProps = t3lib_BEfunc::getModTSconfig('', 'tx_tinyMCE');
if(!empty($groupOrUserProps['properties']['prefLang']))
if (!empty($groupOrUserProps['properties']['prefLang'])) {
$this->extConfig['lang'] = $groupOrUserProps['properties']['prefLang'];
else
} else {
$this->extConfig['lang'] = (TYPO3_MODE == 'FE' ? $GLOBALS['TSFE']->lang : $GLOBALS['LANG']->lang);
}
}
}
// Default-Code for using XCLASS (dont touch)
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tinymce/mod1/class.tinymce.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tinymce/mod1/class.tinymce.php']);
}
?>
?>
\ No newline at end of file
......@@ -12,7 +12,7 @@
$EM_CONF[$_EXTKEY] = array(
'title' => 'tinyMCE',
'description' => 'Just a base for extensions which want to integrate a WYSIWIG editor.',
'description' => 'tinymce sources with compressor and spellchecker',
'category' => 'misc',
'shy' => 0,
'version' => '2.0.0',
......@@ -34,6 +34,8 @@ $EM_CONF[$_EXTKEY] = array(
'CGLcompliance_note' => '',
'constraints' => array(
'depends' => array(
'php' => '5.2.0-5.3.99',
'typo3' => '4.3.0-4.6.99',
),
'conflicts' => array(
),
......
#!/bin/sh
for i in `find ./tinymce/jscripts/tiny_mce -name langs`;
#!/bin/bash
for i in `find ./tinymce_language_pack -name langs`;
do
merge=`echo $i | cut -f5- -d/ | sed -e 's/langs//'`;
cp -r $i tinyMCE/$merge;
if [ $? -eq 0 ]
then
echo "$i merged";
fi
done;
cp -a $i/* `echo $i | sed s/tinymce_language_pack/tinymce/`/
done;
\ No newline at end of file
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>blank_page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="mceContentBody">
</body>
</html>
// CA lang variables by Marc Bria and Marc Folch
tinyMCE.addToLang('',{
bold_desc : 'Negreta (Ctrl+B)',
italic_desc : 'Cursiva (Ctrl+I)',
underline_desc : 'Subratllat (Ctrl+U)',
striketrough_desc : 'Barrat',
justifyleft_desc : 'Alinea a l\'esquerra',
justifycenter_desc : 'Centrat',
justifyright_desc : 'Alinea a la dreta',
justifyfull_desc : 'Justificat',
bullist_desc : 'Llista sense ordenar',
numlist_desc : 'Llista ordenada',
outdent_desc : 'Disminueix el sagnat',
indent_desc : 'Augmenta el sagnat',
undo_desc : 'Desf&eacute;s (Ctrl+Z)',
redo_desc : 'Ref&eacute;s (Ctrl+Y)',
link_desc : 'Insereix enlla&ccedil;',
unlink_desc : 'Treu enlla&ccedil;',
image_desc : 'Insereix imatge',
cleanup_desc : 'Neteja el codi',
focus_alert : 'L&agrave;rea de l\'editor ha de ser enfocada abans dexecutar aquesta comanda.',
edit_confirm : 'Vols utilitzar el mode WYSIWYG per a aquesta &agrave;rea de text?',
insert_link_title : 'Insereix/edita enlla&agrave;',
insert : 'Insereix',
update : 'Insereix',
cancel : 'Cancel&middot;la',
insert_link_url : 'Adre&ccedil;a de l\'enlla&ccedil;',
insert_link_target : 'Dest&iacute',
insert_link_target_same : 'Open link in the same window',
insert_link_target_same : 'Obre l\'enlla&ccedil; a la mateixa finestra',
insert_link_target_blank : 'Obre l\'enlla&ccedil; en una finestra nova',
insert_image_title : 'Insereix/edita imatge',
insert_image_src : 'URL de la imatge',
insert_image_alt : 'Descripci&oacute; de la imatge',
help_desc : 'Ajuda',
bold_img : "bold.gif",
italic_img : "italic.gif",
underline_img : "underline.gif",
clipboard_msg : 'Copiar, retallar i enganxar no &eacute;s possible amb Mozilla i Firefox.\nVols m&eacute;s informaci&oacute; sobre aquesta q&euml;esti&oacute;?',
popup_blocked : 'Ho sentim, per&ograve; hem detectat que el bloqueig de finestres del vostre navegador ha bloquejat una finestra amb funcions del programa. Haur&iacute;eu de deshabilitar el bloqueig de finestres en aquesta web per poder utilitzar completament aquesta eina.'
});
/**
* Czech lang variables
* encoding: utf-8
*
* @author Michi
* @author Pavel Novák
* @author Josef Klimosz
*
* $Id: cs.js,v 1.6 2005/10/18 13:59:21 spocke Exp $
*/
tinyMCE.addToLang('',{
bold_desc : 'Tučně',
italic_desc : 'Kurzíva',
underline_desc : 'Podtržení',
striketrough_desc : 'Přeškrtnutí',
justifyleft_desc : 'Zarovnání vlevo',
justifycenter_desc : 'Zarovnání na střed',
justifyright_desc : 'Zarovnání vpravo',
justifyfull_desc : 'Zarovnání do bloku',
bullist_desc : 'Seznam s odrážkami',
numlist_desc : 'Číslovaný seznam',
outdent_desc : 'Snížit odsazení',
indent_desc : 'Zvýšit odsazení',
undo_desc : 'Zpět',
redo_desc : 'Znovu',
link_desc : 'Vložit odkaz',
unlink_desc : 'Zrušit odkaz',
image_desc : 'Vložit obrázek',
cleanup_desc : 'Vyčistit kód',
focus_alert : 'Před použitím tohoto příkazu musí být kurzor v okně editoru.',
edit_confirm : 'Chcete použít WYSIWYG editaci pro tento text?',
insert_link_title : 'Vložit/upravit odkaz',
insert : 'Vložit',
update : 'Změnit',
cancel : 'Zrušit',
insert_link_url : 'URL odkazu',
insert_link_target : 'Cíl',
insert_link_target_same : 'Otevřít odkaz ve stejném okně',
insert_link_target_blank : 'Otevřít odkaz v novém okně',
insert_image_title : 'Vložit/upravit obrázek',
insert_image_src : 'URL obrázku',
insert_image_alt : 'Popis obrázku',
help_desc : 'Nápověda',
bold_img : 'bold.gif',
italic_img : 'italic.gif',
underline_img : "underline.gif",
clipboard_msg : 'Funkce Kopírovat/vyjmout/vložit nejsou použitelné v Mozille a Firefoxu.\nChcete více informací o tomto problému?',
popup_blocked : 'Omlouváme se, ale blokovač vyskakovacích oken neumožnil otevřít okno, které zprostředkovává funkčnost aplikace. Musíte vypnout blokování vyskakovacích oken na tomto webu, abyste využili plné funkčnosti.'
});
// UK lang variables
tinyMCE.addToLang('',{
bold_desc : 'Bold (Ctrl+B)',
italic_desc : 'Italig (Ctrl+I)',
underline_desc : 'Tanlinellu (Ctrl+U)',
striketrough_desc : 'Llinell drwodd',
justifyleft_desc : 'Unioni i\'r chwith',
justifycenter_desc : 'Unioni i\'r canol',
justifyright_desc : 'Unioni i\'r dde',
justifyfull_desc : 'Unioni llawn',
bullist_desc : 'Rhestr heb drefn',
numlist_desc : 'Rhestr mewn trefn',
outdent_desc : 'Lleihau mewnoliad',
indent_desc : 'Cynyddu mewnoliad',
undo_desc : 'Dadwneud (Ctrl+Z)',
redo_desc : 'Ailwneud (Ctrl+Y)',
link_desc : 'Mewnosod/golygu dolen',
unlink_desc : 'Dadgysylltu',
image_desc : 'Mewnosod/golygu delwedd',
cleanup_desc : 'Tacluso c&ocirc;d',
focus_alert : 'Rhaid rhoi ffocws i\'r golygydd cyn defnyddio\'r gorchymyn hwn.',
edit_confirm : 'Wyt ti eisiau defnyddio\'r dull WYSIWYG ar gyfer yr ardal destun hon?',
insert_link_title : 'Mewnosod/golygu dolen',
insert : 'Mewnosod',
update : 'Diweddaru',
cancel : 'Diddymu',
insert_link_url : 'URL dolen',
insert_link_target : 'Targed',
insert_link_target_same : 'Agor dolen yn yr un ffenest',
insert_link_target_blank : 'Agor dolen mewn ffenest newydd',
insert_image_title : 'Mewnosod/golygu delwedd',
insert_image_src : 'URL delwedd',
insert_image_alt : 'Disgrifiad delwedd',
help_desc : 'Cymorth',
bold_img : "bold.gif",
italic_img : "italic.gif",
underline_img : "underline.gif",
clipboard_msg : 'Dyw Cop&iuml;o/Torri/Gludo ddim ar gael ym Mozilla na Firefox.\nHoffet ti ragor o wybodaeth ynghylch hyn?',
popup_blocked : 'Mae\'n ddrwg gennym, ond mae dy declyn atal ffenestri naid wedi analluogi ffenest sy\'n cynnig nodweddion i\'r rhaglen. Bydd rhaid i ti analluogi atal ffenestri naid ar gyfer y safle hon er mwyn cael y defnydd gorau o\'r rhaglen hwn.'
});
// DK lang variables - Transl.:Jan Moelgaard, Bo Frederiksen, John Dalsgaard - Corr.: Ronny Buelund
tinyMCE.addToLang('',{
bold_desc : 'Fed',
italic_desc : 'Kursiv',
underline_desc : 'Understreg',
striketrough_desc : 'Gennemstreg',
justifyleft_desc : 'Venstrejusteret',
justifycenter_desc : 'Centrer',
justifyright_desc : 'H&oslash;jrejusteret',
justifyfull_desc : 'Lige margin',
bullist_desc : 'Liste med punkttegn',
numlist_desc : 'Liste med tal',
outdent_desc : 'Ryk til venstre',
indent_desc : 'Ryk til h&oslash;jre',
undo_desc : 'Fortryd',
redo_desc : 'Gentag',
link_desc : 'Inds&aelig;t link',
unlink_desc : 'Fjern link',
image_desc : 'Inds&aelig;t billede',
cleanup_desc : 'Ryd op i koden',
focus_alert : 'Der skal s&aelig;ttes fokus p&aring; sessionen, f&oslash;r man kan bruge denne kommando',
edit_confirm : 'Vil du bruge WYSIWYG mode til dette tekstomr&aring;de?',
insert_link_title : 'Inds&aelig;t eller rediger link',
insert : 'Inds&aelig;t',
update : 'Opdater',
cancel : 'Fortryd',