1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: cInclude('includes', 'functions.lang.php');
19:
20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45:
46: class cTinyMCE4Editor extends cWYSIWYGEditor {
47: 48: 49:
50: private $_sBaseURL;
51:
52: 53: 54:
55: private $_bUseGZIP = false;
56:
57: 58: 59: 60:
61: protected static $_sConfigPrefix = '[\'wysiwyg\'][\'tinymce4\']';
62:
63: public function __construct($sEditorName, $sEditorContent) {
64: global $idart;
65:
66: $belang = cRegistry::getBackendLanguage();
67: $cfg = cRegistry::getConfig();
68: $client = cRegistry::getClientId();
69: $cfgClient = cRegistry::getClientConfig();
70: $lang = cRegistry::getLanguageId();
71:
72: parent::__construct($sEditorName, $sEditorContent);
73: $this->_setEditor("tinymce4");
74: $this->_aSettings = array();
75:
76:
77:
78: $oTypeColl = new cApiTypeCollection();
79: $oTypeColl->select();
80: while (false !== ($typeEntry = $oTypeColl->next())) {
81:
82: $curType = $typeEntry->get('type');
83:
84: $contentTypeClassName = cTypeGenerator::getContentTypeClassName($curType);
85: if (false === class_exists($contentTypeClassName)) {
86: continue;
87: }
88: $cContentType = new $contentTypeClassName(null, 0, array());
89: if (false === $cContentType->isWysiwygCompatible()) {
90: continue;
91: }
92: $this->_aSettings[$curType] = cTinymce4Configuration::get(array(), 'tinymce4');
93: }
94:
95:
96: $this->_aSettings = cApiCecHook::executeAndReturn('Contenido.WYSIWYG.LoadConfiguration', $this->_aSettings, $this->_sEditor);
97:
98:
99:
100:
101:
102: foreach ($this->_aSettings as $cmsType => $setting) {
103: $this->_setSetting($cmsType, "article_url_suffix", 'front_content.php?idart=' . $idart, true);
104:
105:
106:
107:
108: $this->_setSetting($cmsType, 'selector', ('.' . $cmsType), true);
109:
110: $this->_setSetting($cmsType, "content_css", $cfgClient[$client]["path"]["htmlpath"] . "css/style_tiny.css");
111:
112: $this->_setSetting($cmsType, "theme", "modern");
113: $this->_setSetting($cmsType, "remove_script_host", false);
114:
115: $this->_setSetting($cmsType, "urlconverter_callback", "Con.Tiny.customURLConverterCallback");
116:
117: $this->_setSetting($cmsType, "pagebreak_separator", "<!-- my page break -->");
118:
119: $this->_setSetting($cmsType, "remove_linebreaks", false);
120:
121:
122: $this->_setSetting($cmsType, "convert_urls", false);
123: $this->_setSetting($cmsType, "relative_urls", false);
124:
125:
126: $aLangs = i18nGetAvailableLanguages();
127: $this->_setSetting($cmsType, "language", $aLangs[$belang][4]);
128: unset($aLangs);
129:
130:
131:
132: $this->_setSetting($cmsType, 'document_base_url', cRegistry::getFrontendUrl(), true);
133:
134:
135:
136:
137: $this->setBaseURL($this->_getEditorPath());
138:
139:
140: if (getEffectiveSetting("generator", "xhtml", false) == "true") {
141: $this->setXHTMLMode($cmsType, true);
142: } else {
143: $this->setXHTMLMode($cmsType, false);
144: }
145:
146:
147: if (false === isset($this->_aSettings[$cmsType]["contenido_gzip"])
148: || "true" !== $this->_aSettings[$cmsType]["contenido_gzip"]) {
149: $this->setGZIPMode(false);
150: } else {
151: $this->setGZIPMode(true);
152: }
153:
154:
155: $this->setLists($cmsType);
156:
157:
158: $this->setUserDefinedStyles($cmsType);
159:
160:
161: $this->_setSetting($cmsType, "width", "100%");
162: $this->_setSetting($cmsType, "height", "480px");
163:
164:
165: $sDirection = langGetTextDirection($lang);
166: $this->_setSetting($cmsType, "directionality", $sDirection);
167:
168:
169: $this->_setSetting($cmsType, "plugin_insertdate_dateFormat", $this->convertFormat(getEffectiveSetting("dateformat", "date", "Y-m-d")));
170: $this->_setSetting($cmsType, "plugin_insertdate_timeFormat", $this->convertFormat(getEffectiveSetting("dateformat", "time", "H:i:s")));
171:
172:
173: $sMode = "full";
174: if (array_key_exists("contenido_toolbar_mode", $this->_aSettings[$cmsType])) {
175: $sMode = $this->_aSettings[$cmsType]["contenido_toolbar_mode"];
176: }
177: $this->setToolbar($cmsType, trim(strtolower($sMode)));
178:
179: $autoFullElements = $this->_aSettings[$cmsType]['auto_full_elements'];
180: if (true === isset($this->_aSettings[$cmsType]['auto_full_elements'])) {
181: unset($this->_aSettings[$cmsType]['auto_full_elements']);
182: }
183:
184:
185:
186:
187: if ($autoFullElements === 'true') {
188: $this->_setSetting($cmsType, 'valid_elements', '*[*]');
189: $this->_setSetting($cmsType, 'extended_valid_elements', '*[*]');
190: }
191:
192:
193:
194: $validElements = "a[name|href|target|title],strong/b[class],em/i[class],strike[class],u[class],p[dir|class|style],ol,ul,li[style],br,img[class|src|border=0|alt|title|hspace|vspace|width|height|style],sub,sup,blockquote[dir|style],table[border=0|cellspacing|cellpadding|width|height|class|style],tr[class|rowspan|width|height|valign|style],td[dir|class|colspan|rowspan|width|height|valign|style],div[dir|class|style],span[class|style],pre[class|style],address[class|style],h1[dir|class|style],h2[dir|class|style],h3[dir|class|style],h4[dir|class|style],h5[dir|class|style],h6[dir|class|style],hr";
195:
196:
197: $validElements .= "iframe[src|width|height],object[data|width|height|type],audio[controls|src],source[src|type],script[src],video[width|height|poster|controls]";
198:
199:
200: $this->_setSetting($cmsType, "valid_elements", $validElements);
201:
202:
203: if (!array_key_exists("extended_valid_elements", $this->_aSettings[$cmsType]) && array_key_exists("tinymce-extended-valid-elements", $this->_aSettings[$cmsType])) {
204: $this->_setSetting($cmsType, "extended_valid_elements", $this->_aSettings["tinymce-extended-valid-elements"]);
205: }
206:
207: $this->_setSetting($cmsType, "extended_valid_elements", "form[name|action|method],textarea[name|style|cols|rows],input[type|name|value|style|onclick],a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|style|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|style]");
208:
209:
210: $this->cleanURLs($cmsType);
211:
212:
213: unset($this->_aSettings[$cmsType]["contenido_toolbar_mode"], $this->_aSettings[$cmsType]["contenido_lists"]);
214:
215: unset($this->_aSettings[$cmsType]["tinymce-stylesheet-file"], $this->_aSettings[$cmsType]["tinymce-valid-elements"], $this->_aSettings[$cmsType]["tinymce-extended-valid-elements"], $this->_aSettings[$cmsType]["tinymce-lists"], $this->_aSettings[$cmsType]["tinymce-styles"], $this->_aSettings[$cmsType]["tinymce-toolbar-mode"], $this->_aSettings[$cmsType]["tinymce-toolbar1"], $this->_aSettings[$cmsType]["tinymce-toolbar2"], $this->_aSettings[$cmsType]["tinymce-toolbar3"], $this->_aSettings[$cmsType]["tinymce4-plugins"]);
216: }
217: }
218:
219: function convertFormat($sInput) {
220: $aFormatCodes = array(
221: "y" => "%y", "Y" => "%Y", "d" => "%d", "m" => "%m", "H" => "%H", "h" => "%I", "i" => "%M", "s" => "%S", "a" => "%P", "A" => "%P"
222: );
223:
224: foreach ($aFormatCodes as $sFormatCode => $sReplacement) {
225: $sInput = str_replace($sFormatCode, $sReplacement, $sInput);
226: }
227:
228: return ($sInput);
229: }
230:
231: function setUserDefinedStyles($sType) {
232: $sStyles = "";
233:
234:
235:
236: if(true === isset($this->_aSettings[$sType])
237: && true === isset($this->_aSettings[$sType][$sType])) {
238: if (array_key_exists('style_formats', $this->_aSettings[$sType][$sType])) {
239: $sStyles = $this->_aSettings[$sType]["style_formats"];
240: if (strlen($sStyles) > 0) {
241:
242: if (null !== json_decode($sStyles)) {
243: $this->_setSetting($sType, 'style_formats', json_decode($sStyles), true);
244: }
245: }
246: }
247: }
248: }
249:
250: 251: 252: 253: 254:
255: function setLists($sType) {
256: $client = cRegistry::getClientId();
257: $lang = cRegistry::getLanguageId();
258:
259: $aLists = array();
260: if (array_key_exists("contenido_lists", $this->_aSettings[$sType])) {
261: $aLists = json_decode($this->_aSettings[$sType]["contenido_lists"], true);
262: }
263:
264:
265: if (true === isset($aLists['link'])) {
266: $this->_setSetting($sType, 'link_list', $this->_sBaseURL . 'contenido/ajax/class.tinymce_list.php?mode=link&lang=' . $lang . '&client=' . $client . '#', true);
267: }
268:
269: if (true === isset($aLists['image'])) {
270: $this->_setSetting($sType, 'image_list', $this->_sBaseURL . 'contenido/ajax/class.tinymce_list.php?mode=image&lang=' . $lang . '&client=' . $client . '#', true);
271: }
272:
273: }
274:
275: 276: 277: 278: 279:
280: function setXHTMLMode($sType, $bEnabled = true) {
281: if ($bEnabled) {
282: $this->_setSetting($sType, 'cleanup_callback', '', true);
283: } else {
284: $this->_setSetting($sType, 'cleanup_callback', 'Con.Tiny.customCleanupCallback', true);
285: }
286: }
287:
288: 289: 290: 291:
292: private function setGZIPMode($bEnabled = true) {
293: if ($bEnabled) {
294: $this->_bUseGZIP = true;
295: } else {
296: $this->_bUseGZIP = false;
297: }
298: }
299:
300: 301: 302: 303:
304: public function getGZIPMode() {
305: return (bool) $this->_bUseGZIP;
306: }
307:
308: 309: 310:
311: public function setToolbar($cmsType, $sMode = "") {
312: $cfg = cRegistry::getConfig();
313: $cfgClient = cRegistry::getClientConfig();
314: $client = cRegistry::getClientId();
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330: switch ($sMode) {
331: case "full":
332: if ('CMS_HTMLHEAD' === $cmsType) {
333: $defaultToolbar1 = cTinymce4Configuration::get('undo redo | consave conclose', 'tinymce4', $cmsType, 'tinymce4_full', 'toolbar1');
334: $defaultToolbar2 = cTinymce4Configuration::get('', 'tinymce4', $cmsType, 'tinymce4_full', 'toolbar2');
335: $defaultToolbar3 = cTinymce4Configuration::get('', 'tinymce4', $cmsType, 'tinymce4_full', 'toolbar3');
336: $defaultPlugins = cTinymce4Configuration::get('conclose', 'tinymce4', $cmsType, 'tinymce4_full', 'plugins');
337: $this->_setSetting($cmsType, 'menubar', false, true);
338: } else {
339: $defaultToolbar1 = cTinymce4Configuration::get('cut copy paste pastetext | searchreplace | undo redo | bold italic underline strikethrough subscript superscript | insertdatetime preview | visualchars nonbreaking template pagebreak | help | fullscreen', 'tinymce4', $cmsType, 'tinymce4_full', 'toolbar1');
340: $defaultToolbar2 = cTinymce4Configuration::get('link unlink anchor image media hr | bullist numlist | outdent indent blockquote | alignleft aligncenter alignright alignfull removeformat | forecolor backcolor | ltr rtl | charmap | code', 'tinymce4', $cmsType, 'tinymce4_full', 'toolbar2');
341: $defaultToolbar3 = cTinymce4Configuration::get('table | formatselect fontselect fontsizeselect | consave conclose', 'tinymce4', $cmsType, 'tinymce4_full', 'toolbar3');
342: $defaultPlugins = cTinymce4Configuration::get('charmap code conclose table conclose hr image link pagebreak layer insertdatetime preview anchor media searchreplace print contextmenu paste directionality fullscreen visualchars nonbreaking template textcolor', 'tinymce4', $cmsType, 'tinymce4_full', 'plugins');
343: }
344: $this->_setSetting($cmsType, 'inline', false, true);
345: $this->_setSetting($cmsType, 'toolbar1', $defaultToolbar1, true);
346: $this->_setSetting($cmsType, 'toolbar2', $defaultToolbar2, true);
347: $this->_setSetting($cmsType, 'toolbar3', $defaultToolbar3, true);
348: $this->_setSetting($cmsType, 'plugins', $defaultPlugins, true);
349:
350: $aCustSettings = cTinymce4Configuration::get(array(), 'tinymce4', $cmsType, 'tinymce4_full');
351: foreach ($aCustSettings as $sKey => $sValue) {
352: $this->_setSetting($cmsType, $sKey, $sValue, true);
353: }
354: break;
355:
356: case "fullscreen":
357:
358: if ('CMS_HTMLHEAD' === $cmsType) {
359: $defaultToolbar1 = cTinymce4Configuration::get('undo redo | consave conclose', 'tinymce4', $cmsType, 'tinymce4_fullscreen', 'toolbar1');
360: $defaultToolbar2 = cTinymce4Configuration::get('', 'tinymce4',$cmsType, 'tinymce4_fullscreen', 'toolbar2');
361: $defaultToolbar3 = cTinymce4Configuration::get('', 'tinymce4', $cmsType, 'tinymce4_fullscreen', 'toolbar3');
362: $defaultPlugins = cTinymce4Configuration::get('conclose', 'tinymce4', $cmsType, 'tinymce4_fullscreen', 'plugins');
363: } else {
364: $defaultToolbar1 = cTinymce4Configuration::get('cut copy paste pastetext | searchreplace | undo redo | bold italic underline strikethrough subscript superscript | insertdatetime preview | visualchars nonbreaking template pagebreak | help | fullscreen', 'tinymce4', $cmsType, 'tinymce4_fullscreen', 'toolbar1');
365: $defaultToolbar2 = cTinymce4Configuration::get('link unlink anchor image media hr | bullist numlist | outdent indent blockquote | alignleft aligncenter alignright alignfull removeformat | forecolor backcolor | ltr rtl | charmap | code', 'tinymce4', $cmsType, 'tinymce4_fullscreen', 'toolbar2');
366: $defaultToolbar3 = cTinymce4Configuration::get('table | formatselect fontselect fontsizeselect | consave conclose', 'tinymce4', $cmsType, 'tinymce4_fullscreen', 'toolbar3');
367: $defaultPlugins = cTinymce4Configuration::get('charmap code table conclose hr image link pagebreak layer insertdatetime preview anchor media searchreplace print contextmenu paste directionality fullscreen visualchars nonbreaking template textcolor', 'tinymce4', $cmsType, 'tinymce4_fullscreen', 'plugins');
368: }
369: $this->_setSetting($cmsType, 'inline', false, true);
370: $this->_setSetting($cmsType, 'menubar', true, true);
371: $this->_setSetting($cmsType, 'toolbar1', $defaultToolbar1, true);
372: $this->_setSetting($cmsType, 'toolbar2', $defaultToolbar2, true);
373: $this->_setSetting($cmsType, 'toolbar3', $defaultToolbar3, true);
374:
375: $this->_setSetting($cmsType, 'plugins', $defaultPlugins, true);
376:
377: $aCustSettings = cTinymce4Configuration::get(array(), 'tinymce4', $cmsType, 'tinymce4_fullscreen');
378: foreach ($aCustSettings as $sKey => $sValue) {
379: $this->_setSetting($cmsType, $sKey, $sValue, true);
380: }
381:
382: break;
383:
384: case "simple":
385: $this->_setSetting($cmsType, "toolbar1", "cut copy paste pastetext | searchreplace | undo redo | bold italic underline strikethrough subscript superscript | insertdatetime preview", true);
386: $this->_setSetting($cmsType, "toolbar2", "link unlink anchor image | bullist numlist | outdent indent | alignleft aligncenter alignright alignfull removeformat | forecolor backcolor | ltr rtl | charmap | code", true);
387: $this->_setSetting($cmsType, "toolbar3", "", true);
388:
389: $this->_setSetting($cmsType, "plugins", "anchor charmap code insertdatetime preview searchreplace print contextmenu paste directionality textcolor", true);
390:
391: $aCustSettings = cTinymce4Configuration::get(array(), 'tinymce4', $cmsType, 'tinymce4_simple');
392: foreach ($aCustSettings as $sKey => $sValue) {
393: $this->_setSetting($cmsType, $sKey, $sValue, true);
394: }
395:
396: break;
397:
398: case "mini":
399: $this->_setSetting($cmsType, "toolbar1", "undo redo | bold italic underline strikethrough | link", true);
400: $this->_setSetting($cmsType, "toolbar2", "", true);
401: $this->_setSetting($cmsType, "toolbar3", "", true);
402:
403: $this->_setSetting($cmsType, "plugins", "contextmenu", true);
404:
405: $aCustSettings = cTinymce4Configuration::get(array(), 'tinymce4', $cmsType, 'tinymce4_mini');
406: foreach ($aCustSettings as $sKey => $sValue) {
407: $this->_setSetting($cmsType, $sKey, $sValue, true);
408: }
409:
410: break;
411:
412: case "custom":
413: $aCustSettings = cTinymce4Configuration::get(array(), 'tinymce4', $cmsType, 'tinymce4_custom');
414: foreach ($aCustSettings as $sKey => $sValue) {
415: $this->_setSetting($cmsType, $sKey, $sValue, true);
416: }
417:
418: break;
419:
420: case "inline_edit":
421: if ('CMS_HTMLHEAD' === $cmsType) {
422: $defaultToolbar1 = cTinymce4Configuration::get('undo redo | consave conclose', 'tinymce4', $cmsType, 'tinymce4_inline', 'toolbar1');
423: $defaultToolbar2 = cTinymce4Configuration::get('', 'tinymce4', $cmsType, 'tinymce4_inline', 'toolbar2');
424: $defaultToolbar3 = cTinymce4Configuration::get('', 'tinymce4', $cmsType, 'tinymce4_inline', 'toolbar3');
425: $defaultPlugins = cTinymce4Configuration::get('conclose', 'tinymce4', $cmsType, 'tinymce4_inline', 'plugins');
426: } else {
427: $defaultToolbar1 = cTinymce4Configuration::get('bold italic underline strikethrough | undo redo | bullist numlist separator forecolor backcolor | alignleft aligncenter alignright | confullscreen | consave conclose', 'tinymce4', $cmsType, 'tinymce4_inline', 'plugins');
428: $defaultToolbar2 = cTinymce4Configuration::get('', 'tinymce4', $cmsType, 'tinymce4_inline', 'toolbar2');
429: $defaultToolbar3 = cTinymce4Configuration::get('', 'tinymce4', $cmsType, 'tinymce4_inline', 'toolbar3');
430: $defaultPlugins = cTinymce4Configuration::get('conclose confullscreen media table textcolor', 'tinymce4', $cmsType, 'tinymce4_inline', 'plugins');
431: }
432: $this->_setSetting($cmsType, 'inline', true, true);
433: $this->_setSetting($cmsType, 'menubar', false, true);
434: $this->_setSetting($cmsType, 'toolbar1', $defaultToolbar1, true);
435: $this->_setSetting($cmsType, 'toolbar2', $defaultToolbar2, true);
436: $this->_setSetting($cmsType, 'toolbar3', $defaultToolbar3, true);
437:
438:
439: $this->_unsetSetting($cmsType, "width");
440: $this->_setSetting($cmsType, "height", "210px", true);
441:
442:
443:
444:
445:
446: $this->_setSetting($cmsType, "plugins", $defaultPlugins, true);
447:
448:
449: $this->_setSetting($cmsType, 'inline', true);
450: $this->_setSetting($cmsType, 'menubar', false);
451: $this->_setSetting($cmsType, "content_css", $cfgClient[$client]["path"]["htmlpath"] . "css/style_tiny.css", true);
452:
453: $aCustSettings = cTinymce4Configuration::get(array(), 'tinymce4', $cmsType, 'tinymce4_inline');
454: foreach ($aCustSettings as $sKey => $sValue) {
455: $this->_setSetting($cmsType, $sKey, $sValue, true);
456: }
457:
458: break;
459:
460: default:
461: $this->_setSetting($cmsType, 'toolbar1', 'undo redo | bold italic underline strikethrough | link unlink anchor image | table', true);
462: $this->_setSetting($cmsType, 'toolbar2', 'styleselect | bullist numlist | outdent indent | alignleft aligncenter alignright alignfull removeformat | forecolor backcolor | subscript superscript | code', true);
463: $this->_setSetting($cmsType, 'toolbar3', "", true);
464: $this->_setSetting($cmsType, 'plugins', "anchor code contextmenu media paste table searchreplace textcolor", true);
465:
466: $aCustSettings = cTinymce4Configuration::get(array(), 'tinymce4', $cmsType, 'tinymce_default');
467: foreach ($aCustSettings as $sKey => $sValue) {
468: $this->_setSetting($cmsType, $sKey, $sValue, true);
469: }
470: }
471: }
472:
473: function cleanURLs($cmsType) {
474: global $sess;
475:
476:
477: $aParameters = array(
478:
479: 'content_css', 'popups_css', 'popups_css_add', 'editor_css',
480: 'plugin_preview_pageurl',
481: 'media_external_list_url',
482: 'template_external_list_url'
483: );
484:
485: foreach ($aParameters as $sParameter) {
486: if (array_key_exists($sParameter, $this->_aSettings[$cmsType])) {
487: $this->_setSetting($cmsType, $sParameter, $this->addPath($this->_aSettings[$cmsType][$sParameter]), true);
488: }
489: }
490:
491:
492: $aParameters = array(
493: 'media_external_list_url',
494: 'template_external_list_url'
495: );
496:
497: foreach ($aParameters as $sParameter) {
498: if (array_key_exists($sParameter, $this->_aSettings[$cmsType]) && preg_match('/\\.php$/i', $this->_aSettings[$cmsType][$sParameter])) {
499: $this->_setSetting($cmsType, $sParameter, $this->_aSettings[$cmsType][$sParameter] . '?contenido=' . $sess->id, true);
500: }
501: }
502: }
503:
504: function addPath($sFile) {
505: global $cfgClient, $client;
506:
507:
508: if (!preg_match('/^(http|https):\/\/((?:[a-zA-Z0-9_-]+\.?)+):?(\d*)/', $sFile)) {
509: if (preg_match('/^\//', $sFile)) {
510: $sFile = "http://" . $_SERVER['HTTP_HOST'] . $sFile;
511: } else {
512: $sFile = $cfgClient[$client]["htmlpath"]["frontend"] . $sFile;
513: }
514: }
515:
516: return $sFile;
517: }
518:
519: function setBaseURL($sBaseUrl) {
520: $this->_sBaseURL = $sBaseUrl;
521: }
522:
523: public function _getScripts() {
524: if ($this->_bUseGZIP) {
525: $sReturn = "\n<!-- tinyMCE -->\n" . '<script language="javascript" type="text/javascript" src="' . $this->_sBaseURL . 'tinymce/js/tinymce/tinymce.gzip.js"></script>';
526: } else {
527: $sReturn = "\n<!-- tinyMCE -->\n" . '<script language="javascript" type="text/javascript" src="' . $this->_sBaseURL . 'tinymce/js/tinymce/tinymce.min.js"></script>';
528: }
529:
530: return $sReturn;
531: }
532:
533: public function _getEditor() {
534: global $sess, $cfg, $lang, $client, $idart, $cfgClient;
535:
536:
537: $browserparameters = array("restrict_imagebrowser" => array("jpg", "gif", "jpeg", "png"));
538: $sess->register("browserparameters");
539:
540:
541:
542:
543: $oTemplate = new cTemplate();
544:
545: $oTemplate->set('s', 'CONFIG', json_encode($this->_aSettings));
546:
547: $oTemplate->set('s', 'PATH_CONTENIDO_FULLHTML', cRegistry::getConfigValue('path', 'contenido_fullhtml'));
548: $oTemplate->set('s', 'IMAGEBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
549: $oTemplate->set('s', 'FILEBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=filebrowser');
550: $oTemplate->set('s', 'MEDIABROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
551: $oTemplate->set('s', 'FRONTEND_PATH', $cfgClient[$client]["path"]["htmlpath"]);
552: $oTemplate->set('s', 'CLOSE', html_entity_decode(i18n('Close editor'), ENT_COMPAT | ENT_HTML401, cRegistry::getEncoding()));
553: $oTemplate->set('s', 'SAVE', html_entity_decode(i18n('Close editor and save changes'), ENT_COMPAT | ENT_HTML401, cRegistry::getEncoding()));
554: $oTemplate->set('s', 'QUESTION', html_entity_decode(i18n('You have unsaved changes.'), ENT_COMPAT | ENT_HTML401, cRegistry::getEncoding()));
555: $oTemplate->set('s', 'BACKEND_URL', cRegistry::getBackendUrl());
556:
557: $oTxtEditor = new cHTMLTextarea($this->_sEditorName, $this->_sEditorContent);
558: $oTxtEditor->setId($this->_sEditorName);
559: $oTxtEditor->setClass(htmlentities($this->_sEditorName));
560:
561: $oTxtEditor->setStyle("width: " . $this->_aSettings["width"] . "; height: " . $this->_aSettings["height"] . ";");
562:
563: $sReturn = $oTemplate->generate($cfg['path']['all_wysiwyg'] . $this->_sEditor . "contenido/templates/template.tinymce_tpl.html", true);
564: $sReturn .= $oTxtEditor->render();
565:
566: return $sReturn;
567: }
568:
569: 570: 571: 572: 573: 574: 575: 576: 577:
578: protected function _setSetting($sType, $sKey, $sValue, $bForceSetting = false) {
579: if ($bForceSetting || !array_key_exists($sKey, $this->_aSettings[$sType])) {
580: $this->_aSettings[$sType][$sKey] = $sValue;
581: }
582: }
583:
584: 585: 586: 587:
588: protected function _unsetSetting() {
589: $numargs = func_num_args();
590:
591: if (0 === $numargs) {
592: return;
593: }
594:
595: $result = &$this->_aSettings;
596: for ($i = 0; $i < $numargs -1; $i++) {
597:
598: if (false === in_array(func_get_arg(1 + $i), $this->_aSettings)) {
599: return;
600: }
601:
602: $result = $result[func_get_arg(1 + $i)];
603: }
604:
605:
606: unset($result);
607: }
608:
609:
610: public function getConfigInlineEdit() {
611: $sConfig = '';
612:
613: foreach($this->_aSettings as $cmsType => $setting) {
614: $this->setToolbar($cmsType, 'inline_edit');
615: }
616:
617: return $this->_aSettings;
618:
619: foreach ($this->_aSettings as $sKey => $sValue) {
620: if (is_bool($sValue)) {
621: if ($sValue === true) {
622: $sValue = 'true';
623: } else {
624: $sValue = 'false';
625: }
626: }
627:
628: if ($sValue == "true" || $sValue == "false" || $sKey == "oninit" || $sKey == "onpageload" || $sKey == 'style_formats') {
629: $sConfig .= "'$sKey': " . $sValue;
630: } else {
631: $sConfig .= "'$sKey': '" . $sValue . "'";
632: }
633: $sConfig .= ",\n\t";
634: }
635:
636: $sConfig = substr($sConfig, 0, -3);
637: return $sConfig;
638: }
639:
640: public function getConfigFullscreen() {
641: $sConfig = '';
642: foreach($this->_aSettings as $cmsType => $setting) {
643: $this->setToolbar($cmsType, 'fullscreen');
644: }
645:
646: return $this->_aSettings;
647:
648: }
649:
650: 651: 652: 653:
654: public function getPlugins() {
655: return (string) $this->_aSettings['plugins'];
656: }
657:
658: 659: 660: 661:
662: function getThemes() {
663: return (string) $this->_aSettings['theme'];
664: }
665:
666: 667: 668: 669: 670: 671: 672:
673: public static function safeConfig($config) {
674: parent::safeConfig($config['tinymce4']);
675: }
676: }
677:
678: ?>