RoxenCMS 17System Developer Manual PikeRoxen CMS-Specific Module APIsFCK Editor Filters

     


FCK Editor Filters

Note: For compatibility reasons the FCK Editor name remains despite the switch to CKEditor starting in Roxen CMS 5.4.

By developing a custom HTML post-processing filter you can modify, extend or replace the cleaning that Roxen CMS performs on contents produced with the FCK Editor. This section will describe the programming steps; instructions on activating the filter can be found in the section Managing templates in a Basic site (look for the Controlling the Insite Editor toolbar heading) in the Web Developer Manual.

Your filters should be placed in roxen/local/editorfilter/ so they remain after a server update. It's recommended that you sub-class the default filter in order to reduce the amount of code. The default implementation can be seen in the server-x.x.x/modules/sitebuilder/pike-modules/Sitebuilder.pmod/AppFilter.pmod source file.

Here is an example of a custom filter:

string description() { return "MyFCKFilter"; } class MyFCKFilter { inherit Sitebuilder.AppFilter.FCKFilter; // Extend default filter by mapping <u> to <b> mapping(string:string) normalize_tag = ::normalize_tag + ([ "u" : "b" ]); } string download(string data, void|RequestID id) { return MyFCKFilter()->filter_string_download(data, id); } string upload(string data, void|RequestID id) { return MyFCKFilter()->filter_string(data, id); }

When saved as MyFCKFilter.pike in the aforementioned directory it can then be activated using the following statement in cms-toolbar.xsl:

  <xsl:param name="fck-filter"
             rxml:type="string" select="'MyFCKFilter'"/>

Note: The file MyFCKFilter.pike has to preserve case and exact file name. A restart of Roxen CMS might be needed to avoid overcaching.

Differences between Text & Picture and Table components

The method described in this section works for both to Text & Picture and Table components. To decide which editor your customization applies to, follow these steps:

  • Text & Picture — Inherit AppFilter.FCKFilter and name your XSL parameter fck-filter.

  • Table — Inherit AppFilter.FCKTableFilter and name your XSL parameter fck-table-filter.