FYI, I have finally made an official P'unk Avenue blog post about
pkHtml::simplify with a more complete discussion that focuses just on
that feature:

http://window.punkave.com/2009/09/21/a-better-strip_tags-pkhtmlsimplify/

Thanks for the kind words about the code!

On Sep 16, 3:57 pm, Jake Barnes <lkrub...@geocities.com> wrote:
> Thanks, Tom. I'll post a link to this from my weblog. The HTML
> Simplify is a utility most of us need for a lot of projects. Do you
> have a blog? I'm going to link to the thread on Google Groups, but it
> would seem more normal to post to an announcement on your company
> site.
>
> On Sep 14, 4:36 pm, Sid Bachtiar <sid.bacht...@gmail.com> wrote:
>
>
>
> > Great plugin! Thank you ... I am using it on my project :D
>
> > On Tue, Sep 15, 2009 at 1:59 AM, Tom Boutell <t...@punkave.com> wrote:
>
> > > Unlike most of our plugins, pkToolkitPlugin is a bit of a kitchen
> > > sink. It contains a lot of utility classes, some more experimental
> > > things, and not a lot of documentation. So it's easy to miss the great
> > > stuff that lives there.
>
> > > Better documentation is coming as various items in that plugin mature.
> > > But I'd like to share two particularly useful and stable features that
> > > folks probably don't realize are there:
>
> > > * The pkToolkit:ssh task. This is a convenient way to open up an
> > > interactive ssh connection to any staging or production server
> > > configured in properties.ini. Just type:
>
> > > ./symfony pkToolkit:ssh staging
>
> > > You'll be prompted for the password of the staging site. When the
> > > connection is made, the script automatically changes directory to the
> > > project's directory, which is almost always the next thing you'd do
> > > anyway. And then it becomes a normal interactive shell.
>
> > > Note that the 'expect' utility must be installed on your computer for
> > > this to work, and it probably won't work on a Windows host. Macs come
> > > with expect, and it is an easily installed package on Linux.
>
> > > * The pkHtml class. Many projects allow users to edit content via a
> > > rich text editor. And we all know what happens if the user pastes a
> > > Word document in there: the styles of the page wind up hopelessly
> > > munged. You can use striptags(), but that doesn't clean up the CSS, so
> > > your page is still a mess.
>
> > > A common workaround is to use FCK's "paste as plaintext" mode, which
> > > thwarts attempts to paste rich text from another program. That works,
> > > after a fashion, but it's frustrating for users. And none of the
> > > workarounds help if the user is actively trying to enter inappropriate
> > > HTML in a misguided attempt to re-style their site... then calling you
> > > to fix it for the 500th time.
>
> > > HTML Tidy can do the job, but it has a reputation for being heavy and 
> > > slow.
>
> > > Or... you can just use pkHtml::simplify():
>
> > > pkHtml::simplify($richTextHTML,
> > > "<h3><h4><h5><h6><blockquote><p><a><ul><ol><nl><li><b><i><strong><em><strik
> > >  e><code><hr><br><div><table><thead><caption><tbody><tr><th><td>");
>
> > > If that looks a lot like the arguments to striptags(), you're right.
> > > But pkHtml::simplify() follows up striptags() with a DOMDocument-based
> > > filter that removes attributes too, except for the attributes that
> > > actually make sense to permit for certain tags. Currently this is:
>
> > > A tag -> href and name attributes
> > > img tag -> src attribute
>
> > > You don't have to use pkHtml::simplify() manually, either. Instead,
> > > you can use the sfValidatorHtml validator, also found in pkToolkit,
> > > which allows the above list of tags by default because they are
> > > well-suited to user-entered content (you can change that).
>
> > > pkHtml is much more lightweight than Tidy. On one project we needed to
> > > separately clean hundreds of potential HTML containers in a single XML
> > > document, in real time, before presenting some of that information to
> > > the user. pkHtml::simplify turns that around very quickly indeed.
>
> > > Our pkContextCMSPlugin takes advantage of pkHtml::simplify() to allow
> > > rich text editing without the constant "oops I screwed up my site"
> > > issues that come up without a robust server-side filter.
>
> > > For convenience we also package Dominic Schierlinck's
> > > sfWidgetFormRichTextarea widget. It's meant to be compatible with both
> > > MCE and FCK, although we always use FCK.
>
> > > --
> > > Tom Boutell
> > > P'unk Avenue
> > > 215 755 1330
> > > punkave.com
> > > window.punkave.com
>
> > --
> > Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to