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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • 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
  • cRights
  • 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
  • cApiImageCheckImageEditingPossibility
  • 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
  • conGetUniqueArticleUrlname
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsArticleUrlnameUnique
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSetStartArticle
  • consoleLog
  • 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
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParentAreaId
  • getRightsList
  • 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
  • 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
  • strCheckAlias
  • 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 WYSIWYG editor class for TinyMCE.
  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: cInclude('includes', 'functions.lang.php');
 17: 
 18: /**
 19:  * The object cTinyMCEEditor is a wrapper class to the TinyMCE WYSIWYG Editor.
 20:  * Attributes can be defined to generate JavaScript options and functions to initialise the global
 21:  * tinyMCE object in file ./contenido/external/wysiwyg/tinymce3/tinymce.tpl.html.
 22:  *
 23:  * All settings accepted by tinyMCE and its plugins may be specified using system, client
 24:  * group or user property/setting.
 25:  *
 26:  * The following parameters will be always set on initialization (even, if they have been specified
 27:  * as property. They can be set using setSetting later on, if needed):
 28:  * document_base_url
 29:  * cleanup_callback (-> XHTML)
 30:  * file_browser_callback
 31:  * external_link_list_url
 32:  * external_image_list_url
 33:  *
 34:  * The following settings are only used in CONTENIDO:
 35:  * contenido_toolbar_mode: full, simple, mini, custom
 36:  * contenido_lists: link,image
 37:  * contenido_height_html
 38:  * contenido_height_head
 39:  * See backend.customizing.html for details
 40:  *
 41:  * @deprecated [2017-11-23]
 42:  * @package    Core
 43:  * @subpackage Backend
 44:  */
 45: class cTinyMCEEditor extends cWYSIWYGEditor {
 46: 
 47:     /**
 48:      * Stores base url of page
 49:      *
 50:      * @var string
 51:      */
 52:     protected $_baseURL = '';
 53: 
 54:     /**
 55:      * Stores, if GZIP compression will be used
 56:      *
 57:      * @var bool
 58:      */
 59:     protected $_useGZIP = false;
 60: 
 61: 
 62:     /**
 63:      * cTinyMCEEditor constructor
 64:      *
 65:      * @param string $editorName
 66:      * @param string $editorContent
 67:      */
 68:     public function __construct($editorName, $editorContent) {
 69: 
 70:         $belang = cRegistry::getBackendLanguage();
 71:         $cfgClient = cRegistry::getClientConfig();
 72:         $client = cRegistry::getClientId();
 73:         $lang = cRegistry::getLanguageId();
 74:         $idart = cRegistry::getArticleId();
 75: 
 76:         parent::__construct($editorName, $editorContent);
 77: 
 78:         $this->_setEditor("tinymce3");
 79: 
 80:         // Retrieve all settings for tinymce
 81:         $this->_aSettings = getEffectiveSettingsByType("tinymce");
 82: 
 83:         // added client and langiage id in tinymce settings
 84:         $this->_aSettings["langid"] = cRegistry::getLanguageId();
 85:         $this->_aSettings["clientid"] = cRegistry::getClientId();
 86: 
 87:         // For compatibility, read settings in previous syntax also (< V4.7, type "wysiwyg" vs. "tinymce")
 88:         $this->_aSettings = array_merge(getEffectiveSettingsByType("wysiwyg"), $this->_aSettings);
 89: 
 90:         // modified 23.10.2006
 91:         $this->setSetting(null, "article_url_suffix", 'front_content.php?idart=' . $idart, true);
 92: 
 93:         // Default values
 94:         $this->setSetting(null, "mode", "exact");
 95:         $aPathFragments = explode('/', $cfgClient[$client]["path"]["htmlpath"]);
 96:         $this->setSetting(null, "content_css", $cfgClient[$client]["path"]["htmlpath"] . "css/style_tiny.css");
 97: 
 98:         $this->setSetting(null, "theme", "advanced");
 99:         $this->setSetting(null, "theme_advanced_toolbar_location", "top");
100:         $this->setSetting(null, "theme_advanced_path_location", "bottom");
101:         $this->setSetting(null, "remove_script_host", false);
102:         $this->setSetting(null, "file_browser_callback", "Con.Tiny.customFileBrowserCallback", true);
103:         //$this->_setSetting("urlconverter_callback", "Con.Tiny.customURLConverterCallback");
104:         // New in V3.x
105:         $this->setSetting(null, "theme_advanced_resizing", true);
106:         $this->setSetting(null, "pagebreak_separator", "<!-- my page break -->"); // needs pagebreak plugin
107:         // Source formatting (ugh!)
108:         $this->setSetting(null, "apply_source_formatting", true);
109:         $this->setSetting(null, "remove_linebreaks", false); // Remove linebreaks - GREAT idea...
110: 
111:         // Convert URLs and Relative URLs default
112:         $this->setSetting(null, "convert_urls", false);
113:         $this->setSetting(null, "relative_urls", false);
114: 
115:         // Editor name (a comma separated list of instances)
116:         $this->setSetting(null, "elements", $editorName);
117: 
118:         // Editor language
119:         $langs = i18nGetAvailableLanguages();
120:         $this->setSetting(null, "language", $langs[$belang][4]);
121:         unset($langs);
122: 
123:         // Set document base URL
124:         $this->setSetting(null, 'document_base_url', cRegistry::getFrontendUrl(), true);
125: 
126:         // The following "base URL" is the URL used to reference JS script files
127:         // - it is not the base href value
128:         //$this->setBaseURL(preg_replace('/^https?:\/\/[^\/]+(.*)$/', '$1', $this->_getEditorPath()));
129:         $this->setBaseURL($this->_getEditorPath());
130: 
131:         // XHTML
132:         if (getEffectiveSetting("generator", "xhtml", false) == "true") {
133:             $this->setXHTMLMode(true);
134:         } else {
135:             $this->setXHTMLMode(false);
136:         }
137: 
138:         // GZIP
139:         if ($this->_aSettings["contenido_gzip"] == "true") {
140:             $this->setGZIPMode(true);
141:         } else {
142:             $this->setGZIPMode(false);
143:         }
144: 
145:         // Stylesheet file, for compatibility
146:         if (!array_key_exists("content_css", $this->_aSettings) && array_key_exists("tinymce-stylesheet-file", $this->_aSettings)) {
147:             $this->setSetting(null, "content_css", $this->_aSettings["tinymce-stylesheet-file"], true);
148:         }
149: 
150:         // Set lists (for links and image elements)
151:         $this->setLists();
152: 
153:         // Set user defined styles (be sure, that previous and SPAW syntax works)
154:         $this->setUserDefinedStyles();
155: 
156:         // Width and height
157:         $this->setSetting(null, "width", "100%");
158:         $this->setSetting(null, "height", "480px");
159: 
160:         // Text direction (rtl = right to left)
161:         $sDirection = langGetTextDirection($lang);
162:         $this->setSetting(null, "directionality", $sDirection);
163: 
164:         if ($sDirection == "rtl") {
165:             $this->setSetting(null, "theme_advanced_toolbar_align", "right", true);
166:         } else {
167:             $this->setSetting(null, "theme_advanced_toolbar_align", "left", true);
168:         }
169: 
170:         // Date and time formats
171:         $this->setSetting(null, "plugin_insertdate_dateFormat", $this->convertFormat(getEffectiveSetting("dateformat", "date", "Y-m-d")));
172:         $this->setSetting(null, "plugin_insertdate_timeFormat", $this->convertFormat(getEffectiveSetting("dateformat", "time", "H:i:s")));
173: 
174:         // Setting the toolbar (toolbar_mode and tinymce-toolbar-mode accepted)
175:         $mode = "full";
176:         if (array_key_exists("tinymce-toolbar-mode", $this->_aSettings)) {
177:             $mode = $this->_aSettings["tinymce-toolbar-mode"];
178:         }
179:         if (array_key_exists("contenido_toolbar_mode", $this->_aSettings)) {
180:             $mode = $this->_aSettings["contenido_toolbar_mode"];
181:         }
182:         $this->setToolbar(trim(cString::toLowerCase($mode)));
183: 
184:         $autoFullElements = $this->_aSettings['auto_full_elements'];
185:         unset($this->_aSettings['auto_full_elements']);
186: 
187:         // Valid elements, for compatibility also accepts "tinymce-valid-elements"
188:         if (!array_key_exists("valid_elements", $this->_aSettings) && array_key_exists("tinymce-valid-elements", $this->_aSettings)) {
189:             $this->setSetting(null, "valid_elements", $this->_aSettings["tinymce-valid-elements"], true);
190:         }
191: 
192:         // _setSetting checks, if value is empty
193:         if ($autoFullElements === 'true') {
194:             $this->setSetting(null, 'valid_elements', '*[*]');
195:             $this->setSetting(null, 'extended_valid_elements', '*[*]');
196:         }
197: 
198:         $this->setSetting(null, "valid_elements", "a[name|href|target|title],strong/b[class],em/i[class],strike[class],u[class],p[dir|class|align],ol,ul,li,br,img[class|src|alt|title|hspace|vspace|width|height|align],sub,sup,blockquote[dir|style],table[border=0|cellspacing|cellpadding|width|height|class|align|style],tr[class|rowspan|width|height|align|valign|style],td[dir|class|colspan|rowspan|width|height|align|valign|style],div[dir|class|align],span[class|align],pre[class|align],address[class|align],h1[dir|class|align],h2[dir|class|align],h3[dir|class|align],h4[dir|class|align],h5[dir|class|align],h6[dir|class|align],hr");
199: 
200:         // Extended valid elements, for compatibility also accepts "tinymce-extended-valid-elements"
201:         if (!array_key_exists("extended_valid_elements", $this->_aSettings) && array_key_exists("tinymce-extended-valid-elements", $this->_aSettings)) {
202:             $this->setSetting(null, "extended_valid_elements", $this->_aSettings["tinymce-extended-valid-elements"]);
203:         }
204: 
205: 
206:         //print_r($this->_aSettings['valid_elements']);
207: 
208:         $this->setSetting(null, "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|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]");
209: 
210:         // Clean all possible URLs
211:         $this->cleanURLs();
212: 
213:         // Remove CONTENIDO specific settings
214:         unset($this->_aSettings["contenido_toolbar_mode"], $this->_aSettings["contenido_lists"]);
215:         // Remove obsolete, deprecated values
216:         unset($this->_aSettings["tinymce-stylesheet-file"], $this->_aSettings["tinymce-valid-elements"], $this->_aSettings["tinymce-extended-valid-elements"], $this->_aSettings["tinymce-lists"], $this->_aSettings["tinymce-styles"], $this->_aSettings["tinymce-toolbar-mode"], $this->_aSettings["tinymce-toolbar1"], $this->_aSettings["tinymce-toolbar2"], $this->_aSettings["tinymce-toolbar3"], $this->_aSettings["tinymce-plugins"]);
217:     }
218: 
219:     /**
220:      * Old constructor
221:      *
222:      * @param string $editorName
223:      * @param string $editorContent
224:      * @deprecated [2016-02-18]
225:      *              This method is deprecated and is not needed any longer. Please use __construct() as constructor function.
226:      * @return __construct()
227:      */
228:     public function cTinyMCEEditor($editorName, $editorContent) {
229:         cDeprecated('This method is deprecated and is not needed any longer. Please use __construct() as constructor function.');
230:         return $this->__construct($editorName, $editorContent);
231:     }
232: 
233:     /**
234:      * Convert formats
235:      *
236:      * @param string $input
237:      * @return string
238:      */
239:     public function convertFormat($input) {
240:         $aFormatCodes = array(
241:             "y" => "%y", "Y" => "%Y", "d" => "%d", "m" => "%m", "H" => "%H", "h" => "%I", "i" => "%M", "s" => "%S", "a" => "%P", "A" => "%P"
242:         );
243: 
244:         foreach ($aFormatCodes as $sFormatCode => $sReplacement) {
245:             $input = str_replace($sFormatCode, $sReplacement, $input);
246:         }
247: 
248:         return $input;
249:     }
250: 
251:     /**
252:      * Set user defined styles
253:      *
254:      */
255:     public function setUserDefinedStyles() {
256:         $styles = "";
257: 
258:         if (array_key_exists("theme_advanced_styles", $this->_aSettings)) {
259:             $styles = $this->_aSettings["theme_advanced_styles"];
260:         } else if (array_key_exists("tinymce-styles", $this->_aSettings)) {
261:             $styles = $this->_aSettings["tinymce-styles"];
262:         }
263: 
264:         if ($styles) {
265:             $this->setSetting(null, "theme_advanced_styles", preg_replace('/;$/i', '', str_replace("|", "=", trim($styles))), true);
266:         }
267:     }
268: 
269:     /**
270:      * The special name "contenido_lists", for compatibility also
271:      * accepts "tinymce-lists".
272:      *
273:      * @param string $lists
274:      *        Deprecated, for compatibility, only
275:      */
276:     public function setLists($lists = "") {
277: 
278:         $lang = cRegistry::getLanguageId();
279:         $client = cRegistry::getClientId();
280: 
281:         if ($lists == "") {
282:             if (array_key_exists("contenido_lists", $this->_aSettings)) {
283:                 $lists = $this->_aSettings["contenido_lists"];
284:             } else if (array_key_exists("tinymce-lists", $this->_aSettings)) {
285:                 $lists = $this->_aSettings["tinymce-lists"];
286:             }
287:         }
288: 
289:         $aLists = array();
290:         $aLists = explode(",", cString::toLowerCase(str_replace(" ", "", $lists)));
291: 
292:         if (in_array("link", $aLists)) {
293:             $this->setSetting(null, "external_link_list_url", $this->_baseURL . "list.php?mode=link&lang=" . $lang . "&client=" . $client . "#", true);
294:         }
295:         if (in_array("image", $aLists)) {
296:             $this->setSetting(null, "external_image_list_url", $this->_baseURL . "list.php?mode=image&lang=" . $lang . "&client=" . $client . "#", true);
297:         }
298:         if (in_array("media", $aLists)) {
299:             $this->setSetting(null, "media_external_list_url", $this->_baseURL . "list.php?mode=media&lang=" . $lang . "&client=" . $client . "#", true);
300:         }
301:     }
302: 
303:     /**
304:      * Set method XHTML mode
305:      * Standard: true
306:      *
307:      * @param bool $beabled
308:      */
309:     public function setXHTMLMode($beabled = true) {
310:         if ($beabled) {
311:             $this->setSetting(null, "cleanup_callback", "", true);
312:         } else {
313:             $this->setSetting(null, "cleanup_callback", "Con.Tiny.customCleanupCallback", true);
314:         }
315:     }
316: 
317:     /**
318:      * Set method GZIP mode
319:      * Standard: true
320:      *
321:      * @param bool $enabled
322:      */
323:     public function setGZIPMode($enabled = true) {
324:         if ($enabled) {
325:             $this->_useGZIP = true;
326:         } else {
327:             $this->_useGZIP = false;
328:         }
329:     }
330: 
331:     /**
332:      * Get method for GZIP mode
333:      *
334:      * @return boolean
335:      */
336:     public function getGZIPMode() {
337:         return cSecurity::toBoolean($this->_useGZIP);
338:     }
339: 
340:     /**
341:      * For compatibility also accepts "tinymce-toolbar-mode", "tinymce-toolbar1-3" and "tinymce-plugins"
342:      *
343:      * @param string $mode
344:      */
345:     public function setToolbar($mode = "") {
346: 
347:         $cfgClient = cRegistry::getClientConfig();
348:         $client = cRegistry::getClientId();
349: 
350:         switch ($mode) {
351:             case "full": // Show all options
352:                 $this->setSetting(null, "theme_advanced_buttons1", "cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,bold,italic,underline,strikethrough,sub,sup,|,insertdate,inserttime,preview,|,styleselect,|,visualchars,nonbreaking,template,pagebreak,|,help,|,fullscreen", true);
353:                 $this->setSetting(null, "theme_advanced_buttons2", "link,unlink,anchor,image,media,advhr,|,bullist,numlist,|,outdent,indent,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,removeformat,|,forecolor,backcolor,|,ltr,rtl,|,visualaid,charmap,cleanup,|,code", true);
354:                 $this->setSetting(null, "theme_advanced_buttons3", "tablecontrols,|,formatselect,fontselect,fontsizeselect,|,styleprops,|,cite,abbr,acronym,del,ins,attribs", true);
355:                 //table,save,advhr,advimage,advlink,pagebreak,style,layer,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template
356:                 $this->setSetting(null, "plugins", "table,save,advhr,advimage,advlink,pagebreak,style,layer,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups", true);
357:                 $this->setSetting(null, "theme_advanced_toolbar_align", "left", true);
358: 
359:                 $aCustSettings = getEffectiveSettingsByType("tinymce");
360:                 foreach ($aCustSettings as $key=> $value) {
361:                     $this->setSetting(null, $key, $value, true);
362:                 }
363: 
364:                 break;
365:             case "fullscreen": // Show all options
366:                 $this->setSetting(null, "theme_advanced_buttons1", "cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,bold,italic,underline,strikethrough,sub,sup,|,insertdate,inserttime,preview,|,styleselect,|,visualchars,nonbreaking,template,pagebreak,|,help,|,fullscreen", true);
367:                 $this->setSetting(null, "theme_advanced_buttons2", "link,unlink,anchor,image,media,advhr,|,bullist,numlist,|,outdent,indent,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,removeformat,|,forecolor,backcolor,|,ltr,rtl,|,visualaid,charmap,cleanup,|,code", true);
368:                 $this->setSetting(null, "theme_advanced_buttons3", "tablecontrols,|,formatselect,fontselect,fontsizeselect,|,styleprops,|,cite,abbr,acronym,del,ins,attribs", true);
369:                 //table,save,advhr,advimage,advlink,pagebreak,style,layer,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template
370:                 $this->setSetting(null, "plugins", "table,save,advhr,advimage,advlink,pagebreak,style,layer,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups", true);
371:                 $this->setSetting(null, "theme_advanced_toolbar_align", "left", true);
372: 
373:                 $aCustSettings = getEffectiveSettingsByType("tinymce_fullscreen");
374:                 foreach ($aCustSettings as $key => $value) {
375:                     $this->setSetting(null, $key, $value, true);
376:                 }
377: 
378:                 break;
379:             case "simple": // Does not show font and table options
380:                 $this->setSetting(null, "theme_advanced_buttons1", "cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,bold,italic,underline,strikethrough,sub,sup,|,insertdate,inserttime,preview,|,styleselect", true);
381:                 $this->setSetting(null, "theme_advanced_buttons2", "link,unlink,anchor,image,advhr,|,bullist,numlist,|,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,removeformat,|,forecolor,backcolor,|,ltr,rtl,|,visualaid,charmap,cleanup,|,code", true);
382:                 $this->setSetting(null, "theme_advanced_buttons3", "", true);
383:                 $this->setSetting(null, "plugins", "advhr,advimage,advlink,insertdatetime,preview,searchreplace,print,contextmenu,paste,directionality", true);
384: 
385:                 $aCustSettings = getEffectiveSettingsByType("tinymce_simple");
386:                 foreach ($aCustSettings as $key => $value) {
387:                     $this->setSetting(null, $key, $value, true);
388:                 }
389: 
390:                 break;
391:             case "mini": // Minimal toolbar
392:                 $this->setSetting(null, "theme_advanced_buttons1", "undo,redo,|,bold,italic,underline,strikethrough,|,link", true);
393:                 $this->setSetting(null, "theme_advanced_buttons2", "", true);
394:                 $this->setSetting(null, "theme_advanced_buttons3", "", true);
395: 
396:                 $aCustSettings = getEffectiveSettingsByType("tinymce_mini");
397:                 foreach ($aCustSettings as $key => $value) {
398:                     $this->setSetting(null, $key, $value, true);
399:                 }
400: 
401:                 break;
402:             case "custom": // Custom toolbar
403:                 // tinymce-toolbar1/2/3 and tinymce-plugins are only mentioned for compatibility
404:                 // They are ignored, if theme_advanced_buttons1/2/3 and plugins have been already
405:                 // specified
406:                 $this->setSetting(null, "theme_advanced_buttons1", $this->_aSettings["tinymce-toolbar1"]);
407:                 $this->setSetting(null, "theme_advanced_buttons2", $this->_aSettings["tinymce-toolbar2"]);
408:                 $this->setSetting(null, "theme_advanced_buttons3", $this->_aSettings["tinymce-toolbar3"]);
409:                 $this->setSetting(null, "plugins", $this->_aSettings["tinymce-plugins"]);
410:                 $this->setSetting(null, "theme_advanced_toolbar_location", "bottom");
411: 
412:                 $aCustSettings = getEffectiveSettingsByType("tinymce_custom");
413:                 foreach ($aCustSettings as $key => $value) {
414:                     $this->setSetting(null, $key, $value, true);
415:                 }
416: 
417:                 break;
418:             case "inline_edit":
419:                 $this->setSetting(null, "theme_advanced_buttons1", "bold,italic,underline,strikethrough,separator,undo,separator,bullist,numlist,separator,forecolor,backcolor,separator,justifyleft,justifycenter,justifyright,separator,fullscreen,separator,save,close", true);
420:                 $this->setSetting(null, "theme_advanced_buttons2", "", true);
421:                 $this->setSetting(null, "theme_advanced_buttons3", "", true);
422: 
423:                 $this->setSetting(null, "setupcontent_callback", "Con.Tiny.customSetupContentCallback", true);
424: 
425:                 $this->_unsetSetting("width");
426:                 $this->_unsetSetting("theme_advanced_toolbar_location");
427:                 $this->setSetting(null, "theme_advanced_toolbar_location", "external");
428:                 $this->setSetting(null, "height", "210px", true);
429:                 // close plugin not in plugins directory but still working if listed
430:                 $this->setSetting(null, "plugins", "table,inlinepopups,fullscreen,close", true);
431:                 $this->setSetting(null, "mode", "exact", true);
432:                 $this->setSetting(null, "elements", "*", true);
433:                 $this->setSetting(null, "content_css", $cfgClient[$client]["path"]["htmlpath"] . "css/style_tiny.css", true);
434: 
435:                 if (!array_key_exists("auto_resize", $this->_aSettings)) {
436:                     $this->setSetting(null, "auto_resize", "false", true);
437:                 }
438: 
439:                 if (!array_key_exists("theme_advanced_toolbar_location", $this->_aSettings)) {
440:                     $this->setSetting(null, "theme_advanced_toolbar_location", "top", true);
441:                 }
442: 
443:                 if (!array_key_exists("theme_advanced_resizing_use_cookie", $this->_aSettings)) {
444:                     $this->setSetting(null, "theme_advanced_resizing_use_cookie", "false", true);
445:                 }
446: 
447:                 if (!array_key_exists("theme_advanced_toolbar_align", $this->_aSettings)) {
448:                     $this->setSetting(null, "theme_advanced_toolbar_align", "center", true);
449:                 }
450: 
451:                 $aCustSettings = getEffectiveSettingsByType("tinymce_inline");
452:                 foreach ($aCustSettings as $key => $value) {
453:                     $this->setSetting(null, $key, $value, true);
454:                 }
455: 
456:                 break;
457:             default: // Default options
458:                 $this->setSetting(null, "theme_advanced_buttons1", "undo,redo,|,bold,italic,underline,strikethrough,|,link,unlink,anchor,image,advhr,|,tablecontrols", true);
459:                 $this->setSetting(null, "theme_advanced_buttons2", "styleselect,|,bullist,numlist,|,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,removeformat,|,forecolor,backcolor,|,sub,sup,|,code", true);
460:                 $this->setSetting(null, "theme_advanced_buttons3", "", true);
461:                 $this->setSetting(null, "plugins", "table,advhr,advimage,advlink,searchreplace,contextmenu,paste", true);
462: 
463:                 $aCustSettings = getEffectiveSettingsByType("tinymce_default");
464:                 foreach ($aCustSettings as $key => $value) {
465:                     $this->setSetting(null, $key, $value, true);
466:                 }
467:         }
468:     }
469: 
470:     /**
471:      * Clean urls function
472:      *
473:      */
474:     public function cleanURLs() {
475: 
476:         $sess = cRegistry::getBackendSessionId();
477: 
478:         // Add the path to the following values
479:         $aParameters = array(
480:             //builtin
481:             'content_css', 'popups_css', 'popups_css_add', 'editor_css', // plugins
482:             'plugin_preview_pageurl', //preview plugin
483:             'media_external_list_url', //media plugin
484:             'template_external_list_url' //template plugin
485:         );
486: 
487:         foreach ($aParameters as $sParameter) {
488:             if (array_key_exists($sParameter, $this->_aSettings)) {
489:                 $this->setSetting(null, $sParameter, $this->addPath($this->_aSettings[$sParameter]), true);
490:             }
491:         }
492: 
493:         // Session for template and media support files that are written in PHP
494:         $aParameters = array(
495:             'media_external_list_url', //media plugin
496:             'template_external_list_url' //template plugin
497:         );
498: 
499:         foreach ($aParameters as $sParameter) {
500:             if (array_key_exists($sParameter, $this->_aSettings) && preg_match('/\\.php$/i', $this->_aSettings[$sParameter])) {
501:                 $this->setSetting(null, $sParameter, $this->_aSettings[$sParameter] . '?contenido=' . $sess->id, true);
502:             }
503:         }
504:     }
505: 
506:     /**
507:      * Add path before filename
508:      *
509:      * @param string $file
510:      * @return string
511:      */
512:     public function addPath($file) {
513: 
514:         $cfgClient = cRegistry::getClientConfig();
515:         $client = cRegistry::getClientId();
516: 
517:         // Quick and dirty hack
518:         if (!preg_match('/^(http|https):\/\/((?:[a-zA-Z0-9_-]+\.?)+):?(\d*)/', $file)) {
519:             if (preg_match('/^\//', $file)) {
520:                 $file = "http://" . $_SERVER['HTTP_HOST'] . $file;
521:             } else {
522:                 $file = $cfgClient[$client]['htmlpath']['frontend'] . $file;
523:             }
524:         }
525: 
526:         return $file;
527:     }
528: 
529:     /**
530:      * Set method for base url
531:      *
532:      * @param string $baseUrl
533:      */
534:     public function setBaseURL($baseUrl) {
535:         $this->_baseURL = $baseUrl;
536:     }
537: 
538:     /**
539:      * Get method for scripts
540:      *
541:      * @return string
542:      */
543:     public function getScripts() {
544:         return "\n<!-- tinyMCE -->\n" . '<script language="javascript" type="text/javascript" src="' . $this->_baseURL . 'jscripts/tiny_mce/tiny_mce.js"></script>';
545:     }
546: 
547:     /**
548:      * Get method for editor
549:      *
550:      * @return string
551:      */
552:     public function getEditor() {
553: 
554:         $sess = cRegistry::getSession();
555:         $cfg = cRegistry::getConfig();
556:         $client = cRegistry::getClientId();
557:         $cfgClient = cRegistry::getClientConfig();
558: 
559:         // TODO: Check functionality - doesn't seem to have any effect...
560:         $sess->register("browserparameters");
561: 
562:         // Contenido-specific: Set article_url_suffix setting as it is used in plugins/advlink/jscripts/functions.js on anchor tags
563:         $this->setSetting(null, "setupcontent_callback", 'Con.Tiny.customSetupContentCallback', true);
564:         $this->setSetting(null, "save_callback", 'Con.Tiny.customSaveCallback', true);
565: 
566:         // Set browser windows
567:         // Difference between file and image browser is with (file) or without categories/articles (image)
568:         $template = new cTemplate();
569:         $template->set('s', 'IMAGEBROWSER', $cfg['path']['contenido_fullhtml'] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
570:         $template->set('s', 'FILEBROWSER', $cfg['path']['contenido_fullhtml'] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=filebrowser');
571:         $template->set('s', 'MEDIABROWSER', $cfg['path']['contenido_fullhtml'] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
572:         $template->set('s', 'FRONTEND_PATH', $cfgClient[$client]['path']['htmlpath']);
573: 
574:         // Calculate the configuration
575:         $config = '';
576: 
577:         foreach ($this->_aSettings as $key => $value) {
578:             if (is_bool($value)) {
579:                 if ($value === true) {
580:                     $value = "true";
581:                 } else {
582:                     $value = "false";
583:                 }
584:             }
585: 
586:             if ($value == "true" || $value == "false" || $key == "oninit" || $key == "onpageload" || $key == 'style_formats') {
587:                 $config .= "'$key': " . $value;
588:             } else {
589:                 $config .= "'$key': '" . $value . "'";
590:             }
591:             $config .= ",\n\t";
592:         }
593: 
594:         $config = cString::getPartOfString($config, 0, -3);
595:         $template->set('s', 'CONFIG', $config);
596: 
597:         $oTxtEditor = new cHTMLTextarea($this->_sEditorName, $this->_sEditorContent);
598:         $oTxtEditor->setId($this->_sEditorName);
599: 
600:         $oTxtEditor->setStyle("width: " . $this->_aSettings["width"] . "; height: " . $this->_aSettings["height"] . ";");
601: 
602:         $return = $template->generate($cfg['path']['all_wysiwyg'] . $this->_sEditor . "/tinymce.tpl.html", true);
603:         $return .= $oTxtEditor->render();
604: 
605:         return $return;
606:     }
607: 
608:     /**
609:      * Get method for inline editing
610:      *
611:      * @return string
612:      */
613:     public function getConfigInlineEdit() {
614:         $config = '';
615:         $this->setToolbar('inline_edit');
616: 
617:         foreach ($this->_aSettings as $key => $value) {
618:             if (is_bool($value)) {
619:                 if ($value === true) {
620:                     $value = "true";
621:                 } else {
622:                     $value = "false";
623:                 }
624:             }
625: 
626:             if ($value == "true" || $value == "false" || $key == "oninit" || $key == "onpageload" || $key == 'style_formats') {
627:                 $config .= "'$key': " . $value;
628:             } else {
629:                 $config .= "'$key': '" . $value . "'";
630:             }
631:             $config .= ",\n\t";
632:         }
633: 
634:         $config = cString::getPartOfString($config, 0, -3);
635: 
636:         return $config;
637:     }
638: 
639:     /**
640:      * Get method for fullscreen mode
641:      *
642:      * @return string
643:      */
644:     public function getConfigFullscreen() {
645:         $config = '';
646:         $this->setToolbar('fullscreen');
647: 
648:         $config .= "'theme_advanced_buttons1': '" . $this->_aSettings['theme_advanced_buttons1'] . "',\n";
649:         $config .= "'theme_advanced_buttons2': '" . $this->_aSettings['theme_advanced_buttons2'] . "',\n";
650:         $config .= "'theme_advanced_buttons3': '" . $this->_aSettings['theme_advanced_buttons3'] . "',\n";
651:         $config .= "'theme_advanced_toolbar_align': '" . $this->_aSettings['theme_advanced_toolbar_align'] . "',\n";
652:         $config .= "'plugins': '" . $this->_aSettings['plugins'] . "'\n";
653: 
654:         return $config;
655:     }
656: 
657:     /**
658:      * Get method for plugins
659:      *
660:      * @return array
661:      */
662:     public function getPlugins() {
663:         return $this->_aSettings['plugins'];
664:     }
665: 
666:     /**
667:      * Get method for themes
668:      *
669:      * @return array
670:      */
671:     public function getThemes() {
672:         return $this->_aSettings['theme'];
673:     }
674: 
675: }
676: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0