...where the replacements mean the following:
$1: the file name (eg. "image.gif")
$2: the descriptive name (alt attribute, eg. "Some Image")
$3: the alignment (left, right, center)
$4: the border width (in pixels)
So this string would change
[[image:image.gif:Some Image:left:1]]
into
Alternative replacement strings could be:
(dump the latter two parameters, handle the images through CSS)
(a slight twist on the previous one, this one could generate an image
with class="pivotimage-left" (if the alignment was left).
As noted on pivotlog.net, the last two parameters are kinda deprecated,
so stuff might not always work as it should... I'm not a Pivot guru and
this is just a quick hack.
Contact me if stuff goes wrong; I'll see what I can do.
*/
$DNZM_PITT_REPLACEMENT = '
';
/*
That's all the modification you should do, unless you're 100%
sure of what you're doing...
Don't forget to activate the plugin!
*/
if (!function_exists('DNZM_PITT')) {
function DNZM_PITT($text) {
global $DNZM_PITT_REPLACEMENT;
// in: [[image:image.gif:Some image:center:1]]
// out:
// If the image tag is not there, don't bother replacing stuff,
// just return the text as is.
if (strpos($text, '[[image:') === false) return $text;
// Replace stuff!
$text = preg_replace('/\[\[image:([^:]+):([^:]*):([^:]*):([^:]*)\]\]/', $DNZM_PITT_REPLACEMENT, $text);
return $text;
}
}
add_filter('the_content', 'DNZM_PITT', 6);
?>