TYPO3 CMS  TYPO3_6-2
Plaintext.php
Go to the documentation of this file.
1 <?php
3 
22 
23  protected $extensionKey = 'rtehtmlarea';
24 
25  // The key of the extension that is extending htmlArea RTE
26  protected $pluginName = 'PlainText';
27 
28  // The name of the plugin registered by the extension
30 
31  // Path to this main locallang file of the extension relative to the extension dir.
32  protected $relativePathToSkin = 'extensions/PlainText/skin/htmlarea.css';
33 
34  // Path to the skin (css) file relative to the extension dir
35  protected $htmlAreaRTE;
36 
37  // Reference to the invoking object
38  protected $thisConfig;
39 
40  // Reference to RTE PageTSConfig
41  protected $toolbar;
42 
43  // Reference to RTE toolbar array
44  protected $LOCAL_LANG;
45 
46  // Frontend language array
47  protected $pluginButtons = 'pastetoggle,pastebehaviour';
48 
50  'pastetoggle' => 'PasteToggle',
51  'pastebehaviour' => 'PasteBehaviour'
52  );
53 
54  public function main($parentObject) {
55  // Opera has no onPaste event to handle
56  return parent::main($parentObject) && $this->htmlAreaRTE->client['browser'] != 'opera';
57  }
58 
65  public function buildJavascriptConfiguration($RTEcounter) {
66  $registerRTEinJavascriptString = '';
67  $button = 'pastebehaviour';
68  // Get current TYPO3 User Setting, if available
69  if (TYPO3_MODE === 'BE' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS']) && is_object($GLOBALS['BE_USER'])) {
70  if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][($button . '.')])) {
71  $registerRTEinJavascriptString .= '
72  RTEarea[' . $RTEcounter . '].buttons.' . $button . ' = new Object();';
73  }
74  $registerRTEinJavascriptString .= '
75  RTEarea[' . $RTEcounter . '].buttons.' . $button . '.current = "' . (isset($GLOBALS['BE_USER']->uc['rteCleanPasteBehaviour']) ? $GLOBALS['BE_USER']->uc['rteCleanPasteBehaviour'] : 'plainText') . '";';
76  }
77  return $registerRTEinJavascriptString;
78  }
79 
86  public function applyToolbarConstraints($show) {
87  $removeButtons = array();
88  // Remove pastebehaviour button if pastetoggle is not configured
89  if (!in_array('pastetoggle', $show)) {
90  $removeButtons[] = 'pastebehaviour';
91  }
92  // Remove pastebehaviour button if TYPO3 User Settings are available
93  if (TYPO3_MODE === 'BE' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS']) && is_object($GLOBALS['BE_USER'])) {
94  $removeButtons[] = 'pastebehaviour';
95  }
96  return array_diff($show, $removeButtons);
97  }
98 
99 }
const TYPO3_MODE
Definition: init.php:40
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]