ExSponge

Developer

FCGRX

3rd Party (Free)

Creative Commons Attribution Non-Commercial No Derivatives

EE Version Support

  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

Tags

A real-time HTML filter and Rich Text / WYSIWYG / Microsoft Word cleanup plugin for ExpressionEngine. Full featured but dead easy.

This plugin cleans up the mess your clients leave behind!

Whether your markup was entered via WYSIWYG (Rich Text) editors (such as TinyMCE, CKEditor, FCKEditor, Expresso, Wyvern, Wygwam, Blogger’s online editor, and ExpressionEngine’s own built-in Rich Text Editor), pasted in from Microsoft Word or Adobe InDesign, or bulk-imported from XML or another CMS, ExSponge leaves it properly formatted and free of layout-breaking cruft.

It will also optionally remove all tags, or keep only the tags you want. Limit tag parameters too. And you can even trim the fully filtered, cruft-free content down to a specified number of paragraphs.

This plugin is for developers who want neatly formatted paragraphs with minimal, semantic styling, and who do not want the proprietary tags and unnecessary parameters inserted by word processors (or the “tag soup” unwittingly generated by clients) compromising their layout.

Although undoubtedly less comprehensive than HTML TIDY or HTML Purifier, it is also more efficient, easier to set up, and focused on the specific problems you will likely encounter if you give your clients a WYSIWG field with which to edit their channel entries. In my worst-case scenario (a Microsoft Word document exported to HTML and pasted into an EE Rich Text field), ExSponge reduced the data size by 97% without any loss in content.

Some of what is removed by default:

     
  • Word document garbage (including comments, proprietary styles, useless XML tags, “smart” tags, etc.)
  •  
  • Empty tag pairs (including empty paragraphs)
  •  
  • Out-of-scope sections (head, title, style, form, script, object, applet, xml)
  •  
  • Unnecessary or layout-breaking tags (html, iframe, head, style, center, form, object, etc.)
  •  
  • Unnecessary parameters within tags (unless otherwise specified)
  •  
  • Inline styling (unless otherwise specified)
  •  
  • JavaScript (including malicious code)
  •  
  • Non-printing and control characters
  •  
  • Newlines (\n) and linefeeds (\r)
  •  
  • Images with no source
  •  
  • Extra whitespace
  •  
  • Anchor links
  •  
  • Empty lines
  •  
  • PHP

In addition, special HTML entities are converted to their ASCII equivalents, special Word characters are converted to UTF-8, unterminated tags are closed, and non-breaking spaces ( ) are converted to normal spaces. If tables tags are to be removed, table text is reformatted first. Paragraph formatting is given special attention, and missing paragraph start and end tags are inserted where needed.

The final output will be compact, tidy, and ready to use in your layout.

DEMO

A live demonstration of ExSponge is available here:

  http://fcgrx.com/sponge

PARAMETERS

allow_tags - Remove all HTML tags from the markup and leave only raw, unformatted text (“no”), strip most tags but keep the most useful and safe (“safe”, which is the equivalent of “<p><br><b><a><i><em><strong><ul><ol><li><img><h1><h2><h3><h4><h5><h6><blockquote><dl><dt><dd><cite><table><tr><td><th><thead><tbody><tfoot>”), strip most tags but the minimum (“minimal”, which is the equivalent of “<p><br><b><a><i><em><strong><ul><ol><li><img><h1><h2><h3><h4><h5><h6><blockquote>”), or strip all tags except the ones you list. Tip: if you set this parameter to “<p>”, text will be reduced to paragraphs only. Note that out-of-scope tags (html, head, link, header, footer etc) will be removed regardless. Optional; default is “yes”.

allow_breaks - Allow <br> tags to remain (“yes”), or only convert double-breaks (<br><br>) to paragraphs while leaving single breaks alone (“single”), or consolidate them into paragraphs (“no”). Optional; default is “no”.

allow_attributes - Allow tag attributes to remain (“yes”), strip all but the most necessary (“no”, which is the equivalent of “href|src|height|width|alt|title|cite”, or strip all parameters except the ones you list. Optional; default is “no”.

convert_tags - Convert presentational tags <i> and <b> and <s> and <strike> to the semantic <em> and <strong> and <del> and <ins> (“yes”), or leave them as-is (“no”). Optional; default is “yes”.

paragraphs - Clip the text after a specified number of paragraphs. Any positive number (“1”, “4”, “9999”) will cause the text to be trimmed. Optional; default is “-1” (do not clip the text at all).

USAGE

To use this plugin, simply wrap the text you want processed between these tag pairs:

{exp:ex_sponge}
    ( your mess goes here )
{/exp:ex_sponge}

I typically use the above tag (with no parameters) in every template that contains the output of a Rich Text or WYSIWYG field the client is allowed to edit.

A more complex example, which reduces the markup down to the basics, keeps only the first four paragraphs, and takes advantage of EE’s built-in tag caching:

{exp:ex_sponge 
 allow_tags="<p><strong><em><ul><li>"
 paragraphs="4" cache="yes" refresh="1440"}
    ( your mess goes here )
{/exp:ex_sponge}

 

ExSponge Links

This entry was created April 15, 2013, 9:56 am.
This entry was last updated May 27, 2013, 2:38 am.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

1 Review:

Mulkey Design 08.16.13

Mulkey Design
Rating - {addon_rating_average}

Works as advertised. I have a client who cannot stop pasting from Word and reformatting every RTE field. This cleaned it all up in minutes.