2 namespace TYPO3\CMS\Rtehtmlarea\Extension;
50 'abbreviation' =>
'Abbreviation'
75 $enabled = parent::main($configuration);
78 if (isset($this->configuration[
'thisConfig'][
'buttons.'][
'acronym.']) && is_array($this->configuration[
'thisConfig'][
'buttons.'][
'acronym.'])) {
79 if (!isset($this->configuration[
'thisConfig'][
'buttons.'][
'abbreviation.']) || !is_array($this->configuration[
'thisConfig'][
'buttons.'][
'abbreviation.'])) {
80 $this->configuration[
'thisConfig'][
'buttons.'][
'abbreviation.'] = $this->configuration[
'thisConfig'][
'buttons.'][
'acronym.'];
82 unset($this->configuration[
'thisConfig'][
'buttons.'][
'acronym.']);
85 foreach ($this->configuration[
'thisConfig'] as $key => $config) {
86 if ($key !==
'proc.') {
87 if (is_array($config)) {
88 foreach ($config as $subKey => $subConfig) {
89 if (is_array($subConfig)) {
90 foreach ($subConfig as $subSubKey => $subSubConfig) {
91 if ($subSubKey !==
'removeFieldsets') {
92 $this->configuration[
'thisConfig'][$key][$subKey][$subSubKey] = str_replace(
'acronym',
'abbreviation', $subSubConfig);
96 if ($subKey !==
'removeFieldsets') {
97 $this->configuration[
'thisConfig'][$key][$subKey] = str_replace(
'acronym',
'abbreviation', $subConfig);
102 if ($key !==
'removeFieldsets') {
103 $this->configuration[
'thisConfig'][$key] = str_replace(
'acronym',
'abbreviation', $config);
109 if (is_array($this->configuration[
'specConf'][
'richtext'][
'parameters'])) {
110 foreach ($this->configuration[
'specConf'][
'richtext'][
'parameters'] as $key => $config) {
111 $this->configuration[
'specConf'][
'richtext'][
'parameters'][$key] = str_replace(
'acronym',
'abbreviation', $config);
115 if (is_object(
$GLOBALS[
'BE_USER']) && isset(
$GLOBALS[
'BE_USER']->userTS[
'options.'][
'RTEkeyList'])) {
116 $GLOBALS[
'BE_USER']->userTS[
'options.'][
'RTEkeyList'] = str_replace(
'acronym',
'abbreviation',
$GLOBALS[
'BE_USER']->userTS[
'options.'][
'RTEkeyList']);
119 $removedFieldsets =
GeneralUtility::trimExplode(
',', $this->configuration[
'thisConfig'][
'buttons.'][
'abbreviation.'][
'removeFieldsets'],
true);
130 $button =
'abbreviation';
132 if (in_array($button, $this->toolbar)) {
133 if (!is_array($this->configuration[
'thisConfig'][
'buttons.']) || !is_array($this->configuration[
'thisConfig'][
'buttons.'][($button .
'.')])) {
134 $jsArray[] =
'RTEarea[editornumber].buttons.' . $button .
' = new Object();';
136 $jsArray[] =
'RTEarea[editornumber].buttons.' . $button .
'.abbreviationUrl = "' . $this->
writeTemporaryFile(
'abbreviation_' . $this->configuration[
'contentLanguageUid'],
'js', $this->
buildJSAbbreviationArray()) .
'";';
137 $jsArray[] =
'RTEarea[editornumber].buttons.' . $button .
'.noAcronym = ' . ($this->acronymIndex ?
'false' :
'true') .
';';
138 $jsArray[] =
'RTEarea[editornumber].buttons.' . $button .
'.noAbbr = ' . ($this->abbreviationIndex ?
'false' :
'true') .
';';
140 return implode(LF, $jsArray);
152 $button =
'abbreviation';
153 $acronymArray = array();
154 $abbrArray = array();
155 $tableA =
'tx_rtehtmlarea_acronym';
156 $tableB =
'static_languages';
157 $fields = $tableA .
'.type,' . $tableA .
'.term,' . $tableA .
'.acronym,' . $tableB .
'.lg_iso_2,' . $tableB .
'.lg_country_iso_2';
158 $tableAB = $tableA .
' LEFT JOIN ' . $tableB .
' ON ' . $tableA .
'.static_lang_isocode=' . $tableB .
'.uid';
159 $whereClause =
'1=1';
160 $loadRecordsFromDatabase =
true;
162 $lockBeUserToDBmounts = isset($this->configuration[
'thisConfig'][
'buttons.'][$button .
'.'][
'lockBeUserToDBmounts']) ? $this->configuration[
'thisConfig'][
'buttons.'][$button .
'.'][
'lockBeUserToDBmounts'] :
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'lockBeUserToDBmounts'];
163 $savedGroupDataWebmounts = $backendUser->groupData[
'webmounts'];
164 if (!$backendUser->isAdmin() &&
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'lockBeUserToDBmounts'] && $lockBeUserToDBmounts) {
166 $altMountPoints = trim($backendUser->getTSConfigVal(
'options.pageTree.altElementBrowserMountPoints'));
167 if ($altMountPoints) {
170 $webMounts = $backendUser->returnWebmounts();
171 $perms_clause = $backendUser->getPagePermsClause(1);
172 $recursive = isset($this->configuration[
'thisConfig'][
'buttons.'][$button .
'.'][
'recursive']) ? (int)$this->configuration[
'thisConfig'][
'buttons.'][$button .
'.'][
'recursive'] : 0;
173 if (trim($this->configuration[
'thisConfig'][
'buttons.'][$button .
'.'][
'pages'])) {
175 foreach ($pids as $key => $val) {
176 if (!$backendUser->isInWebMount($val, $perms_clause)) {
184 $backendUser->groupData[
'webmounts'] = $savedGroupDataWebmounts;
187 $pageTreePrefix =
'';
188 foreach ($pids as $key => $val) {
190 $pageTreePrefix =
',';
192 $pageTree .= $pageTreePrefix . $queryGenerator->getTreeList($val, $recursive, ($begin = 0), $perms_clause);
195 if ($pageTree !==
'') {
196 $whereClause .=
' AND ' . $tableA .
'.pid IN (' . $pageTree .
')';
200 $loadRecordsFromDatabase =
false;
204 if ($loadRecordsFromDatabase) {
206 if ($this->configuration[
'contentLanguageUid'] > -1) {
207 $whereClause .=
' AND (' . $tableA .
'.sys_language_uid=' . $this->configuration[
'contentLanguageUid'] .
' OR ' . $tableA .
'.sys_language_uid=-1) ';
210 if (is_array($this->configuration[
'thisConfig'][
'buttons.']) && is_array($this->configuration[
'thisConfig'][
'buttons.'][
'language.']) && isset($this->configuration[
'thisConfig'][
'buttons.'][
'language.'][
'restrictToItems'])) {
211 $languageList = implode(
'\',\
'',
GeneralUtility::trimExplode(
',', $database->fullQuoteStr(strtoupper($this->configuration[
'thisConfig'][
'buttons.'][
'language.'][
'restrictToItems']), $tableB)));
212 $whereClause .=
' AND ' . $tableB .
'.lg_iso_2 IN (' . $languageList .
') ';
218 $res = $database->exec_SELECTquery($fields, $tableAB, $whereClause);
219 while ($abbreviationRow = $database->sql_fetch_assoc($res)) {
220 $item = array(
'term' => $abbreviationRow[
'term'],
'abbr' => $abbreviationRow[
'acronym'],
'language' => strtolower($abbreviationRow[
'lg_iso_2']) . ($abbreviationRow[
'lg_country_iso_2'] ?
'-' . $abbreviationRow[
'lg_country_iso_2'] :
''));
221 if ($abbreviationRow[
'type'] == 1) {
222 $acronymArray[] = $item;
223 }
elseif ($abbreviationRow[
'type'] == 2) {
224 $abbrArray[] = $item;
227 $database->sql_free_result($res);
230 $this->acronymIndex = count($acronymArray);
231 $this->abbreviationIndex = count($abbrArray);
232 return json_encode(array(
'abbr' => $abbrArray,
'acronym' => $acronymArray));