TYPO3 CMS  TYPO3_6-2
Typo3Color.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 = 'TYPO3Color';
27 
28  // The name of the plugin registered by the extension
29  protected $relativePathToLocallangFile = 'extensions/TYPO3Color/locallang.xlf';
30 
31  // Path to this main locallang file of the extension relative to the extension dir.
32  protected $relativePathToSkin = 'extensions/TYPO3Color/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 = 'textcolor,bgcolor';
48 
50  'textcolor' => 'ForeColor',
51  'bgcolor' => 'HiliteColor'
52  );
53 
54  public function main($parentObject) {
55  return parent::main($parentObject) && $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['allowStyleAttribute'];
56  }
57 
64  public function buildJavascriptConfiguration($RTEcounter) {
65  // Process colors configuration
66  $registerRTEinJavascriptString = $this->buildJSColorsConfig($RTEcounter);
67  return $registerRTEinJavascriptString;
68  }
69 
77  public function buildJSColorsConfig($RTEcounter) {
78  if ($this->htmlAreaRTE->is_FE()) {
79  $RTEProperties = $this->htmlAreaRTE->RTEsetup;
80  } else {
81  $RTEProperties = $this->htmlAreaRTE->RTEsetup['properties'];
82  }
83  $configureRTEInJavascriptString = '';
84  $configureRTEInJavascriptString .= '
85  RTEarea[' . $RTEcounter . '].disableColorPicker = ' . (trim($this->thisConfig['disableColorPicker']) ? 'true' : 'false') . ';';
86  // Building the array of configured colors
87  if (is_array($RTEProperties['colors.'])) {
88  $HTMLAreaColorname = array();
89  foreach ($RTEProperties['colors.'] as $colorName => $conf) {
90  $colorName = substr($colorName, 0, -1);
91  $colorLabel = $this->htmlAreaRTE->getPageConfigLabel($conf['name'], 0);
92  $HTMLAreaColorname[$colorName] = array($colorLabel, strtoupper(substr($conf['value'], 1, 6)));
93  }
94  }
95  // Setting the list of colors if specified in the RTE config
96  if ($this->thisConfig['colors']) {
97  $HTMLAreaColors = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->htmlAreaRTE->cleanList($this->thisConfig['colors']));
98  $HTMLAreaJSColors = array();
99  foreach ($HTMLAreaColors as $colorName) {
100  if ($HTMLAreaColorname[$colorName]) {
101  $HTMLAreaJSColors[] = $HTMLAreaColorname[$colorName];
102  }
103  }
104  if ($this->htmlAreaRTE->is_FE()) {
105  $GLOBALS['TSFE']->csConvObj->convArray($HTMLAreaJSColors, $this->htmlAreaRTE->OutputCharset, 'utf-8');
106  }
107  $configureRTEInJavascriptString .= '
108  RTEarea[' . $RTEcounter . '].colors = ' . json_encode($HTMLAreaJSColors) . ';';
109  }
110  return $configureRTEInJavascriptString;
111  }
112 
113 }
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]