TYPO3 CMS  TYPO3_6-2
CopyPaste.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 = 'CopyPaste';
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/CopyPaste/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 = 'copy, cut, paste';
48 
50  'copy' => 'Copy',
51  'cut' => 'Cut',
52  'paste' => 'Paste'
53  );
54 
55  // Hide buttons not implemented in client browsers
56  protected $hideButtonsFromClient = array(
57  'gecko' => array('copy', 'cut', 'paste'),
58  'webkit' => array('copy', 'cut', 'paste'),
59  'opera' => array('copy', 'cut', 'paste')
60  );
61 
62  public function main($parentObject) {
63  $enabled = parent::main($parentObject);
64  // Hiding some buttons
65  if ($enabled && is_array($this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']])) {
66  $this->pluginButtons = implode(',', array_diff(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->pluginButtons, TRUE), $this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']]));
67  }
68  // Force enabling the plugin even if no button remains in the tool bar, so that hot keys still are enabled
69  $this->pluginAddsButtons = FALSE;
70  return $enabled;
71  }
72 
79  public function applyToolbarConstraints($show) {
80  // Remove some buttons
81  if (is_array($this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']])) {
82  return array_diff($show, $this->hideButtonsFromClient[$this->htmlAreaRTE->client['browser']]);
83  } else {
84  return $show;
85  }
86  }
87 
88 }
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)