1: <?php
2: /**
3: * This file contains the abstract WYSIWYG editor class.
4: *
5: * @package Core
6: * @subpackage Backend
7: * @version SVN Revision $Rev:$
8: *
9: * @author Timo Hummel
10: * @copyright four for business AG <www.4fb.de>
11: * @license http://www.contenido.org/license/LIZENZ.txt
12: * @link http://www.4fb.de
13: * @link http://www.contenido.org
14: */
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: /**
19: * Base class for all WYSIWYG editors
20: *
21: * @package Core
22: * @subpackage Backend
23: */
24: abstract class cWYSIWYGEditor {
25:
26: protected $_sPath;
27:
28: protected $_sEditor;
29:
30: protected $_sEditorName;
31:
32: protected $_sEditorContent;
33:
34: protected $_aSettings;
35:
36: public function __construct($sEditorName, $sEditorContent) {
37: $cfg = cRegistry::getConfig();
38:
39: $this->_sPath = $cfg['path']['all_wysiwyg_html'];
40: $this->_setEditorName($sEditorName);
41: $this->_setEditorContent($sEditorContent);
42: }
43:
44: protected function _setEditorContent($sContent) {
45: $this->_sEditorContent = $sContent;
46: }
47:
48: protected function _setEditor($sEditor) {
49: global $cfg;
50:
51: if (is_dir($cfg['path']['all_wysiwyg'] . $sEditor)) {
52: if (substr($sEditor, strlen($sEditor) - 1, 1) != "/") {
53: $sEditor = $sEditor . "/";
54: }
55:
56: $this->_sEditor = $sEditor;
57: }
58: }
59:
60: protected function _setSetting($sKey, $sValue, $bForceSetting = false) {
61: if ($bForceSetting) {
62: $this->_aSettings[$sKey] = $sValue;
63: } else if (!array_key_exists($sKey, $this->_aSettings)) {
64: $this->_aSettings[$sKey] = $sValue;
65: }
66: }
67:
68: protected function _unsetSetting($sKey) {
69: unset($this->_aSettings[$sKey]);
70: }
71:
72: protected function _getEditorPath() {
73: return ($this->_sPath . $this->_sEditor);
74: }
75:
76: protected function _setEditorName($sEditorName) {
77: $this->_sEditorName = $sEditorName;
78: }
79:
80: /**
81: * @throws cBadMethodCallException if this method is not overridden in the subclass
82: */
83: protected function _getScripts() {
84: throw new cBadMethodCallException('You need to override the method _getScripts');
85: }
86:
87: /**
88: * @throws cBadMethodCallException if this method is not overridden in the subclass
89: */
90: protected function _getEditor() {
91: throw new cBadMethodCallException('You need to override the method _getEditor');
92: }
93:
94: }
95: