TYPO3 CMS  TYPO3_6-2
Spellchecker.php
Go to the documentation of this file.
1 <?php
3 
17 
24 
25  protected $extensionKey = 'rtehtmlarea';
26 
27  // The key of the extension that is extending htmlArea RTE
28  protected $pluginName = 'SpellChecker';
29 
30  // The name of the plugin registered by the extension
32 
33  // Path to this main locallang file of the extension relative to the extension dir.
34  protected $relativePathToSkin = 'extensions/SpellChecker/skin/htmlarea.css';
35 
36  // Path to the skin (css) file relative to the extension dir.
37  protected $htmlAreaRTE;
38 
39  // Reference to the invoking object
40  protected $thisConfig;
41 
42  // Reference to RTE PageTSConfig
43  protected $toolbar;
44 
45  // Reference to RTE toolbar array
46  protected $LOCAL_LANG;
47 
48  // Frontend language array
49  protected $pluginButtons = 'spellcheck';
50 
52  'spellcheck' => 'SpellCheck'
53  );
54 
55  protected $spellCheckerModes = array('ultra', 'fast', 'normal', 'bad-spellers');
56 
57  public function main($parentObject) {
58  return parent::main($parentObject) && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables') && !in_array($this->htmlAreaRTE->language, \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->htmlAreaRTE->ID]['plugins'][$pluginName]['noSpellCheckLanguages'])) && ($this->htmlAreaRTE->contentCharset == 'iso-8859-1' || $this->htmlAreaRTE->contentCharset == 'utf-8');
59  }
60 
67  public function buildJavascriptConfiguration($RTEcounter) {
68  $button = 'spellcheck';
69  // Set the SpellChecker mode
70  $spellCheckerMode = isset($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) ? trim($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) : 'normal';
71  if (!in_array($spellCheckerMode, $this->spellCheckerModes)) {
72  $spellCheckerMode = 'normal';
73  }
74  // Set the use of personal dictionary
75  $enablePersonalDicts = $this->thisConfig['buttons.'][$button . '.']['enablePersonalDictionaries'] ? (isset($GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts']) && $GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts'] ? TRUE : FALSE) : FALSE;
76  if ($this->htmlAreaRTE->is_FE()) {
77  $enablePersonalDicts = FALSE;
78  }
79  $registerRTEinJavascriptString = '';
80  if (in_array($button, $this->toolbar)) {
81  if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][($button . '.')])) {
82  $registerRTEinJavascriptString .= '
83  RTEarea[' . $RTEcounter . '].buttons.' . $button . ' = new Object();';
84  }
85  $registerRTEinJavascriptString .= '
86  RTEarea[' . $RTEcounter . '].buttons.' . $button . '.contentTypo3Language = "' . $this->htmlAreaRTE->contentTypo3Language . '";
87  RTEarea[' . $RTEcounter . '].buttons.' . $button . '.contentISOLanguage = "' . $this->htmlAreaRTE->contentISOLanguage . '";
88  RTEarea[' . $RTEcounter . '].buttons.' . $button . '.contentCharset = "' . $this->htmlAreaRTE->contentCharset . '";
89  RTEarea[' . $RTEcounter . '].buttons.' . $button . '.spellCheckerMode = "' . $spellCheckerMode . '";
90  RTEarea[' . $RTEcounter . '].buttons.' . $button . '.enablePersonalDicts = ' . ($enablePersonalDicts ? 'true' : 'false') . ';';
91  $registerRTEinJavascriptString .= '
92  RTEarea[' . $RTEcounter . '].buttons.' . $button . '.path = "' . ($this->htmlAreaRTE->is_FE() || $this->htmlAreaRTE->isFrontendEditActive() ? ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . 'index.php?eID=rtehtmlarea_spellchecker' : $this->htmlAreaRTE->backPath . BackendUtility::getAjaxUrl('rtehtmlarea::spellchecker')) . '";';
93  }
94  return $registerRTEinJavascriptString;
95  }
96 
97 }
static getAjaxUrl($ajaxIdentifier, array $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
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'][]