Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _processCmsTags
  • addArtspec
  • addslashes_deep
  • 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
  • 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
  • endsWith
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAktuellType
  • 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
  • modTestModule
  • 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
  • setHelpContext
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • stripslashes_deep
  • 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
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • xmlFileToArray
  • 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:  * @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: cInclude("includes", "functions.lang.php");
 19: 
 20: /**
 21:  * The object cTinyMCEEditor is a wrapper class to the TinyMCE WYSIWYG Editor.
 22:  * Attributes can be defined to generate JavaScript options and functions to initialise the global
 23:  * tinyMCE object in file ./contenido/external/wysiwyg/tinymce2/tinymce.tpl.html.
 24:  *
 25:  * All settings accepted by tinyMCE and its plugins may be specified using system, client
 26:  * group or user property/setting.
 27:  *
 28:  * The following parameters will be always set on initialization (even, if they have been specified
 29:  * as property. They can be set using setSetting later on, if needed):
 30:  * document_base_url
 31:  * cleanup_callback (-> XHTML)
 32:  * file_browser_callback
 33:  * external_link_list_url
 34:  * external_image_list_url
 35:  * flash_external_list_url
 36:  *
 37:  * The following settings are only used in CONTENIDO:
 38:  * contenido_toolbar_mode: full, simple, mini, custom
 39:  * contenido_lists: link,image,flash
 40:  * contenido_height_html
 41:  * contenido_height_head
 42:  * See backend.customizing.html for details
 43:  *
 44:  * @package    Core
 45:  * @subpackage Backend
 46:  */
 47: class cTinyMCEEditor extends cWYSIWYGEditor {
 48:     /** Stores base url of page
 49:      */
 50:     var $_sBaseURL;
 51: 
 52:     /** Stores, if GZIP compression will be used
 53:      */
 54:     var $_bUseGZIP = false;
 55: 
 56:     function cTinyMCEEditor($sEditorName, $sEditorContent) {
 57:         global $belang, $cfg, $cfgClient, $client, $lang, $idart;
 58: 
 59:         parent::__construct($sEditorName, $sEditorContent);
 60:         $this->_setEditor("tinymce3");
 61: 
 62:         // Retrieve all settings for tinymce
 63:         $this->_aSettings = getEffectiveSettingsByType("tinymce");
 64: 
 65:         // For compatibility, read settings in previous syntax also (< V4.7, type "wysiwyg" vs. "tinymce")
 66:         $this->_aSettings = array_merge(getEffectiveSettingsByType("wysiwyg"), $this->_aSettings);
 67: 
 68:         $this->_setSetting("article_url_suffix", 'front_content.php?idart=' . $idart, true); # modified 23.10.2006
 69: 
 70:         // Default values
 71:         $this->_setSetting("mode", "exact");
 72:         $aPathFragments = explode('/', $cfgClient[$client]["path"]["htmlpath"]);
 73:         $this->_setSetting("content_css", $cfgClient[$client]["path"]["htmlpath"] . "css/style_tiny.css");
 74: 
 75:         $this->_setSetting("theme", "advanced");
 76:         $this->_setSetting("theme_advanced_toolbar_location", "top");
 77:         $this->_setSetting("theme_advanced_path_location", "bottom");
 78:         $this->_setSetting("remove_script_host", false);
 79:         $this->_setSetting("file_browser_callback", "myCustomFileBrowser", true);
 80:         //$this->_setSetting("urlconverter_callback", "CustomURLConverter");
 81:         // New in V3.x
 82:         $this->_setSetting("theme_advanced_resizing", true);
 83:         $this->_setSetting("pagebreak_separator", "<!-- my page break -->"); // needs pagebreak plugin
 84:         // Source formatting (ugh!)
 85:         $this->_setSetting("apply_source_formatting", true);
 86:         $this->_setSetting("remove_linebreaks", false); // Remove linebreaks - GREAT idea...
 87: 
 88:         // Convert URLs and Relative URLs default
 89:         $this->_setSetting("convert_urls", false);
 90:         $this->_setSetting("relative_urls", false);
 91: 
 92:         // Editor name (a comma spearated list of instances)
 93:         $this->_setSetting("elements", $sEditorName);
 94: 
 95:         // Editor language
 96:         $aLangs = i18nGetAvailableLanguages();
 97:         $this->_setSetting("language", $aLangs[$belang][4]);
 98:         unset($aLangs);
 99: 
100:         // Set document base URL
101:         //$this->setSetting("document_base_url", $cfgClient[$client]["path"]["htmlpath"], true);
102: 
103:         // The following "base URL" is the URL used to reference JS script files
104:         // - it is not the base href value
105:         //$this->setBaseURL(preg_replace('/^https?:\/\/[^\/]+(.*)$/', '$1', $this->_getEditorPath()));
106:         $this->setBaseURL($this->_getEditorPath());
107:         
108:         // XHTML
109:         if (getEffectiveSetting("generator", "xhtml", false) == "true") {
110:             $this->setXHTMLMode(true);
111:         } else {
112:             $this->setXHTMLMode(false);
113:         }
114: 
115:         // GZIP
116:         if ($this->_aSettings["contenido_gzip"] == "true") {
117:             $this->setGZIPMode(true);
118:         } else {
119:             $this->setGZIPMode(false);
120:         }
121: 
122:         // Stylesheet file, for compatibility
123:         if (!array_key_exists("content_css", $this->_aSettings) && array_key_exists("tinymce-stylesheet-file", $this->_aSettings)) {
124:             $this->_setSetting("content_css", $this->_aSettings["tinymce-stylesheet-file"], true);
125:         }
126: 
127:         // Set lists (for links, images and flash elements)
128:         $this->setLists();
129: 
130:         // Set user defined styles (be sure, that previous and SPAW syntax works)
131:         $this->setUserDefinedStyles();
132: 
133:         // Width and height
134:         $this->_setSetting("width", "100%");
135:         $this->_setSetting("height", "480px");
136: 
137:         // Text direction (rtl = right to left)
138:         $sDirection = langGetTextDirection($lang);
139:         $this->_setSetting("directionality", $sDirection);
140: 
141:         if ($sDirection == "rtl") {
142:             $this->_setSetting("theme_advanced_toolbar_align", "right", true);
143:         } else {
144:             $this->_setSetting("theme_advanced_toolbar_align", "left", true);
145:         }
146: 
147:         // Date and time formats
148:         $this->_setSetting("plugin_insertdate_dateFormat", $this->convertFormat(getEffectiveSetting("dateformat", "date", "Y-m-d")));
149:         $this->_setSetting("plugin_insertdate_timeFormat", $this->convertFormat(getEffectiveSetting("dateformat", "time", "H:i:s")));
150: 
151:         // Setting the toolbar (toolbar_mode and tinymce-toolbar-mode accepted)
152:         $sMode = "full";
153:         if (array_key_exists("tinymce-toolbar-mode", $this->_aSettings)) {
154:             $sMode = $this->_aSettings["tinymce-toolbar-mode"];
155:         }
156:         if (array_key_exists("contenido_toolbar_mode", $this->_aSettings)) {
157:             $sMode = $this->_aSettings["contenido_toolbar_mode"];
158:         }
159:         $this->setToolbar(trim(strtolower($sMode)));
160: 
161:         $autoFullElements = $this->_aSettings['auto_full_elements'];
162:         unset($this->_aSettings['auto_full_elements']);
163: 
164:         // Valid elements, for compatibility also accepts "tinymce-valid-elements"
165:         if (!array_key_exists("valid_elements", $this->_aSettings) && array_key_exists("tinymce-valid-elements", $this->_aSettings)) {
166:             $this->_setSetting("valid_elements", $this->_aSettings["tinymce-valid-elements"], true);
167:         }
168: 
169:         // _setSetting checks, if value is empty
170: 
171:         if ($autoFullElements === 'true') {
172:             $this->_setSetting('valid_elements', '*[*]');
173:             $this->_setSetting('extended_valid_elements', '*[*]');
174:         }
175: 
176:         $this->_setSetting("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|border=0|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");
177: 
178:         // Extended valid elements, for compatibility also accepts "tinymce-extended-valid-elements"
179:         if (!array_key_exists("extended_valid_elements", $this->_aSettings) && array_key_exists("tinymce-extended-valid-elements", $this->_aSettings)) {
180:             $this->_setSetting("extended_valid_elements", $this->_aSettings["tinymce-extended-valid-elements"]);
181:         }
182: 
183: 
184:         //print_r($this->_aSettings['valid_elements']);
185: 
186:         $this->_setSetting("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|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]");
187: 
188:         // Background color
189:         if (!array_key_exists("contenido_background_color", $this->_aSettings)) {
190:             if (array_key_exists("tinymce-backgroundcolor", $this->_aSettings)) {
191:                 $this->_setSetting("contenido_background_color", $this->_aSettings["tinymce-backgroundcolor"], true);
192:             } else {
193:                 $this->_setSetting("contenido_background_color", "white", true);
194:             }
195:         }
196: 
197:         // Clean all possible URLs
198:         $this->cleanURLs();
199: 
200:         // Remove CONTENIDO specific settings
201:         // contenido_background_color is used in getEditor
202:         unset($this->_aSettings["contenido_toolbar_mode"], $this->_aSettings["contenido_lists"]);
203:         // Remove obsolete, deprecated values
204:         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"]);
205:     }
206: 
207:     function convertFormat($sInput) {
208:         $aFormatCodes = array(
209:             "y" => "%y", "Y" => "%Y", "d" => "%d", "m" => "%m", "H" => "%H", "h" => "%I", "i" => "%M", "s" => "%S", "a" => "%P", "A" => "%P"
210:         );
211: 
212:         foreach ($aFormatCodes as $sFormatCode => $sReplacement) {
213:             $sInput = str_replace($sFormatCode, $sReplacement, $sInput);
214:         }
215: 
216:         return ($sInput);
217:     }
218: 
219:     function setUserDefinedStyles() {
220:         $sStyles = "";
221: 
222:         if (array_key_exists("theme_advanced_styles", $this->_aSettings)) {
223:             $sStyles = $this->_aSettings["theme_advanced_styles"];
224:         } else if (array_key_exists("tinymce-styles", $this->_aSettings)) {
225:             $sStyles = $this->_aSettings["tinymce-styles"];
226:         }
227: 
228:         if ($sStyles) {
229:             $this->_setSetting("theme_advanced_styles", preg_replace('/;$/i', '', str_replace("|", "=", trim($sStyles))), true);
230:         }
231:     }
232: 
233:     /**
234:      * The special name "contenido_lists", for compatibility also accepts "tinymce-lists"
235:      *
236:      * @param string    sLists    Deprecated, for compatibility, only
237:      */
238:     function setLists($sLists = "") {
239:         global $lang, $client;
240: 
241:         if ($sLists == "") {
242:             if (array_key_exists("contenido_lists", $this->_aSettings)) {
243:                 $sLists = $this->_aSettings["contenido_lists"];
244:             } else if (array_key_exists("tinymce-lists", $this->_aSettings)) {
245:                 $sLists = $this->_aSettings["tinymce-lists"];
246:             }
247:         }
248: 
249:         $aLists = array();
250:         $aLists = explode(",", strtolower(str_replace(" ", "", $sLists)));
251: 
252:         if (in_array("link", $aLists)) {
253:             $this->_setSetting("external_link_list_url", $this->_sBaseURL . "list.php?mode=link&lang=" . $lang . "&client=" . $client . "#", true);
254:         }
255:         if (in_array("image", $aLists)) {
256:             $this->_setSetting("external_image_list_url", $this->_sBaseURL . "list.php?mode=image&lang=" . $lang . "&client=" . $client . "#", true);
257:         }
258:         if (in_array("flash", $aLists)) {
259:             $this->_setSetting("flash_external_list_url", $this->_sBaseURL . "list.php?mode=flash&lang=" . $lang . "&client=" . $client . "#", true);
260:         }
261:         if (in_array("media", $aLists)) {
262:             $this->_setSetting("media_external_list_url", $this->_sBaseURL . "list.php?mode=media&lang=" . $lang . "&client=" . $client . "#", true);
263:         }
264:     }
265: 
266:     function setXHTMLMode($bEnabled = true) {
267:         if ($bEnabled) {
268:             $this->_setSetting("cleanup_callback", "", true);
269:         } else {
270:             $this->_setSetting("cleanup_callback", "CustomCleanupContent", true);
271:         }
272:     }
273: 
274:     function setGZIPMode($bEnabled = true) {
275:         if ($bEnabled) {
276:             $this->_bUseGZIP = true;
277:         } else {
278:             $this->_bUseGZIP = false;
279:         }
280:     }
281: 
282:     /**
283:      * For compatibility also accepts "tinymce-toolbar-mode", "tinymce-toolbar1-3" and "tinymce-plugins"
284:      */
285:     function setToolbar($sMode = "") {
286:         global $cfg, $cfgClient, $client;
287: 
288:         switch ($sMode) {
289:             case "full": // Show all options
290:                 $this->_setSetting("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);
291:                 $this->_setSetting("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);
292:                 $this->_setSetting("theme_advanced_buttons3", "tablecontrols,|,formatselect,fontselect,fontsizeselect,|,styleprops,|,cite,abbr,acronym,del,ins,attribs", true);
293:                 //safari,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
294:                 $this->_setSetting("plugins", "safari,table,save,advhr,advimage,advlink,pagebreak,style,layer,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups", true);
295:                 $this->_setSetting("theme_advanced_toolbar_align", "left", true);
296: 
297:                 $aCustSettings = getEffectiveSettingsByType("tinymce");
298:                 foreach ($aCustSettings as $sKey => $sValue) {
299:                     $this->_setSetting($sKey, $sValue, true);
300:                 }
301: 
302:                 break;
303: 
304:             case "fullscreen": // Show all options
305:                 $this->_setSetting("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);
306:                 $this->_setSetting("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);
307:                 $this->_setSetting("theme_advanced_buttons3", "tablecontrols,|,formatselect,fontselect,fontsizeselect,|,styleprops,|,cite,abbr,acronym,del,ins,attribs", true);
308:                 //safari,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
309:                 $this->_setSetting("plugins", "safari,table,save,advhr,advimage,advlink,pagebreak,style,layer,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups", true);
310:                 $this->_setSetting("theme_advanced_toolbar_align", "left", true);
311: 
312:                 $aCustSettings = getEffectiveSettingsByType("tinymce_fullscreen");
313:                 foreach ($aCustSettings as $sKey => $sValue) {
314:                     $this->_setSetting($sKey, $sValue, true);
315:                 }
316: 
317:                 break;
318: 
319:             case "simple": // Does not show font and table options
320:                 $this->_setSetting("theme_advanced_buttons1", "cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,bold,italic,underline,strikethrough,sub,sup,|,insertdate,inserttime,preview,|,styleselect", true);
321:                 $this->_setSetting("theme_advanced_buttons2", "link,unlink,anchor,image,flash,advhr,|,bullist,numlist,|,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,removeformat,|,forecolor,backcolor,|,ltr,rtl,|,visualaid,charmap,cleanup,|,code", true);
322:                 $this->_setSetting("theme_advanced_buttons3", "", true);
323:                 $this->_setSetting("plugins", "advhr,advimage,advlink,insertdatetime,preview,flash,searchreplace,print,contextmenu,paste,directionality", true);
324: 
325:                 $aCustSettings = getEffectiveSettingsByType("tinymce_simple");
326:                 foreach ($aCustSettings as $sKey => $sValue) {
327:                     $this->_setSetting($sKey, $sValue, true);
328:                 }
329: 
330:                 break;
331: 
332:             case "mini": // Minimal toolbar
333:                 $this->_setSetting("theme_advanced_buttons1", "undo,redo,|,bold,italic,underline,strikethrough,|,link", true);
334:                 $this->_setSetting("theme_advanced_buttons2", "", true);
335:                 $this->_setSetting("theme_advanced_buttons3", "", true);
336: 
337:                 $aCustSettings = getEffectiveSettingsByType("tinymce_mini");
338:                 foreach ($aCustSettings as $sKey => $sValue) {
339:                     $this->_setSetting($sKey, $sValue, true);
340:                 }
341: 
342:                 break;
343: 
344:             case "custom": // Custom toolbar
345:                 // tinymce-toolbar1/2/3 and tinymce-plugins are only mentioned for compatibility
346:                 // They are ignored, if theme_advanced_buttons1/2/3 and plugins have been already
347:                 // specified
348:                 $this->_setSetting("theme_advanced_buttons1", $this->_aSettings["tinymce-toolbar1"]);
349:                 $this->_setSetting("theme_advanced_buttons2", $this->_aSettings["tinymce-toolbar2"]);
350:                 $this->_setSetting("theme_advanced_buttons3", $this->_aSettings["tinymce-toolbar3"]);
351:                 $this->_setSetting("plugins", $this->_aSettings["tinymce-plugins"]);
352:                 $this->_setSetting("theme_advanced_toolbar_location", "bottom");
353: 
354:                 $aCustSettings = getEffectiveSettingsByType("tinymce_custom");
355:                 foreach ($aCustSettings as $sKey => $sValue) {
356:                     $this->_setSetting($sKey, $sValue, true);
357:                 }
358: 
359:                 break;
360: 
361:             case "inline_edit":
362:                 $this->_setSetting("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);
363:                 $this->_setSetting("theme_advanced_buttons2", "", true);
364:                 $this->_setSetting("theme_advanced_buttons3", "", true);
365: 
366:                 $this->_setSetting("setupcontent_callback", "myCustomSetupContent", true);
367: 
368:                 $this->_unsetSetting("width");
369:                 $this->_unsetSetting("theme_advanced_toolbar_location");
370:                 $this->_setSetting("theme_advanced_toolbar_location", "external");
371:                 $this->_setSetting("height", "210px", true);
372:                 $this->_setSetting("plugins", "table,inlinepopups,fullscreen,close", true);
373:                 $this->_setSetting("mode", "exact", true);
374:                 $this->_setSetting("elements", "*", true);
375:                 $this->_setSetting("content_css", $cfgClient[$client]["path"]["htmlpath"] . "css/style_tiny.css", true);
376: 
377:                 if (!array_key_exists("auto_resize", $this->_aSettings)) {
378:                     $this->_setSetting("auto_resize", "false", true);
379:                 }
380: 
381:                 if (!array_key_exists("theme_advanced_toolbar_location", $this->_aSettings)) {
382:                     $this->_setSetting("theme_advanced_toolbar_location", "top", true);
383:                 }
384: 
385:                 if (!array_key_exists("theme_advanced_resizing_use_cookie", $this->_aSettings)) {
386:                     $this->_setSetting("theme_advanced_resizing_use_cookie", "false", true);
387:                 }
388: 
389:                 if (!array_key_exists("theme_advanced_toolbar_align", $this->_aSettings)) {
390:                     $this->_setSetting("theme_advanced_toolbar_align", "center", true);
391:                 }
392: 
393:                 $aCustSettings = getEffectiveSettingsByType("tinymce_inline");
394:                 foreach ($aCustSettings as $sKey => $sValue) {
395:                     $this->_setSetting($sKey, $sValue, true);
396:                 }
397: 
398:                 break;
399: 
400:             default: // Default options
401:                 $this->_setSetting("theme_advanced_buttons1", "undo,redo,|,bold,italic,underline,strikethrough,|,link,unlink,anchor,image,flash,advhr,|,tablecontrols", true);
402:                 $this->_setSetting("theme_advanced_buttons2", "styleselect,|,bullist,numlist,|,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,removeformat,|,forecolor,backcolor,|,sub,sup,|,code", true);
403:                 $this->_setSetting("theme_advanced_buttons3", "", true);
404:                 $this->_setSetting("plugins", "table,advhr,advimage,advlink,flash,searchreplace,contextmenu,paste", true);
405: 
406:                 $aCustSettings = getEffectiveSettingsByType("tinymce_default");
407:                 foreach ($aCustSettings as $sKey => $sValue) {
408:                     $this->_setSetting($sKey, $sValue, true);
409:                 }
410:         }
411:     }
412: 
413:     function cleanURLs() {
414:         global $sess;
415: 
416:         // Add the path to the following values
417:         $aParameters = array(
418:             //builtin
419:             'content_css', 'popups_css', 'popups_css_add', 'editor_css', // plugins
420:             'plugin_preview_pageurl', //preview plugin
421:             'media_external_list_url', //media plugin
422:             'template_external_list_url' //template plugin
423:         );
424: 
425:         foreach ($aParameters as $sParameter) {
426:             if (array_key_exists($sParameter, $this->_aSettings)) {
427:                 $this->_setSetting($sParameter, $this->addPath($this->_aSettings[$sParameter]), true);
428:             }
429:         }
430: 
431:         // Session for template and media support files that are written in PHP
432:         $aParameters = array(
433:             'media_external_list_url', //media plugin
434:             'template_external_list_url' //template plugin
435:         );
436: 
437:         foreach ($aParameters as $sParameter) {
438:             if (array_key_exists($sParameter, $this->_aSettings) && preg_match('/\\.php$/i', $this->_aSettings[$sParameter])) {
439:                 $this->_setSetting($sParameter, $this->_aSettings[$sParameter] . '?contenido=' . $sess->id, true);
440:             }
441:         }
442:     }
443: 
444:     function addPath($sFile) {
445:         global $cfgClient, $client;
446: 
447:         // Quick and dirty hack
448:         if (!preg_match('/^(http|https):\/\/((?:[a-zA-Z0-9_-]+\.?)+):?(\d*)/', $sFile)) {
449:             if (preg_match('/^\//', $sFile)) {
450:                 $sFile = "http://" . $_SERVER['HTTP_HOST'] . $sFile;
451:             } else {
452:                 $sFile = $cfgClient[$client]["htmlpath"]["frontend"] . $sFile;
453:             }
454:         }
455: 
456:         return $sFile;
457:     }
458: 
459:     function setBaseURL($sBaseUrl) {
460:         $this->_sBaseURL = $sBaseUrl;
461:     }
462: 
463:     function _getScripts() {
464:         if ($this->_bUseGZIP) {
465:             $sReturn = "\n<!-- tinyMCE -->\n" . '<script language="javascript" type="text/javascript" src="' . $this->_sBaseURL . 'jscripts/tiny_mce/tiny_mce_gzip.js"></script>';
466:         } else {
467:             $sReturn = "\n<!-- tinyMCE -->\n" . '<script language="javascript" type="text/javascript" src="' . $this->_sBaseURL . 'jscripts/tiny_mce/tiny_mce.js"></script>';
468:         }
469: 
470:         return $sReturn;
471:     }
472: 
473:     function _getEditor() {
474:         global $sess, $cfg, $lang, $client, $idart, $cfgClient;
475: 
476:         // TODO: Check functionality - doesn't seem to have any effect...
477:         $browserparameters = array("restrict_imagebrowser" => array("jpg", "gif", "jpeg", "png"));
478:         $sess->register("browserparameters");
479: 
480:         // Contenido-specific: Set article_url_suffix setting as it is used in plugins/advlink/jscripts/functions.js on anchor tags
481:         $this->_setSetting("setupcontent_callback", 'myCustomSetupContent', true);
482:         $this->_setSetting("save_callback", 'cutFullpath', true);
483: 
484:         // Set browser windows
485:         // Difference between file and image browser is with (file) or without categories/articles (image)
486:         $oTemplate = new cTemplate;
487:         $oTemplate->set('s', 'IMAGEBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
488:         $oTemplate->set('s', 'FILEBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=filebrowser');
489:         $oTemplate->set('s', 'FLASHBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
490:         $oTemplate->set('s', 'MEDIABROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
491:         $oTemplate->set('s', 'FRONTEND_PATH', $cfgClient[$client]["path"]["htmlpath"]);
492: 
493:         // GZIP support options
494:         if ($this->_bUseGZIP) {
495:             $sGZIPScript = "<script language=\"JavaScript\" type=\"text/javascript\">\n" . "    tinyMCE_GZ.init({ \n" . "    plugins : '" . $this->_aSettings["plugins"] . "', \n" . "    themes : '" . $this->_aSettings["theme"] . "', \n" . "    languages : '" . $this->_aSettings["language"] . "', \n" . "    disk_cache : true, \n" . "    debug : false \n" . "});\n" . "</script>\n";
496:             $oTemplate->set('s', 'COMPRESSOR', $sGZIPScript);
497:         } else {
498:             $oTemplate->set('s', 'COMPRESSOR', '');
499:         }
500: 
501:         // Calculate the configuration
502:         $sConfig = '';
503: 
504:         foreach ($this->_aSettings as $sKey => $sValue) {
505:             if (is_bool($sValue)) {
506:                 if ($sValue === true) {
507:                     $sValue = "true";
508:                 } else {
509:                     $sValue = "false";
510:                 }
511:             }
512: 
513:             if ($sValue == "true" || $sValue == "false" || $sKey == "oninit" || $sKey == "onpageload" || $sKey == 'style_formats') {
514:                 $sConfig .= "'$sKey': " . $sValue;
515:             } else {
516:                 $sConfig .= "'$sKey': '" . $sValue . "'";
517:             }
518:             $sConfig .= ",\n\t";
519:         }
520: 
521:         $sConfig = substr($sConfig, 0, -3);
522:         $oTemplate->set('s', 'CONFIG', $sConfig);
523: 
524:         $oTxtEditor = new cHTMLTextarea($this->_sEditorName, $this->_sEditorContent);
525:         $oTxtEditor->setId($this->_sEditorName);
526: 
527:         $sBgColor = $this->_aSettings["contenido_background_color"];
528: 
529:         $oTxtEditor->setStyle("width: " . $this->_aSettings["width"] . "; height: " . $this->_aSettings["height"] . "; background-color: " . $sBgColor . ";");
530: 
531:         $sReturn = $oTemplate->generate($cfg['path']['all_wysiwyg'] . $this->_sEditor . "/tinymce.tpl.html", true);
532:         $sReturn .= $oTxtEditor->render();
533: 
534:         return $sReturn;
535:     }
536: 
537:     function getConfigInlineEdit() {
538:         $sConfig = '';
539:         $this->setToolbar('inline_edit');
540: 
541:         foreach ($this->_aSettings as $sKey => $sValue) {
542:             if (is_bool($sValue)) {
543:                 if ($sValue === true) {
544:                     $sValue = "true";
545:                 } else {
546:                     $sValue = "false";
547:                 }
548:             }
549: 
550:             if ($sValue == "true" || $sValue == "false" || $sKey == "oninit" || $sKey == "onpageload" || $sKey == 'style_formats') {
551:                 $sConfig .= "'$sKey': " . $sValue;
552:             } else {
553:                 $sConfig .= "'$sKey': '" . $sValue . "'";
554:             }
555:             $sConfig .= ",\n\t";
556:         }
557: 
558:         $sConfig = substr($sConfig, 0, -3);
559: 
560:         return $sConfig;
561:     }
562: 
563:     function getConfigFullscreen() {
564:         $sConfig = '';
565:         $this->setToolbar('fullscreen');
566: 
567:         $sConfig .= "'theme_advanced_buttons1': '" . $this->_aSettings['theme_advanced_buttons1'] . "',\n";
568:         $sConfig .= "'theme_advanced_buttons2': '" . $this->_aSettings['theme_advanced_buttons2'] . "',\n";
569:         $sConfig .= "'theme_advanced_buttons3': '" . $this->_aSettings['theme_advanced_buttons3'] . "',\n";
570:         $sConfig .= "'theme_advanced_toolbar_align': '" . $this->_aSettings['theme_advanced_toolbar_align'] . "',\n";
571:         $sConfig .= "'plugins': '" . $this->_aSettings['plugins'] . "'\n";
572: 
573:         return $sConfig;
574:     }
575: }
576: 
577: ?>
CMS CONTENIDO 4.9.2 API documentation generated by ApiGen 2.8.0