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
    • NavigationMain
    • 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
  • generateInfoButton
  • generateJs
  • getAktuellType
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • 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
  • 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: 
107:         // XHTML
108:         if (getEffectiveSetting("generator", "xhtml", false) == "true") {
109:             $this->setXHTMLMode(true);
110:         } else {
111:             $this->setXHTMLMode(false);
112:         }
113: 
114:         // GZIP
115:         if ($this->_aSettings["contenido_gzip"] == "true") {
116:             $this->setGZIPMode(true);
117:         } else {
118:             $this->setGZIPMode(false);
119:         }
120: 
121:         // Stylesheet file, for compatibility
122:         if (!array_key_exists("content_css", $this->_aSettings) && array_key_exists("tinymce-stylesheet-file", $this->_aSettings)) {
123:             $this->_setSetting("content_css", $this->_aSettings["tinymce-stylesheet-file"], true);
124:         }
125: 
126:         // Set lists (for links, images and flash elements)
127:         $this->setLists();
128: 
129:         // Set user defined styles (be sure, that previous and SPAW syntax works)
130:         $this->setUserDefinedStyles();
131: 
132:         // Width and height
133:         $this->_setSetting("width", "100%");
134:         $this->_setSetting("height", "480px");
135: 
136:         // Text direction (rtl = right to left)
137:         $sDirection = langGetTextDirection($lang);
138:         $this->_setSetting("directionality", $sDirection);
139: 
140:         if ($sDirection == "rtl") {
141:             $this->_setSetting("theme_advanced_toolbar_align", "right", true);
142:         } else {
143:             $this->_setSetting("theme_advanced_toolbar_align", "left", true);
144:         }
145: 
146:         // Date and time formats
147:         $this->_setSetting("plugin_insertdate_dateFormat", $this->convertFormat(getEffectiveSetting("dateformat", "date", "Y-m-d")));
148:         $this->_setSetting("plugin_insertdate_timeFormat", $this->convertFormat(getEffectiveSetting("dateformat", "time", "H:i:s")));
149: 
150:         // Setting the toolbar (toolbar_mode and tinymce-toolbar-mode accepted)
151:         $sMode = "full";
152:         if (array_key_exists("tinymce-toolbar-mode", $this->_aSettings)) {
153:             $sMode = $this->_aSettings["tinymce-toolbar-mode"];
154:         }
155:         if (array_key_exists("contenido_toolbar_mode", $this->_aSettings)) {
156:             $sMode = $this->_aSettings["contenido_toolbar_mode"];
157:         }
158:         $this->setToolbar(trim(strtolower($sMode)));
159: 
160:         $autoFullElements = $this->_aSettings['auto_full_elements'];
161:         unset($this->_aSettings['auto_full_elements']);
162: 
163:         // Valid elements, for compatibility also accepts "tinymce-valid-elements"
164:         if (!array_key_exists("valid_elements", $this->_aSettings) && array_key_exists("tinymce-valid-elements", $this->_aSettings)) {
165:             $this->_setSetting("valid_elements", $this->_aSettings["tinymce-valid-elements"], true);
166:         }
167: 
168:         // _setSetting checks, if value is empty
169: 
170:         if ($autoFullElements === 'true') {
171:             $this->_setSetting('valid_elements', '*[*]');
172:             $this->_setSetting('extended_valid_elements', '*[*]');
173:         }
174: 
175:         $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");
176: 
177:         // Extended valid elements, for compatibility also accepts "tinymce-extended-valid-elements"
178:         if (!array_key_exists("extended_valid_elements", $this->_aSettings) && array_key_exists("tinymce-extended-valid-elements", $this->_aSettings)) {
179:             $this->_setSetting("extended_valid_elements", $this->_aSettings["tinymce-extended-valid-elements"]);
180:         }
181: 
182: 
183:         //print_r($this->_aSettings['valid_elements']);
184: 
185:         $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]");
186: 
187:         // Background color
188:         if (!array_key_exists("contenido_background_color", $this->_aSettings)) {
189:             if (array_key_exists("tinymce-backgroundcolor", $this->_aSettings)) {
190:                 $this->_setSetting("contenido_background_color", $this->_aSettings["tinymce-backgroundcolor"], true);
191:             } else {
192:                 $this->_setSetting("contenido_background_color", "white", true);
193:             }
194:         }
195: 
196:         // Clean all possible URLs
197:         $this->cleanURLs();
198: 
199:         // Remove CONTENIDO specific settings
200:         // contenido_background_color is used in getEditor
201:         unset($this->_aSettings["contenido_toolbar_mode"], $this->_aSettings["contenido_lists"]);
202:         // Remove obsolete, deprecated values
203:         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"]);
204:     }
205: 
206:     function convertFormat($sInput) {
207:         $aFormatCodes = array(
208:             "y" => "%y", "Y" => "%Y", "d" => "%d", "m" => "%m", "H" => "%H", "h" => "%I", "i" => "%M", "s" => "%S", "a" => "%P", "A" => "%P"
209:         );
210: 
211:         foreach ($aFormatCodes as $sFormatCode => $sReplacement) {
212:             $sInput = str_replace($sFormatCode, $sReplacement, $sInput);
213:         }
214: 
215:         return ($sInput);
216:     }
217: 
218:     function setUserDefinedStyles() {
219:         $sStyles = "";
220: 
221:         if (array_key_exists("theme_advanced_styles", $this->_aSettings)) {
222:             $sStyles = $this->_aSettings["theme_advanced_styles"];
223:         } else if (array_key_exists("tinymce-styles", $this->_aSettings)) {
224:             $sStyles = $this->_aSettings["tinymce-styles"];
225:         }
226: 
227:         if ($sStyles) {
228:             $this->_setSetting("theme_advanced_styles", preg_replace('/;$/i', '', str_replace("|", "=", trim($sStyles))), true);
229:         }
230:     }
231: 
232:     /**
233:      * The special name "contenido_lists", for compatibility also accepts "tinymce-lists"
234:      *
235:      * @param string    sLists    Deprecated, for compatibility, only
236:      */
237:     function setLists($sLists = "") {
238:         global $lang, $client;
239: 
240:         if ($sLists == "") {
241:             if (array_key_exists("contenido_lists", $this->_aSettings)) {
242:                 $sLists = $this->_aSettings["contenido_lists"];
243:             } else if (array_key_exists("tinymce-lists", $this->_aSettings)) {
244:                 $sLists = $this->_aSettings["tinymce-lists"];
245:             }
246:         }
247: 
248:         $aLists = array();
249:         $aLists = explode(",", strtolower(str_replace(" ", "", $sLists)));
250: 
251:         if (in_array("link", $aLists)) {
252:             $this->_setSetting("external_link_list_url", $this->_sBaseURL . "list.php?mode=link&lang=" . $lang . "&client=" . $client . "#", true);
253:         }
254:         if (in_array("image", $aLists)) {
255:             $this->_setSetting("external_image_list_url", $this->_sBaseURL . "list.php?mode=image&lang=" . $lang . "&client=" . $client . "#", true);
256:         }
257:         if (in_array("flash", $aLists)) {
258:             $this->_setSetting("flash_external_list_url", $this->_sBaseURL . "list.php?mode=flash&lang=" . $lang . "&client=" . $client . "#", true);
259:         }
260:         if (in_array("media", $aLists)) {
261:             $this->_setSetting("media_external_list_url", $this->_sBaseURL . "list.php?mode=media&lang=" . $lang . "&client=" . $client . "#", true);
262:         }
263:     }
264: 
265:     function setXHTMLMode($bEnabled = true) {
266:         if ($bEnabled) {
267:             $this->_setSetting("cleanup_callback", "", true);
268:         } else {
269:             $this->_setSetting("cleanup_callback", "CustomCleanupContent", true);
270:         }
271:     }
272: 
273:     function setGZIPMode($bEnabled = true) {
274:         if ($bEnabled) {
275:             $this->_bUseGZIP = true;
276:         } else {
277:             $this->_bUseGZIP = false;
278:         }
279:     }
280: 
281:     /**
282:      * For compatibility also accepts "tinymce-toolbar-mode", "tinymce-toolbar1-3" and "tinymce-plugins"
283:      */
284:     function setToolbar($sMode = "") {
285:         global $cfg, $cfgClient, $client;
286: 
287:         switch ($sMode) {
288:             case "full": // Show all options
289:                 $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);
290:                 $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);
291:                 $this->_setSetting("theme_advanced_buttons3", "tablecontrols,|,formatselect,fontselect,fontsizeselect,|,styleprops,|,cite,abbr,acronym,del,ins,attribs", true);
292:                 //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
293:                 $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);
294:                 $this->_setSetting("theme_advanced_toolbar_align", "left", true);
295: 
296:                 $aCustSettings = getEffectiveSettingsByType("tinymce");
297:                 foreach ($aCustSettings as $sKey => $sValue) {
298:                     $this->_setSetting($sKey, $sValue, true);
299:                 }
300: 
301:                 break;
302: 
303:             case "fullscreen": // Show all options
304:                 $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);
305:                 $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);
306:                 $this->_setSetting("theme_advanced_buttons3", "tablecontrols,|,formatselect,fontselect,fontsizeselect,|,styleprops,|,cite,abbr,acronym,del,ins,attribs", true);
307:                 //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
308:                 $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);
309:                 $this->_setSetting("theme_advanced_toolbar_align", "left", true);
310: 
311:                 $aCustSettings = getEffectiveSettingsByType("tinymce_fullscreen");
312:                 foreach ($aCustSettings as $sKey => $sValue) {
313:                     $this->_setSetting($sKey, $sValue, true);
314:                 }
315: 
316:                 break;
317: 
318:             case "simple": // Does not show font and table options
319:                 $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);
320:                 $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);
321:                 $this->_setSetting("theme_advanced_buttons3", "", true);
322:                 $this->_setSetting("plugins", "advhr,advimage,advlink,insertdatetime,preview,flash,searchreplace,print,contextmenu,paste,directionality", true);
323: 
324:                 $aCustSettings = getEffectiveSettingsByType("tinymce_simple");
325:                 foreach ($aCustSettings as $sKey => $sValue) {
326:                     $this->_setSetting($sKey, $sValue, true);
327:                 }
328: 
329:                 break;
330: 
331:             case "mini": // Minimal toolbar
332:                 $this->_setSetting("theme_advanced_buttons1", "undo,redo,|,bold,italic,underline,strikethrough,|,link", true);
333:                 $this->_setSetting("theme_advanced_buttons2", "", true);
334:                 $this->_setSetting("theme_advanced_buttons3", "", true);
335: 
336:                 $aCustSettings = getEffectiveSettingsByType("tinymce_mini");
337:                 foreach ($aCustSettings as $sKey => $sValue) {
338:                     $this->_setSetting($sKey, $sValue, true);
339:                 }
340: 
341:                 break;
342: 
343:             case "custom": // Custom toolbar
344:                 // tinymce-toolbar1/2/3 and tinymce-plugins are only mentioned for compatibility
345:                 // They are ignored, if theme_advanced_buttons1/2/3 and plugins have been already
346:                 // specified
347:                 $this->_setSetting("theme_advanced_buttons1", $this->_aSettings["tinymce-toolbar1"]);
348:                 $this->_setSetting("theme_advanced_buttons2", $this->_aSettings["tinymce-toolbar2"]);
349:                 $this->_setSetting("theme_advanced_buttons3", $this->_aSettings["tinymce-toolbar3"]);
350:                 $this->_setSetting("plugins", $this->_aSettings["tinymce-plugins"]);
351:                 $this->_setSetting("theme_advanced_toolbar_location", "bottom");
352: 
353:                 $aCustSettings = getEffectiveSettingsByType("tinymce_custom");
354:                 foreach ($aCustSettings as $sKey => $sValue) {
355:                     $this->_setSetting($sKey, $sValue, true);
356:                 }
357: 
358:                 break;
359: 
360:             case "inline_edit":
361:                 $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);
362:                 $this->_setSetting("theme_advanced_buttons2", "", true);
363:                 $this->_setSetting("theme_advanced_buttons3", "", true);
364: 
365:                 $this->_setSetting("setupcontent_callback", "myCustomSetupContent", true);
366: 
367:                 $this->_unsetSetting("width");
368:                 $this->_unsetSetting("theme_advanced_toolbar_location");
369:                 $this->_setSetting("theme_advanced_toolbar_location", "external");
370:                 $this->_setSetting("height", "210px", true);
371:                 $this->_setSetting("plugins", "table,inlinepopups,fullscreen,close", true);
372:                 $this->_setSetting("mode", "exact", true);
373:                 $this->_setSetting("elements", "*", true);
374:                 $this->_setSetting("content_css", $cfgClient[$client]["path"]["htmlpath"] . "css/style_tiny.css", true);
375: 
376:                 if (!array_key_exists("auto_resize", $this->_aSettings)) {
377:                     $this->_setSetting("auto_resize", "false", true);
378:                 }
379: 
380:                 if (!array_key_exists("theme_advanced_toolbar_location", $this->_aSettings)) {
381:                     $this->_setSetting("theme_advanced_toolbar_location", "top", true);
382:                 }
383: 
384:                 if (!array_key_exists("theme_advanced_resizing_use_cookie", $this->_aSettings)) {
385:                     $this->_setSetting("theme_advanced_resizing_use_cookie", "false", true);
386:                 }
387: 
388:                 if (!array_key_exists("theme_advanced_toolbar_align", $this->_aSettings)) {
389:                     $this->_setSetting("theme_advanced_toolbar_align", "center", true);
390:                 }
391: 
392:                 $aCustSettings = getEffectiveSettingsByType("tinymce_inline");
393:                 foreach ($aCustSettings as $sKey => $sValue) {
394:                     $this->_setSetting($sKey, $sValue, true);
395:                 }
396: 
397:                 break;
398: 
399:             default: // Default options
400:                 $this->_setSetting("theme_advanced_buttons1", "undo,redo,|,bold,italic,underline,strikethrough,|,link,unlink,anchor,image,flash,advhr,|,tablecontrols", true);
401:                 $this->_setSetting("theme_advanced_buttons2", "styleselect,|,bullist,numlist,|,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,removeformat,|,forecolor,backcolor,|,sub,sup,|,code", true);
402:                 $this->_setSetting("theme_advanced_buttons3", "", true);
403:                 $this->_setSetting("plugins", "table,advhr,advimage,advlink,flash,searchreplace,contextmenu,paste", true);
404: 
405:                 $aCustSettings = getEffectiveSettingsByType("tinymce_default");
406:                 foreach ($aCustSettings as $sKey => $sValue) {
407:                     $this->_setSetting($sKey, $sValue, true);
408:                 }
409:         }
410:     }
411: 
412:     function cleanURLs() {
413:         global $sess;
414: 
415:         // Add the path to the following values
416:         $aParameters = array(
417:             //builtin
418:             'content_css', 'popups_css', 'popups_css_add', 'editor_css', // plugins
419:             'plugin_preview_pageurl', //preview plugin
420:             'media_external_list_url', //media plugin
421:             'template_external_list_url' //template plugin
422:         );
423: 
424:         foreach ($aParameters as $sParameter) {
425:             if (array_key_exists($sParameter, $this->_aSettings)) {
426:                 $this->_setSetting($sParameter, $this->addPath($this->_aSettings[$sParameter]), true);
427:             }
428:         }
429: 
430:         // Session for template and media support files that are written in PHP
431:         $aParameters = array(
432:             'media_external_list_url', //media plugin
433:             'template_external_list_url' //template plugin
434:         );
435: 
436:         foreach ($aParameters as $sParameter) {
437:             if (array_key_exists($sParameter, $this->_aSettings) && preg_match('/\\.php$/i', $this->_aSettings[$sParameter])) {
438:                 $this->_setSetting($sParameter, $this->_aSettings[$sParameter] . '?contenido=' . $sess->id, true);
439:             }
440:         }
441:     }
442: 
443:     function addPath($sFile) {
444:         global $cfgClient, $client;
445: 
446:         // Quick and dirty hack
447:         if (!preg_match('/^(http|https):\/\/((?:[a-zA-Z0-9_-]+\.?)+):?(\d*)/', $sFile)) {
448:             if (preg_match('/^\//', $sFile)) {
449:                 $sFile = "http://" . $_SERVER['HTTP_HOST'] . $sFile;
450:             } else {
451:                 $sFile = $cfgClient[$client]["htmlpath"]["frontend"] . $sFile;
452:             }
453:         }
454: 
455:         return $sFile;
456:     }
457: 
458:     function setBaseURL($sBaseUrl) {
459:         $this->_sBaseURL = $sBaseUrl;
460:     }
461: 
462:     function _getScripts() {
463:         if ($this->_bUseGZIP) {
464:             $sReturn = "\n<!-- tinyMCE -->\n" . '<script language="javascript" type="text/javascript" src="' . $this->_sBaseURL . 'jscripts/tiny_mce/tiny_mce_gzip.js"></script>';
465:         } else {
466:             $sReturn = "\n<!-- tinyMCE -->\n" . '<script language="javascript" type="text/javascript" src="' . $this->_sBaseURL . 'jscripts/tiny_mce/tiny_mce.js"></script>';
467:         }
468: 
469:         return $sReturn;
470:     }
471: 
472:     function _getEditor() {
473:         global $sess, $cfg, $lang, $client, $idart, $cfgClient;
474: 
475:         // TODO: Check functionality - doesn't seem to have any effect...
476:         $browserparameters = array("restrict_imagebrowser" => array("jpg", "gif", "jpeg", "png"));
477:         $sess->register("browserparameters");
478: 
479:         // Contenido-specific: Set article_url_suffix setting as it is used in plugins/advlink/jscripts/functions.js on anchor tags
480:         $this->_setSetting("setupcontent_callback", 'myCustomSetupContent', true);
481:         $this->_setSetting("save_callback", 'cutFullpath', true);
482: 
483:         // Set browser windows
484:         // Difference between file and image browser is with (file) or without categories/articles (image)
485:         $oTemplate = new cTemplate;
486:         $oTemplate->set('s', 'IMAGEBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
487:         $oTemplate->set('s', 'FILEBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=filebrowser');
488:         $oTemplate->set('s', 'FLASHBROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
489:         $oTemplate->set('s', 'MEDIABROWSER', $cfg["path"]["contenido_fullhtml"] . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
490:         $oTemplate->set('s', 'FRONTEND_PATH', $cfgClient[$client]["path"]["htmlpath"]);
491: 
492:         // GZIP support options
493:         if ($this->_bUseGZIP) {
494:             $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";
495:             $oTemplate->set('s', 'COMPRESSOR', $sGZIPScript);
496:         } else {
497:             $oTemplate->set('s', 'COMPRESSOR', '');
498:         }
499: 
500:         // Calculate the configuration
501:         $sConfig = '';
502: 
503:         foreach ($this->_aSettings as $sKey => $sValue) {
504:             if (is_bool($sValue)) {
505:                 if ($sValue === true) {
506:                     $sValue = "true";
507:                 } else {
508:                     $sValue = "false";
509:                 }
510:             }
511: 
512:             if ($sValue == "true" || $sValue == "false" || $sKey == "oninit" || $sKey == "onpageload" || $sKey == 'style_formats') {
513:                 $sConfig .= "'$sKey': " . $sValue;
514:             } else {
515:                 $sConfig .= "'$sKey': '" . $sValue . "'";
516:             }
517:             $sConfig .= ",\n\t";
518:         }
519: 
520:         $sConfig = substr($sConfig, 0, -3);
521:         $oTemplate->set('s', 'CONFIG', $sConfig);
522: 
523:         $oTxtEditor = new cHTMLTextarea($this->_sEditorName, $this->_sEditorContent);
524:         $oTxtEditor->setId($this->_sEditorName);
525: 
526:         $sBgColor = $this->_aSettings["contenido_background_color"];
527: 
528:         $oTxtEditor->setStyle("width: " . $this->_aSettings["width"] . "; height: " . $this->_aSettings["height"] . "; background-color: " . $sBgColor . ";");
529: 
530:         $sReturn = $oTemplate->generate($cfg['path']['all_wysiwyg'] . $this->_sEditor . "/tinymce.tpl.html", true);
531:         $sReturn .= $oTxtEditor->render();
532: 
533:         return $sReturn;
534:     }
535: 
536:     function getConfigInlineEdit() {
537:         $sConfig = '';
538:         $this->setToolbar('inline_edit');
539: 
540:         foreach ($this->_aSettings as $sKey => $sValue) {
541:             if (is_bool($sValue)) {
542:                 if ($sValue === true) {
543:                     $sValue = "true";
544:                 } else {
545:                     $sValue = "false";
546:                 }
547:             }
548: 
549:             if ($sValue == "true" || $sValue == "false" || $sKey == "oninit" || $sKey == "onpageload" || $sKey == 'style_formats') {
550:                 $sConfig .= "'$sKey': " . $sValue;
551:             } else {
552:                 $sConfig .= "'$sKey': '" . $sValue . "'";
553:             }
554:             $sConfig .= ",\n\t";
555:         }
556: 
557:         $sConfig = substr($sConfig, 0, -3);
558: 
559:         return $sConfig;
560:     }
561: 
562:     function getConfigFullscreen() {
563:         $sConfig = '';
564:         $this->setToolbar('fullscreen');
565: 
566:         $sConfig .= "'theme_advanced_buttons1': '" . $this->_aSettings['theme_advanced_buttons1'] . "',\n";
567:         $sConfig .= "'theme_advanced_buttons2': '" . $this->_aSettings['theme_advanced_buttons2'] . "',\n";
568:         $sConfig .= "'theme_advanced_buttons3': '" . $this->_aSettings['theme_advanced_buttons3'] . "',\n";
569:         $sConfig .= "'theme_advanced_toolbar_align': '" . $this->_aSettings['theme_advanced_toolbar_align'] . "',\n";
570:         $sConfig .= "'plugins': '" . $this->_aSettings['plugins'] . "'\n";
571: 
572:         return $sConfig;
573:     }
574: }
575: 
576: ?>
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0