|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Stanislas Rolland <typo3(arobas)sjbr.ca> 00006 * All rights reserved 00007 * 00008 * This script is part of the Typo3 project. The Typo3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 /** 00025 * Copy as Plain Text extension for htmlArea RTE 00026 * 00027 * @author Stanislas Rolland <typo3(arobas)sjbr.ca> 00028 * 00029 * TYPO3 SVN ID: $Id: class.tx_rtehtmlarea_plaintext.php 7838 2010-06-08 16:10:41Z stan $ 00030 * 00031 */ 00032 class tx_rtehtmlarea_plaintext extends tx_rtehtmlarea_api { 00033 protected $extensionKey = 'rtehtmlarea'; // The key of the extension that is extending htmlArea RTE 00034 protected $pluginName = 'PlainText'; // The name of the plugin registered by the extension 00035 protected $relativePathToLocallangFile = ''; // Path to this main locallang file of the extension relative to the extension dir. 00036 protected $relativePathToSkin = 'extensions/PlainText/skin/htmlarea.css'; // Path to the skin (css) file relative to the extension dir 00037 protected $htmlAreaRTE; // Reference to the invoking object 00038 protected $thisConfig; // Reference to RTE PageTSConfig 00039 protected $toolbar; // Reference to RTE toolbar array 00040 protected $LOCAL_LANG; // Frontend language array 00041 protected $pluginButtons = 'pastetoggle,pastebehaviour'; 00042 protected $convertToolbarForHtmlAreaArray = array ( 00043 'pastetoggle' => 'PasteToggle', 00044 'pastebehaviour' => 'PasteBehaviour', 00045 ); 00046 public function main ($parentObject) { 00047 // Opera has no onPaste event to handle 00048 return parent::main($parentObject) && $this->htmlAreaRTE->client['browser'] != 'opera'; 00049 } 00050 /** 00051 * Return JS configuration of the htmlArea plugins registered by the extension 00052 * 00053 * @param integer Relative id of the RTE editing area in the form 00054 * 00055 * @return string JS configuration for registered plugins 00056 * 00057 * The returned string will be a set of JS instructions defining the configuration that will be provided to the plugin(s) 00058 * Each of the instructions should be of the form: 00059 * RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value"; 00060 */ 00061 public function buildJavascriptConfiguration($RTEcounter) { 00062 $registerRTEinJavascriptString = ''; 00063 $button = 'pastebehaviour'; 00064 // Get current TYPO3 User Setting, if available 00065 if (TYPO3_MODE === 'BE' && t3lib_extMgm::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS']) && is_object($GLOBALS['BE_USER'])) { 00066 if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button.'.'])) { 00067 $registerRTEinJavascriptString .= ' 00068 RTEarea[' . $RTEcounter . '].buttons.' . $button . ' = new Object();'; 00069 } 00070 $registerRTEinJavascriptString .= ' 00071 RTEarea[' . $RTEcounter . '].buttons.' . $button . '.current = "' . (isset($GLOBALS['BE_USER']->uc['rteCleanPasteBehaviour']) ? $GLOBALS['BE_USER']->uc['rteCleanPasteBehaviour'] : 'plainText') . '";'; 00072 } 00073 return $registerRTEinJavascriptString; 00074 } 00075 /** 00076 * Return an updated array of toolbar enabled buttons 00077 * 00078 * @param array $show: array of toolbar elements that will be enabled, unless modified here 00079 * 00080 * @return array toolbar button array, possibly updated 00081 */ 00082 public function applyToolbarConstraints ($show) { 00083 $removeButtons = array(); 00084 // Remove pastebehaviour button if pastetoggle is not configured 00085 if (!in_array('pastetoggle', $show)) { 00086 $removeButtons[] = 'pastebehaviour'; 00087 } 00088 // Remove pastebehaviour button if TYPO3 User Settings are available 00089 if (TYPO3_MODE === 'BE' && t3lib_extMgm::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS']) && is_object($GLOBALS['BE_USER'])) { 00090 $removeButtons[] = 'pastebehaviour'; 00091 } 00092 return array_diff($show, $removeButtons); 00093 } 00094 } 00095 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/PlainText/class.tx_rtehtmlarea_plaintext.php'])) { 00096 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/PlainText/class.tx_rtehtmlarea_plaintext.php']); 00097 } 00098 ?>
1.8.0