Hi,
I am curious about how I can parse the contents of a WordPress post, replace a tag with code and then write the changed contents back into the post.
My concern is that I would like to write a plugin that can embed a certain online service (viewat.org). Parameters would be width, height, an ID and (optinal) the language.
The tag within the post could look somewhat like this:
[embed_viewat width=600 height=400 id=1234 lang=de]
What I need is to
a) find this tag within the post,
b) extract the correct parameter values,
... and here it becomes tricky:
c) The way the .swf-files are used on that website is not XHTML valid. I want to use the KIMILI Flashembed plugin to produce valid SWF object embedding. This means that I want to replace MY tag with the KIMILI Flashembed tag syntax using the extracted parameters. But: this means I would have to put MY plugin before the KIMILI plugin is executed. How on earth do I do THAT?
For finding the tag and extracting the values, I bet I will have to use regular expressions, right? No idea how... never really used them, although I looked up a few resources.
What is better: ereg or preg?
I took a look at the source code of wpvideo, and the preg used there seems VERY complex...
So many questions...
Help would be greatly appreciated!
Thanks! :-)