Re: Wordpress RDFa theme [was: Re: Serving XHTML+RDFa as application/xhtml+xml]

2009/1/29 Toby A Inkster <tai@g5n.co.uk>:
> Sam Kuper wrote:
>> I didn't find such a PHP module, at least not one that I could easily
>> integrate into Wordpress. But it's likely I just haven't looked hard
>> enough...
>
> Is this any help?
>
> http://php.pastebin.com/f3fdc4a6d
>
> Usage: $encoded = xml_entities($plain, $style);
>
> It will always convert ampersand, angled brackets and double quote to the
> XML named entities. Other characters it will convert to numeric entities.
> If $style is set to the string "#x" it will use hexadecimal numbers. If
> style is set to the string "#" or omitted it will use decimal.

Thanks for that. At a glance it seems similar to
http://hsivonen.iki.fi/php-utf8/ - which it what I used in the
Wordpress template - except that yours returns ASCII strings of named
(for predefined XML) or numbered (for other) entities, whereas Henri
Sivonenen's returns the UTF-8 character itself.

I guess it's not terribly important which of those two approaches is
used. The question is more one of where to apply such a function
within a Wordpress template. I'm relatively new to WP, and I haven't
yet found a filter that *all* the XHTML code would be passed through
before being served. So the approach I've taken is to just filter the
most obvious candidates (e.g. user-generated contents), before they're
saved in the database if possible, and to eradicate named SGML
entities from the rest of the template.

This is just a first pass at getting WP to serve XHTML+RDFa as
application/xhtml+xml, though, so it could probably do with a fair
amount of refinement/optimisation :)

I'll be giving it some more thought in the coming weeks. All
suggestions gratefully received!

Thanks again,

Sam

Received on Thursday, 29 January 2009 15:04:14 UTC