Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinymce4Configuration
  • cTinyMCE4Editor
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TODOBackendList
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • addArtspec
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • putFileContents
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the abstract WYSIWYG editor class.
  4:  *
  5:  * @package Core
  6:  * @subpackage Backend
  7:  * @author Timo Hummel
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: /**
 17:  * Base class for all WYSIWYG editors
 18:  *
 19:  * @package Core
 20:  * @subpackage Backend
 21:  */
 22: abstract class cWYSIWYGEditor {
 23:     /**
 24:      * Access key under which the wysiwyg editor settings will be stored
 25:      * @var string
 26:      */
 27:     protected static $_configPrefix = '[\'wysiwyg\']';
 28: 
 29:     /**
 30:      *
 31:      * @var string
 32:      */
 33:     protected $_sPath;
 34: 
 35:     /**
 36:      *
 37:      * @var string
 38:      */
 39:     protected $_sEditor;
 40: 
 41:     /**
 42:      *
 43:      * @var string
 44:      */
 45:     protected $_sEditorName;
 46: 
 47:     /**
 48:      *
 49:      * @var string
 50:      */
 51:     protected $_sEditorContent;
 52: 
 53:     /**
 54:      *
 55:      * @var array
 56:      */
 57:     protected $_aSettings;
 58: 
 59:     /**
 60:      * Constructor to create an instance of this class.
 61:      *
 62:      * @param string $editorName
 63:      * @param string $editorContent
 64:      */
 65:     public function __construct($editorName, $editorContent) {
 66:         $cfg = cRegistry::getConfig();
 67: 
 68:         $this->_sPath = $cfg['path']['all_wysiwyg_html'];
 69:         $this->_setEditorName($editorName);
 70:         $this->_setEditorContent($editorContent);
 71:     }
 72: 
 73:     /**
 74:      *
 75:      * @param string $sContent
 76:      */
 77:     protected function _setEditorContent($sEditorContent) {
 78:         $this->_sEditorContent = $sEditorContent;
 79:     }
 80: 
 81:     /**
 82:      *
 83:      * @param string $sEditor
 84:      */
 85:     protected function _setEditor($sEditor) {
 86:         global $cfg;
 87: 
 88:         if (is_dir($cfg['path']['all_wysiwyg'] . $sEditor)) {
 89:             if (substr($sEditor, strlen($sEditor) - 1, 1) != "/") {
 90:                 $sEditor = $sEditor . "/";
 91:             }
 92: 
 93:             $this->_sEditor = $sEditor;
 94:         }
 95:     }
 96: 
 97:     /**
 98:      * Sets given setting if setting was not yet defined.
 99:      * Overwriting defined setting can be achieved with $forceSetting = true.
100:      *
101:      * @param string $key
102:      *         of setting to set
103:      * @param string $value
104:      *         of setting to set
105:      * @param bool $forceSetting [optional]
106:      *         to overwrite defined setting
107:      * @param bool $type Normally unused (counterpart of cTinyMCE4Editor::setSetting)
108:      */
109:     public function setSetting($type = null, $key, $value, $forceSetting = false) {
110:         if ($forceSetting || !array_key_exists($key, $this->_aSettings)) {
111:             $this->_aSettings[$key] = $value;
112:         }
113:     }
114: 
115:     /**
116:      *
117:      * @param string $key
118:      */
119:     protected function _unsetSetting($key) {
120:         unset($this->_aSettings[$key]);
121:     }
122: 
123:     /**
124:      *
125:      * @return string
126:      */
127:     protected function _getEditorPath() {
128:         return $this->_sPath . $this->_sEditor;
129:     }
130: 
131:     /**
132:      *
133:      * @param string $sEditorName
134:      */
135:     protected function _setEditorName($sEditorName) {
136:         $this->_sEditorName = $sEditorName;
137:     }
138: 
139:     /**
140:      *
141:      * @throws cBadMethodCallException if this method is not overridden in the
142:      *         subclass
143:      */
144:     protected function getScripts() {
145:         throw new cBadMethodCallException('You need to override the method _getScripts');
146:     }
147: 
148:     /**
149:      *
150:      * @throws cBadMethodCallException if this method is not overridden in the
151:      *         subclass
152:      */
153:     protected function getEditor() {
154:         throw new cBadMethodCallException('You need to override the method _getEditor');
155:     }
156: 
157:     /**
158:      * Find out which WYSIWYG editor is currently chosen
159:      * @return string
160:      *         The name of current WYSIWYG editor
161:      */
162:     public static function getCurrentWysiwygEditorName() {
163:         // define fallback WYSIWYG editor
164:         define('DEFAULT_WYSIWYG_EDITOR', cRegistry::getConfigValue('wysiwyg', 'editor', 'tinymce3'));
165: 
166:         $curWysiwygEditor = getEffectiveSetting('wysiwyg', 'editor', constant('DEFAULT_WYSIWYG_EDITOR'));
167: 
168:         // no paths are allowed in WYSIWYG editor
169:         // fall back to defaults if editor folder does not exist
170:         if (0 === strlen($curWysiwygEditor)
171:         || false === cFileHandler::exists(cRegistry::getConfigValue('path', 'all_wysiwyg') . $curWysiwygEditor)
172:         || false !== strpos($curWysiwygEditor, '.')
173:         || false !== strpos($curWysiwygEditor, '/')
174:         || false !== strpos($curWysiwygEditor, '\\')) {
175:             $curWysiwygEditor = constant('DEFAULT_WYSIWYG_EDITOR');
176:         }
177: 
178:         return $curWysiwygEditor;
179:     }
180: 
181:     /**
182:      * Saves configuration of WYSIWYG editor into a file
183:      * This function does not validate input! This has to be done by classes that extend cWYSIWYGEditor
184:      * because this class does not know what each WYSIWYG editor expects.
185:      * @param array $config
186:      *         Array with configuration values for the current WYSIWYG editor to save
187:      * @return array
188:      *         Array with values that were not accepted
189:      */
190:     public static function saveConfig($config) {
191: 
192:         // specify filename scheme
193:         // for tinymce 4 this will be config.wysiwyg_tinymce4.php
194:         $configFile = 'config.wysiwyg_' . static::getCurrentWysiwygEditorName() . '.php';
195: 
196:         // get path to current config folder
197:         $configPath = cRegistry::getConfigValue('path', 'contenido_config');
198: 
199:         // write content to file as array in $cfg['tinymce4']
200:         $filePrefix = '<?php ' . PHP_EOL;
201:         $filePrefix .= "defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');\n";
202:         $filePrefix .= 'global $cfg;' . PHP_EOL . PHP_EOL;
203: 
204:         $content = $filePrefix . '$cfg' . static::$_configPrefix . ' = ' . var_export($config, true) . ';' . PHP_EOL;
205: 
206:         // first try to write then check what went wrong in case of error
207:         if (true !== cFileHandler::write($configPath . $configFile, $content)) {
208:             $erroneousSettings = array();
209: 
210:             // just pass back that the file could not be written
211:             $erroneusSettings['saving'] = array('config_file' => 'wysiwyg config file could not be written');
212:             // write more detailed information with sensitive information such as full path into error log
213:             error_log('Error writing ' . $configPath . $configFile);
214:             return $erroneusSettings;
215:         }
216: 
217:         // apply changes to current config
218:         global $cfg;
219:         $cfg['wysiwyg'][static::getCurrentWysiwygEditorName()] = $config;
220: 
221:         return array();
222:     }
223: }
224: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0