TYPO3 CMS  TYPO3_7-6
Plaintext.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 {
29  protected $pluginName = 'PlainText';
30 
36  protected $pluginButtons = 'pastetoggle,pastebehaviour';
37 
44  'pastetoggle' => 'PasteToggle',
45  'pastebehaviour' => 'PasteBehaviour'
46  ];
47 
54  public function main(array $configuration)
55  {
56  // Opera has no onPaste event to handle
57  return parent::main($configuration)
58  && $this->configuration['client']['browser'] !== 'opera';
59  }
60 
66  public function buildJavascriptConfiguration()
67  {
68  $jsArray = [];
69  $button = 'pastebehaviour';
70  // Get current TYPO3 User Setting, if available
71  if (TYPO3_MODE === 'BE' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS']) && is_object($GLOBALS['BE_USER'])) {
72  if (!is_array($this->configuration['thisConfig']['buttons.']) || !is_array($this->configuration['thisConfig']['buttons.'][$button . '.'])) {
73  $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . ' = new Object();';
74  }
75  $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.current = "' . (isset($GLOBALS['BE_USER']->uc['rteCleanPasteBehaviour']) ? $GLOBALS['BE_USER']->uc['rteCleanPasteBehaviour'] : 'plainText') . '";';
76  }
77  return implode(LF, $jsArray);
78  }
79 
86  public function applyToolbarConstraints($show)
87  {
88  $removeButtons = [];
89  // Remove pastebehaviour button if pastetoggle is not configured
90  if (!in_array('pastetoggle', $show)) {
91  $removeButtons[] = 'pastebehaviour';
92  }
93  // Remove pastebehaviour button if TYPO3 User Settings are available
94  if (TYPO3_MODE === 'BE' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS']) && is_object($GLOBALS['BE_USER'])) {
95  $removeButtons[] = 'pastebehaviour';
96  }
97  return array_diff($show, $removeButtons);
98  }
99 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']